/* clox playground
 *
 * Palette: "ink and coral". Dark is near-black ink with a coral accent (lox:
 * smoked salmon) and teal for the debugger; light is warm paper with the same
 * accents, deepened for contrast. Every colour is a token: light by default,
 * dark when the system is dark (unless the user picked light) or when the user
 * picked dark.
 *
 * Type: Inter for the interface, JetBrains Mono for code. Spacing on a 4 px
 * grid; panels have 10 px corners and hairline borders.
 */

@font-face {
  font-family: "Inter";
  src: url("vendor/fonts/inter-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("vendor/fonts/jetbrains-mono-latin-variable.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("vendor/fonts/jetbrains-mono-latin-variable-italic.woff2") format("woff2");
  font-weight: 100 800;
  font-style: italic;
  font-display: swap;
}

:root {
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --mod: "Ctrl ";
  --shift: "Shift ";

  /* light: warm paper */
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --raised: #f1eee7;
  --border: #e5e0d6;
  --border-strong: #d4ccbd;
  --text: #1d1b18;
  --muted: #6c675d;
  --faint: #9d978a;
  --accent: #c84a26;
  --accent-hover: #b23f1e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(200, 74, 38, 0.1);
  --teal: #0e8277;
  --teal-soft: rgba(14, 130, 119, 0.12);
  --error: #c5302a;
  --error-soft: rgba(197, 48, 42, 0.08);
  --ok: #2b7a3d;
  --shadow: 0 1px 2px rgba(40, 30, 10, 0.05), 0 4px 16px rgba(40, 30, 10, 0.05);
  --shadow-pop: 0 8px 28px rgba(40, 30, 10, 0.16);

  --code-bg: #fffefb;
  --gutter: #b2ab9d;
  --active-line: rgba(200, 74, 38, 0.045);
  --selection: rgba(14, 130, 119, 0.18);
  --hover-line: rgba(232, 168, 20, 0.2);
  --debug-line: rgba(14, 130, 119, 0.14);
  --panel: var(--surface);

  --tok-keyword: #7b3fd6;
  --tok-atom: #c2410c;
  --tok-number: #0e7c72;
  --tok-string: #2f7a34;
  --tok-comment: #a29b8d;
  --tok-self: #c2410c;
  --tok-def: #2459c4;
  --tok-prop: #8a5a00;
  --tok-operator: #5f5a52;
  color-scheme: light;
}

html[data-platform="mac"] { --mod: "⌘"; --shift: "⇧"; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0c10;
    --surface: #10131a;
    --surface-2: #141822;
    --raised: #1a1f2b;
    --border: #212734;
    --border-strong: #2d3546;
    --text: #e8eaf0;
    --muted: #8d95a8;
    --faint: #5c6579;
    --accent: #ff7a59;
    --accent-hover: #ff9070;
    --accent-ink: #1a0d08;
    --accent-soft: rgba(255, 122, 89, 0.13);
    --teal: #4fd8c8;
    --teal-soft: rgba(79, 216, 200, 0.13);
    --error: #ff6f69;
    --error-soft: rgba(255, 111, 105, 0.1);
    --ok: #5fd69b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.25);
    --shadow-pop: 0 10px 34px rgba(0, 0, 0, 0.5);

    --code-bg: #0d1016;
    --gutter: #485164;
    --active-line: rgba(255, 255, 255, 0.025);
    --selection: rgba(79, 216, 200, 0.2);
    --hover-line: rgba(255, 196, 64, 0.13);
    --debug-line: rgba(79, 216, 200, 0.13);

    --tok-keyword: #c3a6ff;
    --tok-atom: #ffa46e;
    --tok-number: #74d9cc;
    --tok-string: #a5df9a;
    --tok-comment: #5c6579;
    --tok-self: #ffa46e;
    --tok-def: #86b0ff;
    --tok-prop: #e8c87d;
    --tok-operator: #9aa3b6;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0a0c10;
  --surface: #10131a;
  --surface-2: #141822;
  --raised: #1a1f2b;
  --border: #212734;
  --border-strong: #2d3546;
  --text: #e8eaf0;
  --muted: #8d95a8;
  --faint: #5c6579;
  --accent: #ff7a59;
  --accent-hover: #ff9070;
  --accent-ink: #1a0d08;
  --accent-soft: rgba(255, 122, 89, 0.13);
  --teal: #4fd8c8;
  --teal-soft: rgba(79, 216, 200, 0.13);
  --error: #ff6f69;
  --error-soft: rgba(255, 111, 105, 0.1);
  --ok: #5fd69b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.25);
  --shadow-pop: 0 10px 34px rgba(0, 0, 0, 0.5);

  --code-bg: #0d1016;
  --gutter: #485164;
  --active-line: rgba(255, 255, 255, 0.025);
  --selection: rgba(79, 216, 200, 0.2);
  --hover-line: rgba(255, 196, 64, 0.13);
  --debug-line: rgba(79, 216, 200, 0.13);

  --tok-keyword: #c3a6ff;
  --tok-atom: #ffa46e;
  --tok-number: #74d9cc;
  --tok-string: #a5df9a;
  --tok-comment: #5c6579;
  --tok-self: #ffa46e;
  --tok-def: #86b0ff;
  --tok-prop: #e8c87d;
  --tok-operator: #9aa3b6;
  color-scheme: dark;
}

/* --- base ------------------------------------------------------------------ */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--ui);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
code, kbd, pre, .mono { font-family: var(--mono); font-feature-settings: "calt" 0, "liga" 0; }
.muted { color: var(--muted); font-weight: 400; }
.spacer { flex: 1; }

.icon { width: 16px; height: 16px; flex: none; }

/* --- buttons ---------------------------------------------------------------- */

.btn, .select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font: 500 13.5px/1 var(--ui);
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s, transform 0.08s;
}
.btn:hover:not(:disabled) { border-color: var(--faint); background: var(--raised); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.42; cursor: default; }
.btn:focus-visible, .select:focus-visible, [role="tab"]:focus-visible,
.splitter:focus-visible, input:focus-visible, .mobile-tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--raised); color: var(--text); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.icon-btn { padding: 0 8px; }
#debug:not(:disabled) .icon { color: var(--teal); }
#stop:not(:disabled) .icon { color: var(--error); }

.select {
  padding-right: 30px;
  min-width: 0;
  max-width: 260px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 14px, calc(100% - 10px) 14px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

kbd {
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  color: var(--muted);
  background: var(--surface);
}
.btn kbd { margin-left: 2px; }
.btn.primary kbd { color: var(--accent-ink); background: transparent; border-color: color-mix(in srgb, var(--accent-ink) 30%, transparent); opacity: 0.85; }
.kbd-mod::before { content: var(--mod); }
.kbd-shift::before { content: var(--shift) var(--mod); }

/* --- header ----------------------------------------------------------------- */

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.logo { display: inline-flex; align-items: center; gap: 9px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark { width: 28px; height: 28px; }
.logo-bg { fill: var(--accent); }
.logo-bar { fill: var(--accent-ink); }
.wordmark { font: 700 19px/1 var(--mono); letter-spacing: -0.03em; }
.tagline {
  margin: 0;
  padding-left: 14px;
  border-left: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 13.5px;
}
.header-spacer { flex: 1; }
.header-links { display: flex; gap: 4px; }
.header-links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 13.5px;
}
.header-links a:hover { color: var(--text); background: var(--raised); text-decoration: none; }
.header-actions { display: flex; gap: 8px; }

/* --- workbench: editor | output, with "under the hood" below ------------------ */

.workbench {
  --left: 56%;
  --bottom: 300px;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(280px, var(--left)) 8px minmax(240px, 1fr);
  grid-template-rows: minmax(160px, 1fr) 8px minmax(120px, var(--bottom));
  grid-template-areas:
    "code   vsplit output"
    "hsplit hsplit hsplit"
    "hood   hood   hood";
  padding: 10px 12px 8px;
}
.editor-panel { grid-area: code; }
.output-panel { grid-area: output; }
.hood-panel { grid-area: hood; }
.splitter-v { grid-area: vsplit; }
.splitter-h { grid-area: hsplit; }

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.panel-title {
  margin: 0 4px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.run-buttons { position: relative; display: flex; gap: 6px; }

.splitter { position: relative; border-radius: 4px; touch-action: none; }
.splitter::after {
  content: "";
  position: absolute;
  border-radius: 2px;
  background: var(--border-strong);
  opacity: 0;
  transition: opacity 0.15s, background-color 0.15s;
}
.splitter-v { cursor: col-resize; }
.splitter-v::after { left: 3px; width: 2px; top: 30%; bottom: 30%; }
.splitter-h { cursor: row-resize; }
.splitter-h::after { top: 3px; height: 2px; left: 45%; right: 45%; }
.splitter:hover::after, .splitter.dragging::after, .splitter:focus-visible::after { opacity: 1; background: var(--accent); }
body.resizing { user-select: none; }
body.resizing.resizing-v { cursor: col-resize; }
body.resizing.resizing-h { cursor: row-resize; }

/* --- editor ------------------------------------------------------------------ */

.editor { flex: 1; min-height: 0; overflow: hidden; background: var(--code-bg); }
.editor .cm-editor { height: 100%; }
.editor .cm-editor.cm-focused { outline: none; }
.editor .cm-scroller { font-feature-settings: "calt" 0, "liga" 0; }

/* --- output -------------------------------------------------------------------- */

.output-body { position: relative; flex: 1; min-height: 0; display: flex; background: var(--code-bg); }
.output {
  flex: 1;
  margin: 0;
  padding: 12px 14px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.6;
}
.output .line.fresh { animation: line-in 0.18s ease-out; }
.line.err { color: var(--error); }
.line.err a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--error) 45%, transparent); text-underline-offset: 2px; }
.output:not(:empty) + .output-empty { display: none; }

.empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 24px;
  text-align: center;
  color: var(--text);
  pointer-events: none;
}
.empty p { margin: 2px 0; max-width: 34em; }
.empty .btn { pointer-events: auto; margin-top: 12px; }
.empty-icon {
  width: 34px; height: 34px; padding: 8px;
  margin-bottom: 8px;
  border-radius: 10px;
  color: var(--accent);
  background: var(--accent-soft);
}

/* --- under the hood: tabs ------------------------------------------------------- */

.tabs { gap: 2px; padding-top: 0; padding-bottom: 0; align-items: stretch; }
.hood-title { align-self: center; margin-right: 10px; }
.tabs [role="tab"] {
  position: relative;
  border: none;
  background: transparent;
  padding: 0 12px;
  font: 550 13.5px/1 var(--ui);
  color: var(--muted);
  cursor: pointer;
}
.tabs [role="tab"]:hover { color: var(--text); }
.tabs [role="tab"][aria-selected="true"] { color: var(--text); }
.tabs [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.tab-hint { align-self: center; color: var(--faint); font-size: 12.5px; }
.tabpanel { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--code-bg); }

/* --- bytecode -------------------------------------------------------------------- */

.bytecode {
  position: relative;
  flex: 1;
  overflow: auto;
  padding: 6px 0 14px;
  column-width: 400px;
  column-gap: 0;
  column-rule: 1px solid var(--border);
}
.bytecode.stale { opacity: 0.45; transition: opacity 0.15s; }
.bc-function { break-inside: avoid-column; padding-bottom: 6px; }
.bc-function h3 {
  margin: 8px 14px 4px;
  font: 600 12px/1.4 var(--mono);
  color: var(--tok-def);
}
.bc-op {
  margin: 0;
  padding: 0 14px;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre;
  cursor: default;
  border-left: 2px solid transparent;
  transition: background-color 0.12s;
}
.bc-op:hover, .bc-op.linked { background: var(--hover-line); }
.bc-op.current { background: var(--teal-soft); border-left-color: var(--teal); color: var(--text); }

/* --- debugger ---------------------------------------------------------------------- */

.dbg { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.banner {
  margin: 10px 12px 0;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--error) 50%, transparent);
  background: var(--error-soft);
  border-radius: var(--radius-sm);
  color: var(--error);
  font-size: 13px;
}
.dbg-controls { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.btn-group { display: flex; gap: 4px; }
#dbg-play .icon, #dbg-forward .icon, #dbg-back .icon { color: var(--teal); }
.dbg-controls input[type="range"] { flex: 1; min-width: 80px; accent-color: var(--teal); }
.dbg-position {
  min-width: 15em;
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.dbg-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  padding: 0 12px 12px;
}
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.card h3 {
  margin: 0;
  padding: 7px 12px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--faint); }
.dbg-code { flex: 1; overflow: auto; padding: 4px 0; }
.dbg-code .bc-op.current { animation: op-flash 0.35s ease-out; }

/* The value stack: drawn top first (column-reverse keeps the DOM bottom-to-top). */
.stack {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 4px;
  overflow: auto;
}
.stack li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font: 12.5px/1.4 var(--mono);
  white-space: pre;
  min-width: 0;
}
.stack li.top { border-color: color-mix(in srgb, var(--teal) 55%, var(--border)); }
.stack .slot { min-width: 1.6em; color: var(--faint); font-size: 11px; text-align: right; }
.stack .value { overflow: hidden; text-overflow: ellipsis; }
.stack li.frame-start::after {
  content: attr(data-frame);
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 4px;
  font: 500 10.5px/1.5 var(--ui);
  color: var(--accent);
  background: var(--accent-soft);
}
.stack li.pushed { animation: push 0.24s cubic-bezier(.2, .8, .3, 1.2); }
.stack li.ghost { animation: pop 0.24s ease-in forwards; pointer-events: none; }
.stack li.note { border-style: dashed; background: transparent; color: var(--faint); font-family: var(--ui); }

/* Call frames: one card each, innermost on top. */
.frames {
  flex: 1;
  list-style: none;
  margin: 0;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
}
.frame-card {
  position: relative;
  padding: 7px 10px 7px 34px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  font: 12.5px/1.4 var(--mono);
  white-space: pre;
}
.frame-card::before {
  content: attr(data-depth);
  position: absolute;
  left: 8px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 5px;
  font: 600 10.5px/1 var(--ui);
  color: var(--muted);
  background: var(--raised);
}
.frame-card .frame-fn { font-weight: 600; }
.frame-card .frame-line { color: var(--muted); }
.frame-card.active { border-color: color-mix(in srgb, var(--teal) 60%, var(--border)); background: var(--teal-soft); }
.frame-card.active::before { color: var(--accent-ink); background: var(--teal); }
.frame-card.entered { animation: frame-in 0.28s cubic-bezier(.2, .8, .3, 1.15); }

.dbg-output {
  flex: 1;
  margin: 0;
  padding: 8px 12px;
  overflow: auto;
  font-size: 12.5px;
  white-space: pre-wrap;
}
.dbg-output:empty::before { content: "Nothing printed yet."; color: var(--faint); font-family: var(--ui); }

.dbg-empty { position: relative; flex: 1; }

/* --- first-visit hint ------------------------------------------------------------------ */

/* Anchored to the Debug button and centred under it, whatever its width. */
.debug-anchor { position: relative; display: inline-flex; }
.hint {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  margin-left: -140px;
  z-index: 20;
  width: 280px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--teal) 55%, var(--border));
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  font-size: 13px;
  animation: hint-in 0.35s cubic-bezier(.2, .8, .3, 1.2) 0.4s both;
}
.hint::before {
  content: "";
  position: absolute;
  top: -7px; left: calc(50% - 6px);
  width: 12px; height: 12px;
  transform: rotate(45deg);
  background: var(--surface);
  border-left: 1px solid color-mix(in srgb, var(--teal) 55%, var(--border));
  border-top: 1px solid color-mix(in srgb, var(--teal) 55%, var(--border));
}
.hint p { margin: 0 0 10px; }
.hint b { color: var(--teal); }

/* --- status bar --------------------------------------------------------------------------- */

.statusbar {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 30px;
  padding: 0 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--muted);
}
.status { display: inline-flex; align-items: center; gap: 7px; font-weight: 550; white-space: nowrap; }
.status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--faint);
}
.status[data-kind="ok"] { color: var(--ok); }
.status[data-kind="ok"]::before { background: var(--ok); }
.status[data-kind="error"] { color: var(--error); }
.status[data-kind="error"]::before { background: var(--error); }
.status[data-kind="running"] { color: var(--accent); }
.status[data-kind="running"]::before { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.stats { display: flex; flex-wrap: wrap; gap: 0; }
.stat { white-space: nowrap; }
.stat + .stat::before { content: "·"; margin: 0 8px; color: var(--faint); }
.stat b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.shortcuts { display: flex; gap: 14px; white-space: nowrap; }
.shortcuts kbd { margin-right: 4px; }

/* --- motion ------------------------------------------------------------------------------- */

@keyframes push {
  from { transform: translateY(-10px) scale(0.96); opacity: 0; background: var(--teal-soft); }
  60% { background: var(--teal-soft); }
}
@keyframes pop {
  to { transform: translateY(-10px) scale(0.96); opacity: 0; }
}
@keyframes frame-in {
  from { transform: translateX(-10px); opacity: 0; }
}
@keyframes op-flash {
  from { background: color-mix(in srgb, var(--teal) 30%, transparent); }
}
@keyframes line-in {
  from { opacity: 0; transform: translateY(2px); }
}
@keyframes hint-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
}
@keyframes pulse {
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- phones and narrow windows: one panel at a time, chosen by tabs ------------------------ */

.mobile-tabs { display: none; }

@media (max-width: 860px) {
  .app-header { gap: 10px; padding: 8px 12px; flex-wrap: wrap; }
  .tagline { display: none; }
  .header-links span, .header-actions .label { display: none; }
  .header-links a { padding: 6px 8px; }
  .header-actions .btn { padding: 0 9px; }
  .mobile-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px 0;
  }
  .mobile-tabs button {
    flex: 1;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--muted);
    font: 550 13px/1 var(--ui);
  }
  .mobile-tabs button[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
  .workbench { display: flex; flex-direction: column; padding: 8px 12px; }
  .splitter { display: none; }
  .workbench > .panel { flex: 1; }
  body[data-pane="code"] .workbench > .panel:not(.editor-panel),
  body[data-pane="output"] .workbench > .panel:not(.output-panel),
  body[data-pane="hood"] .workbench > .panel:not(.hood-panel) { display: none; }
  .panel-header { flex-wrap: wrap; }
  .editor-panel .select { flex: 1 1 100%; max-width: none; }
  .run-buttons { flex: 1; }
  .run-buttons .btn { flex: 1; justify-content: center; }
  .btn kbd, .tab-hint, .shortcuts { display: none; }
  .debug-anchor { flex: 1; }
  .debug-anchor .btn { flex: 1; }
  .dbg-controls { flex-wrap: wrap; }
  .dbg-position { min-width: 0; text-align: left; width: 100%; }
  .dbg-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: auto; }
  .dbg-code-card { grid-column: 1 / -1; max-height: 220px; }
  .bytecode { column-width: auto; }
  .statusbar { flex-wrap: wrap; gap: 4px 12px; padding: 6px 12px; }
}
