:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --line: #e3e3df;
  --accent: #2f6f4f;
  --warn: #9a3412;
  --hot: #b91c1c;
  --sleeper: #7c3aed;
  --espn: #b91c1c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --panel: #1b1e24;
    --ink: #e8e8e6;
    --muted: #9aa1ad;
    --line: #2b2f37;
    --accent: #6ee7a8;
    --warn: #fbbf24;
    --hot: #f87171;
    --sleeper: #a78bfa;
    --espn: #fca5a5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

header {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}

.bar {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  /* `font: inherit` is shorthand and resets weight, so it has to come first —
     a font-weight above it is silently discarded. */
  font: inherit;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--ink);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
}
/* Both are desktop affordances; a phone has the burger. */
.railshut-btn { display: none; }
.bar nav a { display: inline-flex; align-items: center; gap: 8px; }

.bar nav {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: baseline;
  flex: 1;
}
.bar nav a { color: var(--muted); text-decoration: none; padding: 2px 0; }
.bar nav a:hover { color: var(--ink); }
.bar nav a.on { color: var(--ink); font-weight: 650; }
.spacer { margin-left: auto; }

/* Menu control. Hidden off-canvas rather than display:none so it stays
   reachable by keyboard. */
.nav-toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}
.burger { display: none; }
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

main { max-width: 1100px; margin: 0 auto; padding: 24px 20px 64px; }

h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 20px;
}

.scroll { overflow-x: auto; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

a { color: inherit; }

.tag {
  display: inline-block;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 650;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid currentColor;
}
.tag.sleeper { color: var(--sleeper); }

/* Marks your own team or player. Sits on the text baseline so it reads as part
   of the name rather than as a separate column of its own. */
.verified {
  display: inline-block;
  width: 15px;
  height: 15px;
  vertical-align: -2px;
  color: var(--sleeper);
  flex: 0 0 auto;
}
.verified svg { display: block; width: 100%; height: 100%; }

/* How much harder or easier than the league's average run-in. */
.sosdelta { font-size: 11.5px; }
.tag.espn { color: var(--espn); }

.pos {
  display: inline-block;
  min-width: 34px;
  text-align: center;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
}

.muted { color: var(--muted); }
.warn { color: var(--warn); }
.hot { color: var(--hot); font-weight: 600; }

.leagues { color: var(--muted); font-size: 13px; }

.meter {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  vertical-align: middle;
  margin-right: 8px;
}
.meter span { display: block; height: 100%; background: var(--accent); }

button {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 12px;
  cursor: pointer;
}
button:hover { border-color: var(--muted); }
button[disabled] { opacity: 0.6; cursor: default; }

.banner {
  border: 1px solid var(--warn);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 14px;
}
.banner code {
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 13px;
}
.banner p { margin: 10px 0 0; }

/* Collapsed by default so a long category list cannot push the board off
   screen; native <details> needs no JavaScript. */
details.banner summary {
  cursor: pointer;
  list-style: none;
}
details.banner summary::-webkit-details-marker { display: none; }
details.banner summary::after {
  content: " ▸";
  color: var(--muted);
  font-size: 11px;
}
details.banner[open] summary::after { content: " ▾"; }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.htmx-request .spin { opacity: 0.5; }

/* Assistant.
   A conversation, not a table: the reader's own words sit in a tinted bubble on
   the right, and the reply is plain prose across the column so long answers stay
   readable. */
.chat { display: flex; flex-direction: column; gap: 22px; margin: 4px 0 26px; }

.turn { max-width: 820px; }
.turn.you { align-self: flex-end; display: flex; justify-content: flex-end; max-width: 82%; }

.bubble {
  background: color-mix(in srgb, var(--accent) 13%, transparent);
  color: var(--ink);
  border-radius: 12px 12px 4px 12px;
  padding: 11px 15px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Rendered markdown. Spacing is tuned for answers that mix a sentence, a list
   and a table, which is what these replies actually look like. */
.prose { font-size: 15px; line-height: 1.62; overflow-wrap: anywhere; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p { margin: 0 0 12px; }
.prose strong { font-weight: 650; color: var(--ink); }
.prose em { font-style: italic; }

.prose h1, .prose h2, .prose h3 {
  margin: 20px 0 8px;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.prose h1 { font-size: 16px; }

.prose ul, .prose ol { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin: 3px 0; }
.prose li > p { margin: 0; }

.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
}
.prose pre {
  margin: 12px 0;
  padding: 11px 13px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-x: auto;
}
.prose pre code { border: none; background: none; padding: 0; font-size: 12px; line-height: 1.7; }

.prose blockquote {
  margin: 12px 0;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line);
  color: var(--muted);
}

.prose table { width: auto; margin: 12px 0; font-size: 13px; border-collapse: collapse; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.prose th { background: var(--bg); font-weight: 650; }

.prose hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }

/* What it looked up, stated quietly under the answer. */
.tools {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--muted);
}
.toolicon {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}

.ask { display: flex; gap: 10px; align-items: flex-start; }
.ask textarea {
  flex: 1;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  min-height: 76px;
  resize: vertical;
}
.ask textarea::placeholder { color: var(--muted); }
.ask textarea:focus { outline: none; border-color: var(--muted); }
.ask button { border-radius: 10px; padding: 10px 18px; }

.prompts { margin: 0 0 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.prompts a { color: var(--muted); }

/* Player headshots, hotlinked from Sleeper's CDN. Initials sit underneath so a
   missing image degrades to a coloured monogram instead of a broken icon. */
.pname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ptext { min-width: 0; }

/* The avatar clips its image, so the status chip lives on a wrapper that does
   not, letting it sit proud of the circle like a notification badge. */
.ava { position: relative; flex: 0 0 auto; line-height: 0; }

.chip {
  position: absolute;
  right: -3px;
  bottom: -2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 8px;
  border: 2px solid var(--panel);
  box-sizing: content-box;
  font-size: 9px;
  font-weight: 700;
  line-height: 15px;
  text-align: center;
  letter-spacing: 0.02em;
  color: #fff;
}
.chip.warn { background: #d97706; }
.chip.bad { background: #dc2626; }
.chip.mute { background: #6b7280; }

@media (prefers-color-scheme: dark) {
  .chip.warn { background: #f59e0b; color: #1a1a1a; }
  .chip.bad { background: #ef4444; }
  .chip.mute { background: #9aa1ad; color: #1a1a1a; }
}

.avatar {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  background: var(--line);
}
.avatar .initials {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--panel);
}

/* Team logos are artwork on a transparent ground, so they need padding and
   must not be cropped like a headshot. */
.avatar[data-pos="DEF"] { background: var(--bg); }
.avatar[data-pos="DEF"] img { object-fit: contain; object-position: center; padding: 3px; background: transparent; }

.avatar[data-pos="QB"] { background: #6d28d9; }
.avatar[data-pos="RB"] { background: #047857; }
.avatar[data-pos="WR"] { background: #b45309; }
.avatar[data-pos="TE"] { background: #1d4ed8; }
.avatar[data-pos="K"] { background: #64748b; }

/* Player names are links, but must not look like a wall of blue in a table. */
.plink { color: inherit; text-decoration: none; }
.plink:hover { text-decoration: underline; }

/* Stat lines: label travels with the number, so it reads at any width. */
.statgroup { white-space: nowrap; font-weight: 600; width: 1%; }
.statline { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.stat { display: flex; flex-direction: column; min-width: 58px; }
.statv { font-variant-numeric: tabular-nums; font-weight: 600; }
.statl {
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Player page header */
/* Breadcrumbs. Derived from what the page is about rather than how you got
   here, so they read the same however you arrived. */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs [aria-current="page"] { color: var(--ink); }
.crumbsep { color: var(--line); }

/* An NFL team, wherever one is named. */
.teamlink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--line); }
.teamlink:hover { color: var(--ink); border-bottom-color: var(--muted); }

/* A section heading with its own action on the same line. */
.sectionhead { margin-bottom: 6px; }
.sectionhead h1 { margin: 0; }
.sectionhead form { margin-left: auto; }

/* An icon-only control. 30px matches the drawer close and the sidebar collapse,
   which is this project's size for a secondary square button. */
.iconbtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.iconbtn:hover { color: var(--ink); border-color: var(--muted); }
.iconbtn:disabled { cursor: default; opacity: 0.6; }
/* The label is gone, so the icon has to say that something is happening. */
.iconbtn[data-busy] .icon { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .iconbtn[data-busy] .icon { animation: none; }
  .iconbtn[data-busy] { opacity: 0.6; }
}

/* Navigation icons. Sized once here so every glyph lines up whatever it draws,
   and coloured by inheritance so the active and hover states need no extra
   rules. */
.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: block;
}
.brand .icon { width: 20px; height: 20px; color: var(--accent); }
.bar nav a .icon { color: var(--muted); }
.bar nav a:hover .icon { color: var(--ink); }
.bar nav a.on .icon { color: var(--accent); }

/* A row that is present but switched off. Dimmed rather than removed, so the
   way back stays where the way out was. */
tr.dim td.primary { color: var(--muted); }
tr.dim .tag { opacity: 0.6; }

/* Secondary facts under a table row's title: platform, team, freshness. They
   are worth having and not worth a column each. */
.rowmeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11.5px;
}
.rowmeta .muted { color: var(--muted); }
.good { color: var(--accent); }

/* A rival team's crest, beside its name. */
.crest, .tipcrest {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--line);
}
.tipcrest { width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.vtipweek { display: flex; align-items: center; gap: 2px; }

/* Headline numbers at the top of the season tab. */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 22px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--panel);
}
.tilelabel {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tilenum { font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tilenote { color: var(--muted); font-size: 11.5px; }

/* Your own row in the league table. */
tr.mine td { background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* The head-to-head line at the top of the matchup tab. */
.scoreline {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  margin-bottom: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.scoreside { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.scoreside.right { align-items: flex-end; text-align: right; }
.scorename {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scorenum { font-size: 26px; font-variant-numeric: tabular-nums; }
.scoremid { flex: 0 0 auto; font-size: 13px; font-weight: 650; }

/* Marking a player off the board by hand, which is the only way to keep the
   ranking honest while ESPN publishes nothing mid-draft. */
.searchbox textarea {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  resize: vertical;
}
.searchbox textarea:focus { outline: none; border-color: var(--muted); }

.takenbtn {
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 9px;
  cursor: pointer;
}
.takenbtn:hover { color: var(--ink); border-color: var(--muted); }
.linkbtn {
  font: inherit;
  font-size: inherit;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
.linkbtn:hover { color: var(--ink); }

/* A pick that landed while you were watching. Fades rather than staying marked:
   it is news for a moment, then it is just another row. */
@keyframes justin {
  from { background: color-mix(in srgb, var(--accent) 26%, transparent); }
  to { background: transparent; }
}
tr.justin td { animation: justin 2.4s ease-out both; }

/* The draft is polling. */
.livedot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--accent);
  animation: livepulse 1.8s ease-in-out infinite;
}
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

@media (prefers-reduced-motion: reduce) {
  tr.justin td { animation: none; background: color-mix(in srgb, var(--accent) 14%, transparent); }
  .livedot { animation: none; }
}

/* Games already played, on a team's schedule. */
tr.past td { opacity: 0.55; }

.phead { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.phead h1 { margin: 0 0 2px; }
.phead .sub { margin: 0; }
.ava.big .avatar { width: 64px; height: 64px; }
.ava.big .avatar .initials { font-size: 22px; }
.ava.big .chip { min-width: 20px; height: 20px; line-height: 20px; font-size: 11px; right: -2px; }

/* Shown only on narrow screens; the wide layout has dedicated columns. */
.submeta, .only-narrow { display: none; }

/* The counterpart to .only-narrow: a column that earns its width on a desktop
   and crowds a phone out of the page. Used on figures that are a second view of
   something already in the table — best and worst week are the two ends of the
   swing beside them, projected wins is the playoff odds in another unit. */
@media (max-width: 720px) {
  .wide-only { display: none; }
}

/* Column legend, so no header is a guess. */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: -12px 0 18px;
  font-size: 12px;
  color: var(--muted);
}
.legend strong { color: var(--ink); font-weight: 600; }

/* GM board controls */
.controls { padding: 14px 16px; font-size: 13px; }
.controls .row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.controls .row + .row { margin-top: 8px; }
.controls .key {
  flex: 0 0 62px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.controls .opts { display: flex; gap: 12px; flex-wrap: wrap; flex: 1; }
.controls a { color: var(--muted); text-decoration: none; }
.controls a.on { color: var(--ink); font-weight: 600; }

/* Naming a player with @, inside the composer. The list sits above the caret
   rather than below it: the composer is at the foot of the column and a list
   hanging off the bottom would be off screen. */
.mentionbox { position: relative; }
.mentions .results {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.4);
}
.mentions .results li button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border: none;
  border-radius: 7px;
  background: none;
  cursor: pointer;
}
.mentions .results li button:hover,
.mentions .results li button.active { background: var(--line); }
.mentions .pname { display: flex; align-items: center; gap: 9px; }
.mentions .avatar { width: 26px; height: 26px; }
.mentions .avatar .initials { font-size: 10px; }
.mentions .ptext { font-size: 14px; min-width: 0; }
.mentions .submeta {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

/* The app's dropdown, built rather than borrowed.
   The native select's popup is drawn by the operating system and ignores every
   rule here, which is why a styled select still opened a menu from a different
   application. The list below is ours; the select itself stays in the DOM and
   keeps the value, the change event and the no-script fallback. */
.ftselect { position: relative; display: inline-flex; max-width: 100%; }
.ftselect-native {
  /* Present for the form, out of the way visually and for the reader, who is
     given the listbox instead. */
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.ftselect-btn {
  font: inherit;
  font-size: 14px;
  text-align: left;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 34px 8px 12px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.ftselect-btn:hover { border-color: var(--muted); }
.ftselect.open .ftselect-btn { border-color: var(--muted); }
.ftselect-btn:focus-visible { outline: none; border-color: var(--accent); }

.ftselect-list {
  position: absolute;
  top: calc(100% + 6px);
  /* Anchored to the trigger's right edge, not its left. An option can be longer
     than the selected value — "Sundays Are For The Boys Dynasty FFL" is — so the
     list grows wider than the button, and growing rightward from a control that
     already sits at the right edge of the page ran it off the screen. Growing
     leftward from the same edge keeps it in view wherever the trigger is. */
  right: 0;
  left: auto;
  min-width: 100%;
  /* And never wider than the window, whatever the longest league is called. */
  max-width: min(420px, calc(100vw - 24px));
  max-height: 300px;
  overflow-y: auto;
  z-index: 40;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}
.ftselect-option {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ftselect-option:hover,
.ftselect-option.active { background: var(--line); }
/* The chosen row keeps a mark of its own, so the keyboard cursor and the
   current value are never confused for one another. */
.ftselect-option[aria-selected="true"] { color: var(--accent); font-weight: 650; }

/* The app's dropdown. One definition, used everywhere a select appears, so no
   surface falls back to the browser's own control and looks borrowed from a
   different application.

   It stays a native select: the styling is ours, but the keyboard handling,
   the mobile picker and the screen-reader behaviour are the platform's, which
   a hand-built listbox would have to reimplement and would get wrong. */
.controls select,
.leaguepick select,
.select {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 34px 8px 12px;
  max-width: 100%;
  cursor: pointer;
  /* Native arrows do not follow the theme, so draw one. */
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.controls select:focus,
.leaguepick select:focus,
.select:focus { outline: none; border-color: var(--muted); }
.controls noscript button { margin-left: 8px; }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 720px) {
  body { font-size: 16px; }

  /* Header collapses to one row: wordmark left, menu button right. */
  .bar {
    padding: 0;
    gap: 0;
    align-items: center;
    flex-wrap: wrap;
  }
  .brand {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 15px 16px;
    font-size: 15px;
  }
  .spacer { display: none; }

  .burger {
    display: block;
    padding: 16px;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  /* The middle bar is the element itself; the outer two are absolutely
     positioned on top of it, so closing folds them into a true cross. In normal
     flow they stack instead of overlapping and the X comes out as an arrow. */
  .burger .bars {
    position: relative;
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: background 0.18s ease;
  }
  .burger .bars::before,
  .burger .bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 20px;
    height: 2px;
    border-radius: 2px;
    background: var(--ink);
    transition: transform 0.18s ease;
  }
  .burger .bars::before { top: -6px; }
  .burger .bars::after { top: 6px; }

  .nav-toggle:checked ~ .burger .bars { background: transparent; }
  .nav-toggle:checked ~ .burger .bars::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle:checked ~ .burger .bars::after { transform: translateY(-6px) rotate(-45deg); }
  .nav-toggle:focus-visible ~ .burger { outline: 2px solid var(--accent); outline-offset: -4px; }

  /* The panel must claim a whole row of its own. `flex: 1` from the desktop
     rule sets a zero basis, which is what squashed this into a column. */
  .bar nav {
    flex: 0 0 100%;
    order: 3;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    border-top: 1px solid var(--line);
  }
  .nav-toggle:checked ~ nav { display: flex; }

  .bar nav a {
    padding: 14px 16px;
    font-size: 16px;
    color: var(--ink);
    border-left: 3px solid transparent;
  }
  .bar nav a + a { border-top: 1px solid var(--line); }
  .bar nav a.on {
    box-shadow: none;
    color: var(--accent);
    font-weight: 600;
    border-left-color: var(--accent);
    background: var(--bg);
  }
  main { padding: 18px 14px 56px; }
  h1 { font-size: 18px; }
  .sub { font-size: 13px; }

  .card {
    margin-left: -14px;
    margin-right: -14px;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }

  .scroll { -webkit-overflow-scrolling: touch; }

  /* Only the sortable board stays a table; its name column stays pinned. */
  .scroll table:not(.stack) th:first-child,
  .scroll table:not(.stack) td:first-child {
    position: sticky;
    left: 0;
    background: var(--panel);
    z-index: 1;
    max-width: 42vw;
  }
  .scroll table:not(.stack) th { padding: 9px 10px; }
  .scroll table:not(.stack) td { padding: 9px 10px; font-size: 14px; }

  /* Everything else becomes one card per row. */
  table.stack,
  table.stack tbody,
  table.stack tr,
  table.stack td {
    display: block;
    width: 100%;
  }
  table.stack thead { display: none; }

  table.stack tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }
  table.stack tr:last-child { border-bottom: none; }

  table.stack td {
    border: none;
    padding: 3px 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    font-size: 14px;
    text-align: right;
  }
  table.stack td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: left;
  }

  /* The headline of each card. */
  table.stack td.primary {
    display: block;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    margin-bottom: 8px;
    line-height: 1.35;
  }
  table.stack td.primary::before { content: none; }

  /* Long values (name lists) read better stacked under their label. */
  table.stack td.block { display: block; text-align: left; }
  table.stack td.block::before { display: block; margin-bottom: 4px; }

  /* A head-to-head slot is a comparison, and the generic stack turns it into
     six labelled lines — slot, your player, his points, their player, their
     points, swing — which is both long and no longer a comparison. As a card
     the two players sit one above the other with their points aligned, which is
     the shape the question actually has. */
  table.stack tr.vs {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "slot   swing"
      "mine   mineproj"
      "theirs theirsproj";
    column-gap: 12px;
    row-gap: 5px;
    align-items: center;
    padding: 12px 16px;
  }
  table.stack tr.vs td {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    min-width: 0;
    font-size: 14px;
  }
  /* Position says what each cell is, so the labels come off. */
  table.stack tr.vs td::before { content: none; }
  .vsslot { grid-area: slot; margin: 0 !important; }
  .vsmine { grid-area: mine; }
  .vsmineproj { grid-area: mineproj; justify-content: flex-end; }
  .vstheirs { grid-area: theirs; }
  .vstheirsproj { grid-area: theirsproj; justify-content: flex-end; }
  .vsswing { grid-area: swing; justify-content: flex-end; font-weight: 600; }

  /* Which side is which: yours in full ink on top, theirs muted below. No
     label — a prefix on one row only would break the alignment that makes the
     pair readable as a comparison. */
  .vstheirs, .vstheirsproj { color: var(--muted); }

  table.stack td.num { text-align: right; }
  table.stack tr.dayhead { background: var(--bg); padding: 9px 16px; }
  table.stack tr.dayhead td { display: block; text-align: left; }
  table.stack tr.dayhead td::before { content: none; }

  /* Rows the card headline already covers. */
  table.stack td.dup { display: none; }
  .wide-only { display: none; }

  .avatar { width: 38px; height: 38px; }
  .avatar .initials { font-size: 13px; }
  .pname { gap: 12px; align-items: flex-start; }
  .ava { margin-top: 1px; }
  .chip { min-width: 17px; height: 17px; line-height: 17px; font-size: 10px; }

  .submeta {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    font-weight: 400;
    color: var(--muted);
  }
  .only-narrow { display: inline; }

  /* League and position filters become a swipeable chip row rather than a
     stacked list that eats the screen. */
  .controls { padding: 12px 0; }
  .controls .row { flex-wrap: nowrap; align-items: center; }
  .controls .row + .row { margin-top: 10px; }
  .controls .key { flex: 0 0 auto; padding-left: 16px; }
  .controls form.row { padding-right: 16px; }
  .controls select { flex: 1; min-width: 0; font-size: 16px; }
  .legend { gap: 4px 14px; margin: -8px 0 16px; }
  .controls .opts {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding: 2px 16px 2px 0;
  }
  .controls .opts::-webkit-scrollbar { display: none; }
  .controls .opts a {
    flex: 0 0 auto;
    max-width: 60vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 7px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 13px;
  }
  .controls .opts a.on {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg);
  }

  .ask { flex-direction: column; }
  .ask textarea { width: 100%; min-height: 92px; font-size: 16px; }
  .ask button { width: 100%; padding: 13px; font-size: 15px; }

  .turn.you { max-width: 88%; }
  .prose { font-size: 15px; }
  .prose table { font-size: 12px; }
  .chat { gap: 18px; }

  button { padding: 10px 14px; }
  .msg { padding: 12px 14px; }
}

@media (min-width: 721px) and (max-width: 900px) {
  main { padding: 20px 16px 56px; }
  td, th { padding: 9px 11px; }
}

/* Weekly projection chart.
   Two series, so the palette is the validated blue/orange categorical pair
   (all six checks pass on both surfaces). Identity is never colour alone: a
   legend is always present. */
.viz {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --actual: #6b7280;
  padding: 14px 12px 6px;
}
@media (prefers-color-scheme: dark) {
  .viz {
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --actual: #9aa1ad;
  }
}

/* Named apart from `.legend`, which is the board's column key and carries a
   negative top margin that would drag this over the text above it. */
.viz .vizlegend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 0 4px 8px;
  font-size: 12px;
  color: var(--muted);
}
.viz .vizlegend .key { display: inline-flex; align-items: center; gap: 6px; }
.viz .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.viz .swatch.s1, .chipx .swatch.s1 { background: var(--series-1); }
.viz .swatch.s2, .chipx .swatch.s2 { background: var(--series-2); }
.viz .swatch.s3, .chipx .swatch.s3 { background: var(--series-3); }
.viz .swatch.s4, .chipx .swatch.s4 { background: var(--series-4); }
.viz .swatch.s5, .chipx .swatch.s5 { background: var(--series-5); }
.viz .swatch.actual { background: var(--actual); }

.viz { position: relative; }

/* One drawing per aspect, one shown at a time. The square plot that reads well
   on a phone is 900px tall across a desktop card, and the wide one that fits a
   desktop card is 90px tall on a phone, so the breakpoint picks. */
.viz svg { display: block; width: 100%; height: auto; overflow: visible; }
.viz svg.narrow { display: none; }
@media (max-width: 760px) {
  .viz svg.wide { display: none; }
  .viz svg.narrow { display: block; }
}

/* Hover readout. Revealed by the script; both parts are inert without it, and
   each hit column still carries a native <title>. */
.viz .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.viz .cross[data-on] { opacity: 0.7; }
.viz .hit:hover { cursor: crosshair; }

.vtip {
  position: absolute;
  top: 10px;
  transform: translateX(-50%);
  z-index: 5;
  pointer-events: none;
  min-width: 132px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  font-size: 12px;
  line-height: 1.5;
}
.vtipweek {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.vtiprow { display: flex; align-items: center; gap: 7px; }
.vtiprow .swatch { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 auto; }
.vtiprow .swatch.s1 { background: var(--series-1); }
.vtiprow .swatch.s2 { background: var(--series-2); }
.vtiprow .swatch.s3 { background: var(--series-3); }
.vtiprow .swatch.s4 { background: var(--series-4); }
.vtiprow .swatch.s5 { background: var(--series-5); }
.vtiprow .swatch.actual { background: var(--actual); }
.vtipname {
  flex: 1;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}
.vtipval { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

.viz .line { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Colour alone is not enough: three of the five hues sit under 3:1 on white,
   and one adjacent pair lands in the CVD floor band. Each series carries a
   distinct dash so it stays identifiable in greyscale and for colour-blind
   readers. */
.viz .line.s1 { stroke: var(--series-1); }
.viz .line.s2 { stroke: var(--series-2); stroke-dasharray: 7 3; }
.viz .line.s3 { stroke: var(--series-3); stroke-dasharray: 2 3; }
.viz .line.s4 { stroke: var(--series-4); stroke-dasharray: 9 3 2 3; }
.viz .line.s5 { stroke: var(--series-5); stroke-dasharray: 4 4; }
.viz .line.actual { stroke: var(--actual); stroke-width: 1.5; stroke-dasharray: 1 3; }

/* A ring in the surface colour keeps overlapping marks legible. */
.viz .dot { stroke: var(--panel); stroke-width: 1.5; }
.viz .dot.s1 { fill: var(--series-1); }
.viz .dot.s2 { fill: var(--series-2); }
.viz .dot.s3 { fill: var(--series-3); }
.viz .dot.s4 { fill: var(--series-4); }
.viz .dot.s5 { fill: var(--series-5); }
.viz .dot.actual { fill: var(--actual); r: 2; }

.viz .hit { fill: transparent; }

.viz .axis { stroke: var(--line); stroke-width: 1; }
.viz .grid { stroke: var(--line); stroke-width: 1; }
.viz .tick { fill: var(--muted); font-size: 9px; }
.viz .tick.wk { text-anchor: middle; }

.viz .byeline { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.viz .byetext { fill: var(--muted); font-size: 7px; text-anchor: middle; letter-spacing: 0.06em; }

/* Table view of the plotted numbers. */
.vtable { padding: 4px 12px 12px; font-size: 13px; }
.vtable summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.vtable table { margin-top: 8px; font-size: 12px; }
.vtable td, .vtable th { padding: 5px 8px; white-space: nowrap; }

/* Removable chips for the players being compared. */
.chipx {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.chipx:hover { border-color: var(--muted); }
.chipx .swatch { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
/* Small enough that the chip stays a chip: the row sits beside a text input
   and a full-size avatar would make it twice the input's height. */
.chipx .avatar { width: 22px; height: 22px; margin: -2px 0; }
.chipx .avatar .initials { font-size: 9px; }
.chipx .chipoff { color: var(--muted); font-size: 15px; line-height: 1; margin-left: 1px; }
.chipx:hover .chipoff { color: var(--ink); }

/* "Comparing" does not fit the shared 62px key column, so its row started
   further right than the "Compare" row below it. Widened for this card only. */
.controls.compare .key { flex-basis: 84px; }
.controls.compare .row { align-items: center; }

/* The board's own filter box, which sits between the league picker and the
   slot chips. */
.controls .row.search { align-items: center; }

/* Autocomplete under the board search. It floats so the controls card does not
   grow and shove the board down as you type. */
.suggest { position: relative; }
.suggest .results,
.suggest .noresult {
  position: absolute;
  z-index: 20;
  /* Lines up with the input, which starts after the 62px key column and its
     10px gap. */
  left: 72px;
  /* Capped rather than stretched to the input's width: the input is as wide as
     the card, and a 460px-wide list of eight names reads as a list. */
  width: min(460px, calc(100% - 72px));
  margin: 6px 0 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  max-height: 348px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.suggest .noresult { padding: 14px; color: var(--muted); font-size: 13px; }
.suggest .results li a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
}
.suggest .results li a:hover,
.suggest .results li a[data-active],
.suggest .results li a:focus-visible {
  background: var(--line);
  outline: none;
}
.suggest .pname { display: flex; align-items: center; gap: 10px; }
.suggest .avatar { width: 28px; height: 28px; }
.suggest .avatar .initials { font-size: 10px; }
.suggest .ava .chip { min-width: 13px; height: 13px; line-height: 13px; font-size: 8px; }
.suggest .ptext { flex: 1; min-width: 0; font-size: 14px; }
.suggest .submeta {
  display: block;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.suggestnum {
  flex: 0 0 auto;
  min-width: 44px;
  text-align: right;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
@media (max-width: 760px) {
  .suggest .results, .suggest .noresult { left: 0; width: 100%; }
}

/* The side panel. A drawer over the board rather than a column beside it: the
   board is already using the full width, and squeezing it on open would reflow
   every row underneath the thing you just clicked. */
.panel[hidden] { display: none; }

/* A docked column, not an overlay. The assistant is for asking about what is on
   the page, so covering the page with a dimmed sheet defeated the purpose: the
   answer arrived and the numbers it referred to were behind glass. The page
   narrows instead and stays readable and clickable. */
.panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow: hidden;
}
@media (min-width: 1000px) {
  /* Give the column its space rather than taking it from the content. */
  body.panelopen main { margin-right: 420px; }
}
@media (max-width: 999px) {
  /* Too narrow to sit two columns side by side, so it covers instead — the
     only case where an overlay is the honest answer. */
  .panel { box-shadow: -16px 0 40px rgba(0, 0, 0, 0.35); }
}
.panelhead {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}
.panelname { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.panelname strong { font-size: 16px; }
.panelname .sub { margin: 0; font-size: 12px; }
.panelclose { flex: 0 0 auto; }
/* The panel owns the scroll region, not the page: the head stays put and one
   child below it scrolls. */
.panelbody { padding: 16px; flex: 1; min-height: 0; overflow-y: auto; }
.panelbody .sub { margin: 0 0 12px; }
.panelbody h1.panelh { font-size: 13px; margin: 20px 0 8px; }
.panelbody .card { margin: 0 0 12px; }
.panelbody .viz { padding: 10px 6px 4px; }
.panelbody .vizlegend { display: none; }

.panelstats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}
.panelstats .stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--panel);
}
.panelstats .statlabel {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.panelstats strong { font-size: 17px; font-variant-numeric: tabular-nums; }

.panelmore {
  display: inline-block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.panelmore:hover { color: var(--ink); }

/* Title and league picker share a line: the league scopes everything below it,
   so it belongs with the heading rather than buried under the tabs. */
.pagehead {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.pagehead h1 { margin: 0; flex: 0 0 auto; }
.leaguepick { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.leaguepick .key {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.leaguepick select {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 32px 7px 12px;
  max-width: 100%;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 15px center, right 10px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.leaguepick select:focus { outline: none; border-color: var(--muted); }
@media (max-width: 760px) {
  /* Stacked on a phone: the two do not fit on one line and the picker is worth
     the full width. */
  .leaguepick { margin-left: 0; width: 100%; }
  .leaguepick select { flex: 1; min-width: 0; font-size: 16px; }
}

/* How far each side sits from its own norm, under the week's readout. A number
   on its own says nothing about whether it is a good week for them. */
.vtipnote {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
}
.vtipswing { display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.vtipswing .vtipname { flex: 0 0 34px; color: var(--muted); }

/* Bye players as faces. The column was the widest in the table and only the
   count and the faces get read at a glance; the names are one hover away. */
.byefaces { display: inline-flex; align-items: center; }
.byeface { display: inline-flex; margin-right: -7px; }
.byeface:last-of-type { margin-right: 0; }
.byefaces .avatar {
  width: 22px;
  height: 22px;
  /* A ring in the surface colour keeps overlapping faces separable. */
  box-shadow: 0 0 0 2px var(--panel);
}
.byefaces .avatar .initials { font-size: 9px; }
.byecount {
  margin-left: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Team names run long — "Ismael's Impressive Team" wrapped to three lines and
   made every row ninety pixels tall, so five teams filled a phone screen. One
   line with an ellipsis; the full name is still in the row's own title. */
@media (max-width: 720px) {
  .stage td.primary {
    max-width: 132px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .stage .stagesub { font-size: 12.5px; }
  .stage { margin-bottom: 32px; }
}

/* The projection's working, one section per stage of the pipeline.
   Generous space between stages and tight space inside them, so the five
   groups are legible before a word is read. */
.stage { margin: 0 0 46px; }
.stagehead {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 0 0 14px;
}
/* The stage number is the one emphasised thing in each header: the order is
   the argument the page is making. */
.stagenum {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--panel);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stagehead h2 { margin: 2px 0 4px; font-size: 17px; }
.stagesub { margin: 0; color: var(--muted); font-size: 13px; }
.stagenote {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}
/* A table's own caption, for the note that only makes sense beside the data. */
.tcap {
  caption-side: top;
  text-align: left;
  padding: 12px 14px 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(11px, 3.4vw, 15px);
  overflow-wrap: anywhere;
}

/* A slot nobody on the roster can fill, priced at a waiver pickup.
   Dashed and unfilled so it never reads as a player you own: the faces beside
   it are rostered, this is a plan. */
.byecell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
}
.streamed {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border: 1px dashed var(--line);
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}
.streamslot { color: var(--muted); letter-spacing: 0.04em; }
.streamval { color: var(--text); font-variant-numeric: tabular-nums; }

/* Where an answer's web claims came from. Under the answer, not inside it, so
   the prose stays readable and the provenance is still one glance away. */
.sources {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.sourceslabel {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
}
.sources a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sources a:hover { color: var(--ink); border-bottom-color: var(--muted); }

/* A question that never reached the server. */
.turn.failed {
  color: var(--warn);
  font-size: 13px;
  border: 1px solid var(--warn);
  border-radius: 8px;
  padding: 10px 12px;
}

/* Waiting on an answer. */
.turn.pending {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 14px;
}
.dots { display: inline-flex; gap: 4px; }
.dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: dotpulse 1.2s ease-in-out infinite;
}
.dots i:nth-child(2) { animation-delay: 0.15s; }
.dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotpulse {
  0%, 100% { opacity: 0.25; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}
.composer textarea[readonly] { opacity: 0.55; }
.send:disabled { opacity: 0.55; cursor: default; }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; } }

/* The drawer's own chat, narrower than the tab's. */
/* The composer is pinned to the foot and the transcript scrolls above it, which
   is how every chat surface behaves and what makes an empty thread read as
   waiting for a question rather than as a form floating in a blank column. */
.chatdrawer { display: flex; flex-direction: column; overflow: hidden; }
.chatdrawer .chat {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  gap: 16px;
  /* The composer owns the gap below, so the two cannot both claim it. */
  margin: 4px 0 0;
}
.chatdrawer .turn { max-width: 100%; }
.chatdrawer .turn.you { max-width: 92%; }
.chatdrawer .prose { font-size: 14px; }
.chatdrawer .composer {
  flex: 0 0 auto;
  /* Not sticky here. The drawer is a flex column with a scrolling chat above,
     so the composer is already pinned to the foot by the layout. Sticky is for
     the tab, where the page itself scrolls — and inside the drawer its `bottom`
     offset shifted the box up into the space above it, which closed an
     eighteen-pixel gap to two and left the answer touching the input. */
  position: static;
  margin-top: 18px;
}
/* The picker and the composer sit one above the other in a narrow column, so
   they share an edge. A control that stops short of the box beneath it reads as
   a mistake. */
.chatdrawer form.row { display: block; margin-bottom: 14px; }
.chatdrawer .ftselect,
.chatdrawer .ftselect-btn { width: 100%; }
.chatdrawer select {
  font: inherit;
  font-size: 13px;
  width: 100%;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  margin-bottom: 14px;
}
.panelnew {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
}
.panelnew:hover { color: var(--ink); border-color: var(--muted); }

/* Ask, beside the tabs: the assistant without leaving the page. */
.askbtn {
  margin-left: auto;
  align-self: center;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  cursor: pointer;
}
.askbtn:hover { color: var(--ink); border-color: var(--muted); }

@media (max-width: 720px) {
  /* Ask is not a tab. It opens a panel rather than navigating, and squeezing it
     onto the end of the tab row made five items fight for 390px and put an
     action in the middle of a navigation control. On a phone it becomes what it
     actually is: the page's one primary action, always in reach, and out of the
     way of everything it is not. */
  .askbtn {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 30;
    margin: 0;
    padding: 11px 22px;
    font-size: 14px;
    color: var(--panel);
    background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  }
  /* It would otherwise float on top of the panel it just opened. */
  body:has(.panel:not([hidden])) .askbtn { display: none; }
  /* So the last row of a table is never trapped under it. */
  main { padding-bottom: 84px; }
}

/* Board / Assistant tabs */
.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
}
.tabs a {
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.tabs .count {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 17px;
  text-align: center;
}
.tabs a.on .count { background: var(--accent); color: var(--panel); }

@media (max-width: 720px) {
  .tabs { margin: 0 -14px 16px; padding: 0 14px; }
  .tabs a { flex: 1; text-align: center; padding: 11px 8px; font-size: 15px; }
}

/* Comparison search */
/* The card clips its corners with overflow:hidden, which would also cut off the
   results panel, and later cards paint over earlier ones without a stacking
   context of its own. */
.card.controls { overflow: visible; position: relative; z-index: 6; }
.controls .search { align-items: flex-start; }
.searchbox { position: relative; flex: 1; min-width: 0; }

.searchbox input[type="search"] {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  appearance: none;
}
.searchbox input[type="search"]:focus { outline: none; border-color: var(--muted); }

/* Results float over the page so adding a player never shifts the chart. */
.searchbox .results {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  max-height: 320px;
  overflow-y: auto;
}
.searchbox .results li + li { border-top: 1px solid var(--line); }
.searchbox .results a {
  display: block;
  padding: 8px 10px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--ink);
}
.searchbox .results a:hover,
.searchbox .results a:focus { background: var(--bg); outline: none; }
.searchbox .results .avatar { width: 28px; height: 28px; }
.searchbox .results .submeta { display: block; font-size: 12px; color: var(--muted); }

.searchbox .noresult {
  position: absolute;
  left: 0;
  right: 0;
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 720px) {
  .controls .search { flex-wrap: wrap; }
  .searchbox { flex: 1 1 100%; padding-right: 16px; }
  .searchbox input[type="search"] { font-size: 16px; }
}

/* Hover preview on the draft board.
   Pointer devices only: a phone has no hover, and the card would sit on top of
   the row you just tapped. */
.preview { display: none; }

@media (min-width: 901px) and (hover: hover) and (pointer: fine) {
  /* Both the scroll wrapper and the card around it clip by default, and a
     later card would paint over the preview even once it escapes. */
  .previewable { overflow: visible; }
  .card.pickcard { overflow: visible; position: relative; z-index: 20; }

  .pickrow td.primary { position: relative; }

  .preview {
    display: block;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 760px;
    max-width: 62vw;
    z-index: 60;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
    pointer-events: none;
  }
  .pickrow:hover .preview,
  .pickrow:focus-within .preview {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* Rows in the lower half open upward. The card is ~400px tall, so anchoring
     it below a row that far down the board runs it off the screen. CSS cannot
     measure the space available, and the board is long enough that the hovered
     row is usually mid-viewport, so the half it sits in is the best signal. */
  .pickrow:nth-child(n + 6) .preview { top: auto; bottom: calc(100% + 6px); }

  .previewcard {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    overflow: hidden;
  }
  .previewhead {
    padding: 10px 14px 0;
    font-size: 13px;
  }
  /* Inside the card the chart is furniture, not a section of the page. */
  .previewcard .sub { margin: 6px 14px 0; font-size: 12px; }
  .previewcard .card { border: none; margin: 0; border-radius: 0; }
  .previewcard .viz { padding: 8px 14px 8px; }
  .previewcard .vizlegend { font-size: 11.5px; gap: 5px 14px; }
  .previewcard .previewhead { font-size: 14px; padding: 12px 16px 0; }
  .previewcard .sub { margin: 7px 16px 0; }
  .previewcard .vtable { display: none; }
}

/* Assistant: a thread with its history in the sidebar rail. */
.thread { display: flex; flex-direction: column; max-width: 860px; }

.threadhead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.threadhead strong { display: block; font-size: 15px; font-weight: 650; line-height: 1.35; }
.threadmeta { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }

.ghost {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 6px;
  cursor: pointer;
}
.ghost:hover { color: var(--hot); }

.chatempty { color: var(--muted); font-size: 14px; line-height: 1.7; }
.chatempty p { margin: 0 0 10px; }
.chatempty ul { margin: 0; padding-left: 18px; }
.chatempty li { margin: 4px 0; }

/* The composer sits at the foot of the thread as one box, the way a message
   field should read, rather than a textarea with a button parked beside it. */
.composer {
  position: sticky;
  bottom: 16px;
  margin-top: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.composer textarea {
  width: 100%;
  border: none;
  background: none;
  resize: none;
  font: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  min-height: 46px;
  padding: 0;
}
.composer textarea:focus { outline: none; }
.composer textarea::placeholder { color: var(--muted); }

.composerbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.hint { font-size: 11.5px; color: var(--muted); }
/* Send and stop are one control in two states, so they share a footprint:
   a 34px circle, comfortably past a thumb's worth of target, in the same
   spot whichever one is showing. */
.send,
.stopask {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  flex: 0 0 auto;
}
/* `display` on a bare class beats [hidden] at the same specificity, so only
   one of the pair would ever go away. Say it here, with the class, or both
   buttons sit in the bar at once. */
.send[hidden],
.stopask[hidden] { display: none; }

/* Send is the primary action in the panel and carries the accent fill. */
.send {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--panel);
}
.send:hover:not(:disabled) { filter: brightness(1.12); }
.send .icon { width: 17px; height: 17px; }

/* Stop undoes an action rather than taking one, so it recedes to an outline
   while it stands in for send — same place, visibly not the same weight. */
.stopask {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}
.stopask:hover { color: var(--text); border-color: var(--muted); }
.stopask .icon { width: 13px; height: 13px; }

/* Sidebar rail: new chat plus recent conversations. */
.rail { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }

.newchat {
  display: block;
  text-align: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.newchat:hover { border-color: var(--muted); }

.railhead {
  margin: 18px 0 6px;
  padding: 0 10px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.railempty { margin: 0; padding: 0 10px; font-size: 12px; color: var(--muted); line-height: 1.6; }

.convlist { list-style: none; margin: 0; padding: 0; }
.convlist a {
  display: block;
  padding: 7px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
}
.convlist a:hover { background: var(--bg); color: var(--ink); }
.convlist li.on a { background: var(--bg); color: var(--ink); }
.convtitle {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.35;
}
.convmeta { display: block; margin-top: 2px; font-size: 10.5px; opacity: 0.75; }

/* ------------------------------------------------------- desktop sidebar */

@media (min-width: 1000px) {
  /* The top bar becomes a fixed rail. Same markup, different layout: the
     hamburger and its checkbox simply stop applying. */
  header {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 216px;
    border-right: 1px solid var(--line);
    border-bottom: none;
    overflow-y: auto;
  }

  .bar {
    flex-direction: column;
    align-items: stretch;
    height: 100%;
    max-width: none;
    margin: 0;
    padding: 22px 12px;
    gap: 4px;
  }

  .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 20px;
    font-size: 15px;
  }

  .bar nav a {
    display: flex;
    align-items: center;
    gap: 11px;
  }
  .burger { display: none; }
  .spacer { display: none; }

  /* Collapsing the sidebar. It narrows to its icons rather than disappearing,
     so the mark that brings it back is always on screen. */
  .railshut-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Pinned to the foot, whatever is above it. */
    margin-top: auto;
    width: 30px;
    height: 30px;
    padding: 0;
    color: var(--muted);
    background: none;
    border: 1px solid transparent;
    border-radius: 8px;
    cursor: pointer;
  }
  .railshut-btn:hover { color: var(--ink); border-color: var(--line); }

  body.railshut header { width: 60px; }
  body.railshut .brandname,
  body.railshut .navlabel,
  body.railshut .railshut-btn,
  body.railshut .rail { display: none; }
  body.railshut .bar { padding: 22px 8px; align-items: center; }
  body.railshut .brand { padding: 0 0 18px; justify-content: center; width: 100%; }
  body.railshut .brand:hover .icon { color: var(--ink); }
  body.railshut .bar nav { width: 100%; }
  body.railshut .bar nav a {
    justify-content: center;
    padding: 10px 0;
    gap: 0;
  }
  body.railshut .bar nav a.on { background: none; }
  body.railshut main { margin-left: 60px; }

  .bar nav {
    /* Sized to its links, so the rail below starts right under them instead of
       being pushed to the foot of the sidebar. */
    flex: 0 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .bar nav a {
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 14px;
  }
  .bar nav a:hover { background: var(--bg); }
  .bar nav a.on { color: var(--ink); font-weight: 650; background: none; }

  main {
    margin-left: 216px;
    /* Wide enough to use a big monitor, bounded so an ultrawide does not
       stretch a table to absurdity. */
    max-width: 1760px;
    padding: 26px 40px 72px;
  }

  /* Page copy runs the full content width, matching the cards it introduces.
     A 900px measure is better typography in the abstract, but it left every
     paragraph stopping short of the table it describes, which reads as a
     layout fault rather than a choice. The thread keeps a measure below —
     it really is all running text. */
  .thread { max-width: 900px; }

  /* The assistant is the one place that is all running text, and 900px left
     half a wide monitor empty. Prose still needs a measure, so the column
     widens rather than filling: long lines are hard to track back. The
     composer shares the width so the two edges line up. */
  .thread { max-width: 1180px; }
  .turn { max-width: 1040px; }
  .card, .scroll, .card table { max-width: none; }

  /* The rail takes what is left and scrolls when the list gets long. */
  .rail { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-top: 18px; padding-top: 16px; }
}

/* Between the phone layout and the rail, keep the top bar but use the width. */

/* ---------------------------------------------------------------- sign-in */

.signin-page { display: grid; place-items: center; min-height: 100vh; }

.signin {
  /* Not running text: this is a single centred control with two short lines
     above it, and the cap is what keeps the card from stretching to the full
     width of a desktop window. */
  max-width: 380px;
  width: 100%;
  /* The generic `main` rule sets `margin: 0 auto`, which fights the centring
     grid on the body and resolves lopsided against it. The grid centres this;
     the margin must not also try to. */
  margin: 0;
  padding: 32px 24px;
  text-align: center;
}

.signin h1 { font-size: 20px; margin: 0 0 6px; }
.signin .sub { color: var(--muted); font-size: 14px; margin: 0 0 28px; }

/* Spacing does the grouping: the gap above the button is larger than anything
   inside the block, so the control reads as separate from the copy. */
.signin-action { display: grid; justify-items: center; gap: 14px; }

.signin-error {
  background: var(--panel);
  border: 1px solid var(--hot);
  border-left-width: 3px;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 20px;
  font-size: 13px;
  text-align: left;
  color: var(--ink);
}

.signin-status { font-size: 13px; margin: 0; }
