/* RiftBorn: Battle League - UI styles.
 * "Pastel Oil Afro-Surrealism": dark plum and indigo panels, soft gold
 * hairlines, aged gold display type. Newsreader for display, IBM Plex for
 * body, Plex Mono for numbers. Local fonts only (no CDN). Sizes scale with
 * the viewport so the UI reads on a laptop at 1024x640 and on a TV.
 */

@font-face { font-family: 'Newsreader'; src: url(assets/fonts/newsreader.woff2) format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Newsreader'; src: url(assets/fonts/newsreader-italic.woff2) format('woff2'); font-style: italic; font-weight: 200 800; font-display: swap; }
@font-face { font-family: 'Plex'; src: url(assets/fonts/plex.woff2) format('woff2'); font-weight: 100 700; font-display: swap; }
@font-face { font-family: 'PlexMono'; src: url(assets/fonts/mono.woff2) format('woff2'); font-display: swap; }

:root {
  color-scheme: dark;
  --ground: #0e0c15;
  --panel: #181422;
  --raised: #221c31;
  --border: #2d2740;
  --gold: #e0b95c;
  --gold-hi: #f6dc94;
  --gold-lo: #9c7a32;
  --ink: #efe7d6;
  --muted: #aaa093;
  --ember: #ef7d45;
  --verdant: #6fc08a;
  --storm: #63b3e6;
  --rift: #a58cf0;
  --danger: #e5586b;
  --p1: var(--gold);
  --p2: var(--storm);
  --panel-a: rgba(24, 20, 34, 0.86);
  --raised-a: rgba(34, 28, 49, 0.9);
  --hair: rgba(224, 185, 92, 0.32);
  --hair-soft: rgba(224, 185, 92, 0.16);
  --shadow: 0 18px 50px rgba(5, 3, 10, 0.55);
  --display: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --body: 'Plex', 'Segoe UI', system-ui, sans-serif;
  --mono: 'PlexMono', ui-monospace, Consolas, monospace;
  --r: 0.5rem;
  --gap: 1rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Type scales with the viewport: about 13px at 1024x640, 19px at 1080p. */
html { font-size: clamp(13px, calc(0.45vw + 0.5vh + 5px), 24px); }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ground); }
body { color: var(--ink); font-family: var(--body); line-height: 1.45; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#ui { position: fixed; inset: 0; z-index: 1; overflow: hidden; }
.noscript, .fatal { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 32rem; padding: 1.2rem 1.5rem; background: var(--panel); border: 1px solid var(--danger); border-radius: var(--r); color: var(--ink); z-index: 10; }
button, input, select { font: inherit; color: inherit; }
::selection { background: rgba(224, 185, 92, 0.35); }

/* ------------------------------------------------------------------ screens */
.screen { position: absolute; inset: 0; box-sizing: border-box; }
.ui-root *, .ui-root *::before, .ui-root *::after { box-sizing: border-box; }
.panel-screen { display: flex; align-items: center; justify-content: center; padding: 2.2rem 1.5rem; background: radial-gradient(ellipse at 50% 40%, rgba(14, 12, 21, 0.25), rgba(14, 12, 21, 0.78)); }
.panel {
  background: linear-gradient(180deg, var(--panel-a), rgba(18, 15, 27, 0.9));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--hair-soft), var(--shadow);
  border-radius: var(--r);
  backdrop-filter: blur(6px);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-bottom: 0.7rem; margin-bottom: 0.9rem; border-bottom: 1px solid var(--hair); }
.panel-head h2, .forge-head h2, .tp-head h2 { margin: 0; font: 600 1.7rem/1.1 var(--display); letter-spacing: 0.01em; color: var(--gold-hi); }
h3 { font-family: var(--display); font-weight: 600; }
.fine { font-size: 0.78rem; color: var(--muted); margin: 0.4rem 0; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 0.2rem; font-size: 0.75rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.group-title { margin: 0.2rem 0 0.5rem; font: 600 0.78rem/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.hint-bar { position: absolute; left: 0; right: 0; bottom: 0.6rem; margin: 0; text-align: center; font-size: 0.75rem; color: var(--muted); text-shadow: 0 1px 4px #000; pointer-events: none; }
.hint-bar.inline { position: static; margin-top: 0.9rem; text-align: left; }
.num, .key { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.warn { color: var(--danger); }
.row-inline { display: flex; gap: 0.5rem; align-items: stretch; }
.row-inline > .ctl { flex: 1; }
.row-end { display: flex; justify-content: flex-end; margin-top: 0.8rem; }
.row-buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.1rem; }
.tab-row { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: space-between; margin-bottom: 0.6rem; }
.ctl-group { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.9rem; min-width: 0; }
.ctl-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

/* ------------------------------------------------------------------ focus ring */
.is-focus { outline: 2px solid var(--gold); outline-offset: 2px; box-shadow: 0 0 0 5px rgba(224, 185, 92, 0.18), 0 0 18px rgba(224, 185, 92, 0.25); }
:focus { outline: none; }
input:focus-visible, .ctl-text input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 0.6rem; justify-content: flex-start;
  min-height: 2.5rem; padding: 0.5rem 1rem; cursor: pointer;
  background: linear-gradient(180deg, var(--raised-a), rgba(26, 21, 38, 0.92));
  border: 1px solid var(--border); border-radius: calc(var(--r) * 0.8);
  color: var(--ink); font-weight: 500; letter-spacing: 0.01em;
  transition: border-color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease);
}
.btn:hover, .btn.is-focus { border-color: var(--gold); background: linear-gradient(180deg, #2c2440, #211a31); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn-icon { font-family: var(--mono); font-size: 0.75rem; color: var(--gold); opacity: 0.85; }
.btn-hint { margin-left: auto; padding-left: 0.6rem; font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.btn-primary { background: linear-gradient(180deg, #e7c46d, #b88c36); border-color: #f2d58a; color: #1a1208; font-weight: 600; }
.btn-primary:hover, .btn-primary.is-focus { background: linear-gradient(180deg, #f3d686, #c99b42); border-color: #fff0c0; }
.btn-primary .btn-hint { color: rgba(26, 18, 8, 0.65); }
.btn-ghost { background: transparent; }
.btn-small { min-height: 2.1rem; padding: 0.35rem 0.8rem; font-size: 0.88rem; }
.btn-danger { border-color: rgba(229, 88, 107, 0.5); }
.btn-danger:hover, .btn-danger.is-focus { border-color: var(--danger); outline-color: var(--danger); }
.btn-roll { border-color: rgba(165, 140, 240, 0.55); }
.btn-roll .btn-label::before { content: '\25C7  '; color: var(--rift); }

/* ------------------------------------------------------------------ controls */
.ctl {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  min-height: 2.4rem; padding: 0.35rem 0.6rem 0.35rem 0.8rem; width: 100%;
  background: rgba(34, 28, 49, 0.62); border: 1px solid var(--border); border-radius: calc(var(--r) * 0.8);
  cursor: pointer; text-align: left;
}
.ctl:hover { border-color: var(--hair); }
.ctl-label { font-size: 0.88rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cy-box { display: inline-flex; align-items: center; gap: 0.3rem; min-width: 0; }
.cy-value { min-width: 6.5rem; text-align: center; font-size: 0.88rem; color: var(--gold-hi); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 14rem; }
.cy-arrow { width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1px solid var(--border); background: rgba(14, 12, 21, 0.6); color: var(--gold); cursor: pointer; line-height: 1; font-size: 1.1rem; padding: 0; }
.cy-arrow:hover { border-color: var(--gold); }
.sl-box { display: inline-flex; align-items: center; gap: 0.6rem; flex: 1; justify-content: flex-end; min-width: 0; }
.sl-value { font-family: var(--mono); font-size: 0.8rem; color: var(--gold-hi); min-width: 4.8rem; text-align: right; white-space: nowrap; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; max-width: 13rem; height: 0.35rem; border-radius: 1rem; background: linear-gradient(90deg, var(--gold) 0 var(--p, 50%), var(--border) var(--p, 50%) 100%); cursor: pointer; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 1rem; height: 1rem; border-radius: 50%; background: var(--gold-hi); border: 2px solid #1a1208; box-shadow: 0 0 0 1px var(--gold); }
input[type=range]::-moz-range-thumb { width: 1rem; height: 1rem; border-radius: 50%; background: var(--gold-hi); border: 2px solid #1a1208; }
.tg-box { display: inline-flex; align-items: center; gap: 0.6rem; }
.tg-state { font-size: 0.8rem; color: var(--muted); min-width: 1.8rem; text-align: right; }
.tg-track { position: relative; width: 2.4rem; height: 1.3rem; border-radius: 1rem; background: var(--border); transition: background .15s; }
.tg-knob { position: absolute; top: 0.15rem; left: 0.15rem; width: 1rem; height: 1rem; border-radius: 50%; background: var(--muted); transition: transform .18s var(--ease), background .18s; }
.ctl-toggle.is-on .tg-track { background: rgba(224, 185, 92, 0.45); }
.ctl-toggle.is-on .tg-knob { transform: translateX(1.1rem); background: var(--gold-hi); }
.ctl-toggle.is-on .tg-state { color: var(--gold-hi); }
.ctl-text { cursor: text; }
.ctl-text input { flex: 1; min-width: 0; max-width: 16rem; padding: 0.3rem 0.5rem; background: rgba(14, 12, 21, 0.75); border: 1px solid var(--border); border-radius: 0.3rem; color: var(--ink); }
.ctl-text input::placeholder { color: rgba(170, 160, 147, 0.6); }
.co-box { position: relative; display: inline-flex; align-items: center; gap: 0.5rem; }
.co-chip { width: 1.6rem; height: 1.6rem; border-radius: 0.35rem; border: 1px solid rgba(239, 231, 214, 0.35); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35); }
.co-hex { font-family: var(--mono); font-size: 0.75rem; color: var(--muted); min-width: 4.5rem; }
.co-picker { position: absolute; right: 0; top: 0; width: 1.6rem; height: 1.6rem; opacity: 0; pointer-events: none; border: 0; padding: 0; }

/* Tabs */
.tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; border-bottom: 1px solid var(--hair); margin-bottom: 0.8rem; }
.tab { padding: 0.45rem 0.9rem; background: transparent; border: 1px solid transparent; border-bottom: 0; border-radius: 0.4rem 0.4rem 0 0; color: var(--muted); cursor: pointer; font-size: 0.9rem; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--gold-hi); background: rgba(34, 28, 49, 0.8); border-color: var(--hair); box-shadow: inset 0 2px 0 var(--gold); }
.tabs-small .tab { padding: 0.3rem 0.65rem; font-size: 0.8rem; }

/* Cards */
.card {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; text-align: left;
  padding: 0.65rem 0.8rem; min-height: 4.2rem; cursor: pointer;
  background: rgba(34, 28, 49, 0.66); border: 1px solid var(--border); border-radius: calc(var(--r) * 0.8); color: var(--ink);
  transition: border-color .15s, background .15s;
}
.card:hover { border-color: var(--hair); }
.card.is-selected { border-color: var(--c, var(--gold)); background: linear-gradient(180deg, rgba(48, 38, 66, 0.92), rgba(34, 28, 49, 0.9)); box-shadow: inset 0 0 0 1px var(--c, var(--gold)); }
.card.is-selected::after { content: '\2713'; position: absolute; top: 0.45rem; right: 0.6rem; color: var(--c, var(--gold)); font-size: 0.85rem; }
.card-swatch { width: 100%; height: 0.35rem; border-radius: 0.2rem; margin-bottom: 0.2rem; }
.card-title { font: 600 1rem/1.15 var(--display); color: var(--ink); padding-right: 1rem; }
.card-tag { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--c, var(--gold)); }
.card-body { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: 0.55rem; }
.card-grid.cards-small { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); }
.cards-small .card-body { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Toast */
.toast { position: absolute; left: 50%; bottom: 2.6rem; transform: translate(-50%, 1rem); max-width: min(36rem, 90vw); padding: 0.6rem 1.1rem; background: var(--raised); border: 1px solid var(--hair); border-radius: var(--r); box-shadow: var(--shadow); font-size: 0.9rem; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); z-index: 20; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-ok { border-color: rgba(111, 192, 138, 0.6); }
.toast.is-warn { border-color: rgba(239, 125, 69, 0.7); }
.toast.is-error { border-color: var(--danger); }

/* ------------------------------------------------------------------ movelist and tables */
table { border-collapse: collapse; width: 100%; }
.movelist { font-size: 0.8rem; }
.movelist th { position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 500; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 0.3rem 0.4rem; border-bottom: 1px solid var(--hair); }
.movelist td { padding: 0.28rem 0.4rem; border-bottom: 1px solid rgba(45, 39, 64, 0.7); vertical-align: top; }
.movelist .ml-input { font-family: var(--mono); color: var(--gold-hi); white-space: nowrap; }
.movelist .ml-name { color: var(--ink); }
.movelist .ml-level { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); }
.movelist .lv-high { color: #f2c27a; }
.movelist .lv-low { color: var(--storm); }
.movelist .ml-shared td { background: rgba(224, 185, 92, 0.05); }
.movelist .ml-note { color: var(--muted); font-style: italic; }
.movelist.is-compact td { padding: 0.22rem 0.35rem; }
.adv-plus { color: var(--verdant); }
.adv-minus { color: #e8c27a; }
.adv-unsafe { color: var(--danger); }
.ml-head { margin: 0 0 0.4rem; }
.controls { font-size: 0.85rem; }
.controls th { text-align: left; font-weight: 500; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--hair); }
.controls td { padding: 0.32rem 0.5rem; border-bottom: 1px solid rgba(45, 39, 64, 0.7); }
.controls .key { color: var(--gold-hi); font-size: 0.8rem; }

/* ------------------------------------------------------------------ title */
.title-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; background: radial-gradient(ellipse at 50% 45%, rgba(14, 12, 21, 0.1), rgba(14, 12, 21, 0.72) 75%); cursor: pointer; }
.title-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; }
.wordmark { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 0.9; }
.wm-main {
  font: 800 clamp(3.6rem, 13vw, 12rem)/0.92 var(--display); letter-spacing: 0.04em;
  background: linear-gradient(100deg, #8a6524 0%, #d9b25a 18%, #fff0c2 32%, #e0b95c 46%, #a77a2c 62%, #f1d28a 78%, #8a6524 100%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0.25rem 0.9rem rgba(0, 0, 0, 0.65)) drop-shadow(0 0 1.6rem rgba(224, 185, 92, 0.18));
  animation: shimmer 9s ease-in-out infinite;
}
.wm-rule { display: block; width: min(34rem, 60vw); height: 2px; margin: 0.7rem 0 0.6rem; background: linear-gradient(90deg, transparent, var(--gold) 20%, var(--gold-hi) 50%, var(--gold) 80%, transparent); opacity: 0.8; border-radius: 2px; }
.wm-sub { font: 600 clamp(1.1rem, 2.6vw, 2.4rem)/1 var(--display); letter-spacing: 0.42em; padding-left: 0.42em; color: var(--ink); text-shadow: 0 2px 10px #000; }
.tagline { margin: 1.1rem 0 0; font: italic 400 clamp(1rem, 1.8vw, 1.6rem)/1.3 var(--display); color: #f2e3c4; text-shadow: 0 2px 8px #000; }
.press { margin-top: 2.2rem; font-size: 0.9rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--gold); animation: breathe 2.4s ease-in-out infinite; }
.title-foot { position: absolute; bottom: 1rem; left: 0; right: 0; font-size: 0.75rem; color: var(--muted); text-shadow: 0 1px 4px #000; }
@keyframes shimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
@keyframes breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ------------------------------------------------------------------ main menu */
.menu-screen { display: flex; align-items: center; padding: 2rem 0 2rem clamp(1.5rem, 7vw, 8rem); background: linear-gradient(90deg, rgba(14, 12, 21, 0.9) 0%, rgba(14, 12, 21, 0.62) 38%, rgba(14, 12, 21, 0) 70%); }
.menu-col { display: flex; flex-direction: column; gap: 0.5rem; width: min(26rem, 44vw); }
.menu-brand { display: flex; flex-direction: column; margin-bottom: 1.2rem; }
.mb-main { font: 800 3.2rem/0.95 var(--display); letter-spacing: 0.05em; background: linear-gradient(100deg, #b88c36, #fff0c2 40%, #e0b95c 60%, #9c7a32); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.6)); }
.mb-sub { font: 600 1rem/1 var(--display); letter-spacing: 0.4em; color: var(--ink); margin-top: 0.4rem; }
.menu-list { display: flex; flex-direction: column; gap: 0.4rem; }
.menu-item { width: 100%; font-size: 1.05rem; min-height: 2.75rem; }
.menu-item.is-focus { transform: translateX(0.4rem); }
.menu-desc { min-height: 2.8em; margin: 0.8rem 0 0; color: #e6dac2; font-size: 0.92rem; }
.menu-foot { margin-top: 1rem; }

/* ------------------------------------------------------------------ how to play, settings */
.howto-panel { width: min(58rem, 94vw); max-height: 88vh; display: flex; flex-direction: column; padding: 1.3rem 1.5rem; }
.howto-content { overflow-y: auto; padding-right: 0.5rem; min-height: 0; flex: 1; }
.howto-item { padding: 0.55rem 0 0.75rem; border-bottom: 1px solid rgba(45, 39, 64, 0.7); }
.howto-item h3 { margin: 0 0 0.25rem; font-size: 1.15rem; color: var(--gold-hi); }
.howto-item p { margin: 0; color: #e6dac2; max-width: 52rem; }
.settings-panel { width: min(36rem, 94vw); max-height: 88vh; overflow-y: auto; padding: 1.3rem 1.5rem; }

/* ------------------------------------------------------------------ pause */
.pause-screen { z-index: 5; display: flex; align-items: center; justify-content: center; background: rgba(8, 6, 14, 0.62); backdrop-filter: blur(2px); }
.pause-panel { width: min(30rem, 92vw); max-height: 88vh; display: flex; flex-direction: column; padding: 1.3rem 1.5rem; }
.pause-panel:has(.pause-moves:not([hidden])), .pause-panel:has(.pause-controls:not([hidden])) { width: min(52rem, 94vw); }
.pause-view { display: flex; flex-direction: column; min-height: 0; }
.pause-moves:not([hidden]), .pause-controls:not([hidden]) { overflow: hidden; flex: 1; }
.pause-ml { overflow-y: auto; max-height: 56vh; padding-right: 0.4rem; }
.pause-controls .controls-wrap { overflow-y: auto; max-height: 60vh; }

/* ------------------------------------------------------------------ results */
.results-panel { width: min(46rem, 94vw); max-height: 90vh; overflow-y: auto; padding: 1.5rem 1.8rem; text-align: center; }
.winner { margin: 0.2rem 0 0; font: 700 clamp(2.2rem, 5vw, 4rem)/1.05 var(--display); color: var(--c, var(--gold)); text-shadow: 0 0 1.4rem color-mix(in srgb, var(--c, var(--gold)) 35%, transparent); }
.win-word { color: var(--ink); font-weight: 500; }
.winner-title { margin: 0.2rem 0 0; color: var(--muted); font-style: italic; font-family: var(--display); font-size: 1.1rem; }
.score { margin: 0.4rem 0 0.8rem; font: 600 1.8rem/1 var(--mono); color: var(--gold-hi); }
.round-list { list-style: none; margin: 0 auto 1rem; padding: 0; max-width: 30rem; display: flex; flex-direction: column; gap: 0.2rem; }
.round-list li { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 0.6rem; text-align: left; font-size: 0.85rem; padding: 0.25rem 0.5rem; background: rgba(34, 28, 49, 0.5); border-radius: 0.3rem; }
.rl-n { color: var(--muted); }
.rl-r { color: var(--gold); font-family: var(--mono); font-size: 0.78rem; }
.stats { max-width: 30rem; margin: 0 auto; font-size: 0.9rem; }
.stats th { padding: 0.35rem; font: 600 1rem/1.1 var(--display); color: var(--c, var(--ink)); border-bottom: 1px solid var(--hair); }
.stats td { padding: 0.28rem 0.5rem; border-bottom: 1px solid rgba(45, 39, 64, 0.7); }
.stats .st-label { color: var(--muted); font-size: 0.8rem; }
.stats .lead { color: var(--gold-hi); font-weight: 600; }
.results-panel .row-buttons { justify-content: center; }
.next-line { margin: 0.9rem 0 0; color: #e6dac2; font-size: 0.9rem; }
.ladder-list { list-style: none; margin: 1rem auto; padding: 0; max-width: 36rem; text-align: left; display: flex; flex-direction: column; gap: 0.25rem; }
.ladder-list li { display: grid; grid-template-columns: 1.6rem 9rem 4.5rem 1fr; gap: 0.5rem; align-items: baseline; padding: 0.3rem 0.5rem; border-radius: 0.3rem; background: rgba(34, 28, 49, 0.45); font-size: 0.82rem; color: var(--muted); }
.ladder-list li.is-done { color: var(--ink); }
.ladder-list li.is-done .ll-n { color: var(--verdant); }
.ladder-list li.is-current { border: 1px solid var(--gold); color: var(--ink); }
.ll-n { font-family: var(--mono); color: var(--gold); }
.ll-name { font-weight: 600; }
.ll-lv { font-family: var(--mono); font-size: 0.75rem; }
.ll-line { font-size: 0.78rem; }
.champion { padding: 0.8rem 0 0.4rem; }
.champ-word { margin: 0.2rem 0; font: 800 clamp(2.6rem, 6vw, 4.6rem)/1 var(--display); letter-spacing: 0.03em; background: linear-gradient(100deg, #9c7a32, #fff0c2 35%, #e0b95c 55%, #b88c36); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 6s ease-in-out infinite; }
.champ-name { margin: 0.3rem 0 0; font: 600 1.6rem/1.1 var(--display); color: var(--c, var(--ink)); }

/* ------------------------------------------------------------------ HUD */
.hud { pointer-events: none; z-index: 2; }
.hud-top { position: absolute; top: 0.9rem; left: 1.2rem; right: 1.2rem; display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.2rem; align-items: start; }
.hud-side { --el: var(--gold); display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.hud-side.side-2 { align-items: stretch; }
.hud-namerow { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.side-2 .hud-namerow { flex-direction: row-reverse; }
.hud-tag { font: 600 0.7rem/1 var(--mono); padding: 0.15rem 0.35rem; border-radius: 0.2rem; background: var(--p1); color: #1a1208; }
.side-2 .hud-tag { background: var(--p2); color: #08131c; }
.hud-name { font: 700 1.25rem/1 var(--display); color: var(--ink); text-shadow: 0 2px 6px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title { font: italic 400 0.85rem/1 var(--display); color: var(--el); text-shadow: 0 1px 4px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hud-pips { display: inline-flex; gap: 0.3rem; margin-left: auto; }
.side-2 .hud-pips { margin-left: 0; margin-right: auto; }
.pip { width: 0.75rem; height: 0.75rem; border-radius: 50%; border: 1.5px solid var(--gold); background: rgba(14, 12, 21, 0.7); transform: rotate(45deg); border-radius: 0.15rem; }
.pip.is-won { background: radial-gradient(circle, var(--gold-hi), var(--gold)); box-shadow: 0 0 0.5rem rgba(224, 185, 92, 0.7); }
.hp-bar { position: relative; height: 1.35rem; background: rgba(14, 12, 21, 0.82); border: 1px solid rgba(224, 185, 92, 0.55); border-radius: 0.25rem; overflow: hidden; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
.hp-fill, .hp-trail { position: absolute; inset: 0; transform-origin: left center; transition: none; }
.side-2 .hp-fill, .side-2 .hp-trail { transform-origin: right center; }
.hp-trail { background: linear-gradient(180deg, #f0d9b0, #c98a6a); opacity: 0.85; }
.hp-fill { background: linear-gradient(180deg, color-mix(in srgb, var(--el) 30%, #f7e3a6) 0%, color-mix(in srgb, var(--el) 55%, #d9a440) 55%, color-mix(in srgb, var(--el) 50%, #8a5a1e) 100%); }
.hp-bar.is-low .hp-fill { background: linear-gradient(180deg, #ffb48a, #e5586b 60%, #8a2030); }
.hp-bar.is-danger { animation: hpPulse 0.9s ease-in-out infinite; }
.hp-num { position: absolute; top: 50%; transform: translateY(-50%); right: 0.4rem; font: 600 0.72rem/1 var(--mono); color: rgba(14, 12, 21, 0.85); text-shadow: 0 0 2px rgba(255, 255, 255, 0.35); }
.side-2 .hp-num { right: auto; left: 0.4rem; }
@keyframes hpPulse { 0%, 100% { box-shadow: 0 0 0 rgba(229, 88, 107, 0); } 50% { box-shadow: 0 0 0.9rem rgba(229, 88, 107, 0.75); } }
.guard-bar { position: relative; height: 0.3rem; background: rgba(14, 12, 21, 0.75); border-radius: 0.2rem; overflow: hidden; }
.guard-fill { position: absolute; inset: 0; transform-origin: left center; background: linear-gradient(90deg, #9fb3c8, #dfe8ff); }
.side-2 .guard-fill { transform-origin: right center; }
.guard-bar.is-low .guard-fill { background: var(--ember); animation: guardFlash 0.5s steps(2, end) infinite; }
@keyframes guardFlash { 50% { opacity: 0.3; } }
.res-row { display: flex; align-items: center; gap: 0.5rem; }
.side-2 .res-row { flex-direction: row-reverse; }
.res-label { font-size: 0.66rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); white-space: nowrap; min-width: 7.5rem; text-shadow: 0 1px 3px #000; }
.side-2 .res-label { text-align: right; }
.res-bar { position: relative; flex: 1; max-width: 60%; height: 0.6rem; background: rgba(14, 12, 21, 0.82); border: 1px solid rgba(165, 140, 240, 0.4); border-radius: 0.3rem; overflow: visible; }
.res-fill { position: absolute; inset: 0; transform-origin: left center; border-radius: 0.3rem; background: linear-gradient(90deg, #6a58b8, var(--rift) 50%, #e6dcff); }
.side-2 .res-fill { transform-origin: right center; }
.res-mark { position: absolute; top: -0.2rem; bottom: -0.2rem; width: 2px; background: var(--gold); opacity: 0.75; }
.res-mark.m50 { left: 50%; }
.res-mark.m100 { right: 0; }
.side-2 .res-mark.m50 { left: 50%; }
.side-2 .res-mark.m100 { right: auto; left: 0; }
.res-bar.is-surge .res-mark.m50 { background: var(--gold-hi); box-shadow: 0 0 0.4rem var(--gold); opacity: 1; }
.res-bar.is-surge ~ .res-num, .res-bar.is-full ~ .res-num { color: var(--gold-hi); }
.res-bar.is-full { border-color: var(--gold); animation: resGlow 1.2s ease-in-out infinite; }
.res-bar.is-full .res-fill { background: linear-gradient(90deg, #e0b95c, #fff0c2, #e0b95c); }
@keyframes resGlow { 0%, 100% { box-shadow: 0 0 0.3rem rgba(224, 185, 92, 0.5); } 50% { box-shadow: 0 0 1rem rgba(246, 220, 148, 0.95); } }
.res-num { font: 600 0.75rem/1 var(--mono); color: var(--muted); min-width: 1.8rem; text-shadow: 0 1px 3px #000; }
.side-2 .res-num { text-align: right; }
.stance-row { display: flex; align-items: center; gap: 0.3rem; }
.side-2 .stance-row { flex-direction: row-reverse; }
.st-icon { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.12rem 0.4rem 0.12rem 0.25rem; border-radius: 1rem; border: 1px solid rgba(45, 39, 64, 0.9); background: rgba(14, 12, 21, 0.65); color: var(--muted); opacity: 0.6; transition: opacity .12s, color .12s, border-color .12s; }
.st-svg { width: 0.95rem; height: 0.95rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.st-spirit .st-svg { fill: currentColor; stroke: none; }
.st-name { font-size: 0.66rem; letter-spacing: 0.06em; }
.st-icon.is-on { opacity: 1; color: #1a1208; background: var(--gold); border-color: var(--gold-hi); }
.st-spirit.is-on { background: var(--el); border-color: var(--el); color: #0e0c15; }
.st-icon.is-off { text-decoration: line-through; opacity: 0.3; }
.el-chip { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0 0.3rem; font-size: 0.7rem; color: var(--ink); text-shadow: 0 1px 3px #000; }
.el-swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 1px solid rgba(239, 231, 214, 0.5); flex: none; }
.hud-side.is-surging .hp-bar { box-shadow: 0 0 0.9rem color-mix(in srgb, var(--el) 70%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 0.25rem; min-height: 1.1rem; }
.side-2 .chips { justify-content: flex-end; }
.chip { font-size: 0.64rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.1rem 0.4rem; border-radius: 0.2rem; background: rgba(14, 12, 21, 0.8); border: 1px solid var(--border); animation: chipIn .2s var(--ease); }
.chip-buff { color: var(--gold-hi); border-color: rgba(224, 185, 92, 0.6); }
.chip-surge { background: var(--el); color: #0e0c15; border-color: var(--el); }
.chip-effect { color: #ffc7cf; border-color: rgba(229, 88, 107, 0.6); }
.chip-burn { color: #ffb48a; } .chip-poison { color: #c8f59a; } .chip-slow, .chip-root { color: #bfe3ff; } .chip-curse { color: #e0c8ff; }
@keyframes chipIn { from { transform: scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.hud-center { display: flex; flex-direction: column; align-items: center; min-width: 5.5rem; }
.hud-timer { font: 700 2.6rem/1 var(--display); color: var(--ink); text-shadow: 0 2px 10px #000, 0 0 1rem rgba(224, 185, 92, 0.35); min-width: 3.5rem; text-align: center; padding: 0.1rem 0.6rem; border: 1px solid var(--hair); border-radius: 0.4rem; background: rgba(14, 12, 21, 0.6); }
.hud-timer.is-low { color: var(--ember); animation: breathe 1s ease-in-out infinite; }
.hud-round { margin-top: 0.25rem; font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); text-shadow: 0 1px 3px #000; }
.hud-mode { font-size: 0.66rem; color: var(--gold); text-shadow: 0 1px 3px #000; white-space: nowrap; }
.callout { position: absolute; top: 9.5rem; font: italic 700 1.6rem/1 var(--display); color: var(--ink); text-shadow: 0 2px 8px #000, 0 0 1rem color-mix(in srgb, var(--el, var(--gold)) 60%, transparent); opacity: 0; pointer-events: none; white-space: nowrap; }
.callout.side-1 { left: 2rem; }
.callout.side-2 { right: 2rem; }
.callout.is-on { animation: calloutIn 0.9s var(--ease) forwards; }
.callout.co-counter { color: #ffd27a; }
.callout.co-parry { color: #fff3c4; }
.callout.co-crush { color: var(--ember); }
.callout.co-super { color: var(--el, var(--gold-hi)); font-size: 1.9rem; }
@keyframes calloutIn { 0% { opacity: 0; transform: translateY(0.6rem) scale(0.9); } 15% { opacity: 1; transform: translateY(0) scale(1.06); } 30% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-0.4rem); } }
.combo { position: absolute; top: 12.5rem; display: flex; flex-direction: column; align-items: flex-start; opacity: 0; transition: opacity .25s; text-shadow: 0 2px 8px #000; }
.combo.side-1 { left: 2rem; }
.combo.side-2 { right: 2rem; align-items: flex-end; }
.combo.is-on { opacity: 1; }
.combo-n { font: 800 3rem/0.9 var(--display); color: var(--gold-hi); }
.combo.is-pop .combo-n { animation: comboPop .18s var(--ease); }
.combo-w { font: 700 0.8rem/1 var(--body); letter-spacing: 0.3em; color: var(--el, var(--gold)); }
.combo-d { margin-top: 0.2rem; font: 500 0.8rem/1 var(--mono); color: var(--ink); }
@keyframes comboPop { from { transform: scale(1.35); } to { transform: none; } }
.announcer { position: absolute; left: 0; right: 0; top: 34%; display: flex; flex-direction: column; align-items: center; opacity: 0; pointer-events: none; }
.announcer.is-on { animation: annIn 1.2s var(--ease) forwards; }
.ann-main { font: 800 clamp(3rem, 9vw, 7.5rem)/1 var(--display); letter-spacing: 0.03em; color: var(--ann, var(--gold)); background: linear-gradient(180deg, #fff6dc, var(--ann, var(--gold)) 60%, color-mix(in srgb, var(--ann, var(--gold)) 60%, #3a2410)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; filter: drop-shadow(0 0.3rem 1rem rgba(0, 0, 0, 0.8)); }
.ann-sub { margin-top: 0.3rem; font: italic 500 1.4rem/1.1 var(--display); color: var(--ink); text-shadow: 0 2px 8px #000; }
.ann-sub:empty { display: none; }
.announcer.ann-fight .ann-main { letter-spacing: 0.12em; }
.announcer.ann-ko .ann-main { font-size: clamp(3.6rem, 11vw, 9rem); }
.announcer.ann-win.is-on, .announcer.ann-round.is-on { animation-name: annHold; }
.announcer.ann-perfect .ann-main { font-style: italic; }
@keyframes annIn { 0% { opacity: 0; transform: scale(1.4); filter: blur(6px); } 14% { opacity: 1; transform: scale(1); filter: none; } 78% { opacity: 1; } 100% { opacity: 0; transform: scale(0.98); } }
@keyframes annHold { 0% { opacity: 0; transform: translateY(1rem); } 15% { opacity: 1; transform: none; } 90% { opacity: 1; } 100% { opacity: 0.9; } }
.input-log { position: absolute; top: 9rem; list-style: none; margin: 0; padding: 0; display: none; font: 500 0.72rem/1.35 var(--mono); color: var(--ink); text-shadow: 0 1px 3px #000; }
.input-log li:first-child { color: var(--gold-hi); }
.input-log.side-1 { left: 0.6rem; }
.input-log.side-2 { right: 0.6rem; text-align: right; }
body.show-inputs .input-log { display: block; }
body.show-inputs .callout.side-1, body.show-inputs .combo.side-1 { left: 5.5rem; }
body.show-inputs .callout.side-2, body.show-inputs .combo.side-2 { right: 5.5rem; }

/* ------------------------------------------------------------------ training panel */
.training-screen { pointer-events: none; z-index: 3; }
.training-panel { pointer-events: auto; position: absolute; right: 1.2rem; top: 11.5rem; width: min(21rem, 34vw); max-height: calc(100% - 13rem); overflow-y: auto; padding: 0.8rem 0.9rem; background: rgba(18, 15, 27, 0.86); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow); }
.training-panel.is-editing { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), var(--shadow); }
.tp-head { display: flex; flex-direction: column; gap: 0.15rem; margin-bottom: 0.5rem; }
.tp-head h2 { font-size: 1.2rem; }
.tp-hint { margin: 0; font-size: 0.72rem; color: var(--muted); }
.tp-opts { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.7rem; }
.tp-opts .ctl { min-height: 2.05rem; }
.tp-opts .cy-value { min-width: 5.5rem; }
.tp-buttons { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.2rem; }
.training-panel.is-data-only .tp-opts, .training-panel.is-data-only .tp-head h2 { display: none; }
.training-panel.is-collapsed { display: none; }
.fd-card { padding: 0.55rem 0.65rem; border: 1px solid var(--hair); border-radius: 0.4rem; background: rgba(14, 12, 21, 0.6); }
.fd-eyebrow { margin: 0; font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.fd-head { margin: 0.15rem 0 0.4rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem; }
.fd-name { font: 600 1rem/1.1 var(--display); color: var(--ink); }
.fd-input { font: 600 0.8rem/1 var(--mono); color: var(--gold-hi); }
.fd-kind { font-size: 0.7rem; color: var(--muted); }
.fd-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.3rem; margin: 0; }
.fd-cell { padding: 0.25rem 0.35rem; border-radius: 0.25rem; background: rgba(34, 28, 49, 0.6); }
.fd-cell dt { font-size: 0.6rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fd-cell dd { margin: 0; font-size: 0.95rem; color: var(--ink); }
.fd-combo { margin: 0.45rem 0 0; font-size: 0.75rem; color: #e6dac2; }

/* ------------------------------------------------------------------ character select */
.select-screen { display: flex; flex-direction: column; padding: 1rem 1.2rem 2.2rem; gap: 0.8rem; background: linear-gradient(90deg, rgba(14, 12, 21, 0.78) 0%, rgba(14, 12, 21, 0.2) 40%, rgba(14, 12, 21, 0.2) 62%, rgba(14, 12, 21, 0.78) 100%); }
.sel-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; }
.sel-title { margin: 0; font: 700 1.7rem/1 var(--display); color: var(--gold-hi); text-shadow: 0 2px 8px #000; }
.sel-sub { margin: 0.2rem 0 0; font-size: 0.8rem; color: var(--muted); }
.slots { display: flex; align-items: center; justify-content: center; gap: 0.8rem; min-width: 0; }
.slot { --el: var(--border); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 0.5rem; align-items: center; min-width: 11rem; max-width: 18rem; padding: 0.35rem 0.7rem; background: var(--panel-a); border: 1px solid var(--border); border-left: 3px solid var(--el); border-radius: 0.4rem; }
.slot-2 { border-left-width: 1px; border-right: 3px solid var(--el); }
.slot-label { grid-row: span 2; font: 700 0.75rem/1 var(--mono); padding: 0.2rem 0.35rem; border-radius: 0.2rem; background: var(--p1); color: #1a1208; }
.slot-2 .slot-label { background: var(--p2); color: #08131c; }
.slot-name { font: 600 1rem/1.15 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-state { font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.slot.is-locked .slot-state { color: var(--verdant); }
.slot-vs { font: italic 600 1.1rem/1 var(--display); color: var(--gold); }
.sel-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 36%) 1fr minmax(0, 31%); gap: 1rem; }
.sel-left { overflow-y: auto; padding: 0.7rem 0.8rem; min-height: 0; }
.grid-label { margin: 0.5rem 0 0.4rem; font: 600 0.72rem/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.grid-label:first-child { margin-top: 0; }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.4rem, 1fr)); gap: 0.45rem; }
.tile {
  --el: var(--gold);
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; text-align: left;
  min-height: 4.6rem; padding: 0.7rem 0.6rem 0.45rem; overflow: hidden; cursor: pointer;
  background: rgba(34, 28, 49, 0.72); border: 1px solid var(--border); border-radius: 0.4rem; color: var(--ink);
  transition: transform .12s var(--ease), border-color .12s;
}
.tile:hover { border-color: var(--hair); }
.tile-band { position: absolute; left: 0; right: 0; top: 0; height: 0.3rem; background: var(--el); }
.tile-glyph { position: absolute; right: 0.5rem; bottom: 0.2rem; font: 700 2.4rem/1 var(--display); color: var(--el); opacity: 0.35; }
.tile-name { font: 600 0.98rem/1.1 var(--display); padding-right: 1.6rem; }
.tile-sub { font-size: 0.7rem; color: var(--el); font-style: italic; }
.tile-meta { margin-top: auto; font-size: 0.64rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tile-cur { position: absolute; top: 0.45rem; right: 0.35rem; display: flex; gap: 0.15rem; }
.cur-badge { display: none; font: 700 0.58rem/1 var(--mono); padding: 0.12rem 0.22rem; border-radius: 0.15rem; }
.cb-1 { background: var(--p1); color: #1a1208; }
.cb-2 { background: var(--p2); color: #08131c; }
.tile.cur-1 .cb-1, .tile.cur-2 .cb-2 { display: inline-block; }
.tile.cur-1 { border-color: var(--p1); box-shadow: 0 0 0 2px var(--p1), 0 0 16px rgba(224, 185, 92, 0.3); transform: translateY(-1px); }
.tile.cur-2 { border-color: var(--p2); box-shadow: 0 0 0 2px var(--p2), 0 0 16px rgba(99, 179, 230, 0.3); transform: translateY(-1px); }
.tile.cur-1.cur-2 { box-shadow: 0 0 0 2px var(--p1), 0 0 0 4px var(--p2); }
.tile.lock-1, .tile.lock-2 { background: linear-gradient(180deg, rgba(60, 48, 30, 0.9), rgba(34, 28, 49, 0.9)); }
.tile.lock-1 .cb-1::after, .tile.lock-2 .cb-2::after { content: ' \2713'; }
.tile-random .tile-name, .tile-forge .tile-name { color: var(--gold-hi); }
.sel-stagegap { pointer-events: none; }
.sel-info { --el: var(--gold); overflow-y: auto; padding: 0.7rem 0.9rem; min-height: 0; border-top: 2px solid var(--el); }
.info-tabs { margin-bottom: 0.6rem; }
.info-eyebrow { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.3rem; flex-wrap: wrap; }
.info-who { font: 700 0.7rem/1 var(--mono); padding: 0.15rem 0.3rem; border-radius: 0.2rem; background: var(--p1); color: #1a1208; }
.info-who.who-2 { background: var(--p2); color: #08131c; }
.info-tag { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.info-lock { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--verdant); }
.info-name { margin: 0; font: 700 1.7rem/1.05 var(--display); color: var(--ink); }
.info-name.sm { font-size: 1.15rem; margin-bottom: 0.4rem; }
.info-title { margin: 0.1rem 0 0.5rem; font: italic 500 1rem/1.2 var(--display); color: var(--el); }
.facts { margin: 0.5rem 0; display: grid; grid-template-columns: 1fr; gap: 0.15rem; }
.fact { display: grid; grid-template-columns: 6.2rem 1fr; gap: 0.5rem; padding: 0.2rem 0; border-bottom: 1px solid rgba(45, 39, 64, 0.6); font-size: 0.84rem; }
.fact dt { color: var(--muted); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; padding-top: 0.08rem; }
.fact dd { margin: 0; color: var(--ink); }
.fact-el { display: inline-flex; align-items: center; gap: 0.35rem; }
.info-blurb { margin: 0.6rem 0 0.3rem; color: #e6dac2; font-size: 0.88rem; }
.info-el-blurb { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.8rem; font-style: italic; }
.canon-note { margin-top: 0.7rem; padding: 0.45rem 0.6rem; border-left: 2px solid var(--hair); background: rgba(14, 12, 21, 0.45); font-size: 0.72rem; color: var(--muted); }
.canon-note p { margin: 0.15rem 0; }
.canon-note strong { color: #cfc3ae; font-weight: 500; }
.canon-head { margin: 0 0 0.2rem; font-size: 0.66rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-lo); }
p.canon-note.canon-head { margin-top: 0.7rem; }
.sel-info .movelist { font-size: 0.76rem; }

/* ------------------------------------------------------------------ arena select */
.arena-panel { width: min(64rem, 96vw); max-height: 92vh; display: flex; flex-direction: column; padding: 1.2rem 1.4rem; }
.arena-summary { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin-bottom: 0.8rem; flex-wrap: wrap; }
.sum-chip { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.3rem 0.7rem; border-radius: 0.4rem; background: rgba(34, 28, 49, 0.7); border: 1px solid var(--border); border-bottom: 2px solid var(--el); }
.sum-label { font: 700 0.68rem/1 var(--mono); color: var(--muted); }
.sum-name { font: 600 1.05rem/1.1 var(--display); }
.sum-vs { font: italic 600 1rem/1 var(--display); color: var(--gold); }
.arena-body { display: grid; grid-template-columns: 1fr minmax(15rem, 19rem); gap: 1.1rem; min-height: 0; flex: 1; }
.arena-left { overflow-y: auto; min-height: 0; padding: 0.2rem; }
.arena-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr)); gap: 0.6rem; }
.arena-card { min-height: 9rem; padding-top: 3.2rem; background: linear-gradient(180deg, transparent 0 2.6rem, rgba(34, 28, 49, 0.85) 2.6rem), var(--sky, var(--raised)); }
.arena-card .card-tag { position: absolute; top: 0.55rem; left: 0.75rem; padding: 0.12rem 0.4rem; border-radius: 0.2rem; background: rgba(14, 12, 21, 0.75); color: var(--ink); }
.arena-card.is-open .card-tag { color: var(--ember); }
.arena-card.is-walled .card-tag { color: var(--storm); }
.arena-card .card-body { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.arena-card.is-random { background: linear-gradient(180deg, transparent 0 2.6rem, rgba(34, 28, 49, 0.85) 2.6rem), linear-gradient(120deg, #1a1838, #3a2a55, #2a1a12); }
.arena-src { margin-top: auto; font-family: var(--mono); font-size: 0.64rem; color: var(--gold-lo); }
.arena-opts { display: flex; flex-direction: column; gap: 0.5rem; }
.arena-note { min-height: 1em; }
.btn-start { margin-top: auto; justify-content: center; min-height: 3rem; font-size: 1.1rem; }
.btn-start .btn-hint { margin-left: 0.6rem; }
.ladder-intro { padding: 1rem 1.2rem; border: 1px solid var(--hair); border-radius: var(--r); background: rgba(34, 28, 49, 0.55); }
.ladder-intro h3 { margin: 0 0 0.4rem; color: var(--gold-hi); font-size: 1.3rem; }
.ladder-intro p { margin: 0.3rem 0; color: #e6dac2; }

/* ------------------------------------------------------------------ the forge */
.forge-screen { display: grid; grid-template-columns: minmax(0, 43%) 1fr minmax(0, 28%); gap: 1rem; padding: 1rem 1.2rem 2.2rem; background: linear-gradient(90deg, rgba(14, 12, 21, 0.8) 0%, rgba(14, 12, 21, 0.25) 45%, rgba(14, 12, 21, 0.25) 66%, rgba(14, 12, 21, 0.75) 100%); }
.forge-left { display: flex; flex-direction: column; min-height: 0; padding: 0.9rem 1rem 0.8rem; }
.forge-head { display: flex; align-items: baseline; gap: 0.8rem; margin-bottom: 0.4rem; }
.forge-head .fine { margin: 0; font-style: italic; font-family: var(--display); }
.forge-tabs { margin-bottom: 0.6rem; }
.forge-tabs .tab { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.forge-sections { flex: 1; min-height: 0; overflow-y: auto; padding: 0.1rem 0.4rem 0.4rem 0.1rem; }
.forge-section { display: flex; flex-direction: column; gap: 0.45rem; }
.section-lead { margin: 0 0 0.3rem; color: #e6dac2; font-size: 0.88rem; }
.custom-panel { margin-top: 0.8rem; padding: 0.7rem 0.8rem; border: 1px solid var(--hair); border-radius: var(--r); background: rgba(14, 12, 21, 0.5); }
.pick-card.is-custom { border-style: dashed; border-color: rgba(165, 140, 240, 0.6); }
.pick-card.is-custom .card-tag { color: var(--rift); }
.el-card .card-tag { color: var(--c, var(--gold)); }
.forge-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; padding-top: 0.7rem; margin-top: 0.4rem; border-top: 1px solid var(--hair); }
.forge-stagegap { pointer-events: none; }
.forge-readout { --el: var(--gold); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; padding: 0.8rem 0.9rem; border-top: 2px solid var(--el); }
.ro-head { margin: 0 0 0.4rem; font: 600 0.72rem/1 var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }
.ro-eyebrow { margin: 0; font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ro-name { margin: 0.1rem 0 0; font: 700 1.5rem/1.05 var(--display); word-break: break-word; }
.ro-title { margin: 0.1rem 0 0; font: italic 500 0.95rem/1.2 var(--display); color: var(--el); word-break: break-word; }
.stats-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.35rem; margin: 0.7rem 0 0.5rem; }
.stat { display: flex; flex-direction: column; padding: 0.3rem 0.45rem; border-radius: 0.3rem; background: rgba(34, 28, 49, 0.65); border: 1px solid var(--border); }
.stat-label { font-size: 0.62rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-size: 1rem; color: var(--gold-hi); }
.ro-chord { display: flex; gap: 0.4rem; align-items: center; margin: 0.4rem 0; font-size: 0.82rem; }
.ro-line { margin: 0.2rem 0; font-size: 0.82rem; color: #e6dac2; }
.ro-line strong { color: var(--muted); font-weight: 500; }
.ro-tabs { margin: 0.6rem 0 0.3rem; }
.ro-moves { min-height: 0; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .sel-body { grid-template-columns: minmax(0, 40%) 1fr minmax(0, 33%); }
  .forge-screen { grid-template-columns: minmax(0, 47%) 1fr minmax(0, 30%); }
  .ctl-cols { grid-template-columns: 1fr; }
}
@media (max-width: 1100px), (max-height: 720px) {
  .sel-head { grid-template-columns: auto 1fr auto; }
  .slot { min-width: 9rem; }
  .tile { min-height: 4rem; padding-top: 0.6rem; }
  .tile-grid { grid-template-columns: repeat(auto-fill, minmax(7.6rem, 1fr)); }
  .hud-name { font-size: 1.1rem; }
  .callout { top: 8.5rem; }
  .combo { top: 11rem; }
  .training-panel { top: 10rem; max-height: calc(100% - 11rem); }
  .arena-card { min-height: 8rem; }
}
@media (max-width: 900px) {
  .sel-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sel-stagegap, .forge-stagegap { display: none; }
  .forge-screen { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .arena-body { grid-template-columns: 1fr; }
  .menu-col { width: min(26rem, 80vw); }
}
@media (min-width: 2200px) {
  .hud-top { left: 2rem; right: 2rem; }
}

/* ------------------------------------------------------------------ reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .wm-main, .champ-word { background-position: 30% 50%; }
  .announcer.is-on { opacity: 1; animation: none !important; }
  .callout.is-on { opacity: 1; animation: none !important; }
  .press { opacity: 1; }
}

/* Legibility over bright skies (Hilltop dusk, Root Road daylight): a soft scrim behind
   the top HUD and a shadow on every small HUD label. */
.hud::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 10rem; pointer-events: none;
  background: linear-gradient(to bottom, rgba(10, 8, 16, 0.62), rgba(10, 8, 16, 0.28) 55%, transparent); }
.hud-top { z-index: 1; }
.hud-top * { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85); }

/* Forge readout: the movelist scrolls inside the panel; the footnote never overlaps it. */
.forge-readout { overflow: hidden; }
.forge-readout .ro-moves { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.forge-readout > .fine { flex: 0 0 auto; margin-top: 0.6rem; }

/* ------------------------------------------------------------------ movelist sections, badges, legend */
.ml-wrap { min-width: 0; }
.ml-legend { display: flex; flex-wrap: wrap; gap: 0.15rem 0.7rem; margin: 0 0 0.45rem; font-size: 0.68rem; color: var(--muted); line-height: 1.5; }
.ml-legend b { font: 600 0.72rem/1 var(--mono); color: var(--gold-hi); }
.ml-legend.is-compact { font-size: 0.62rem; gap: 0.1rem 0.55rem; }
.mlg { white-space: nowrap; }
.movelist .ml-sec td { padding: 0.55rem 0.4rem 0.25rem; border-bottom: 1px solid var(--hair); background: transparent; }
.movelist tbody .ml-sec:first-child td { padding-top: 0.3rem; }
.ml-sec-name { font: 600 0.7rem/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); margin-right: 0.6rem; }
.ml-sec-note { font-size: 0.68rem; color: var(--muted); }
.movelist .ml-pre { color: var(--muted); opacity: 0.85; }
.movelist .ml-follow .ml-name { padding-left: 0.6rem; }
.ml-mname { margin-right: 0.35rem; }
.ml-badges { display: inline-flex; flex-wrap: wrap; gap: 0.2rem; vertical-align: 0.08em; }
.mlb { font: 600 0.58rem/1 var(--mono); letter-spacing: 0.04em; padding: 0.14rem 0.3rem; border-radius: 0.2rem; border: 1px solid var(--border); color: var(--muted); background: rgba(14, 12, 21, 0.6); white-space: nowrap; }
.mlb-ex { color: #1a1208; background: var(--gold); border-color: var(--gold-hi); }
.mlb-cost { color: var(--gold-hi); border-color: rgba(224, 185, 92, 0.5); }
.mlb-break { color: #fff; background: rgba(229, 88, 107, 0.75); border-color: var(--danger); }
.mlb-just { color: var(--gold-hi); border-color: var(--gold); }
.mlb-hold { color: var(--storm); border-color: rgba(99, 179, 230, 0.55); }
.mlb-otg { color: #d9c7a4; border-color: rgba(217, 199, 164, 0.5); }
.mlb-launch { color: var(--verdant); border-color: rgba(111, 192, 138, 0.55); }
.mlb-crumple { color: var(--ember); border-color: rgba(239, 125, 69, 0.55); }
.mlb-bound { color: #f0a96b; border-color: rgba(240, 169, 107, 0.55); }
.mlb-trans { color: var(--rift); border-color: rgba(165, 140, 240, 0.55); }
.mlb-hit { color: var(--ink); border-color: rgba(239, 231, 214, 0.35); }
@media (max-width: 640px) {
  .movelist .ml-col-start, .movelist .ml-col-block { display: none; }
  .movelist .ml-input { white-space: normal; word-break: break-word; min-width: 4.5rem; }
  .movelist td { padding: 0.24rem 0.3rem; }
  .ml-sec-note { display: block; margin-top: 0.15rem; }
}

/* ------------------------------------------------------------------ HUD callouts (combo engine) */
.callout .co-main { display: block; }
.callout .co-sub { display: block; margin-top: 0.15rem; font: italic 500 0.82rem/1.1 var(--display); color: var(--ink); opacity: 0.9; max-width: 22rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.callout:not(.has-sub) .co-sub { display: none; }
.callout.side-2 .co-sub { margin-left: auto; text-align: right; }
.callout.side-2 { text-align: right; }
.callout.co-just { color: var(--gold-hi); font-size: 1.9rem; letter-spacing: 0.04em; }
.callout.co-charge { color: var(--storm); }
.callout.co-break { color: #fff; text-shadow: 0 2px 8px #000, 0 0 1rem var(--danger); }
.callout.co-break .co-main { color: var(--danger); }
.callout.co-ex { color: var(--gold-hi); font-size: 1.8rem; }
.callout.co-rift { color: var(--rift); text-shadow: 0 2px 8px #000, 0 0 1.1rem rgba(165, 140, 240, 0.8); }
.callout.co-bound { color: #f0a96b; }
.callout.co-crumple { color: var(--ember); }
.callout.co-otg { color: #d9c7a4; }
.callout.co-trans { color: var(--rift); font-size: 1.35rem; }
.callout.co-react { color: var(--co, var(--gold-hi)); text-shadow: 0 2px 8px #000, 0 0 1rem var(--co, var(--gold)); }
.callout.co-punish { color: #ffd27a; font-size: 1.35rem; }

/* ------------------------------------------------------------------ title help, inputs guide */
.title-help { margin-top: 0.9rem; font-size: 0.78rem; color: var(--muted); text-shadow: 0 1px 4px #000; }
.inputs-guide td { vertical-align: top; }
.inputs-guide .ig-group td { padding-top: 0.7rem; font: 600 0.7rem/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); border-bottom: 1px solid var(--hair); }
.inputs-guide .ig-name strong { display: block; color: var(--ink); font-weight: 600; font-size: 0.88rem; }
.inputs-guide .ig-note { display: block; margin-top: 0.1rem; font-size: 0.74rem; color: var(--muted); max-width: 26rem; }
.inputs-guide { table-layout: fixed; }
.inputs-guide th:nth-child(1) { width: 40%; }
.inputs-guide th:nth-child(2), .inputs-guide th:nth-child(3) { width: 21%; }
.inputs-guide th:nth-child(4) { width: 18%; }
.inputs-guide .key { white-space: normal; overflow-wrap: anywhere; font-size: 0.78rem; }
.pause-ctl-body { min-height: 0; flex: 1; overflow: hidden; display: flex; flex-direction: column; margin-top: 0.5rem; }
.pause-ctl-body .controls-wrap { overflow-y: auto; max-height: 56vh; padding-right: 0.4rem; }
@media (max-width: 640px) {
  .inputs-guide .key { font-size: 0.72rem; }
  .inputs-guide th:nth-child(3), .inputs-guide td:nth-child(3) { display: none; }
  .inputs-guide th:nth-child(1) { width: 46%; }
  .inputs-guide th:nth-child(2) { width: 30%; }
  .inputs-guide th:nth-child(4) { width: 24%; }
}

/* ------------------------------------------------------------------ training: combo trials */
.tr-card { margin-bottom: 0.6rem; padding: 0.55rem 0.65rem; border: 1px solid var(--hair); border-radius: 0.4rem; background: rgba(14, 12, 21, 0.6); }
.tr-eyebrow { display: flex; justify-content: space-between; gap: 0.5rem; }
.tr-count { color: var(--gold); letter-spacing: 0.06em; text-transform: none; }
.tr-name { margin: 0.15rem 0 0.1rem; font: 600 1rem/1.15 var(--display); color: var(--ink); }
.tr-meta { margin: 0 0 0.4rem; font-size: 0.68rem; color: var(--muted); }
.tr-steps { list-style: none; margin: 0 0 0.4rem; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; counter-reset: trs; }
.tr-step { counter-increment: trs; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.15rem 0.4rem; padding: 0.22rem 0.4rem 0.22rem 1.6rem; position: relative; border-radius: 0.25rem; background: rgba(34, 28, 49, 0.55); border: 1px solid transparent; font-size: 0.78rem; }
.tr-step::before { content: counter(trs); position: absolute; left: 0.45rem; top: 0.25rem; font: 600 0.7rem/1.3 var(--mono); color: var(--muted); }
.tr-step.is-next { border-color: var(--gold); background: rgba(224, 185, 92, 0.1); }
.tr-step.is-done { opacity: 0.75; }
.tr-step.is-done::before { content: '\2713'; color: var(--verdant); }
.tr-step.is-miss { border-color: var(--danger); }
.tr-pre { flex-basis: 100%; font-size: 0.66rem; color: var(--rift); }
.tr-in { font: 600 0.82rem/1.2 var(--mono); color: var(--gold-hi); }
.tr-mv { color: var(--ink); }
.tr-how { font-size: 0.66rem; color: var(--muted); font-style: italic; }
.tr-status { margin: 0.2rem 0 0.45rem; font-size: 0.74rem; color: #e6dac2; min-height: 1.2em; }
.tr-status.is-done { color: var(--verdant); font-weight: 600; }
.tr-status.is-miss { color: #f2a0aa; }
.tr-status.is-demo { color: var(--storm); }
.tr-status.is-info { color: var(--gold-hi); }
.tr-buttons { display: flex; gap: 0.35rem; }
.tr-buttons .btn { flex: 1; justify-content: center; }
.tr-buttons .tr-nav { flex: 0 0 2.3rem; padding-left: 0; padding-right: 0; font-size: 1.1rem; }
.tr-all { margin-top: 0.45rem; }
.tr-all summary { cursor: pointer; font-size: 0.74rem; color: var(--gold); padding: 0.15rem 0.1rem; border-radius: 0.2rem; list-style-position: inside; }
.tr-list { list-style: none; margin: 0.3rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.15rem; max-height: 14rem; overflow-y: auto; }
.tr-item { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 0.45rem; align-items: baseline; padding: 0.25rem 0.4rem; border-radius: 0.25rem; border: 1px solid transparent; background: rgba(34, 28, 49, 0.45); color: var(--ink); font: inherit; font-size: 0.74rem; text-align: left; cursor: pointer; }
.tr-item:hover, .tr-item.is-focus { border-color: var(--gold); }
.tr-item.is-current { border-color: var(--hair); background: rgba(224, 185, 92, 0.1); }
.tr-stars { font-size: 0.62rem; color: var(--gold); letter-spacing: -0.05em; }
.tr-item-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tr-item.is-cleared .tr-check::after { content: '\2713'; color: var(--verdant); }
.training-panel.is-data-only .tr-all { display: none; }
@media (max-width: 640px) {
  .training-panel { width: auto; left: 0.6rem; right: 0.6rem; top: auto; bottom: 0.6rem; max-height: 45%; }
}

/* App shell: install and fullscreen buttons (src/app-shell.js). Faint until hovered so they never fight the HUD. */
.app-shell { position: fixed; right: 0.6rem; bottom: 0.6rem; z-index: 50; display: flex; gap: 0.4rem; opacity: 0.35; transition: opacity 0.15s; }
.app-shell:hover, .app-shell:focus-within { opacity: 1; }
.app-shell-btn { font: inherit; font-size: 0.78rem; padding: 0.3rem 0.7rem; color: #f0e2be; background: rgba(14, 12, 21, 0.85); border: 1px solid #e8c46a; border-radius: 4px; cursor: pointer; }
.app-shell-btn[hidden] { display: none; }
