:root {
  --bg: #efe5cf;
  --bg-deep: #d8c4a2;
  --ink: #22160b;
  --muted: #6e5d4d;
  --accent: #b54324;
  --accent-strong: #8e2a11;
  --line: rgba(44, 24, 10, 0.18);
  --panel: rgba(255, 249, 238, 0.82);
  --shadow: 0 24px 80px rgba(67, 31, 8, 0.16);
  --board: #c9964e;
  --board-line: #5b3617;
  --white-stone: #f8f2e8;
  --black-stone: #17120d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.55), transparent 30%),
    radial-gradient(circle at bottom right, rgba(181, 67, 36, 0.14), transparent 28%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-deep) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92em;
}

.page-shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.hero-copy,
.hero-panel,
.board-panel,
.info-card {
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 28px;
  border-radius: 28px;
}

.eyebrow,
.panel-label,
.toolbar-label,
.card-label {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  color: var(--muted);
}

.hero-copy h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(2.4rem, 5vw, 4.4rem);
  line-height: 0.96;
}

.lead {
  margin: 16px 0 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 28px;
}

.panel-card {
  padding: 16px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(34, 22, 11, 0.08);
}

.panel-value {
  margin: 0;
  font-size: 1rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.72fr);
  gap: 24px;
}

.board-panel {
  padding: 20px;
  border-radius: 28px;
}

.board-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.toolbar-status {
  margin: 0;
  font-size: 1.1rem;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: end;
}

.action-button {
  border: none;
  border-radius: 999px;
  padding: 11px 16px;
  cursor: pointer;
  background: rgba(34, 22, 11, 0.08);
  color: var(--ink);
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.action-button:hover {
  transform: translateY(-1px);
}

.action-button.primary {
  background: var(--accent);
  color: #fff6ef;
}

.action-button.primary:hover {
  background: var(--accent-strong);
}

.action-button.subtle {
  background: rgba(255, 255, 255, 0.68);
}

.board-frame {
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.05)),
    rgba(0, 0, 0, 0.02);
}

.board {
  aspect-ratio: 1;
  width: 100%;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0;
  padding: 12px;
  border-radius: 26px;
  background:
    linear-gradient(var(--board-line), var(--board-line)) 12px calc(100% / 12 / 2 + 12px) / calc(100% - 24px) 1px no-repeat,
    linear-gradient(90deg, var(--board-line), var(--board-line)) calc(100% / 12 / 2 + 12px) 12px / 1px calc(100% - 24px) no-repeat,
    var(--board);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.28),
    inset 0 -12px 24px rgba(79, 47, 15, 0.18);
}

.cell {
  position: relative;
  border: none;
  background: transparent;
  cursor: pointer;
}

.cell::before,
.cell::after {
  content: "";
  position: absolute;
  background: var(--board-line);
  opacity: 0.72;
}

.cell::before {
  width: 1px;
  top: 0;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.cell::after {
  height: 1px;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.cell:hover::before,
.cell:hover::after {
  opacity: 1;
}

.cell[data-piece="1"]::before,
.cell[data-piece="1"]::after,
.cell[data-piece="2"]::before,
.cell[data-piece="2"]::after {
  opacity: 0.5;
}

.stone {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  box-shadow:
    inset 0 3px 5px rgba(255, 255, 255, 0.16),
    inset 0 -6px 8px rgba(0, 0, 0, 0.16),
    0 6px 12px rgba(0, 0, 0, 0.14);
  z-index: 1;
  animation: stone-in 180ms ease;
}

.stone.black {
  background: radial-gradient(circle at 35% 30%, #5c534d, var(--black-stone) 58%);
}

.stone.white {
  background: radial-gradient(circle at 35% 30%, #ffffff, var(--white-stone) 58%);
}

.side-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.info-card {
  padding: 20px;
  border-radius: 24px;
}

.card-body {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

@keyframes stone-in {
  from {
    transform: scale(0.72);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 920px) {
  .page-shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 20px;
  }

  .hero,
  .layout {
    grid-template-columns: 1fr;
  }

  .board-toolbar {
    flex-direction: column;
  }

  .toolbar-actions {
    justify-content: start;
  }
}
