:root {
  color: #172321;
  background: #f3f1ea;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  --ink: #172321;
  --muted: #6c7672;
  --paper: #fffefa;
  --cream: #f3f1ea;
  --line: #d8dbd3;
  --green: #19594b;
  --green-dark: #0f4036;
  --lime: #dff26c;
  --orange: #e67928;
  --wood: #d9ae71;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; background: var(--cream); color: var(--ink); }
button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.game-topbar {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 34px;
  border-bottom: 1px solid rgba(23,35,33,.1);
  background: rgba(243,241,234,.92);
  backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; font-weight: 780; letter-spacing: -.03em; text-decoration: none; }
.brand-mark { width: 27px; height: 27px; display: grid; grid-template-columns: repeat(3,1fr); gap: 2px; transform: skewY(-8deg); }
.brand-mark i { border-radius: 2px; background: var(--green); }
.brand-mark i:nth-child(2) { background: #3c8d79; transform: translateY(3px); }
.brand-mark i:nth-child(3) { background: var(--lime); transform: translateY(6px); }
.brand-tag { padding: 3px 7px; border: 1px solid #bfc5bd; border-radius: 999px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.more-link, .private-back {
  min-height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid var(--green);
  border-radius: 12px;
  background: var(--green);
  color: white;
  font-size: 13px;
  font-weight: 720;
  text-decoration: none;
  transition: .18s ease;
}
.more-link:hover, .private-back:hover { transform: translateY(-1px); background: var(--green-dark); box-shadow: 0 10px 24px rgba(25,89,75,.18); }
.private-back { background: transparent; color: var(--green); }
.private-back:hover { color: white; }

.game-shell { max-width: 1180px; margin: 0 auto; padding: 52px 42px 70px; }
.hero-grid { display: grid; grid-template-columns: minmax(330px,.86fr) minmax(430px,1.14fr); gap: 58px; align-items: center; }
.kicker { display: flex; align-items: center; gap: 9px; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.kicker::before { content: ""; width: 24px; height: 2px; background: currentColor; }
.hero-copy h1 { margin: 18px 0 16px; font-family: Georgia,"Noto Serif SC",serif; font-size: clamp(48px,6vw,76px); font-weight: 500; line-height: .98; letter-spacing: -.055em; }
.hero-copy h1 span { color: var(--green); }
.hero-copy > p { max-width: 470px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; }
.model-status { display: flex; align-items: flex-start; gap: 10px; margin-top: 28px; padding: 13px 14px; border: 1px solid #d5d9d1; border-radius: 11px; background: rgba(255,255,255,.42); color: var(--muted); font-size: 11px; line-height: 1.55; }
.model-status::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: #d3a84c; box-shadow: 0 0 0 4px rgba(211,168,76,.12); }
.model-status.ready::before { background: #64a282; box-shadow: 0 0 0 4px rgba(100,162,130,.12); }
.model-status.fallback::before { background: var(--orange); }

.game-card { padding: 19px; border: 1px solid #cfd3ca; border-radius: 22px; background: rgba(255,254,250,.82); box-shadow: 0 24px 60px rgba(27,39,36,.12); }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 2px 15px; }
.game-head strong { font-size: 13px; }
.turn { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.turn::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #1c211f; box-shadow: inset 0 1px 1px rgba(255,255,255,.2); }
.turn.ai::before { background: #f5f6f2; border: 1px solid #9ca19e; }
.board-wrap { position: relative; width: 100%; aspect-ratio: 1; }
#gomokuBoard { width: 100%; height: 100%; display: block; border: 1px solid #bb8d54; border-radius: 10px; background: var(--wood); box-shadow: inset 0 0 30px rgba(93,55,20,.12); cursor: crosshair; touch-action: manipulation; }
#gomokuBoard.is-thinking { cursor: wait; }
.win-banner { position: absolute; inset: 0; display: none; place-items: center; border-radius: 10px; background: rgba(15,31,27,.46); backdrop-filter: blur(3px); }
.win-banner.show { display: grid; }
.win-card { min-width: 210px; padding: 23px; border: 1px solid rgba(255,255,255,.5); border-radius: 17px; background: var(--paper); box-shadow: 0 22px 55px rgba(0,0,0,.2); text-align: center; }
.win-card strong { display: block; font-family: Georgia,"Noto Serif SC",serif; font-size: 28px; font-weight: 500; }
.win-card span { display: block; margin-top: 7px; color: var(--muted); font-size: 11px; }
.game-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; color: var(--muted); font-size: 10px; }
.game-meta { display: flex; align-items: center; gap: 9px; }
#modelVersion { padding-left: 9px; border-left: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.controls { display: flex; gap: 8px; }
.control-button { min-height: 34px; padding: 0 11px; border: 1px solid #ccd1c9; border-radius: 9px; background: white; color: var(--green); font-size: 10px; font-weight: 700; cursor: pointer; }
.control-button:hover { border-color: var(--green); background: #f1f6f3; }
.control-button:disabled { opacity: .45; cursor: not-allowed; }

.game-details { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-top: 24px; }
.detail-card { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,254,250,.66); }
.detail-card small { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; }
.detail-card strong { display: block; margin-top: 8px; font-family: Georgia,"Noto Serif SC",serif; font-size: 19px; font-weight: 500; }

@media (max-width: 880px) {
  .game-topbar { padding: 12px 18px; }
  .brand-tag { display: none; }
  .game-shell { padding: 38px 20px 55px; }
  .hero-grid { grid-template-columns: 1fr; gap: 32px; }
  .hero-copy h1 { font-size: 52px; }
  .hero-copy > p { max-width: none; }
  .game-card { width: min(100%,600px); margin: 0 auto; }
  .game-details { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .game-topbar { align-items: flex-start; }
  .brand { font-size: 13px; }
  .more-link, .private-back { min-height: 38px; padding: 0 11px; font-size: 11px; }
  .hero-copy h1 { font-size: 43px; }
  .game-card { padding: 12px; border-radius: 16px; }
  .game-footer { align-items: flex-start; flex-direction: column; }
}
