/* yumthumb, the app. One job per screen: a large transcript box in the middle of the home screen, a slim
   sidebar for everything else, and the finished package as tabs. Red is kept for the one button that
   spends money and for what JEV picked. */
@font-face { font-family: 'Geist'; src: url(fonts/geist.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Geist Mono'; src: url(fonts/geist-mono.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  --paper: #fafafa;
  --surface: #ffffff;
  --ink: #111111;
  --soft: #444444;
  --muted: #6b6b6b;
  --line: #ebebeb;
  --line2: #dcdcdc;
  --hover: #f2f2f2;
  --red: #e5261b;
  --tint: #fdecea;
  --mark: #fdecea;
  --rec: #d3271d;
  --done: #15803d;
  --donebg: #ecfdf3;
  --lift: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -12px rgba(0, 0, 0, 0.12);
  --ui: 'Geist', system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: var(--ui);
  --mono: 'Geist Mono', ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 0.9rem/1.55 var(--ui);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
code { font-family: var(--mono); font-size: 0.9em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
svg.ic { width: 1rem; height: 1rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Frame ---------- */
.app { display: grid; grid-template-columns: 14.5rem minmax(0, 1fr); height: 100vh; height: 100dvh; }

/* ---------- Sidebar ---------- */
.side { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.75rem 0.6rem; background: var(--surface); border-right: 1px solid var(--line); min-height: 0; }
.brand { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; padding: 0.35rem 0.5rem 0.85rem; }
.brand a { display: flex; align-items: center; gap: 0.55rem; color: inherit; text-decoration: none; }
.brand img { width: 1.65rem; height: 1.65rem; border-radius: 7px; }
.newb { display: flex; align-items: center; gap: 0.5rem; border: 1px solid var(--line2); background: var(--surface); padding: 0.42rem 0.6rem; font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); margin-bottom: 0.6rem; }
.newb:hover { border-color: var(--ink); }
kbd { font: 400 0.68rem var(--mono); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 0.3rem; }
.newb kbd { margin-left: auto; }
.navs { display: grid; gap: 0.1rem; }
.nav { display: flex; align-items: center; gap: 0.55rem; width: 100%; border: 0; background: none; border-radius: 7px; padding: 0.38rem 0.5rem; text-align: left; color: var(--soft); }
.nav:hover { background: var(--hover); color: var(--ink); }
.nav[aria-current] { background: var(--hover); color: var(--ink); font-weight: 500; }
.side h2 { font-size: 0.72rem; font-weight: 500; color: var(--muted); padding: 0.9rem 0.5rem 0.25rem; }
.runs { overflow: auto; min-height: 0; flex: 1; }
.runs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; border-radius: 7px; }
.runs li:hover, .runs li:focus-within, .runs li:has(.open.current) { background: var(--hover); }
.runs .open { text-align: left; background: none; border: 0; padding: 0.38rem 0.5rem; color: var(--soft); line-height: 1.3; min-width: 0; overflow-wrap: anywhere; }
.runs .open.current { color: var(--ink); font-weight: 500; }
.runs .when { display: block; font-size: 0.72rem; color: var(--muted); font-weight: 400; margin-top: 0.1rem; }
.runs .remove { background: none; border: 0; color: var(--muted); padding: 0.45rem 0.4rem; font-size: 0.7rem; opacity: 0; }
.runs li:hover .remove, .runs .remove:focus-visible { opacity: 1; }
.runs .remove:hover { color: var(--rec); }
.runs .none { display: block; color: var(--muted); font-size: 0.76rem; padding: 0.25rem 0.5rem; }
.runs .none:hover { background: none; }
/* The account row only shows once there is something to put in it (Sign out, on the hosted page). */
.me { display: none; align-items: center; gap: 0.3rem; padding: 0.5rem 0.25rem 0; border-top: 1px solid var(--line); }
.me:has(button) { display: flex; }
.ava { width: 1.6rem; height: 1.6rem; border-radius: 50%; background: linear-gradient(135deg, #e5261b, #ffb020); flex: none; margin-left: 0.25rem; }

/* ---------- Main ---------- */
.doc { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.crumb { color: var(--muted); margin-right: auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb b { color: var(--ink); font-weight: 500; }
.key-state { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid #f3c7c3; background: var(--tint); color: var(--rec); border-radius: 99px; padding: 0.15rem 0.65rem; font-size: 0.78rem; white-space: nowrap; }
.key-state::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--rec); }
.key-state.ready { border-color: #c7ecd3; background: var(--donebg); color: var(--done); }
.key-state.ready::before { background: var(--done); }
.scroll { flex: 1; overflow: auto; min-height: 0; }
.home { max-width: 49.5rem; margin: 0 auto; padding: 3.5rem 1.5rem 0; }
.home-head { text-align: center; margin-bottom: 1.6rem; }
.home-head h2 { font-size: 1.9rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.15; }
.home-head p { color: var(--muted); font-size: 0.95rem; margin-top: 0.4rem; }
.stage { max-width: 49.5rem; margin: 0 auto; padding: 0 1.5rem 5rem; }

.cbox { background: var(--surface); border: 1px solid var(--line2); border-radius: 16px; box-shadow: var(--lift); }
.cbox:focus-within { border-color: #b5b5b5; }
.cbox textarea { display: block; width: 100%; border: 0; background: none; resize: none; padding: 1.1rem 1.25rem 0.5rem; font-size: 0.95rem; line-height: 1.6; outline: none; }
#transcript { min-height: 8rem; }
#transcript.dropping { background: var(--tint); border-radius: 16px 16px 0 0; }
::placeholder { color: #9a9a9a; }
.notes { border-top: 1px solid var(--line); }
.notes:not([open]) { display: none; }
.notes textarea { padding: 0.8rem 1.25rem; font-size: 0.9rem; }
.crow { display: flex; align-items: center; gap: 0.5rem; padding: 0.6rem 0.75rem; border-top: 1px solid var(--line); flex-wrap: wrap; }
.crow .count { margin-left: auto; }
.count { color: var(--muted); font-size: 0.78rem; }
.ghost { display: inline-flex; align-items: center; gap: 0.4rem; border: 1px solid var(--line); background: var(--surface); padding: 0.32rem 0.65rem; font-size: 0.82rem; color: var(--soft); white-space: nowrap; }
.ghost:hover { border-color: var(--line2); background: var(--paper); }
.stack { display: inline-flex; }
.mg { width: 1.15rem; height: 1.15rem; border-radius: 50%; color: #fff; font-size: 0.62rem; font-weight: 600; display: inline-grid; place-items: center; border: 1.5px solid #fff; margin-left: -0.3rem; flex: none; }
.stack .mg:first-child { margin-left: 0; }
.primary { background: var(--red); color: #fff; border: 0; border-radius: 9px; padding: 0.5rem 0.9rem; font-weight: 600; white-space: nowrap; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.25) inset, 0 1px 2px rgba(229, 38, 27, 0.4); }
.primary:hover { background: #cf2118; }
.primary.stop { background: var(--ink); box-shadow: none; }
.primary:disabled { background: #e3e3e3; color: #9a9a9a; cursor: default; box-shadow: none; }
.quiet { background: var(--surface); border: 1px solid var(--line2); padding: 0.38rem 0.8rem; font-weight: 500; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.quiet:hover { border-color: var(--ink); }
.link { background: none; border: 0; padding: 0; color: var(--muted); font-size: 0.8rem; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }
.error { color: var(--rec); font-size: 0.85rem; margin-top: 0.5rem; }
.composer .error { padding: 0 0.5rem; }
.makes { display: flex; justify-content: center; flex-wrap: wrap; gap: 0.4rem 1.1rem; color: var(--muted); font-size: 0.8rem; margin: 0.9rem 0 2.6rem; }
.makes li { display: inline-flex; align-items: center; gap: 0.35rem; }

/* ---------- Writers (a dialog) ---------- */
.field-head { display: flex; align-items: baseline; justify-content: space-between; }
input[type="search"], input[type="password"], input[type="text"], dialog textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 8px;
}
input:focus-visible, dialog textarea:focus-visible { outline: none; border-color: var(--ink); }
.chosen { margin: 0 -0.5rem 0.6rem; }
.chosen li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0.6rem; align-items: center; padding: 0.35rem 0.5rem; border-radius: 8px; font-size: 0.86rem; }
.chosen li:hover { background: var(--hover); }
.chosen .mg { width: 1.4rem; height: 1.4rem; border-radius: 7px; border: 0; margin: 0; font-size: 0.68rem; }
.chosen .id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chosen .price { font: 400 0.72rem var(--mono); color: var(--muted); white-space: nowrap; }
.chosen .gone { color: var(--rec); }
.chosen .data-note { grid-column: 2 / -1; font-size: 0.74rem; line-height: 1.35; color: var(--soft); border-left: 2px solid var(--red); padding-left: 0.45rem; }
.chosen button { background: none; border: 0; color: var(--muted); padding: 0 0.3rem; font-size: 1.05rem; line-height: 1; }
.chosen button:hover { color: var(--rec); }
.adder { position: relative; font-size: 0.86rem; }
.matches { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 15rem; overflow: auto; background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; padding: 0.25rem; box-shadow: var(--lift); }
.matches li { padding: 0.35rem 0.5rem; border-radius: 6px; font-size: 0.82rem; cursor: pointer; display: flex; justify-content: space-between; gap: 0.75rem; }
.matches li span:last-child { font: 400 0.72rem var(--mono); color: var(--muted); white-space: nowrap; }
.matches li:hover, .matches li.active { background: var(--hover); }
.optional { margin-top: 1.1rem; padding-top: 0.9rem; border-top: 1px solid var(--line); }
.optional h3 { font-size: 0.86rem; font-weight: 600; }
.optional > p { color: var(--muted); font-size: 0.78rem; line-height: 1.4; margin: 0.15rem 0 0.5rem; }
dialog .optional label { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; font-size: 0.86rem; margin: 0.35rem 0 0; cursor: pointer; }
.optional input { accent-color: var(--red); width: 0.95rem; height: 0.95rem; margin: 0; flex: none; }
.optional input:disabled + span { color: var(--muted); }
.optional .notice-on { font-size: 0.78rem; line-height: 1.4; margin: 0.25rem 0 0.5rem 1.45rem; padding: 0.35rem 0.5rem; background: var(--tint); border-radius: 6px; color: var(--ink); }
#writers { width: min(34rem, 94vw); max-height: 92vh; overflow: auto; }

/* ---------- Under the transcript box ---------- */
.welcome { display: grid; gap: 1.75rem; }
.welcome a, dialog a { color: inherit; text-underline-offset: 3px; }
.welcome .needs { color: var(--muted); text-align: center; }
.welcome .needs button { display: block; margin: 0.6rem auto 0; }
.welcome h3 { font-size: 0.8rem; font-weight: 500; color: var(--muted); margin-bottom: 0.55rem; }
.recent { display: grid; }
.rec { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 1rem; margin-bottom: 0.5rem; }
.rec:hover { border-color: var(--line2); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.rec b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rec span { color: var(--muted); font: 400 0.76rem var(--mono); white-space: nowrap; }
.about { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.8rem 1rem; }
.about summary { cursor: pointer; color: var(--soft); font-weight: 500; }
.about ol { margin: 0.8rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.45rem; color: var(--soft); }
.about .terms { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid var(--line); display: grid; gap: 0.5rem; font-size: 0.86rem; color: var(--soft); }

/* ---------- The document ---------- */

.notice { background: var(--tint); border-radius: 10px; padding: 0.75rem 1rem; margin-bottom: 1.5rem; }
.notice button { margin-top: 0.6rem; }

.panel { padding: 1.4rem 0 1.5rem; border-top: 1px solid var(--line); }
.panel:first-child { border-top: 0; padding-top: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; }
.panel-head h2, .section h2 { font-size: 0.95rem; font-weight: 600; }
.panel-head p { color: var(--muted); font-size: 0.8rem; }
.lane { display: grid; grid-template-columns: minmax(8rem, 15rem) minmax(3rem, 1fr) 3.6rem 4.2rem; gap: 0.8rem; align-items: center; padding: 0.22rem 0; font-size: 0.82rem; }
.lane .id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lane .track { height: 0.3rem; background: var(--hover); border-radius: 99px; overflow: hidden; }
.lane .fill { height: 100%; width: 0; background: var(--ink); border-radius: 99px; }
.lane.running .fill { width: 100%; background: repeating-linear-gradient(110deg, var(--red) 0 14px, #f59a94 14px 28px); background-size: 200% 100%; animation: roll 1.1s linear infinite; }
.lane.error .fill { width: 100%; background: var(--rec); opacity: 0.3; }
.lane .time, .lane .cost { text-align: right; font: 400 0.75rem var(--mono); color: var(--muted); }
.lane .why { grid-column: 2 / -1; color: var(--rec); font-size: 0.78rem; margin-top: -0.15rem; }
.lane .gap { grid-column: 2 / -1; color: var(--muted); font-size: 0.78rem; margin-top: -0.15rem; }
.judging { margin-top: 0.75rem; color: var(--muted); font-size: 0.85rem; }
@keyframes roll { to { background-position: -56px 0; } }
@media (prefers-reduced-motion: reduce) { .lane.running .fill { animation: none; } }

.section { padding: 1.4rem 0 1.5rem; border-top: 1px solid var(--line); scroll-margin-top: 0.5rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.section-head p { color: var(--muted); font-size: 0.8rem; text-align: right; }
.section-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.15rem; }
.link { border: 0; background: none; padding: 0; font-size: 0.8rem; font-weight: 500; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line2); }
.link:hover { text-decoration-color: var(--ink); }
.link:disabled { color: var(--muted); cursor: progress; }
.why { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 1.1rem 1.25rem; margin: 0 0 1.25rem; }
.why h3 { font-size: 0.95rem; font-weight: 600; margin-bottom: 0.35rem; }
.why h4 { font-size: 0.78rem; font-weight: 600; color: var(--muted); margin: 1rem 0 0.25rem; }
.why p { font-size: 0.86rem; line-height: 1.55; color: var(--soft); max-width: 72ch; }
.why .asked { border-left: 2px solid var(--line2); padding-left: 0.75rem; }
.why .fine { font-size: 0.78rem; color: var(--muted); margin-top: 0.8rem; }
.why-scroll { overflow-x: auto; }
.why table { width: 100%; border-collapse: collapse; font-size: 0.82rem; min-width: 34rem; }
.why th, .why td { text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.why thead th { font-weight: 500; color: var(--muted); font-size: 0.76rem; }
.why tbody th { font-weight: 500; color: var(--ink); max-width: 22rem; }
.why tbody tr:last-child th, .why tbody tr:last-child td { border-bottom: 0; }
.why tr.passed th { color: var(--soft); font-weight: 400; }
.why .tag { display: block; font-size: 0.7rem; font-weight: 500; color: var(--muted); }
.why .meter { display: block; width: 4.5rem; height: 5px; border-radius: 3px; background: var(--line); margin: 0.3rem 0 0.25rem; overflow: hidden; }
.why .meter i { display: block; height: 100%; background: var(--ink); border-radius: 3px; }
.why tr.passed .meter i { background: var(--muted); }
.why .word { color: var(--soft); }
.pick { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.3rem 1.25rem; align-items: start; padding: 0.7rem 0.8rem; margin: 0 -0.8rem 0.4rem; border-radius: 10px; }
.pick .body { line-height: 1.6; max-width: 68ch; white-space: pre-wrap; color: var(--soft); }
.pick .meta { grid-column: 1; color: var(--muted); font-size: 0.78rem; }
.pick .actions { grid-row: 1; grid-column: 2; display: flex; flex-direction: column; gap: 0.3rem; align-items: stretch; }
.copy { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 0.2rem 0.65rem; font-size: 0.78rem; color: var(--soft); white-space: nowrap; }
.copy:hover { border-color: var(--ink); }
.copy.copied { background: var(--ink); border-color: var(--ink); color: #fff; }
.pick.title .body { font-size: 1rem; font-weight: 500; line-height: 1.35; white-space: normal; color: var(--ink); }
/* JEV's first choice in a section is the large one in red. With no judging there is a note above the
   picks, so nothing is marked. */
.pick.lead { background: var(--tint); border-radius: 14px; padding: 1.1rem 1.25rem; margin: 0 0 1.25rem; }
.pick.lead::before { content: var(--pick-badge, "The judge's pick"); grid-column: 1 / -1; justify-self: start; font-size: 0.72rem; font-weight: 600; color: #fff; background: var(--red); border-radius: 5px; padding: 0.12rem 0.45rem; }
.pick.lead .actions { grid-row: 2; }
.pick.lead .body { color: var(--ink); }
.pick.lead.title .body { font-size: 1.5rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.pick .lead { font-weight: 600; color: var(--ink); display: block; margin-bottom: 0.25rem; }
.pick .aside { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 0.45rem; }
.pick .subject { font-weight: 600; font-size: 1.05rem; line-height: 1.35; display: block; color: var(--ink); }
.pick .preview { display: block; color: var(--muted); margin: 0.15rem 0 0.8rem; padding-bottom: 0.8rem; border-bottom: 1px solid var(--line); }
.unjudged { background: var(--tint); border-radius: 8px; padding: 0.5rem 0.8rem; margin-bottom: 0.8rem; font-size: 0.85rem; }

details.all { margin-top: 0.6rem; }
details.all > summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; width: fit-content; }
details.all > summary:hover, details.all[open] > summary { color: var(--ink); }
details.all[open] > summary { margin-bottom: 0.5rem; }
.cand { display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; gap: 0.8rem; align-items: start; padding: 0.5rem 0; border-top: 1px solid var(--line); }
.cand .odds { font: 400 0.75rem var(--mono); color: var(--muted); padding-top: 0.2rem; }
.cand .text { line-height: 1.5; white-space: pre-wrap; max-width: 68ch; color: var(--soft); }
.cand .text strong { display: block; color: var(--ink); font-weight: 600; }
.cand .who { display: block; color: var(--muted); font-size: 0.74rem; margin-top: 0.15rem; white-space: normal; }
.cand.picked .odds { color: var(--red); font-weight: 500; }
.receipt { border-top: 1px solid var(--line); padding-top: 1rem; color: var(--muted); font-size: 0.8rem; }

/* ---------- A finished run: title, tabs, the section, and the cost beside it ---------- */
.app.has-run .home { display: none; }
.app.is-live .home-head, .app.is-live .makes, .app.is-live .cbox textarea, .app.is-live .notes, .app.is-live .ghost { display: none; }
.app.is-live .home { padding-top: 1.5rem; }
.app.is-live .makes + * { margin-top: 0; }
.app.is-live .stage { padding-top: 1.5rem; }
.stage.result { max-width: none; margin: 0; padding: 0; min-height: 100%; display: flex; flex-direction: column; background: var(--surface); }
.stage.result > .notice { margin: 1.25rem 2rem 0; }
.runhead { position: sticky; top: 0; z-index: 3; background: var(--surface); padding: 1.4rem 2rem 0; border-bottom: 1px solid var(--line); }
.runhead-row { display: flex; align-items: flex-start; gap: 1rem; }
.runhead h1 { font-size: 1.5rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; margin-right: auto; max-width: 32ch; }
.runhead-acts { display: flex; gap: 0.5rem; align-items: center; flex: none; }
.runhead-acts .copy { padding: 0.45rem 0.8rem; font-size: 0.82rem; }
.tabs { display: flex; gap: 0.25rem; margin-top: 1.1rem; overflow-x: auto; }
.tabs button { border: 0; background: none; border-radius: 0; padding: 0.55rem 0.75rem 0.7rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; display: flex; gap: 0.45rem; align-items: center; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-color: var(--red); }
.tabs i { font: 400 0.72rem var(--mono); color: var(--muted); background: var(--paper); border-radius: 99px; padding: 0.05rem 0.45rem; }
.runbody { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 19rem; }
.pane { padding: 1.6rem 2rem 4rem; max-width: 50rem; min-width: 0; }
.pane .section { border-top: 0; padding: 0; }
.pane .pick:not(.pick.lead) { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
.tabs button:focus-visible { outline-offset: -2px; }
.pane .section-head h2 { font-size: 0.8rem; font-weight: 500; color: var(--muted); }
.rail { border-left: 1px solid var(--line); background: var(--paper); padding: 1.5rem 1.25rem 4rem; }
.rail h2 { font-size: 0.75rem; font-weight: 500; color: var(--muted); margin-bottom: 0.2rem; }
.rail .total { font-size: 2.1rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
.rail-note { color: var(--muted); font-size: 0.78rem; line-height: 1.45; margin: 0.3rem 0 1.2rem; }
.costs { margin-bottom: 1.2rem; }
.costs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.2rem 0.5rem; font-size: 0.82rem; padding: 0.28rem 0; }
.costs .id { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.costs .amt { font: 400 0.72rem var(--mono); color: var(--muted); white-space: pre; }
.costs .bar { grid-column: 1 / -1; height: 3px; border-radius: 9px; background: var(--hover); overflow: hidden; }
.costs .bar i { display: block; height: 100%; background: var(--ink); }
.costs .bad { color: var(--muted); }
.costs .why { grid-column: 1 / -1; font-size: 0.74rem; color: var(--rec); }
.costs li:not(.bad) .why { color: var(--muted); }

/* ---------- Dialogs ---------- */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 1.5rem 1.6rem; width: min(30rem, 92vw); background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18); }
dialog::backdrop { backdrop-filter: blur(2px); }
dialog::backdrop { background: rgba(25, 25, 25, 0.35); }
dialog h2 { font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; margin-bottom: 0.4rem; }
dialog p { font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
dialog label { display: block; font-weight: 500; font-size: 0.85rem; margin: 0.85rem 0 0.3rem; }
dialog textarea { resize: vertical; line-height: 1.5; display: block; }
dialog .hint { font-size: 0.78rem; margin: 0.35rem 0 0; }
.other-route { margin-top: 1.1rem; }
.other-route summary { cursor: pointer; color: var(--muted); font-size: 0.82rem; }
dialog .saved { font-weight: 400; color: var(--done); font-size: 0.78rem; }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.6rem; margin-top: 1.4rem; }
.dialog-actions button { white-space: nowrap; }
.dialog-actions .link { margin-right: auto; }
.dialog-actions .quiet, .dialog-actions .primary { padding: 0.5rem 0.95rem; }

.fill { display: flex; gap: 0.5rem; }
.fill input { flex: 1; min-width: 0; }
.fill button { white-space: nowrap; }
dialog .hint.error { color: var(--rec); }

/* ---------- Setup guide ---------- */
#guide { width: min(34rem, 94vw); }
.guide-steps { list-style: none; padding: 0; display: flex; gap: 0.4rem; margin-bottom: 1.4rem; font-size: 0.78rem; color: var(--muted); }
.guide-steps li { flex: 1; display: flex; align-items: center; gap: 0.45rem; padding-top: 0.6rem; border-top: 2px solid var(--line); white-space: nowrap; }
.guide-steps span { width: 1.3rem; height: 1.3rem; border-radius: 50%; display: grid; place-items: center; background: var(--hover); font-size: 0.72rem; font-weight: 600; flex: none; }
.guide-steps .now { color: var(--ink); font-weight: 500; border-color: var(--red); }
.guide-steps .now span { background: var(--red); color: #fff; }
.guide-steps .past { border-color: var(--ink); }
.guide-steps .past span { background: var(--ink); color: #fff; }
#guide p { font-size: 0.9rem; color: var(--soft); }
#guide .hint { font-size: 0.78rem; color: var(--muted); }
.guide-list { margin: 0 0 1rem; padding-left: 1.2rem; display: grid; gap: 0.35rem; font-size: 0.9rem; color: var(--soft); }
ol.guide-list { list-style: decimal; }
ul.guide-list { list-style: disc; }
.guide-notes { margin: 0 0 0.5rem; display: grid; gap: 0.15rem; max-height: 46vh; overflow: auto; padding: 0.8rem 1rem; background: var(--paper); border-radius: 10px; font-size: 0.86rem; }
.guide-notes dt { font-size: 0.74rem; color: var(--muted); margin-top: 0.5rem; }
.guide-notes dt:first-child { margin-top: 0; }
.guide-notes dd { margin: 0; white-space: pre-wrap; }
#guide .dialog-actions { flex-wrap: wrap; }

/* ---------- First-visit checklist ---------- */
.welcome .todo { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.todo li { background: var(--surface); display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); gap: 0.8rem; align-items: start; padding: 0.85rem 1rem; border: 1px solid var(--line); border-radius: 12px; }
.todo .tick { width: 1.5rem; height: 1.5rem; border-radius: 50%; border: 1.5px solid #cfcfca; display: grid; place-items: center; font-size: 0.8rem; font-weight: 700; color: #fff; }
.todo .done .tick { background: var(--done); border-color: var(--done); }
.todo li p { color: var(--ink); font-weight: 500; }
.todo .done p { color: var(--muted); font-weight: 400; }
.todo li button { margin-top: 0.45rem; }

/* ---------- Narrower windows ---------- */
@media (max-width: 68rem) {
  .runbody { grid-template-columns: 1fr; }
  .rail { border-left: 0; border-top: 1px solid var(--line); }
}

/* ---------- Phones: the sidebar becomes a strip across the top ---------- */
@media (max-width: 48rem) {
  html, body { height: auto; }
  .app { display: block; height: auto; }
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.3rem; padding: 0.5rem 0.6rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0.2rem 0.4rem; margin-right: auto; }
  .newb { margin: 0; }
  .newb kbd { display: none; }
  .navs { display: flex; flex-wrap: wrap; width: 100%; }
  .nav { width: auto; }
  .nav svg.ic { display: none; }
  .side h2 { display: none; }
  .runs { display: none; }
  .me { border-top: 0; padding: 0; }
  .ava { display: none; }
  .scroll { overflow: visible; }
  .topbar { padding: 0.5rem 0.75rem; }
  .crumb { display: none; }
  .home { padding: 1.75rem 0.9rem 0; }
  .home-head h2 { font-size: 1.5rem; }
  .stage { padding: 0 0.9rem 6rem; }
  .crow .count { margin-left: 0; }
  .crow .primary { flex: 1 1 100%; }
  .lane { grid-template-columns: minmax(0, 1fr) 3.4rem 4rem; }
  .lane .track { display: none; }
  .pick { grid-template-columns: 1fr; }
  .pick .actions { grid-row: auto; grid-column: 1; flex-direction: row; flex-wrap: wrap; }
  .pick.lead .actions { grid-row: auto; }
  .runhead { position: static; padding: 1.1rem 1rem 0; }
  .runhead-row { flex-direction: column; }
  .pane { padding: 1.25rem 1rem 2rem; }
  .rail { padding: 1.25rem 1rem 2rem; }
}

[hidden] { display: none !important; }

/* ---------- Four judges ---------- */
.views { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; margin: 0 0 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.views button { border: 0; background: none; padding: 0.28rem 0.7rem; font-size: 0.82rem; color: var(--soft); border-radius: 8px; }
.views button:hover { color: var(--ink); }
.views button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 500; box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.05); }
.views button.off { color: var(--muted); text-decoration: line-through; }
.board { border-top: 1px solid var(--line); padding-top: 1.1rem; margin: 0.5rem 0 1.25rem; }
.board h3 { font-size: 0.95rem; font-weight: 600; }
.board-note { font-size: 0.82rem; color: var(--muted); margin: 0.2rem 0 0.9rem; max-width: 70ch; }
.board .cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; }
.board .col { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0.75rem 0.85rem; min-width: 0; }
.board .col.off { background: var(--paper); }
.board h4 { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; font-size: 0.86rem; font-weight: 600; margin-bottom: 0.5rem; }
.board h4 .link { font-size: 0.86rem; font-weight: 600; }
.board h4 span { font-size: 0.7rem; font-weight: 400; color: var(--muted); }
.board ol { margin: 0; padding: 0; list-style: none; counter-reset: pick; display: grid; gap: 0.6rem; }
.board li { counter-increment: pick; font-size: 0.82rem; line-height: 1.4; color: var(--soft); padding-left: 1.3rem; position: relative; overflow-wrap: anywhere; }
.board li::before { content: counter(pick); position: absolute; left: 0; top: 0; font: 500 0.72rem var(--mono); color: var(--muted); }
.board li.shared { color: var(--ink); }
.board li span { display: block; font-size: 0.72rem; color: var(--muted); margin-top: 0.1rem; }
.board .failed { font-size: 0.8rem; color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 68rem) { .board .cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 34rem) { .board .cols { grid-template-columns: 1fr; } }
