/* Checkers — mobile-first; the board is a square CSS grid that fills the width. */
:root { --bg: #0f1726; --panel: #18233b; --panel-line: rgba(255,255,255,0.08); --text: #e8eef9; --muted: #93a3c0; --accent: #10b981; --gold: #f4c150; --field: #0f1726; --light: #ecd9b6; --darksq: #8a5a3b; }
* { box-sizing: border-box; }
html, body { max-width: 100%; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); min-height: 100vh; background: radial-gradient(1200px 600px at 50% -10%, #16213a 0%, var(--bg) 60%); }
.app-header { text-align: center; padding: 14px 16px 6px; }
.logo { font-size: 30px; margin: 0; color: var(--gold); }
.tagline { color: var(--muted); margin: 4px 0 0; letter-spacing: 2px; text-transform: uppercase; font-size: 11px; }
.hdr-links { margin: 8px 0 0; display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.back-link { color: #f5d98a; font-size: 14px; text-decoration: none; padding: 8px 4px; }
.back-link:hover { text-decoration: underline; }
.app-main { display: flex; gap: 18px; justify-content: center; align-items: flex-start; padding: 8px 8px 40px; flex-wrap: wrap; }
.board-panel { width: 100%; max-width: 640px; min-width: 0; background: linear-gradient(160deg, #3a2a17, #241a0f); padding: 8px; border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.5), inset 0 0 0 2px #7a5a2e; }
.board { display: grid; grid-template-columns: repeat(var(--n, 8), 1fr); width: 100%; aspect-ratio: 1; border-radius: 4px; overflow: hidden; touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; box-shadow: 0 0 0 2px #5a3f22; }
.sq { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; }
.sq.light { background: var(--light); }
.sq.dark { background: var(--darksq); cursor: pointer; }
.sq.last { box-shadow: inset 0 0 0 100px rgba(245,217,138,.28); }
.sq.sel { box-shadow: inset 0 0 0 100px rgba(255,212,92,.45); }
.sq.via { box-shadow: inset 0 0 0 100px rgba(120,220,160,.35); }
.sq i { position: absolute; font-style: normal; font-size: 9px; color: rgba(0,0,0,.45); line-height: 1; }
.sq i.cr { top: 2px; left: 2px; }
.sq i.cc { bottom: 2px; right: 3px; }
.pc { width: 80%; height: 80%; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: clamp(12px, 5vw, 30px); line-height: 1; position: relative; z-index: 1; }
.pc.w { background: radial-gradient(circle at 35% 30%, #fffdf6, #d9ceb4); box-shadow: 0 2px 3px rgba(0,0,0,.55), inset 0 0 0 3px #b9ad8f; color: #8a6a1c; }
.pc.b { background: radial-gradient(circle at 35% 30%, #5f6674, #14171d); box-shadow: 0 2px 3px rgba(0,0,0,.65), inset 0 0 0 3px #000; color: #f4c150; }
.pc.can { outline: 2px dashed rgba(255,212,92,.95); outline-offset: 1px; }
.pc.picked { outline: 3px solid #ffd45c; outline-offset: 1px; }
.dot { position: absolute; width: 34%; height: 34%; border-radius: 50%; background: rgba(46,226,122,.9); box-shadow: 0 0 0 2px rgba(10,61,32,.8); z-index: 2; }
.dot.cap { background: rgba(255,90,80,.9); }
.status { margin-top: 8px; min-height: 22px; font-size: 14px; color: #f5d98a; font-weight: 600; }
.info-line { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

.side-panel { width: 100%; max-width: 640px; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px; padding: 16px; box-shadow: 0 18px 40px rgba(0,0,0,.4); }
.panel-title { font-size: 16px; color: #f5d98a; margin: 16px 0 10px; border-bottom: 1px solid var(--panel-line); padding-bottom: 6px; }
.panel-title:first-child { margin-top: 0; }
.turn-indicator { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.turn-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; border: 1px solid #0b1220; }
.turn-dot.w { background: #fdfaf3; box-shadow: 0 0 10px rgba(255,255,255,.5); }
.turn-dot.b { background: #22252c; box-shadow: 0 0 10px rgba(0,0,0,.6); border-color: #777; }
.controls { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.btn-row { display: flex; gap: 6px; }
.btn-row .btn { flex: 1; }
.btn { font: inherit; font-weight: 600; font-size: 14px; color: #06281e; background: var(--accent); border: none; border-radius: 11px; padding: 11px 16px; min-height: 44px; cursor: pointer; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn-sm { padding: 9px 12px; font-size: 13px; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--panel-line); }
.btn-ghost:hover:not(:disabled) { color: #f5d98a; border-color: #f5d98a; }
.help-btn { background: transparent; color: #f5d98a; border: 1px solid rgba(245,217,138,.4); }
.ctl { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ctl select { margin-left: auto; background: var(--field); color: var(--text); border: 1px solid var(--panel-line); border-radius: 6px; padding: 6px 8px; font: inherit; max-width: 62%; }
.ai-status { font-size: 12px; color: #f5d98a; min-height: 16px; font-style: italic; }
.tn-entry { display: flex; gap: 6px; margin-bottom: 8px; }
.tn-entry input, #ol-name { flex: 1; min-width: 0; width: 100%; background: var(--field); color: var(--text); border: 1px solid var(--panel-line); border-radius: 6px; padding: 9px 8px; font: inherit; font-size: 14px; margin-bottom: 8px; }
.tn-entry input { margin-bottom: 0; }
.tn-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.tn-actions .btn { flex: 1; }
.tn-body { font-size: 13px; }
.tn-result { font-size: 15px; color: #f5d98a; margin-bottom: 6px; font-weight: 600; }
.tn-king { color: #ffcf6b; font-weight: 500; margin-bottom: 8px; }
.tn-sub { color: var(--muted); margin: 6px 0 4px; font-size: 12px; }
.tn-hint { color: var(--muted); font-style: italic; font-size: 12px; line-height: 1.45; }
.tn-queue { margin: 0 0 8px; padding-left: 22px; max-height: 140px; overflow-y: auto; }
.move-log { margin: 0; padding: 0; list-style: none; max-height: 240px; overflow-y: auto; font-size: 13px; }
.move-log li { margin: 1px 0; padding: 3px 6px; border-radius: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.move-log li:nth-child(odd) { background: rgba(255,255,255,.03); }
.mv-no { color: var(--muted); min-width: 26px; }
.mv-w { color: #f0f4ff; min-width: 70px; }
.mv-b { color: #b9c6dd; }
.help-overlay { position: fixed; inset: 0; background: rgba(10,6,3,.72); display: none; align-items: center; justify-content: center; z-index: 50; padding: 14px; }
.help-overlay.open { display: flex; }
.help-card { position: relative; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px; max-width: 660px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 22px 20px 20px; box-shadow: 0 24px 70px rgba(0,0,0,.6); }
.help-card h2 { color: #f5d98a; margin: 0 36px 8px 0; font-size: 21px; }
.help-card h3 { color: #f5d98a; font-size: 15px; margin: 16px 0 4px; }
.help-card p, .help-card li { font-size: 14px; line-height: 1.55; }
.help-card p { margin: 6px 0; }
.help-card ul { margin: 6px 0; padding-left: 20px; }
.help-card b { color: #f3e6d3; }
.help-close { position: absolute; top: 8px; right: 10px; background: transparent; border: none; color: var(--muted); font-size: 30px; line-height: 1; cursor: pointer; padding: 6px 10px; }
.help-actions { text-align: right; margin-top: 18px; }
@media (min-width: 900px) {
  .logo { font-size: 44px; }
  .app-main { gap: 24px; padding: 14px 16px 48px; }
  .board-panel { width: min(640px, calc(100vw - 400px)); min-width: 460px; }
  .side-panel { width: 320px; }
  .help-card { padding: 26px 30px; }
}
