/* ==========================================================================
   Royal Chess — panels.css
   v2 screens: title columns, time control grid, puzzle hub, theme list,
   settings tabs; the board page (top bar, side panel for puzzles / timed
   runs / analysis / editor, evaluation bar, editor palettes).
   ========================================================================== */

/* ------------------------------------------------------------ 3D canvas */
#game3d { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; touch-action: none; }
/* the 3D hall behind the menus is blurred inside the renderer (Renderer3D.setBlur), never with a CSS filter */
#game3d.hidden { display: none; }

/* ------------------------------------------------------------ title (layout lives in royal-ui.css) */
/* with the live 3D board behind the menu, empty space passes drags through to it */
body.menu3d #screen-title.active { pointer-events: none; }
body.menu3d #screen-title.active button { pointer-events: auto; }

/* ------------------------------------------------------------ time control */
#screen-time { display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 1.4vmin; overflow-y: auto; padding: 70px 12px 16px; }
#screen-time .corner { position: fixed; }
.time-sub { margin: -6px 0 4px; font-style: italic; font-size: clamp(15px, 2.3vmin, 20px); color: rgba(247, 238, 215, 0.85); }
.time-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; width: min(720px, 94vw); }
.tc-classic, .tc-tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(20, 70, 52, 0.95), rgba(7, 32, 24, 0.95));
  box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.45), 0 8px 18px rgba(0, 0, 0, 0.5);
  color: var(--ivory);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.tc-classic { width: 100%; flex-direction: row; gap: 16px; padding: 10px 18px; }
.tc-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tc-tile { min-height: clamp(72px, 11vmin, 104px); }
.tc-main { font-family: var(--font-head); font-weight: 700; font-size: clamp(26px, 4.6vmin, 42px); letter-spacing: 0.06em; color: var(--gold-light); text-shadow: 0 2px 0 #02120c; }
.tc-cat { font-size: clamp(14px, 2.1vmin, 19px); color: rgba(247, 238, 215, 0.82); }
.tc-classic .tc-main { font-size: clamp(30px, 5vmin, 46px); }
.tc-tile:hover, .tc-classic:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 2px var(--gold-light), 0 0 18px rgba(246, 227, 163, 0.35), 0 12px 22px rgba(0, 0, 0, 0.55); }
.tc-tile.selected, .tc-classic.selected { background: linear-gradient(180deg, #2b8a64, #11513a); box-shadow: inset 0 0 0 2px var(--gold-light), 0 0 22px rgba(246, 227, 163, 0.45); }
.tc-tile:focus-visible, .tc-classic:focus-visible, .color-btn:focus-visible, .hub-card:focus-visible, .theme-card:focus-visible,
.th-swatch:focus-visible, .seg button:focus-visible, .tab:focus-visible, .an-move:focus-visible, .pal-btn:focus-visible {
  outline: 3px solid rgba(120, 255, 190, 0.9); outline-offset: 3px;
}
.color-pick { display: flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 40px; background: rgba(6, 26, 19, 0.75); box-shadow: 0 0 0 2px var(--gold-dark); }
.color-label { font-family: var(--font-head); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold-light); font-size: 13px; margin-right: 4px; }
.color-btn { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 35%, rgba(246, 227, 163, 0.18), rgba(0, 0, 0, 0.35)); box-shadow: inset 0 0 0 2px rgba(217, 178, 95, 0.45); transition: all 0.15s ease; overflow: hidden; }
.color-btn img { height: 50px; margin-top: 8px; }
.color-btn[data-color="random"] img { height: 30px; margin: 0; }
.color-btn.selected { box-shadow: inset 0 0 0 3px var(--gold-light), 0 0 16px rgba(246, 227, 163, 0.5); background: radial-gradient(circle at 50% 35%, rgba(246, 227, 163, 0.4), rgba(20, 80, 58, 0.6)); }

/* ------------------------------------------------------------ puzzle hub */
#screen-puzzles, #screen-themes { overflow-y: auto; }
#screen-puzzles .corner, #screen-themes .corner { position: fixed; }
.hub { width: min(1040px, 94vw); margin: 0 auto; padding: 72px 0 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.hub-rating { margin: 0 0 6px; font-size: clamp(16px, 2.4vmin, 21px); color: rgba(247, 238, 215, 0.88); }
.hub-rating b { font-family: var(--font-head); color: var(--gold-light); font-size: 1.25em; }
.hub-grid { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.hub-card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 16px 14px 14px;
  border-radius: 16px;
  background: url('../assets/images/ui/leather.jpg') center / 256px;
  box-shadow: inset 0 0 0 2px rgba(217, 178, 95, 0.55), inset 0 0 40px rgba(0, 0, 0, 0.55), 0 12px 24px rgba(0, 0, 0, 0.55);
  color: var(--ivory);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
button.hub-card:hover { transform: translateY(-4px); box-shadow: inset 0 0 0 2px var(--gold-light), inset 0 0 40px rgba(0, 0, 0, 0.4), 0 0 24px rgba(246, 227, 163, 0.25), 0 16px 28px rgba(0, 0, 0, 0.6); }
.hub-card > img { width: 50px; height: 50px; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6)); }
.hub-card.big { grid-row: span 2; justify-content: center; }
.hub-card.big > img { width: 96px; height: 96px; }
.hub-card.big .hub-name { font-size: clamp(22px, 3.2vmin, 30px); }
.hub-name { font-family: var(--font-head); font-weight: 800; font-size: clamp(16px, 2.4vmin, 21px); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-light); text-shadow: 0 2px 0 #031810; }
.hub-desc { font-size: clamp(14px, 2vmin, 17px); font-style: italic; color: rgba(247, 238, 215, 0.82); }
.hub-stat { font-family: var(--font-head); font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: #9fe8c2; min-height: 1em; }
.rush-btns { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 2px; }
.rush-btns .plaque.small { font-size: 12px; min-height: 34px; padding: 0 0.7em; }

/* ------------------------------------------------------------ themes list */
.themes-wrap { width: min(1100px, 94vw); margin: 0 auto; padding: 72px 0 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.themes-list { width: 100%; display: flex; flex-direction: column; gap: 16px; }
.theme-cat h3 { margin: 4px 0 8px; font-family: var(--font-head); font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-size: 15px; }
.theme-cat .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.theme-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left;
  padding: 10px 12px; border-radius: 12px;
  background: linear-gradient(180deg, rgba(20, 70, 52, 0.92), rgba(7, 32, 24, 0.92));
  box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.4), 0 6px 12px rgba(0, 0, 0, 0.45);
  color: var(--ivory); transition: all 0.15s ease;
}
.theme-card:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 2px var(--gold-light), 0 10px 18px rgba(0, 0, 0, 0.5); }
.theme-card b { font-family: var(--font-head); font-weight: 800; font-size: 15px; letter-spacing: 0.06em; color: var(--gold-light); }
.theme-card span { font-size: 14px; color: rgba(247, 238, 215, 0.8); line-height: 1.2; }
.theme-card small { font-family: var(--font-head); font-size: 11px; letter-spacing: 0.12em; color: #9fe8c2; }
.theme-card[disabled] { opacity: 0.45; cursor: default; }

/* ------------------------------------------------------------ settings */
.settings-panel { width: min(660px, 94vw); max-height: min(92vh, calc(100vh - 24px)); }
.tabs { display: flex; gap: 6px; width: 100%; justify-content: center; margin-bottom: 4px; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 10px 10px 4px 4px; font-family: var(--font-head); font-weight: 700; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(247, 238, 215, 0.7); background: rgba(3, 20, 14, 0.55); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.3); }
.tab.active { color: #2a1a05; background: linear-gradient(#f6e3a3, #d9b25f 60%, #a47a2c); box-shadow: 0 0 12px rgba(246, 227, 163, 0.4); }
.tab-page { display: none; width: 100%; flex-direction: column; gap: 10px; max-height: min(52vh, 440px); overflow-y: auto; overflow-x: hidden; padding: 2px 4px 6px; }
.tab-page.active { display: flex; }
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.th-swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 12px; background: rgba(3, 20, 14, 0.55); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.3); color: var(--gold-light); font-family: var(--font-head); font-weight: 700; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; transition: all 0.15s ease; }
.th-swatch canvas { width: 100%; aspect-ratio: 1; border-radius: 6px; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.6); }
.th-swatch.selected { box-shadow: inset 0 0 0 3px var(--gold-light), 0 0 14px rgba(246, 227, 163, 0.45); }
.th-swatch:hover { transform: translateY(-2px); }
.seg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(3, 20, 14, 0.55); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.35); }
.seg-label { font-family: var(--font-head); font-weight: 700; font-size: clamp(13px, 2vmin, 16px); letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-light); }
.seg { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.seg button { padding: 5px 10px; border-radius: 8px; font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: 0.08em; color: rgba(247, 238, 215, 0.75); background: linear-gradient(#1a3f31, #0b261d); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.35); }
.seg button.selected { color: #2a1a05; background: linear-gradient(#f6e3a3, #d9b25f 60%, #a47a2c); }
.seg button[disabled] { opacity: 0.4; cursor: default; }
.settings-note { margin: 0; font-size: 14px; font-style: italic; color: rgba(247, 238, 215, 0.75); text-align: center; }

/* ------------------------------------------------------------ custom time / run results / misc */
.custom-rows { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.custom-row { display: flex; flex-direction: column; gap: 6px; padding: 10px 14px; border-radius: 12px; background: rgba(3, 20, 14, 0.55); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.35); font-family: var(--font-head); font-weight: 700; letter-spacing: 0.06em; color: var(--gold-light); }
.custom-row b { color: var(--ivory); font-size: 1.2em; }
input[type=range] { width: 100%; accent-color: #d9b25f; }
.run-stats { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.run-stats div { display: flex; flex-direction: column; align-items: center; padding: 6px; border-radius: 10px; background: rgba(3, 20, 14, 0.55); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.3); }
.run-stats b { font-family: var(--font-head); font-size: 22px; color: var(--ivory); }
.run-stats span { font-size: 12px; color: rgba(247, 238, 215, 0.75); letter-spacing: 0.08em; text-transform: uppercase; font-family: var(--font-head); }
.run-stats .best b { color: #7ff0b8; }
.pause-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.pause-grid .plaque.small { width: 100%; }
.plaque[disabled] { opacity: 0.45; filter: grayscale(0.6); pointer-events: none; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-light); opacity: 0.85; }
.link-btn img { width: 18px; height: 18px; }
.link-btn:hover { opacity: 1; text-decoration: underline; }
.pgn-text { width: 100%; min-height: 140px; max-height: 38vh; resize: vertical; padding: 10px; border-radius: 10px; border: 0; background: rgba(2, 14, 10, 0.8); color: var(--ivory); font: 13px/1.4 Consolas, 'Courier New', monospace; box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.4); user-select: text; -webkit-user-select: text; }

/* ------------------------------------------------------------ board page */
#screen-board { pointer-events: none; }
#screen-board.active .topbar, #screen-board.active .side-panel, #screen-board.active .palette, #screen-board.active .evalbar { pointer-events: auto; }
.topbar {
  position: absolute; left: 0; right: 0; top: 0; height: 58px;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-top)) 12px 8px;
  background: linear-gradient(rgba(6, 22, 16, 0.92), rgba(6, 22, 16, 0.65) 70%, rgba(6, 22, 16, 0));
  z-index: 5;
}
.topbar .medal.small { --medal-small: 42px; }
.topbar-title { margin: 0 0 0 6px; font-family: var(--font-display); font-weight: 900; font-size: clamp(18px, 3vmin, 26px); letter-spacing: 0.05em; text-transform: uppercase; color: var(--gold-light); text-shadow: 0 2px 0 #2a1904, 0 4px 10px rgba(0, 0, 0, 0.8); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-spacer { flex: 1; }

.side-panel {
  position: absolute;
  display: flex; flex-direction: column;
  padding: 14px;
  border-radius: 16px;
  background: url('../assets/images/ui/leather.jpg') center / 256px;
  box-shadow: inset 0 0 0 2px rgba(217, 178, 95, 0.55), inset 0 0 50px rgba(0, 0, 0, 0.55), 0 16px 34px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.panel-block { display: none; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.panel-block.active { display: flex; }

/* puzzle panel */
.pz-head { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(3, 20, 14, 0.6); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.35); }
.pz-head.good { background: linear-gradient(rgba(20, 110, 60, 0.75), rgba(8, 60, 32, 0.75)); }
.pz-head.bad { background: linear-gradient(rgba(130, 24, 20, 0.78), rgba(70, 10, 8, 0.78)); }
.pz-king { width: 52px; height: 58px; position: relative; flex: none; }
.pz-king img { position: absolute; left: 50%; bottom: -4px; height: 76px; transform: translateX(-50%); filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.7)); }
.pz-title { font-family: var(--font-head); font-weight: 800; font-size: clamp(17px, 2.6vmin, 22px); letter-spacing: 0.06em; color: var(--gold-light); }
.pz-sub { font-size: clamp(14px, 2vmin, 17px); color: rgba(247, 238, 215, 0.88); }
.pz-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; color: rgba(247, 238, 215, 0.85); }
.pz-meta .chip { padding: 2px 10px; border-radius: 12px; background: rgba(3, 20, 14, 0.55); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.3); font-family: var(--font-head); font-size: 12px; letter-spacing: 0.06em; }
.pz-meta .chip b { color: var(--gold-light); }
.pz-meta .delta-up { color: #7ff0b8; }
.pz-meta .delta-down { color: #ff8f82; }
.pz-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pz-actions .plaque.small { flex: 1 1 calc(33% - 6px); min-width: 0; font-size: 12px; padding: 0 0.5em; }
.pz-actions .plaque.small.primary { border-image-source: url('../assets/images/ui/plaque_active.png'); color: var(--gold-pale); }
.pz-actions .plaque.hidden, .pz-actions .plaque[hidden] { display: none; }
.pz-history { display: flex; flex-wrap: wrap; gap: 4px; }
.pz-history span { min-width: 34px; padding: 2px 6px; border-radius: 8px; text-align: center; font-family: var(--font-head); font-size: 11px; font-weight: 700; color: #04130c; }
.pz-history .win { background: #6fe3a2; }
.pz-history .loss { background: #ff8b7e; }
.pz-streak { font-family: var(--font-head); font-weight: 800; font-size: 16px; color: var(--gold-light); text-align: center; }

/* timed runs */
.run-title { font-family: var(--font-display); font-weight: 900; font-size: 22px; text-transform: uppercase; color: var(--gold-light); text-align: center; }
.run-clock { font-family: var(--font-head); font-weight: 800; font-size: clamp(40px, 7vmin, 64px); line-height: 1; text-align: center; color: var(--ivory); font-variant-numeric: tabular-nums; text-shadow: 0 3px 0 #02120c; }
.run-clock.low { color: #ff7a6b; }
.run-clock.bonus { animation: clockBonus 0.6s ease; }
.run-clock.penalty { animation: clockPenalty 0.6s ease; }
@keyframes clockBonus { 30% { color: #7ff0b8; transform: scale(1.12); } }
@keyframes clockPenalty { 30% { color: #ff5a4a; transform: scale(0.92); } }
.run-status { text-align: center; font-style: italic; color: rgba(247, 238, 215, 0.85); min-height: 1.2em; }
.run-score { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.run-score-n { font-family: var(--font-head); font-weight: 900; font-size: 44px; color: var(--gold-light); line-height: 1; }
.run-score-l { font-family: var(--font-head); font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(247, 238, 215, 0.75); }
.run-combo { display: flex; flex-direction: column; gap: 4px; }
.combo-bar { height: 12px; border-radius: 8px; background: rgba(3, 20, 14, 0.7); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.4); overflow: hidden; }
.combo-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #2ad18a, #f6e3a3); transition: width 0.25s ease; }
.combo-marks { display: flex; justify-content: space-between; font-family: var(--font-head); font-size: 11px; color: rgba(247, 238, 215, 0.7); }
.combo-marks span.hit { color: #7ff0b8; }
.combo-n { text-align: center; font-family: var(--font-head); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(247, 238, 215, 0.8); }
.combo-n b { color: var(--gold-light); font-size: 1.4em; }
.run-strikes { display: flex; justify-content: center; gap: 8px; min-height: 26px; }
.run-strikes .strike { width: 24px; height: 24px; border-radius: 50%; background: rgba(3, 20, 14, 0.7); box-shadow: inset 0 0 0 2px rgba(217, 178, 95, 0.45); }
.run-strikes .strike.on { background: radial-gradient(circle at 35% 30%, #ffb3a8, #d8352a 60%, #7a120c); box-shadow: 0 0 10px rgba(255, 60, 40, 0.7); }
.run-rival { display: none; }
.run-rival.show { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(3, 20, 14, 0.6); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.35); font-family: var(--font-head); color: var(--gold-light); }
.run-rival .rv-score { font-size: 28px; font-weight: 900; color: var(--ivory); }
.run-log { display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; overflow-y: auto; flex: 1; min-height: 40px; }
.run-log span { min-width: 38px; padding: 2px 6px; border-radius: 8px; text-align: center; font-family: var(--font-head); font-size: 11px; font-weight: 700; color: #04130c; }
.run-log .win { background: #6fe3a2; }
.run-log .loss { background: #ff8b7e; }

/* analysis */
.an-engine { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(3, 20, 14, 0.6); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.35); }
.switch-line { display: flex; align-items: center; gap: 8px; cursor: pointer; font-family: var(--font-head); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-light); font-size: 14px; position: relative; }
.switch-line input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-line input:checked + .switch { background: linear-gradient(#1c7a55, #0f5a3e); }
.switch-line input:checked + .switch::after { transform: translateX(28px); }
.switch-line input:focus-visible + .switch { outline: 3px solid rgba(120, 255, 190, 0.9); outline-offset: 2px; }
.an-depth { font-size: 13px; color: rgba(247, 238, 215, 0.7); font-family: var(--font-head); letter-spacing: 0.06em; }
.an-score { margin-left: auto; font-family: var(--font-head); font-weight: 900; font-size: 22px; color: var(--ivory); }
.an-lines { display: flex; flex-direction: column; gap: 4px; }
.an-line { display: flex; gap: 8px; align-items: baseline; padding: 4px 8px; border-radius: 8px; background: rgba(3, 20, 14, 0.45); font-size: 14px; line-height: 1.3; color: rgba(247, 238, 215, 0.9); cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.an-line:hover { background: rgba(20, 70, 52, 0.7); }
.an-line b { font-family: var(--font-head); color: var(--gold-light); min-width: 48px; }
.an-moves { flex: 1; min-height: 80px; overflow-y: auto; padding: 8px; border-radius: 12px; background: rgba(2, 14, 10, 0.55); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.3); font-size: 16px; line-height: 1.75; user-select: none; }
.an-moves .num { color: rgba(247, 238, 215, 0.55); font-family: var(--font-head); font-size: 13px; margin: 0 2px 0 4px; }
.an-move { padding: 1px 5px; border-radius: 6px; color: var(--ivory); cursor: pointer; font-weight: 600; background: none; border: 0; font: inherit; }
.an-move:hover { background: rgba(246, 227, 163, 0.18); }
.an-move.current { background: linear-gradient(#f6e3a3, #d9b25f); color: #2a1a05; }
.an-var { display: block; margin: 2px 0 2px 14px; padding-left: 8px; border-left: 2px solid rgba(217, 178, 95, 0.4); font-size: 14px; color: rgba(247, 238, 215, 0.8); }
.an-var .an-move { color: rgba(247, 238, 215, 0.85); font-weight: 500; }
.an-comment { color: #9fe8c2; font-style: italic; margin: 0 4px; }
.an-empty { color: rgba(247, 238, 215, 0.55); font-style: italic; }
.an-nav { display: flex; justify-content: center; gap: 6px; }
.an-nav .medal.small { --medal-small: 42px; }
.an-tools { display: flex; flex-direction: column; gap: 8px; }
.an-field { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: 0.1em; color: var(--gold-light); }
.an-field input { flex: 1; min-width: 0; padding: 6px 8px; border: 0; border-radius: 8px; background: rgba(2, 14, 10, 0.8); color: var(--ivory); font: 12px Consolas, 'Courier New', monospace; box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.4); user-select: text; -webkit-user-select: text; }
.an-buttons, .ed-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.an-buttons .plaque.small, .ed-buttons .plaque.small { flex: 1 1 calc(50% - 6px); font-size: 11px; padding: 0 0.4em; min-width: 0; }

/* evaluation bar */
.evalbar { position: absolute; display: none; border-radius: 6px; overflow: hidden; background: #1a1a1a; box-shadow: 0 0 0 2px var(--gold-dark), 0 6px 14px rgba(0, 0, 0, 0.6); }
.evalbar.show { display: block; }
.eval-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 50%; background: linear-gradient(90deg, #fbf5e6, #e8dcc0); transition: height 0.4s ease, width 0.4s ease; }
.evalbar.horizontal .eval-fill { top: 0; bottom: 0; right: auto; width: 50%; height: auto; }
.eval-text { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-family: var(--font-head); font-weight: 800; font-size: 10px; color: #2a1a05; }
.evalbar.black-better .eval-text { top: 4px; bottom: auto; color: #f3e6c6; }
.evalbar.flipped .eval-fill { top: 0; bottom: auto; }
.evalbar.flipped .eval-text { top: 4px; bottom: auto; }
.evalbar.flipped.black-better .eval-text { top: auto; bottom: 4px; }
.evalbar.horizontal .eval-text { top: 50%; bottom: auto; left: 6px; right: auto; transform: translateY(-50%); }
.evalbar.horizontal.black-better .eval-text { left: auto; right: 6px; }
.evalbar.horizontal.flipped .eval-fill { left: auto; right: 0; top: 0; bottom: 0; }
.evalbar.horizontal.flipped .eval-text { left: auto; right: 6px; }
.evalbar.horizontal.flipped.black-better .eval-text { left: 6px; right: auto; }

/* editor */
.palette { position: absolute; display: none; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(4, 22, 16, 0.78); box-shadow: 0 0 0 2px var(--gold-dark), 0 8px 18px rgba(0, 0, 0, 0.55); }
.palette.show { display: flex; }
.pal-btn { position: relative; flex: 1; display: grid; place-items: center; border-radius: 9px; background: rgba(246, 227, 163, 0.06); transition: background 0.15s ease; overflow: hidden; touch-action: none; }
/* piece sprites are 256x400 with the base at 84% height: scale so the base sits near the bottom of the button */
.pal-btn img { position: absolute; left: 50%; top: -8%; height: 116%; transform: translateX(-50%); pointer-events: none; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.6)); }
.pal-btn img.icon { position: static; height: 55%; transform: none; }
.pal-btn:hover { background: rgba(246, 227, 163, 0.18); }
.pal-btn.selected { background: linear-gradient(#2b8a64, #11513a); box-shadow: inset 0 0 0 2px var(--gold-light); }
.ed-row { display: flex; align-items: center; gap: 8px; }
.ed-row select, .ed-castle select { flex: 1; padding: 7px 8px; border-radius: 8px; border: 0; background: rgba(2, 14, 10, 0.85); color: var(--ivory); font-family: var(--font-head); font-weight: 700; font-size: 13px; box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.4); }
.ed-label { font-family: var(--font-head); font-weight: 700; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-light); }
.ed-castle { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; padding: 8px 10px; border-radius: 12px; background: rgba(3, 20, 14, 0.55); box-shadow: inset 0 0 0 1px rgba(217, 178, 95, 0.3); font-size: 14px; color: rgba(247, 238, 215, 0.9); }
.ed-castle .ed-label { grid-column: span 2; }
.ed-castle label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.ed-castle input { accent-color: #d9b25f; width: 16px; height: 16px; }
.ed-status { margin: 0; min-height: 1.2em; font-size: 14px; font-style: italic; color: #9fe8c2; }
.ed-status.bad { color: #ff8f82; }

@media (max-width: 760px) {
  .hub-grid { grid-template-columns: 1fr 1fr; }
  .hub-card.big { grid-column: span 2; grid-row: span 1; }
  .tc-grid { gap: 8px; }
  .theme-grid { gap: 6px; }
  .seg-row { flex-direction: column; align-items: stretch; }
  .seg { justify-content: flex-start; }
  .topbar-title { font-size: 16px; }
  .side-panel { padding: 10px; }
}
