/* Stoneborn — interface. Dark glass, thin gold: Cinzel for display, Manrope for everything else (Inter stays as a
   fallback). Cinzel has only capitals (its lower case is small capitals), so it is always set in capitals, every serif
   letter the same height; it is set light (its regular weight) and widely spaced, and only on headings. Small labels
   are Manrope in spaced capitals instead.
   One scale throughout: corners 16 (panels), 14 (cards), 10 (buttons, fields), 8 (chips); buttons 42, 34 and 28 high;
   type 10.5 / 12 / 13.5 / 15 and up. */
@font-face { font-family: 'Cinzel'; font-weight: 400; font-display: swap; src: url('../fonts/cinzel-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 600; font-display: swap; src: url('../fonts/cinzel-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 700; font-display: swap; src: url('../fonts/cinzel-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('../fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 400; font-display: swap; src: url('../fonts/manrope-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 500; font-display: swap; src: url('../fonts/manrope-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 600; font-display: swap; src: url('../fonts/manrope-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Manrope'; font-weight: 700; font-display: swap; src: url('../fonts/manrope-latin-700-normal.woff2') format('woff2'); }

:root {
  --glass: rgba(14, 15, 19, 0.58);
  --glass-strong: rgba(11, 12, 16, 0.8);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.07);
  --gold-line: rgba(230, 196, 124, 0.5);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --gold: #e6c47c;
  --gold-deep: #b98d42;
  --text: #f0ebe1;
  --muted: #a8a297;
  --dim: #6f6b63;
  --danger: #ff7a6b;
  --radius: 16px;
  --display: 'Cinzel', 'Times New Roman', serif;
  --ui: 'Manrope', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050608; color: var(--text); font: 400 14px/1.5 var(--ui); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: 'kern' 1; }
body { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
svg { width: 20px; height: 20px; display: block; flex: none; }

#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; outline: none; }

.glass { background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--radius); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42), var(--edge); }

/* ---------- loader ---------- */
#loader { position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 22px; background: radial-gradient(80% 60% at 50% 40%, #16181f 0%, #050608 70%); transition: opacity 0.9s ease, visibility 0.9s; }
#loader.done { opacity: 0; visibility: hidden; }
.loader-mark { font: 400 clamp(28px, 6vw, 54px)/1 var(--display); letter-spacing: 0.34em; text-transform: uppercase; padding-left: 0.34em; background: linear-gradient(180deg, #f7e2ac, #b98d42); -webkit-background-clip: text; background-clip: text; color: transparent; }
.loader-bar { width: 220px; height: 2px; background: rgba(255, 255, 255, 0.1); overflow: hidden; border-radius: 2px; }
.loader-bar i { display: block; width: 40%; height: 100%; background: var(--gold); animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-110%); } to { transform: translateX(280%); } }
.loader-text { color: var(--muted); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }

/* ---------- cinematic shots: the HUD steps aside, the picture stays full-frame ---------- */
#skip-hint { position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%); z-index: 6; padding: 7px 16px; border-radius: 10px; background: rgba(8, 9, 12, 0.45); color: rgba(255, 255, 255, 0.62); font-size: 10.5px; font-weight: 600; letter-spacing: 0.24em; text-transform: uppercase; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.35s ease; }
body.cinematic #skip-hint { opacity: 1; }
body.replay #skip-hint { display: none; }
#hud { transition: opacity 0.35s ease; }
body.cinematic #hud { opacity: 0; pointer-events: none; }

/* ---------- top bar ---------- */
.topbar { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; padding: calc(14px + var(--safe-t)) 18px 0; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.top-left, .top-right { display: flex; align-items: center; gap: 8px; }
.brand { font: 400 14px/1 var(--display); letter-spacing: 0.36em; text-transform: uppercase; color: var(--gold); margin-left: 8px; opacity: 0.92; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; background: var(--glass); border: 1px solid var(--stroke); color: var(--text); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--edge); transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.15s; }
.icon-btn:hover { background: rgba(36, 38, 46, 0.7); border-color: var(--stroke-strong); color: var(--gold); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 8px; background: none; border-color: transparent; backdrop-filter: none; box-shadow: none; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.icon-btn.on { color: var(--gold); border-color: rgba(230, 196, 124, 0.45); }

.status { position: absolute; left: 50%; top: calc(14px + var(--safe-t)); transform: translateX(-50%); height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 18px; border-radius: 11px; background: var(--glass); border: 1px solid var(--stroke); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: var(--edge); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; white-space: nowrap; transition: border-color 0.3s, box-shadow 0.3s; }
.turn-dot { width: 12px; height: 12px; border-radius: 50%; background: #f3ede0; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 0 12px rgba(160, 215, 255, 0.7); transition: background 0.3s, box-shadow 0.3s; }
.status.black .turn-dot { background: #17161c; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35), 0 0 12px rgba(255, 110, 40, 0.8); }
.status.check { border-color: rgba(255, 122, 107, 0.7); box-shadow: 0 0 24px rgba(255, 90, 70, 0.35); }
.status.thinking .turn-dot { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.55); opacity: 0.5; } }

/* ---------- player plates ---------- */
.plate { position: fixed; left: 18px; z-index: 9; width: 232px; padding: 12px 14px; display: grid; grid-template-columns: 38px 1fr auto; gap: 4px 12px; align-items: center; background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--radius); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); box-shadow: var(--edge); transition: border-color 0.3s, box-shadow 0.3s, opacity 0.3s; }
.plate-top { top: calc(70px + var(--safe-t)); }
.plate-bottom { bottom: calc(92px + var(--safe-b)); }
.plate.active { border-color: rgba(230, 196, 124, 0.55); box-shadow: 0 0 0 1px rgba(230, 196, 124, 0.12), 0 12px 40px rgba(0, 0, 0, 0.5); }
.plate .avatar { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font: 400 20px/1 var(--display); text-transform: uppercase; }
.plate .avatar.w { background: radial-gradient(circle at 35% 30%, #fffdf6, #cfc6b4); color: #6b5a34; box-shadow: inset 0 0 0 2px #e6c47c; }
.plate .avatar.b { background: radial-gradient(circle at 35% 30%, #3a3944, #0c0c10); color: #e08a5c; box-shadow: inset 0 0 0 2px #c8744a; }
.plate .who { min-width: 0; }
.plate .name { display: block; font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plate .title { display: block; color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.plate .adv { font-weight: 600; color: var(--gold); font-size: 13px; min-width: 22px; text-align: right; }
.plate .captured { grid-column: 1 / -1; min-height: 20px; display: flex; flex-wrap: wrap; gap: 0; font-size: 17px; line-height: 20px; letter-spacing: -2px; }
.cap-w { color: #f1ead9; text-shadow: 0 0 1px #000, 0 1px 2px rgba(0, 0, 0, 0.6); }
.cap-b { color: #2a2931; text-shadow: 0 0 1px rgba(255, 255, 255, 0.85), 0 0 2px rgba(255, 255, 255, 0.5); }

/* ---------- move list ---------- */
.moves { position: fixed; right: 18px; top: calc(70px + var(--safe-t)); bottom: calc(92px + var(--safe-b)); width: 208px; z-index: 9; display: flex; flex-direction: column; overflow: hidden; transition: opacity 0.25s, transform 0.25s; }
.moves.closed { opacity: 0; transform: translateX(16px); pointer-events: none; }
.moves header { display: flex; align-items: center; justify-content: space-between; padding: 12px 10px 9px 16px; font: 600 10.5px/1 var(--ui); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); border-bottom: 1px solid var(--stroke); }
#move-list { list-style: none; margin: 0; padding: 8px 8px 12px; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; font-variant-numeric: tabular-nums; }
#move-list li { display: grid; grid-template-columns: 30px 1fr 1fr; align-items: center; padding: 1px 0; }
#move-list .n { color: var(--dim); font-size: 12px; padding-left: 6px; }
#move-list .m { padding: 4px 8px; border-radius: 7px; font-weight: 500; }
#move-list .m.last { background: rgba(230, 196, 124, 0.16); color: var(--gold); }
#move-list .empty { display: block; color: var(--dim); padding: 10px 8px; font-size: 12.5px; }

/* ---------- dock ---------- */
.dock { position: fixed; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); z-index: 10; display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 16px; max-width: calc(100vw - 24px); }
.dock-btn { height: 48px; min-width: 56px; padding: 0 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-radius: 10px; color: var(--text); transition: background 0.2s, color 0.2s, transform 0.15s; }
.dock-btn span { font-size: 9.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); transition: color 0.2s; white-space: nowrap; }
.dock-btn svg { width: 18px; height: 18px; stroke-width: 1.5; }
.dock-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); color: var(--gold); }
.dock-btn:hover:not(:disabled) span { color: var(--text); }
.dock-btn:active:not(:disabled) { transform: translateY(1px); }
.dock-btn:disabled { opacity: 0.32; }
.dock-btn.wide { min-width: 74px; }
.sep { width: 1px; height: 28px; background: var(--stroke); margin: 0 6px; flex: none; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); }
.seg button { height: 32px; padding: 0 13px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--muted); transition: background 0.2s, color 0.2s; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(230, 196, 124, 0.13); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(230, 196, 124, 0.38); }
.speed { display: flex; align-items: center; gap: 10px; padding: 0 12px 0 8px; color: var(--muted); }
.speed output { width: 38px; text-align: right; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.speed input { width: 120px; }

input[type=range] { -webkit-appearance: none; appearance: none; height: 22px; background: transparent; cursor: pointer; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--gold) var(--fill, 50%), rgba(255, 255, 255, 0.14) var(--fill, 50%)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--gold); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: #fff7e2; box-shadow: 0 0 0 3px rgba(230, 196, 124, 0.3), 0 2px 6px rgba(0, 0, 0, 0.5); transition: box-shadow 0.2s; }
input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border: 0; border-radius: 50%; background: #fff7e2; box-shadow: 0 0 0 3px rgba(230, 196, 124, 0.3), 0 2px 6px rgba(0, 0, 0, 0.5); }
input[type=range]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 6px rgba(230, 196, 124, 0.3), 0 2px 6px rgba(0, 0, 0, 0.5); }

/* ---------- main menu ---------- */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; background: linear-gradient(90deg, rgba(4, 5, 8, 0.9) 0%, rgba(4, 5, 8, 0.62) 34%, rgba(4, 5, 8, 0) 68%); pointer-events: none; animation: fade 0.8s ease both; }
@keyframes fade { from { opacity: 0; } }
/* while Stage & Settings is open on the start screen the menu steps aside (it fades back in when the panel closes) */
body.staging #menu { animation: none; opacity: 0; transition: opacity 0.45s ease; }
body.staging #menu .menu-inner { pointer-events: none; }
.menu-inner { pointer-events: auto; padding: 0 clamp(24px, 7vw, 110px); width: min(640px, 100%); }
.eyebrow { margin: 0 0 12px; font-size: 11px; font-weight: 600; letter-spacing: 0.36em; text-transform: uppercase; color: var(--gold); }
.logo { margin: 0; width: max-content; max-width: none; white-space: nowrap; font: 400 clamp(34px, 5.6vw, 72px)/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; background: linear-gradient(180deg, #fff3cf 0%, #e6c47c 45%, #a47a34 100%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 6px 30px rgba(230, 196, 124, 0.22)); }
.tagline { margin: 16px 0 8px; color: var(--text); font-size: 16px; letter-spacing: 0.01em; max-width: 40ch; text-wrap: balance; }
.menu-desc { margin: 0 0 34px; color: var(--muted); font-size: 14.5px; line-height: 1.55; max-width: 46ch; text-wrap: pretty; }
.menu-list { display: grid; gap: 6px; }
.menu-list > button { position: relative; text-align: left; padding: 13px 18px 13px 22px; border-radius: 12px; border: 1px solid transparent; transition: background 0.3s var(--ease), border-color 0.3s, transform 0.3s var(--ease); }
.menu-list > button::before { content: ''; position: absolute; left: 0; top: 50%; width: 3px; height: 0; background: var(--gold); border-radius: 2px; transform: translateY(-50%); transition: height 0.25s; }
.menu-list b { display: block; font: 400 16px/1.25 var(--display); letter-spacing: 0.16em; text-transform: uppercase; }
.menu-list small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; letter-spacing: 0.01em; }
.menu-list > button:hover:not(:disabled), .menu-list > button:focus-visible { background: rgba(255, 255, 255, 0.06); border-color: var(--stroke); transform: translateX(6px); }
.menu-list > button:hover:not(:disabled)::before { height: 60%; }
.menu-list > button:hover:not(:disabled) b { color: var(--gold); }
.menu-list > button:disabled { opacity: 0.42; }
.menu-foot { position: fixed; right: 24px; bottom: calc(44px + var(--safe-b)); margin: 0; color: var(--dim); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
/* the design credit, in the bottom right corner of the start screen */
.credit { position: fixed; right: 24px; bottom: calc(18px + var(--safe-b)); pointer-events: auto; color: var(--muted); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85); font-size: 10.5px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; text-decoration: none; transition: color 0.25s; }
.credit b { font-weight: 600; color: var(--text); transition: color 0.25s; }
.credit:hover b, .credit:focus-visible b { color: var(--gold); }

/* ---------- dialogs ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(3, 4, 6, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade 0.25s ease both; }
.modal.soft { background: rgba(3, 4, 6, 0.28); backdrop-filter: none; -webkit-backdrop-filter: none; }
.card { position: relative; width: min(440px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 30px; background: var(--glass-strong); animation: rise 0.4s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.card.wide { width: min(820px, 100%); }
.card.small { width: min(360px, 100%); }
.card.center { text-align: center; }
.card h2 { margin: 0 0 20px; font: 400 19px/1.25 var(--display); letter-spacing: 0.18em; text-transform: uppercase; }
.card h2.big { font-size: 32px; margin-bottom: 8px; background: linear-gradient(180deg, #fff3cf, #c79a4c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card .close { position: absolute; top: 16px; right: 16px; background: none; border-color: transparent; }
.muted { color: var(--muted); margin: 0 0 22px; }
.stack { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.spacer { flex: 1; }
.label { color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.btn { height: 42px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--stroke-strong); background: rgba(255, 255, 255, 0.03); font: 600 11.5px/1 var(--ui); letter-spacing: 0.13em; text-transform: uppercase; white-space: nowrap; transition: background 0.2s, border-color 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s; }
.btn:hover { background: rgba(230, 196, 124, 0.07); border-color: var(--gold-line); color: #fff8e8; }
.btn:active { transform: translateY(1px); }
.btn.gold { color: #17120a; border-color: rgba(255, 236, 190, 0.3); background: linear-gradient(180deg, #ecd39a 0%, #cba25a 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 20px rgba(230, 196, 124, 0.14); }
.btn.gold:hover { color: #17120a; background: linear-gradient(180deg, #f2dcaa 0%, #d4ad66 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 8px 26px rgba(230, 196, 124, 0.24); }

.opponents { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.opp { text-align: left; padding: 16px; border-radius: 14px; border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.025); box-shadow: var(--edge); transition: background 0.2s, border-color 0.2s, transform 0.25s var(--ease); }
.opp:hover { background: rgba(255, 255, 255, 0.07); transform: translateY(-2px); }
.opp.on { border-color: var(--gold-line); background: linear-gradient(180deg, rgba(230, 196, 124, 0.13), rgba(230, 196, 124, 0.03)); }
.opp .lvl { display: flex; gap: 4px; margin-bottom: 10px; }
.opp .lvl i { width: 14px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); }
.opp .lvl i.f { background: var(--gold); }
.opp b { display: block; font: 400 14.5px/1.25 var(--display); letter-spacing: 0.14em; text-transform: uppercase; }
.opp em { display: block; font-style: normal; color: var(--gold); font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; margin: 4px 0 7px; }
.opp p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.style-row { margin-top: 18px; }
.sound-hear { display: grid; gap: 8px; margin-top: 12px; }
.sound-hear .label { font-size: 13px; color: var(--muted); }
.sound-hear .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.style-note { flex: 1 1 220px; min-width: 0; margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.45; }

.promo-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.promo-row button { padding: 12px 0 10px; border-radius: 12px; border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.025); transition: background 0.2s, border-color 0.2s, transform 0.25s var(--ease); }
.promo-row button:hover { background: rgba(230, 196, 124, 0.14); border-color: rgba(230, 196, 124, 0.6); transform: translateY(-2px); }
.promo-row .g { display: block; font-size: 34px; line-height: 1; }
.promo-row small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- settings drawer ---------- */
#drawer { position: fixed; top: 12px; right: 12px; bottom: 12px; width: min(392px, calc(100vw - 24px)); z-index: 30; display: flex; flex-direction: column; background: var(--glass-strong); backdrop-filter: blur(28px) saturate(1.4); -webkit-backdrop-filter: blur(28px) saturate(1.4); animation: drawer 0.4s var(--ease) both; }
@keyframes drawer { from { opacity: 0; transform: translateX(24px); } }
#drawer header { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 10px 22px; }
#drawer h2 { margin: 0; font: 400 14px/1 var(--display); letter-spacing: 0.26em; text-transform: uppercase; color: var(--gold); }
.tabs { position: relative; display: grid; grid-template-columns: repeat(8, minmax(40px, 1fr)); padding: 0 10px; border-bottom: 1px solid var(--stroke); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 9px 0 11px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--muted); white-space: nowrap; transition: color 0.25s; }
.tabs button svg { width: 18px; height: 18px; stroke-width: 1.45; opacity: 0.85; transition: opacity 0.25s; }
.tabs button.on svg, .tabs button:hover svg { opacity: 1; }
/* one thin gold line under the tab that is open; it slides from tab to tab */
.tabs .ind { position: absolute; left: 10px; bottom: -1px; width: calc((100% - 20px) / 8); height: 1px; transform: translateX(calc(var(--i, 0) * 100%)); transition: transform 0.4s var(--ease); pointer-events: none; }
.tabs .ind::after { content: ''; position: absolute; left: 22%; right: 22%; top: 0; height: 1.5px; border-radius: 1px; background: var(--gold); box-shadow: 0 0 8px rgba(230, 196, 124, 0.5); }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--gold); }
.panes { flex: 1; overflow-y: auto; padding: 20px 22px 26px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
.pane h3 { margin: 24px 0 11px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.pane h3:first-child { margin-top: 0; }
.pane p.note { margin: 10px 0 0; color: var(--dim); font-size: 12px; }
.pane p.note.warn { color: #e8b98a; line-height: 1.45; }
.toast.long { max-width: min(560px, calc(100vw - 32px)); white-space: normal; line-height: 1.5; animation-duration: 10s; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 30px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--stroke); font-size: 12px; font-weight: 500; color: var(--muted); transition: color 0.2s, border-color 0.2s, background 0.2s; }
.chip:hover { color: var(--text); border-color: var(--stroke-strong); }
.chip.on { color: var(--gold); border-color: var(--gold-line); background: rgba(230, 196, 124, 0.1); }
.field { display: grid; grid-template-columns: 96px 1fr 42px; align-items: center; gap: 12px; height: 36px; }
.field span { color: var(--text); font-size: 13px; }
.field output { text-align: right; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.field input { width: 100%; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; cursor: pointer; }
.toggle span { font-size: 13px; }
.toggle small { display: block; color: var(--dim); font-size: 11.5px; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle i { flex: none; width: 40px; height: 22px; border-radius: 11px; background: rgba(255, 255, 255, 0.14); position: relative; transition: background 0.2s; }
.toggle i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.2s; }
.toggle input:checked + i { background: var(--gold-deep); }
.toggle input:checked + i::after { transform: translateX(18px); }
.toggle input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }
.palettes .note.group, .mixer .note.group { margin: 16px 0 8px; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.own-board { margin-top: 6px; }
/* Tiles: a small picture and a name, nothing else. The description is a tip on hover. */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 10px; }
.tiles.big { grid-template-columns: repeat(3, 1fr); }
.tiles.pals { grid-template-columns: repeat(5, 1fr); gap: 12px 8px; }
.tile { padding: 0; border: 0; background: none; color: inherit; text-align: center; min-width: 0; cursor: pointer; }
.tile .thumb { display: block; aspect-ratio: 1; border-radius: 12px; box-sizing: border-box; outline: 1px solid var(--stroke); outline-offset: 0; transition: transform 0.25s var(--ease), outline-color 0.2s, box-shadow 0.25s; }
.tile.pal .thumb { border-radius: 50%; margin: 0 4px; }
.tile.env .thumb { aspect-ratio: 4 / 3; border-radius: 10px; }
.tile[hidden] { display: none; }
.tiles.envs { margin-top: 10px; }
.tile b { display: block; margin-top: 8px; font: 600 10px/1.25 var(--ui); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); transition: color 0.2s; }
.tile:hover .thumb { transform: translateY(-2px); outline-color: var(--stroke-strong); box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35); }
.tile.on .thumb { outline: 1px solid rgba(230, 196, 124, 0.95); outline-offset: 3px; box-shadow: 0 0 16px rgba(230, 196, 124, 0.16); }
.tile.on b { color: var(--gold); }
.chips.small { margin-bottom: 4px; }
.chips.small .chip { height: 28px; padding: 0 10px; font-size: 11.5px; }
/* Surprise me: the one gold button in the Looks tab, with a spark, and a slow sheen passing over it */
.chip.surprise { position: relative; overflow: hidden; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 0 13px 0 11px; color: #17120a; font-weight: 600; border-color: rgba(255, 236, 190, 0.35); background: linear-gradient(180deg, #ecd39a 0%, #cba25a 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 4px 16px rgba(230, 196, 124, 0.22); }
.chip.surprise svg { width: 14px; height: 14px; stroke-width: 1.8; }
.chip.surprise::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.45) 50%, rgba(255, 255, 255, 0) 100%); transform: skewX(-18deg); animation: sheen 5.5s ease-in-out infinite; pointer-events: none; }
@keyframes sheen { 0%, 70% { left: -60%; } 100% { left: 130%; } }
.chip.surprise:hover { color: #17120a; border-color: rgba(255, 236, 190, 0.5); background: linear-gradient(180deg, #f2dcaa 0%, #d4ad66 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42), 0 6px 22px rgba(230, 196, 124, 0.34); }
.chip.vary { color: var(--gold); border-color: rgba(230, 196, 124, 0.3); }
.chip.vary:hover { background: rgba(230, 196, 124, 0.1); }
/* the card a surprise look is shown on */
.surprise-card { margin: 10px 0 4px; padding: 13px 14px; border-radius: 14px; border: 1px solid rgba(230, 196, 124, 0.3); background: linear-gradient(180deg, rgba(230, 196, 124, 0.08), rgba(230, 196, 124, 0.02)); box-shadow: var(--edge); }
.surprise-card b { display: block; font: 400 14px/1.3 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
.surprise-card .note { margin: 6px 0 10px; }
.surprise-card .row { display: flex; gap: 8px; }
.surprise-card .row .btn { flex: 1; }
.surprise-card .btn:disabled { opacity: 0.5; }
.surprise-card .row { flex-wrap: wrap; }
.surprise-card .row .btn { min-width: calc(50% - 4px); }
.surprise-card.busy { opacity: 0.6; }
.note.taste { margin-top: 2px; }
.note.taste .link { margin-left: 2px; padding: 0; border: 0; background: none; color: var(--gold); font: inherit; text-decoration: underline; cursor: pointer; }
.manage.edit { flex-wrap: wrap; }
.manage.edit input { flex: 1 1 100%; }
.manage.edit .btn { flex: 1; }
.btn.small { height: 34px; padding: 0 12px; font-size: 10.5px; letter-spacing: 0.12em; border-radius: 9px; }
.saver { display: grid; gap: 8px; margin-top: 12px; }
.saver .row, .manage { display: flex; gap: 8px; }
.saver .row { margin-top: 2px; }
.saver .row .btn { flex: 1; }
.manage { margin-top: 12px; }
.manage input { flex: 1; }
.saver input, .manage input { height: 34px; min-width: 0; padding: 0 12px; border-radius: 9px; border: 1px solid var(--stroke-strong); background: rgba(255, 255, 255, 0.03); color: var(--text); font: 400 13px var(--ui); transition: border-color 0.2s; }
.saver input:focus, .manage input:focus { outline: none; border-color: var(--gold-line); }
.saver input::placeholder { color: var(--dim); }
.dots { display: flex; flex-wrap: wrap; gap: 9px; }
.dot { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 0; outline: 1px solid var(--stroke-strong); cursor: pointer; transition: transform 0.2s, outline-color 0.2s; }
.dot:hover { transform: scale(1.12); }
.dot.on { outline: 1.5px solid rgba(230, 196, 124, 0.95); outline-offset: 2px; }
.mixer.idle .dot.on { outline-color: rgba(255, 255, 255, 0.35); }
.tip { position: fixed; z-index: 80; max-width: 230px; padding: 10px 12px 11px; border-radius: 10px; pointer-events: none; background: rgba(10, 11, 15, 0.94); border: 1px solid var(--stroke-strong); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), var(--edge); animation: tip 0.16s ease-out both; }
.tip b { display: block; font: 600 10.5px/1.25 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.tip span { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.4; color: var(--muted); }
@keyframes tip { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.seg.full { display: flex; width: 100%; }
.seg.full button { flex: 1; padding: 0 6px; }

/* ---------- toasts ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%); z-index: 50; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
body:has(#present:not([hidden])) #toasts { bottom: calc(150px + var(--safe-b)); }      /* above the players' card of a presentation */
.toast { padding: 11px 18px; border-radius: 11px; background: var(--glass-strong); border: 1px solid rgba(230, 196, 124, 0.3); box-shadow: var(--edge), 0 12px 30px rgba(0, 0, 0, 0.35); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); font-weight: 500; font-size: 13px; white-space: nowrap; animation: toast 3s ease both; }
@keyframes toast { 0% { opacity: 0; transform: translateY(8px); } 8%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }

/* ---------- shared bits ---------- */
.bar { height: 3px; background: rgba(255, 255, 255, 0.1); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-deep), var(--gold)); transition: width 0.45s ease; }
.btn.sm { height: 34px; padding: 0 14px; border-radius: 9px; font-size: 10.5px; letter-spacing: 0.12em; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.4; pointer-events: none; }
input { font: inherit; color: inherit; user-select: text; -webkit-user-select: text; }

/* ---------- academy: coach panel ---------- */
.coach { position: fixed; left: 18px; top: calc(70px + var(--safe-t)); width: 344px; z-index: 9; padding: 13px 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.coach header { display: flex; align-items: center; gap: 8px; }
.coach-head { flex: 1; min-width: 0; }
.coach-head span { display: block; font-size: 10px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.coach-head b { display: block; font: 400 14.5px/1.3 var(--display); letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coach-head em { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coach-head em:empty { display: none; }
.coach-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.coach-text { margin: 4px 0 0; font-size: 14.5px; line-height: 1.58; color: #e6e1d6; }
.coach-text b { color: #fff; font-weight: 600; }
.coach-feedback { margin: 0; min-height: 21px; font-size: 13.5px; font-weight: 500; line-height: 1.5; }
.coach-feedback:empty { min-height: 0; }
.coach-feedback.good { color: #8fe2ab; }
.coach-feedback.bad { color: var(--danger); }
.coach-feedback.info { color: #9fd2ff; }
.coach footer { display: flex; gap: 6px; align-items: center; margin-top: 2px; }
body.lesson .plate, body.lesson .moves, body.lesson #btn-moves, body.lesson #btn-undo, body.lesson #btn-hint, body.lesson #btn-battles { display: none; }

/* ---------- academy: lesson list ---------- */
.sheet { position: fixed; inset: 0; z-index: 25; overflow-y: auto; background: rgba(5, 6, 9, 0.88); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); animation: fade 0.3s ease both; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.18) transparent; }
.sheet-inner { max-width: 1120px; margin: 0 auto; padding: clamp(20px, 4vw, 48px) clamp(16px, 4vw, 40px) 64px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.sheet-head h2 { margin: 0; font: 400 clamp(20px, 3vw, 30px)/1.2 var(--display); letter-spacing: 0.16em; text-transform: uppercase; }
.academy-top { display: flex; align-items: center; gap: 22px; margin: 24px 0 26px; flex-wrap: wrap; }
.academy-meter { flex: 1; min-width: 220px; }
.academy-meter span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 9px; }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; align-items: start; }
.chapter { border: 1px solid var(--stroke); border-radius: 14px; background: rgba(255, 255, 255, 0.025); box-shadow: var(--edge); padding: 16px 12px 10px; }
.chapter header { display: flex; gap: 12px; align-items: flex-start; padding: 0 6px 10px; }
.chapter .num { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 400 14px/1 var(--display); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(230, 196, 124, 0.5); }
.chapter.complete .num { background: var(--gold); color: #1b1508; }
.chapter h3 { margin: 0; font: 400 14.5px/1.25 var(--display); letter-spacing: 0.14em; text-transform: uppercase; }
.chapter p { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.chapter .tally { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.lesson { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 9px 8px; border-radius: 10px; transition: background 0.2s; }
.lesson:hover { background: rgba(255, 255, 255, 0.07); }
.lesson .tick { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.22); display: grid; place-items: center; }
.lesson .tick svg { width: 13px; height: 13px; }
.lesson.done .tick { background: var(--gold-deep); box-shadow: none; color: #fff; }
.lesson.done span { color: var(--muted); }
.lesson.next .tick { box-shadow: inset 0 0 0 2px var(--gold); }
.lesson.next span { color: var(--gold); }
.lesson small { color: var(--dim); font-size: 11.5px; }
.lesson small.score { color: var(--gold); font-variant-numeric: tabular-nums; }
.lesson span em { display: block; font-style: normal; font-size: 11.5px; color: var(--dim); margin-top: 1px; }
.chapters + .chapters-head { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--stroke); }
.chapters-head { margin-bottom: 14px; }
.chapters-head h3 { margin: 0; font: 400 15.5px/1.25 var(--display); letter-spacing: 0.16em; text-transform: uppercase; }
.chapters-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; max-width: 620px; }
.chapters.basics .chapter { background: none; }

/* ---------- importing a game ---------- */
.import-card { width: min(560px, 100%); }
.import-card .seg.full { margin: 4px 0 14px; }
.import-pane textarea { display: block; width: 100%; height: 150px; resize: vertical; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--stroke-strong); background: rgba(0, 0, 0, 0.3); color: var(--text); font: 400 12.5px/1.5 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; user-select: text; -webkit-user-select: text; }
.import-pane textarea:focus, .import-pane input:focus { outline: none; border-color: var(--gold-line); }
.import-pane textarea::placeholder { color: var(--dim); }
.import-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.import-row .note, .import-pane .note { color: var(--dim); font-size: 12px; margin: 10px 0 0; }
.import-row .note { margin: 0; }
.import-status { min-height: 20px; margin: 14px 0 0; color: var(--muted); font-size: 13px; }
.import-status.bad { color: #e8b98a; }
.import-list { display: grid; gap: 6px; margin-top: 10px; max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
.import-game { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; align-items: baseline; text-align: left; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.025); transition: background 0.2s, border-color 0.2s; }
.import-game:hover, .import-game.on { background: rgba(230, 196, 124, 0.07); border-color: var(--gold-line); }
.ig-who { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ig-who i { font-style: normal; font-weight: 500; color: var(--dim); font-size: 12px; }
.ig-res { color: var(--gold); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.ig-where { grid-column: 1; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ig-tag { grid-column: 2; justify-self: end; font-size: 9.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); }
#import.drop .card { border-color: var(--gold-line); box-shadow: 0 0 0 1px var(--gold-line), 0 24px 60px rgba(0, 0, 0, 0.42); }
/* the gallery card that opens the import, and the remove mark on an imported film */
.legend.add { border-style: dashed; border-color: rgba(230, 196, 124, 0.35); background: rgba(230, 196, 124, 0.03); }
.legend.add .thumb { position: relative; background: radial-gradient(120% 140% at 50% 0%, rgba(230, 196, 124, 0.16), rgba(230, 196, 124, 0) 70%); }
.legend.add .thumb s { position: absolute; right: 16px; top: 50%; width: 30px; height: 30px; margin-top: -15px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--gold-line); }
.legend.add .thumb s::before, .legend.add .thumb s::after { content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 1.5px; margin: -0.75px 0 0 -6px; background: var(--gold); }
.legend.add .thumb s::after { transform: rotate(90deg); }
.legend.add b { color: var(--gold); }
.legend { position: relative; }
.lg-remove { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: rgba(8, 9, 12, 0.55); color: var(--muted); font-size: 16px; line-height: 1; opacity: 0; transition: opacity 0.2s, color 0.2s; }
.legend:hover .lg-remove, .lg-remove:focus-visible { opacity: 1; }
.lg-remove:hover { color: var(--text); }

/* ---------- making a video ---------- */
.video-card { width: min(520px, 100%); }
.video-card .label { display: block; margin: 16px 0 8px; }
.video-card .muted b { color: var(--text); font-weight: 600; }
.video-card .note { margin: 14px 0 0; color: var(--dim); font-size: 12px; line-height: 1.5; }
.video-card .error { margin: 12px 0 0; }
.video-run { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 24px; background: rgba(5, 6, 9, 0.94); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); animation: fade 0.3s ease both; }
.vr-inner { width: min(760px, 100%); display: grid; justify-items: center; text-align: center; }
.vr-inner .eyebrow { margin-bottom: 10px; }
.vr-inner h2 { margin: 0 0 22px; font: 400 clamp(20px, 2.6vw, 28px)/1.2 var(--display); letter-spacing: 0.16em; text-transform: uppercase; }
.vr-frame { display: grid; place-items: center; max-width: 100%; }
.vr-frame canvas, .vr-frame video { display: block; max-width: min(100%, 720px); max-height: 56vh; border-radius: 12px; outline: 1px solid var(--stroke-strong); background: #000; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5); }
.vr-bar { width: min(420px, 100%); margin: 22px 0 0; }
.vr-status { margin: 12px 0 0; min-height: 20px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.vr-actions { display: flex; gap: 10px; margin-top: 18px; }
.vr-actions a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.video-run:not(.ready) #vr-save, .video-run:not(.ready) #video-done { display: none; }
.video-run.ready #video-cancel { display: none; }

/* ---------- presenting a tournament ---------- */
.present-card { width: min(580px, 100%); }
.present-card .label { display: block; margin: 18px 0 8px; }
.present-card .seg.full { margin: 4px 0 14px; }
.present-card .join input:focus { outline: none; border-color: var(--gold-line); }
.present-card [data-src] .note { color: var(--dim); font-size: 12px; margin: 10px 0 0; line-height: 1.5; }
.ps-list { display: grid; gap: 6px; margin-top: 12px; max-height: 300px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
.ps-list .note.bad { color: #e8b98a; }
.ps-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; text-align: left; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--stroke); background: rgba(255, 255, 255, 0.025); transition: background 0.2s, border-color 0.2s; }
.ps-item:hover { background: rgba(230, 196, 124, 0.07); border-color: var(--gold-line); }
.ps-item.on { background: rgba(230, 196, 124, 0.09); border-color: var(--gold-line); }
#ps-events .ps-item { grid-template-columns: minmax(0, 1fr) auto; }
#ps-events .ps-item > span:not([class]) { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-ev { margin-top: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--gold-line); background: rgba(230, 196, 124, 0.045); }
.ps-ev-head b { display: block; font: 400 15px/1.3 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); }
.ps-ev-head span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ps-ev .chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; max-height: 132px; overflow-y: auto; }
.ps-ev .chip.on { color: var(--gold); border-color: var(--gold-line); background: rgba(230, 196, 124, 0.08); }
.ps-ev .chip.live::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: #ff6a5a; vertical-align: 1px; }
.ps-ev-go { display: flex; align-items: center; gap: 12px; }
.ps-ev-go .note { flex: 1; margin: 0; color: var(--dim); font-size: 12px; line-height: 1.45; }
.ps-ev-go .btn:disabled { opacity: 0.5; }
.present-card .ps-replay-note { margin: -6px 0 0; color: var(--dim); font-size: 12px; line-height: 1.5; }
.ps-item b { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-item > span:not([class]) { grid-column: 1; color: var(--muted); font-size: 12px; }
.ps-item > span[class] { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 9.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; }
.ps-live { color: #ff8a7a; } .ps-done { color: var(--dim); } .ps-soon { color: var(--muted); }
#present { position: fixed; inset: 0; z-index: 12; pointer-events: none; }
#present > * { pointer-events: auto; }
.pr-head { position: absolute; left: 0; right: 0; top: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: calc(22px + var(--safe-t)) 28px 40px; pointer-events: none; background: linear-gradient(180deg, rgba(5, 6, 9, 0.62) 0%, rgba(5, 6, 9, 0.28) 55%, rgba(5, 6, 9, 0) 100%); }
.pr-head > * { pointer-events: auto; }
.pr-kicker { display: flex; align-items: center; gap: 12px; margin: 0 0 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.pr-live { display: inline-flex; align-items: center; gap: 7px; color: #ff8a7a; }
.pr-live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #ff6a5a; box-shadow: 0 0 10px rgba(255, 90, 70, 0.8); animation: pulse 1.6s ease-in-out infinite; }
.pr-live.replay { color: var(--gold); }
.pr-live.replay::before { background: var(--gold); box-shadow: 0 0 10px rgba(230, 196, 124, 0.7); }
.pr-event h2 { margin: 0; max-width: min(56vw, 900px); font: 400 clamp(18px, 2vw, 28px)/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6); }
.pr-tools { display: flex; gap: 8px; transition: opacity 0.4s; }
body.pr-idle .pr-tools { opacity: 0; pointer-events: none; }
.pr-tools .pr-surprise { height: 40px; margin: 0 4px 0 0; padding: 0 16px 0 14px; border-radius: 11px; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; }
.pr-tools .pr-surprise svg { width: 15px; height: 15px; }
.pr-tools .pr-surprise:disabled { opacity: 0.6; cursor: progress; }
body.pr-idle { cursor: none; }
.pr-rail { position: absolute; right: 24px; top: calc(96px + var(--safe-t)); bottom: calc(150px + var(--safe-b)); width: 276px; display: flex; flex-direction: column; overflow: hidden; }
.pr-rail header { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 10px; border-bottom: 1px solid var(--stroke); font-size: 10.5px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.pr-rail header em { font-style: normal; letter-spacing: 0.06em; text-transform: none; color: var(--muted); font-weight: 500; font-size: 12px; }
.pr-games { flex: 1; overflow-y: auto; padding: 6px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.16) transparent; }
.pr-g { position: relative; display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px 10px; border-radius: 9px; transition: background 0.2s; }
.pr-g:hover { background: rgba(255, 255, 255, 0.05); }
.pr-g.on { background: rgba(230, 196, 124, 0.1); box-shadow: inset 2px 0 0 var(--gold); }
.pr-bd { color: var(--dim); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: center; }
.pr-pl b, .pr-st b { display: block; font-size: 13px; line-height: 1.45; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-pl i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; vertical-align: 1px; }
.pr-pl i.pw { background: #f1ead9; } .pr-pl i.pb { background: #1d1c22; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45); }
.pr-st { text-align: right; font-variant-numeric: tabular-nums; }
.pr-st b { color: var(--gold); }
.pr-st em { font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap; }
.pr-g.live .pr-st em::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: #ff6a5a; vertical-align: 1px; }
.pr-card { position: absolute; left: calc(50% - 150px); bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); width: min(940px, calc(100vw - 360px)); display: grid; grid-template-columns: 1fr minmax(160px, 0.62fr) 1fr; align-items: center; gap: 16px; padding: 16px 20px; }
.pr-p { display: flex; align-items: center; gap: 16px; min-width: 0; }
.pr-p.pb { justify-content: flex-end; text-align: right; }
.pr-who { min-width: 0; }
.pr-who b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font: 400 clamp(14px, 1.2vw, 18px)/1.2 var(--display); letter-spacing: 0.07em; text-transform: uppercase; overflow: hidden; }
.pr-who small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.pr-clock { flex: none; min-width: 70px; padding: 6px 10px; border-radius: 8px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--stroke); font-size: 20px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); transition: color 0.3s, border-color 0.3s; }
.pr-clock:empty { display: none; }
.pr-card.w-move .pw .pr-clock, .pr-card.b-move .pb .pr-clock { color: #fff6df; border-color: var(--gold-line); box-shadow: 0 0 16px rgba(230, 196, 124, 0.18); }
.pr-mid { display: grid; justify-items: center; gap: 8px; text-align: center; min-width: 0; }
.pr-line { display: flex; align-items: center; justify-content: center; gap: 6px; max-width: 100%; margin: -5px 0 -3px; }
.pr-line > span { min-width: 0; font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.3s; }
.pr-card.browsing .pr-line > span { color: var(--text); }
.pr-step { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); transition: color 0.2s, background 0.2s, opacity 0.4s; }
.pr-step svg { width: 15px; height: 15px; }
.pr-step:hover:not(:disabled) { color: var(--gold); background: rgba(255, 255, 255, 0.06); }
.pr-step:disabled { opacity: 0.25; cursor: default; }
body.pr-idle .pr-step { opacity: 0; pointer-events: none; }
.pr-film { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 13px 0 11px; border-radius: 14px; background: var(--glass-strong); border: 1px solid var(--gold-line); color: var(--gold); font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); transition: opacity 0.4s, background 0.2s, color 0.2s; }
.pr-film svg { width: 14px; height: 14px; }
.pr-film:hover { background: rgba(230, 196, 124, 0.16); color: #fff2d2; }
.pr-film:disabled { cursor: progress; }
.pr-film[hidden] { display: none; }
body.pr-idle .pr-film:not(:disabled) { opacity: 0; pointer-events: none; }
.pr-meter { position: relative; width: 100%; max-width: 220px; height: 6px; border-radius: 3px; overflow: hidden; background: #26252d; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14); }
.pr-meter i { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; background: #f4efe3; transition: width 0.9s var(--ease); }
.pr-meter::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--gold); }
.pr-mid small { max-width: 100%; color: var(--dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* the graph of a game (js/graph.js): White's chances in white below the line, a gold line for level */
.graph { display: block; width: 100%; background: #1d1c23; border-radius: 4px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14); cursor: pointer; overflow: hidden; }
.graph[hidden] { display: none; }
.graph .g-area { fill: #efe9dc; opacity: 0.92; }
.graph .g-line { fill: none; stroke: #fffaf0; stroke-width: 1; }
.graph .g-mid { stroke: var(--gold); stroke-width: 1; opacity: 0.55; }
.graph .g-at { stroke: var(--gold); stroke-width: 1.5; }
.graph .g-dot { fill: var(--gold); stroke: #15141a; stroke-width: 1.2; }
.pr-graph { max-width: 220px; height: 26px; margin: 1px 0; }
.pr-meter[hidden] { display: none; }
/* a big move: the card glows for a moment, and the board in the list is marked */
.pr-card.swing { animation: swing-glow 7s ease-out both; }
.pr-card.swing .pr-line > span { color: #fff2d2; }
@keyframes swing-glow {
  0% { box-shadow: 0 0 0 1px rgba(230, 196, 124, 0.9), 0 0 46px rgba(230, 196, 124, 0.42); }
  12% { box-shadow: 0 0 0 1px rgba(230, 196, 124, 0.7), 0 0 30px rgba(230, 196, 124, 0.28); }
  100% { box-shadow: 0 0 0 1px rgba(230, 196, 124, 0), 0 0 0 rgba(230, 196, 124, 0); }
}
.pr-g.swung .pr-bd { color: var(--gold); }
.pr-g.swung .pr-bd::after { content: ''; display: block; width: 5px; height: 5px; margin: 3px auto 0; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px rgba(230, 196, 124, 0.8); }
.pr-note { position: absolute; left: 50%; top: calc(24px + var(--safe-t)); transform: translateX(-50%); margin: 0; padding: 8px 16px; border-radius: 10px; background: var(--glass-strong); border: 1px solid rgba(255, 122, 107, 0.4); color: #ffb3a8; font-size: 13px; }
@media (max-width: 1000px) {
  .pr-rail { display: none; }
  .pr-card { left: 50%; width: calc(100vw - 24px); grid-template-columns: 1fr; gap: 10px; padding: 12px 14px; }
  .pr-p.pb { justify-content: flex-start; text-align: left; }
  .pr-p.pb .pr-clock { order: -1; }
  .pr-mid { order: 3; }
  .pr-event h2 { max-width: 76vw; }
}

/* ---------- online ---------- */
.join { display: flex; gap: 8px; }
.join input { flex: 1; min-width: 0; height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--stroke-strong); background: rgba(0, 0, 0, 0.3); font-size: 14px; }
.join input:focus { outline: none; border-color: var(--gold); }
#join-code { text-transform: uppercase; letter-spacing: 0.28em; font-weight: 600; }
#join-code::placeholder { letter-spacing: 0.04em; font-weight: 400; text-transform: none; color: var(--dim); }
.or { display: flex; align-items: center; gap: 12px; color: var(--dim); font-size: 11.5px; letter-spacing: 0.14em; text-transform: uppercase; margin: 20px 0 14px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--stroke); }
.row.tight { margin: 0 0 16px; }
.code-line { margin: 16px 0 0; color: var(--muted); }
.code-line b { font: 400 22px/1 var(--display); letter-spacing: 0.3em; color: var(--gold); margin-left: 10px; user-select: text; -webkit-user-select: text; }
.waiting { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 18px 0 0; }
.spinner { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.18); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { color: var(--danger); margin: 0 0 18px; }

@media (max-width: 860px) {
  .coach { left: 10px; right: 10px; width: auto; top: auto; bottom: calc(82px + var(--safe-b)); max-height: 42vh; overflow-y: auto; }
  .coach-text { font-size: 14px; }
}

/* ---------- legendary games: gallery ---------- */
.sheet-lead { margin: 14px 0 26px; max-width: 62ch; color: var(--muted); font-size: 14.5px; }
.legends { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.legend { text-align: left; border: 1px solid var(--stroke); border-radius: 14px; background: rgba(255, 255, 255, 0.025); box-shadow: var(--edge); overflow: hidden; display: flex; flex-direction: column; transition: transform 0.3s var(--ease), border-color 0.25s, background 0.25s; }
.legend:hover { transform: translateY(-3px); border-color: rgba(230, 196, 124, 0.6); background: rgba(255, 255, 255, 0.06); }
.legend .thumb { height: 92px; display: flex; align-items: flex-end; padding: 10px 14px; }
.legend .thumb i { font-style: normal; font-size: 10px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.legend b { padding: 15px 16px 0; font: 400 16px/1.25 var(--display); letter-spacing: 0.14em; text-transform: uppercase; }
.legend em { padding: 4px 16px 0; font-style: normal; color: var(--gold); font-size: 12.5px; }
.legend p { margin: 0; padding: 8px 16px 0; color: #d9d4c9; font-size: 13.5px; line-height: 1.5; flex: 1; }
.legend small { padding: 12px 16px 14px; color: var(--dim); font-size: 11.5px; letter-spacing: 0.04em; }
.legend.seen small { color: var(--gold-deep); }

/* ---------- legendary games: caption, transport, labels on the board ---------- */
#legend-bar { position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); z-index: 12; width: min(780px, calc(100vw - 20px)); display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 8px; pointer-events: none; }
#legend-bar > * { pointer-events: auto; }
.lg-cap { max-width: 100%; padding: 10px 22px 11px; border-radius: 14px; text-align: center; background: rgba(9, 10, 14, 0.5); border: 1px solid rgba(255, 255, 255, 0.07); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35), var(--edge); transition: transform 0.5s var(--ease); }
.lg-cap header { display: flex; justify-content: center; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.lg-eyebrow { font: 600 10.5px/1.3 var(--ui); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.lg-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.lg-count:not(:empty)::before { content: '\00b7\00a0\00a0'; }
.lg-text { margin: 6px 0 9px; font-size: 17px; line-height: 1.5; color: #f6f1e7; cursor: pointer; text-wrap: balance; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.lg-text.in { animation: caption 0.45s ease both; }
@keyframes caption { from { opacity: 0; transform: translateY(4px); } }
.lg-text b { font-weight: 600; }
.c-r { color: #ff9a86; } .c-b { color: #93cdff; } .c-g { color: #f1d08c; } .c-w { color: #ffffff; }
.lg-meter { display: flex; align-items: center; justify-content: center; gap: 10px; }
.lg-meter b { position: relative; flex: none; width: 150px; height: 5px; border-radius: 3px; overflow: hidden; background: #26252d; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.16); }
.lg-meter b i { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; background: #f4efe3; transition: width 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.lg-meter b::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--gold); }
.lg-meter span { width: 172px; text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
/* Review my game (js/review.js): the caption, the graph and the controls, where the dock was */
body.reviewing #dock, body.reviewing #coach { display: none !important; }
#review-bar { position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); z-index: 12; width: min(820px, calc(100vw - 20px)); display: grid; grid-template-columns: minmax(0, 1fr); justify-items: center; gap: 8px; pointer-events: none; }
#review-bar[hidden] { display: none; }
#review-bar > * { pointer-events: auto; }
.rv-cap { width: 100%; max-width: 680px; padding: 10px 22px 12px; border-radius: 14px; text-align: center; background: rgba(9, 10, 14, 0.55); border: 1px solid rgba(255, 255, 255, 0.07); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35), var(--edge); }
.rv-cap header { display: flex; justify-content: center; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.rv-eyebrow { font: 600 10.5px/1.3 var(--ui); letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.rv-acc { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rv-acc:not(:empty)::before { content: '\00b7\00a0\00a0'; }
.rv-text { margin: 6px 0 10px; font-size: 16px; line-height: 1.5; color: #f6f1e7; text-wrap: balance; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6); }
.rv-text.in { animation: caption 0.45s ease both; }
.rv-text b { font-weight: 600; }
.rv-g { color: var(--gold); } .rv-r { color: #ff8a7a; } .rv-best { color: #a9dcb9; }
.rv-inaccuracy { color: #e8d38f; } .rv-mistake { color: #f3ad66; } .rv-blunder { color: #ff8478; }
.rv-graph { height: 34px; max-width: 100%; }
.rv-graph .g-dot.inaccuracy { fill: #e8d38f; } .rv-graph .g-dot.mistake { fill: #f3ad66; } .rv-graph .g-dot.blunder { fill: #ff8478; }
.rv-graph .g-dot.theirs { opacity: 0.55; }
.rv-ctl { width: 100%; display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 12px; background: var(--glass-strong); }
.rv-ctl .icon-btn.sm { width: 34px; height: 34px; }
.rv-ctl .icon-btn.sm:hover { background: rgba(255, 255, 255, 0.08); }
.rv-ctl .icon-btn.sm:disabled { opacity: 0.3; }
.rv-ctl .btn.sm { height: 32px; }
.rv-ctl .btn[hidden] { display: none; }
.rv-m { cursor: pointer; }
.rv-m em { font-style: normal; font-weight: 700; margin-left: 2px; font-size: 0.92em; }
.rv-m.inaccuracy em { color: #e8d38f; } .rv-m.mistake em { color: #f3ad66; } .rv-m.blunder em { color: #ff8478; }
@media (max-width: 700px) {
  .rv-ctl { flex-wrap: wrap; justify-content: center; }
  .rv-ctl .spacer { display: none; }
  .rv-text { font-size: 14.5px; }
}
.lg-ctl { width: 100%; display: flex; align-items: center; gap: 4px; padding: 5px 8px; border-radius: 12px; background: var(--glass-strong); transition: opacity 0.35s ease, transform 0.5s var(--ease); }
.lg-ctl .icon-btn.sm { width: 34px; height: 34px; }
.lg-ctl .icon-btn.sm:hover { background: rgba(255, 255, 255, 0.08); }
.lg-ctl .lg-play { background: rgba(230, 196, 124, 0.16); color: var(--gold); border-color: rgba(230, 196, 124, 0.4); }
.lg-ctl .seg button { height: 30px; padding: 0 11px; font-size: 12px; }
.lg-ctl .sep { height: 22px; }
.lg-ctl .speed { gap: 6px; padding: 0 4px 0 6px; }
.lg-ctl .speed input { width: 74px; }
.lg-ctl .speed output { width: 34px; }
.lg-progress { position: relative; flex: 1; min-width: 60px; height: 4px; margin: 0 12px; border-radius: 2px; background: rgba(255, 255, 255, 0.1); }
.lg-progress i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 2px; background: var(--text); transition: width 0.3s; }
.lg-progress s { position: absolute; top: -2px; height: 8px; border-radius: 2px; background: rgba(230, 196, 124, 0.55); }
#lg-takeover { margin-left: 6px; }
/* while the game plays untouched, the controls step aside and the caption settles lower */
#legend-bar.idle .lg-ctl { opacity: 0; transform: translateY(10px); pointer-events: none; }
#legend-bar.idle .lg-cap { transform: translateY(54px); }
#lg-labels { position: fixed; inset: 0; z-index: 4; overflow: hidden; pointer-events: none; }
.lg-label { position: absolute; left: 0; top: 0; --stem: 12px; opacity: 0; transition: opacity 0.3s ease; will-change: transform; }
.lg-label.on { opacity: 1; }
.lg-label span { position: absolute; left: 0; bottom: calc(var(--stem) + 1px); transform: translateX(-50%); padding: 3px 9px 4px; border-radius: 9px; background: rgba(9, 10, 14, 0.74); box-shadow: inset 0 0 0 1px currentColor, 0 4px 14px rgba(0, 0, 0, 0.4); font-size: 11px; font-weight: 600; line-height: 1.25; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.lg-label i { position: absolute; left: 0; bottom: 0; width: 1px; height: var(--stem); background: currentColor; opacity: 0.8; }
.lg-label i::after { content: ''; position: absolute; left: -2px; bottom: -2px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
body.replay .dock, body.replay #btn-moves { display: none; }
body.replay .moves { bottom: calc(22px + var(--safe-b)); }
body.replay .plate-bottom { bottom: calc(22px + var(--safe-b)); }

/* ---------- legendary games: title card, take over ---------- */
.legend-card { width: min(560px, 100%); }
.legend-card h2.big { font-size: clamp(26px, 4vw, 36px); margin-bottom: 6px; }
.lgc-players { margin: 0 0 16px; color: var(--gold); font-size: 13px; letter-spacing: 0.04em; }
.lgc-body p { margin: 0 0 12px; font-size: 15px; line-height: 1.6; color: #e6e1d6; }
#lgc-modebox { margin: 18px 0 16px; }
.lgc-note { margin: 8px 0 0; color: var(--dim); font-size: 12px; }
.tk-levels { margin: 8px 0 4px; }

@media (max-width: 1240px) { body.replay .plate-bottom { bottom: auto; top: calc(148px + var(--safe-t)); } }
@media (max-width: 860px) {
  body.replay .plate-bottom { top: calc(62px + var(--safe-t)); }
  .lg-text { font-size: 15px; margin: 5px 0 8px; }
  .lg-cap { padding: 9px 14px 10px; }
  .lg-meter b { width: 110px; }
  .lg-meter span { width: 160px; font-size: 10px; }
  .lg-ctl { flex-wrap: wrap; row-gap: 4px; padding: 5px 6px 8px; }
  .lg-ctl .sep { display: none; }
  .lg-ctl .seg { margin-left: auto; }
  .lg-ctl .seg button { padding: 0 9px; }
  .lg-progress { order: 8; flex: 1 1 120px; margin: 0 10px 0 8px; }
  #lg-takeover { order: 9; padding: 0 10px; margin-left: 0; }
  .lg-ctl .speed { order: 7; padding: 0 0 0 4px; gap: 4px; }
  .lg-ctl .speed > span { display: none; }
  .lg-ctl .speed input { width: 54px; }
  .lg-ctl .speed output { width: 30px; }
  .lg-ctl .lg-progress { flex-basis: 70px; }
  #legend-bar.idle .lg-cap { transform: translateY(92px); }
  .lg-label span { font-size: 10px; padding: 2px 7px 3px; }
  body.replay .moves { display: none; }
  #legend-bar { bottom: calc(8px + var(--safe-b)); }
}

/* ---------- start menu: the Legendary Games card ---------- */
.feature { display: grid; grid-template-columns: 96px minmax(0, 1fr); margin: 8px 0; border-radius: 14px; overflow: hidden; background: rgba(12, 13, 17, 0.55); border: 1px solid var(--stroke-strong); backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3); box-shadow: 0 16px 44px rgba(0, 0, 0, 0.35), var(--edge); }
.feat-thumb { display: block; min-height: 100%; }
.feat-body { padding: 15px 18px 16px; }
.feat-body .eyebrow { margin: 0 0 8px; font-size: 10px; letter-spacing: 0.3em; }
.feat-body > b { display: block; font: 400 17px/1.25 var(--display); letter-spacing: 0.14em; text-transform: uppercase; }
.feat-body > small { display: block; margin: 5px 0 12px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.feat-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lgc-score { color: var(--gold) !important; font-weight: 600; }
#play .opp { width: 100%; }
#play .opp b { margin-bottom: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .brand { display: none; }
  .moves { width: 180px; }
  .plate { width: 196px; }
}
@media (max-width: 860px) {
  .plate { left: 10px; width: auto; max-width: 46vw; padding: 8px 12px 8px 8px; grid-template-columns: 30px 1fr auto; border-radius: 14px; }
  .plate .avatar { width: 30px; height: 30px; font-size: 16px; }
  .plate .title { display: none; }
  .plate .captured { font-size: 14px; min-height: 0; line-height: 16px; }
  .plate-top { top: calc(62px + var(--safe-t)); }
  .plate-bottom { top: calc(62px + var(--safe-t)); bottom: auto; left: auto; right: 10px; }
  .status { position: static; transform: none; margin: 0 auto; padding: 0 14px; font-size: 13px; }
  .topbar { padding: calc(10px + var(--safe-t)) 10px 0; gap: 8px; }
  .top-right #btn-full { display: none; }
  .moves { top: calc(118px + var(--safe-t)); right: 10px; bottom: calc(84px + var(--safe-b)); }
  .dock { bottom: calc(10px + var(--safe-b)); overflow-x: auto; justify-content: flex-start; scrollbar-width: none; border-radius: 18px; }
  .dock::-webkit-scrollbar { display: none; }
  .dock > * { flex: none; }
  .speed input { width: 90px; }
  .opponents { grid-template-columns: 1fr 1fr; }
  .card { padding: 22px 18px; }
  .screen { align-items: flex-end; background: linear-gradient(0deg, rgba(4, 5, 8, 0.96) 0%, rgba(4, 5, 8, 0.9) 48%, rgba(4, 5, 8, 0) 72%), linear-gradient(180deg, rgba(4, 5, 8, 0.78) 0%, rgba(4, 5, 8, 0.5) 22%, rgba(4, 5, 8, 0) 34%); }
  .menu-inner { padding: 0 20px calc(28px + var(--safe-b)); }
  .tagline { margin: 10px 0 6px; }
  .tagline { margin-bottom: 18px; }
  .menu-desc { display: none; }                      /* it would sit on the board picture; the tagline says it */
  .menu-list > button { padding: 10px 14px 10px 18px; }
  .menu-list b { font-size: 16px; }
  .menu-foot { display: none; }
  .credit { top: calc(16px + var(--safe-t)); bottom: auto; right: 18px; }
}
@media (max-height: 560px) {
  .tagline, .eyebrow, .menu-desc { display: none; }
  .logo { font-size: 38px; margin-bottom: 12px; }
  .menu-list > button { padding: 7px 14px 7px 18px; }
  .menu-list small { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
