/* haxe.run playground. Same visual language as hxplus.org: the tokens below
 * match hxplus-site/assets/style.css, the dashboard sits on the same blueprint
 * grid, panels carry corner ticks, and labels are mono eyebrows. Orange is for
 * actions and whatever is live; ink is for structure. The editor itself stays
 * plain, because code reads better on a clean surface. */

:root {
  --bg: #0b0e14;
  --bg-alt: #0f131c;
  --panel: #131826;
  --panel-2: #171d2c;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e7eaf0;
  --muted: #9aa3b2;
  --faint: #6b7484;
  --accent: #ff9d2e;
  --accent-2: #ffb054;
  --accent-soft: rgba(255, 157, 46, 0.12);
  --accent-line: rgba(255, 157, 46, 0.45);
  --ink: #ff9d2e;
  --ink-soft: rgba(255, 157, 46, 0.12);
  --ink-line: rgba(255, 157, 46, 0.45);
  --green: #5fd39a;
  --red: #ff6b6b;
  --yellow: #ffcc66;
  --blue: #6fb7ff;
  --grid: rgba(255, 255, 255, 0.045);
  --tick: rgba(255, 255, 255, 0.22);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  --mono: "Cascadia Code", "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bar-h: 52px;
  color-scheme: dark;
}

:root[data-theme="light"] {
  /* Drafting paper: a white sheet ruled in faint blue, navy ink for structure. */
  --bg: #ffffff;
  --bg-alt: #f3f6fb;
  --panel: #ffffff;
  --panel-2: #f8fafd;
  --border: rgba(18, 42, 86, 0.13);
  --border-strong: rgba(18, 42, 86, 0.22);
  --text: #0e1a2e;
  --muted: #475468;
  --faint: #7d8aa0;
  --accent: #e2620a;
  --accent-2: #f07a1f;
  --accent-soft: rgba(226, 98, 10, 0.09);
  --accent-line: rgba(226, 98, 10, 0.45);
  --ink: #1d46b0;
  --ink-soft: rgba(29, 70, 176, 0.07);
  --ink-line: rgba(29, 70, 176, 0.35);
  --green: #0f8a55;
  --red: #c62828;
  --yellow: #a86800;
  --blue: #1d46b0;
  --grid: rgba(29, 70, 176, 0.055);
  --tick: rgba(29, 70, 176, 0.5);
  --shadow: 0 18px 44px rgba(14, 26, 46, 0.12);
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; overflow: hidden; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

button, select { font-family: inherit; }

::selection { background: var(--accent); color: #16100a; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Blueprint grid: fine dots in the dark theme, graph paper in the light one. */
.dashboard,
.boot-overlay {
  background-color: var(--bg);
  background-image: radial-gradient(var(--grid) 1px, transparent 1.2px);
  background-size: 28px 28px;
}

:root[data-theme="light"] .dashboard,
:root[data-theme="light"] .boot-overlay {
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
}

/* Corner ticks: registration marks at each corner of a panel, as on hxplus.org. */
@property --t {
  syntax: "<color>";
  inherits: false;
  initial-value: transparent;
}

.ticks::after {
  --t: var(--tick);
  --l: 10px;
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(var(--t) 0 0) 0 0 / var(--l) 1px,
    linear-gradient(var(--t) 0 0) 0 0 / 1px var(--l),
    linear-gradient(var(--t) 0 0) 100% 0 / var(--l) 1px,
    linear-gradient(var(--t) 0 0) 100% 0 / 1px var(--l),
    linear-gradient(var(--t) 0 0) 0 100% / var(--l) 1px,
    linear-gradient(var(--t) 0 0) 0 100% / 1px var(--l),
    linear-gradient(var(--t) 0 0) 100% 100% / var(--l) 1px,
    linear-gradient(var(--t) 0 0) 100% 100% / 1px var(--l);
  background-repeat: no-repeat;
  transition: --t 0.2s;
}

.ticks:hover::after { --t: var(--ink); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

.idx {
  color: var(--faint);
  letter-spacing: 0.04em;
  padding-right: 12px;
  border-right: 1px solid var(--border-strong);
}

/* ------------------------------------------------------------------- top bar */

.bar {
  height: var(--bar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-logo { width: 22px; height: 22px; display: block; }
.dot-run { color: var(--accent); }

.stub-badge {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px dashed rgba(255, 157, 46, 0.45);
  border-radius: 999px;
  padding: 3px 9px;
  cursor: help;
}

.project-name {
  font-size: .82rem;
  color: var(--muted);
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-name.is-saved { color: var(--text); }
.project-name.is-saved::before { content: "\1F4BE\00a0 "; }

.bar-spacer { flex: 1; }

.hidden { display: none !important; }

/* --------------------------------------------------------- compiler status */

.compiler-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .72rem;
  font-family: var(--mono);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

.status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}

.status-booting .status-dot { background: var(--accent); animation: pulse 1s ease-in-out infinite; }
.status-booting { color: var(--accent); border-color: rgba(255,157,46,.4); }
.status-ready .status-dot { background: var(--green); }
.status-error .status-dot { background: var(--red); }
.status-error { color: var(--red); border-color: rgba(255,107,107,.4); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* --------------------------------------------------------------- boot overlay */

.boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .3s;
}

.boot-overlay.gone { opacity: 0; pointer-events: none; }

.boot-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(380px, calc(100vw - 32px));
  padding: 34px 28px 28px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.boot-logo { width: 52px; height: 52px; margin-bottom: 20px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.boot-error .boot-logo { animation: none; opacity: .5; }

.boot-title {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 8px;
}
.boot-sub { color: var(--muted); font-size: .88rem; margin-bottom: 18px; }

.boot-track {
  width: 240px; height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.boot-bar { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .2s; }

.boot-track.indeterminate .boot-bar {
  width: 34% !important;
  animation: slide 1.1s ease-in-out infinite;
}

@keyframes slide {
  0% { margin-left: -34%; } 100% { margin-left: 100%; }
}

.boot-hint { color: var(--muted); font-size: .78rem; font-family: var(--mono); }
.boot-error .boot-hint { color: var(--red); }
.boot-retry { margin-top: 18px; }

.btn-danger { color: var(--red); padding: 7px 10px; }
.btn-danger:hover { border-color: var(--red); }

/* --------------------------------------------------------- options popover */

.options-wrap { position: relative; }

.options-btn-dot { color: var(--accent); }

#optionsBtn.has-changes { border-color: var(--accent); color: var(--accent); }

.options-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  width: 310px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.opt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: .84rem;
}

.opt-col { flex-direction: column; align-items: stretch; gap: 6px; }

.opt-row label { color: var(--muted); }

.control-sm { padding: 4px 8px; font-size: .8rem; }

.opt-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .84rem;
  color: var(--muted);
  cursor: pointer;
}

.opt-check code {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--ink);
}

.opt-defines {
  width: 100%;
  min-height: 62px;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 8px;
  font-family: var(--mono);
  font-size: .78rem;
}

.opt-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.opt-libs { color: var(--muted); font-size: .8rem; }
.opt-libs code { font-family: var(--mono); font-size: .76rem; color: var(--ink); }

.opt-summary {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------- file tabs */

.file-bar {
  flex: none;
  display: flex;
  align-items: stretch;
  height: 34px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.file-tabs { display: flex; align-items: stretch; overflow-x: auto; }

.file-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px 0 13px;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}

.file-tab:hover { color: var(--text); }

.file-tab.active {
  color: var(--text);
  background: var(--bg);
  border-bottom-color: var(--ink);
}

.entry-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.file-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: .62rem;
  padding: 2px 3px;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
}

.file-tab:hover .file-close { opacity: 1; }
.file-close:hover { background: var(--accent-soft); color: var(--accent); }

.file-add {
  flex: none;
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--muted);
  font-size: 1rem;
  width: 32px;
  cursor: pointer;
}

.file-add:hover { color: var(--ink); background: var(--ink-soft); }

.file-bar .pane-meta { margin-left: auto; padding: 0 12px; align-self: center; }

.control {
  height: 34px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* The sample picker is the one bar item allowed to give up width, so the
   buttons never get squeezed into wrapping. */
.bar .control { flex: 0 1 auto; min-width: 90px; }

.btn {
  /* Fixed height and centred content: labels differ (some have an icon glyph,
     some are two words) and content-driven sizing made them disagree. Notably
     "▶ Run" is the only label containing a space, so it used to wrap to two
     lines and double in height when the bar got tight. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  flex: none;
  white-space: nowrap;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 14px;
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color .14s, background .14s, opacity .14s, box-shadow .14s;
}

.btn:hover { border-color: var(--muted); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #16100a;
  box-shadow: 0 8px 22px rgba(255, 157, 46, 0.22);
}

:root[data-theme="light"] .btn-primary { color: #fff; box-shadow: 0 8px 20px rgba(226, 98, 10, 0.2); }

.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-primary:disabled { opacity: .4; cursor: default; background: var(--accent); box-shadow: none; }

/* Docs is a link, not an action: same geometry, quieter weight. */
.btn-docs {
  text-decoration: none;
  font-weight: 500;
  color: var(--muted);
}

.btn-docs:hover { color: var(--text); }

.btn-icon { font-size: .74rem; line-height: 1; }
.btn-icon-only { padding: 0 10px; }
.btn-tiny { height: 24px; padding: 0 9px; font-size: .74rem; font-weight: 500; }

.tt-moon { display: none; }
:root[data-theme="light"] .tt-sun { display: none; }
:root[data-theme="light"] .tt-moon { display: inline; }

/* ------------------------------------------------------------------ popover */

.popover {
  position: fixed;
  z-index: 300;
  min-width: 244px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}

.popover-label {
  font-size: .82rem;
  color: var(--muted);
}

.popover-input {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  font-family: var(--mono);
  font-size: .84rem;
}

.popover-input:focus {
  outline: none;
  border-color: var(--accent);
}

.popover-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.btn-danger-solid {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.btn-danger-solid:hover { filter: brightness(1.08); }

/* ----------------------------------------------------------------- dashboard */

.dashboard {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

body.in-editor .dashboard { display: none; }
body:not(.in-editor) .workspace { display: none; }

/* Toolbar controls that only make sense with a file open. */
body:not(.in-editor) #saveBtn,
body:not(.in-editor) #deleteBtn,
body:not(.in-editor) #runBtn,
body:not(.in-editor) #shareBtn,
body:not(.in-editor) .options-wrap,
body:not(.in-editor) #projectName,
body:not(.in-editor) #backBtn { display: none; }
body:not(.in-editor) #paneSwitch { display: none; }

/* On the gallery the cards do the picker's job. */
body:not(.in-editor) #picker { display: none; }

.dash-inner { max-width: 1080px; margin: 0 auto; padding: 52px 28px 72px; }

.dash-head { margin-bottom: 44px; }

.dash-head .eyebrow { margin-bottom: 14px; }

.dash-head h1 {
  font-size: clamp(1.9rem, 3.8vw, 2.7rem);
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: 14px;
}

.dash-head p {
  color: var(--muted);
  max-width: 48em;
  font-size: 1rem;
}

.dash-section { margin-bottom: 42px; }

.dash-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.dash-section-head h2 { font-size: 0.74rem; }

.dash-hint { font-size: .78rem; color: var(--faint); }

.dash-head .dash-note p { font-size: .9rem; color: var(--text); max-width: none; }
.dash-head .dash-note .dash-note-detail { margin-top: 6px; color: var(--muted); font-family: var(--mono); font-size: .74rem; }
.dash-note-detail:empty { display: none; }
.dash-note-actions { display: flex; justify-content: flex-end; margin-top: 8px; }

.link-btn {
  background: none;
  border: none;
  padding: 0;
  font: 600 .84rem var(--font);
  color: var(--ink);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-btn:hover { color: var(--accent); }

.dash-note {
  margin-top: 18px;
  max-width: 48em;
  padding: 12px 16px;
  font-size: .9rem;
  color: var(--text);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: 8px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-align: left;
  gap: 9px;
  padding: 20px;
  min-height: 156px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color .15s, transform .15s, background .15s;
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.card-accent {
  width: 26px; height: 3px;
  border-radius: 2px;
  background: var(--accent);
  margin-bottom: 3px;
}

.card-accent.green { background: var(--green); }
.card-accent.blue  { background: var(--blue); }
.card-accent.red   { background: var(--red); }
.card-accent.amber { background: var(--accent); }

.card-title { font-size: 1.02rem; font-weight: 600; }

.card-desc {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
  flex: 1;
}

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.card-tag {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--ink);
  background: var(--ink-soft);
  border-radius: 5px;
  padding: 2px 8px;
}

.card-del {
  position: absolute;
  top: 12px; right: 12px;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: none; border-radius: 6px;
  color: var(--muted); font-size: .72rem; cursor: pointer;
  opacity: 0; transition: opacity .15s, color .15s, background .15s;
}

.card:hover .card-del { opacity: 1; }
.card-del:hover { color: var(--red); background: rgba(255,107,107,.12); }

.card-new {
  align-items: flex-start;
  justify-content: center;
  border-style: dashed;
  border-color: var(--border-strong);
  background: transparent;
}

.card-new .card-title { color: var(--accent); }

@media (max-width: 640px) {
  .dash-inner { padding: 34px 18px 56px; }
  .card-grid { grid-template-columns: 1fr; }
}

/* ----------------------------------------------------------------- workspace */

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 50% 6px 1fr;
}

.pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.pane-output { border-left: 1px solid var(--border); }

.pane-head, .pane-foot {
  flex: none;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
}

.pane-foot { border-bottom: none; border-top: 1px solid var(--border); }

.pane-title {
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 600;
}

.pane-meta {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  margin-left: auto;
}

.pane-meta.status-compiling { color: var(--accent); }
.pane-meta.status-edited { color: var(--accent); }
.pane-meta.status-ok { color: var(--green); }
.pane-meta.status-errors { color: var(--red); }

.pane-meta-right { margin-left: auto; }

.editor-host { flex: 1; min-height: 0; }

.fallback-editor {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 14px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  tab-size: 4;
}

.splitter {
  background: var(--border);
  cursor: col-resize;
}

.splitter:hover { background: var(--ink); }

/* ----------------------------------------------------------------- problems */

.problems {
  flex: none;
  max-height: 168px;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}

.problems-head {
  flex: none;
  padding: 7px 12px;
  font-size: .74rem;
  font-family: var(--mono);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.problems-head .has-errors { color: var(--red); }
.problems-head .has-warnings { color: var(--yellow); }

.problems-list { list-style: none; overflow-y: auto; }

.problem {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 6px 12px;
  font-size: .8rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.problem:hover { background: var(--ink-soft); }
.problem-error .problem-sev { color: var(--red); }
.problem-warning .problem-sev { color: var(--yellow); }
.problem-sev { font-size: .74rem; }
.problem-msg { flex: 1; }
.problem-loc { font-family: var(--mono); font-size: .72rem; color: var(--muted); }

/* --------------------------------------------------------------------- tabs */

.tabs {
  flex: none;
  display: flex;
  align-items: stretch;
  height: 34px;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .74rem;
  font-weight: 600;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
  background: var(--bg);
}

.tab-spacer { flex: 1; border-right: none; }
.tab-console { border-left: 1px solid var(--border); border-right: none; }

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

.output-host { flex: 1; min-height: 0; position: relative; }

.output-code {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre;
  color: var(--text);
}

.output-code.dimmed { display: none; }

.console {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.console.hidden { display: none; }

.console-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
}

.console-lines {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
}

.console-line { white-space: pre-wrap; word-break: break-word; }
.console-error { color: var(--red); }
.console-warn { color: var(--yellow); }
.console-meta { color: var(--muted); font-style: italic; margin-top: 8px; }

.console-meta-inline {
  margin-left: auto;
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-info  { color: var(--muted); }
.log-trace { color: var(--muted); opacity: .72; }
.log-warn  { color: var(--yellow); }
.log-error { color: var(--red); }

/* ------------------------------------------------------------ render stage */

.preview {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.preview.hidden { display: none; }

.preview-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
}

.preview-meta { margin-left: auto; }
.preview-meta code { color: var(--ink); }

.preview-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 12px;
  background:
    linear-gradient(45deg, rgba(127,127,127,.07) 25%, transparent 25%, transparent 75%, rgba(127,127,127,.07) 75%),
    linear-gradient(45deg, rgba(127,127,127,.07) 25%, transparent 25%, transparent 75%, rgba(127,127,127,.07) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
}

.stage {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0b0e14;
}

.sandbox { display: none; }

/* -------------------------------------------------------------------- toast */

.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 18px;
  font-size: .86rem;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s, transform .18s;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* --------------------------------------------------------------- responsive */

.pane-switch { display: none; }

@media (max-width: 820px) {
  /* Phones: the bar wraps onto a second row instead of running off the screen,
     and the workspace shows the code or the output, not both. */
  .bar {
    height: auto;
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 8px 10px;
  }
  #compilerStatusText { display: none; }
  .compiler-status { padding: 4px 6px; }
  .bar .control { max-width: 46vw; }
  .pane-switch {
    display: inline-flex;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    overflow: hidden;
  }
  .pane-switch button {
    height: 30px;
    padding: 0 12px;
    background: none;
    border: none;
    color: var(--muted);
    font: 600 .8rem var(--font);
    cursor: pointer;
  }
  .pane-switch button.active { background: var(--ink-soft); color: var(--ink); }
  .workspace { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .splitter { display: none; }
  body:not(.show-output) .pane-output { display: none; }
  body.show-output .pane-editor { display: none; }
  .pane-output { border-left: none; }
  .stub-badge { display: none; }
  .brand span { display: none; }
  /* The bar sheds its lowest-priority item first; docs stay at /AGENTS.md. */
  .btn-docs { display: none; }
}
