/* stumbl · app.css
   Layout: one centered column. Content sits on translucent "glass" sheets so it stays readable over the
   pixel-art scene behind it. With the Plain background the sheets are clear and the page follows light/dark.
   Scene themes overwrite the colour tokens inline on <html>. */
:root {
  --bg: #eff1f6; --panel: #e3e7ef; --panel-2: #d5dae6; --line: #c8cedb;
  --sub: #939bb1; --muted: #5b6480; --text: #192036;
  --accent: #0b8479; --accent-ink: #ffffff; --err: #d2334d; --extra: #93263a; --warm: #b86e00; --good: #2c8546;
  --glass-rgb: 239, 241, 246; --glass-a: 0;
  --font-type: "Lexend", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-ui: "Lexend", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-pixel: "Silkscreen", "JetBrains Mono", ui-monospace, monospace;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131826; --panel: #1b2133; --panel-2: #262d44; --line: #303852;
    --sub: #5b6483; --muted: #8f97b1; --text: #e3e7f2;
    --accent: #4ccfc1; --accent-ink: #072320; --err: #ff6a7e; --extra: #b24a5e; --warm: #f0ae4a; --good: #5cc983;
    --glass-rgb: 19, 24, 38; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131826; --panel: #1b2133; --panel-2: #262d44; --line: #303852;
  --sub: #5b6483; --muted: #8f97b1; --text: #e3e7f2;
  --accent: #4ccfc1; --accent-ink: #072320; --err: #ff6a7e; --extra: #b24a5e; --warm: #f0ae4a; --good: #5cc983;
  --glass-rgb: 19, 24, 38; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
#bg { position: fixed; left: 0; top: 0; z-index: 0; image-rendering: pixelated; image-rendering: crisp-edges; pointer-events: none; }
.app { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; gap: 22px; padding-block: 18px 22px; }
h1, h2, h3 { font-weight: 500; letter-spacing: -0.01em; text-wrap: balance; margin: 0; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.12rem; } h3 { font-size: 0.98rem; }
p { margin: 0; }
a { color: var(--accent); }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
kbd { font-family: var(--font-mono); font-size: .78em; background: var(--panel); color: var(--muted); padding: 1px 6px; border-radius: 4px; }
.glass { background: rgba(var(--glass-rgb), var(--glass-a)); }
.has-scene .glass { -webkit-backdrop-filter: saturate(1.1); backdrop-filter: saturate(1.1); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; transition: opacity .25s; border-radius: var(--radius); }
.has-scene .top { padding: 8px 10px 8px 14px; }
.brand { font-weight: 600; font-size: 1.55rem; letter-spacing: -0.03em; color: var(--text); text-decoration: none; line-height: 1; }
.brand .mb { text-decoration: underline wavy var(--err); text-decoration-thickness: 2px; text-underline-offset: 7px; text-decoration-skip-ink: none; }
.nav { display: flex; gap: 2px; background: var(--panel); padding: 4px; border-radius: 10px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 6px 12px; border-radius: 7px; color: var(--muted); text-decoration: none; font-size: .88rem; white-space: nowrap; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { background: rgba(var(--glass-rgb), 1); color: var(--text); }
:root:not(.has-scene) .nav a[aria-current="page"] { background: var(--bg); }

/* buttons */
.btn { font: inherit; font-size: .9rem; border: 0; border-radius: 8px; padding: 9px 16px; background: var(--panel-2); color: var(--text); cursor: pointer; display: inline-flex; gap: 8px; align-items: center; text-decoration: none; }
.btn:hover { filter: brightness(1.08); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn kbd { background: rgba(0, 0, 0, .14); color: inherit; }
.btn-sm { font: inherit; font-size: .78rem; border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 6px; padding: 4px 10px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn-sm:hover { color: var(--accent); border-color: var(--accent); }
.btn-sm.danger { color: var(--err); border-color: var(--err); }
.seg { display: inline-flex; background: var(--panel-2); border-radius: 8px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { font: inherit; font-size: .78rem; border: 0; background: none; color: var(--muted); padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: rgba(var(--glass-rgb), 1); color: var(--text); }
:root:not(.has-scene) .seg button[aria-pressed="true"] { background: var(--bg); }

/* sheets and panels */
.view { display: flex; flex-direction: column; gap: 22px; }
.sheet { border-radius: 16px; display: flex; flex-direction: column; gap: 24px; }
.has-scene .sheet { padding: 22px; }
.panel { background: var(--panel); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.section-title p { color: var(--muted); font-size: .85rem; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; }
.lede { color: var(--muted); max-width: 66ch; margin-top: 6px; }
.banner { background: color-mix(in oklab, var(--warm) 16%, rgba(var(--glass-rgb), 1)); border: 1px solid color-mix(in oklab, var(--warm) 45%, transparent); padding: 12px 16px; border-radius: 10px; font-size: .9rem; }
.banner b { font-weight: 500; }
.note { color: var(--muted); font-size: .86rem; }
.empty { color: var(--sub); font-size: .88rem; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--font-mono); font-size: .76rem; background: var(--panel-2); color: var(--text); padding: 2px 8px; border-radius: 5px; }
.chip.err { color: var(--err); }
.chip.rule { background: color-mix(in oklab, var(--accent) 22%, transparent); color: var(--text); }
.tag { font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-ink); background: var(--accent); padding: 2px 8px; border-radius: 5px; }
.mk { color: var(--err); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.better { color: var(--good); } .worse { color: var(--err); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 400px), 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.tablewrap { overflow-x: auto; }

/* test view */
#v-test { flex: 1; }
.config { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 2px; background: var(--panel); border-radius: 10px; padding: 5px 8px; margin: 0 auto; font-family: var(--font-mono); font-size: .8rem; max-width: 100%; transition: opacity .25s; }
.config button { background: none; border: 0; color: var(--sub); padding: 5px 9px; border-radius: 6px; cursor: pointer; font: inherit; }
.config button:hover { color: var(--text); }
.config button[aria-pressed="true"] { color: var(--accent); }
.config .sep { width: 2px; height: 16px; background: var(--line); border-radius: 2px; margin: 0 6px; }
.config.off { opacity: .45; }
.drillbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; font-size: .88rem; color: var(--muted); transition: opacity .25s; }
.has-scene .drillbar { background: rgba(var(--glass-rgb), var(--glass-a)); padding: 7px 12px; border-radius: 10px; width: fit-content; max-width: 100%; margin: 0 auto; color: var(--text); }
.stage { display: flex; flex-direction: column; gap: 10px; border-radius: 16px; margin-top: clamp(4px, 5vh, 60px); }
.has-scene .stage { padding: 18px 22px 16px; }
.live { font-family: var(--font-mono); font-size: 1.4rem; color: var(--accent); display: flex; gap: 18px; min-height: 1.6em; font-variant-numeric: tabular-nums; align-items: baseline; flex-wrap: wrap; }
.live .lw { color: var(--sub); font-size: 1rem; }
.live .kept { margin-left: auto; color: var(--muted); font-family: var(--font-ui); font-size: .8rem; }
.eye { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--sub); cursor: pointer; align-self: center; }
.eye:hover { color: var(--text); background: var(--panel); }
.eye svg { width: 20px; height: 20px; display: block; }
.eye[aria-pressed="true"] { color: var(--accent); }
.live.pre #counter, .live.pre .lw { opacity: .55; }
.words-wrap { position: relative; cursor: text; }
.words { --lh: 1.6em; --rg: .32em; font-family: var(--font-type); font-size: clamp(1.25rem, .95rem + 1.35vw, 1.8rem); height: calc(3 * var(--lh) + 2 * var(--rg)); overflow: hidden; position: relative; transition: filter .2s, opacity .2s; }
.inner { position: relative; display: flex; flex-wrap: wrap; column-gap: .55em; row-gap: var(--rg); transition: transform .14s ease-out; }
.word { height: var(--lh); line-height: var(--lh); white-space: nowrap; }
.word.blocked { animation: nudge .26s; }
@keyframes nudge { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.l { color: var(--sub); }
.l.ok { color: var(--text); }
.l.bad { color: var(--err); }
.l.x { color: var(--extra); }
.l.sh { position: relative; }
.l.sh::before { content: "⇧" attr(data-sh); position: absolute; left: 50%; top: -.15em; transform: translateX(-50%); font-family: var(--font-mono); font-size: .38em; line-height: 1; color: var(--accent); white-space: nowrap; }
.word.err { text-decoration: underline wavy var(--err); text-decoration-thickness: 1.5px; text-underline-offset: .3em; text-decoration-skip-ink: none; }
#caret, .pace { position: absolute; left: 0; top: 0; width: 2px; height: 1.12em; margin-top: calc((var(--lh) - 1.12em) / 2); border-radius: 2px; pointer-events: none; margin-left: -1px; }
#caret { background: var(--accent); transition: transform .085s ease-out; z-index: 2; }
#caret.idle { animation: blink 1.05s steps(1) infinite; }
.pace { background: var(--sub); opacity: .7; z-index: 1; width: 2px; }
@keyframes blink { 50% { opacity: 0; } }
#kb { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; pointer-events: none; }
.focus-hint { position: absolute; inset: 0; display: none; place-items: center; color: var(--text); font-size: 1rem; pointer-events: none; }
.words-wrap.blurred .words { filter: blur(5px); opacity: .45; }
.words-wrap.blurred .focus-hint { display: grid; }
.hints { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; color: var(--sub); font-size: .78rem; margin-top: 10px; }
.explain { text-align: center; color: var(--muted); font-size: .85rem; max-width: 60ch; margin: 0 auto; border-radius: 10px; }
.has-scene .explain { padding: 8px 14px; }
body.typing .top, body.typing .config, body.typing .drillbar, body.typing .foot, body.typing .explain, body.typing .hints { opacity: 0; pointer-events: none; }

/* results */
.results { display: flex; flex-direction: column; gap: 24px; }
.res-top { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 28px; align-items: start; }
.big { display: flex; flex-direction: column; gap: 14px; }
.big .lbl, .stat .lbl { font-family: var(--font-mono); color: var(--sub); font-size: .85rem; }
.big .val { font-size: clamp(2.6rem, 2rem + 2.5vw, 3.8rem); line-height: 1; color: var(--accent); font-weight: 500; font-variant-numeric: tabular-nums; }
.big .val.fail { color: var(--err); }
.chart-fig { margin: 0; min-width: 0; }
svg.chart { width: 100%; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .ax { fill: var(--sub); font-family: var(--font-mono); font-size: 11px; }
.chart .l1 { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .a1 { fill: var(--accent); opacity: .12; }
.chart .l2 { fill: none; stroke: var(--sub); stroke-width: 1.5; stroke-linejoin: round; }
.chart .l3 { fill: none; stroke: var(--warm); stroke-width: 1.5; stroke-dasharray: 3 3; }
.chart .ex { stroke: var(--err); stroke-width: 2; stroke-linecap: round; }
.chart .ex-n { fill: var(--err); font-family: var(--font-mono); font-size: 10px; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--text); opacity: .06; }
.chart .dot { fill: var(--accent); }
.chart .dot.drill { fill: var(--warm); }
.chart .bar { fill: var(--accent); }
.chart .bar.alt { fill: var(--sub); }
.chart .bar.hot { fill: var(--err); }
.legend { display: flex; gap: 16px; justify-content: flex-end; font-family: var(--font-mono); font-size: .74rem; color: var(--sub); margin-top: 4px; flex-wrap: wrap; }
.lg::before { content: ""; display: inline-block; width: 14px; height: 2px; vertical-align: middle; margin-right: 6px; background: var(--sub); }
.lg.a::before { background: var(--accent); height: 3px; }
.lg.w::before { background: var(--warm); }
.lg.e::before { content: "×"; width: auto; height: auto; background: none; color: var(--err); font-weight: 600; }
.res-row { display: flex; flex-wrap: wrap; gap: 14px 36px; }
.stat .val { font-size: 1.4rem; font-variant-numeric: tabular-nums; }
.stat .val.sm { font-size: 1rem; padding-top: 6px; }
.stat .cap { font-size: .72rem; color: var(--sub); }
.res-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.kv { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; }
.kv div { display: flex; justify-content: space-between; gap: 10px; }
.kv b { font-weight: 500; font-family: var(--font-mono); }
.mini h3 { font-size: .76rem; font-family: var(--font-mono); color: var(--muted); font-weight: 500; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .07em; }
.wlist { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.wmiss { font-family: var(--font-type); font-size: 1.05rem; }
.wmiss small { display: block; font-family: var(--font-mono); font-size: .7rem; color: var(--sub); }
.obs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: .88rem; }
.obs li { display: flex; gap: 10px; align-items: baseline; }
.obs li::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 2px; background: var(--sub); transform: translateY(-1px); }
.obs li.bad::before { background: var(--err); }
.obs li.good::before { background: var(--good); }
.check { width: 100%; border-collapse: collapse; font-size: .86rem; }
.check th { text-align: left; font-weight: 400; color: var(--sub); font-family: var(--font-mono); font-size: .74rem; padding: 0 10px 8px 0; }
.check td { padding: 7px 10px 7px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.lvl { display: inline-flex; gap: 2px; vertical-align: middle; }
.lvl i { width: 7px; height: 7px; border-radius: 2px; background: var(--panel-2); }
.lvl i.on { background: var(--accent); }

/* lists and rows */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 4.2rem minmax(0, 1fr) 3.4rem 4rem auto; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: .86rem; font-variant-numeric: tabular-nums; }
.row:first-child { border-top: 0; }
.row.head { color: var(--sub); font-family: var(--font-mono); font-size: .72rem; padding-top: 0; border-top: 0; }
.row .c { font-family: var(--font-type); font-size: 1.12rem; font-weight: 500; overflow-wrap: anywhere; }
.row .r { text-align: right; }
.row .tr { font-size: .74rem; }
.row.wr { grid-template-columns: minmax(0, 1fr) 4.4rem 4.2rem auto; }
.row.k3 { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 3.4rem; align-items: start; }
.row.k4 { grid-template-columns: minmax(0, 1.5fr) 3.6rem 4.2rem 3.6rem; align-items: start; }
.row p { color: var(--sub); font-size: .76rem; }
.bar { display: block; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--err); border-radius: 3px; }
.bar.acc i { background: var(--accent); }
.bar.warm i { background: var(--warm); }
.flag { color: var(--err); }

.stumlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.stum { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr) 6.5rem auto; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.stum:first-child { border-top: 0; padding-top: 4px; }
.stum-key { font-family: var(--font-type); font-size: 1.55rem; font-weight: 500; line-height: 1.1; overflow-wrap: anywhere; }
.stum-key.sm { font-size: 1.02rem; }
.kind { font-family: var(--font-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .07em; color: var(--sub); margin-bottom: 2px; }
.stum-body p { color: var(--muted); font-size: .87rem; }
.stum-cost { text-align: right; font-variant-numeric: tabular-nums; }
.stum-cost b { display: block; font-weight: 500; font-size: 1.2rem; color: var(--err); font-family: var(--font-mono); }
.stum-cost span { font-size: .7rem; color: var(--sub); }

.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.sumcell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sumcell .lbl { font-family: var(--font-mono); font-size: .74rem; color: var(--sub); }
.sumcell .val { font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.sumcell .val small { font-size: .8rem; color: var(--muted); }
.sumcell svg { width: 100%; height: 44px; display: block; }
.spark-l { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-a { opacity: .14; }

/* keyboard heatmap */
.kbd-heat { --k: clamp(22px, calc((100vw - 110px) / 13), 52px); --g: clamp(3px, .5vw, 6px); display: flex; flex-direction: column; gap: var(--g); overflow-x: auto; padding-bottom: 4px; }
.krow { display: flex; gap: var(--g); }
.key { flex: none; width: var(--k); height: calc(var(--k) * 1.08); border-radius: 7px; background: var(--panel-2); display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--font-mono); font-size: calc(var(--k) * .34); line-height: 1.1; color: var(--text); }
.key small { font-size: max(9px, calc(var(--k) * .2)); color: var(--muted); font-variant-numeric: tabular-nums; }
.key.nodata { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--sub); }
.key.hot small { color: var(--text); }
.heat-legend { display: flex; align-items: center; gap: 8px; font-size: .74rem; color: var(--sub); margin-top: 12px; font-family: var(--font-mono); flex-wrap: wrap; }
.heat-legend .ramp { width: 120px; height: 8px; border-radius: 4px; }

/* habits */
.find { display: grid; grid-template-columns: 5px minmax(0, 1fr) auto; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); align-items: start; }
.find:first-child { border-top: 0; padding-top: 2px; }
.find .sev { border-radius: 3px; background: var(--err); align-self: stretch; }
.find h3 { font-size: 1.02rem; }
.find .stat { color: var(--text); font-size: .88rem; margin-top: 3px; }
.find .why { color: var(--muted); font-size: .84rem; margin-top: 4px; }
.find .fix { color: var(--muted); font-size: .84rem; margin-top: 2px; }
.find .fix b { color: var(--accent); font-weight: 500; }
.goodlist { display: flex; flex-wrap: wrap; gap: 10px; }
.goodlist div { background: color-mix(in oklab, var(--good) 14%, var(--panel)); border-radius: 10px; padding: 10px 14px; font-size: .86rem; max-width: 100%; }
.goodlist b { display: block; font-weight: 500; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 18px; }
.metric .lbl { font-family: var(--font-mono); font-size: .72rem; color: var(--sub); }
.metric .val { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.metric .val.bad { color: var(--err); }
.metric .val.good { color: var(--good); }
.metric p { font-size: .74rem; color: var(--muted); }
.conf { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.conf div { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; }
.conf .pair { font-family: var(--font-mono); font-size: 1.1rem; }
.conf .pair .arrow { color: var(--sub); margin: 0 6px; }
.conf small { display: block; color: var(--muted); font-size: .72rem; }

/* drills */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 14px; }
.card { background: var(--panel); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.card h3 { font-size: 1.02rem; }
.card-sub { color: var(--muted); font-size: .85rem; }
.preview { font-family: var(--font-type); color: var(--sub); font-size: .92rem; line-height: 1.6; overflow-wrap: anywhere; flex: 1; }
.preview .hl { color: var(--text); }
.card .btn { align-self: flex-start; }
.card-main { padding: 22px 24px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 14px 30px; }
.card-main h2 { font-size: 1.4rem; }
.card-main .preview { font-size: 1.1rem; }
.card-main .left { display: flex; flex-direction: column; gap: 12px; }
.session { display: flex; flex-direction: column; gap: 12px; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; counter-reset: s; }
.steps li { counter-increment: s; background: var(--panel-2); border-radius: 8px; padding: 6px 12px 6px 8px; font-size: .84rem; display: flex; gap: 8px; align-items: center; }
.steps li::before { content: counter(s); font-family: var(--font-mono); font-size: .72rem; background: var(--accent); color: var(--accent-ink); border-radius: 5px; padding: 0 6px; }
.steps li.done { opacity: .55; text-decoration: line-through; }
.steps li.now { box-shadow: inset 0 0 0 1px var(--accent); }
.custom { display: flex; flex-direction: column; gap: 10px; }
.custom label { font-weight: 500; }
.custom .rowf { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.custom input[type="text"], .custom textarea, .custom select, .field { flex: 1 1 220px; min-width: 0; font: inherit; font-family: var(--font-mono); font-size: .9rem; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: rgba(var(--glass-rgb), 1); color: var(--text); }
:root:not(.has-scene) .custom input[type="text"], :root:not(.has-scene) .custom textarea, :root:not(.has-scene) .field { background: var(--bg); }
.custom textarea { min-height: 70px; resize: vertical; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: .84rem; color: var(--muted); }
.toggles label { display: inline-flex; gap: 6px; align-items: center; font-weight: 400; cursor: pointer; }
.custom .hint { color: var(--sub); font-size: .78rem; }
.custom .msg { color: var(--err); font-size: .82rem; }

/* themes */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 14px; }
.theme { font: inherit; text-align: left; border: 0; padding: 0; background: var(--panel); border-radius: var(--radius); overflow: hidden; cursor: pointer; color: var(--text); display: flex; flex-direction: column; box-shadow: inset 0 0 0 1px transparent; }
.theme canvas { width: 100%; aspect-ratio: 16 / 10; display: block; image-rendering: pixelated; background: var(--panel-2); max-width: 100%; }
.theme .plain { width: 100%; aspect-ratio: 16 / 10; display: grid; grid-template-columns: 1fr 1fr; }
.theme .plain span:first-child { background: #eff1f6; } .theme .plain span:last-child { background: #131826; }
.theme .meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.theme .meta b { font-weight: 500; font-size: .92rem; }
.theme .meta small { color: var(--muted); font-size: .76rem; }
.theme .sw { display: flex; gap: 4px; margin-top: 6px; }
.theme .sw i { width: 14px; height: 14px; border-radius: 4px; }
.theme[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.theme:hover { filter: brightness(1.06); }
.settings-row { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: center; font-size: .88rem; }
.settings-row label { display: inline-flex; gap: 10px; align-items: center; }
input[type="range"] { accent-color: var(--accent); }

/* data */
.doc-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.doc-table th { text-align: left; font-weight: 400; color: var(--sub); font-family: var(--font-mono); font-size: .72rem; padding: 0 12px 8px 0; white-space: nowrap; }
.doc-table td { padding: 9px 12px 9px 0; border-top: 1px solid var(--line); vertical-align: top; font-variant-numeric: tabular-nums; }
.doc-table code, .schema code { font-family: var(--font-mono); font-size: .8rem; }
.schema { font-family: var(--font-mono); font-size: .76rem; line-height: 1.55; background: var(--panel-2); border-radius: 10px; padding: 14px 16px; overflow-x: auto; white-space: pre; color: var(--text); margin: 0; }
.data-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; font-size: .86rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
textarea.dump { width: 100%; min-height: 140px; font-family: var(--font-mono); font-size: .74rem; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); padding: 10px; }

.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; color: var(--sub); font-size: .76rem; margin-top: auto; transition: opacity .25s; border-radius: 10px; }
.foot a { color: inherit; text-decoration: none; }
.foot a:hover { color: var(--text); text-decoration: underline; }
.has-scene .foot { padding: 8px 14px; color: var(--muted); }
.status::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sub); margin-right: 7px; vertical-align: 1px; }
.status.account::before { background: var(--good); }
.status.warn::before { background: var(--warm); }

@media (max-width: 720px) {
  .res-top { grid-template-columns: 1fr; }
  .big { flex-direction: row; gap: 36px; }
  .stum { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 14px; }
  .stum-cost { grid-column: 2; grid-row: 1; }
  .stum-body { grid-column: 1 / -1; }
  .stum .btn-sm { grid-column: 1 / -1; justify-self: start; }
  .card-main { grid-template-columns: 1fr; padding: 18px; }
  .row { grid-template-columns: 3.2rem minmax(0, 1fr) 3rem 3.6rem auto; gap: 8px; }
  .row.wr { grid-template-columns: minmax(0, 1fr) 3.8rem auto; }
  .row.wr .hide-sm, .row.k4 .hide-sm { display: none; }
  .row.k4 { grid-template-columns: minmax(0, 1fr) 3.4rem 3.8rem; }
  .find { grid-template-columns: 4px minmax(0, 1fr); }
  .find .btn-sm { grid-column: 2; justify-self: start; }
  .has-scene .sheet, .has-scene .stage { padding: 16px; }
  .brand { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  #caret, .inner, .top, .config, .foot { transition: none; }
  #caret.idle, .word.blocked { animation: none; }
}
