/* WhileLoopWarrior: raw TUI look. One accent, 1px rules, no radius, no gradients, no shadows. */

:root, [data-theme="amber"] {
  --bg: #0c0b09;
  --bg-2: #12100c;
  --bg-3: #1b1812;
  --line: #3b3428;
  --line-2: #5a4f3c;
  --fg: #eadfc8;
  --dim: #9a8f7a;
  --mute: #5e5646;
  --acc: #ffb000;
  --ink: #0c0b09;
  --ok: #a6e22e;
  --err: #ff5f56;
  --warn: #ffb000;
  --e: #a6e22e;
  --m: #ffb000;
  --h: #ff5f56;
  --sel: rgba(255, 176, 0, 0.16);
  --glow: none;
}
[data-theme="phosphor"] {
  --bg: #040804;
  --bg-2: #071007;
  --bg-3: #0c180c;
  --line: #1d3a1b;
  --line-2: #2f5e2b;
  --fg: #b9f6ad;
  --dim: #6da764;
  --mute: #3d6538;
  --acc: #39ff14;
  --ink: #031003;
  --ok: #39ff14;
  --err: #ff4040;
  --warn: #e8ff4f;
  --e: #39ff14;
  --m: #e8ff4f;
  --h: #ff4040;
  --sel: rgba(57, 255, 20, 0.14);
  --glow: 0 0 6px rgba(57, 255, 20, 0.35);
}
[data-theme="paper"] {
  --bg: #f1ede2;
  --bg-2: #ebe6d8;
  --bg-3: #e2dccb;
  --line: #1a1a1a;
  --line-2: #1a1a1a;
  --fg: #141414;
  --dim: #555046;
  --mute: #8c8676;
  --acc: #ff3d00;
  --ink: #f1ede2;
  --ok: #0b7a2b;
  --err: #d40000;
  --warn: #b35c00;
  --e: #0b7a2b;
  --m: #b35c00;
  --h: #d40000;
  --sel: rgba(255, 61, 0, 0.14);
  --glow: none;
}
[data-theme="frost"] {
  --bg: #0b1016;
  --bg-2: #0f161e;
  --bg-3: #16202b;
  --line: #24323f;
  --line-2: #36495a;
  --fg: #d6e2ea;
  --dim: #8aa0b2;
  --mute: #4d6173;
  --acc: #6fd3ff;
  --ink: #071018;
  --ok: #7ee0a8;
  --err: #ff6b81;
  --warn: #ffd479;
  --e: #7ee0a8;
  --m: #ffd479;
  --h: #ff6b81;
  --sel: rgba(111, 211, 255, 0.16);
  --glow: none;
}
[data-theme="redline"] {
  --bg: #0a0505;
  --bg-2: #110909;
  --bg-3: #1a0e0e;
  --line: #3a1c1c;
  --line-2: #5c2a2a;
  --fg: #f2dcd6;
  --dim: #a98a84;
  --mute: #63443f;
  --acc: #ff3b30;
  --ink: #0a0505;
  --ok: #9be08a;
  --err: #ffb347;
  --warn: #ffb347;
  --e: #9be08a;
  --m: #ffb347;
  --h: #ff3b30;
  --sel: rgba(255, 59, 48, 0.18);
  --glow: none;
}
[data-theme="c64"] {
  --bg: #352879;
  --bg-2: #3d2f87;
  --bg-3: #463795;
  --line: #6c5eb5;
  --line-2: #8a7fd0;
  --fg: #c9c3ff;
  --dim: #a49cf0;
  --mute: #7c6fd0;
  --acc: #eeee77;
  --ink: #352879;
  --ok: #9ae29b;
  --err: #ff7777;
  --warn: #eeee77;
  --e: #9ae29b;
  --m: #eeee77;
  --h: #ff7777;
  --sel: rgba(238, 238, 119, 0.18);
  --glow: none;
}
[data-theme="dmg"] {
  --bg: #9bbc0f;
  --bg-2: #8fb10e;
  --bg-3: #84a50e;
  --line: #306230;
  --line-2: #0f380f;
  --fg: #0f380f;
  --dim: #306230;
  --mute: #5a8a1c;
  --acc: #0f380f;
  --ink: #9bbc0f;
  --ok: #0f380f;
  --err: #7a1f1f;
  --warn: #306230;
  --e: #306230;
  --m: #0f380f;
  --h: #7a1f1f;
  --sel: rgba(15, 56, 15, 0.18);
  --glow: none;
}

:root {
  --mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --pix: "VT323", "IBM Plex Mono", monospace;
  --sidebar-w: 310px;
  --desc-w: 36%;
  --bottom-h: 40vh;
}

* { box-sizing: border-box; border-radius: 0 !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 13px/1.5 var(--mono);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-shadow: var(--glow);
}
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; text-shadow: inherit; }
input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.grow { flex: 1; }
::selection { background: var(--acc); color: var(--ink); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line); }
::-webkit-scrollbar-thumb:hover { background: var(--acc); }
::-webkit-scrollbar-track { background: transparent; }
kbd { font: inherit; opacity: .6; }

/* ---------------- top bar ---------------- */
.app-top {
  height: 30px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 10px 0 0;
  border-bottom: 1px solid var(--line);
}
.logo {
  height: 100%; display: flex; align-items: center; padding: 0 12px;
  background: var(--acc); color: var(--ink); font-weight: 700; letter-spacing: 1px; text-shadow: none;
  text-decoration: none;
}
.crumb { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.crumb b { color: var(--fg); font-weight: 600; }
.crumb .d { padding: 0 6px; margin-left: 8px; color: var(--ink); text-shadow: none; font-weight: 700; }
.d-Easy { background: var(--e); } .d-Medium { background: var(--m); } .d-Hard { background: var(--h); }
.nav { display: flex; gap: 2px; }
.tb { padding: 2px 6px; color: var(--dim); white-space: nowrap; }
.tb:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
.tb.run { color: var(--fg); }
.tb.bench { color: var(--acc); }
.tb.kill { color: var(--err); }
.tb:disabled { opacity: .35; cursor: default; background: none; color: var(--dim); }
.timer { display: flex; align-items: center; gap: 2px; color: var(--dim); }
.timer.running #timerText { color: var(--acc); }
.timer.running #timerText::before { content: "● "; animation: blink 1s steps(1) infinite; }
.xp { color: var(--dim); white-space: nowrap; }
.xp b { color: var(--acc); font-weight: 600; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------------- panes ---------------- */
.app-main { flex: 1; display: flex; min-height: 0; padding: 8px 6px 6px; gap: 0; }
.pane {
  position: relative;
  border: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  background: var(--bg);
}
.pane.focus { border-color: var(--acc); }
.ptitle {
  position: absolute; top: -9px; left: 8px; z-index: 5;
  padding: 0 6px; line-height: 16px; background: var(--bg);
  color: var(--dim); white-space: nowrap; max-width: calc(100% - 16px); overflow: hidden; text-overflow: ellipsis;
}
.ptitle b { color: var(--acc); font-weight: 600; }
.ptitle b::before { content: "["; color: var(--mute); } .ptitle b::after { content: "]"; color: var(--mute); }
.pane.focus .ptitle { color: var(--fg); }
#sidebar { width: var(--sidebar-w); flex: none; }
#sidebar.collapsed, #sidebar.collapsed + .gutter { display: none; }
#descPane { width: var(--desc-w); flex: none; min-width: 220px; }
.work { flex: 1; display: flex; flex-direction: column; min-width: 300px; }
#editorPane { flex: 1; min-height: 100px; }
#editorWrap { flex: 1; position: relative; margin-top: 8px; }
#editor { position: absolute; inset: 0; }
#bottomPanel { height: var(--bottom-h); flex: none; min-height: 34px; }

.gutter { width: 8px; flex: none; cursor: col-resize; position: relative; }
.gutter-h { height: 12px; flex: none; cursor: row-resize; position: relative; }
.gutter::after, .gutter-h::after { content: ""; position: absolute; background: transparent; }
.gutter::after { top: 0; bottom: 0; left: 3px; width: 2px; }
.gutter-h::after { left: 0; right: 0; top: 5px; height: 2px; }
.gutter:hover::after, .gutter-h:hover::after, .drag::after { background: var(--acc); }
body.dragging { user-select: none; }

/* tmux-style zoom / minimize (ctrl+b z / m / r) */
#descPane.min, #descPane.min + .gutter { display: none; }
#editorPane.min, #editorPane.min + .gutter-h { display: none; }
#editorPane.min ~ #bottomPanel { flex: 1; height: auto; }
body.zoomed .app-main > .pane:not(.zoom-target), body.zoomed .app-main > .gutter,
body.zoomed .work > .pane:not(.zoom-target), body.zoomed .work > .gutter-h { display: none; }
body.zoomed .app-main > .work:not(:has(.zoom-target)) { display: none; }
body.zoomed .pane.zoom-target,
body.zoomed #sidebar.zoom-target, body.zoomed #descPane.zoom-target, body.zoomed #bottomPanel.zoom-target { display: flex; flex: 1; width: auto; height: auto; }
body.zoomed .pane.zoom-target .ptitle::after { content: " [Z]"; color: var(--acc); }
.pane-num {
  position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; pointer-events: none;
  font: 96px/1 var(--pix); color: var(--mute); background: rgba(0, 0, 0, .35);
}
.pane-num.on { color: var(--acc); }
body.dragging #editor { pointer-events: none; }

.tabs { display: flex; align-items: center; gap: 0; padding: 10px 8px 0; flex: none; border-bottom: 1px dashed var(--line); }
.tabs button { padding: 2px 8px 3px; color: var(--dim); }
.tabs button:hover { color: var(--fg); }
.tabs button.on { background: var(--fg); color: var(--bg); text-shadow: none; }
.tabs sup { font-size: 10px; margin-left: 3px; vertical-align: top; color: inherit; opacity: .8; }
.tabs sup.ok { color: var(--ok); opacity: 1; } .tabs sup.bad { color: var(--err); opacity: 1; }
.tabs button.on sup.ok, .tabs button.on sup.bad { color: var(--bg); }

/* ---------------- sidebar ---------------- */
.side-scroll { flex: 1; overflow: hidden; display: flex; flex-direction: column; margin-top: 10px; min-height: 0; }
.stats { padding: 4px 10px 10px; border-bottom: 1px dashed var(--line); }
.big { font-family: var(--pix); font-size: 44px; line-height: .9; color: var(--acc); letter-spacing: 1px; }
.big small { font-size: 22px; color: var(--dim); margin-left: 4px; }
.rank { color: var(--fg); margin-top: 6px; }
.rank span { color: var(--dim); }
.xpbar, .split { white-space: pre; color: var(--dim); font-size: 12px; line-height: 1.45; overflow: hidden; }
.xpbar i, .split i { font-style: normal; }
.xpbar .f { color: var(--acc); }
.split .e { color: var(--e); } .split .m { color: var(--m); } .split .h { color: var(--h); }
.heat-head { display: flex; justify-content: space-between; color: var(--dim); margin-top: 10px; font-size: 12px; }
.heat-head b { color: var(--acc); font-weight: 600; }
.heat { margin: 2px 0 0; font: 12px/1.05 var(--mono); letter-spacing: 1px; color: var(--mute); }
.heat .l1 { color: var(--line-2); } .heat .l2 { color: var(--dim); } .heat .l3 { color: var(--fg); } .heat .l4 { color: var(--acc); }
.heat .today { background: var(--sel); }

.filter { padding: 10px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px dashed var(--line); }
.prompt { display: flex; align-items: center; gap: 6px; color: var(--acc); border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.prompt:focus-within { border-bottom-color: var(--acc); }
.prompt input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--fg); caret-color: var(--acc); }
.prompt input::placeholder { color: var(--mute); }
.diff { display: flex; gap: 2px; }
.diff button { padding: 0 6px; color: var(--dim); }
.diff button::before { content: "( ) "; white-space: pre; }
.diff button.on::before { content: "(*) "; color: var(--acc); }
.diff button.on { color: var(--fg); }
.sels { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sels select {
  appearance: none; width: 100%; padding: 2px 6px; background: var(--bg); color: var(--dim);
  border: 1px solid var(--line); outline: none; font-size: 12px;
}
.sels select:focus { border-color: var(--acc); color: var(--fg); }
.sels select:last-child { grid-column: 1 / -1; }

.plist { padding: 4px 0 10px; flex: 1; overflow: auto; min-height: 90px; }
@media (max-height: 700px) { .split { display: none; } .stats { padding-bottom: 6px; } .filter { gap: 6px; padding: 8px 10px; } }
.prob { display: grid; grid-template-columns: 14px 40px 1fr 14px; gap: 6px; padding: 0 10px; cursor: pointer; white-space: nowrap; }
.prob:hover { background: var(--bg-3); }
.prob.active { background: var(--acc); color: var(--ink); text-shadow: none; }
.prob.active .id, .prob.active .st, .prob.active .dl { color: var(--ink); }
.prob .st { color: var(--mute); }
.prob .st.solved { color: var(--ok); } .prob .st.tried { color: var(--warn); }
.prob .id { color: var(--mute); }
.prob .t { overflow: hidden; text-overflow: ellipsis; }
.dl { font-weight: 700; text-align: right; }
.dl.Easy { color: var(--e); } .dl.Medium { color: var(--m); } .dl.Hard { color: var(--h); }
.app-empty { color: var(--mute); padding: 14px 10px; }

/* ---------------- description ---------------- */
.desc-body { flex: 1; overflow: auto; padding: 12px 16px 40px; }
.h1 { font-family: var(--pix); font-size: 30px; line-height: 1; margin: 2px 0 8px; color: var(--fg); }
.h1 span { color: var(--acc); }
.app-meta { color: var(--dim); font-size: 12px; margin: 0 0 14px; display: grid; grid-template-columns: auto 1fr; gap: 0 10px; }
.app-meta dt { color: var(--mute); }
.app-meta dd { margin: 0; }
.app-meta a { color: var(--acc); }
.statement { line-height: 1.65; }
.statement p { margin: 0 0 10px; }
.statement code { color: var(--acc); background: none; font: inherit; }
.statement strong { color: var(--fg); font-weight: 600; }
.statement em { color: var(--fg); }
.statement a { color: var(--acc); }
.statement pre, .statement .example-block {
  white-space: pre-wrap; margin: 0 0 14px; padding: 6px 0 6px 12px;
  border-left: 2px solid var(--acc); background: var(--bg-2); font: inherit;
}
.statement .example-block p { margin: 0; }
.statement pre code, .statement .example-block code { color: var(--fg); }
.statement img { max-width: 100%; height: auto !important; filter: grayscale(1) contrast(1.1); border: 1px solid var(--line); background: #fff; margin: 4px 0 10px; }
.statement ul { padding-left: 0; list-style: none; }
.statement li::before { content: "- "; color: var(--acc); }
.statement li { margin: 3px 0; padding-left: 14px; text-indent: -14px; }
.statement pre.plain { border-left-color: var(--dim); }
.note { color: var(--warn); margin-bottom: 10px; }
.hint { border: 1px dashed var(--line); margin-bottom: 8px; }
.hint summary { cursor: pointer; padding: 4px 8px; color: var(--dim); list-style: none; }
.hint summary::-webkit-details-marker { display: none; }
.hint summary::before { content: "[+] "; color: var(--acc); }
.hint[open] summary::before { content: "[-] "; }
.hint div { padding: 0 8px 8px 30px; }
.similar a { display: grid; grid-template-columns: 1fr auto; padding: 1px 4px; color: var(--fg); text-decoration: none; }
.similar a:hover { background: var(--fg); color: var(--bg); text-shadow: none; }
.similar .ext { color: var(--mute); }

/* ---------------- output ---------------- */
.out { flex: 1; overflow: auto; padding: 10px 14px 14px; }
.idle { color: var(--mute); white-space: pre; line-height: 1.6; }
.idle b { color: var(--dim); font-weight: 500; }
.idle .k { color: var(--acc); }
.cmd { color: var(--mute); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd b { color: var(--acc); font-weight: 400; }
.banner { font-family: var(--pix); font-size: 46px; line-height: .85; letter-spacing: 2px; margin: 4px 0 8px; display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.banner.ok { color: var(--ok); } .banner.bad { color: var(--err); } .banner.run { color: var(--acc); }
.banner.run::after { content: "_"; animation: blink 1s steps(1) infinite; }
.banner small { font-family: var(--mono); font-size: 13px; letter-spacing: 0; color: var(--dim); }
.banner.flash { animation: glitch .45s steps(2) 2; }
@keyframes glitch { 0% { transform: translateX(0); } 25% { transform: translateX(-3px); filter: hue-rotate(90deg); } 50% { transform: translateX(3px); } 100% { transform: none; } }
.pbar { white-space: pre; color: var(--dim); margin-bottom: 10px; }
.pbar .ok { color: var(--ok); } .pbar .bad { color: var(--err); }
table.cases { border-collapse: collapse; margin-bottom: 12px; }
.cases th { text-align: left; color: var(--mute); font-weight: 400; padding: 0 18px 2px 0; border-bottom: 1px dashed var(--line); }
.cases td { padding: 0 18px 0 0; white-space: nowrap; }
.cases tr.row { cursor: pointer; }
.cases tr.row:hover td { background: var(--bg-3); }
.cases tr.on td { background: var(--sel); }
.cases td:first-child { padding-left: 4px; }
.cases tr.on td:first-child { color: var(--acc); }
.st-ok { color: var(--ok); } .st-bad { color: var(--err); } .st-pend { color: var(--acc); animation: blink 1s steps(1) infinite; }
.detail-h { color: var(--mute); margin: 4px 0 6px; white-space: nowrap; overflow: hidden; }
.kv { display: grid; grid-template-columns: 44px 1fr; gap: 2px 10px; margin: 0; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-all; }
.kv dd.bad { color: var(--err); } .kv dd.ok { color: var(--ok); }
.kv .caret { color: var(--err); white-space: pre; display: block; }
.kv .log { color: var(--dim); border-left: 1px solid var(--line); padding-left: 8px; max-height: 150px; overflow: auto; }
.kv .err { color: var(--err); }
.jump { color: var(--acc); cursor: pointer; text-decoration: underline; }
.stderr { color: var(--err); white-space: pre-wrap; margin-top: 10px; }

/* complexity */
.cx-top { display: flex; gap: 34px; flex-wrap: wrap; margin-bottom: 10px; }
.cx-top .lbl { color: var(--mute); font-size: 12px; }
.cx-top .val { font-family: var(--pix); font-size: 40px; line-height: .9; color: var(--acc); }
.cx-top .val.wait { color: var(--mute); }
.cx-top .sub { color: var(--dim); font-size: 12px; }
.cx-top .yours .val { color: var(--fg); font-size: 28px; }
.cx-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
.out { container-type: inline-size; }
@container (max-width: 760px) { .cx-grid { grid-template-columns: 1fr; } }
.chart-head { display: flex; justify-content: space-between; color: var(--mute); font-size: 12px; margin-bottom: 2px; }
.chart-head button { color: var(--dim); padding: 0 4px; }
.chart-head button.on { background: var(--fg); color: var(--bg); text-shadow: none; }
.chart svg { width: 100%; height: auto; display: block; border: 1px solid var(--line); }
.chart .gridl { stroke: var(--line); stroke-dasharray: 1 3; }
.chart .ax { stroke: var(--dim); }
.chart text { fill: var(--mute); font: 10px var(--mono); }
.chart .ref { fill: none; stroke: var(--mute); stroke-dasharray: 3 4; }
.chart .ref-t { fill: var(--dim); }
.chart .ser { fill: none; stroke: var(--acc); stroke-width: 1.5; }
.chart .pt { fill: var(--bg); stroke: var(--acc); stroke-width: 1.5; }
table.bench { border-collapse: collapse; width: 100%; }
.bench th { text-align: right; color: var(--mute); font-weight: 400; border-bottom: 1px dashed var(--line); padding: 0 8px 2px; }
.bench td { text-align: right; padding: 0 8px; white-space: nowrap; }
.bench td.bar { text-align: left; color: var(--acc); }
.bench th:last-child { text-align: left; }
.cx-note { color: var(--warn); margin-top: 8px; }
.cx-foot { color: var(--mute); font-size: 12px; margin-top: 8px; }

.console { white-space: pre-wrap; word-break: break-word; }
.console .err { color: var(--err); }
.console .sys { color: var(--mute); }
.console .tag { color: var(--mute); }

/* ---------------- status line / command line ---------------- */
.status {
  height: 22px; flex: none; display: flex; align-items: center; gap: 0;
  background: var(--bg-3); border-top: 1px solid var(--line); white-space: nowrap; overflow: hidden;
}
.status > * { padding: 0 10px; }
.status .mode { height: 100%; display: flex; align-items: center; background: var(--fg); color: var(--bg); font-weight: 700; text-shadow: none; }
.status .mode.insert { background: var(--ok); color: var(--ink); } .status .mode.visual { background: var(--acc); color: var(--ink); }
.status .mode.run { background: var(--acc); color: var(--ink); animation: blink 1s steps(1) infinite; }
.status .mode.err { background: var(--err); color: var(--bg); }
.status .vimstat { color: var(--acc); padding: 0 4px; }
.status .vimstat:empty { display: none; }
.status .panestat { display: flex; gap: 6px; padding: 0 6px; }
.panestat .pfx { background: var(--acc); color: var(--ink); padding: 0 4px; font-weight: 700; text-shadow: none; }
.panestat button { color: var(--dim); } .panestat button:hover { color: var(--acc); }
#fileState { color: var(--dim); }
#diagState { color: var(--dim); }
#diagState.e { color: var(--err); } #diagState.w { color: var(--warn); }
.msg { color: var(--fg); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.msg.err { color: var(--err); } .msg.ok { color: var(--ok); } .msg.acc { color: var(--acc); }
#cursorPos, #userStat, #streakSmall, #themeName, #clock { color: var(--dim); border-left: 1px solid var(--line); }
#userStat b { color: var(--fg); font-weight: 600; } #userStat:hover b { color: var(--acc); }
#streakSmall b { color: var(--acc); font-weight: 600; }

.cmdline { position: fixed; left: 0; right: 0; bottom: 0; z-index: 90; background: var(--bg); border-top: 1px solid var(--acc); }
.cmdline label { display: flex; align-items: center; height: 22px; padding: 0 10px; color: var(--acc); }
.cmdline input { flex: 1; background: none; border: 0; outline: none; color: var(--fg); caret-color: var(--acc); padding-left: 2px; }
#cmdHints { list-style: none; margin: 0; padding: 4px 0; max-height: 40vh; overflow: auto; border-bottom: 1px dashed var(--line); }
#cmdHints:empty { display: none; }
#cmdHints li { display: grid; grid-template-columns: 260px 1fr; padding: 0 10px; color: var(--dim); cursor: pointer; }
#cmdHints li b { color: var(--fg); font-weight: 500; }
#cmdHints li.on { background: var(--acc); color: var(--ink); text-shadow: none; }
#cmdHints li.on b { color: var(--ink); }

/* ---------------- modal ---------------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: rgba(0, 0, 0, .55); }
.modal { width: min(660px, 94vw); max-height: 86vh; overflow: auto; background: var(--bg); border: 1px solid var(--acc); }
.modal .mt { background: var(--acc); color: var(--ink); padding: 1px 10px; font-weight: 700; text-shadow: none; display: flex; justify-content: space-between; }
.modal .mt button { color: var(--ink); }
.modal .mb { padding: 12px 14px; }
.modal table { border-collapse: collapse; width: 100%; }
.modal td { padding: 1px 0; vertical-align: top; }
.modal td:first-child { color: var(--acc); white-space: nowrap; padding-right: 18px; }
.modal td:last-child { color: var(--dim); }
.modal h4 { margin: 12px 0 4px; color: var(--fg); font-weight: 600; }
.modal h4:first-child { margin-top: 0; }
.modal p { color: var(--dim); }
.modal .row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px; }
.modal .row button { padding: 1px 10px; border: 1px solid var(--line-2); }
.modal .row button:hover { background: var(--fg); color: var(--bg); }
.modal .row button.danger { border-color: var(--err); color: var(--err); }
.modal .row button.danger:hover { background: var(--err); color: var(--bg); }

/* editor runtime-error marker */
.err-line { background: rgba(255, 95, 86, 0.12); }
.err-glyph { background: var(--err); width: 4px !important; margin-left: 4px; }

/* ---------------- boot + crt ---------------- */
.boot { position: fixed; inset: 0; z-index: 300; background: var(--bg); padding: 24px 28px 40px; cursor: pointer; overflow-y: auto; overscroll-behavior: contain; }
.boot pre { margin: 0; font: 14px/1.55 var(--mono); color: var(--fg); }
.boot .ok { color: var(--ok); } .boot .acc { color: var(--acc); } .boot .dim { color: var(--mute); } .boot .err { color: var(--err); }
.boot.tty { cursor: text; overflow: auto; }
.boot pre { white-space: pre-wrap; word-break: break-word; }
/* the real input is invisible; its value is drawn into the log */
/* 16px: a smaller input makes iOS zoom the page when it gets focus */
/* the form handed to password managers after a login: present for them, invisible for people */
.pm-form { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.tty-in { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; }
.boot a { color: inherit; text-decoration: none; }
.boot a.acc { color: var(--acc); }
.boot a:hover { background: var(--acc); color: var(--ink); text-shadow: none; }
.boot-home { position: fixed; top: 14px; right: 20px; z-index: 2; color: var(--dim) !important; font: 13px var(--mono); cursor: pointer; }
.boot-home:hover { background: var(--acc) !important; color: var(--ink) !important; }
.boot .cur::after { content: "█"; color: var(--acc); animation: blink 1s steps(1) infinite; }
.crt-fx { display: none; }
body.crt .crt-fx {
  display: block; position: fixed; inset: 0; z-index: 250; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0, rgba(0, 0, 0, .22) 1px, transparent 1px, transparent 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, .45) 100%);
  animation: flicker 6s infinite steps(60);
}
@keyframes flicker { 0%, 100% { opacity: 1; } 47% { opacity: .92; } 48% { opacity: 1; } }

/* ---------------- code | design switch ---------------- */
.modes { display: flex; border: 1px solid var(--line); }
.modes a { padding: 1px 8px; color: var(--dim); text-decoration: none; }
.modes a:hover { color: var(--fg); }
.modes a.on { background: var(--acc); color: var(--ink); text-shadow: none; }

/* complexity panel: the browser's space figure is an estimate */
.cx-top .lbl .est { color: var(--warn); font-size: 11px; margin-left: 4px; }
