:root {
  --bg-deep: #1f1a15;
  --bg-mid: #4d3118;
  --panel: rgba(247, 242, 231, 0.96);
  --panel-soft: rgba(252, 248, 240, 0.94);
  --ink: #201811;
  --muted: #65584c;
  --line: rgba(44, 26, 10, 0.16);
  --wood-light: #d6a663;
  --wood-mid: #b97a34;
  --wood-deep: #8d5722;
  --stone-black: #1a1e24;
  --stone-white: #f8f1e4;
  --stone-rim: #d9c6a2;
  --shadow: 0 22px 48px rgba(11, 7, 4, 0.28);
  --go-cell-size: clamp(34px, 6vw, 58px);
  --go-grid-size: 9;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 10%, rgba(238, 202, 132, 0.18), transparent 20%),
    radial-gradient(circle at 86% 12%, rgba(160, 102, 44, 0.16), transparent 18%),
    linear-gradient(155deg, var(--bg-deep), var(--bg-mid));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.03), transparent 28%),
    linear-gradient(rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 80px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0, rgba(255, 255, 255, 0.018) 1px, transparent 1px, transparent 80px);
  pointer-events: none;
  opacity: 0.3;
}

.go-app {
  width: min(1220px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.go-topbar,
.go-controls-panel,
.board-panel,
.player-card,
.rules-card,
.go-seo-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.go-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 24px;
}

.go-topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.go-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--ink);
}

.go-brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f5d89d, var(--wood-mid));
  color: #1a130d;
  font-weight: 900;
}

.go-brand-copy {
  display: grid;
  gap: 2px;
}

.go-brand-copy strong {
  font-size: 1.04rem;
}

.go-brand-copy span {
  color: var(--muted);
  font-size: 0.92rem;
}

.go-return,
.go-support,
.action-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(31, 24, 17, 0.12);
  border-radius: 999px;
  text-decoration: none;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, opacity 140ms ease;
}

.go-return,
.action-button {
  background: linear-gradient(145deg, #fcf9f2, #eadcc9);
  color: var(--ink);
}

.go-support {
  background: linear-gradient(145deg, #ffdc42, #f0b90a);
  color: #24150f;
}

.action-button.primary {
  background: linear-gradient(145deg, #f1cf91, var(--wood-mid));
  color: #1f160f;
}

.go-return:hover,
.go-return:focus-visible,
.go-support:hover,
.go-support:focus-visible,
.action-button:hover,
.action-button:focus-visible {
  transform: translateY(-1px);
}

.action-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.go-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(380px, 1.08fr);
  gap: 20px;
  align-items: start;
  padding: 28px 0 18px;
}

.eyebrow {
  margin: 0 0 12px;
  color: rgba(255, 245, 230, 0.78);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow.dark {
  color: #836548;
}

.go-copy h1,
.status-copy h2,
.rules-card h3,
.result-overlay h2,
.go-seo-card h2 {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", serif;
}

.go-copy h1 {
  margin: 0 0 14px;
  max-width: 13ch;
  color: #fff8ec;
  font-size: clamp(2.3rem, 5vw, 4.6rem);
  line-height: 0.95;
}

.go-copy p:last-child {
  margin: 0;
  max-width: 60ch;
  color: rgba(250, 242, 232, 0.86);
  line-height: 1.65;
}

.go-controls-panel {
  border-radius: 30px;
  padding: 22px;
}

.status-copy h2 {
  margin: 0;
  font-size: clamp(1.28rem, 2.4vw, 1.82rem);
  line-height: 1.12;
}

.notice-text,
.mode-hint {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.setup-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) repeat(2, minmax(150px, 0.5fr));
  gap: 16px;
  align-items: end;
  margin-top: 18px;
}

.setup-group,
.select-field {
  display: grid;
  gap: 10px;
}

.setup-label {
  margin: 0;
  color: #6c4f33;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mode-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.choice-pill {
  position: relative;
  display: inline-flex;
  min-height: 48px;
  align-items: center;
}

.choice-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-pill span {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid rgba(31, 24, 17, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  font-weight: 700;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.choice-pill:hover span,
.choice-pill input:focus-visible + span {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(31, 24, 17, 0.12);
}

.choice-pill input:checked + span {
  background: linear-gradient(145deg, #5e3a1a, #8d5722);
  color: #fff7ea;
  border-color: rgba(94, 58, 26, 0.4);
}

.select-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(31, 24, 17, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.select-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.metric-card {
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(31, 24, 17, 0.08);
}

.metric-card span {
  display: block;
  margin-bottom: 6px;
  color: #81654d;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-card strong {
  font-size: 1.34rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.go-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(300px, 0.68fr);
  gap: 20px;
  align-items: start;
}

.board-panel,
.player-card,
.rules-card {
  border-radius: 30px;
}

.board-panel {
  padding: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 32%),
    var(--panel);
}

.board-shell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
  padding: 14px;
  border-radius: 26px;
  overflow: auto;
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.18), transparent 18%),
    linear-gradient(145deg, rgba(240, 208, 150, 0.5), rgba(170, 112, 43, 0.22));
}

.go-board-grid {
  --go-padding: calc(var(--go-cell-size) / 2);
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--go-grid-size), var(--go-cell-size));
  grid-template-rows: repeat(var(--go-grid-size), var(--go-cell-size));
  width: max-content;
  padding: var(--go-padding);
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 26%),
    linear-gradient(145deg, var(--wood-light), var(--wood-mid) 62%, var(--wood-deep));
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.2),
    0 18px 34px rgba(41, 23, 8, 0.22);
}

.go-board-grid.size-13 {
  --go-cell-size: clamp(24px, 4.2vw, 40px);
}

.go-cell {
  position: relative;
  width: var(--go-cell-size);
  height: var(--go-cell-size);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.go-cell::before,
.go-cell::after {
  content: "";
  position: absolute;
  background: rgba(70, 41, 16, 0.78);
  pointer-events: none;
}

.go-cell::before {
  left: 0;
  right: 0;
  top: calc(50% - 1px);
  height: 2px;
}

.go-cell::after {
  top: 0;
  bottom: 0;
  left: calc(50% - 1px);
  width: 2px;
}

.go-cell.edge-left::before {
  left: 50%;
}

.go-cell.edge-right::before {
  right: 50%;
}

.go-cell.edge-top::after {
  top: 50%;
}

.go-cell.edge-bottom::after {
  bottom: 50%;
}

.go-cell:focus-visible {
  outline: 3px solid rgba(255, 242, 220, 0.8);
  outline-offset: -2px;
  z-index: 4;
}

.go-cell.empty-playable:hover,
.go-cell.empty-playable:focus-visible {
  z-index: 3;
}

.go-cell.empty-playable:hover .go-placement-hint,
.go-cell.empty-playable:focus-visible .go-placement-hint {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.05);
}

.go-placement-hint,
.go-star-point,
.go-stone {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.go-placement-hint {
  width: calc(var(--go-cell-size) * 0.28);
  height: calc(var(--go-cell-size) * 0.28);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 140ms ease, transform 140ms ease;
}

.go-board-grid.black-turn .go-placement-hint {
  background: rgba(26, 30, 36, 0.28);
}

.go-board-grid.white-turn .go-placement-hint {
  background: rgba(248, 241, 228, 0.7);
  box-shadow: 0 0 0 1px rgba(94, 58, 26, 0.18);
}

.go-star-point {
  width: calc(var(--go-cell-size) * 0.18);
  height: calc(var(--go-cell-size) * 0.18);
  border-radius: 50%;
  background: rgba(70, 41, 16, 0.82);
}

.go-stone {
  width: calc(var(--go-cell-size) * 0.78);
  height: calc(var(--go-cell-size) * 0.78);
  border-radius: 50%;
  box-shadow: 0 10px 16px rgba(18, 10, 5, 0.2);
}

.go-stone.black {
  background: radial-gradient(circle at 30% 28%, #49505a, var(--stone-black) 58%, #08090c);
  box-shadow:
    inset -6px -8px 14px rgba(0, 0, 0, 0.5),
    inset 4px 4px 8px rgba(255, 255, 255, 0.08),
    0 10px 16px rgba(18, 10, 5, 0.24);
}

.go-stone.white {
  background: radial-gradient(circle at 30% 28%, #ffffff, var(--stone-white) 60%, #d4c2a5);
  box-shadow:
    inset -6px -8px 12px rgba(0, 0, 0, 0.12),
    inset 4px 4px 8px rgba(255, 255, 255, 0.78),
    0 10px 16px rgba(18, 10, 5, 0.16);
  border: 1px solid rgba(126, 102, 68, 0.18);
}

.go-stone.last-move {
  box-shadow:
    0 0 0 4px rgba(255, 236, 182, 0.4),
    0 10px 16px rgba(18, 10, 5, 0.24);
}

.go-sidebar {
  display: grid;
  gap: 18px;
}

.player-card,
.rules-card {
  padding: 18px 20px;
}

.player-card {
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.player-card.active {
  transform: translateY(-2px);
  background: var(--panel-soft);
}

.player-card.winner {
  background:
    linear-gradient(145deg, rgba(241, 207, 145, 0.34), rgba(255, 255, 255, 0.64)),
    var(--panel-soft);
}

.player-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.player-token {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-block;
}

.token-black {
  background: radial-gradient(circle at 30% 28%, #49505a, var(--stone-black) 58%, #08090c);
}

.token-white {
  background: radial-gradient(circle at 30% 28%, #ffffff, var(--stone-white) 60%, #d4c2a5);
  border: 1px solid rgba(126, 102, 68, 0.18);
}

.player-name {
  margin: 0 0 2px;
  font-size: 1.08rem;
  font-weight: 800;
}

.player-role {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.player-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.player-stats div {
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.5);
}

.player-stats dt {
  margin: 0 0 8px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.player-stats dd {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 800;
}

.rules-card h3 {
  margin: 0 0 14px;
  font-size: 1.12rem;
}

.rules-list,
.content-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.result-overlay {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(92%, 420px);
  padding: 22px 20px 18px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(31, 24, 17, 0.14);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 234, 219, 0.98)),
    var(--panel-soft);
  box-shadow:
    0 20px 34px rgba(29, 18, 9, 0.24),
    inset 0 0 0 2px rgba(255, 249, 238, 0.72);
  text-align: center;
  z-index: 10;
  animation: overlay-pop 260ms ease-out;
}

.result-overlay[hidden] {
  display: none;
}

.overlay-kicker {
  margin: 0 0 6px;
  color: #936a35;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.result-overlay h2 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1;
}

.overlay-message {
  margin: 0 auto;
  max-width: 30ch;
  color: #5d5247;
  line-height: 1.55;
}

.overlay-scores {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.overlay-scores span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(31, 24, 17, 0.08);
  font-weight: 800;
}

.overlay-details {
  margin: 14px 0 0;
  color: #6a5c51;
  line-height: 1.55;
}

.overlay-actions {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.go-seo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.go-seo-card {
  position: relative;
  display: grid;
  gap: 14px;
  padding: 20px 22px;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), transparent 38%),
    var(--panel-soft);
}

.go-seo-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: linear-gradient(180deg, var(--wood-light), var(--wood-deep));
}

.go-seo-card-wide {
  grid-column: 1 / -1;
}

.go-seo-card h2 {
  margin: 0;
  font-size: 1.28rem;
  line-height: 1.16;
}

.go-seo-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.go-faq-list {
  display: grid;
  gap: 14px;
  margin: 0;
}

.go-faq-list div {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(31, 24, 17, 0.08);
}

.go-faq-list dt {
  margin: 0 0 6px;
  font-weight: 800;
}

.go-faq-list dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.go-seo-card a {
  color: #7b4d1d;
  font-weight: 800;
  text-decoration-thickness: 2px;
}

@keyframes overlay-pop {
  from {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@media (max-width: 1080px) {
  .go-hero,
  .go-layout,
  .go-seo {
    grid-template-columns: 1fr;
  }

  .setup-panel {
    grid-template-columns: 1fr 1fr;
  }

  .setup-group {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .go-app {
    width: min(100% - 20px, 760px);
    padding: 18px 0 34px;
  }

  .go-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .go-topbar-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .go-copy h1 {
    max-width: none;
  }

  .setup-panel,
  .metric-grid,
  .action-row,
  .player-stats,
  .overlay-actions {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .go-return,
  .go-support,
  .action-button {
    width: 100%;
  }

  .board-panel {
    padding: 16px;
  }

  .board-shell {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  :root {
    --go-cell-size: clamp(28px, 8vw, 42px);
  }

  .go-board-grid.size-13 {
    --go-cell-size: clamp(20px, 5.8vw, 30px);
  }

  .go-controls-panel,
  .player-card,
  .rules-card,
  .go-seo-card {
    padding-left: 16px;
    padding-right: 16px;
  }

  .result-overlay {
    width: calc(100% - 14px);
    padding: 18px 14px 14px;
  }
}
