/* ─────────────────────────────────────────────────────────────────────────
   tigr playground — style-only design.
   Visual layer for the playground. The runtime glue (app.js, worker.js)
   owns behavior and binds to the ids documented in DESIGN_CONTRACT.md;
   this file styles those hooks and nothing else.
   ───────────────────────────────────────────────────────────────────────── */

:root {
  /* foreground / background — warm-neutral whites and inks */
  --bg:        oklch(0.985 0.006 80);
  --bg-elev:   oklch(0.97  0.008 80);
  --bg-sunk:   oklch(0.955 0.010 78);
  --line:      oklch(0.89  0.012 75);
  --line-soft: oklch(0.93  0.010 75);
  --ink:       oklch(0.22  0.018 65);
  --ink-2:     oklch(0.42  0.018 70);
  --ink-3:     oklch(0.58  0.016 72);
  --ink-4:     oklch(0.72  0.012 72);

  --accent:      #d39148;
  --accent-ink:  oklch(0.45 0.14 60);
  --accent-wash: color-mix(in oklch, var(--accent) 14%, var(--bg));
  --accent-line: color-mix(in oklch, var(--accent) 35%, var(--line));

  --ok:    oklch(0.52 0.13 145);
  --err:   oklch(0.50 0.16 25);
  --warn:  oklch(0.62 0.14 70);

  --font-sans: 'IBM Plex Sans', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', ui-monospace, Menlo, monospace;

  --r-sm: 4px;
  --r:    8px;
  --r-lg: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        oklch(0.18  0.012 75);
    --bg-elev:   oklch(0.21  0.014 75);
    --bg-sunk:   oklch(0.155 0.012 75);
    --line:      oklch(0.32  0.014 75);
    --line-soft: oklch(0.26  0.012 75);
    --ink:       oklch(0.94  0.012 80);
    --ink-2:     oklch(0.78  0.012 80);
    --ink-3:     oklch(0.62  0.012 80);
    --ink-4:     oklch(0.48  0.012 80);

    --accent-wash: color-mix(in oklch, var(--accent) 18%, var(--bg));
    --accent-line: color-mix(in oklch, var(--accent) 40%, var(--line));

    --ok:  oklch(0.78 0.13 145);
    --err: oklch(0.78 0.14 25);
  }
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-ligatures: none;
}

button, select, input, textarea {
  font: inherit;
  color: inherit;
}

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  color: var(--ink-2);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ─── App shell ────────────────────────────────────────────────────────── */

.app {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--bg);
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}

/* Logomark — lowercase wordmark + version pill */
.logomark {
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.logomark .wordmark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.logomark .version {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-left: 4px;
}

/* ─── Tabs (#tab-editor / #tab-repl) ───────────────────────────────────── */

.tabs {
  justify-self: center;
  display: inline-flex;
  background: var(--bg-sunk);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.tab {
  appearance: none;
  font: 500 13px var(--font-sans);
  color: var(--ink-2);
  background: transparent;
  border: 0;
  padding: 6px 16px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: color 120ms ease, background 120ms ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  background: var(--bg-elev);
  color: var(--ink);
  box-shadow: 0 1px 2px oklch(0 0 0 / .04), 0 1px 0 var(--line);
}
.tab-glyph {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  opacity: .9;
}

/* ─── Status (#status) ─────────────────────────────────────────────────── */

.topbar-right {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--ink-3);
  font-size: 12px;
}

/* Header links — Docs and the GitHub repo. */
.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 500 13px var(--font-sans);
  color: var(--ink-2);
  text-decoration: none;
  white-space: nowrap;
  transition: color 120ms ease;
}
.topbar-link:hover { color: var(--ink); }
.topbar-link .gh-icon {
  width: 15px;
  height: 15px;
  fill: currentColor;
}
.topbar-link .link-arrow {
  width: 9px;
  height: 9px;
  color: var(--ink-4);
  transition: color 120ms ease;
}
.topbar-link:hover .link-arrow { color: var(--accent); }
.topbar-divider {
  width: 1px;
  height: 16px;
  background: var(--line);
}
.topbar-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  letter-spacing: 0.02em;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ok) 25%, transparent);
}
/* The glue updates #status's textContent to "running…" / "ready" /
   "stopped — session reset". Status-dot color tracks via :has(). */
.topbar-right:has(#status:not(:empty))[data-state="running"] .status-dot,
#status:where([data-state="running"]) ~ .status-dot { background: var(--warn); }

/* ─── Stage / panels ──────────────────────────────────────────────────── */

.stage {
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Both panels always exist in the DOM; the glue toggles .is-active on the
   selected one. */
.panel {
  display: none;
  height: 100%;
  min-height: 0;
}
.panel.is-active {
  display: grid;
}
.panel-editor.is-active {
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr;
}
.panel-repl.is-active {
  grid-template-rows: 1fr;
}

.editor-column {
  display: grid;
  grid-template-rows: 1.45fr 6px 1fr;
  min-height: 0;
  border-left: 1px solid var(--line);
}

/* ─── Sidebar (#editor-examples lives here as a list-style <select>) ───── */

/* Toggle: a hidden checkbox watched by :has() — flips the sidebar between
   expanded (~240px) and a collapsed rail (~44px). Pure CSS, no scripts. */
.sidebar-toggle-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0; height: 0;
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr;
  width: 240px;
  background: var(--bg-elev);
  overflow: hidden;
  transition: width 220ms cubic-bezier(.4, .0, .2, 1);
  position: relative;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
}
.sidebar-header-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
}
.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.sidebar-toggle:hover {
  background: var(--bg-sunk);
  color: var(--ink);
}
.sidebar-toggle-icon {
  width: 12px;
  height: 12px;
  transition: transform 220ms cubic-bezier(.4, .0, .2, 1);
}

/* The expand control lives in the editor pane bar (.editor-expand);
   it is hidden until the sidebar is collapsed. */
.editor-expand { display: none; }

/* Collapsed state — applied to the whole panel via :has(). The sidebar
   shrinks to zero width; the pane-bar expand chevron takes over. */
.panel-editor:has(#sidebar-toggle:checked) .sidebar { width: 0; }
.panel-editor:has(#sidebar-toggle:checked) .editor-expand {
  display: inline-flex;
}

/* ─── Examples list (proper navigation list) ──────────────────────────── */

.examples-list {
  margin: 0;
  padding: 8px 0 14px;
  overflow-y: auto;
  min-height: 0;
}

.examples-group + .examples-group { margin-top: 6px; }

.examples-group-label {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 18px 4px;
}

.examples-group-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.example-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  appearance: none;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 5px 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
  white-space: nowrap;
}
.example-item:hover {
  background: var(--bg-sunk);
  color: var(--ink);
}
.example-item.is-active {
  background: var(--accent-wash);
  color: var(--ink);
  font-weight: 500;
}
.example-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 5px;
  bottom: 5px;
  width: 2px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.example-icon {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-4);
  background: var(--bg-sunk);
  padding: 1px 4px;
  border-radius: 3px;
  border: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.example-item.is-active .example-icon {
  color: var(--accent);
  border-color: var(--accent-line);
  background: color-mix(in oklch, var(--accent) 8%, var(--bg));
}

/* The "Yours" group holds the single persistent scratch slot, pinned
   above the bundled examples and fenced off by a divider. */
.examples-group-yours {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

/* A dashed icon marks the scratch slot as a different kind of thing —
   a sandbox, not a read-only example — without needing a new control. */
.example-item-scratch .example-icon { border-style: dashed; }

/* "auto-saved" hint, pushed to the row's trailing edge. */
.example-meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-4);
  flex-shrink: 0;
}
.example-item:hover .example-meta { color: var(--ink-3); }
.example-item.is-active .example-meta { color: var(--accent); }

/* ─── Panes (editor + output) ─────────────────────────────────────────── */

.pane {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 0;
  border-bottom: 1px solid var(--line);
}
.pane:last-child { border-bottom: 0; }
.pane-output { background: var(--bg-sunk); }

/* Draggable divider between the editor and output panes (see app.js).
   The editor pane drops its own border — the splitter is the divider. */
.pane-editor { border-bottom: 0; }
.pane-splitter {
  height: 6px;
  cursor: row-resize;
  touch-action: none;
  background: var(--bg-elev);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.pane-splitter:hover,
.pane-splitter.is-dragging {
  background: var(--accent-wash);
  border-color: var(--accent-line);
}

.pane-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  gap: 12px;
}
.pane-bar-sub { background: var(--bg-sunk); }
.pane-bar-left, .pane-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pane-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}
.pane-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
}

/* ─── File picker (wraps #editor-examples) ────────────────────────────── */

.file-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 28px 4px 10px;
  background: var(--bg-sunk);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.file-picker:hover { border-color: var(--line); }
.file-picker:focus-within {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.file-picker-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  flex-shrink: 0;
}
.file-picker-chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-size: 10px;
  pointer-events: none;
}
.examples-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0 8px 0 0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  /* hide the chevron the browser draws */
  background-image: none;
}

/* ─── Buttons ─────────────────────────────────────────────────────────── */

.btn {
  appearance: none;
  font: 500 13px var(--font-sans);
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 60ms ease;
}
.btn:hover { background: var(--bg-sunk); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}
.btn-ghost:hover { background: var(--bg-sunk); color: var(--ink); }
.btn-small { height: 26px; padding: 0 10px; font-size: 12px; }
.btn-primary {
  background: var(--accent);
  border-color: color-mix(in oklch, var(--accent) 65%, black 12%);
  color: oklch(0.18 0.04 60);
  font-weight: 600;
  box-shadow:
    0 1px 0 color-mix(in oklch, var(--accent) 60%, black 25%) inset,
    0 0 0 1px color-mix(in oklch, var(--accent) 50%, transparent);
}
.btn-primary:hover {
  background: color-mix(in oklch, var(--accent) 92%, black 5%);
}
.btn-icon { font-size: 9px; opacity: .85; }
.btn-kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  background: color-mix(in oklch, var(--accent) 75%, black 10%);
  color: oklch(0.96 0.02 60);
  border: 0;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 2px;
}

/* ─── Editor (#editor — plain textarea) ───────────────────────────────── */

.editor-wrap {
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  background-image:
    linear-gradient(to right, var(--line-soft) 0, var(--line-soft) 1px, transparent 1px);
  background-size: 54px 100%;
  background-repeat: no-repeat;
}
.editor-textarea {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 14px 16px 14px 70px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
  overflow: auto;
  caret-color: var(--accent);
}
.editor-textarea::selection {
  background: color-mix(in oklch, var(--accent) 28%, transparent);
}
.editor-textarea::placeholder {
  color: var(--ink-4);
}

/* ─── Editor output (#editor-output) ──────────────────────────────────── */

.output-scroll {
  overflow: auto;
  padding: 14px 18px;
  min-height: 0;
}

/* ─── Exit pill (decorative) ──────────────────────────────────────────── */

.exit-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--ok);
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--ok) 14%, var(--bg));
  border: 1px solid color-mix(in oklch, var(--ok) 30%, var(--line));
}
/* `display: inline-flex` above outranks the UA [hidden] rule — restore
   it so the pill stays hidden until the first run sets it. */
.exit-pill[hidden] { display: none; }
/* Error run — glue toggles .is-error; the dot inherits via currentColor. */
.exit-pill.is-error {
  color: var(--err);
  background: color-mix(in oklch, var(--err) 14%, var(--bg));
  border-color: color-mix(in oklch, var(--err) 30%, var(--line));
}
.exit-pill-dot {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: currentColor;
}

/* ─── Entries (.entry, populated by glue in both panels) ──────────────── */

.entry {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.entry + .entry {
  border-top: 1px dashed var(--line-soft);
  margin-top: 4px;
  padding-top: 10px;
}

.entry-input {
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
}
.entry-input::first-letter {
  /* the prompt prefix (e.g. "tigr>") tends to be the first run of chars;
     can't reliably style it without markup support, so leave it alone */
}

.entry-output {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink);
  padding-left: 14px;
  border-left: 2px solid var(--line);
}

.entry-value {
  color: var(--accent-ink);
  font-weight: 500;
  padding-left: 14px;
  position: relative;
}
.entry-value::before {
  content: "=";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 600;
}

.entry-error {
  margin: 0;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--err);
  padding: 8px 12px;
  background: color-mix(in oklch, var(--err) 8%, var(--bg));
  border: 1px solid color-mix(in oklch, var(--err) 25%, var(--line));
  border-radius: var(--r-sm);
}

/* ─── REPL (#panel-repl) ──────────────────────────────────────────────── */

.repl {
  display: grid;
  grid-template-rows: 1fr auto auto;
  height: 100%;
  min-height: 0;
  background: var(--bg-sunk);
}

.repl-scrollback {
  overflow: auto;
  padding: 22px 28px 8px;
}
.repl-scrollback > .entry,
.repl-scrollback > .repl-banner {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
}

.repl-banner {
  font-family: var(--font-mono);
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line-soft);
  margin-bottom: 8px;
}
.repl-banner-title {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}
.repl-banner-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 4px;
  font-family: var(--font-sans);
}
.repl-banner-sub kbd { font-size: 10.5px; padding: 0 4px; }

/* Active prompt row */
.repl-active {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 28px 12px;
  max-width: 100%;
  background: var(--bg-sunk);
  border-top: 1px solid var(--line-soft);
}
.repl-active > * { max-width: 920px; }
.repl-prompt {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--accent);
  padding-top: 4px;
  user-select: none;
  letter-spacing: 0;
}
.repl-input {
  width: 100%;
  min-height: 26px;
  max-height: 240px;
  margin: 0;
  padding: 4px 0;
  background: transparent;
  border: 0;
  outline: none;
  resize: none;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--ink);
  caret-color: var(--accent);
  overflow-y: auto;
}
.repl-input::selection {
  background: color-mix(in oklch, var(--accent) 28%, transparent);
}
.repl-input::placeholder { color: var(--ink-4); }

/* Hint row + reset */
.repl-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 28px;
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  font-size: 12px;
  color: var(--ink-3);
}
.repl-hint-left {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.repl-hint-left kbd { margin-right: 2px; }

/* ─── Entry tweaks specifically inside the REPL ───────────────────────── */

.repl-scrollback .entry-input {
  /* The glue prefixes echoed source with the prompt — match the prompt
     color by tinting the first three chars via a leading pseudo. Since
     we can't target inside textContent, the prompt blends as plain ink. */
}

/* ─── Focus rings (style-only feedback) ───────────────────────────────── */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: var(--r-sm);
}
.btn:focus-visible,
.tab:focus-visible {
  outline-offset: 2px;
}
.editor-textarea:focus-visible,
.repl-input:focus-visible {
  outline: none;
}

/* ─── Scrollbars ──────────────────────────────────────────────────────── */

.output-scroll::-webkit-scrollbar,
.repl-scrollback::-webkit-scrollbar,
.editor-textarea::-webkit-scrollbar,
.repl-input::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.output-scroll::-webkit-scrollbar-thumb,
.repl-scrollback::-webkit-scrollbar-thumb,
.editor-textarea::-webkit-scrollbar-thumb,
.repl-input::-webkit-scrollbar-thumb {
  background: color-mix(in oklch, var(--ink-4) 35%, transparent);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.output-scroll::-webkit-scrollbar-thumb:hover,
.repl-scrollback::-webkit-scrollbar-thumb:hover,
.editor-textarea::-webkit-scrollbar-thumb:hover,
.repl-input::-webkit-scrollbar-thumb:hover {
  background: color-mix(in oklch, var(--ink-3) 55%, transparent);
  background-clip: padding-box;
}

/* ─── Narrow viewport ─────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .topbar { grid-template-columns: auto 1fr auto; padding: 0 12px; gap: 8px; }
  .logomark .version { display: none; }
  .editor-textarea { padding-left: 56px; }
  .editor-wrap { background-size: 44px 100%; }
  .pane-bar { padding: 0 10px; height: 38px; }
  .repl-scrollback, .repl-active, .repl-hint { padding-left: 16px; padding-right: 16px; }
  .btn-kbd { display: none; }

  /* Lock the page so iOS can't scroll the whole document off-screen
     when an input is focused. */
  body { position: fixed; inset: 0; width: 100%; }

  /* Reclaim topbar width — the status reads "ready" the vast majority
     of the time and is not worth the space on a phone. */
  .topbar-status, .topbar-divider { display: none; }

  /* REPL only: shrink to the visual viewport (kept current by app.js)
     so the input row rides above the on-screen keyboard. The playground
     stays full height — the keyboard simply overlays its output pane. */
  body[data-tab="repl"] .app { height: var(--vvh, 100dvh); }

  /* Editor column spans the full width; the sidebar overlays it rather
     than stealing a grid column. */
  .panel-editor.is-active { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(240px, 78vw);
  }

  /* A 6px splitter is too thin to grab with a finger. */
  .editor-column { grid-template-rows: 1.45fr 16px 1fr; }
  .pane-splitter { height: 16px; }

  /* 16px input text stops iOS Safari auto-zooming on focus. */
  .repl-input { font-size: 16px; }
}
