:root {
  --bg: #12151c; --panel: #181c25; --line: #262c3a; --text: #d7dbe6; --dim: #7c869b;
  --accent: #5ea1ff; --ok: #4cc38a; --bad: #ff6b6b; --warn: #f0b84d;
  --kw: #c792ea; --type: #4ec9b0; --str: #e8c27a; --num: #f78c6c; --fn: #82aaff; --comment: #5c6a85;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font: 14px/1.4 system-ui, sans-serif; }
body { display: flex; flex-direction: column; }
header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
h1 { margin: 0; font-size: 18px; } h1 span { color: var(--dim); font-weight: 400; }
.field { display: flex; align-items: center; gap: 8px; color: var(--dim); }
select, button { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font: inherit; }
button { background: var(--accent); color: #07101f; border-color: var(--accent); font-weight: 600; cursor: pointer; }
button:disabled { opacity: .5; cursor: progress; }
kbd { font: 11px var(--mono); opacity: .7; margin-left: 6px; }
#status { color: var(--dim); }
main { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; }
.pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); }
.pane:last-child { border-right: 0; }
.pane-title { padding: 6px 12px; color: var(--dim); font-size: 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
#meta { float: right; font-family: var(--mono); }
.editor { flex: 1; min-height: 0; display: flex; overflow: hidden; font: 14px/20px var(--mono); }
#gutter { padding: 8px 8px 8px 12px; text-align: right; color: var(--comment); user-select: none; white-space: pre; overflow: hidden; background: var(--panel); }
#gutter .err { color: var(--bad); font-weight: 700; }
.code { position: relative; flex: 1; min-width: 0; }
#highlight, #source { position: absolute; inset: 0; margin: 0; padding: 8px 12px; border: 0; font: inherit; tab-size: 4; white-space: pre; overflow: auto; }
#highlight { pointer-events: none; overflow: hidden; }
#source { background: transparent; color: transparent; caret-color: var(--text); resize: none; outline: none; }
#source::selection { background: #3a4a6b; color: transparent; }
.line { min-height: 20px; }
.line.err { background: rgba(255, 107, 107, .16); box-shadow: inset 3px 0 var(--bad); }
.tok-kw { color: var(--kw); } .tok-type { color: var(--type); } .tok-str { color: var(--str); }
.tok-num { color: var(--num); } .tok-fn, .tok-call { color: var(--fn); } .tok-lit { color: var(--num); }
.tok-comment { color: var(--comment); font-style: italic; }
#output { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; font: 13px/1.5 var(--mono); }
#output pre { margin: 0 0 12px; white-space: pre-wrap; word-break: break-word; }
.hint { color: var(--dim); font-family: system-ui, sans-serif; }
.label { font: 600 11px system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); margin: 8px 0 4px; }
.stderr { color: var(--warn); }
.fail { color: var(--bad); }
.pass { color: var(--ok); }
.diag { display: block; width: 100%; text-align: left; background: rgba(255, 107, 107, .1); color: var(--text); border: 1px solid rgba(255, 107, 107, .35); border-radius: 6px; padding: 6px 10px; margin-bottom: 6px; font: inherit; font-weight: 400; cursor: pointer; }
.diag b { color: var(--bad); }
@media (max-width: 800px) {
  main { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .pane { border-right: 0; border-bottom: 1px solid var(--line); }
}
