/* Decisions page: additions on top of style.css. Every colour and font comes from tokens.css. */

/* ─── Intro ─── */
.intro-3 { grid-template-columns: repeat(3, 1fr); }

/* ─── Setup ─── */
.link-btn { padding: 0; border: none; background: none; color: var(--blue-600); font: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer; }
.link-btn:hover { color: var(--ink); }

.model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.model-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line-2); min-width: 0; transition: border-color .15s, opacity .15s; }
.model-card[data-selected="false"] { opacity: .72; }
.model-card[data-selected="true"] { border-color: var(--line-strong); }
.model-card.ok { border-color: var(--green); }
.model-card.error { border-color: var(--red); }
.model-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-3); }
.pick { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; min-width: 0; }
.pick input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--ink); flex: none; cursor: pointer; }
.pick .swatch { flex: none; margin-top: 7px; }
.pick > span { display: grid; gap: 2px; min-width: 0; }
.pick strong { font-family: var(--font-display); font-weight: 600; font-size: var(--body-lg); line-height: 1.2; color: var(--ink); }
.pick small { color: var(--ink-2); }
.model-head .btn { flex: none; }
.model-head .btn-secondary { background: var(--surface); border: 1px solid var(--line-strong); }
.model-blurb { margin: 0; color: var(--ink-2); font-size: var(--caption); line-height: 1.5; }
.model-card .meter { margin: 0; }
.model-card[data-model="basal"] .meter i { background: var(--green); }
.model-card[data-model="qwen"] .meter i { background: var(--blue); }
.model-phases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); margin: 0; }
.model-phases div { display: grid; gap: 2px; min-width: 0; }
.model-phases dt { color: var(--ink-3); }
.model-phases dd { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: var(--body-lg); color: var(--ink); overflow-wrap: anywhere; }
.model-status { margin: auto 0 0; padding-top: 8px; border-top: 1px dashed var(--line-2); color: var(--ink-3); font-size: var(--caption); line-height: 1.45; }
.model-card.ok .model-status { color: var(--green-600); }
.model-card.error .model-status { color: var(--red-600); }

/* ─── Chrome ─── */
/* the menu scrolls away so the question desk can take the whole viewport */
.edu-header { position: static; }
.sec-head .to-desk { order: 2; display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-display); font-weight: 600; font-size: var(--body-sm); }
.sec-head .to-desk .lucide { width: 16px; height: 16px; }

/* ─── Desk: inputs left, answers right, one viewport tall ─── */
.workbench { padding: var(--sp-4) 0; scroll-margin-top: 0; }
.desk { --desk-h: calc(100dvh - 2 * var(--sp-4)); max-width: 1240px; padding-inline: clamp(24px, 5vw, 72px); box-sizing: content-box; height: var(--desk-h); min-height: 560px; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--sp-5); }
.desk-input, .desk-output { display: flex; flex-direction: column; gap: var(--sp-3); min-height: 0; }
.desk-input > *, .desk-output > * { flex-shrink: 0; }
.desk .sec-head h2 { font-size: var(--h3); }
.desk .presets { gap: 6px; }
.desk .presets .edu-overline { min-width: 6.5em; margin-right: 0; }
.desk .presets .btn-secondary { background: var(--surface); border: 1px solid var(--line-strong); }

/* ─── Inputs ─── */
.desk-input > .vega-inputs { flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.vega-inputs .field { display: flex; flex-direction: column; min-height: 0; }
.vega-inputs .field-state { flex: 2 1 0; }
.vega-inputs .field-questions { flex: 3 1 0; }
.field-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px var(--sp-3); }
.field-head label { font-family: var(--font-mono); font-weight: 500; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); cursor: pointer; }
.vega-inputs textarea { flex: 1 1 0; height: auto; min-height: 64px; resize: none; }
.vega-inputs textarea.code, #state { font-family: var(--font-mono); font-size: var(--body-sm); line-height: 1.55; }
.vega-inputs textarea[aria-invalid="true"] { border-color: var(--red); }
.kind-chip { margin-left: 6px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--paper-3); color: var(--ink-2); font-size: 10px; letter-spacing: .08em; }
.desk-actions { display: flex; align-items: center; gap: var(--sp-4); }
.run-hint { margin: 0; color: var(--ink-2); font-size: var(--caption); line-height: 1.45; }
.question-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.btn-tiny { gap: 5px; padding: 4px 10px; font-size: var(--caption); }
.btn-tiny .lucide { width: 14px; height: 14px; }
.question-tools .edu-overline { color: var(--ink-2); }
.question-tools .btn-secondary { background: var(--surface); border: 1px solid var(--line-strong); }
.btn-run { padding: 14px 28px; font-size: var(--body); }
.format-help summary { padding: 0; font-family: var(--font-mono); font-weight: 500; font-size: var(--caption); color: var(--ink-2); }
.format-help summary::before { width: 7px; height: 7px; }
.format-help .fine { margin-top: var(--sp-2); }
/* a loaded file's samples sit on one row that scrolls sideways */
.sample-list { display: flex; gap: 6px; flex-basis: 100%; overflow-x: auto; padding: 0 0 4px calc(6.5em + 6px); scrollbar-width: thin; }
.sample-list .btn { flex: none; white-space: nowrap; }
.sample-list .btn { padding: 6px 12px; font-size: var(--caption); background: var(--surface); border: 1px solid var(--line-strong); }
.samples-source { font-family: var(--font-mono); font-size: var(--caption); color: var(--ink-2); }
.samples-source:empty { display: none; }
.samples-source.has-skipped { color: var(--red-600); cursor: help; }
.presets .btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.input-error { margin: 0; padding: 12px 16px; border-radius: var(--r-md); background: var(--red-soft); color: var(--red-ink); font-size: var(--body-sm); font-weight: 500; }
.fine code { font-family: var(--font-mono); font-size: .95em; color: var(--ink); background: var(--paper-3); padding: .08em .35em; border-radius: var(--r-xs); }
kbd { padding: 1px 6px; border-radius: var(--r-xs); background: color-mix(in srgb, var(--ink) 12%, transparent); font-family: var(--font-mono); font-size: 11px; }

/* ─── Answers ─── */
.answers { flex: 1 1 0; min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-auto-rows: max-content; align-content: start; gap: var(--sp-4); padding: 2px 4px 2px 2px; overscroll-behavior: contain; }
.answers-empty { grid-column: 1 / -1; margin: 0; padding: 28px; border: 1px dashed var(--line-2); border-radius: var(--r-xl); color: var(--ink-3); font-family: var(--font-mono); font-size: var(--body-sm); }
.answer { display: flex; flex-direction: column; padding: 0; overflow: hidden; animation: answer-in .25s ease-out; }
.answer .lane-head h3 { margin: 0; font-family: var(--font-mono); font-weight: 500; font-size: var(--body); color: var(--ink); }
.answer .lane-body { padding: 16px 22px 8px; }
.chip-yellow { background: var(--yellow-soft); color: var(--yellow-ink); }
.headline { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 14px; }
.headline strong { font-family: var(--font-display); font-weight: 700; font-size: var(--h3); line-height: 1.1; color: var(--ink); overflow-wrap: anywhere; }
.headline span { font-family: var(--font-mono); font-size: var(--caption); color: var(--ink-2); }
.legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); margin: 0; font-family: var(--font-mono); font-size: var(--caption); color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend span:not([data-state="ready"]) { opacity: .5; }
.desk .verdict { flex: none; grid-template-columns: auto 1fr; gap: 4px var(--sp-3); padding: 14px 20px; border-radius: var(--r-lg); }
.desk .verdict strong { font-size: var(--h4); }
.desk .verdict p { margin: 0; font-size: var(--caption); line-height: 1.45; }
.swatch { display: inline-block; width: 22px; height: 10px; border-radius: var(--r-pill); }
.swatch-d1, .bar-d1 i { background: var(--yellow); }
.swatch-qwen, .bar-qwen i { background: var(--blue); }
.swatch-basal, .bar-basal i { background: var(--green); }
.head-chips { display: inline-flex; gap: 6px; }
.chip-red { background: var(--red-soft); color: var(--red-ink); }
.verdicts { display: grid; grid-template-columns: repeat(var(--lanes, 2), minmax(0, 1fr)); gap: var(--sp-2); margin: 0 0 14px; }
.v { display: grid; gap: 2px; margin: 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--paper-2); border-left: 4px solid var(--line-2); min-width: 0; }
.v-d1.filled { border-left-color: var(--yellow); }
.v-qwen.filled { border-left-color: var(--blue); }
.v-basal.filled { border-left-color: var(--green); }
.v small { color: var(--ink-2); }
.v strong { font-family: var(--font-display); font-weight: 700; font-size: var(--h4); line-height: 1.2; color: var(--ink); overflow-wrap: anywhere; }
.v span { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); overflow-wrap: anywhere; }
.v.skipped strong { color: var(--ink-3); }
/* three lanes do not fit side by side in a card: one row per model, name on the left */
.verdicts[data-lanes="3"] { grid-template-columns: 1fr; gap: 6px; }
.verdicts[data-lanes="3"] .v { grid-template-columns: minmax(96px, 7.5em) 1fr; column-gap: 12px; align-items: baseline; padding: 8px 12px; }
.verdicts[data-lanes="3"] .v small { grid-row: 1 / 3; align-self: center; }
.verdicts[data-lanes="3"] .v strong { font-size: var(--body-lg); overflow-wrap: normal; }
.dist .choice.pair { grid-template-columns: minmax(110px, 1.3fr) 1fr 52px; margin-bottom: 10px; }
.dist .choice-label { grid-template-columns: auto 1fr; gap: 8px; }
.dist .choice-label b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--body-sm); }
.dist .choice-label small:empty { display: none; }
.bars, .nums { display: grid; gap: 3px; }
.bars .bar { height: 9px; }
.bars .bar i { width: 0; transition: width .2s ease-out; }
.nums em { font-style: normal; text-align: right; font-family: var(--font-mono); font-size: 11px; line-height: 9px; color: var(--ink-2); }
.top-d1 .num-d1, .top-basal .num-basal, .top-qwen .num-qwen { color: var(--ink); font-weight: 600; }
.top-d1 .choice-label b, .top-basal .choice-label b, .top-qwen .choice-label b { color: var(--ink); }
.answer .flags { grid-template-columns: repeat(2, 1fr); padding: 12px 22px 18px; border-top: 1px dashed var(--line-2); margin-top: auto; }
.answer .flags:empty { display: none; }
.answer .flags dd { font-size: var(--body-sm); overflow-wrap: anywhere; }
.answer .flags .warn { background: var(--red-soft); }
.answer .flags .warn dt, .answer .flags .warn dd { color: var(--red-ink); }
.answer[data-abstain="true"] { border-color: var(--red); }
@keyframes answer-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── Raw ─── */
.raw .output { margin: 0; padding: 18px 28px 24px; border-top: none; max-height: 420px; overflow: auto; font-size: var(--caption); }

@media (prefers-reduced-motion: reduce) { .answer { animation: none; } }

/* ─── Responsive ─── */
/* narrow or short screens: the desk falls back to one long column in the page flow */
@media (max-width: 768px), (max-height: 600px) {
  .desk { height: auto; min-height: 0; grid-template-columns: minmax(0, 1fr); }
  .desk-input > .vega-inputs, .vega-inputs .field-state, .vega-inputs .field-questions, .answers { flex: none; }
  .vega-inputs textarea { flex: none; min-height: 200px; resize: vertical; }
  .answers { overflow: visible; }
}
@media (max-width: 768px) {
  .desk { padding-inline: 16px; }
  .model-grid { grid-template-columns: 1fr; }
  .intro-3 { grid-template-columns: 1fr; }
  .desk .presets .edu-overline { min-width: 0; }
  .sample-list { padding-left: 0; }
  .desk-actions { flex-direction: column; align-items: stretch; }
  .btn-tiny { min-height: 36px; }
  .answers { grid-template-columns: 1fr; }
  .answer .lane-head { flex-direction: row; align-items: center; }
  .raw .output { padding: 14px 20px 20px; }
}
