:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #10201b;
  color: #eef8ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #10201b;
}

button, select {
  min-height: 44px;
  border: 1px solid #6f8174;
  border-radius: 8px;
  background: #d7f6df;
  color: #10201b;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

button small {
  display: block;
  margin-top: 2px;
  color: inherit;
  font-weight: 700;
  opacity: 0.78;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px clamp(12px, 3vw, 28px);
  background: rgba(16, 32, 27, 0.96);
  border-bottom: 1px solid #31433a;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.brand small, .module-card p, .intro p, .panel p, .review span {
  display: block;
  color: #b9c9bd;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #65d6a6;
  color: #10201b;
  font-weight: 900;
}

.level-pill {
  white-space: nowrap;
  padding: 10px 12px;
  border: 1px solid #496156;
  border-radius: 999px;
  background: #1b2c26;
  color: #d7f6df;
}

main {
  padding: clamp(14px, 3vw, 28px);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.intro, .panel, .module-card, .result-panel {
  border: 1px solid #3c5147;
  border-radius: 8px;
  background: #172a23;
  padding: clamp(16px, 3vw, 24px);
}

.intro {
  grid-column: span 12;
}

.module-card {
  grid-column: span 4;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.activity {
  grid-column: span 12;
}

h1, h2, h3, p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.5rem);
  line-height: 0.96;
  margin-bottom: 12px;
}

h2 {
  font-size: 1.25rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
}

.stats span {
  padding: 12px;
  border-radius: 8px;
  background: #22362f;
  color: #b9c9bd;
}

.stats b {
  display: block;
  color: #ffffff;
  font-size: 1.35rem;
}

.compact {
  grid-template-columns: repeat(4, minmax(92px, 1fr));
}

.panel-title, .game-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.game-layout {
  display: grid;
  gap: 12px;
}

.yard-wrap {
  position: relative;
  overflow: hidden;
  border: 1px solid #53675c;
  border-radius: 8px;
  background: #26332d;
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1040 / 760;
}

.warning {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f2c94c;
  color: #10201b;
  font-weight: 900;
}

.hud, .touch-controls, .choice-row {
  display: grid;
  gap: 10px;
}

.hud {
  grid-template-columns: repeat(4, 1fr);
}

.hud span {
  padding: 10px;
  border-radius: 8px;
  background: #22362f;
  text-align: center;
}

.touch-controls {
  grid-template-columns: repeat(5, 1fr);
  touch-action: none;
}

.touch-controls button {
  min-height: 64px;
  font-size: 1.4rem;
}

.result-panel {
  border-color: #65d6a6;
}

.inspection-art {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.inspection-art section {
  padding: 12px;
  border: 1px solid #3c5147;
  border-radius: 8px;
  background: #22362f;
}

.component {
  width: 100%;
  margin: 4px 0;
  background: #eef8ef;
}

.component.selected {
  background: #f2c94c;
}

.review {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #3c5147;
  border-radius: 8px;
  background: #22362f;
}

.review.defect {
  border-color: #f2c94c;
}

.review.false {
  border-color: #ee8f77;
}

.quiz button {
  display: block;
  width: 100%;
  margin: 10px 0;
  text-align: left;
  padding: 12px;
}

.danger {
  background: #ee8f77;
}

.rotate-note {
  display: none;
  margin: 0;
  color: #f2c94c;
}

.activity p, .panel > p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #31433a;
}

@media (max-width: 840px) {
  .module-card {
    grid-column: span 12;
  }

  .stats, .compact, .hud, .inspection-art {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    align-items: flex-start;
  }
}

@media (orientation: portrait) and (max-width: 760px) {
  .rotate-note {
    display: block;
  }
}

@media (max-width: 560px) {
  main {
    padding: 10px;
  }

  .brand small {
    display: none;
  }

  .level-pill {
    font-size: 0.85rem;
  }

  .touch-controls {
    grid-template-columns: repeat(5, minmax(52px, 1fr));
  }
}
