/* E++ IDE — clean, dark, editor-first theme. */
:root {
  --bg: #0b1120;
  --panel: #111a2e;
  --panel-2: #0f172a;
  --panel-3: #16213c;
  --border: #22304f;
  --text: #e2e8f0;
  --muted: #8ea0bd;
  --accent: #34d399;
  --accent-2: #a78bfa;
  --danger: #f87171;
  --warning: #fbbf24;
  --mono: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 14px;
}

* { box-sizing: border-box; }
/* `hidden` must always win — the IDE toggles panels with it on small screens. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 500px at 80% -10%, rgba(167, 139, 250, .14), transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
button, input, textarea { font: inherit; }
code, kbd { font-family: var(--mono); }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 20px; border-bottom: 1px solid var(--border);
  background: rgba(11, 17, 32, .9); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo {
  font-family: var(--mono); font-weight: 800; font-size: 26px; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06131f; border-radius: 12px; padding: 10px 12px; letter-spacing: -1px;
  box-shadow: 0 8px 24px rgba(52, 211, 153, .25);
}
.logo span { font-size: 18px; vertical-align: top; }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .2px; }
.build-badge {
  font-family: var(--mono); font-size: 10px; font-weight: 700; vertical-align: middle;
  color: var(--accent); background: rgba(52, 211, 153, .12);
  border: 1px solid rgba(52, 211, 153, .45); border-radius: 999px; padding: 2px 7px;
  white-space: nowrap;
}
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.save-status { color: var(--muted); font-size: 12.5px; margin-right: 4px; }
.save-status.dirty { color: var(--warning); }
.action-group { display: flex; align-items: center; gap: 6px; }
/* One wrapper for everything except Run: transparent on a wide screen, the
   scrolling action row on a phone. */
.action-bar { display: contents; }
.run-actions { margin-left: 4px; }
.action-divider {
  width: 1px; align-self: stretch; margin: 2px 2px;
  background: linear-gradient(180deg, transparent, var(--border) 20%, var(--border) 80%, transparent);
}
.btn-suggest {
  background: linear-gradient(135deg, #f59e0b, #ea580c);
  border-color: rgba(251, 191, 36, .45);
  color: #1f1300;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(245, 158, 11, .18);
}

/* Small-screen panel switcher — only visible in the mobile layout below. */
.mobile-view-nav { display: none; }
.mobile-badge {
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--panel-3); border: 1px solid var(--border); color: var(--text);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.mobile-badge-alert { background: var(--danger); border-color: var(--danger); color: #fff; }
.mobile-badge[hidden] { display: none !important; }

.btn {
  appearance: none; border: 1px solid var(--border); background: var(--panel-3);
  color: var(--text); border-radius: 10px; padding: 8px 14px; cursor: pointer;
  font-size: 13.5px; font-weight: 600; transition: filter .15s, transform .05s, opacity .15s;
}
.btn:hover:not(:disabled) { filter: brightness(1.2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-small { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn-accent { background: linear-gradient(135deg, #0ea371, #059669); border-color: #34d39955; color: #04150e; }
.btn-run { background: linear-gradient(135deg, var(--accent), #22c55e); border-color: #34d39966; color: #04150e; font-size: 14px; padding: 9px 20px; }
.btn-danger { background: #7f1d1d; border-color: #f8717155; }
.btn-danger-outline { color: var(--danger); }
.btn-zip {
  background: linear-gradient(135deg, #059669, #0d9488);
  border-color: rgba(52, 211, 153, 0.5);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.2);
}
.btn-tutorial {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: rgba(167, 139, 250, 0.5);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.2);
}

/* ---------- dashboard stats banner (Requirement 10) ---------- */
.dash-banner {
  display: flex; align-items: center; gap: 8px 0; flex-wrap: wrap;
  padding: 6px 20px 7px; background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--border); font-size: 12px;
}
.dash-group { display: flex; align-items: center; gap: 14px; padding: 0 14px; }
.dash-group:first-child { padding-left: 0; }
.dash-group + .dash-group { border-left: 1px solid var(--border); }
.dash-group-end { margin-left: auto; padding-right: 0; align-items: center; }
.dash-stat { display: flex; align-items: center; gap: 6px; }
.dash-label { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.dash-rules {
  flex: 1 1 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding-top: 5px; margin-top: 5px; border-top: 1px dashed rgba(148, 163, 184, .16);
  font-size: 11px; color: #64748b;
}
.dash-rules span + span::before { content: '·'; margin-right: 10px; color: #334155; }
.dash-rules-label {
  text-transform: uppercase; letter-spacing: .1em; font-size: 9.5px; font-weight: 800; color: #475569;
}
.dash-rules-label::before { content: none !important; }
.dash-val { font-family: var(--mono); color: var(--text); font-weight: 600; font-size: 12px; }
.dash-badge-pill {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; display: inline-block;
}
.badge-eppl { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.4); }
.badge-eppla { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.4); }
.badge-version { background: rgba(52, 211, 153, 0.12); color: var(--accent); border: 1px solid rgba(52, 211, 153, 0.4); }
.dash-stat-build { margin-left: auto; }

/* ---------- layout ---------- */
.layout {
  flex: 1; display: grid; grid-template-columns: 290px minmax(0, 1fr);
  gap: 16px; padding: 16px 20px; max-width: 1600px; width: 100%; margin: 0 auto;
  min-height: 0; min-width: 0;
}

/* ---------- sidebar ---------- */
.sidebar { display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto; padding-right: 2px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.sidebar h2, .libraries-panel h2, .help-panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0; }
.file-search {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 8px 12px; width: 100%; outline: none;
}
.file-search:focus { border-color: var(--accent); }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-row { display: flex; align-items: center; gap: 4px; position: relative; }
.file-row .file-item { flex: 1; min-width: 0; }
.btn-file-delete {
  background: transparent; border: 1px solid transparent; color: #64748b;
  font-size: 18px; line-height: 1; width: 28px; height: 32px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: all .15s ease; flex-shrink: 0;
}
.btn-file-delete:hover {
  color: var(--danger); background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
}
.file-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 9px 11px; cursor: pointer;
}
.file-item:hover { border-color: var(--accent); }
.file-item.active { background: linear-gradient(135deg, rgba(52,211,153,.16), rgba(167,139,250,.14)); border-color: var(--accent); }
.file-item .file-icon { font-family: var(--mono); font-size: 10px; font-weight: 700; background: var(--panel-3); border: 1px solid var(--border); border-radius: 6px; padding: 3px 5px; color: var(--accent); }
.file-icon-eppla {
  background: rgba(168, 85, 247, 0.2) !important;
  color: #c084fc !important;
  border-color: rgba(168, 85, 247, 0.5) !important;
}
.head-sub {
  font-size: 11px; color: var(--accent-2); font-family: var(--mono); text-transform: none; letter-spacing: 0;
}
.file-item .file-name { font-family: var(--mono); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.file-item .file-date { color: var(--muted); font-size: 11px; white-space: nowrap; }
.no-files { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0; }
.sidebar-actions { display: flex; }
.libraries-panel, .help-panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
}
.panel-note { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.panel-note code { color: var(--accent); }
.library-card { border-top: 1px solid var(--border); padding: 10px 0 2px; }
.library-card:first-of-type { border-top: none; }
.lib-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.lib-insert-btn { font-size: 11px; padding: 2px 8px; font-weight: 600; flex-shrink: 0; }
.library-card h3 { margin: 0; font-size: 14px; }
.library-card h3 span { color: var(--accent-2); font-family: var(--mono); font-size: 12px; }
.library-card p { margin: 4px 0 6px; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.library-card ul { margin: 0; padding-left: 16px; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.help-panel pre {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.65; color: #a5f3d0;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px; overflow-x: auto; margin: 10px 0 0;
}

/* ---------- workspace ---------- */
.workspace { display: grid; grid-template-rows: minmax(320px, 1fr) 260px auto; gap: 16px; min-height: 0; }
.editor-card, .console-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden; min-height: 0;
}
.draw-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; overflow: hidden; flex: 0 0 auto;
}
.draw-card[hidden] { display: none; }
#drawCanvas {
  display: block; width: 100%; height: auto; max-height: 320px;
  background: #0b1020;
}
.editor-head, .console-head {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.tab {
  display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 13px;
  background: var(--panel-3); border: 1px solid var(--border); border-bottom-color: transparent;
  border-radius: 8px 8px 0 0; padding: 6px 12px; margin-bottom: -10px;
}
.tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.editor-head-actions { margin-left: auto; display: flex; gap: 6px; }
.console-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0; }
.console-hint { color: var(--muted); font-size: 12.5px; }
.console-head .btn { margin-left: auto; }

.editor-wrap { flex: 1; display: flex; min-height: 0; background: #0a0f1f; }
.line-numbers {
  flex: 0 0 52px; overflow: hidden; text-align: right; padding: 16px 10px 16px 0;
  font-family: var(--mono); font-size: 14px; line-height: 1.6; color: #47597d;
  border-right: 1px solid var(--border); user-select: none; background: var(--panel-2);
}
.code-area { position: relative; flex: 1; min-width: 0; }
.highlight-layer, #editor {
  margin: 0; padding: 16px; font-family: var(--mono); font-size: 14px; line-height: 1.6;
  tab-size: 2; white-space: pre; word-wrap: normal;
}
.highlight-layer {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: var(--text);
}
.highlight-layer code { font: inherit; display: block; will-change: transform; }
#editor {
  position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: none; outline: none;
  background: transparent; color: transparent; caret-color: var(--accent); overflow: auto;
}
#editor::selection { background: rgba(167, 139, 250, .35); }
#editor::placeholder { color: #47597d; }

/* syntax colours */
.tok-keyword { color: #c4b5fd; font-weight: 600; }
.tok-operator { color: #7dd3fc; }
.tok-string { color: #86efac; }
.tok-variable { color: #fbbf24; }
.tok-number { color: #f9a8d4; }
.tok-comment { color: #64748b; font-style: italic; }
.tok-word { color: #e2e8f0; }
.tok-punctuation { color: #94a3b8; }

.statusbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 7px 12px; border-top: 1px solid var(--border); background: var(--panel-2);
  color: var(--muted); font-size: 12px; font-family: var(--mono);
}
.status-sep { opacity: .5; }
.status-spacer { flex: 1; }
.status-run { color: var(--accent); }
.status-run.running { color: var(--warning); }
.status-run.error { color: var(--danger); }

/* ---------- console ---------- */
.console-output {
  flex: 1; overflow-y: auto; padding: 12px 16px; font-family: var(--mono);
  font-size: 13.5px; line-height: 1.65; background: #070b16;
}
.console-line { white-space: pre-wrap; word-break: break-word; }
.console-line.output { color: #d1fae5; }
.console-line.system { color: #7dd3fc; }
.console-line.library { color: var(--accent-2); }
.console-line.prompt { color: #fde68a; }
.console-line.answer { color: var(--muted); }
.console-line.answer::before { content: "› "; color: var(--accent); }
.console-line.error {
  color: #fecaca; background: rgba(248, 113, 113, .1); border: 1px solid rgba(248,113,113,.35);
  border-radius: 8px; padding: 8px 10px; margin: 6px 0;
}
.console-line.divider { color: #334155; }
.console-empty { color: #47597d; }
.console-input {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  border-top: 1px solid var(--border); background: var(--panel-2);
}
.console-input-prompt { font-family: var(--mono); font-size: 13px; color: #fde68a; }
.console-input input {
  flex: 1; background: #070b16; border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-family: var(--mono); outline: none;
}
.console-input input:focus { border-color: var(--accent); }

/* ---------- footer, dialog, toast ---------- */
.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12.5px;
}
.footer code { color: var(--accent); }
.footer kbd {
  background: var(--panel-3); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 5px; padding: 1px 5px; font-size: 11px;
}
.file-dialog {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: var(--radius); padding: 22px; width: min(420px, 92vw);
}
.file-dialog::backdrop { background: rgba(2, 6, 17, .7); }
.file-dialog h2 { margin: 0 0 14px; font-size: 17px; }
.file-dialog label { display: block; color: var(--muted); font-size: 12.5px; margin-bottom: 6px; }
.file-dialog input {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 10px 12px; font-family: var(--mono); outline: none;
}
.file-dialog input:focus { border-color: var(--accent); }
.dialog-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 8px 0 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel-3); border: 1px solid var(--accent); color: var(--text);
  border-radius: 10px; padding: 10px 18px; font-size: 13.5px; z-index: 50;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.toast.error { border-color: var(--danger); }

/* ==================================================================
   Responsive layout
   ================================================================== */

/* Laptops / large tablets: tighten the two-column desktop layout first. */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 248px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .topbar { padding: 10px 14px; }
  .brand p { display: none; }
  .workspace { grid-template-rows: minmax(300px, 1fr) 230px; gap: 12px; }
  .footer { padding: 8px 14px; }
}

/*
 * Small screens (tablets in portrait and phones): the IDE becomes an
 * app-style, single-panel layout. Files / Code / Console are switched with
 * the mobile panel bar, the whole IDE fits the visible viewport height
 * (100dvh, including phones where browser chrome comes and goes), and
 * each panel scrolls internally. No more one very long page.
 */
@media (max-width: 0px) {
  html, body { height: 100%; height: 100dvh; }
  body {
    min-height: 0;
    height: 100dvh;
    overflow: hidden;
    overscroll-behavior: none;
  }

  /* --- compact two-row header: brand + Run, then file actions --- */
  .topbar {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand run"
      "files files";
    align-items: center;
    gap: 6px 10px;
    padding: max(8px, env(safe-area-inset-top)) 10px 8px;
    background: #0c1425;
  }
  .brand { grid-area: brand; gap: 9px; min-width: 0; }
  .logo { font-size: 19px; padding: 8px 9px; border-radius: 9px; box-shadow: none; }
  .logo span { font-size: 13px; }
  .brand h1 { font-size: 16px; white-space: nowrap; }
  .brand p, .save-status { display: none; }
  .top-actions { display: contents; }
  .action-bar {
    grid-area: files;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1px 1px 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .action-bar::-webkit-scrollbar { display: none; }
  .action-divider { display: none; }
  .file-actions, .learn-actions, .tool-actions {
    grid-area: auto;
    gap: 6px;
    overflow: visible;
    flex: 0 0 auto;
  }
  .run-actions { grid-area: run; gap: 6px; margin-left: 0; }
  .top-actions .btn {
    flex: 0 0 auto;
    min-height: 40px;
    padding: 7px 13px;
    border-radius: 9px;
    white-space: nowrap;
  }
  .btn-run { padding: 8px 18px; }

  /* --- Files / Code / Console segmented control --- */
  .mobile-view-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 6px 8px;
    background: #0c1425;
    border-bottom: 1px solid var(--border);
  }
  .mobile-view-btn {
    appearance: none;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    min-width: 0; min-height: 42px;
    padding: 7px 6px;
    background: rgba(255, 255, 255, .03);
    color: var(--muted);
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 13.5px; font-weight: 700;
    cursor: pointer;
  }
  .mobile-view-btn.active {
    background: rgba(52, 211, 153, .16);
    border-color: rgba(52, 211, 153, .55);
    color: #ecfdf5;
  }
  .mobile-view-icon { font-family: var(--mono); font-size: 13px; color: var(--accent); }

  /* --- one panel at a time, exactly filling the remaining height --- */
  .layout {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    gap: 0;
  }
  .sidebar, .workspace { width: 100%; min-height: 0; }

  body[data-mobile-view="files"] .sidebar {
    display: flex; flex: 1 1 auto; overflow-y: auto; padding: 2px 0 6px;
    overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  body[data-mobile-view="files"] .workspace { display: none; }
  body[data-mobile-view="editor"] .sidebar,
  body[data-mobile-view="console"] .sidebar { display: none; }

  body[data-mobile-view="editor"] .workspace,
  body[data-mobile-view="console"] .workspace {
    flex: 1 1 auto; display: grid; grid-template-rows: minmax(0, 1fr); gap: 0;
  }
  body[data-mobile-view="editor"] .console-card { display: none; }
  body[data-mobile-view="console"] .editor-card { display: none; }
  body[data-mobile-view="editor"] .draw-card,
  body[data-mobile-view="files"] .draw-card { display: none; }
  body[data-mobile-view="console"] .workspace { grid-template-rows: minmax(0, 1fr) auto; }
  body[data-mobile-view="console"] #drawCanvas { max-height: 220px; }

  .editor-card, .console-card { height: 100%; border-radius: 12px; }

  /* --- editor: larger touch-friendly code, slimmer gutter --- */
  .editor-head { padding: 7px 8px; gap: 6px; }
  .tab { min-width: 0; flex: 1 1 auto; padding: 6px 9px; font-size: 12.5px; }
  #currentFileName { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .editor-head-actions { flex: 0 0 auto; }
  .editor-head-actions .btn { min-height: 38px; padding: 6px 9px; }
  .line-numbers {
    flex-basis: 42px;
    padding: 12px 7px 12px 0;
    /* Smaller numerals, but the same 24.8px line height as the 16px code
       (16 x 1.55), so numbers stay aligned with their lines. */
    font-size: 12.5px; line-height: 24.8px;
  }
  .highlight-layer, #editor {
    padding: 12px;
    /* 16px also stops iOS Safari auto-zooming when the editor is tapped. */
    font-size: 16px; line-height: 1.55;
  }
  .statusbar {
    flex-wrap: nowrap; gap: 6px; overflow: hidden; white-space: nowrap;
    padding: 6px 9px; font-size: 11px;
  }
  .statusbar .status-optional { display: none; }
  .status-spacer { min-width: 4px; }
  .status-run { overflow: hidden; text-overflow: ellipsis; }

  /* --- console --- */
  .console-head { padding: 7px 8px; }
  .console-hint { display: none; }
  .console-head .btn { min-height: 38px; }
  .console-output { padding: 10px 12px; font-size: 13px; }
  .console-input { flex-wrap: wrap; padding: 8px; }
  .console-input-prompt { flex: 1 0 100%; min-width: 0; overflow-wrap: anywhere; }
  .console-input input { flex: 1 1 auto; min-width: 0; min-height: 44px; font-size: 16px; }
  .console-input .btn { min-height: 44px; }

  /* --- files view --- */
  .sidebar { gap: 10px; }
  .file-search { min-height: 44px; font-size: 16px; }
  .file-list { gap: 7px; }
  .file-item { min-height: 48px; padding: 9px 10px; }
  .sidebar-actions .btn { width: 100%; min-height: 42px; }
  .libraries-panel, .help-panel { padding: 12px; }
  .help-panel pre { max-height: 132px; }

  .footer { display: none; }

  /* --- overlays --- */
  .toast {
    left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom));
    transform: none; width: auto; text-align: center; font-size: 13px;
  }
  .file-dialog {
    width: calc(100vw - 24px);
    max-width: 420px;
    padding: 18px;
  }
  .file-dialog input { min-height: 48px; font-size: 16px; }
  .dialog-actions .btn { flex: 1; min-height: 44px; }
}

/* Larger phones in portrait get a two-column file grid (less scrolling). */
@media (min-width: 600px) and (max-width: 0px) {
  .file-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-list li { min-width: 0; }
}

/* Phones: compress everything one more step. */
@media (max-width: 0px) {
  .top-actions .btn { min-height: 38px; padding: 6px 11px; font-size: 12.5px; }
  .mobile-view-nav { padding: 5px 6px; }
  .mobile-view-btn { min-height: 42px; font-size: 13px; gap: 5px; }
  .layout { padding: 6px 6px max(6px, env(safe-area-inset-bottom)); }
  .editor-head-actions .btn { padding: 6px 7px; font-size: 12px; }
  .statusbar .status-lines-item { display: none; }
  .file-item .file-date { display: none; }
  .library-card p { display: none; }
  .library-card ul { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-left: 0; list-style: none; }
  .console-output { font-size: 12.5px; }
}

/* Very narrow phones: keep the essentials reachable, drop decorative bits. */
@media (max-width: 0px) {
  .brand h1 { font-size: 16px; }
  .logo { font-size: 18px; padding: 7px 8px; }
  .mobile-view-icon { display: none; }
  .line-numbers { flex-basis: 36px; padding-right: 5px; }
  .highlight-layer, #editor { padding: 10px 8px; }
  .tab { font-size: 12px; }
}

/* Short landscape phones: one-row header so code gets the height. */
@media (max-width: 0px) and (max-height: 500px) and (orientation: landscape) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand files run";
    padding-top: 5px; padding-bottom: 5px;
  }
  .brand h1 { display: none; }
  .top-actions .btn { min-height: 34px; padding: 5px 10px; }
  .mobile-view-nav { padding: 4px 6px; }
  .mobile-view-btn { min-height: 34px; }
  .logo { padding: 6px 8px; }
}

/* A panel is open: the page behind it must not scroll under the pointer. */
body.modal-open { overflow: hidden; }

/* ---------- 1.2.1 the Studio's own ask dialog ---------- */
.ask-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(3, 7, 18, .74); backdrop-filter: blur(5px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.ask-box {
  width: min(470px, 100%);
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}
.ask-box h2 { margin: 0; font-size: 17px; letter-spacing: .1px; }
.ask-message { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.ask-field { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.ask-field input {
  background: #0b1322; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 13px; color: var(--text); font-size: 14.5px; font-weight: 500;
  letter-spacing: normal; text-transform: none;
}
.ask-field input:focus { outline: none; border-color: rgba(52, 211, 153, .6); box-shadow: 0 0 0 3px rgba(52, 211, 153, .12); }
.ask-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- 1.2.1 Language Patch 1: pictures, linked to a name ---------- */
.pic-overlay {
  position: fixed; inset: 0; z-index: 76;
  background: rgba(3, 7, 18, .8); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.pic-shell {
  width: min(880px, 100%); max-height: min(90vh, 820px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .65);
}
.pic-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.pic-kicker { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #7dd3fc; }
.pic-head h2 { margin: 3px 0 0; font-size: 19px; }
.pic-body {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 0; min-height: 0; overflow: hidden;
}
.pic-left { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.pic-right {
  padding: 18px 20px; border-left: 1px solid var(--border); background: #0a1220;
  display: flex; flex-direction: column; gap: 12px; min-height: 0; overflow-y: auto;
}
.pic-drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 26px 16px; text-align: center; cursor: pointer;
  border: 2px dashed rgba(56, 189, 248, .35); border-radius: 14px; background: rgba(56, 189, 248, .05);
  transition: border-color .15s, background .15s;
}
.pic-drop:hover, .pic-drop:focus-visible, .pic-drop-active {
  border-color: rgba(56, 189, 248, .8); background: rgba(56, 189, 248, .12); outline: none;
}
.pic-drop-icon { font-size: 26px; line-height: 1; }
.pic-drop-main { font-size: 14px; font-weight: 600; }
.pic-drop-hint { font-size: 11.5px; color: var(--muted); }
.pic-field { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.pic-field input {
  background: #0b1322; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; color: var(--text); font-size: 14px; font-weight: 600;
  letter-spacing: normal; text-transform: none;
}
.pic-field input:focus { outline: none; border-color: rgba(56, 189, 248, .6); box-shadow: 0 0 0 3px rgba(56, 189, 248, .12); }
.pic-preview {
  display: flex; align-items: center; gap: 12px; min-height: 96px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #070c16;
}
.pic-preview img {
  width: 76px; height: 76px; object-fit: contain; border-radius: 8px;
  background: repeating-conic-gradient(#1b2537 0% 25%, #131c2c 0% 50%) 50% / 16px 16px;
}
.pic-preview-empty, .pic-preview-info { color: var(--muted); font-size: 12.5px; }
.pic-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pic-note { margin: 0; font-size: 12px; line-height: 1.55; color: var(--muted); min-height: 18px; }
.pic-book-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pic-book-head h3 { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pic-count { font-size: 11px; font-family: var(--mono); color: #64748b; }
.pic-list { display: flex; flex-direction: column; gap: 8px; }
.pic-empty { margin: 0; padding: 14px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); font-size: 12.5px; text-align: center; }
.pic-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 11px; background: #0c1424;
}
.pic-thumb {
  width: 42px; height: 42px; object-fit: contain; border-radius: 8px; flex: 0 0 auto;
  background: repeating-conic-gradient(#1b2537 0% 25%, #131c2c 0% 50%) 50% / 12px 12px;
}
.pic-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.pic-item-name { font-family: var(--mono); font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.pic-item-meta { font-size: 11px; color: var(--muted); }
.pic-tip { margin: 0; font-size: 11.5px; line-height: 1.6; color: #64748b; }
.pic-tip code { color: var(--accent); }

@media (max-width: 0px) {
  .pic-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .pic-right { border-left: none; border-top: 1px solid var(--border); }
  .pic-preview { min-height: 84px; }
}

body.light-theme .pic-shell { background: #fff; }
body.light-theme .pic-head { background: #f8fafc; }
body.light-theme .pic-right, body.light-theme .pic-preview, body.light-theme .pic-item { background: #f8fafc; }
body.light-theme .pic-field input { background: #fff; color: #0f172a; }

/* ---------- 1.2.1 community ideas (suggest a feature) ---------- */
.sug-overlay {
  position: fixed; inset: 0; z-index: 75;
  background: rgba(3, 7, 18, .8); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.sug-shell {
  width: min(680px, 100%); max-height: min(88vh, 780px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .65);
}
.sug-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 18px 20px; border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.sug-kicker { font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: #fbbf24; }
.sug-head h2 { margin: 3px 0 0; font-size: 19px; }
.sug-body { padding: 18px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.sug-intro { margin: 0; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.sug-intro strong { color: var(--text); }
.sug-field { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.sug-field textarea {
  background: #0b1322; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 13px; color: var(--text); font-size: 14px; font-weight: 500;
  letter-spacing: normal; text-transform: none; resize: vertical; min-height: 84px; line-height: 1.55;
}
.sug-field textarea:focus { outline: none; border-color: rgba(245, 158, 11, .55); box-shadow: 0 0 0 3px rgba(245, 158, 11, .12); }
.sug-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sug-actions .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.sug-hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; flex: 1 1 220px; }
.sug-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.sug-list-head h3 { margin: 0; font-size: 13px; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sug-list-tools { display: flex; align-items: center; gap: 8px; }
.sug-status { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.sug-list { display: flex; flex-direction: column; gap: 8px; }
.sug-empty { margin: 0; padding: 14px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted); font-size: 13px; text-align: center; }
.sug-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: 11px; background: #0c1424;
  text-decoration: none; color: var(--text);
}
.sug-item:hover { border-color: rgba(245, 158, 11, .45); background: #101a2e; }
.sug-vote {
  flex: 0 0 auto; min-width: 42px; text-align: center;
  padding: 5px 6px; border-radius: 9px; background: rgba(148, 163, 184, .12);
  font-family: var(--mono); font-size: 11.5px; color: var(--muted); line-height: 1.25;
}
.sug-vote strong { display: block; font-size: 14px; color: var(--text); }
.sug-item-main { min-width: 0; flex: 1 1 auto; }
.sug-item-title { font-size: 13.5px; font-weight: 600; line-height: 1.4; }
.sug-item-meta { margin-top: 3px; font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.sug-chip { padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); font-size: 10.5px; letter-spacing: .03em; }
.sug-chip-open { color: #7dd3fc; border-color: rgba(56, 189, 248, .4); background: rgba(56, 189, 248, .1); }
.sug-chip-done { color: #a7f3d0; border-color: rgba(52, 211, 153, .4); background: rgba(52, 211, 153, .1); }

body.light-theme .ask-box, body.light-theme .sug-shell { background: #fff; }
body.light-theme .sug-head { background: #f8fafc; }
body.light-theme .sug-item { background: #f8fafc; }
body.light-theme .ask-field input, body.light-theme .sug-field textarea { background: #fff; color: #0f172a; }

/* ---------- 1.2 tutorials: a deck of cards, checked for real ---------- */
.tut-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(3, 7, 18, 0.82);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 18px;
}
.tut-shell {
  width: min(1180px, 100%); height: min(880px, 100%);
  display: grid; grid-template-columns: 280px minmax(0, 1fr);
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75);
}

.tut-nav {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--panel-2); border-right: 1px solid var(--border);
  padding: 16px 12px 12px;
}
.tut-nav-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 6px 10px; }
.tut-nav-title { font-weight: 800; font-size: 15px; letter-spacing: .2px; }
.tut-progress-label { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.tut-progress { height: 5px; border-radius: 999px; background: rgba(148, 163, 184, 0.18); margin: 0 6px 12px; overflow: hidden; }
.tut-progress-bar { height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, #34d399, #22d3ee); transition: width .3s ease; }
.tut-course-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 2px; }
.tut-course { margin-bottom: 14px; }
.tut-course-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.tut-course-head .tut-course-count { margin-left: auto; font-family: var(--mono); font-size: 11px; }
.tut-step {
  width: 100%; display: flex; align-items: center; gap: 9px;
  background: transparent; border: 1px solid transparent; color: var(--text);
  text-align: left; padding: 7px 8px; border-radius: 9px; cursor: pointer;
  font-size: 13px; line-height: 1.35;
}
.tut-step:hover { background: rgba(148, 163, 184, 0.12); }
.tut-step.active { background: rgba(52, 211, 153, 0.14); border-color: rgba(52, 211, 153, 0.4); }
.tut-step-dot {
  flex: 0 0 20px; width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(148, 163, 184, 0.16); color: var(--muted);
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.tut-step.done .tut-step-dot { background: rgba(52, 211, 153, 0.9); color: #052e1b; }
.tut-nav-foot { margin: 10px 6px 0; font-size: 11px; color: var(--muted); line-height: 1.45; }
.tut-link {
  display: block; margin: 10px 6px 0; padding: 0;
  background: none; border: none; cursor: pointer;
  color: #a5b4fc; font-size: 11.5px; text-align: left; text-decoration: underline;
}
.tut-link:hover { color: #c7d2fe; }

.tut-card { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.tut-card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); background: var(--panel-2);
}
.tut-course-name { font-size: 11.5px; color: #a5b4fc; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.tut-card-head h2 { margin: 3px 0 0; font-size: 19px; }
.tut-card-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }

.tut-goal {
  margin: 0; padding: 10px 14px; border-radius: 10px; font-size: 14px;
  background: rgba(34, 211, 238, 0.08); border: 1px solid rgba(34, 211, 238, 0.3);
}
.tut-goal > span:first-child { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #67e8f9; margin-right: 8px; }
.tut-text { display: flex; flex-direction: column; gap: 10px; font-size: 14px; line-height: 1.6; color: var(--text); }
.tut-text p { margin: 0; }
.tut-text code, .tut-goal code {
  font-family: var(--mono); font-size: 12.5px; padding: 1px 5px; border-radius: 5px;
  background: rgba(148, 163, 184, 0.16); color: #7dd3fc;
}
.tut-text pre {
  margin: 0; padding: 12px 14px; border-radius: 10px; overflow-x: auto;
  background: #080d1a; border: 1px solid var(--border);
  font-family: var(--mono); font-size: 12.8px; line-height: 1.55; color: #a7f3d0;
}
.tut-text .tut-tip {
  padding: 10px 14px; border-radius: 10px; font-size: 13px;
  background: rgba(251, 191, 36, 0.08); border: 1px solid rgba(251, 191, 36, 0.3); color: #fde68a;
}

.tut-editor-wrap { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: #080d1a; }
.tut-editor-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; background: #0c1424; border-bottom: 1px solid var(--border);
  font-size: 11.5px; color: var(--muted); font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
}
.tut-step-counter { font-family: var(--mono); text-transform: none; letter-spacing: 0; }
#tutCode {
  width: 100%; box-sizing: border-box; min-height: 150px; max-height: 300px;
  resize: vertical; border: none; outline: none; background: transparent;
  color: #f8fafc; font-family: var(--mono); font-size: 13px; line-height: 1.6;
  padding: 13px 14px; tab-size: 4; white-space: pre; overflow: auto;
  caret-color: #38bdf8;
}

.tut-feedback { padding: 12px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.tut-feedback.ok { background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.45); color: #a7f3d0; }
.tut-feedback.bad { background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.45); color: #fecaca; }
.tut-feedback.info { background: rgba(148, 163, 184, 0.1); border: 1px solid var(--border); color: var(--muted); }
.tut-feedback .tut-detail {
  display: block; margin-top: 8px; padding: 8px 10px; border-radius: 8px;
  background: rgba(2, 6, 23, 0.55); font-family: var(--mono); font-size: 12px;
  color: #e2e8f0; white-space: pre-wrap; max-height: 190px; overflow: auto;
}
.tut-output {
  border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  background: #060a12;
}
.tut-output-head { padding: 6px 12px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); }
.tut-output pre { margin: 0; padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; color: #d1fae5; max-height: 170px; overflow: auto; white-space: pre-wrap; }

.tut-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 20px; border-top: 1px solid var(--border); background: var(--panel-2);
}
.tut-foot-left, .tut-foot-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

@media (max-width: 0px) {
  .tut-shell { grid-template-columns: minmax(0, 1fr); height: 100%; }
  .tut-nav { display: none; }
}

body.light-theme .tut-overlay { background: rgba(226, 232, 240, 0.86); }
body.light-theme .tut-shell { background: #fff; }
body.light-theme .tut-nav, body.light-theme .tut-card-head, body.light-theme .tut-card-foot { background: #f8fafc; }
body.light-theme .tut-text pre, body.light-theme .tut-editor-wrap, body.light-theme .tut-output { background: #f8fafc; }
body.light-theme #tutCode { color: #0f172a; }
body.light-theme .tut-text pre { color: #065f46; }

/* ---------- Settings Dialog (Dev Build 6) ---------- */
.settings-dialog {
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  border-radius: var(--radius); padding: 0; max-width: 480px; width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}
.settings-dialog::backdrop { background: rgba(3, 7, 18, 0.75); backdrop-filter: blur(4px); }
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: var(--panel-2); border-bottom: 1px solid var(--border);
}
.settings-head h2 { margin: 0; font-size: 17px; }
.settings-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.setting-row label { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.setting-row select {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer;
}
.setting-row input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.setting-desc { font-size: 12px; color: var(--muted); margin: 4px 0 0 28px; line-height: 1.4; }

/* ---------- Light Theme (Dev Build 6) ---------- */
body.light-theme {
  --bg: #f0f4f8;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #e2e8f0;
  --border: #cbd5e1;
  --text: #1e293b;
  --muted: #64748b;
  --accent: #059669;
  --danger: #dc2626;
  color: var(--text);
  background: var(--bg);
}
body.light-theme .topbar { background: #ffffff; border-bottom-color: var(--border); }
body.light-theme .sidebar { background: #ffffff; border-right-color: var(--border); }
body.light-theme .file-item { color: var(--text); }
body.light-theme .file-item:hover { background: var(--panel-3); }
body.light-theme .file-item.active { background: rgba(5, 150, 105, 0.12); color: #065f46; }
body.light-theme .editor-card { background: #ffffff; border-color: var(--border); }
body.light-theme .editor { color: var(--text); }
body.light-theme .highlight-layer { color: var(--text); }
body.light-theme .line-numbers { background: #f8fafc; color: var(--muted); border-right-color: var(--border); }
body.light-theme .console-card { background: #ffffff; border-color: var(--border); }
body.light-theme .console-output { background: #f8fafc; }
body.light-theme .statusbar { background: #f8fafc; border-color: var(--border); color: var(--muted); }
body.light-theme .footer { background: #ffffff; border-top-color: var(--border); color: var(--muted); }
body.light-theme .settings-dialog { background: #ffffff; color: var(--text); }
body.light-theme .settings-head { background: #f8fafc; }
body.light-theme .tok-keyword { color: #7c3aed; }
body.light-theme .tok-string { color: #059669; }
body.light-theme .tok-variable { color: #d97706; }
body.light-theme .tok-number { color: #2563eb; }
body.light-theme .tok-comment { color: #94a3b8; }
