:root {
  --bg: #0d0f14; --panel: #151923; --text: #e8eaf0; --dim: #8a90a0; --accent: #ff6b6b; --accent2: #7bd88f;
  --light: #e9d8b6; --dark: #8a6a4a; --sel: rgba(255, 220, 80, .55); --last: rgba(120, 200, 255, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: #79b8ff; }
.top { text-align: center; padding: 24px 16px 8px; }
.top h1 { margin: 0; font-size: 2rem; letter-spacing: .02em; }
.tagline { color: var(--dim); margin: 6px auto 0; max-width: 640px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: 24px; max-width: 1100px; margin: 0 auto; padding: 16px; }
@media (max-width: 860px) { .layout { grid-template-columns: 1fr; } }
.game { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.status { min-height: 1.6em; font-weight: 600; text-align: center; }
.thinking .status::after { content: ' 🪰'; animation: buzz .3s infinite alternate; display: inline-block; }
@keyframes buzz { from { transform: translate(0, 0) rotate(-8deg); } to { transform: translate(2px, -2px) rotate(8deg); } }
.board-wrap { width: min(92vw, 560px); aspect-ratio: 1; }
.board { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: 100%; height: 100%;
  border-radius: 6px; overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,.5); user-select: none; }
.sq { position: relative; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sq.light { background: var(--light); } .sq.dark { background: var(--dark); }
.sq.last { box-shadow: inset 0 0 0 100px var(--last); }
.sq.selected { box-shadow: inset 0 0 0 100px var(--sel); }
.sq.target::after { content: ''; width: 26%; height: 26%; border-radius: 50%; background: rgba(0,0,0,.28); position: absolute; }
.sq.capture::after { content: ''; position: absolute; inset: 6%; border-radius: 50%; border: 4px solid rgba(0,0,0,.3); }
.sq.check { box-shadow: inset 0 0 0 100px rgba(255, 60, 60, .55); }
.piece { font-size: min(9vw, 52px); line-height: 1; z-index: 1; pointer-events: none; }
.piece.white { color: #fafafa; text-shadow: 0 0 2px #000, 0 1px 2px #000; }
.piece.black { color: #111; text-shadow: 0 0 2px #fff8; }
.coord { position: absolute; font-size: 10px; font-style: normal; opacity: .7; }
.coord.rank { top: 2px; left: 3px; } .coord.file { bottom: 1px; right: 3px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.controls label { display: flex; gap: 6px; align-items: center; color: var(--dim); font-size: .95rem; }
select, button { background: var(--panel); color: var(--text); border: 1px solid #2a3040; border-radius: 6px; padding: 6px 10px; font: inherit; cursor: pointer; }
button:hover { border-color: var(--accent); }
.moves { width: min(92vw, 560px); max-height: 120px; overflow: auto; background: var(--panel); border-radius: 6px; padding: 8px 12px; font-family: ui-monospace, Menlo, monospace; font-size: .9rem; }
.moves .n { color: var(--dim); }
.brain { background: var(--panel); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.brain h2 { margin: 0 0 4px; font-size: 1.2rem; } .brain h3 { margin: 12px 0 4px; font-size: 1rem; }
.dim { color: var(--dim); font-weight: 400; font-size: .9em; }
.hint { color: var(--dim); font-size: .85rem; margin: 4px 0; }
canvas { width: 100%; height: auto; border-radius: 6px; background: var(--bg); image-rendering: pixelated; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: .8rem; color: var(--dim); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.sw.plus { background: var(--accent2); } .sw.minus { background: var(--accent); }
.mood-label { display: flex; justify-content: space-between; font-size: .85rem; color: var(--dim); }
.mood-bar { position: relative; height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.mood-fill { position: absolute; top: 0; bottom: 0; left: 50%; width: 0; transition: all .3s; }
.mood-fill.pos { background: var(--accent2); } .mood-fill.neg { background: var(--accent); }
.mood-mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: #fff4; }
.about { max-width: 820px; margin: 24px auto 48px; padding: 0 16px; color: #c9cdd8; }
.about h2 { font-size: 1.3rem; }
.about li { margin-bottom: 6px; }
