/* ==========================================================================
   Gunjin Shogi: dark "online chess site" look
   ========================================================================== */
:root {
  --bg: #2b2d2e;
  --bg-2: #232527;
  --bg-3: #1c1e1f;
  --panel: #252729;
  --panel-2: #1f2123;
  --panel-3: #2e3133;
  --hover: #383b3e;
  --line: #3a3d40;
  --text: #f4f5f2;
  --text-2: #c6c9c6;
  --text-3: #8c9194;
  --green: #5fa564;
  --green-hi: #71b775;
  --green-sh: #3a6b3e;
  --gray: #404447;
  --gray-hi: #4b4f52;
  --gray-sh: #26292b;
  --red: #e02828;
  --red-soft: #fa412d;
  --gold: #f2c94c;
  --blue-army: #2f72c4;
  --red-army: #c8443c;
  --sq-light: #e8e5cf;
  --sq-dark: #6f9168;
  --hq: #d9b44a;
  --river-a: #5aa0c8;
  --river-b: #2f6f99;
  --radius: 6px;
  --font: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --font-head: "Barlow Semi Condensed", "Barlow", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --hl-last: rgba(246, 206, 92, .42);
  --hl-sel: rgba(246, 206, 92, .58);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; }
p { margin: 0 0 .8em; line-height: 1.55; color: var(--text-2); }
h1, h2, h3, h4, .btn, .tab, .nav a, .logo-text, .menu-btn .mb-title, .section-title, .seg button,
.lesson-top .lt-title, .bot-card .bc-name, .piece-group-h, .tc-cat, .field label, .opp-status { font-family: var(--font-head); }
.clock, .move-num, .move-cell .sqs, .tc-btn, .prating, .stat-line b, .lc-num, .lc-meta, .room-code, .go-rating { font-family: var(--font-mono); }
.txt-link { color: var(--green-hi); font-weight: 700; }
kbd { background: var(--panel-3); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: .85em; }
.muted { color: var(--text-3); }
.hidden { display: none !important; }

.ico { display: inline-flex; width: 1.2em; height: 1.2em; flex: none; }
.ico svg { width: 100%; height: 100%; }

/* --------------------------------------------------------------- shell --- */
.app { display: flex; height: 100vh; }
.sidebar {
  width: 168px;
  flex: none;
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  z-index: 10;
}
.logo { display: flex; align-items: center; gap: 8px; padding: 10px 14px 18px; }
.logo svg { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 2px 2px #0006); }
.logo-text { font-weight: 900; font-size: 18px; line-height: 1; letter-spacing: -.3px; }
.logo-text small { display: block; font-size: 10px; font-weight: 700; color: var(--green); letter-spacing: 2.2px; margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px;
  font-weight: 700; font-size: 15px;
  color: var(--text-2);
  border-left: 3px solid transparent;
}
.nav a .ico { width: 24px; height: 24px; color: var(--text-3); }
.nav a:hover { background: var(--bg-3); color: var(--text); }
.nav a:hover .ico { color: var(--text); }
.nav a.active { color: var(--text); background: #1b1d1e; border-left-color: var(--green); }
.nav a.active .ico { color: var(--green); }
.side-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.me-chip { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; border-radius: 6px; margin: 0 6px; }
.me-chip:hover { background: var(--bg-3); }
.me-chip .nm { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 4px; max-width: 112px; min-width: 0; }
.me-chip .nm-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.me-chip .nm .vip-tag { flex-shrink: 0; }
.me-chip .rt { font-size: 12px; color: var(--text-3); }
.side-tools { display: flex; gap: 4px; padding: 4px 10px; }
.conn { font-size: 11px; color: var(--text-3); padding: 2px 16px 6px; display: flex; align-items: center; gap: 6px; }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: #777; display: inline-block; }
.conn.online i { background: var(--green); }
.conn.offline i { background: var(--red); }

.main { flex: 1; min-width: 0; overflow-y: auto; overflow-x: hidden; position: relative; }

/* ------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer;
  background: var(--gray); color: var(--text);
  font-weight: 800; font-size: 15px;
  padding: 10px 16px;
  border-radius: 6px;
  box-shadow: 0 3px 0 0 var(--gray-sh), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: background .12s, transform .06s, box-shadow .06s;
  user-select: none; white-space: nowrap;
}
.btn:hover { background: var(--gray-hi); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 0 0 var(--gray-sh); }
.btn:disabled { opacity: .5; cursor: default; transform: none; }
.btn .ico { width: 20px; height: 20px; }
.btn-primary { background: var(--green); box-shadow: 0 3px 0 0 var(--green-sh), inset 0 1px 0 rgba(255, 255, 255, .14); text-shadow: 0 1px 0 #0003; }
.btn-primary:hover { background: var(--green-hi); }
.btn-primary:active { box-shadow: 0 2px 0 0 var(--green-sh); }
.btn-danger { background: #b3362a; box-shadow: 0 3px 0 0 #6e1d16; }
.btn-danger:hover { background: #c94233; }
.btn-xl { font-size: 22px; letter-spacing: .02em; padding: 17px 20px; border-radius: 8px; box-shadow: 0 4px 0 0 var(--green-sh), inset 0 1px 0 rgba(255, 255, 255, .14); width: 100%; }
.btn-lg { font-size: 18px; padding: 14px 18px; width: 100%; }
.btn-sm { font-size: 13px; padding: 6px 10px; box-shadow: 0 3px 0 0 var(--gray-sh); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-ghost:active { box-shadow: none; }
.icon-btn {
  background: transparent; border: 0; cursor: pointer; color: var(--text-3);
  width: 34px; height: 34px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .ico { width: 22px; height: 22px; }
.icon-btn.on { color: var(--green); }

/* big menu buttons (home / play panel) */
.menu-btn {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: var(--gray); border: 0; cursor: pointer;
  padding: 14px 16px; border-radius: 8px;
  box-shadow: 0 3px 0 0 var(--gray-sh), inset 0 1px 0 rgba(255, 255, 255, .05);
  transition: background .12s, transform .06s;
}
.menu-btn:hover { background: var(--gray-hi); }
.menu-btn:active { transform: translateY(1px); box-shadow: 0 2px 0 0 var(--gray-sh); }
.menu-btn.primary { background: var(--green); box-shadow: 0 3px 0 0 var(--green-sh), inset 0 1px 0 rgba(255, 255, 255, .14); }
.menu-btn.primary:hover { background: var(--green-hi); }
.menu-btn .mb-ico { width: 46px; height: 46px; flex: none; display: flex; align-items: center; justify-content: center; }
.menu-btn .mb-ico svg { width: 100%; height: 100%; }
.menu-btn .mb-ico .ico { width: 40px; height: 40px; }
.menu-btn .mb-title { font-size: 21px; font-weight: 800; color: #fff; text-shadow: 0 1px 0 #0003; }
.menu-btn .mb-sub { font-size: 13.5px; color: #ffffffcc; margin-top: 2px; font-weight: 600; }
.menu-btn:not(.primary) .mb-sub { color: var(--text-2); }

/* --------------------------------------------------------------- board --- */
.board {
  position: relative;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
  border-radius: 2px;
  box-shadow: 0 0 0 5px #1d1f21, 0 0 0 6px #44484b, 0 10px 26px #0008;
  flex: none;
}
.layer { position: absolute; inset: 0; }
.hl-layer, .fx-layer { pointer-events: none; }
.sq { position: absolute; }
.sq.light { background: var(--sq-light); }
.sq.dark { background: var(--sq-dark); }
.sq.gate::after {
  content: ''; position: absolute; left: 14%; right: 14%; height: 7%;
  background: repeating-linear-gradient(90deg, #00000030 0 4px, transparent 4px 8px);
}
.sq.gate[data-node]:not(.hq)::after { top: auto; bottom: 0; }
.sq.hq {
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--hq) 70%, #fff 30%) 0%, var(--hq) 70%);
  box-shadow: inset 0 0 0 3px #0000002a, inset 0 0 0 6px #ffffff30;
}
.hq-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 4%; color: #00000038; font-weight: 900; font-size: calc(var(--s) * .34); letter-spacing: 2px; }
.hq-mark svg { width: calc(var(--s) * .42); height: calc(var(--s) * .42); }
.coord { position: absolute; font-family: var(--font-mono); font-size: max(9px, calc(var(--s) * .17)); font-weight: 600; color: var(--sq-light); pointer-events: none; line-height: 1; z-index: 1; }
.coord.on-light { color: var(--sq-dark); }
.coord.on-hq { color: #00000066; }
.coord.file { transform: translate(-100%, -100%); }
.river {
  position: absolute;
  background: linear-gradient(180deg, var(--river-b), var(--river-a) 45%, var(--river-b));
  box-shadow: inset 0 3px 4px #0005, inset 0 -3px 4px #0005;
  overflow: visible;
}
.river-water {
  position: absolute; inset: 0; opacity: .35;
  background: repeating-linear-gradient(100deg, transparent 0 14px, #ffffff55 14px 16px, transparent 16px 30px);
  animation: flow 6s linear infinite;
}
@keyframes flow { to { background-position: 60px 0; } }
.bridge {
  position: absolute; top: -4px; bottom: -4px;
  background: repeating-linear-gradient(0deg, #9a6a38 0 5px, #7d5228 5px 6px);
  border-left: 3px solid #4f3216; border-right: 3px solid #4f3216;
  box-shadow: 0 2px 4px #0006;
  border-radius: 2px;
}
.bridge i { display: none; }
.river-svg { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; filter: drop-shadow(0 2px 3px #0006); }
.river-svg path { fill: none; stroke-linecap: butt; stroke-linejoin: round; }
.river-svg .br-edge { stroke: #4f3216; }
.river-svg .br-deck { stroke: #9a6a38; }
.river-svg .br-seam-fill { fill: #7d5228; }
.board-small .river-svg { filter: none; }
.river-svg .br-isle-edge { fill: #4f3216; }
.river-svg .br-isle { fill: #9a6a38; }
.river-svg .br-isle-ring { fill: none; stroke: #7d5228; stroke-width: 1.5px; }
.hl.isle { border-radius: 50%; }

.piece {
  position: absolute; left: 0; top: 0;
  transition: transform .2s cubic-bezier(.2, .7, .3, 1);
  will-change: transform;
  filter: drop-shadow(0 2px 1.5px #0007);
  z-index: 2;
}
.piece .piece-svg { width: 100%; height: 100%; display: block; }
.piece.no-tr { transition: none !important; }
.piece.moving { z-index: 30; }
.piece.dragging { z-index: 60; filter: drop-shadow(0 10px 10px #0008); cursor: grabbing; }
.piece.selected { filter: drop-shadow(0 0 0 #fff) drop-shadow(0 2px 3px #000a); }
.piece.dying { animation: die .42s ease-in forwards; }
@keyframes die { 0% { opacity: 1; } 40% { opacity: 1; filter: brightness(2.2) drop-shadow(0 0 6px #ffb84d); } 100% { opacity: 0; filter: brightness(2) blur(3px); } }
.board.pickable-cursor .piece { cursor: pointer; }
.tag {
  position: absolute; top: -6%; right: -10%;
  font-size: max(8px, calc(var(--s) * .16)); font-weight: 900; line-height: 1;
  background: #111d; color: #ffe08a; padding: 2px 4px; border-radius: 4px;
  border: 1px solid #ffe08a88; pointer-events: none;
}

.hl { position: absolute; }
.hl.last-from, .hl.last-to { background: var(--hl-last); }
.hl.sel { background: var(--hl-sel); }
.hl.hover { box-shadow: inset 0 0 0 calc(var(--s) * .055) rgba(255, 255, 255, .8); }
.hl.dot::after { content: ''; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; }
.hl.dot::after { width: calc(var(--s) * .3); height: calc(var(--s) * .3); background: rgba(0, 0, 0, .2); }
/* a piece that can be attacked: an outline in its tile's shape, with a small gap around the piece */
.hl .ring-box { position: absolute; pointer-events: none; }
.hl .ring-tile { width: 100%; height: 100%; display: block; overflow: visible; }
.hl .ring-tile path { fill: none; stroke: rgba(0, 0, 0, .28); stroke-width: 4.2; stroke-linejoin: round; }
.hl.camp { background: rgba(129, 182, 76, .22); }
.hl.swap-src { background: rgba(255, 255, 51, .5); }
.hl.bat-win { background: rgba(129, 182, 76, .5); }
.hl.bat-loss { background: rgba(240, 60, 50, .45); }
.hl.bat-tie { background: rgba(180, 180, 180, .5); }
.hl.zone { background: rgba(255, 214, 0, .38); }
.hl.zone2 { background: rgba(80, 170, 255, .38); }
.hl.danger { background: rgba(240, 60, 50, .35); }
.hl.target { background: rgba(255, 214, 64, .32); box-shadow: inset 0 0 0 calc(var(--s) * .05) #ffd640; animation: tpulse 1.3s ease-in-out infinite; }
.hl.intel-sel { box-shadow: inset 0 0 0 3px #ffe08a; }
@keyframes tpulse { 50% { background: rgba(255, 214, 64, .6); box-shadow: inset 0 0 0 calc(var(--s) * .08) #fff3b0; } }
.burst {
  position: absolute; width: var(--bs); height: var(--bs);
  transform: translate(-50%, -50%) scale(.35); opacity: 0;
  animation: burst .85s ease-out forwards; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: max(2px, calc(var(--bs) * .035)) solid currentColor;
  background: radial-gradient(circle, color-mix(in srgb, currentColor 30%, transparent) 0 45%, transparent 70%);
  color: #f2c94c;
}
.burst.win { color: #8fd092; }
.burst.loss { color: #ff7a68; }
.burst .rmark { width: 38%; height: 38%; filter: drop-shadow(0 1px 2px #0008); }
@keyframes burst { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.35); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(.85); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.1); } }
.fx-pulse { position: absolute; border-radius: 4px; box-shadow: 0 0 0 3px #ffe08a; animation: fxp 1.2s ease-out forwards; }
/* Missile strike: fireballs over the blast area and a shock ring from the landing square */
.burst.boom {
  border: 0; color: #ffb547;
  background: radial-gradient(circle, #fffbe0 0 12%, #ffd34d 26%, #ff8a1f 46%, rgba(214, 60, 20, .8) 60%, rgba(80, 30, 10, 0) 72%);
  animation: boom .9s ease-out both;
}
@keyframes boom { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.2); } 20% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 60% { opacity: .9; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); } }
.fx-shock {
  position: absolute; width: var(--bs); height: var(--bs); border-radius: 50%; z-index: 39; pointer-events: none;
  border: calc(var(--s) * .07) solid rgba(255, 226, 150, .9); box-shadow: 0 0 calc(var(--s) * .3) rgba(255, 170, 60, .6);
  transform: translate(-50%, -50%) scale(.1); opacity: 0; animation: shock .8s ease-out .05s forwards;
}
@keyframes shock { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.1); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1); } }
.piece.flying { transition: transform .45s cubic-bezier(.5, 0, .7, 1); z-index: 50; }
.hl.blast { background: rgba(255, 120, 40, .42); box-shadow: inset 0 0 0 calc(var(--s) * .04) rgba(255, 190, 90, .9); }
.hl.blast-center { background: rgba(255, 80, 30, .55); }
.hl.carry { box-shadow: inset 0 0 0 calc(var(--s) * .07) #ffd640; }
.hl.blast-last { background: rgba(255, 140, 60, .26); }
.strike-box { margin: 10px 12px; padding: 10px 12px; border-radius: 8px; background: #3a2a22; border: 1px solid #a0522d; display: flex; flex-direction: column; gap: 8px; }
.strike-box p { margin: 0; font-size: 13px; }
.strike-box .sb-head { display: flex; align-items: center; gap: 8px; font-size: 15px; color: #fff; }
.strike-box .sb-ico { width: 26px; height: 26px; display: inline-flex; }
.strike-box .seg button { font-size: 12.5px; padding: 6px; }
.mode-notes { margin: 8px 12px 4px; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); font-size: 12.5px; }
.mode-notes .mn-head { display: flex; align-items: center; gap: 6px; font-weight: 800; color: #fff; margin-bottom: 4px; }
.mode-notes ul { margin: 0; padding-inline-start: 18px; }
.mode-notes li { margin: 2px 0; color: var(--text-2); }
.mode-notes li.warn { color: #ff8f80; font-weight: 700; }
.mode-notes li.good { color: #8fd092; font-weight: 700; }
.res.boom { color: #ffb547; font-weight: 800; font-size: 11px; }
.mode-tag { display: inline-block; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 10px; letter-spacing: .02em; vertical-align: middle; white-space: nowrap; }
.mode-tag.sourced { background: #2f4632; color: #bfe39a; }
.mode-tag.house { background: #4a3c22; color: #f2cf7e; }
.hl.guard { box-shadow: inset 0 0 0 calc(var(--s) * .04) rgba(255, 224, 138, .55); }
@keyframes fxp { to { box-shadow: 0 0 0 14px #ffe08a00; } }
.no-anim .piece, .no-anim .burst, .no-anim .fx-shock { transition: none !important; animation: none !important; }
.no-anim .fx-shock { display: none; }
.no-anim .piece.dying { display: none; }

/* --------------------------------------------------------- game layout --- */
.game-layout { display: flex; gap: 20px; height: 100%; padding: 14px 20px; }
.board-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.board-stack { display: flex; flex-direction: column; gap: 6px; height: 100%; width: 100%; align-items: center; min-height: 0; }
.board-area { flex: 1; min-height: 0; width: 100%; display: flex; justify-content: center; align-items: center; }
.side-panel {
  width: 400px; flex: none;
  background: var(--panel);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  max-height: 100%;
}
.panel-head { padding: 14px 16px 10px; display: flex; align-items: center; gap: 10px; }
.panel-head h2 { font-size: 20px; font-weight: 800; }
.panel-body { flex: 1; overflow-y: auto; min-height: 0; }
.panel-foot { border-top: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--panel-2); }
.panel-pad { padding: 14px 16px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--panel-2); flex: none; }
.tab {
  flex: 1; padding: 11px 6px 9px; text-align: center; cursor: pointer;
  color: var(--text-3); font-weight: 700; font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border-bottom: 3px solid transparent; background: none; border-top: 0; border-left: 0; border-right: 0;
}
.tab .ico { width: 22px; height: 22px; }
.tab:hover { color: var(--text); background: var(--panel-3); }
.tab.active { color: var(--text); border-bottom-color: var(--text); }
.tab .badge { background: var(--red-soft); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; margin-left: 4px; }

/* player bars */
.player-bar { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; }
.player-bar .pinfo { flex: 1; min-width: 0; }
.player-bar .pname { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar .prating { color: var(--text-3); font-weight: 600; font-size: 14px; }
.player-bar .pn { overflow: hidden; text-overflow: ellipsis; min-width: 2.5em; }
.player-bar .pname > :not(.pn) { flex-shrink: 0; }
.player-bar .pname > .thinking { overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; min-width: 0; }
.player-bar .caps .more { white-space: nowrap; }
.army { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }
.army.red { background: var(--red-army); }
.army.blue { background: var(--blue-army); }
.player-bar .caps { display: flex; align-items: center; gap: 1px; min-height: 18px; margin-top: 2px; flex-wrap: nowrap; overflow: hidden; }
.player-bar .caps .cap { width: 17px; height: 17px; }
.player-bar .caps .cap svg { width: 100%; height: 100%; }
.player-bar .caps .more { font-size: 12px; color: var(--text-3); margin-left: 4px; font-weight: 700; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; flex: none; }
.status-dot.off { background: #777; }
.thinking { font-size: 12px; color: var(--text-3); font-weight: 600; }
.clock {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 23px; font-weight: 600;
  padding: 5px 12px; border-radius: 5px; min-width: 112px; text-align: right;
  background: #232527; color: var(--text-3);
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
}
.clock .ico { width: 18px; height: 18px; opacity: 0; }
.clock.active { background: #eceee8; color: #1e2123; box-shadow: inset 3px 0 0 var(--green); }
.clock.active .ico { opacity: .7; animation: spin 2s linear infinite; }
.clock.low.active { background: #e02828; color: #fff; }
.clock.low:not(.active) { color: #e46b5f; }
.clock.unlimited { font-size: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* move list */
.moves { font-size: 14px; }
.move-row { display: grid; grid-template-columns: 42px 1fr 1fr; align-items: stretch; }
.move-row:nth-child(odd) { background: #282a2c; }
.move-num { color: var(--text-3); padding: 7px 0 7px 12px; font-weight: 600; }
.move-cell { padding: 5px 6px; cursor: pointer; display: flex; align-items: center; gap: 5px; border-radius: 4px; margin: 2px; font-weight: 700; color: var(--text-2); min-width: 0; }
.move-cell:hover { background: var(--hover); }
.move-cell.current { background: #45494c; color: #fff; box-shadow: inset 0 -2px 0 var(--green); }
.move-cell .mi { width: 20px; height: 20px; flex: none; }
.move-cell .mi svg { width: 100%; height: 100%; }
.move-cell .sqs { white-space: nowrap; }
.move-cell .res { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: 10px; font-weight: 800; padding: 2px 4px; border-radius: 4px; line-height: 1; }
.move-cell .res .rmark { width: 12px; height: 12px; display: block; }
.res.win { background: #4c7a2a; color: #d9f5c0; }
.res.loss { background: #8a2a22; color: #ffd6d0; }
.res.tie { background: #505457; color: #eee; }
.res.hq { background: var(--gold); color: #3a2c00; }
.empty-state { padding: 26px 18px; text-align: center; color: var(--text-3); }
.empty-state .ico { width: 42px; height: 42px; margin-bottom: 8px; opacity: .6; }
.nav-row { display: flex; gap: 6px; }
.nav-row .btn { flex: 1; padding: 8px; box-shadow: 0 3px 0 0 var(--gray-sh); }
.action-row { display: flex; gap: 8px; }
.action-row .btn { flex: 1; }
.review-banner { background: #3d3a2b; color: var(--gold); font-size: 13px; font-weight: 700; padding: 6px 12px; text-align: center; cursor: pointer; }
.draw-offer { background: #2b3a30; padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; }
.draw-offer span { flex: 1 1 150px; min-width: 0; }

/* battle log / intel */
.log-item { padding: 9px 14px; border-bottom: 1px solid #ffffff0a; font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); line-height: 1.4; }
.log-item .li-ico { width: 30px; height: 30px; flex: none; }
.log-item .li-ico svg { width: 100%; height: 100%; }
.log-item b { color: var(--text); }
.log-item .ply { color: var(--text-3); font-size: 11.5px; font-weight: 700; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-3); font-weight: 800; padding: 14px 16px 6px; }
.intel-card { margin: 8px 12px; background: var(--panel-3); border-radius: 8px; padding: 12px; }
.intel-card h4 { font-size: 15px; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.poss-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.poss {
  background: var(--panel-2); border-radius: 6px; padding: 5px 2px 4px; text-align: center; cursor: pointer;
  border: 1px solid transparent; font-size: 10.5px; font-weight: 700; color: var(--text-2);
}
.poss svg { width: 30px; height: 30px; display: block; margin: 0 auto 2px; }
.poss.no { opacity: .22; }
.poss:hover { border-color: #ffffff40; }
.poss.tagged { border-color: #ffe08a; background: #3d3622; }
.stat-line { display: flex; justify-content: space-between; padding: 6px 16px; font-size: 14px; color: var(--text-2); }
.stat-line b { color: var(--text); }
.army-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.army-table td { padding: 4px 6px; border-bottom: 1px solid #ffffff08; }
.army-table td:first-child { width: 30px; }
.army-table svg { width: 24px; height: 24px; display: block; }
.army-table .cnt { text-align: right; color: var(--text-3); font-weight: 700; }

/* chat */
.chat { display: flex; flex-direction: column; height: 100%; }
.chat-log { flex: 1; overflow-y: auto; padding: 10px 14px; font-size: 14px; }
.chat-msg { margin-bottom: 6px; line-height: 1.4; word-wrap: break-word; }
.chat-msg b { margin-right: 6px; }
.chat-msg.sys { color: var(--text-3); font-style: italic; font-size: 13px; }
.chat-msg .r { color: #f08a80; }
.chat-msg .b { color: #7fb2f0; }
.chat-input { display: flex; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; background: var(--panel-2); border: 0; color: var(--text); padding: 12px 14px; font: inherit; outline: none; }

/* setup panel */
.setup-timer { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-weight: 600; background: var(--panel-2); padding: 4px 10px; border-radius: 5px; margin-left: auto; }
.formation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.formation-grid .btn { justify-content: flex-start; font-size: 14px; }
.rules-mini { margin: 0; padding: 0 0 0 18px; color: var(--text-2); font-size: 13.5px; line-height: 1.6; }
.sel-info { display: flex; gap: 12px; align-items: center; background: var(--panel-3); border-radius: 8px; padding: 10px 12px; min-height: 72px; }
.sel-info .si-ico { width: 52px; height: 52px; flex: none; }
.sel-info .si-ico svg { width: 100%; height: 100%; }
.sel-info h4 { font-size: 15px; }
.sel-info p { margin: 2px 0 0; font-size: 13px; }
.opp-status { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--text-2); }
.spinner { width: 18px; height: 18px; border: 3px solid #ffffff22; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
.spinner.lg { width: 44px; height: 44px; border-width: 5px; }
.ready-check { color: var(--green); display: inline-flex; }

/* invite */
.invite-box { background: var(--panel-2); border-radius: 8px; padding: 12px; display: flex; gap: 8px; align-items: center; }
.invite-box input { flex: 1; background: transparent; border: 0; color: var(--text); font: inherit; font-size: 13px; outline: none; min-width: 0; }
.room-code { font-size: 34px; font-weight: 900; letter-spacing: 6px; text-align: center; padding: 8px; font-family: var(--font-mono); color: var(--gold); }

/* ---------------------------------------------------------------- forms --- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--text-2); }
.input, select.input {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 10px 12px; font: inherit; outline: none;
}
.input:focus { border-color: var(--green); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--text-2); cursor: pointer; padding: 6px 0; }
.check input { margin-top: 3px; accent-color: var(--green); width: 16px; height: 16px; }
.check b { color: var(--text); display: block; }
.seg { display: flex; background: var(--panel-2); border-radius: 8px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--text-2); padding: 8px; border-radius: 6px; cursor: pointer; font-weight: 700; }
.seg button.on { background: var(--gray-hi); color: #fff; }
.tc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tc-cat { font-size: 13px; font-weight: 800; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin: 12px 0 6px; }
.tc-cat .ico { width: 18px; height: 18px; }
.tc-btn { background: var(--gray); border: 2px solid transparent; color: #fff; font-weight: 700; padding: 10px 4px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.tc-btn:hover { background: var(--gray-hi); }
.tc-btn.on { border-color: var(--green); background: #33463a; }
.tc-select { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: var(--gray); border: 0; border-radius: 6px; padding: 13px; color: #fff; font-size: 18px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 0 var(--gray-sh); }
.tc-select:hover { background: var(--gray-hi); }

/* ---------------------------------------------------------------- modal --- */
#modal-root { position: fixed; inset: 0; pointer-events: none; z-index: 100; }
.modal-overlay { position: fixed; inset: 0; background: #0009; display: flex; align-items: center; justify-content: center; pointer-events: auto; opacity: 0; transition: opacity .18s; padding: 16px; }
.modal-overlay.show { opacity: 1; }
.modal { background: var(--panel); border-radius: 10px; width: 420px; max-width: 100%; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px #000a; transform: translateY(10px) scale(.98); transition: transform .18s; }
.modal-overlay.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; padding: 16px 18px 6px; }
.modal-head h2 { flex: 1; font-size: 20px; font-weight: 800; }
.modal-body { padding: 8px 18px 16px; }
.modal-actions { display: flex; gap: 10px; padding: 0 18px 18px; }
.modal-actions .btn { flex: 1; }
.modal.wide { width: 640px; }

.gameover { width: 380px; overflow: hidden; }
.gameover .go-head { padding: 22px 18px 18px; text-align: center; position: relative; }
.gameover .go-head.win { background: linear-gradient(180deg, #4f8a53, #356339); }
.gameover .go-head.loss { background: linear-gradient(180deg, #6b3a35, #452422); }
.gameover .go-head.draw { background: linear-gradient(180deg, #57534d, #3b3934); }
.gameover .go-head h2 { font-size: 30px; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 10px; }
.gameover .go-head h2 .ico { width: 34px; height: 34px; color: var(--gold); }
.gameover .go-head p { margin: 4px 0 0; color: #ffffffcc; font-weight: 600; }
.go-players { display: flex; align-items: center; justify-content: center; gap: 22px; padding: 18px 10px 6px; }
.go-player { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; font-size: 14px; max-width: 130px; text-align: center; }
.go-player .avatar.winner { box-shadow: 0 0 0 3px var(--green); }
.go-vs { color: var(--text-3); font-weight: 900; }
.go-rating { text-align: center; color: var(--text-2); font-size: 14px; padding: 4px 0 6px; }
.go-rating b.up { color: var(--green); }
.go-rating b.down { color: var(--red-soft); }
.go-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px 18px 20px; }
.go-actions .btn:first-child { grid-column: span 2; }

/* --------------------------------------------------------------- toasts --- */
#toast-root { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.in-game #toast-root { top: auto; bottom: 22px; flex-direction: column-reverse; }
.in-game .toast { transform: translateY(8px); }
.in-game .toast.show { transform: none; }
.toast { background: #1d1f21; border: 1px solid var(--line); border-left: 4px solid var(--green); padding: 10px 16px; border-radius: 8px; font-weight: 600; font-size: 14px; box-shadow: 0 8px 24px #0008; opacity: 0; transform: translateY(-8px); transition: all .25s; max-width: 90vw; }
.toast.show { opacity: 1; transform: none; }
.toast.error { border-left-color: var(--red-soft); }
.toast.warn { border-left-color: var(--gold); }

/* --------------------------------------------------------------- avatar --- */
.avatar { border-radius: 4px; display: flex; align-items: center; justify-content: center; font-weight: 900; color: #fff; flex: none; overflow: hidden; text-shadow: 0 1px 2px #0005; }
.avatar svg { width: 100%; height: 100%; }
.avatar.empty { background: #4b4845; color: var(--text-3); }
.avatar.empty svg { width: 70%; height: 70%; }

/* ----------------------------------------------------------------- home --- */
.page { max-width: 1160px; margin: 0 auto; padding: 32px 28px 60px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: center; min-height: calc(100vh - 140px); }
.hero-board { display: flex; justify-content: center; align-items: center; height: min(78vh, 720px); }
.hero h1 { font-size: 46px; font-weight: 900; line-height: 1.08; letter-spacing: -1px; margin-bottom: 12px; }
.hero .jp { font-size: 18px; color: var(--text-3); font-weight: 700; margin-bottom: 18px; letter-spacing: 1px; }
.hero .lead { font-size: 17px; margin-bottom: 26px; max-width: 520px; }
.hero-actions { display: flex; flex-direction: column; gap: 14px; max-width: 440px; }
.hero-stats { display: flex; gap: 22px; margin-top: 24px; color: var(--text-3); font-weight: 700; font-size: 14px; }
.hero-stats b { color: var(--text); font-size: 18px; margin-right: 4px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 30px; }
.feature { background: var(--panel); border-radius: 10px; padding: 20px; }
.feature .f-ico { width: 54px; height: 54px; margin-bottom: 10px; }
.feature .f-ico svg { width: 100%; height: 100%; }
.feature h3 { font-size: 18px; margin-bottom: 6px; }
.feature p { font-size: 14px; margin: 0; }
.section-h { font-size: 26px; font-weight: 900; margin: 48px 0 6px; }

/* ----------------------------------------------------------------- play --- */
.lobby-list .lobby-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid #ffffff0a; cursor: pointer; }
.lobby-item:hover { background: var(--panel-3); }
.lobby-item .li-name { flex: 1; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-item .li-tc { color: var(--text-2); font-weight: 700; font-size: 14px; }
.seeking { text-align: center; padding: 26px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.seeking h3 { font-size: 19px; }
.bot-list { display: flex; flex-direction: column; gap: 8px; }
.bot-card { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--panel-3); cursor: pointer; border: 2px solid transparent; }
.bot-card:hover { background: var(--hover); }
.bot-card.on { border-color: var(--green); background: #2f3d33; }
.bot-card .bc-name { font-weight: 800; }
.bot-card .bc-blurb { font-size: 13px; color: var(--text-3); }
.bot-card .bc-rating { margin-left: auto; font-weight: 800; color: var(--text-2); }
.bot-hero { display: flex; gap: 14px; align-items: center; background: var(--panel-2); padding: 14px; border-radius: 10px; margin-bottom: 12px; }
.speech { background: #fff; color: #222; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 600; position: relative; flex: 1; }
.speech::before { content: ''; position: absolute; left: -8px; top: 18px; border: 8px solid transparent; border-left: 0; border-right-color: #fff; }

/* ---------------------------------------------------------------- learn --- */
.learn-head { display: flex; align-items: flex-end; gap: 24px; margin-bottom: 22px; flex-wrap: wrap; }
.learn-head h1 { font-size: 36px; font-weight: 900; }
.progress-bar { height: 10px; background: #1b1d1e; border-radius: 6px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--green); border-radius: 6px; transition: width .3s; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.lesson-card { background: var(--panel); border-radius: 10px; overflow: hidden; cursor: pointer; transition: transform .12s, background .12s; display: flex; flex-direction: column; }
.lesson-card:hover { transform: translateY(-2px); background: var(--panel-3); }
.lesson-card .lc-art { height: 120px; background: linear-gradient(135deg, #3c4a2f, #24301b); display: flex; align-items: center; justify-content: center; position: relative; }
.lesson-card .lc-art svg { height: 86px; width: 86px; filter: drop-shadow(0 4px 6px #0008); }
.lesson-card .lc-num { position: absolute; top: 10px; left: 12px; font-weight: 900; font-size: 13px; background: #0006; padding: 2px 8px; border-radius: 10px; }
.lesson-card .lc-done { position: absolute; top: 8px; right: 10px; background: var(--green); border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.lesson-card .lc-done .ico { width: 18px; height: 18px; }
.lesson-card .lc-body { padding: 14px 16px 16px; }
.lesson-card h3 { font-size: 17px; margin-bottom: 4px; }
.lesson-card p { font-size: 13.5px; margin: 0; }
.lesson-card .lc-meta { font-size: 12px; color: var(--text-3); font-weight: 700; margin-top: 8px; }
.learn-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0 0 30px; }
.learn-link { background: var(--panel); border-radius: 10px; padding: 16px; display: flex; gap: 14px; align-items: center; cursor: pointer; }
.learn-link:hover { background: var(--panel-3); }
.learn-link .ll-ico { width: 48px; height: 48px; flex: none; color: var(--green); }
.learn-link .ll-ico .ico { width: 44px; height: 44px; }
.learn-link h3 { font-size: 16px; }
.learn-link p { margin: 2px 0 0; font-size: 13px; }

.lesson-text { padding: 16px 18px; font-size: 15px; }
.lesson-text h3 { font-size: 21px; margin-bottom: 10px; font-weight: 800; }
.lesson-text p { color: var(--text-2); }
.lesson-text ul { padding-left: 20px; margin: 0 0 12px; color: var(--text-2); line-height: 1.6; }
.lesson-text li { margin-bottom: 4px; }
.lesson-text b, .lesson-text strong { color: var(--text); }
.pc { display: inline-flex; vertical-align: -6px; width: 22px; height: 22px; margin: 0 2px; }
.pc svg { width: 100%; height: 100%; }
.lesson-text table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 6px 0 12px; }
.lesson-text td, .lesson-text th { padding: 5px 6px; border-bottom: 1px solid #ffffff10; text-align: left; color: var(--text-2); }
.lesson-text th { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .8px; }
.lesson-text td svg { width: 26px; height: 26px; display: block; }
.task-box { margin: 0 14px 14px; border-radius: 10px; padding: 12px 14px; background: #2b3a30; border-left: 4px solid var(--green); }
.task-box.done { background: #2f4a35; }
.task-box.fail { background: #4a2a25; border-left-color: var(--red-soft); }
.task-box .tb-title { font-weight: 800; display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.task-box .tb-title .ico { width: 20px; height: 20px; }
.task-box p { margin: 0; font-size: 14px; }
.tipbox { background: #3a3424; border-radius: 8px; padding: 10px 12px; font-size: 14px; color: #f3e3b3; display: flex; gap: 10px; margin: 8px 0 12px; }
.tipbox .ico { color: var(--gold); width: 20px; height: 20px; margin-top: 1px; }
.step-dots { display: flex; gap: 5px; justify-content: center; padding: 4px 0 2px; flex-wrap: wrap; }
.step-dots i { width: 9px; height: 9px; border-radius: 50%; background: #505457; cursor: pointer; }
.step-dots i.on { background: var(--green); }
.step-dots i.cur { background: #fff; transform: scale(1.25); }
.lesson-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.lesson-top .lt-title { font-weight: 800; font-size: 15px; flex: 1; min-width: 0; }
.lesson-top .lt-sub { font-size: 12px; color: var(--text-3); font-weight: 700; }
.board-caption { color: var(--text-3); font-size: 13px; font-weight: 700; text-align: center; min-height: 18px; }

/* pieces page */
.piece-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.piece-card { background: var(--panel); border-radius: 10px; padding: 16px; display: flex; gap: 14px; }
.piece-card .pcard-tile { width: 76px; flex: none; }
.piece-card .pcard-tile svg { width: 76px; height: 76px; display: block; }
.piece-card h3 { font-size: 18px; }
.piece-card .jp { color: var(--text-3); font-size: 13px; font-weight: 700; margin: 2px 0 8px; }
.piece-card .facts { font-size: 13.5px; color: var(--text-2); line-height: 1.55; }
.piece-card .facts b { color: var(--text); }
.chip { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 10px; background: var(--line); color: var(--text-2); margin-right: 4px; }
.chip.g { background: #33463a; color: #bfe39a; }
.mini-board-wrap { width: 120px; flex: none; }
.piece-group-h { font-size: 20px; font-weight: 900; margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }

/* chart */
.chart-wrap { overflow: auto; background: var(--panel); border-radius: 10px; padding: 10px; }
table.chart { border-collapse: separate; border-spacing: 2px; font-size: 12px; margin: 0 auto; }
table.chart th { font-weight: 800; color: var(--text-2); padding: 2px; }
table.chart th svg { width: 34px; height: 34px; display: block; margin: 0 auto; }
table.chart th .cn { font-size: 10px; display: block; text-align: center; white-space: nowrap; }
table.chart thead th { vertical-align: bottom; }
table.chart tbody th { text-align: left; white-space: nowrap; }
table.chart tbody th .rh { display: flex; align-items: center; gap: 6px; padding-right: 6px; }
table.chart tbody th svg { width: 28px; height: 28px; margin: 0; }
table.chart td { width: 38px; height: 34px; text-align: center; font-weight: 900; font-size: 14px; border-radius: 4px; cursor: default; }
table.chart td.w { background: #3e5a26; color: #b7e98b; }
table.chart td.l { background: #5a2722; color: #ff9d8f; }
table.chart td.t { background: #4a4743; color: #ddd; }
table.chart td.x { background: transparent; color: #555; }
table.chart td.hl, table.chart th.hl { outline: 2px solid #ffffffaa; }
table.chart tr:hover th, table.chart td:hover { filter: brightness(1.25); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); margin: 10px 4px 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 16px; height: 16px; border-radius: 4px; display: inline-block; }
table.chart td.x { background: repeating-linear-gradient(135deg, transparent 0 4px, #ffffff0d 4px 7px); }
table.chart td.m { box-shadow: inset 0 0 0 2px #e2b03a88; }
.chart-switch { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; flex-wrap: wrap; }
.chart-switch .seg { flex: 0 1 auto; }
.chart-switch .seg button { padding: 8px 14px; }
.family-seg button { font-size: 15px; }
.chart-notes { margin-top: 12px; font-size: 14px; }
.chart-legend-list { margin: 0; padding-inline-start: 20px; }
.chart-legend-list li { margin: 4px 0; }
.sets-wrap { overflow-x: auto; background: var(--panel); border-radius: 10px; padding: 8px; }
.sets-table { border-collapse: separate; border-spacing: 2px; font-size: 13px; margin: 0 auto; }
.sets-table th { color: var(--text-2); font-weight: 800; padding: 2px 4px; white-space: nowrap; text-align: start; }
.sets-table thead th svg { width: 26px; height: 26px; display: block; margin: 0 auto; }
.sets-table td { width: 30px; text-align: center; font-weight: 800; color: #fff; background: #3a3936; border-radius: 4px; }
.sets-table td.none { background: transparent; }
.sim { display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: center; background: var(--panel); border-radius: 10px; padding: 20px; }
.sim-side { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.sim-side .sim-tile { width: 110px; height: 110px; transition: transform .3s, opacity .3s; }
.sim-side .sim-tile svg { width: 100%; height: 100%; }
.sim-side.lost .sim-tile { opacity: .3; transform: scale(.85) rotate(-8deg); }
.sim-side select { width: 100%; }
.sim-vs { font-size: 26px; font-weight: 900; color: var(--text-3); }
.sim-result { grid-column: 1 / -1; text-align: center; font-size: 17px; font-weight: 700; padding: 12px; border-radius: 8px; background: var(--panel-3); }
.sim-result small { display: block; color: var(--text-3); font-size: 13px; font-weight: 600; margin-top: 4px; }

/* -------------------------------------------------------------- settings --- */
.theme-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.theme-swatch { border-radius: 6px; overflow: hidden; cursor: pointer; border: 2px solid transparent; aspect-ratio: 1; display: grid; grid-template-columns: 1fr 1fr; }
.theme-swatch.on { border-color: var(--green); }
.theme-swatch i { display: block; }
.theme-name { font-size: 11px; text-align: center; color: var(--text-3); margin-top: 3px; font-weight: 700; }

/* ------------------------------------------------------------ responsive --- */
@media (max-width: 1100px) {
  .side-panel { width: 340px; }
  .hero { grid-template-columns: 1fr; gap: 24px; min-height: 0; }
  .hero-board { height: 56vh; }
  .features, .learn-links { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .app { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 0 6px; position: sticky; top: 0; overflow-x: auto; }
  .logo { padding: 8px; }
  .logo-text { display: none; }
  .nav { flex-direction: row; }
  .nav a { padding: 12px 10px; border-left: 0; border-bottom: 3px solid transparent; }
  .nav a span.lbl { display: none; }
  .nav a.active { border-bottom-color: var(--green); }
  .side-bottom { margin: 0 0 0 auto; flex-direction: row; padding: 0; align-items: center; }
  .me-chip .nm, .me-chip .rt, .conn { display: none; }
  .main { overflow: visible; }
  .game-layout { flex-direction: column; height: auto; padding: 10px 8px 24px; gap: 12px; }
  .board-col { width: 100%; }
  .board-stack { height: auto; }
  .board-area { height: auto; min-height: 0; flex: none; }
  .player-bar .thinking, .player-bar .ready-check { display: none; }
  .side-panel { width: 100%; max-height: none; min-height: 320px; }
  .page { padding: 20px 14px 50px; }
  .hero h1 { font-size: 34px; }
  .clock { font-size: 20px; min-width: 92px; }
  .sim { grid-template-columns: 1fr; }
}

.board.no-hints .hl.dot::after, .board.no-hints .hl .ring-box { display: none; }
.board-small { box-shadow: 0 2px 6px #0006; border-radius: 3px; }
.board-small .piece { filter: none; }
.board-small .river { box-shadow: none; }
.board-small .hq-mark { display: none; }
.board-small .bridge { border-width: 1.5px; top: -2px; bottom: -2px; }

/* ------------------------------------------------------------ mode picker --- */
/* mode cards with a live board thumbnail, grouped under the two families */
.mode-groups { display: flex; flex-direction: column; gap: 6px; }
.family-head { display: flex; flex-direction: column; gap: 1px; margin-top: 6px; }
.family-head b { font-family: var(--font-head); font-size: 15px; color: #fff; letter-spacing: .02em; }
.family-head span { font-size: 12px; color: var(--text-3); line-height: 1.3; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 8px; }
.mode-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; text-align: start; background: var(--panel-2); border: 2px solid var(--line); border-radius: 10px; padding: 7px; color: var(--text); font: inherit; }
button.mode-card { cursor: pointer; }
button.mode-card:hover { border-color: var(--gray-hi); }
.mode-card.on { border-color: var(--green-hi); background: rgba(95, 165, 100, .13); box-shadow: 0 0 0 2px rgba(95, 165, 100, .28); }
.mc-thumb { display: flex; align-items: center; justify-content: center; height: 104px; border-radius: 6px; background: rgba(0, 0, 0, .18); pointer-events: none; overflow: hidden; }
.mc-thumb .board { box-shadow: 0 0 0 2px #1d1f21, 0 3px 8px #0006; }
.mc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mc-name { color: #fff; font-size: 14px; line-height: 1.2; font-family: var(--font-head); }
.mc-meta { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: 11.5px; color: var(--text-3); }
.mc-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.mc-desc { font-size: 12px; color: var(--text-2); line-height: 1.3; }
.mode-tag.rated { background: #283c58; color: #a9c9f2; }
.mode-chosen { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 14px; color: #fff; flex-wrap: wrap; }
.mode-about { margin-top: 6px; font-size: 13px; }
.mode-about summary { cursor: pointer; font-weight: 700; color: var(--text-2); }
.mode-about ul { margin: 4px 0; padding-inline-start: 18px; }
.mode-about p { margin: 6px 0; }
.vote-panel .mode-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }

/* ------------------------------------------------------------ mode pages --- */
.mode-page { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; margin-top: 14px; }
.mode-page-board { flex: none; padding: 8px; max-width: 100%; overflow: auto; }
.mode-page-text { flex: 1 1 320px; min-width: 0; }
.mode-rules { margin: 0; padding-inline-start: 20px; font-size: 14.5px; }
.mode-rules li { margin: 5px 0; }
.mode-pieces { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.mp-item { display: flex; align-items: center; gap: 6px; background: var(--panel-2); border-radius: 8px; padding: 4px 8px; font-size: 12.5px; min-width: 0; }
.mp-item svg { width: 26px; height: 26px; flex: none; }
.mp-item b { color: #fff; }
.mp-item .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* your marks on hidden enemy pieces: the guessed symbol plus a ? ! ✕ or ✓ badge */
.piece .mark { position: absolute; inset: 0; pointer-events: none; }
.piece .mark-sym { position: absolute; left: 50%; top: 50%; width: 56%; height: 56%; transform: translate(-50%, -46%); filter: drop-shadow(0 1px 1px #000a); }
.piece .mark-sym svg { width: 100%; height: 100%; }
.piece .mark-badge { position: absolute; top: -9%; right: -9%; width: 40%; height: 40%; min-width: 14px; min-height: 14px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font: 900 max(9px, calc(var(--s) * .23))/1 var(--font-head); color: #fff; border: 2px solid #fff; box-shadow: 0 1px 3px #0009; }
.mark-badge.q { background: #5d6f84; }
.mark-badge.few { background: #e09a1e; }
.mark-badge.x { background: #d4463a; }
.mark-badge.check { background: #3d9a4c; }
/* an enemy piece shown face up because the game deduced it, not because it was revealed */
.piece.deduced::after { content: ''; position: absolute; inset: 3%; border: 2px dashed rgba(255, 255, 255, .75); border-radius: 12%; pointer-events: none; }
/* annotation drawings sit above the pieces and never catch clicks */
.an-layer { pointer-events: none; z-index: 4; }

/* the opponent asked for a rematch */
.btn.pulse { animation: btnpulse 1.8s ease-in-out infinite; }
@keyframes btnpulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--green) 35%, transparent); } }
@media (prefers-reduced-motion: reduce) { .btn.pulse { animation: none; outline: 2px solid var(--gold); } }

/* ---------------------------------------------------- server restart strip --- */
.maint-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 190; min-height: 34px; display: flex; align-items: center; gap: 8px; padding: 6px 14px 8px; background: #3a3220; border-bottom: 1px solid #6b5a2e; color: #f3e6c4; font-size: 13px; font-weight: 600; }
.maint-banner .icon, .maint-banner svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--gold); }
.maint-text { flex: 1; min-width: 0; }
.maint-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: #0003; }
.maint-bar i { display: block; height: 100%; background: var(--gold); transition: width 1s linear; }
body.has-maint .app { height: calc(100vh - 34px); margin-top: 34px; }
@media (max-width: 860px) { body.has-maint .app { height: auto; } .maint-banner { position: sticky; } body.has-maint .app { margin-top: 0; } }

/* chat tools: mute and report */
.chat-tools { display: flex; justify-content: flex-end; gap: 4px; margin: -4px -6px 6px; }
.chat-tools .btn { color: var(--text-3); font-weight: 600; }

/* ------------------------------------------------------ names and lobby --- */
/* "(Guest)" before a guest's name: smaller and softer than the name itself */
.guest-tag { font-size: .78em; font-weight: 600; color: var(--text-3); letter-spacing: .01em; }
.nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lobby-item .li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lobby-item .li-main .li-name { display: flex; align-items: baseline; gap: 6px; }
.li-rating { color: var(--text-3); font-weight: 700; font-size: 12.5px; flex: none; }
.li-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.li-chip { font-size: 11px; font-weight: 700; color: var(--text-2); background: var(--panel-3); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.li-chip.rated { background: #283c58; color: #a9c9f2; }
.li-chip.plain { background: none; color: var(--text-3); padding-inline: 2px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding-inline-end: 16px; }
.section-head .count { margin-inline-start: 6px; color: var(--text-2); }
.section-head .link-btn { font-size: 12.5px; }
.watch-code { display: flex; gap: 6px; padding: 4px 14px 10px; }
.watch-code input { flex: 1; min-width: 0; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); padding: 6px 10px; font: inherit; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.watch-code input::placeholder { font-family: var(--font); text-transform: none; letter-spacing: 0; color: var(--text-3); }
.empty-state.small { padding: 10px 18px 18px; font-size: 13px; }
.live-list { display: flex; flex-direction: column; gap: 6px; padding: 0 10px 14px; }
.live-game { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); color: inherit; text-decoration: none; border: 1px solid transparent; }
.live-game:hover { background: var(--panel-3); border-color: var(--line); }
.live-game .lg-players { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.lg-player { display: flex; align-items: center; gap: 7px; min-width: 0; font-weight: 700; font-size: 14px; }
.lg-player .lg-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 6px; }
.lg-watching { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; color: var(--text-3); }
.lg-watching .ico, .watch-count .ico { width: 14px; height: 14px; }
.live-game .li-chips { grid-column: 1 / -1; }

/* --------------------------------------------------------- spectators --- */
.turn-line { padding: 8px 14px; font-weight: 800; font-size: 14px; color: var(--text-2); border-bottom: 1px solid var(--line); font-family: var(--font-head); letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.turn-line.mine { color: #8fd092; }
.turn-line .tl-count { margin-inline-start: auto; font-size: 12px; font-weight: 700; }
.watch-count { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; color: var(--text-3); }
.watch-bar { display: flex; flex-direction: column; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.panel-pad .watch-bar { margin: -4px 0 0; border-radius: 8px; border-bottom: 0; }
.watch-bar .wb-head { display: flex; align-items: center; gap: 7px; font-size: 14px; }
.watch-bar .wb-head .muted { margin-inline-start: auto; font-size: 12.5px; font-weight: 700; }
.watch-bar .wb-views button { font-size: 12.5px; padding: 6px 4px; }
.watch-bar .wb-note { font-size: 12.5px; }
.chat-note { padding: 12px 14px; font-size: 13.5px; color: var(--text-3); }
.chat-msg .spec-name { color: var(--text); text-decoration: none; }
.chat-msg .spec-name:hover { text-decoration: underline; }
.rule-seg button { white-space: nowrap; padding-inline: 12px; }
.legal-line { margin-top: 40px; font-size: 13px; text-align: center; }
/* the move limit between two people, next to the name of the player who has to move */
.deadline-tag { font-size: 11.5px; font-weight: 800; color: #f2cf7e; background: #4a3c22; border-radius: 9px; padding: 1px 8px; font-family: var(--font-mono); flex-shrink: 0; }
.deadline-tag.urgent { color: #fff; background: var(--red-army); }
