:root {
  color-scheme: light;
  --paper: #ebe5d8;
  --ink: #1f2624;
  --ink-soft: #59625d;
  --jade: #3c746c;
  --vermilion: #a74434;
  --line: rgb(46 52 48 / 48%);
  --white: #faf7ed;
  font-family: "Noto Serif SC", "Songti SC", STSong, SimSun, serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 12% 4%, rgb(255 255 250 / 80%), transparent 24rem),
    radial-gradient(ellipse at 90% 86%, rgb(105 136 126 / 18%), transparent 28rem),
    repeating-linear-gradient(7deg, rgb(65 55 39 / 2%) 0 1px, transparent 1px 5px),
    var(--paper);
}

button { font: inherit; }
button:focus-visible { outline: 3px solid var(--vermilion); outline-offset: 3px; }
.arena { width: min(1420px, 100%); margin: 0 auto; padding: 30px clamp(16px, 4vw, 62px) 48px; }
.masthead { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding-bottom: 22px; border-bottom: 1px solid rgb(31 38 36 / 25%); }
.brand { display: flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; border: 2px solid var(--vermilion); border-radius: 3px; color: var(--vermilion); font-family: KaiTi, STKaiti, serif; font-size: 29px; font-weight: 700; line-height: 1; transform: rotate(-4deg); box-shadow: inset 0 0 0 3px rgb(167 68 52 / 13%); }
.brand-name, .brand-subtitle { display: block; }
.brand-name { font-family: KaiTi, STKaiti, serif; font-size: clamp(28px, 3vw, 38px); font-weight: 700; letter-spacing: .2em; line-height: .9; }
.brand-name span { color: var(--vermilion); }
.brand-subtitle, .eyebrow { color: var(--ink-soft); font-size: 11px; letter-spacing: .2em; }
.brand-subtitle { margin-top: 8px; }
.signal { width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--vermilion); box-shadow: 0 0 0 4px rgb(167 68 52 / 12%); animation: pulse 2.4s ease-in-out infinite; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 344px); align-items: start; gap: clamp(26px, 4.5vw, 66px); margin-top: clamp(30px, 5vw, 60px); }
.game-stage { min-width: 0; }
.stage-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 18px; }
.eyebrow { margin: 0 0 8px; color: var(--jade); font-weight: 700; }
h1, h2 { margin: 0; }
h1 { font-family: KaiTi, STKaiti, serif; font-size: clamp(36px, 5vw, 58px); font-weight: 700; letter-spacing: .12em; line-height: 1; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: .08em; }
.turn-indicator { max-width: 260px; margin: 0; color: var(--jade); font-size: 13px; font-weight: 700; letter-spacing: .09em; line-height: 1.5; text-align: right; }

.board-shell { position: relative; padding: clamp(8px, 1.5vw, 16px); border: 1px solid rgb(31 38 36 / 58%); background: linear-gradient(135deg, rgb(247 243 231 / 98%), rgb(220 208 186 / 98%)); box-shadow: 11px 13px 0 rgb(75 67 49 / 12%), 0 17px 40px rgb(78 65 42 / 13%); }
.board-shell::before, .board-shell::after { content: ""; position: absolute; width: 35px; height: 35px; pointer-events: none; }
.board-shell::before { top: -1px; left: -1px; border-top: 3px solid var(--ink); border-left: 3px solid var(--ink); }
.board-shell::after { right: -1px; bottom: -1px; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }
.board { display: grid; grid-template-rows: repeat(15, minmax(0, 1fr)); aspect-ratio: 1; overflow: hidden; padding: 3.35%; border: 1px solid rgb(31 38 36 / 62%); background: radial-gradient(circle at 25% 20%, rgb(255 253 244 / 92%), transparent 30%), repeating-linear-gradient(95deg, rgb(71 62 45 / 3%) 0 1px, transparent 1px 5px), #e7dcc6; }
.board-row { display: grid; grid-template-columns: repeat(15, minmax(0, 1fr)); min-height: 0; }
.cell { position: relative; display: grid; place-items: center; min-width: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
.cell::before, .cell::after { content: ""; position: absolute; z-index: 0; background: var(--line); pointer-events: none; }
.cell::before { top: 50%; left: 50%; width: 100%; height: 1px; }
.cell::after { top: 50%; left: 50%; width: 1px; height: 100%; }
.cell:hover:not(:disabled) { background: rgb(60 116 108 / 14%); }
.cell:disabled { cursor: default; }
.cell:nth-child(15n)::before, .board-row:last-child .cell::after { display: none; }
.stone { position: relative; z-index: 1; width: 72%; aspect-ratio: 1; border-radius: 50%; }
.stone.is-new { animation: land .22s ease-out both; }
.stone.black { background: radial-gradient(circle at 33% 27%, #59645d, #1d2522 43%, #050807 78%); border: 1px solid #111713; box-shadow: 2px 4px 6px rgb(24 23 17 / 40%); }
.stone.white { background: radial-gradient(circle at 35% 25%, #fffdf5, #f4eddb 45%, #c9baa0 88%); border: 1px solid #ab9c85; box-shadow: 2px 4px 7px rgb(80 61 35 / 22%); }
.cell.last-move .stone::after { content: ""; position: absolute; z-index: 2; top: 38%; left: 38%; width: 24%; aspect-ratio: 1; border: 2px solid var(--vermilion); border-radius: 50%; pointer-events: none; }

.control-deck { border: 1px solid rgb(31 38 36 / 48%); background: rgb(247 242 229 / 66%); box-shadow: 8px 10px 0 rgb(75 67 49 / 8%); }
.deck-section { padding: 21px; border-bottom: 1px solid rgb(31 38 36 / 18%); }
.mode-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 15px; }
.mode-button, .restart-button { border: 1px solid rgb(31 38 36 / 42%); color: var(--ink); background: rgb(255 253 246 / 45%); cursor: pointer; }
.mode-button { min-height: 50px; padding: 8px; font-size: 13px; }
.mode-button span { color: var(--vermilion); }
.mode-button[aria-pressed="true"] { border-color: var(--jade); color: var(--jade); background: rgb(60 116 108 / 10%); box-shadow: inset 0 0 0 1px rgb(60 116 108 / 10%); }
.mode-button:hover { border-color: var(--jade); }
.status-message { min-height: 48px; margin: 15px 0 0; font-size: 16px; font-weight: 700; line-height: 1.45; }
.status-data { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 3px 0 0; }
.status-data div { padding-top: 11px; border-top: 1px solid rgb(31 38 36 / 15%); }
dt { color: var(--ink-soft); font-size: 11px; } dd { margin: 5px 0 0; color: var(--jade); font-size: 13px; font-weight: 700; }
.restart-button { display: block; width: calc(100% - 42px); margin: 21px; min-height: 49px; font-weight: 700; letter-spacing: .08em; }
.restart-button span { margin-right: 8px; color: var(--vermilion); font-size: 18px; }.restart-button:hover { border-color: var(--vermilion); background: rgb(167 68 52 / 7%); }
.rule-note { margin: 0; padding: 0 21px 21px; color: var(--ink-soft); font-size: 12px; line-height: 1.7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.result-dialog { width: min(360px, calc(100vw - 36px)); padding: 38px 34px 32px; border: 1px solid rgb(31 38 36 / 62%); color: var(--ink); background: linear-gradient(135deg, #f9f5e9, #e5dac4); box-shadow: 12px 15px 0 rgb(75 67 49 / 14%), 0 25px 65px rgb(25 26 22 / 28%); text-align: center; }
.result-dialog::backdrop { background: rgb(22 28 25 / 44%); backdrop-filter: blur(2px); }
.result-dialog .eyebrow { margin-bottom: 10px; }
.result-dialog h2 { font-family: KaiTi, STKaiti, serif; font-size: 31px; letter-spacing: .16em; }
.result-copy { margin: 18px 0 24px; color: var(--ink-soft); font-size: 15px; line-height: 1.7; }
.result-seal { display: grid; place-items: center; width: 46px; height: 46px; margin: 0 auto 18px; border: 2px solid var(--vermilion); color: var(--vermilion); font-family: KaiTi, STKaiti, serif; font-size: 27px; font-weight: 700; transform: rotate(-5deg); }
.result-restart { width: 100%; margin: 0; color: var(--ink); }

@keyframes pulse { 50% { opacity: .42; transform: scale(.75); } }
@keyframes land { from { transform: scale(.35); opacity: .25; } to { transform: scale(1); opacity: 1; } }
@media (max-width: 880px) { .game-layout { grid-template-columns: 1fr; }.control-deck { max-width: 680px; }.turn-indicator { text-align: left; }.stage-head { align-items: start; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* GameHub shell additions */
.masthead-actions { display: flex; align-items: center; gap: 15px; }
.home-link { color: var(--ink-soft); font-size: 12px; font-weight: 700; text-decoration: none; }
.home-link:hover { color: var(--jade); }
.masthead .language-switch { display: flex; padding: 2px; border: 1px solid rgb(31 38 36 / 30%); }
.masthead .language-switch button { min-width: 31px; padding: 4px 6px; border: 0; color: var(--ink-soft); background: transparent; cursor: pointer; font: 800 10px/1 Inter, ui-sans-serif, sans-serif; }
.masthead .language-switch button[aria-pressed="true"] { color: var(--white); background: var(--ink); }
.hub-return .brand-name { font-family: Inter, ui-sans-serif, sans-serif; font-size: 17px; letter-spacing: .09em; }.hub-return .brand-mark { font-family: Inter, ui-sans-serif, sans-serif; font-size: 22px; }.hub-return .brand-name span { color: var(--vermilion); }
.game-page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 344px); gap: 18px clamp(26px, 4.5vw, 66px); margin-top: clamp(30px, 5vw, 60px); }
.game-page > .stage-head { grid-column: 1; margin-bottom: 0; }
.match-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.5vw, 16px); margin-top: 18px; padding: 16px clamp(14px, 2vw, 22px); border: 1px solid rgb(31 38 36 / 32%); background: rgb(247 242 229 / 55%); box-shadow: 6px 8px 0 rgb(75 67 49 / 8%); }
.stat-tile { display: grid; gap: 4px; padding: 4px 10px; border-left: 3px solid rgb(31 38 36 / 22%); }
.stat-tile .stat-label { margin: 0; color: var(--ink-soft); font-size: 11px; letter-spacing: .2em; }
.stat-tile .stat-value { font-family: KaiTi, STKaiti, serif; font-size: clamp(22px, 3vw, 30px); line-height: 1; color: var(--ink); }
.stat-tile.stat-white .stat-value { color: var(--jade); }
.match-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(8px, 1.5vw, 16px); width: 100%; max-width: 1420px; margin: 22px auto 0; padding: 16px clamp(14px, 2vw, 22px); border: 1px solid rgb(31 38 36 / 32%); background: rgb(247 242 229 / 55%); box-shadow: 6px 8px 0 rgb(75 67 49 / 8%); }
.stat-tile.stat-black .stat-value { color: var(--ink); }
.match-layout { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 344px); align-items: start; gap: clamp(26px, 4.5vw, 66px); }
.match-layout .control-deck { margin: 0; }
@media (max-width: 880px) { .masthead-actions { gap: 10px; }.game-page { display: block; margin-top: 30px; }.game-page > .stage-head { margin-bottom: 18px; }.match-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 14px; padding: 12px; }.match-layout { display: grid; grid-template-columns: 1fr; }.match-layout .control-deck { max-width: 680px; } }
