:root {
  color: #f4f8f2;
  background: #091613;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --background: #091613;
  --surface: rgba(17, 35, 30, 0.86);
  --surface-light: #1a3a31;
  --border: rgba(208, 231, 208, 0.14);
  --muted: #8ea69b;
  --accent: #d4ee87;
  --accent-dark: #1c2b13;
  --board: #1e765c;
  --board-dark: #175d49;
  --line: rgba(205, 240, 196, 0.2);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(
      circle at 92% 5%,
      rgba(131, 208, 135, 0.15),
      transparent 25rem
    ),
    radial-gradient(
      circle at 5% 46%,
      rgba(212, 238, 135, 0.08),
      transparent 24rem
    ),
    var(--background);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  width: min(100% - 40px, 720px);
  margin: 0 auto;
  padding: 36px 0 34px;
}

.brand {
  display: inline-block;
  margin-bottom: 78px;
  color: #f4f8f2;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.brand span {
  color: var(--muted);
  font-weight: 500;
}

.eyebrow,
.card-kicker {
  margin: 0;
  color: #a9da9c;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.2em;
}

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

h1 {
  margin: 18px 0;
  color: #f6faf5;
  font-size: clamp(3.5rem, 14vw, 6.8rem);
  font-weight: 800;
  letter-spacing: -0.1em;
  line-height: 0.86;
}

h1 em {
  color: var(--accent);
  font-style: normal;
}

.lead {
  margin-bottom: 48px;
  color: #b1c3b9;
  font-size: 1rem;
  line-height: 1.8;
}

.game-card {
  padding: clamp(18px, 4vw, 32px);
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(18px);
}

.card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.card-heading h2 {
  margin: 9px 0 0;
  color: #f2f7f1;
  font-size: 1.3rem;
  letter-spacing: -0.04em;
}

.game-settings {
  display: grid;
  gap: 8px;
}

.difficulty-control {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: right;
}

.difficulty-control select {
  padding: 8px 27px 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  background: var(--surface-light);
  color: #f2f7f1;
  font-size: 0.76rem;
}

.difficulty-control select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(212, 238, 135, 0.15);
}

.scoreboard {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-inline-size: 0;
  margin: 0;
  border-inline: 0;
  padding: 17px 0 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.score-player {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 112px;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  opacity: 0.6;
  transition:
    opacity 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.score-player.is-active {
  border-color: rgba(212, 238, 135, 0.3);
  background: rgba(212, 238, 135, 0.08);
  opacity: 1;
}

.score-disc,
.disc {
  display: block;
  flex: 0 0 auto;
  border-radius: 50%;
}

.score-disc {
  width: 28px;
  height: 28px;
}

.score-disc--black,
.disc--black {
  background: radial-gradient(circle at 35% 30%, #65736d, #111a17 62%);
  box-shadow:
    inset -2px -3px 5px rgba(0, 0, 0, 0.5),
    0 3px 8px rgba(0, 0, 0, 0.28);
}

.score-disc--white,
.disc--white {
  background: radial-gradient(circle at 35% 30%, #ffffff, #bdcdc2 68%);
  box-shadow:
    inset -2px -3px 5px rgba(65, 89, 76, 0.28),
    0 3px 8px rgba(0, 0, 0, 0.22);
}

.score-name {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
}

.score-player strong {
  display: block;
  margin-top: 1px;
  color: #f6faf5;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 1.12rem;
  line-height: 1;
}

.score-divider {
  color: #6e8b7b;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 1.2rem;
}

.status-row {
  display: flex;
  align-items: center;
  min-height: 50px;
  gap: 9px;
}

.status-row p {
  flex: 1;
  margin: 0;
  color: #deebdf;
  font-size: 0.82rem;
  font-weight: 700;
}

.turn-mark {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(212, 238, 135, 0.09);
}

.turn-mark--black {
  background: #18231f;
  border: 1px solid #98ada1;
}

.turn-mark--white {
  background: #f1f8ef;
  border: 1px solid #acc2b1;
}

.thinking-indicator {
  color: var(--accent);
  font-size: 0.7rem;
}

.board-frame {
  min-inline-size: 0;
  margin: 0;
  padding: clamp(6px, 1.5vw, 10px);
  border: 1px solid rgba(212, 238, 135, 0.16);
  border-radius: 17px;
  background: #0a2c23;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.25);
}

.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(205, 240, 196, 0.26);
  border-radius: 9px;
  background: var(--line);
  aspect-ratio: 1;
}

.board-cell {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: var(--board);
  transition: background 140ms ease;
}

.board-cell:disabled {
  cursor: default;
}

.board-cell.is-legal {
  cursor: pointer;
}

.board-cell.is-legal:hover,
.board-cell.is-legal:focus-visible {
  outline: none;
  background: #258366;
}

.board-cell.is-legal:focus-visible {
  box-shadow: inset 0 0 0 3px var(--accent);
}

.disc {
  width: 72%;
  height: 72%;
  animation: place-disc 180ms ease-out;
}

.legal-marker {
  width: 20%;
  height: 20%;
  border: 1px solid rgba(226, 246, 169, 0.6);
  border-radius: 50%;
  background: rgba(212, 238, 135, 0.72);
  box-shadow: 0 0 0 4px rgba(212, 238, 135, 0.09);
}

.game-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 18px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.5;
}

.new-game-button {
  flex: 0 0 auto;
  padding: 11px 14px;
  border: 0;
  border-radius: 11px;
  background: var(--accent);
  color: var(--accent-dark);
  font-size: 0.76rem;
  font-weight: 800;
  transition:
    transform 140ms ease,
    filter 140ms ease;
}

.new-game-button:hover,
.new-game-button:focus-visible {
  filter: brightness(1.07);
  outline: none;
  transform: translateY(-1px);
}

.how-to-play {
  padding: 26px 4px 0;
}

.how-to-play h2 {
  margin: 9px 0 9px;
  color: #e4f0e3;
  font-size: 1rem;
  letter-spacing: -0.03em;
}

.how-to-play p:last-child {
  max-width: 540px;
  margin-bottom: 0;
  color: #8fa89a;
  font-size: 0.78rem;
  line-height: 1.75;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 28px;
  color: #668174;
  font-size: 0.68rem;
}

@keyframes place-disc {
  from {
    opacity: 0;
    transform: scale(0.65);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 28px, 720px);
    padding-top: 26px;
  }

  .brand {
    margin-bottom: 62px;
  }

  .card-heading {
    gap: 12px;
  }

  .card-heading h2 {
    font-size: 1.1rem;
  }

  .scoreboard {
    gap: 8px;
  }

  .score-player {
    min-width: 98px;
  }

  .game-actions {
    align-items: flex-end;
  }

  .page-footer {
    flex-direction: column;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
  }
}
