:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #64748b;
  --line: #d5dbe7;
  --board: #e7ebf1;
  --board-edge: #c8d1dc;
  --pit: #fbfcff;
  --seed: #1d2433;
  --human: #0f766e;
  --human-soft: #d7f4ef;
  --computer: #b84a62;
  --computer-soft: #fde2e8;
  --focus: #f5c84c;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(246, 247, 251, 0.96)),
    var(--bg);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
  align-items: center;
}

.scoreboard {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr minmax(120px, 180px);
  gap: 16px;
  align-items: stretch;
}

.score,
.game-status {
  min-height: 92px;
  border: 1px solid var(--line);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.score {
  padding: 16px;
}

.score-label {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-transform: uppercase;
}

.score strong {
  margin-top: 6px;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1;
}

.score.is-winner {
  border-color: var(--focus);
}

.game-status {
  padding: 16px 20px;
  text-align: center;
}

.turn-label,
.status-message {
  margin: 0;
}

.turn-label {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
}

.status-message {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.45;
}

.board-wrap {
  width: 100%;
  overflow-x: auto;
  padding: 12px 0;
}

.board {
  min-width: 720px;
  min-height: 330px;
  padding: 18px;
  border: 2px solid var(--board-edge);
  background: var(--board);
  display: grid;
  grid-template-columns: minmax(86px, 0.8fr) repeat(6, minmax(76px, 1fr)) minmax(86px, 0.8fr);
  grid-template-rows: repeat(2, minmax(132px, 1fr));
  gap: 12px;
}

.pit {
  position: relative;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  background: var(--pit);
  color: var(--ink);
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: center;
  justify-items: center;
  overflow: hidden;
}

.house {
  width: 100%;
  min-height: 132px;
  padding: 10px;
  cursor: default;
}

.house.is-legal {
  cursor: pointer;
  border-color: var(--human);
  box-shadow: inset 0 0 0 3px var(--human-soft);
}

.house.is-legal:hover,
.house.is-legal:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  transform: translateY(-1px);
}

.house.is-disabled {
  opacity: 0.76;
}

.house.computer {
  box-shadow: inset 0 0 0 3px var(--computer-soft);
}

.store {
  min-height: 100%;
  padding: 12px 8px;
}

.store.computer {
  grid-column: 1;
  grid-row: 1 / span 2;
  box-shadow: inset 0 0 0 3px var(--computer-soft);
}

.store.human {
  grid-column: 8;
  grid-row: 1 / span 2;
  box-shadow: inset 0 0 0 3px var(--human-soft);
}

.pit-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}

.pit-count {
  width: min(52px, 100%);
  min-height: 32px;
  margin-top: 6px;
  border-radius: 999px;
  background: #edf1f7;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  font-weight: 900;
}

.seed-bed {
  width: 100%;
  min-height: 58px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-content: center;
  justify-content: center;
}

.seed {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.7), transparent 32%),
    var(--seed);
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.28);
}

.controls {
  display: flex;
  justify-content: center;
}

.new-game-button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.new-game-button:hover,
.new-game-button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 20px, 560px);
    padding: 18px 0;
    gap: 16px;
  }

  .scoreboard {
    grid-template-columns: 1fr 1fr;
  }

  .game-status {
    grid-column: 1 / -1;
    grid-row: 1;
    min-height: 88px;
  }

  .score {
    grid-row: 2;
  }

  .board {
    min-width: 650px;
    min-height: 300px;
    grid-template-columns: minmax(78px, 0.8fr) repeat(6, minmax(66px, 1fr)) minmax(78px, 0.8fr);
    grid-template-rows: repeat(2, minmax(120px, 1fr));
    gap: 8px;
    padding: 12px;
  }

  .house {
    min-height: 120px;
  }
}
