/* The essay and its stations. Reading measure for prose; stations break out
   to the full width. */
.essay { padding: 36px 0 24px; }
.essay .standfirst { font-size: 19px; line-height: 1.5; color: var(--ink-2); max-width: 46ch; margin: 10px 0 6px; }
.essay h1 { font-size: clamp(34px, 5vw, 56px); letter-spacing: -0.02em; max-width: 18ch; }
.essay .skip { font-size: 14px; }
.essay h2 { font-size: clamp(24px, 3vw, 34px); margin: 56px 0 14px; max-width: 24ch; }
.essay h2 small { display: block; font: 500 12px/1.4 var(--font-mono); color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 8px; }
.essay .prose { max-width: var(--measure); font-size: 17px; line-height: 1.65; }
.essay .prose p { margin: 0 0 1.1em; }
.essay .aside { max-width: var(--measure); border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; color: var(--ink-2); font-size: 15.5px; margin: 18px 0; }

.station { margin: 26px 0 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.station .st-head { display: flex; align-items: baseline; gap: 12px; font: 500 12px/1.4 var(--font-mono); color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 14px; }
.station .st-head .meter { margin-left: auto; text-transform: none; letter-spacing: 0; }
.station .text { background: var(--ground); }
.station .two { display: grid; grid-template-columns: 1fr; gap: 18px; }
@media (min-width: 900px) { .station .two { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.9fr); align-items: start; } }
.station .inputs { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 14px; }
@media (min-width: 760px) { .station .inputs { grid-template-columns: 1fr 1fr auto; align-items: end; } }
.station .inputs .field { margin: 0; }
.station .inputs textarea { min-height: 62px; }
.station .strip-note { margin-top: 10px; }
.station .verdict { margin-top: 12px; }
.station .note { margin: 10px 0 0; }

/* sticky model bar */

/* ranked choice */
.ranked .sentence { font-size: 18px; line-height: 1.6; min-height: 3.2em; padding: 14px 16px; background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius-sm); white-space: pre-wrap; }
.station .row-inputs { margin-bottom: 4px; align-items: end; }
.station .row-inputs .field { margin: 0; }
.station .label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 5px; min-height: 19px; }
.station .label-row label { margin: 0; }
.station .label-row .hint { margin: 0; }
.station .row-inputs input[type="text"], .station .row-inputs .btn.wide, .station .row-inputs .range-box { height: 44px; box-sizing: border-box; }
.station .pair { display: grid; grid-template-columns: minmax(0, 1fr) 170px; gap: 12px; align-items: end; }
.station .range-box { display: flex; align-items: center; }
.station .range-box input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0; }
.station .box-label { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin: 12px 0 6px; }
.station .field + .box-label { margin-top: 14px; }
/* a box that is the opening and the output: typed in, locked while the model writes, open again after */
.text[contenteditable="true"] { cursor: text; transition: border-color var(--t-fast) var(--ease-snap); }
.text[contenteditable="true"]:focus { outline: none; border-color: var(--accent); }
.text .opening { color: var(--muted); }
.ranked .sentence .muted { color: var(--muted); }
.ranked .sentence[contenteditable="true"] { cursor: text; transition: border-color var(--t-fast) var(--ease-snap); }
.ranked .sentence[contenteditable="true"]:focus { outline: none; border-color: var(--accent); }
.ranked .sentence[contenteditable="false"] { background: var(--surface); }
.ranked .sentence:empty::before { content: attr(data-empty); color: var(--muted); }
.ranked .caret { display: inline-block; width: 2px; height: 1em; background: var(--accent); vertical-align: -0.15em; margin-left: 2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { to { visibility: hidden; } }
.ranked ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ranked li { display: grid; grid-template-columns: 34px minmax(80px, 140px) 1fr 44px; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 13px; padding: 4px 8px; border-radius: 5px; transition: background-color var(--t-fast) var(--ease-snap); }
.ranked li { transition: background-color var(--t-fast) var(--ease-out), opacity var(--t-fast) var(--ease-out); }
.ranked li.took { background: var(--accent-soft); }
.ranked li.took .piece { color: var(--ink); font-weight: 600; }
.ranked ol.chosen li:not(.took) { opacity: 0.45; }
.ranked .list-head { font: 11px/1.4 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.ranked ol:empty::before { content: "the top 8 for each word appears here"; font: 13px var(--font-body); color: var(--muted); }
/* the chosen word travels from its row into the sentence */
.fly-word { position: fixed; z-index: 20; pointer-events: none; font-size: 18px; line-height: 1.6; color: var(--ink); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; white-space: pre; }
.ranked li .rank { color: var(--muted); }
.ranked li .bar { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.ranked li .bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform var(--t-move) var(--ease-out); }
.ranked li .pct { text-align: right; color: var(--ink-2); }
.ranked .controls { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.ranked .controls label { display: flex; align-items: center; gap: 8px; }
.ranked input[type="range"] { accent-color: var(--accent); width: 160px; }
.ranked .caption { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; min-height: 1.4em; }

/* evidence meter */
.evidence { font-size: 14px; }
.ev-row { display: flex; align-items: baseline; gap: 10px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.ev-row span { flex: 1; color: var(--ink-2); }
.ev-row b { font-family: var(--font-mono); }
.ev-row small { color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.ev-bar { position: relative; height: 10px; background: var(--surface-2); border-radius: 5px; margin: 10px 0; overflow: visible; }
.ev-bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transform-origin: left; transition: transform var(--t-move) var(--ease-out); }
.ev-bar b { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--ink); }
.ev-verdict { margin: 10px 0 0; color: var(--ink); }
.tok.ev-ok { border-bottom-color: var(--ok); }
.tok.ev-flip { border-bottom-color: var(--warn); }
.tok.ev-lost { border-bottom-color: var(--warn); border-bottom-style: dashed; }

/* lineup bars */
.lu-grid { display: grid; gap: 6px; }
.lu-writer { font-size: 13px; color: var(--muted); margin: 12px 0 2px; }
.lu-row { display: grid; grid-template-columns: 100px 1fr 44px 90px; gap: 10px; align-items: center; font-size: 13px; }
.lu-row.self .lu-bar i { background: var(--ok); }
.lu-name { font-family: var(--font-mono); }
.lu-bar { position: relative; height: 10px; background: var(--surface-2); border-radius: 5px; }
.lu-bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transform-origin: left; }
.lu-bar b { position: absolute; top: -3px; width: 1px; height: 16px; background: var(--line-strong); }
.lu-pct { font-family: var(--font-mono); text-align: right; }
.lu-label { color: var(--muted); }

/* the full tool at the bottom */
.tool-section { border-top: 1px solid var(--line); margin-top: 56px; padding-top: 32px; }
.tool-section h2 { font-size: clamp(24px, 3vw, 34px); margin: 0 0 6px; }

/* the model that loads on arrival: a fixed card with a bar and a cancel button */
.autoload {
  position: fixed; right: 20px; bottom: 20px; z-index: 40; width: min(400px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--ground); border: 1px solid var(--line-strong); border-left: 3px solid var(--accent); border-radius: var(--radius-sm);
  padding: 12px 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.08); font-size: 13.5px; line-height: 1.45; color: var(--ink-2);
  transition: opacity var(--t-move) var(--ease-out), transform var(--t-move) var(--ease-out);
}
.autoload b { color: var(--ink); }
.autoload.off { opacity: 0; transform: translateY(6px); pointer-events: none; }
.al-bar { height: 3px; background: var(--line); border-radius: 2px; margin: 10px 0 8px; overflow: hidden; }
.al-bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 300ms var(--ease-out); }
.al-bar.wait i { transform: none; width: 30%; animation: al-slide 1.2s var(--ease-in-out) infinite; }
@keyframes al-slide { from { translate: -100% 0; } to { translate: 340% 0; } }
.al-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 12px/1.2 var(--font-mono); color: var(--muted); }
.autoload .btn { padding: 5px 10px; font-size: 12px; }
.al-more { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.al-more summary { cursor: pointer; font-size: 12.5px; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 6px; }
.al-more summary::-webkit-details-marker { display: none; }
.al-more summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); transition: transform var(--t-fast) var(--ease-snap); }
.al-more[open] summary::before { transform: rotate(45deg); }
.al-more summary:hover { color: var(--ink); }
.al-req { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.al-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.al-list button {
  width: 100%; text-align: left; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  border: 1px solid var(--line); border-radius: 6px; background: var(--surface); padding: 6px 9px; cursor: pointer;
  font: inherit; font-size: 12.5px; line-height: 1.35; color: var(--ink-2);
  transition: border-color var(--t-fast) var(--ease-snap), background-color var(--t-fast) var(--ease-snap);
}
.al-list button:hover:not(:disabled) { border-color: var(--line-strong); background: var(--ground); }
.al-list button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.al-list button:disabled { opacity: 0.55; cursor: default; }
.al-list b { color: var(--ink); font-weight: 600; }
.al-list i { font: 11px/1.2 var(--font-mono); font-style: normal; color: var(--accent); margin-left: auto; }
.al-list span { flex: 1 1 100%; }
/* shrunk to a pill once the model is in (or the download was cancelled); click to reopen */
.autoload.mini { width: auto; padding: 0; }
.autoload.mini .al-body { display: none; }
.al-pill { border: 0; background: none; padding: 9px 12px; font: inherit; font-size: 12.5px; color: var(--ink-2); cursor: pointer; display: flex; gap: 6px; align-items: center; }
.al-pill b { color: var(--ink); }
.al-pill u { color: var(--accent); text-decoration: none; }
.al-pill:hover u { text-decoration: underline; }
