:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #1d2433;
  --muted: #667085;
  --line: #e1e4ea;
  --accent: #3178c6;
  --accent-ink: #ffffff;
  --pass: #1f8a46;
  --pass-bg: #e8f6ee;
  --fail: #c9302c;
  --fail-bg: #fdecec;
  --warn: #a15c00;
  --warn-bg: #fff4e0;
  --code-bg: #1e1e1e;
  --mono: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, "Liberation Mono", monospace;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  display: flex;
  flex-direction: column;
}
button { font: inherit; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: #151b2c;
  color: #fff;
  flex: none;
}
.brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 12px; color: #aab3c5; }
.exam-select select {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: #fff;
  background: #232b40;
  border: 1px solid #3a4560;
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
}
.exam-select select:focus { outline: 2px solid #5b7cf0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.timer {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: #232b40;
  color: #dfe5f2;
}
.timer.reading { background: #5a4100; color: #ffe08a; }
.timer.working { background: #17345e; color: #cfe0ff; }
.timer.low { background: #6b1d1a; color: #ffd2cf; }
.timer.over { background: #8f1d18; color: #fff; }
.top-actions { display: flex; gap: 8px; margin-left: auto; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  white-space: nowrap;
}
.btn:hover { border-color: #b9c0cc; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { padding: 5px 11px; font-size: 13px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #235a97; }
.btn.ghost { background: transparent; }
.topbar .btn.ghost { color: #dfe5f2; border-color: #3a4560; }
.btn.danger { color: var(--fail); }

/* ---------- layout ---------- */
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 230px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 10px 8px;
}
.sidebar h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 8px 6px; }
.qlink {
  width: 100%;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 6px;
  text-align: left;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 8px;
  cursor: pointer;
  color: var(--ink);
}
.qlink:hover { background: #f1f3f7; }
.qlink.active { background: #e9eefc; border-color: #c9d5fa; }
.qnum { font-weight: 700; }
.qtitle { font-size: 12.5px; color: #3b4456; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qstatus { font-size: 11.5px; font-weight: 700; color: var(--muted); }
.qstatus.pass { color: var(--pass); }
.qstatus.partial { color: var(--warn); }
.qstatus.fail { color: var(--fail); }
.hurdles { margin: 14px 8px 4px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; font-size: 12px; color: #3b4456; line-height: 1.5; }

.main { flex: 1; display: flex; min-width: 0; min-height: 0; }
.workspace { flex: 1; display: grid; grid-template-columns: minmax(340px, 40%) 1fr; min-width: 0; min-height: 0; }

/* ---------- question spec ---------- */
.spec { overflow-y: auto; padding: 18px 22px 40px; background: var(--panel); border-right: 1px solid var(--line); line-height: 1.55; }
.spec h2 { margin: 0 0 4px; font-size: 20px; }
.spec h4 { margin: 18px 0 6px; font-size: 14px; }
.spec code { font-family: var(--mono); font-size: 12.5px; background: #f0f2f6; padding: 1px 4px; border-radius: 4px; }
.spec pre { font-family: var(--mono); font-size: 12.5px; background: #f6f7f9; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow-x: auto; line-height: 1.45; }
.spec pre code { background: none; padding: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #eef1f6; color: #3b4456; }
.chip.marks { background: #e9eefc; color: #2240a8; font-weight: 600; }
.chip.hurdle { background: #fff1d6; color: #7a4a00; }
.chip.leak { background: #e8f6ee; color: #1b6e3a; }
.chip.forbid { background: #fdecec; color: #9b2420; }
.note { font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); margin-top: 22px; padding-top: 10px; }

/* ---------- coding area ---------- */
.coding { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.editor-bar { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: #252526; color: #ccc; flex: none; min-width: 0; }
.filetabs { display: flex; gap: 2px; min-width: 0; flex: 0 1 auto; overflow-x: auto; scrollbar-width: thin; align-self: flex-end; margin-bottom: -7px; }
.filetab { font-family: var(--mono); font-size: 12.5px; color: #9da5b4; background: #2d2d2d; border: none; border-top: 2px solid transparent; padding: 6px 12px 7px; border-radius: 4px 4px 0 0; cursor: pointer; white-space: nowrap; display: flex; gap: 6px; align-items: center; }
.filetab:hover { color: #fff; }
.filetab.active { color: #fff; background: #1e1e1e; border-top-color: var(--accent); }
.filetab .lock { font-size: 10px; color: #c5a65a; font-family: system-ui, sans-serif; }
.filetab .errs { font-size: 10.5px; font-family: system-ui, sans-serif; background: #8f1d18; color: #fff; border-radius: 99px; padding: 0 5px; }
.filetab.dirty::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #9da5b4; }
.save-state { font-size: 12px; color: #8a8f98; white-space: nowrap; flex: none; }
@media (max-width: 1500px) { .save-state { display: none; } }
.editor-actions { margin-left: auto; display: flex; gap: 6px; flex: none; }
.editor-bar .btn.ghost { color: #ddd; border-color: #444; }
.editor-bar .btn:not(.primary):not(.ghost) { background: #2f6e3b; border-color: #2f6e3b; color: #fff; }
.editor { flex: 1 1 55%; min-height: 160px; overflow: hidden; background: var(--code-bg); }
.editor .cm-editor { height: 100%; }
.editor .cm-editor.cm-focused { outline: none; }

.panel { flex: 1 1 45%; min-height: 180px; display: flex; flex-direction: column; background: var(--panel); border-top: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; padding: 0 8px; border-bottom: 1px solid var(--line); flex: none; }
.tab { background: none; border: none; border-bottom: 2px solid transparent; padding: 8px 12px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); }
.tab .badge { margin-left: 6px; font-size: 11px; padding: 1px 6px; border-radius: 999px; background: #eef1f6; }
.tab .badge.pass { background: var(--pass-bg); color: var(--pass); }
.tab .badge.fail { background: var(--fail-bg); color: var(--fail); }
.tab-body { flex: 1; overflow: auto; padding: 10px 12px; min-height: 0; display: flex; flex-direction: column; gap: 8px; }

.run-inputs { display: flex; gap: 10px; flex: none; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 200px; }
.field.grow { flex: 1; }
.field input, .field textarea { font-family: var(--mono); font-size: 13px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); resize: vertical; }
.field input:focus, .field textarea:focus { outline: 2px solid #c9d5fa; border-color: var(--accent); }

.console { flex: 1; margin: 0; min-height: 90px; background: #0f1320; color: #e6e9ef; font-family: var(--mono); font-size: 13px; line-height: 1.45; padding: 10px 12px; border-radius: 6px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.console .cmd { color: #8ab4ff; }
.console .err { color: #ff8f8a; }
.console .warn { color: #ffd479; }
.console .ok { color: #8ee6a8; }
.console .dim { color: #8a93a6; }

/* ---------- autotest results ---------- */
.test-results { display: flex; flex-direction: column; gap: 8px; }
.summary { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.summary .big { font-size: 15px; }
.test { border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.test > summary { list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 7px 10px; font-family: var(--mono); font-size: 12.5px; }
.test > summary::-webkit-details-marker { display: none; }
.test.pass > summary { background: var(--pass-bg); }
.test.fail > summary { background: var(--fail-bg); }
.result-tag { font-family: system-ui, sans-serif; font-weight: 700; font-size: 12px; min-width: 52px; }
.test.pass .result-tag { color: var(--pass); }
.test.fail .result-tag { color: var(--fail); }
.test-body { padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; }
.test-body h5 { margin: 4px 0 2px; font-size: 12px; color: var(--muted); }
.test-body pre { margin: 0; font-family: var(--mono); font-size: 12.5px; background: #f6f7f9; border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; white-space: pre-wrap; word-break: break-word; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.diff .line-bad { background: #ffd9d6; }
.reason { color: var(--fail); font-weight: 600; font-size: 13px; }
.hint { color: var(--warn); font-size: 12.5px; }

.shortcuts { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px 16px; font-size: 13px; }
kbd { font-family: var(--mono); font-size: 11.5px; background: #f0f2f6; border: 1px solid #d3d8e1; border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; }
.muted { color: var(--muted); }

/* ---------- playground ---------- */
.qlink.pg .qnum { font-family: var(--mono); font-size: 11px; color: var(--accent); }
.qlink.newfile { color: var(--muted); border-style: dashed; border-color: var(--line); margin-top: 4px; }
.qlink.newfile:hover { color: var(--ink); }
.pg-form { display: flex; flex-direction: column; gap: 12px; margin: 14px 0 6px; }
.pg-form .field { min-width: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.check input { margin-top: 3px; }
.tpl-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.small { font-size: 12.5px; }
pre.plain { margin: 0; font-family: var(--mono); font-size: 12.5px; background: #f6f7f9; border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; white-space: pre-wrap; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(14, 18, 30, 0.55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: var(--panel); border-radius: 12px; max-width: 760px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 24px 28px; box-shadow: 0 20px 60px rgba(0,0,0,.3); line-height: 1.55; }
.modal h2 { margin-top: 0; }
.modal table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.modal th, .modal td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.modal td.num, .modal th.num { text-align: right; font-variant-numeric: tabular-nums; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.modal ul { padding-left: 20px; }
.pill { font-weight: 700; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.pill.pass { background: var(--pass-bg); color: var(--pass); }
.pill.fail { background: var(--fail-bg); color: var(--fail); }
.progress { height: 6px; background: #eef1f6; border-radius: 99px; overflow: hidden; margin: 10px 0; }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.solution-box { margin-top: 18px; }
.solution-box pre { max-height: 420px; }

/* ---------- paper sections (multiple choice, short answer) ---------- */
.paper { flex: 1; overflow-y: auto; padding: 24px 24px 80px; }
.paper-inner { max-width: 880px; margin: 0 auto; }
.paper-head h2 { margin: 0 0 4px; font-size: 22px; }
.paper-head p { margin: 4px 0; color: var(--muted); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; margin: 16px 0; line-height: 1.55; scroll-margin-top: 16px; }
.card.flash { box-shadow: 0 0 0 3px #b9d3f2; transition: box-shadow .3s; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.card-head h3 { margin: 0; font-size: 16px; }
.card-head .chip { margin-left: auto; }
.card code, .spec code, .modal code { font-family: var(--mono); font-size: 12.5px; background: #f0f2f6; padding: 1px 4px; border-radius: 4px; }
.card pre, .spec pre { font-family: var(--mono); font-size: 12.5px; background: #f6f8fa; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; overflow-x: auto; line-height: 1.45; }
.card pre code, .spec pre code { background: none; padding: 0; }
.card table, .spec table { border-collapse: collapse; font-size: 12.5px; margin: 8px 0; }
.spec td code, .spec th code { white-space: nowrap; font-size: 12px; }
.card th, .card td, .spec th, .spec td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
.card th, .spec th { background: #f6f7f9; }
.choose { font-size: 12.5px; color: var(--muted); font-weight: 600; margin: 10px 0 6px; }
.options { display: flex; flex-direction: column; gap: 6px; }
.option { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; cursor: pointer; background: #fff; }
.option:hover { border-color: #b9c0cc; }
.option input { margin-top: 3px; flex: none; }
.option .letter { font-weight: 700; color: var(--muted); flex: none; width: 16px; }
.option p { margin: 0; }
.option.chosen { border-color: var(--accent); background: #f0f6fd; }
.option.right { border-color: var(--pass); background: var(--pass-bg); }
.option.wrong { border-color: var(--fail); background: var(--fail-bg); }
.option.missed { border-color: var(--pass); border-style: dashed; }
.option .tag { margin-left: auto; font-size: 11.5px; font-weight: 700; flex: none; }
.option.right .tag { color: var(--pass); }
.option.wrong .tag { color: var(--fail); }
.option.missed .tag { color: var(--pass); }
fieldset.options { border: none; padding: 0; margin: 0; }
fieldset:disabled .option { cursor: default; }
.explain { margin-top: 12px; padding: 10px 14px; border-left: 3px solid var(--accent); background: #f6f8fb; border-radius: 0 6px 6px 0; }
.explain p:first-child { margin-top: 0; } .explain p:last-child { margin-bottom: 0; }
.answer-box { width: 100%; min-height: 150px; font: inherit; font-size: 14px; line-height: 1.5; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; resize: vertical; }
.answer-box:focus { outline: 2px solid #c9dcf2; border-color: var(--accent); }
.answer-box:disabled { background: #f6f7f9; color: #3b4456; }
.answer-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.answer-meta .over { color: var(--warn); font-weight: 600; }
.model { margin-top: 14px; }
.model h4, .rubric h4, .ai-box h4 { margin: 12px 0 6px; font-size: 13.5px; }
.model-body { padding: 10px 14px; background: #f3f8f3; border: 1px solid #cfe6d6; border-radius: 8px; }
.model-body p:first-child { margin-top: 0; } .model-body p:last-child { margin-bottom: 0; }
.rubric-row { display: flex; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rubric-row:last-child { border-bottom: none; }
.rubric-text { flex: 1; }
.rubric-text .ai-note { display: block; font-size: 12px; color: #5b4bb5; margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex: none; }
.seg button { border: none; background: #fff; padding: 4px 9px; font-size: 12.5px; cursor: pointer; font-variant-numeric: tabular-nums; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: none; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button.ai { box-shadow: inset 0 -3px 0 #8b7bea; }
.seg button.on.ai { box-shadow: inset 0 -3px 0 #c9c0ff; }
.self-total { display: flex; gap: 10px; align-items: center; margin-top: 10px; font-weight: 600; }
.ai-box { margin-top: 12px; padding: 10px 14px; border: 1px solid #d9d3fb; background: #f7f5ff; border-radius: 8px; }
.ai-box .ai-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-box .ai-score { font-weight: 700; color: #4b3aa8; }
.ai-box p { margin: 6px 0; }
.btn.ai { border-color: #8b7bea; color: #4b3aa8; }
.btn.ai:hover { background: #f2efff; }
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid #c9c0ff; border-top-color: #4b3aa8; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.locked-note { padding: 10px 14px; background: var(--warn-bg); color: #6b4400; border-radius: 8px; margin: 12px 0; }

/* ---------- exam day checklist ---------- */
.checklist { padding-left: 20px; margin: 8px 0; }
.checklist li { margin: 5px 0; }
.intro-checklist { margin: 10px 0; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.intro-checklist summary { cursor: pointer; }

/* ---------- sidebar extras ---------- */
.mcq-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 0 6px; }
.mcq-cell { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 5px 0; font-weight: 700; font-size: 12.5px; cursor: pointer; color: #3b4456; }
.mcq-cell:hover { border-color: #b9c0cc; }
.mcq-cell.answered { background: #e6eef8; border-color: #b8cde8; color: #1d4f88; }
.mcq-cell.right { background: var(--pass-bg); border-color: #a9d8b9; color: var(--pass); }
.mcq-cell.wrong { background: var(--fail-bg); border-color: #f0b7b4; color: var(--fail); }
.mcq-cell.multi { text-decoration: underline dotted; text-underline-offset: 3px; }
.side-note { font-size: 11.5px; color: var(--muted); margin: 6px 8px 0; }
.qlink.section { grid-template-columns: 1fr auto; font-weight: 600; }

/* ---------- problems + test output ---------- */
.problems { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.problem { display: grid; grid-template-columns: auto 1fr; gap: 8px; padding: 5px 8px; border-radius: 5px; cursor: pointer; align-items: baseline; }
.problem:hover { background: #f1f3f7; }
.problem .where { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.problem .msg { white-space: pre-wrap; }
.problem .code { color: var(--muted); font-size: 11.5px; }
.problem.err .msg::before { content: '\2716  '; color: var(--fail); }
.test-row { display: flex; gap: 10px; align-items: baseline; padding: 4px 8px; font-family: var(--mono); font-size: 12.5px; border-radius: 5px; }
.test-row .mark { font-weight: 700; flex: none; width: 14px; }
.test-row.passed .mark { color: var(--pass); }
.test-row.failed .mark { color: var(--fail); }
.test-row.skipped, .test-row.todo { color: var(--muted); }
.test-row .ms { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.test-err { margin: 2px 0 8px 32px; font-family: var(--mono); font-size: 12px; background: #fff6f5; border: 1px solid #f3d0cd; border-radius: 5px; padding: 6px 9px; white-space: pre-wrap; word-break: break-word; }
.test-file { font-weight: 700; font-size: 12.5px; margin: 8px 0 2px; font-family: var(--mono); }
.result-block { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.result-block h4 { margin: 0 0 6px; font-size: 13px; }
.mutant { display: flex; gap: 10px; align-items: baseline; padding: 4px 0; font-size: 13px; }
.mutant .mark { font-weight: 700; width: 70px; flex: none; }
.mutant.caught .mark { color: var(--pass); }
.mutant.missed .mark { color: var(--fail); }
.typebar { padding: 6px 10px; border-radius: 6px; font-size: 13px; font-weight: 600; }
.typebar.ok { background: var(--pass-bg); color: var(--pass); }
.typebar.bad { background: var(--fail-bg); color: var(--fail); cursor: pointer; }

/* highlight.js (light, GitHub-like) for code in questions */
.hljs-keyword, .hljs-built_in, .hljs-type { color: #cf222e; }
.hljs-string, .hljs-regexp { color: #0a3069; }
.hljs-number, .hljs-literal { color: #0550ae; }
.hljs-comment { color: #6e7781; font-style: italic; }
.hljs-title, .hljs-title.function_ { color: #8250df; }
.hljs-attr, .hljs-property { color: #0550ae; }
.hljs-params { color: #24292f; }
.hljs-variable.language_ { color: #cf222e; }

.results-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.stat { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat .label { font-size: 12px; color: var(--muted); }
.stat .value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat.pending .value { color: var(--warn); }
.settings-form { display: flex; flex-direction: column; gap: 12px; }
.settings-form .field { min-width: 0; }
.settings-form select { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.radio-row { display: flex; gap: 8px; align-items: flex-start; }
.radio-row input { margin-top: 4px; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .results-grid { grid-template-columns: repeat(2, 1fr); }
  .spec { max-height: 40vh; border-right: none; border-bottom: 1px solid var(--line); }
  .sidebar { width: 170px; }
}
@media (max-width: 700px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; display: flex; overflow-x: auto; padding: 6px; }
  .sidebar h3, .hurdles { display: none; }
  .qlink { width: auto; grid-template-columns: auto auto; }
  .qlink .qtitle { display: none; }
  .run-inputs { flex-direction: column; }
}
