/* Chess analysis board. Board colours are neutral greys in both themes (the pieces are the puzzle); move grades use the
   site's pastel tokens with dark text so they read in both themes. */
.an .split > *, .an .panel { min-width: 0; }
.an { --an-light: #ecece6; --an-dark: #a9aaa2; }
.an-load { margin: 0 0 12px; }
.an-load textarea { font-family: var(--mono); font-size: 14px; width: 100%; resize: vertical; }
.an-top { justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.an-players { font-size: 14px; color: var(--muted); margin: 10px 0 0; }
.an-players b { color: var(--ink); font-weight: 600; }
.an-palette { margin-top: 12px; }
.an-pal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 4px; max-width: 420px; }
.an-pal { aspect-ratio: 1; min-height: 40px; border: 1px solid var(--line); background: var(--canvas); border-radius: var(--r-md); padding: 3px; cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--ink); font: inherit; font-size: 12px; position: relative; }
.an-pal .cp { position: relative; inset: auto; display: block; width: 100%; height: 100%; }
.an-pal[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); background: var(--soft-2); }
.an-stage { display: flex; gap: 8px; margin-top: 14px; align-items: stretch; max-width: 560px; }
.an-evalbar { position: relative; width: 16px; flex: none; border-radius: 6px; overflow: hidden; background: #1b1b1b; border: 1px solid #6b6b6b; }
.an-evalfill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: #f4f4f0; transition: height .35s ease; }
.an-evalbar.flip .an-evalfill { bottom: auto; top: 0; }
.an-evalbar span { position: absolute; left: 0; right: 0; bottom: 3px; text-align: center; font-family: var(--mono); font-size: 9px; color: #000; writing-mode: vertical-rl; transform: rotate(180deg); }
.an-evalbar.neg span { bottom: auto; top: 3px; color: #fff; }
.an-boardwrap { position: relative; flex: 1; min-width: 0; }
.an-board { display: grid; grid-template-columns: repeat(8, 1fr); border-radius: 6px; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; box-shadow: 0 0 0 1px var(--line); }
.an-sq { position: relative; aspect-ratio: 1; border: 0; padding: 0; margin: 0; min-width: 0; background: var(--an-light); cursor: pointer; display: block; -webkit-tap-highlight-color: transparent; }
.an-sq.dk { background: var(--an-dark); }
.an-sq.last::before { content: ""; position: absolute; inset: 0; background: rgba(40, 40, 40, .22); }
.an-sq.sel::before { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .34); }
.an-sq.chk::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(217, 45, 32, .75) 0, rgba(217, 45, 32, .35) 45%, transparent 72%); }
.an-sq.tg::after { content: ""; position: absolute; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: rgba(0, 0, 0, .3); }
.an-sq.tg.cap::after { left: 4%; top: 4%; width: 92%; height: 92%; background: transparent; box-shadow: inset 0 0 0 4px rgba(0, 0, 0, .3); }
.an-sq:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; z-index: 2; }
.an .cp { position: absolute; inset: 3%; background-size: contain; background-repeat: no-repeat; background-position: center; pointer-events: none; z-index: 1; }
.an-sq.lift .cp { opacity: .25; }
.an-co { position: absolute; font-family: var(--mono); font-size: 10px; line-height: 1; color: rgba(0, 0, 0, .8); pointer-events: none; z-index: 1; }
.an-co.rk { left: 3px; top: 3px; } .an-co.fl { right: 3px; bottom: 3px; }
.an-ghost { position: fixed; z-index: 80; width: 56px; height: 56px; pointer-events: none; background-size: contain; background-repeat: no-repeat; transform: translate(-50%, -50%); filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }
.an-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.an-promo { position: absolute; inset: 0; z-index: 5; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; gap: 8px; border-radius: 6px; }
.an-promo button { width: 22%; aspect-ratio: 1; border: 0; border-radius: 12px; background: var(--an-light); cursor: pointer; position: relative; }
.an-nav { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 12px; max-width: 560px; }
.an-nav .btn-icon { width: 44px; min-height: 44px; }
.an-ply { flex: 1; text-align: center; font-size: 14px; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-turn { margin-top: 14px; align-items: center; gap: 10px; }
.an-castle { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; margin-top: 6px; }
.an-graphbox { margin-top: 16px; }
.an-graph { display: block; width: 100%; height: 120px; border-radius: 8px; cursor: pointer; }
.an-graph circle { stroke: #000; stroke-width: 1.2; }
.an-graph .g-blunder { fill: var(--pink); } .an-graph .g-mistake { fill: var(--coral); } .an-graph .g-inaccuracy { fill: var(--cream); }
.an-info { margin-top: 12px; font-size: 15px; }
.an-info p { margin: 6px 0; }
.an-cur b { color: var(--ink); }
.an-better b { color: var(--ink); }
.an-loss { color: var(--muted); font-size: 13px; }
.an-comment { color: var(--muted); font-style: italic; }
.an-badge, .an-dot { display: inline-block; border-radius: var(--pill); font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .4px; padding: 2px 8px; color: #000; background: var(--soft-2); }
.an-dot { width: 10px; height: 10px; padding: 0; margin-right: 8px; vertical-align: 0; border: 1px solid rgba(0,0,0,.35); }
.c-best.an-badge, .c-best.an-dot { background: var(--mint); } .c-good.an-badge, .c-good.an-dot { background: #e4efe6; }
.c-inaccuracy.an-badge, .c-inaccuracy.an-dot { background: var(--cream); } .c-mistake.an-badge, .c-mistake.an-dot { background: var(--coral); }
.c-blunder.an-badge, .c-blunder.an-dot { background: var(--pink); } .c-forced.an-badge { background: var(--soft-2); color: var(--ink); }
.an-movesbox { margin-top: 16px; }
.an-moves { max-height: 260px; overflow-y: auto; font-family: var(--mono); font-size: 14px; line-height: 2; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; }
.an-num { color: var(--muted); margin: 0 2px 0 6px; }
.an-mv { font: inherit; background: transparent; border: 0; border-radius: 6px; padding: 2px 6px; color: var(--ink); cursor: pointer; min-height: 32px; }
.an-mv:hover { background: var(--soft-2); }
.an-mv i { font-style: normal; font-weight: 600; margin-left: 1px; }
.an-mv.c-inaccuracy i, .an-mv.c-mistake i, .an-mv.c-blunder i { color: #000; background: var(--cream); border-radius: 4px; padding: 0 3px; }
.an-mv.c-mistake i { background: var(--coral); } .an-mv.c-blunder i { background: var(--pink); }
.an-mv.cur { background: var(--ink); color: var(--canvas); }
.an-var { color: var(--muted); font-size: 13px; }
.an-var .an-mv { color: var(--body); font-size: 13px; }
.an-var .an-mv.cur { color: var(--canvas); }
.an-cmt { display: block; color: var(--muted); font-family: var(--font); font-size: 13px; line-height: 1.4; margin: 2px 0 4px 6px; }
.an-res { font-weight: 600; margin-left: 8px; color: var(--ink); }
.an-settings { gap: 10px; align-items: flex-end; }
.an-settings .field { flex: 1 1 150px; }
.an-settings .field:last-child:not(:first-child) { flex: 0 0 90px; }
.an-live-h { margin-top: 28px; }
.an-sum { margin-top: 12px; font-size: 14px; }
.an-sum td, .an-sum th { padding: 7px 10px; }
.an-jump-h { margin: 14px 0 6px; }
.an-run { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 12px; }
.an-prog { width: 100%; height: 6px; border-radius: 3px; background: var(--soft-2); overflow: hidden; margin-top: 8px; }
.an-prog i { display: block; height: 100%; width: 0; background: var(--ink); transition: width .2s; }
.an-pvs { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.an-pv { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-md); padding: 8px 10px; font-size: 14px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: start; }
.an-pv.top { border-color: var(--ink); }
.an-pv b { font-family: var(--mono); font-weight: 500; color: var(--ink); white-space: nowrap; }
.an-pv span { font-family: var(--mono); color: var(--body); word-break: break-word; }
.an-pv .btn { grid-column: 1 / -1; justify-self: start; }
.an-tools { margin-top: 20px; }
.an-tools input[type=text] { font-family: var(--mono); font-size: 14px; }
.an-engine-note { font-size: 13px; }
@media (max-width: 420px) { .an-co { font-size: 8px; } .an-evalbar { width: 12px; } .an-stage { gap: 6px; } }
@media (prefers-reduced-motion: reduce) { .an-evalfill, .an-prog i { transition: none; } }
@media print { .an-right, .an-nav, .an-load, .an-top, .an-var-actions { display: none !important; } }
