/* Chess: a premium stage (player cards with their captured pieces, a framed board with coordinates, a status line and controls that never change size, so nothing moves while playing).
   Pieces come from src/features/chess/chess-pieces.js; the page is built by src/features/chess/chess.js. Load order: after the feature styles. */
.ch-online { text-align: left; max-width: 520px; margin: 0 auto; }
.ch-olabel { margin: .9em 0 .3em; font-weight: 800; color: var(--navy); }
.ch-olist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ch-orow { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px; border: 1.5px solid #e6e8f2; border-radius: 14px; background: #fff; }

/* ── the stage ── */
.ch-wrap { width: min(100%, 580px); margin: 8px auto; padding: 14px 12px 16px; border-radius: 26px; color: #f4efe6; text-align: center;
  background: radial-gradient(120% 80% at 50% 0%, #2c2f45 0%, #161825 55%, #0e0f19 100%); box-shadow: 0 24px 48px rgba(8, 9, 20, .45), inset 0 1px 0 rgba(255, 255, 255, .07); display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* player cards: a fixed height, so a capture never moves the board */
.ch-bar { width: 100%; height: 58px; box-sizing: border-box; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 8px; border-radius: 18px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); transition: background .25s, border-color .25s, box-shadow .25s; }
.ch-bar.on { background: rgba(255, 213, 74, .09); border-color: rgba(255, 213, 74, .55); box-shadow: 0 0 0 3px rgba(255, 213, 74, .1), 0 6px 18px rgba(0, 0, 0, .25); }
.ch-av { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 1.35rem; background: linear-gradient(145deg, #4a4f6d, #272a40); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 2px 6px rgba(0, 0, 0, .35); }
.ch-who { flex: none; min-width: 74px; max-width: 34%; text-align: left; line-height: 1.15; overflow: hidden; }
.ch-who b { display: block; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-who small { display: block; font-size: .72rem; color: #a9adc3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-tray { flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; justify-content: flex-start; padding-left: 8px; overflow: hidden; }
.ch-tray .ch-pc { flex: none; position: static; display: block; width: 22px; height: 34px; margin-left: -9px; } .ch-tray .ch-pc:first-child { margin-left: 0; }
.ch-tray .ch-svg { position: static; width: 100%; height: 100%; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .5)); }
.ch-adv { flex: none; width: 2.4em; text-align: right; font-weight: 800; font-size: .95rem; color: #ffd54a; }

/* the board: a carved frame around 64 squares, with a/b/c and 1/2/3 along the edges */
.ch-boxwrap { position: relative; width: min(100%, 560px, 70vh); box-sizing: border-box; padding: 18px 12px 12px; border-radius: 18px; background: linear-gradient(145deg, #8a5d34, #5e3b1e 55%, #4a2f18); box-shadow: 0 18px 36px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 220, 170, .35), inset 0 -2px 3px rgba(0, 0, 0, .35); }
.ch-board { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); grid-template-rows: repeat(8, minmax(0, 1fr)); width: 100%; aspect-ratio: 1; border-radius: 6px; box-shadow: 0 0 0 2px rgba(30, 16, 6, .8), 0 0 0 3px rgba(255, 220, 170, .25); --lt: #e4e5ee; --dk: #4a4d63; }
.ch-board.ch-wood { --lt: #efe3cb; --dk: #9c7b57; } .ch-board.ch-green { --lt: #eeeed2; --dk: #769656; } .ch-board.ch-blue { --lt: #dee3e6; --dk: #8ca2ad; } .ch-board.ch-slate { --lt: #e4e5ee; --dk: #4a4d63; }
.ch-sq { position: relative; display: grid; place-items: center; border: 0; padding: 0; margin: 0; min-height: 0; border-radius: 0; overflow: visible; cursor: pointer; line-height: 1; box-shadow: none; -webkit-tap-highlight-color: transparent; }
.ch-sq.l { background: var(--lt); } .ch-sq.d { background: var(--dk); }
.ch-board .ch-sq:first-child { border-top-left-radius: 5px; } .ch-board .ch-sq:nth-child(8) { border-top-right-radius: 5px; } .ch-board .ch-sq:nth-child(57) { border-bottom-left-radius: 5px; } .ch-board .ch-sq:last-child { border-bottom-right-radius: 5px; }
.ch-co { position: absolute; font-style: normal; font-weight: 700; font-size: clamp(.5rem, 1.7vw, .72rem); line-height: 1; pointer-events: none; opacity: .75; }
.ch-co.f { right: 4%; bottom: 3%; } .ch-co.r { left: 4%; top: 4%; } .ch-sq.l .ch-co { color: var(--dk); } .ch-sq.d .ch-co { color: var(--lt); }
/* highlights */
.ch-sq.last { background-image: linear-gradient(rgba(255, 214, 90, .42), rgba(255, 214, 90, .42)); }
.ch-sq.sel { background-image: linear-gradient(rgba(255, 213, 74, .75), rgba(255, 213, 74, .75)); box-shadow: inset 0 0 0 3px rgba(255, 240, 160, .9); }
.ch-sq.chk { background-image: radial-gradient(circle at 50% 50%, rgba(255, 70, 50, .95) 0%, rgba(255, 70, 50, .55) 45%, rgba(255, 70, 50, 0) 75%); }
.ch-sq.tg::after { content: ''; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(20, 24, 50, .32); box-shadow: 0 0 0 2px rgba(255, 255, 255, .25); } .ch-sq.d.tg::after { background: rgba(255, 255, 255, .5); box-shadow: 0 0 0 2px rgba(0, 0, 0, .15); }
.ch-sq.cap { box-shadow: inset 0 0 0 4px rgba(236, 84, 58, .85); border-radius: 0; }
@media (hover: hover) { .ch-sq:hover { filter: brightness(1.08); } .ch-sq:hover .ch-svg { transform: translateY(-3%); } }
/* pieces */
.ch-pc { pointer-events: none; display: grid; place-items: center; width: 100%; height: 100%; }
.ch-sq .ch-pc { position: absolute; inset: 0; }
.ch-svg { width: 100%; height: 100%; transition: transform .12s ease-out; }
.ch-sq .ch-svg { position: absolute; left: 0; bottom: 3%; width: 100%; height: 124%; overflow: visible; filter: drop-shadow(0 4px 3px rgba(0, 0, 0, .38)); }
.ch-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ch-arrow { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 3; opacity: .55; stroke: #f0a500; fill: #f0a500; }
/* promotion: a small panel over the board, so the page never grows */
.ch-promo { position: absolute; z-index: 8; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; gap: 8px; align-items: center; padding: 12px 14px; border-radius: 18px; background: rgba(18, 19, 32, .94); border: 1px solid rgba(255, 255, 255, .15); box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.ch-promo[hidden] { display: none; } .ch-promo > span { font-size: .8rem; color: #c9cce0; margin-right: 4px; }
.ch-promo button { width: 58px; height: 74px; padding: 4px; border-radius: 14px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); }
.ch-promo .ch-pc { position: static; width: 100%; height: 100%; } .ch-promo .ch-svg { position: static; filter: none; }
/* status and controls: fixed height */
.ch-status { width: 100%; height: 44px; margin: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 700; font-size: .98rem; line-height: 1.25; color: #fff; overflow: hidden; }
.ch-moves { width: 100%; height: 38px; box-sizing: border-box; display: flex; align-items: center; gap: 4px; padding: 0 10px; border-radius: 12px; background: rgba(0, 0, 0, .25); overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: none; font-size: .86rem; color: #c9cce0; }
.ch-moves::-webkit-scrollbar { display: none; }
.ch-mn { flex: none; color: #7f84a0; font-size: .76rem; margin-left: 6px; }
.ch-mv { flex: none; border: 0; background: transparent; color: #e8e6f2; font: inherit; font-weight: 600; padding: 3px 7px; border-radius: 8px; cursor: pointer; min-height: 0; height: auto; box-shadow: none; }
.ch-mv:hover { background: rgba(255, 255, 255, .1); } .ch-mv.on { background: #ffd54a; color: #2b1d00; }
.ch-ctl { width: 100%; min-height: 88px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-content: start; }
.ch-wrap .ch-ctl button { margin: 0; width: 100%; height: 40px; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 999px; font-size: .86rem; color: #f4efe6; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .16); box-shadow: none; }
.ch-wrap .ch-ctl button:hover:not(:disabled) { background: rgba(255, 255, 255, .14); } .ch-wrap .ch-ctl button:disabled { opacity: .4; }
.ch-wrap .ch-ctl button.small:not(.ghost) { background: linear-gradient(145deg, #ffd54a, #f0a500); color: #2b1d00; border-color: transparent; font-weight: 800; }

/* ── start screen: piece style and board choosers ── */
.ch-styles { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.ch-style { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 10px 10px; border-radius: 14px; background: var(--card, #fff); border: 2px solid var(--line, #dfe2ec); color: inherit; cursor: pointer; min-width: 150px; }
.ch-style.on, .ch-bd.on { border-color: var(--y-deep, #1c4fd8); box-shadow: 0 0 0 3px rgba(28, 79, 216, .18); }
.ch-style small, .ch-bd small { color: var(--muted, #667); font-size: .75rem; }
.ch-prev { display: flex; gap: 2px; padding: 4px 8px; border-radius: 10px; background: #4a4d63; }
.ch-prev.ch-wood { background: linear-gradient(90deg, #efe3cb 50%, #9c7b57 50%); }
.ch-prev .ch-pc { position: static; width: 34px; height: 54px; display: block; } .ch-prev .ch-svg { position: static; width: 100%; height: 100%; filter: none; }
.ch-boards { display: flex; gap: 8px; justify-content: center; margin-bottom: 8px; }
.ch-bd { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 8px; border-radius: 12px; background: var(--card, #fff); border: 2px solid var(--line, #dfe2ec); color: inherit; cursor: pointer; }
.ch-sw { width: 40px; height: 40px; border-radius: 6px; display: block; background: conic-gradient(var(--sl, #e4e5ee) 25%, var(--sd, #4a4d63) 0 50%, var(--sl, #e4e5ee) 0 75%, var(--sd, #4a4d63) 0); }
.ch-sw.ch-wood { --sl: #efe3cb; --sd: #9c7b57; } .ch-sw.ch-green { --sl: #eeeed2; --sd: #769656; } .ch-sw.ch-blue { --sl: #dee3e6; --sd: #8ca2ad; } .ch-sw.ch-slate { --sl: #e4e5ee; --sd: #4a4d63; }
@media (max-width: 420px) { .ch-wrap { padding: 10px 8px 12px; border-radius: 20px; } .ch-boxwrap { padding: 8px; border-radius: 14px; } .ch-bar { height: 52px; } .ch-av { width: 34px; height: 34px; font-size: 1.1rem; } .ch-who { min-width: 60px; } .ch-wrap .ch-ctl button { padding: 0 11px; font-size: .8rem; } }
@media (prefers-reduced-motion: reduce) { .ch-svg, .ch-bar { transition: none; } }
