/* Quantum Stars — Star Atlas.
   Atlas blue owns the shell and the chart band; chart paper is the working
   ground; star gold marks stars and the primary action; grid blue is for
   hairlines only. Marcellus SC for engraved titles, system UI for work. */

@font-face {
  font-family: "Marcellus SC";
  src: url("/static/fonts/marcellus-sc-latin.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Marcellus SC";
  src: url("/static/fonts/marcellus-sc-latin-ext.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --atlas: #14234b;
  --atlas-2: #1b2e5e;
  --atlas-line: #2c4279;
  --atlas-base: #5b74ae;
  --atlas-ink: #eaf0fa;
  --atlas-mute: #a9bbdd;
  --gold: #ffd166;
  --gold-hover: #ffc53d;
  --sky: #7fa7e8;

  --ground: #eaf0fa;
  --surface: #f6f8fd;
  --raised: #ffffff;
  --ink: #14234b;
  --mute: #4c5c80;
  --rule: #c9d5ea;
  --rule-strong: #14234b;
  --lit: #fff3cc;
  --me: #dbe6fa;
  --fresh: #ffe29a;
  --danger: #a8261a;
  --discord: #4752c4;
  --focus: #14234b;
  --rs-dot: #14234b;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%2314234b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  --display: "Marcellus SC", "Iowan Old Style", Georgia, serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --gutter: 40px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --atlas: #060c20;
    --atlas-2: #0e1a3d;
    --atlas-line: #233766;
    --atlas-base: #4a629b;
    --ground: #17264f;
    --surface: #1b2c5a;
    --raised: #1e305f;
    --ink: #e3eaf7;
    --mute: #a6b5d4;
    --rule: #2d4277;
    --rule-strong: #a6b5d4;
    --lit: #43464f;
    --me: #1c2f60;
    --fresh: #4a4220;
    --danger: #ff8a7a;
    --focus: #ffd166;
    --rs-dot: #ffd166;
    --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5 6 7.5 9 4.5' fill='none' stroke='%23e3eaf7' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--atlas-base) transparent; scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.45 var(--ui);
  caret-color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--gold); color: #14234b; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.shell :focus-visible, .atlas :focus-visible { outline-color: var(--gold); }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, p { margin: 0; }
code { font: 0.92em ui-monospace, "SF Mono", Menlo, monospace; }
img { display: block; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 10;
  background: var(--gold); color: #14234b; padding: 8px 14px; border-radius: 6px; font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 6px; border: 1px solid transparent;
  font: 600 14px/1 var(--ui); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 120ms, border-color 120ms, color 120ms;
}
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn-gold { background: var(--gold); color: #14234b; }
.btn-gold:hover:not(:disabled) { background: var(--gold-hover); }
.btn-discord { background: var(--discord); color: #fff; }
.btn-discord:hover { background: #3c45a5; }
.btn-discord .icon { flex: none; }
.btn-quiet, .btn-quiet-dark { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-quiet:hover, .btn-quiet-dark:hover { border-color: var(--rule-strong); }
.btn-ghost { background: transparent; color: var(--mute); padding: 0 10px; }
.btn-ghost:hover { color: var(--ink); text-decoration: underline; }
.btn-ghost-danger { background: transparent; color: var(--danger); border-color: transparent; min-height: 32px; padding: 0 10px; }
.btn-ghost-danger:hover { border-color: currentColor; }
.link-quiet {
  background: none; border: 0; padding: 4px 2px; color: var(--atlas-mute);
  font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.link-quiet:hover { color: var(--atlas-ink); }

/* ---------- shell ---------- */
.shell {
  display: flex; align-items: center; gap: 36px;
  min-height: 60px; padding: 0 var(--gutter);
  background: var(--atlas); color: var(--atlas-ink);
  border-bottom: 1px solid var(--atlas-line);
}
.brand {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font: 22px/1 var(--display); letter-spacing: 0.08em; color: var(--atlas-ink);
}
.brand .mark { flex: none; width: 30px; height: 30px; }
.nav { display: flex; gap: 26px; align-self: stretch; }
.nav a {
  display: flex; align-items: center; color: var(--atlas-mute); text-decoration: none; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.nav a:hover { color: var(--atlas-ink); }
.nav a[aria-current="page"] { color: #fff; border-color: var(--gold); }
.who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.who form { margin: 0; }
.who-name { color: var(--atlas-ink); font-weight: 600; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.avatar-blank {
  display: inline-grid; place-items: center; background: var(--atlas-2); color: var(--gold);
  font: 15px/1 var(--display); border: 1px solid var(--atlas-line);
}

.notice {
  padding: 10px var(--gutter); background: var(--lit); color: var(--ink);
  border-bottom: 1px solid var(--rule); font-size: 14px;
}

/* ---------- the chart ---------- */
.atlas { background: var(--atlas); color: var(--atlas-mute); padding: 18px var(--gutter) 6px; border-bottom: 1px solid var(--atlas-base); }
.atlas-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.atlas-head h1 { font: 17px/1.2 var(--display); letter-spacing: 0.14em; color: #fff; }
.atlas-head p { font-size: 13px; }
.legend { margin: 0 0 0 auto; padding: 0; list-style: none; display: flex; gap: 18px; font-size: 12px; align-items: center; }
.legend li { display: flex; align-items: center; gap: 6px; }
.lg-star { fill: var(--gold); }
.lg-rs { fill: #14234b; font: 700 9px var(--ui); text-anchor: middle; }
.lg-line { stroke: var(--sky); stroke-opacity: 0.45; stroke-width: 1; }

.chart { margin-top: 6px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Explicit ratios: an inline SVG's attribute ratio isn't reliable for height: auto. */
.chart-svg.wide { aspect-ratio: 1200 / 172; }
.chart-svg.narrow { display: none; aspect-ratio: 520 / 250; }
.chart-svg.narrow .axis text { font-size: 16px; }
.chart-svg.narrow .star .name { font-size: 18px; stroke-width: 6px; }
.chart-svg.narrow .star .rs { font-size: 11px; }
.chart-svg.narrow .empty { font-size: 20px; }
.chart-svg .grid line { stroke: var(--atlas-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-svg .grid .base { stroke: var(--atlas-base); }
.chart-svg .grid .ws-line { stroke: var(--sky); stroke-opacity: 0.55; stroke-dasharray: 5 5; }
.chart-svg .bands text {
  fill: var(--atlas-mute); font: 600 10px var(--ui); letter-spacing: 0.08em; text-transform: uppercase;
  paint-order: stroke; stroke: var(--atlas); stroke-width: 4px; stroke-linejoin: round;
}
.chart-svg.narrow .bands text { font-size: 15px; }
.chart-svg .star { cursor: pointer; }
.chart-svg .axis text { fill: var(--atlas-mute); font: 500 11px var(--ui); text-anchor: middle; }
.chart-svg .empty { fill: var(--atlas-ink); font: 14px var(--ui); text-anchor: middle; }
.chart-svg .constellations line {
  stroke: var(--sky); stroke-opacity: 0.45; stroke-width: 1; vector-effect: non-scaling-stroke;
  transition: stroke-opacity 200ms, stroke 200ms;
}
.chart-svg .constellations line.dim { stroke-opacity: 0.08; }
.chart-svg .constellations line.on { stroke-opacity: 0.7; }
/* While one star is lit, the rest of the sky steps back so its corp reads. */
.chart:has(.star.lit) .constellations line:not(.lit) { stroke-opacity: 0.12; }
.chart-svg .constellations line.lit { stroke: var(--gold); stroke-opacity: 0.85; stroke-width: 1.5; }
.star .core { fill: var(--gold); transition: fill 200ms; }
.star .halo { fill: none; stroke: var(--gold); stroke-width: 1.25; opacity: 0; transition: opacity 150ms; vector-effect: non-scaling-stroke; }
/* The RS level, printed small inside every star. */
.star .rs { fill: #14234b; font: 700 9px var(--ui); font-variant-numeric: tabular-nums; pointer-events: none; }
.star.dim .rs { fill: #a9bbdd; }
.star .name {
  fill: #fff; font: 600 12px var(--ui); opacity: 0; pointer-events: none;
  paint-order: stroke; stroke: var(--atlas); stroke-width: 4px; stroke-linejoin: round;
  transition: opacity 150ms;
}
.star.dim .core { fill: #3c4f84; }
.star.lit .halo, .star.lit .name, .star.fresh .name, .star.me .name { opacity: 1; }
/* Your own star keeps a faint ring, so it's findable among forty others. */
.star.me .halo { opacity: 0.55; }
.star.arrived .halo { animation: star-ring 1600ms var(--ease-out) both; }
.star.arrived .core { animation: star-land 900ms var(--ease-out) both; }
.star .core, .star .halo { transform-box: fill-box; transform-origin: center; }
.star.fresh .core { animation: star-land 900ms var(--ease-out) both; }
.star.fresh .halo { animation: star-ring 1600ms var(--ease-out) 200ms both; }
@keyframes star-land { from { transform: scale(0); } 60% { transform: scale(1.35); } to { transform: scale(1); } }
@keyframes star-ring { from { opacity: 1; transform: scale(0.6); } to { opacity: 0; transform: scale(2.6); } }

/* ---------- tools bar ---------- */
.sort-pick { display: none; }
.tools {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px var(--gutter); background: var(--surface); border-bottom: 1px solid var(--rule);
}
.seg { display: inline-flex; align-items: center; border: 1px solid var(--rule); border-radius: 7px; background: var(--raised); overflow: hidden; }
.seg-label { padding: 0 10px 0 12px; font-size: 12px; color: var(--mute); }
.seg button {
  font: 500 13px/1 var(--ui); color: var(--ink); background: transparent; border: 0;
  border-left: 1px solid var(--rule); padding: 0 12px; min-height: 34px; cursor: pointer; white-space: nowrap;
}
.seg button:hover { background: var(--ground); }
.seg button.on { background: var(--atlas); color: #fff; }
.field select, .field input {
  font: 14px var(--ui); color: var(--ink); background-color: var(--raised);
  border: 1px solid var(--rule); border-radius: 7px; min-height: 36px; padding: 0 10px;
}
.field select:hover, .field input:hover { border-color: var(--mute); }
select { appearance: none; -webkit-appearance: none; background-image: var(--chevron); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px !important; }
.field-search { margin-left: auto; }
.field-search input { width: 240px; }
.field input::placeholder { color: var(--mute); }

.tag {
  display: inline-block; font: 600 11px/1.5 var(--ui); padding: 1px 7px; border-radius: 4px;
  vertical-align: 1px; white-space: nowrap;
}
.tag-me { background: var(--atlas); color: #fff; }
.tag-new { background: var(--gold); color: #14234b; }
.tag-sample { color: var(--mute); font-weight: 500; padding: 0 2px; text-decoration: underline dotted; text-underline-offset: 3px; }
/* One quiet dashed ring per sample row; the roster head says what it means. */
.sample-mark { display: inline-flex; vertical-align: 1px; margin-left: 4px; color: var(--mute); }
.roster-head .tag-sample::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border: 1.2px dashed currentColor; border-radius: 50%; vertical-align: 0;
}
.roster-head .tag-sample { border: 1px dashed var(--mute); padding: 1px 7px; text-decoration: none; }

/* ---------- roster table ---------- */
.sheet { padding: 0 var(--gutter); }
.roster-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; padding: 22px 0 10px; }
.roster-head h2 { font: 20px/1.2 var(--display); letter-spacing: 0.08em; white-space: nowrap; }
.roster-head .tag-sample { align-self: center; }
.count { color: var(--mute); font-size: 14px; font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
thead th {
  text-align: left; font: 600 12px/1.2 var(--ui); color: var(--mute);
  border-bottom: 1px solid var(--rule-strong); padding: 0; white-space: nowrap; height: 38px;
}
thead th:not(:has(.sort)) { padding: 0 12px; }
.sort {
  display: inline-flex; align-items: center; gap: 4px; width: 100%; height: 38px; padding: 0 12px;
  background: none; border: 0; font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.sort:hover { color: var(--ink); }
.sort-ico { opacity: 0; transition: transform 150ms, opacity 150ms; }
.sort:hover .sort-ico { opacity: 0.5; }
th[aria-sort="ascending"], th[aria-sort="descending"] { color: var(--ink); }
th[aria-sort="ascending"] .sort-ico, th[aria-sort="descending"] .sort-ico { opacity: 1; }
th[aria-sort="ascending"] .sort-ico { transform: rotate(180deg); }
th.c-n .sort { justify-content: flex-end; }

tbody th, tbody td { padding: 0 12px; height: 38px; border-bottom: 1px solid var(--rule); white-space: nowrap; text-align: left; font-weight: 400; }
tbody tr { transition: background-color 150ms; }
tbody tr.lit { background: var(--lit); }
tbody tr.me { background: var(--me); }
tbody tr.me.lit { background: var(--lit); }
tbody tr.fresh { animation: row-fresh 5s ease-out both; }
tbody tr.arrived { animation: row-arrive 2.4s var(--ease-out) both; }
tbody tr.arrived th:first-of-type { box-shadow: inset 3px 0 0 var(--gold); }
@keyframes row-arrive { from { background: var(--fresh); } }
@keyframes row-fresh { from { background: var(--fresh); } to { background: transparent; } }
.c-num { color: var(--mute); width: 56px; }
.c-name .name { font-weight: 600; }
th.c-name:focus { outline: none; }
th.c-name:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 3px; }

/* Only phones need the way back up to the chart. */
.hl-pill { display: none; }
@media (max-width: 720px) {
  .hl-pill.on {
    display: inline-flex; align-items: center; gap: 8px; position: fixed; z-index: 20;
    left: 50%; transform: translateX(-50%); top: 12px; max-width: calc(100vw - 32px);
    padding: 8px 14px; border: 1px solid var(--atlas-line); border-radius: 999px;
    color: var(--atlas-ink); background: var(--atlas); font: 600 13px/1.2 var(--ui);
    box-shadow: 0 8px 20px rgb(4 9 24 / 0.3); cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .hl-pill svg { color: var(--gold); flex: none; }
}
.c-name .tag { margin-left: 6px; }
.c-discord { color: var(--mute); }
.c-n { text-align: right !important; }
.c-rs { font-weight: 600; }
.rs-dot {
  display: inline-block; vertical-align: -1px; margin-right: 8px; border-radius: 50%;
  width: calc(3px + var(--rs) * 0.8px); height: calc(3px + var(--rs) * 0.8px); background: var(--rs-dot);
}
.ws-yes { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 10px; background: var(--atlas); color: #fff; }
.ws { color: var(--mute); font-size: 13px; }
.ws-yes.ws { color: #fff; }
.c-tech { color: var(--ink); font-size: 14px; }
.none { color: var(--mute); }
.lbl { display: none; }
.c-date { color: var(--mute); font-size: 13px; }
.c-act { text-align: right !important; }

.empty { padding: 40px 0; display: grid; justify-items: start; gap: 8px; color: var(--mute); }
.empty-title { font: 18px/1.3 var(--display); letter-spacing: 0.06em; color: var(--ink); }

/* ---------- signup: the open last row ---------- */
.signup {
  position: sticky; bottom: 0; z-index: 2;
  margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter);
  background: var(--raised); border-top: 1px dashed var(--sky);
  transition: box-shadow 160ms;
}
/* The lift only while it's stuck to the bottom edge, over the roster. */
.signup.stuck { box-shadow: 0 -8px 24px -12px rgb(20 35 75 / 0.25); }
.signup-end { height: 1px; }
.about { margin: 20px 0 8px; max-width: 760px; font-size: 14px; }
.about summary { cursor: pointer; color: var(--mute); font-weight: 600; width: fit-content; padding: 4px 0; }
.about summary:hover { color: var(--ink); }
.about dl { display: grid; gap: 10px; margin: 8px 0 4px; }
.about dt { font-weight: 600; }
.about dd { margin: 2px 0 0; color: var(--mute); max-width: 68ch; }

.signup[data-form-open], .signup:has(.on-roster) { position: static; box-shadow: none; }
.signup-bar { display: flex; align-items: center; gap: 18px; min-height: 68px; padding: 12px 0; }
.bar-star { flex: none; overflow: visible; }
.bar-star-empty .halo { stroke: var(--mute); stroke-dasharray: 3 3; }
.bar-star .core { fill: var(--gold); stroke: var(--atlas); stroke-width: 1.5; }
.bar-star .halo { fill: none; stroke: var(--gold); stroke-width: 1.25; }
.bar-rs { fill: #14234b; font: 700 10px var(--ui); text-anchor: middle; font-variant-numeric: tabular-nums; }
.link-inline {
  background: none; border: 0; padding: 0; font: inherit; color: var(--ink); font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.link-inline:hover { text-decoration-thickness: 2px; }
.signup-copy h2:focus { outline: none; }
.signup-copy { min-width: 0; }
.signup-copy h2 { font: 19px/1.2 var(--display); letter-spacing: 0.06em; text-wrap: balance; }
.signup-copy p { color: var(--mute); font-size: 14px; margin-top: 2px; }
.devnote { display: inline-block; font-size: 12px; border: 1px dashed var(--mute); border-radius: 4px; padding: 0 6px; }
.signup-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.signup[data-form-open] .open-btn { display: none; }

.signup-form { padding: 6px 0 28px 62px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 28px; max-width: 1080px; }
.span-2 { grid-column: span 2; }
.field-block { display: grid; gap: 6px; align-content: start; min-width: 0; margin: 0; padding: 0; border: 0; }
.field-block > label, .field-block > legend, .field-block > .label { font-weight: 600; font-size: 14px; padding: 0; }
.field-block legend { margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--mute); font-size: 13px; margin-left: 4px; }
.hint { color: var(--mute); font-size: 13px; }
.signup-form input[type="text"], .signup-form select {
  font: 15px var(--ui); color: var(--ink); background-color: var(--surface);
  border: 1px solid var(--rule); border-radius: 7px; min-height: 42px; padding: 0 12px; width: 100%;
}
.signup-form input[type="text"]:hover, .signup-form select:hover { border-color: var(--mute); }
.signup-form select:disabled { opacity: 0.5; }
.readonly { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border-radius: 7px; background: var(--ground); color: var(--mute); }
.readonly .avatar { width: 22px; height: 22px; }
.pair { display: grid; grid-template-columns: 1fr 96px; gap: 8px; }

.rs-pick, .yn { display: flex; flex-wrap: wrap; gap: 6px; }
.rs-pick label, .yn label { position: relative; }
.rs-pick input, .yn input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.rs-pick span, .yn span {
  display: grid; place-items: center; min-width: 44px; height: 42px; padding: 0 12px;
  border: 1px solid var(--rule); border-radius: 7px; background: var(--surface);
  font-weight: 600; font-variant-numeric: tabular-nums; transition: background-color 120ms, color 120ms;
}
.yn span { min-width: 72px; }
.rs-pick label:hover span, .yn label:hover span { border-color: var(--mute); }
.rs-pick input:checked + span, .yn input:checked + span { background: var(--atlas); color: var(--gold); border-color: var(--atlas); }
.rs-pick input:focus-visible + span, .yn input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.form-errors:not(:empty) {
  margin-top: 20px; max-width: 1080px; padding: 12px 16px; border-radius: 7px;
  background: color-mix(in srgb, var(--danger) 10%, var(--raised)); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
}
.form-errors p { font-weight: 600; }
.form-errors a { color: inherit; font-weight: 600; text-underline-offset: 3px; }
.field-error {
  display: flex; gap: 6px; align-items: baseline; color: var(--danger); font-size: 13px; font-weight: 600;
}
.field-error::before {
  content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; transform: translateY(-1px);
}
.field-block input[aria-invalid="true"], .field-block select[aria-invalid="true"] {
  border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger);
}
fieldset.invalid .rs-pick span, fieldset.invalid .yn span { border-color: color-mix(in srgb, var(--danger) 60%, var(--rule)); }
.form-errors ul { margin: 4px 0 0; padding-left: 20px; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ---------- organize + dev pages ---------- */
.organize-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 28px 0 4px; }
.organize-head p { color: var(--mute); max-width: 62ch; flex: 1 1 320px; }

/* ---------- admin: admins ---------- */
.admins-page { max-width: 760px; padding-bottom: 48px; }
.admins-page .notice { margin: 16px 0 0; }
.admins-block { display: grid; gap: 10px; padding-top: 24px; margin-top: 24px; border-top: 1px solid var(--rule); }
.admins-block h2 { font: 600 16px/1.3 var(--ui); }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; }
.admin-list li { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--rule); }
.admin-name { font-weight: 600; }
.admin-added { color: var(--mute); font-size: 13px; margin-right: auto; font-variant-numeric: tabular-nums; }
.admins-form { max-width: 420px; }

/* ---------- admin: edit a signup ---------- */
.edit-pilot { padding-bottom: 48px; }
.signup-form.edit-form { margin-top: 20px; padding: 0; }
.c-act { white-space: nowrap; }
.c-act .btn-ghost { min-height: 32px; }
.page-title { font: 26px/1.2 var(--display); letter-spacing: 0.08em; }
.page-narrow { max-width: 560px; margin: 0 auto; padding: 40px 16px; display: grid; gap: 16px; }
.page-narrow p { color: var(--mute); }
/* ---------- sign on: three doors ---------- */
.signin { gap: 28px; }
.door { display: grid; gap: 8px; padding-top: 20px; border-top: 1px solid var(--rule); }
.door h2 { font: 600 16px/1.3 var(--ui); }
.door p { font-size: 14px; }
.door code { font: 600 13px ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink); }
.door-form { display: grid; gap: 8px; justify-items: start; margin-top: 4px; }
.door-form label:not(.sr-only) { font-weight: 600; font-size: 14px; }
.door-form input {
  font: 15px var(--ui); min-height: 42px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 7px;
  width: 100%; background: var(--raised); color: var(--ink);
}
.door-form input[aria-invalid="true"] { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.door-row { display: flex; gap: 10px; width: 100%; }
.door-row input { flex: 1; min-width: 0; }
.code-input { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.04em; }
.door-admin summary { cursor: pointer; color: var(--mute); font-weight: 600; font-size: 14px; width: fit-content; }
.door-admin summary:hover { color: var(--ink); }
.door-admin[open] summary { margin-bottom: 4px; }
.field-error { color: var(--danger); font-size: 14px; }

.foot { padding: 32px var(--gutter) 40px; color: var(--mute); font-size: 13px; }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  :root { --gutter: 24px; }
  .legend { margin-left: 0; width: 100%; }
  .field-search { margin-left: 0; flex: 1 1 220px; }
  .field-search input { width: 100%; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signup-form { padding-left: 0; }
}

@media (max-width: 720px) {
  :root { --gutter: 16px; }
  .shell { gap: 12px; min-height: 56px; }
  .brand { font-size: 19px; }
  .shell { gap: 10px; }
  .brand { font-size: 17px; gap: 8px; letter-spacing: 0.05em; }
  .brand span, .link-quiet { white-space: nowrap; }
  .nav { gap: 14px; }
  .nav a { font-size: 13px; }
  .who { gap: 8px; }
  .who .avatar { display: none; }
  .nav a[href="#signup"] { display: none; }
  .who-name { display: none; }
  .who .btn-discord { min-height: 36px; padding: 0 12px; font-size: 13px; }
  .who .btn-discord .long { display: none; }
  .atlas { padding-top: 14px; }
  .atlas-head p { width: 100%; }
  .legend { gap: 12px; flex-wrap: wrap; }
  .chart-svg.wide { display: none; }
  .chart-svg.narrow { display: block; }
  .tools .field.sort-pick { display: block; flex: 1 1 100%; }
  .sort-pick select { width: 100%; }
  .tools .field:not(.field-search) { flex: 1 1 40%; }
  .tools .field select { width: 100%; }

  .table-wrap { overflow: visible; }
  thead { display: none; }
  table, tbody { display: block; }
  tbody tr {
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; column-gap: 8px; row-gap: 2px;
    grid-template-areas: "num name rs" "num corp ws" "num discord discord" "num tech tech";
    padding: 12px 0; border-bottom: 1px solid var(--rule);
  }
  tbody th, tbody td { display: block; height: auto; padding: 0; border: 0; white-space: normal; }
  .c-num { grid-area: num; width: auto; padding-top: 2px; }
  .c-name { grid-area: name; }
  .c-corp { grid-area: corp; }
  .c-discord { grid-area: discord; font-size: 13px; overflow-wrap: anywhere; }
  .c-rs { grid-area: rs; }
  .c-ws { grid-area: ws; text-align: right; }
  .c-tech { grid-area: tech; font-size: 13px; color: var(--mute); }
  .c-tech .none { display: none; }
  .lbl { display: inline; color: var(--mute); font-weight: 400; font-size: 12px; }
  .c-ws .lbl { display: none; }
  .c-ws .ws:not(.ws-yes) { font-size: 12px; }
  .c-ws .ws:not(.ws-yes)::before { content: "WS: "; }

  .signup-bar { flex-wrap: wrap; gap: 10px 12px; min-height: 0; }
  .signup-copy { flex: 1 1 200px; }
  .signup-copy p { font-size: 13px; }
  .signup-actions { margin-left: 0; }
  .signup:not([data-form-open]):not(:has(.on-roster)) .signup-copy p { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: 1 / -1; }
  .rs-pick { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .rs-pick span { min-width: 0; padding: 0; }
  .form-actions .btn { flex: 1; }
  .organize .c-discord, .organize .c-date { display: none; }
}

@media (max-width: 359px) {
  .brand span {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- admin ---------- */
.admin-tabs {
  display: flex; gap: 24px; padding: 0 var(--gutter);
  background: var(--surface); border-bottom: 1px solid var(--rule);
}
.admin-tabs a {
  display: flex; align-items: center; min-height: 44px; margin-bottom: -1px;
  color: var(--mute); text-decoration: none; font-weight: 600; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.admin-tabs a:hover { color: var(--ink); }
.admin-tabs a[aria-current="page"] { color: var(--ink); border-color: var(--gold); }

.qs-intro { display: flex; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; padding: 24px 0 10px; }
.qs-intro p { color: var(--mute); }
.qs-status:empty { display: none; }
.qs-status { margin: 0 0 14px; padding: 10px 14px; border-radius: 7px; background: var(--lit); font-size: 14px; max-width: 80ch; }

.qs-layout { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 40px; }

/* Desktop: the board is a working surface that fills the window. Header and
   tabs stay put; the list and the groups each scroll on their own. */
@media (min-width: 901px) {
  body.app-fill { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
  body.app-fill > .foot { display: none; }
  body.app-fill .admin-qs { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  body.app-fill .qs-layout { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr); align-items: stretch; padding-bottom: 16px; }
  body.app-fill .qs-pool { position: static; max-height: none; min-height: 0; }
  html:has(body.app-fill) { overflow: hidden; }
  body.app-fill .qs-groups-col { min-height: 0; display: flex; flex-direction: column; }
  body.app-fill .groups { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  /* Each row of group cards is the full board height; a card's members scroll inside it,
     so two or three whole groups sit side by side and their open space stays droppable. */
  body.app-fill .group-grid {
    flex: 1; min-height: 0; overflow-y: auto; grid-auto-rows: 100%; align-items: stretch;
    padding-right: 4px; scrollbar-gutter: stable;
  }
  body.app-fill .group { display: flex; flex-direction: column; min-height: 0; }
  body.app-fill .group .chips { flex: 1; min-height: 0; overflow-y: auto; align-content: start; }
  body.app-fill .drop-hint { flex: 1; }
  body.app-fill .qs-intro { padding-top: 18px; }
}

/* The pool: everyone not yet seated. It is also the drop zone for "out of any group". */
.qs-pool {
  position: sticky; top: 16px; display: flex; flex-direction: column; max-height: calc(100vh - 32px);
  background: var(--raised); border: 1px solid var(--rule); border-radius: 7px;
}
.pool-head { display: grid; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--rule); }
.pool-head h2, .groups-heading h2 { font: 19px/1.2 var(--display); letter-spacing: 0.06em; text-wrap: balance; }
.seg-sm { display: flex; width: 100%; }
.seg-sm button { flex: 1; min-height: 32px; padding: 0 8px; }
.seg-sm button:first-child { border-left: 0; }
.pool-filters { display: flex; gap: 8px; }
.pool-filters .field { flex: 1; min-width: 0; margin: 0; }
.pool-filters select, .pool-filters input { width: 100%; }
.pool { flex: 1; min-height: 140px; overflow-y: auto; padding: 8px 6px 12px; border-radius: 0 0 7px 7px; transition: background-color 120ms; }
.pool-count { padding: 2px 8px 8px; font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.pool-empty { padding: 16px 8px; color: var(--mute); }

/* A pilot, in the pool or in a group: grip, name over corp, WS, RS, H2, action. */
.chips { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.chip {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) 30px 44px 40px 28px; align-items: center; gap: 8px;
  /* relative: keeps the visually hidden labels inside the row, so they scroll and clip with the list */
  position: relative; min-height: 46px; padding: 4px 6px 4px 8px; border-radius: 6px; cursor: grab;
  transition: background-color 120ms, opacity 120ms;
}
.chip:hover { background: var(--ground); }
.chip.dragging { opacity: 0.4; }
.chip:active { cursor: grabbing; }
.grip { color: var(--mute); opacity: 0.55; }
.chip:hover .grip { opacity: 1; }
.chip-main { display: grid; min-width: 0; line-height: 1.25; }
.chip-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-name .tag { margin-left: 4px; }
.chip-corp { font-size: 12px; color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .ws-yes { justify-self: start; font-size: 11px; padding: 1px 6px; }
.chip-rs { justify-self: end; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip-rs .rs-dot { margin-right: 6px; }
.chip-h2 { justify-self: end; font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lbl-h2 { font-size: 11px; margin-right: 3px; }
.chip-btn {
  width: 28px; height: 28px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 6px; background: var(--raised); color: var(--ink);
}
.chip-btn:hover { border-color: var(--rule-strong); }
.chip-remove:hover { color: var(--danger); border-color: currentColor; }

/* Groups */
.groups-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; padding-bottom: 14px; }
.groups-heading { display: flex; align-items: baseline; gap: 12px; }
.groups-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-left: auto; }
.next-hint { font-size: 13px; color: var(--mute); max-width: 46ch; text-wrap: balance; }
.groups-empty { display: grid; gap: 6px; max-width: 62ch; padding: 28px 0; color: var(--mute); }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 20px; align-items: start; }
.group {
  background: var(--raised); border: 1px solid var(--rule); border-radius: 7px;
  transition: border-color 120ms, box-shadow 120ms;
}
.group.is-target { border-color: var(--rule-strong); }
.group-head { display: grid; gap: 8px; padding: 14px 14px 12px; border-bottom: 1px solid var(--rule); }
.group-title-row { display: flex; align-items: center; gap: 10px; }
.group-title-row h3 { margin: 0; font: 19px/1.2 var(--display); letter-spacing: 0.06em; }
.group-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.group-count .of { color: var(--mute); font-weight: 400; }
.btn-link {
  background: none; border: 0; padding: 4px 2px; cursor: pointer; color: var(--ink);
  font: 600 13px var(--ui); text-decoration: underline; text-underline-offset: 3px;
}
.icon-btn {
  margin-left: auto; width: 32px; height: 32px; display: grid; place-items: center; padding: 0; cursor: pointer;
  border: 1px solid transparent; border-radius: 6px; background: none; color: var(--mute);
}
.icon-btn:hover { color: var(--danger); border-color: currentColor; }

.group-tabs { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 14px; }
.group-tab {
  display: inline-flex; align-items: baseline; gap: 8px; min-height: 38px; padding: 8px 12px; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 7px; background: var(--raised); color: var(--ink);
  font: 500 13px var(--ui); transition: border-color 120ms, box-shadow 120ms;
}
.group-tab:hover { border-color: var(--rule-strong); }
.group-tab.is-target { border-color: var(--rule-strong); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.tab-name { font-weight: 600; }
.tab-count { font-variant-numeric: tabular-nums; color: var(--mute); }
.tab-corp { color: var(--mute); max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-dragging .group-tab:not(.is-full) { border-style: dashed; border-color: var(--sky); }
.is-dragging .group-tab.is-full { opacity: 0.6; }
.group-tab.drop-over, .is-dragging .group-tab.drop-over { border-style: solid; border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }

/* Forty seats, drawn like the chart's grid: open seats are hairlines, filled ones ink. */
.seat-track { display: grid; grid-template-columns: repeat(40, minmax(0, 1fr)); gap: 2px; height: 10px; }
.seat-track i { border: 1px solid var(--sky); border-radius: 1px; }
.seat-track i.seat { background: var(--mute); border-color: var(--mute); }
.seat-track i.ws { background: var(--ink); border-color: var(--ink); }

.runs-in { display: flex; align-items: center; gap: 10px; }
.runs-in label { font-weight: 600; font-size: 14px; white-space: nowrap; }
.runs-in input {
  flex: 1; min-width: 0; min-height: 38px; padding: 0 10px;
  font: 15px var(--ui); color: var(--ink); background-color: var(--surface);
  border: 1px solid var(--rule); border-radius: 7px;
}
.runs-in input:hover { border-color: var(--mute); }
.group-head .hint { font-size: 12px; }
.group-stats { font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.group .chips { padding: 6px 6px 8px; }
.drop-hint { padding: 22px 14px; color: var(--mute); font-size: 14px; }

/* Dragging: open targets show a dashed edge; the one under the pointer gets the gold ring. */
.is-dragging .group:not(.is-full) { border-style: dashed; border-color: var(--sky); }
.is-dragging .group.is-full { opacity: 0.6; }
.group.drop-over, .is-dragging .group.drop-over { border-style: solid; border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.pool.drop-over { background: var(--lit); }

@media (max-width: 900px) {
  .qs-layout { grid-template-columns: minmax(0, 1fr); }
  .qs-pool { position: static; max-height: 60vh; }
  .groups-actions { margin-left: 0; }
}
@media (max-width: 720px) {
  .admin-tabs { gap: 18px; }
  .chip { grid-template-columns: 10px minmax(0, 1fr) 28px 40px 36px 32px; gap: 6px; }
  .chip-btn { width: 32px; height: 32px; }
  .groups-actions .btn { flex: 1 1 auto; }
}

/* ---------- admin: import ---------- */
.organize-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-imported { color: var(--ink); border: 1px dashed var(--sky); }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 22px; font-size: 13px; color: var(--mute); }
.crumbs a { color: var(--mute); }
.crumbs a:hover { color: var(--ink); }
.crumbs [aria-current] { color: var(--ink); max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-page .page-title { margin-top: 6px; }
.lede { color: var(--mute); max-width: 68ch; margin: 6px 0 18px; }
.import-page .form-errors { margin: 0 0 18px; }

.upload-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 40px; }
.upload-card { display: grid; gap: 14px; justify-items: start; }
/* Dashed: an open slot waiting for something, like the open signup row. */
.dropzone {
  position: relative; width: 100%; display: grid; justify-items: center; gap: 6px; padding: 36px 20px; cursor: pointer;
  border: 1px dashed var(--sky); border-radius: 7px; background: var(--raised); color: var(--ink); text-align: center;
  transition: border-color 120ms, background-color 120ms;
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--rule-strong); background: var(--surface); }
.dropzone svg { color: var(--mute); }
.dz-title { font-weight: 600; font-size: 16px; }
.dz-hint { color: var(--mute); font-size: 13px; }
.dz-file:not(:empty) { margin-top: 4px; font-weight: 600; font-size: 14px; }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.import-help { display: grid; gap: 10px; padding: 18px 20px; border: 1px solid var(--rule); border-radius: 7px; background: var(--raised); }
.import-help h2 { font: 19px/1.2 var(--display); letter-spacing: 0.06em; }
.import-help ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.import-help p, .import-help li { font-size: 14px; }
.import-help .templates { color: var(--mute); }

.import-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin: 6px 0 18px; }
.import-head .btn { margin-left: auto; }
.import-layout { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 28px; align-items: start; padding-bottom: 40px; }
.map-panel { display: grid; gap: 14px; padding: 16px; border: 1px solid var(--rule); border-radius: 7px; background: var(--raised); }
.map-panel h2, .preview-head h2, .import-done h2 { font: 19px/1.2 var(--display); letter-spacing: 0.06em; }
.file-opts { display: grid; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.opt-sheet { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.opt-sheet select { flex: 1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--atlas); }
/* Label beside its dropdown; the sample and hint sit under the dropdown. */
.map-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); column-gap: 12px; row-gap: 3px; align-items: center; }
.map-row > label { grid-column: 1; }
.map-row > select, .map-row > .map-sample, .map-row > .hint { grid-column: 2; }
.map-row label { font-weight: 600; font-size: 14px; }
.req { font-weight: 500; font-size: 11px; color: var(--mute); border: 1px solid var(--rule); border-radius: 4px; padding: 0 5px; margin-left: 4px; vertical-align: 1px; }
.map-panel select, .opt-sheet select {
  font: 14px var(--ui); color: var(--ink); background-color: var(--surface); width: 100%;
  border: 1px solid var(--rule); border-radius: 7px; min-height: 38px; padding: 0 10px;
}
.map-panel select:hover { border-color: var(--mute); }
.map-sample { font-size: 12px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-row .hint { font-size: 12px; }
.policy { display: grid; gap: 8px; margin: 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--rule); }
.policy legend { font-weight: 600; font-size: 14px; padding: 0 0 6px; }
.policy label { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.policy input { margin-top: 3px; accent-color: var(--atlas); }
.policy strong { display: block; }
.policy label span { color: var(--mute); }
.policy label strong { color: var(--ink); }

.import-preview { display: grid; gap: 12px; min-width: 0; align-content: start; }
/* Stays beside the choices while you work down them. */
@media (min-width: 901px) {
  .import-preview { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; padding-right: 2px; }
}
.preview-head { display: flex; align-items: baseline; gap: 12px; }
.import-blocking, .import-warning { padding: 10px 14px; border-radius: 7px; font-size: 14px; }
.import-blocking { background: color-mix(in srgb, var(--danger) 10%, var(--raised)); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); }
.import-warning { background: var(--lit); }
.tally { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tally li { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--rule); border-radius: 7px; background: var(--raised); }
.tally b { font-variant-numeric: tabular-nums; font-size: 16px; }
.preview-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; }
.preview-actions .hint { max-width: 60ch; }
.st { display: inline-block; font: 600 11px/1.5 var(--ui); padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.st-new { background: var(--gold); color: #14234b; }
.st-update { background: var(--atlas); color: #fff; }
.st-skip { color: var(--mute); border: 1px dashed var(--mute); }
.st-problem { color: var(--danger); border: 1px solid currentColor; }
.preview-table { overflow-x: auto; border: 1px solid var(--rule); border-radius: 7px; background: var(--raised); }
.preview-table table { min-width: 760px; }
.preview-table thead th { padding: 0 10px; }
.preview-table tbody td { height: 36px; padding: 0 10px; font-size: 14px; }
.preview-table .c-name { font-weight: 600; }
.preview-table tr.notes-row td { height: auto; padding: 0 10px 10px; border-top: 0; }
.preview-table tbody tr:has(+ .notes-row) td { border-bottom: 0; }
.st-row-problem { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.st-row-skip td { color: var(--mute); }
.note { display: inline-block; margin: 2px 12px 0 0; font-size: 13px; color: var(--danger); }
.st-row-skip .note { color: var(--mute); }
.import-done { display: grid; gap: 12px; padding: 20px; border: 1px solid var(--rule); border-radius: 7px; background: var(--raised); }

@media (max-width: 900px) {
  .upload-layout, .import-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .import-head .btn { margin-left: 0; }
  .map-row { grid-template-columns: minmax(0, 1fr); }
  .map-row > * { grid-column: 1 !important; }
  /* The roster's phone cards don't suit a preview grid: keep it a scrolling table. */
  .preview-table table { display: table; }
  .preview-table thead { display: table-header-group; }
  .preview-table tbody { display: table-row-group; }
  .preview-table tbody tr { display: table-row; padding: 0; }
  .preview-table tbody th, .preview-table tbody td { display: table-cell; height: 36px; padding: 0 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
  .preview-table tr.notes-row td { white-space: normal; }
}

/* ---------- signup: Compendium link ---------- */
.span-all { grid-column: 1 / -1; }
.signup-form fieldset.comp {
  display: grid; gap: 10px; padding: 14px 16px 16px; margin: 0;
  border: 1px solid var(--rule); border-radius: 7px; background: var(--surface);
}
.comp legend { padding: 0 6px; margin-left: -6px; font-weight: 600; font-size: 14px; }
.comp-status { display: grid; gap: 8px; }
.comp-lede { font-size: 14px; max-width: 72ch; }
.comp-lede .tag { margin-right: 6px; }
.comp-steps { margin: 0; padding-left: 20px; display: grid; gap: 2px; font-size: 14px; color: var(--mute); }
.comp-steps code, .comp-lede code {
  font-size: 13px; color: var(--ink); background: var(--raised);
  border: 1px solid var(--rule); border-radius: 4px; padding: 0 5px;
}
.comp-connect { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* The code is data, so it gets the data face and spacing that keeps dashes legible. */
.signup-form .comp-connect input[type="text"] {
  width: 19ch; min-width: 0; flex: 0 1 19ch; font: 15px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.04em;
}
.comp-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.comp-alt { display: grid; gap: 4px; max-width: 320px; font-weight: 600; font-size: 14px; }
.tag-synced { background: var(--atlas); color: #fff; }

/* ---------- tech card (static/peek.js) ---------- */

.peek {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; border: 0; background: none;
  font: inherit; color: inherit; cursor: pointer; text-align: left;
  text-decoration: underline dotted var(--mute); text-underline-offset: 3px;
}
.peek:hover, .peek[aria-expanded="true"] { text-decoration-color: currentColor; }
.peek-ico { flex: none; color: var(--mute); }
.peek:hover .peek-ico, .peek[aria-expanded="true"] .peek-ico { color: var(--ink); }
button.chip-h2 { border: 0; background: none; padding: 2px 0; font: inherit; cursor: pointer; }

/* Best weapon and shield in the roster: the game's icon in its group color, then the level. */
/* Three fixed slots (weapon, shield, H₂), so icons line up down the column whatever the level's digits. */
.mods { display: inline-grid; grid-template-columns: repeat(3, 3.9em); align-items: center; vertical-align: middle; }
.mod-empty { height: 18px; }
.mod .ti-ring { width: 14px; height: 14px; margin: 2px; border: 1.5px solid var(--mod); border-radius: 50%; }
.mod { --mod: #b0306a; display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mod-shield { --mod: #00788a; }
.mod-hydro { --mod: #5b3fb5; }
.mod .ti { width: 18px; height: 18px; background: var(--mod); }
@media (prefers-color-scheme: dark) { .mod { --mod: #ff8fb8; } .mod-shield { --mod: #66e0f0; } .mod-hydro { --mod: #b99cff; } }

/* The card is always dark, like the chart: it's the game's own look. */
.tech-card {
  --tc-trade: #ffd45a; --tc-mining: #b99cff; --tc-weapon: #ff8fb8; --tc-shield: #66e0f0;
  --tc-support: #7ee08a; --tc-drone: #ffa552; --tc-other: #eaf0fa;
  position: fixed; inset: auto; margin: 0; padding: 0;
  width: min(390px, calc(100vw - 16px)); max-height: calc(100vh - 16px); overflow: auto; overscroll-behavior: contain;
  color: var(--atlas-ink); background: #0d1733; border: 1px solid var(--atlas-line); border-radius: 10px;
  box-shadow: 0 18px 48px rgb(4 9 24 / 0.45), 0 2px 6px rgb(4 9 24 / 0.3);
  font: 13px/1.3 var(--ui); font-variant-numeric: tabular-nums;
}
.tech-card:focus { outline: none; }
.tc-note { margin: 0; padding: 14px 16px; color: var(--atlas-mute); }
.tc ul { list-style: none; margin: 0; padding: 0; }

.tc-head {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; align-items: center;
  padding: 12px 14px 10px; border-bottom: 1px solid var(--atlas-line);
}
.tc-rs {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  color: #14234b; background: var(--gold); font: 700 16px/1 var(--ui);
}
.tc-who { min-width: 0; }
.tc-name { margin: 0; font: 400 18px/1.15 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-sub { margin: 2px 0 0; color: var(--atlas-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-stats { grid-column: 1 / -1; display: flex; gap: 14px; margin-top: 4px !important; }
.tc-stats li { --g: var(--tc-other); display: flex; align-items: center; gap: 5px; }
.tc-stats .ti { width: 22px; height: 22px; background: var(--icon) center / contain no-repeat; mask: none; -webkit-mask: none; }

/* A grid, not columns: each row's two sections start on the same line. */
.tc-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; padding: 8px 14px 10px; }
.tc-group { color: var(--g); }
.tc-trade { --g: var(--tc-trade); } .tc-mining { --g: var(--tc-mining); } .tc-weapon { --g: var(--tc-weapon); }
.tc-shield { --g: var(--tc-shield); } .tc-support { --g: var(--tc-support); } .tc-drone { --g: var(--tc-drone); }
.tc-group h3 {
  margin: 0 0 4px; font: 600 11px/1.2 var(--ui); letter-spacing: 0.08em; text-transform: uppercase;
}
.tc-group ul { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px 2px; }
.tc-group li { display: grid; justify-items: center; gap: 1px; }
.ti {
  display: block; width: 24px; height: 24px; background: var(--g);
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
/* A new tech the icon set doesn't have yet: a plain ring in the group's color. */
.ti-none { mask: none; -webkit-mask: none; background: none; border: 1.5px solid var(--g); border-radius: 50%; width: 20px; height: 20px; margin: 2px; }
.tl { color: var(--atlas-ink); font-weight: 600; font-size: 12px; line-height: 1.1; }
.tc li.zero .ti { opacity: 0.28; }
.tc li.zero .tl { color: var(--atlas-mute); font-weight: 400; }

.tc-foot {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 8px 14px 10px; border-top: 1px solid var(--atlas-line);
}
.tc-ships { display: flex; gap: 14px; }
.tc-ships li { display: flex; align-items: center; gap: 4px; }
.tc-ships img { width: 16px; height: 32px; object-fit: contain; }
.tc-src { margin: 0; color: var(--atlas-mute); font-size: 11px; text-align: right; }

/* On a phone the card is a sheet along the bottom edge. */
@media (max-width: 560px) {
  .tech-card { left: 8px; right: 8px; bottom: 8px; top: auto; width: auto; max-height: 75vh; }
  .tc-group ul { gap: 4px 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .tech-card:popover-open { animation: tc-in 120ms ease-out; }
  @keyframes tc-in { from { opacity: 0; transform: translateY(4px); } }
}
