:root {
  --bg: #f7f1e7;
  --card: #fffaf2;
  --text: #2f261d;
  --muted: #6d6254;
  --line: #5d3b16;
  --wood-a: #f1c06d;
  --wood-b: #c9944d;
  --wood-c: #8f5c2a;
  --black: #111827;
  --white: #f8fafc;
  --accent: #4fa377;
  --gold: #e8c36a;
  --danger: #cc4b4b;
  --shadow: 0 14px 34px rgba(67, 48, 26, 0.12);
  --radius: 26px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', Arial, sans-serif;
  background: linear-gradient(180deg, #fcf8f1 0%, #f4ebdd 100%);
  color: var(--text);
}
button, select { font: inherit; }
.site-header { background: #fffdf8; border-bottom: 1px solid #ecdfca; position: sticky; top: 0; z-index: 20; }
.header-inner, .footer-inner, .page-shell { max-width: 1360px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; }
.brand-wrap { display: flex; flex-direction: column; gap: 4px; }
.brand { text-decoration: none; color: var(--text); font-size: 1.5rem; font-weight: 800; }
.tagline { color: var(--muted); font-weight: 700; letter-spacing: 0.14em; font-size: 0.8rem; }
.site-nav, .footer-links { display: flex; gap: 14px; flex-wrap: wrap; }
.site-nav a, .footer-links a, .breadcrumb-bar a { text-decoration: none; color: var(--text); font-weight: 600; font-size: 0.95rem; }
.site-nav a:hover, .footer-links a:hover, .breadcrumb-bar a:hover, .brand:hover { opacity: 0.78; }
.page-shell { padding-top: 18px; padding-bottom: 46px; }
.breadcrumb-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 0.92rem; margin-bottom: 16px; }
.hero-card, .game-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.hero-card { padding: 24px; margin-bottom: 22px; text-align: center; }
.eyebrow { margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.8rem; font-weight: 800; }
.hero-card h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.1rem); line-height: 1.08; }
.hero-copy { margin: 12px auto 0; max-width: 850px; color: var(--muted); line-height: 1.6; }

.game-layout {
  --side-panel-eye-level-offset: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(270px, 23vw, 315px);
  gap: 18px;
  align-items: start;
}
.game-card { padding: 20px; }
.board-card { min-width: 0; }
.side-panel { width: 100%; max-width: 315px; justify-self: end; padding: 18px; margin-top: var(--side-panel-eye-level-offset); }
.game-toolbar { display: flex; justify-content: space-between; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar-label, .mini-label, .field-label { font-size: 0.82rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.toolbar-value { font-size: 1.7rem; font-weight: 800; }
.turn-row { display: flex; align-items: center; gap: 10px; }
.stone-indicator { width: 22px; height: 22px; border-radius: 999px; display: inline-block; border: 2px solid rgba(0,0,0,0.18); box-shadow: 0 3px 8px rgba(0,0,0,0.18); }
.stone-indicator.black { background: radial-gradient(circle at 35% 25%, #4b5563, #070707); }
.stone-indicator.white { background: radial-gradient(circle at 35% 25%, #ffffff, #dbe1e8); }
.toolbar-actions, .side-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.action-button { appearance: none; border: 0; border-radius: 999px; padding: 11px 16px; font-weight: 800; background: var(--text); color: #fff; cursor: pointer; transition: transform 0.15s ease, opacity 0.15s ease; }
.action-button.secondary { background: #efe1c4; color: var(--text); }
.action-button:hover { transform: translateY(-1px); }
.action-button:disabled { opacity: 0.48; cursor: not-allowed; transform: none; }

.board-shell { overflow: auto; padding: 10px 0 12px; display: flex; justify-content: center; }
canvas {
  display: block;
  width: min(100%, 820px);
  min-width: 340px;
  height: auto;
  border-radius: 30px;
  background: var(--wood-b);
  box-shadow:
    inset 0 5px 0 rgba(255,255,255,0.24),
    inset 0 -10px 0 rgba(86, 49, 18, 0.2),
    0 22px 42px rgba(67, 48, 26, 0.24);
}

.side-panel section + section { margin-top: 17px; padding-top: 17px; border-top: 1px solid #eadcc3; }
.side-panel h2 { margin: 0 0 10px; font-size: 1.12rem; }
.side-panel p, .side-panel li { color: var(--muted); line-height: 1.55; }
.side-panel ul { margin: 0; padding-left: 18px; }
.settings-panel { display: grid; gap: 8px; }
.select-input { width: 100%; border: 1px solid #e5d4b7; background: #fffdf8; border-radius: 14px; padding: 10px 12px; color: var(--text); font-weight: 700; }
.toggle-row { display: flex; align-items: center; gap: 9px; color: var(--muted); font-weight: 700; margin-top: 4px; }
.status-banner { background: #fffdf8; color: #5e523f; border: 1px solid #eadcc3; border-radius: 16px; padding: 9px 11px; font-weight: 800; min-height: 38px; display: flex; align-items: center; line-height: 1.35; }
.status-banner.warning { background: #fff3d8; border-color: #ecc46d; color: #7b4b00; }
.status-banner.finished { background: #ffe5df; border-color: #efb4a6; color: #8b2b19; }
.side-status-wrap { margin-top: 8px; }
.side-status { margin-top: 5px; }
.score-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.score-box { background: #fffdf8; border: 1px solid #eadcc3; border-radius: 16px; padding: 10px; display: grid; gap: 4px; }
.score-box span { color: var(--muted); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.score-box strong { font-size: 1.35rem; }
.small-note { font-size: 0.9rem; margin: 9px 0 0; }
.section-heading-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.text-button { border: 0; background: transparent; color: var(--muted); font-weight: 800; cursor: pointer; padding: 0; }
.text-button:hover { color: var(--text); }
.move-log { margin: 0; padding: 10px 10px 10px 32px; max-height: 210px; overflow-y: auto; background: #fffdf8; border: 1px solid #eadcc3; border-radius: 16px; color: var(--muted); }
.move-log li { margin-bottom: 7px; line-height: 1.45; }
.move-log li:last-child { color: var(--text); font-weight: 800; }
details summary { cursor: pointer; font-weight: 800; }
.site-footer { border-top: 1px solid #ecdfca; background: #fffdf8; }
.footer-inner { padding-top: 18px; padding-bottom: 18px; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 0.95rem; }
.footer-brand { color: var(--text); font-weight: 800; margin-bottom: 4px; }
.footer-tagline { color: var(--muted); }

@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
  .side-panel { max-width: none; justify-self: stretch; margin-top: 0; }
}
@media (max-width: 640px) {
  .header-inner { justify-content: center; text-align: center; }
  .brand-wrap, .footer-brand-block { width: 100%; text-align: center; }
  .site-nav, .footer-links, .breadcrumb-bar { justify-content: center; }
  .page-shell { padding-top: 16px; padding-bottom: 28px; }
  .hero-card, .game-card { border-radius: 20px; padding: 14px; }
  .toolbar-value { font-size: 1.35rem; }
  .score-grid { grid-template-columns: 1fr; }
  canvas { min-width: 310px; }
  .footer-inner { justify-content: center; text-align: center; }
}
