/* =========================================================
   FireFly
   Palette: #FA4C14 (orange accent) + #000000 (black).
   Orange is reserved for accents; lines and panels are neutral.
   Type: light serif display (Newsreader), uppercase grotesk UI
   (Inter Tight), tiny mono labels (JetBrains Mono).
   ========================================================= */

:root {
  --orange: #FA4C14;

  --serif: "Newsreader", "Times New Roman", Georgia, serif;
  --grotesk: "Inter Tight", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, Menlo, monospace;

  /* Easing + timing (hovers 0.35-0.45s, reveals 0.85s) */
  --ease-out-cubic: cubic-bezier(.215, .61, .355, 1);
  --ease-out-quint: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out-sine: cubic-bezier(.445, .05, .55, .95);

  --margin: 12px;
  --ascii-size: 14px;

  /* dark (default) */
  color-scheme: dark;
  --bg: #000000;
  --ink: #F2F2F2;
  --muted: #7D7D7D;
  --line: hsla(0, 0%, 95%, 0.10);
  --panel: hsla(0, 0%, 95%, 0.06);
  --panel-hover: hsla(0, 0%, 95%, 0.10);
  --ink-flash: #FFFFFF;     /* loader: color a character starts at */
  --ink-mid: #FFB08F;
  --tail: #FF8A5C;          /* glowing tail of the firefly */
  --glow: rgba(250, 76, 20, 0.55);
  --hot: #FFE7DC;           /* tail color at the peak of a flash */
  --firefly-opacity: 1;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #FFFFFF;
  --ink: #0B0B0B;
  --muted: #6F6F6F;
  --line: hsla(0, 0%, 5%, 0.12);
  --panel: hsla(0, 0%, 5%, 0.05);
  --panel-hover: hsla(0, 0%, 5%, 0.09);
  --ink-flash: #000000;
  --ink-mid: #FF7A45;
  --tail: #FA4C14;
  --glow: rgba(250, 76, 20, 0.40);
  --hot: #FF6A2E;
  --firefly-opacity: 0.8;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--grotesk);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body { transition: background-color .35s var(--ease-out-cubic), color .35s var(--ease-out-cubic); }
body.loading { overflow: hidden; }

::selection { background: var(--orange); color: #000; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Tiny mono label: 10px uppercase, grey */
.label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Loader ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--bg);
  cursor: pointer;
  transition: opacity .45s ease, visibility .45s;
}

.loader.is-leaving { opacity: 0; visibility: hidden; }

.ascii {
  margin: 0;
  font-family: var(--mono);
  font-size: var(--ascii-size);
  line-height: 1;
  letter-spacing: 0;
  color: var(--orange);
  white-space: pre;
  user-select: none;
}

.art { position: relative; z-index: 0; }

.ascii .c { opacity: 0; }

.loader.run .ascii .c {
  animation: ink .3s ease-out both;
  animation-delay: var(--d, 0ms);
}

@keyframes ink {
  0%   { opacity: 0; color: var(--ink-flash); }
  30%  { opacity: 1; color: var(--ink-mid); }
  100% { opacity: 1; color: var(--orange); }
}

.loader.lit .ascii .c { opacity: 1; }
.loader.lit .ascii .glow { color: var(--tail); transition: color .6s ease; }
.loader.instant .ascii .c { animation: none; opacity: 1; }

.lantern {
  position: absolute;
  z-index: -1;
  left: 50%;
  width: 12ch;
  height: 6em;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(250, 76, 20, .55), rgba(250, 76, 20, .18) 55%, transparent);
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
  transition: opacity .3s ease;
}

.loader.lit .lantern { opacity: 1; animation: lantern 1s ease-in-out .3s infinite; }

@keyframes lantern {
  0%, 100% { opacity: 1; }
  50%      { opacity: .4; }
}

.skip {
  position: absolute;
  right: max(var(--margin), env(safe-area-inset-right));
  bottom: max(var(--margin), env(safe-area-inset-bottom));
  padding: 10px 12px;
  background: var(--panel);
  border: 0;
  cursor: pointer;
  transition: color .35s var(--ease-out-cubic);
}

.skip:hover, .skip:focus-visible { color: var(--ink); outline: none; }

/* ---------- Ambient fireflies ---------- */

.fireflies {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: var(--firefly-opacity);
}

/* Each fly: the ASCII logo at 10px, moved/rotated/scaled by js/fireflies.js */
.fly {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--cols) * 1ch);
  height: calc(var(--rows) * 1em);
  font: 700 10px/1 var(--mono);
  transform-origin: 50% 50%;
  will-change: transform;
}

.fly__layer {
  position: absolute;
  inset: 0;
  margin: 0;
  font: inherit;
  white-space: pre;
  color: var(--orange);
}

/* Wings beat: quick horizontal squash around the body */
.fly__wings {
  opacity: .8;
  transform-origin: 50% 40%;
  animation: wingbeat var(--beat, .1s) ease-in-out infinite alternate;
}

@keyframes wingbeat {
  from { transform: scaleX(1); }
  to   { transform: scaleX(.55); }
}

/* Tail: dim at rest; a bright copy + soft glow flash on top */
.fly__tail { opacity: .45; }
.fly__hot  { color: var(--hot); opacity: 0; }

.fly__glow {
  position: absolute;
  left: 50%;
  top: var(--glow-top);
  width: 16ch;
  height: 10em;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(250, 76, 20, .9), rgba(250, 76, 20, .35) 45%, transparent);
  opacity: 0;
}

.fly__hot, .fly__glow {
  animation: flash var(--flash-dur, 4s) linear var(--flash-delay, 0s) infinite;
}

/* Firefly double blink, then dark for the rest of the cycle */
@keyframes flash {
  0%   { opacity: 0; }
  5%   { opacity: 1; }
  11%  { opacity: .15; }
  15%  { opacity: .9; }
  26%  { opacity: 0; }
  100% { opacity: 0; }
}

/* ---------- App shell ---------- */

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  opacity: 0;
  transition: opacity .5s ease .1s;
}

.app.is-ready { opacity: 1; }

/* ---------- Nav ---------- */

.site-nav {
  position: fixed;
  z-index: 50;
  top: max(var(--margin), env(safe-area-inset-top));
  left: 50%;
  width: min(calc(100vw - var(--margin) * 2), 440px);
  transform: translate(-50%, -12px);
  opacity: 0;
  transition: opacity .85s var(--ease-out-quint), transform .85s var(--ease-out-quint);
}

.app.is-ready .site-nav { opacity: 1; transform: translate(-50%, 0); }

.nav-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  width: 100%;
  height: 48px;
  padding: 0 var(--margin);
  color: var(--ink);
  background: var(--panel);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 0;
  cursor: pointer;
  transition: background-color .35s var(--ease-out-cubic);
}

.nav-bar:hover { background: var(--panel-hover); }
.nav-bar:focus-visible { outline: 1px solid var(--orange); outline-offset: 2px; }

.nav-bar__logo { justify-self: start; display: flex; align-items: center; }

.nav-bar__icon {
  position: relative;
  justify-self: center;
  width: 20px;
  height: 20px;
}

.nav-bar__icon svg {
  position: absolute;
  inset: 0;
  transition: transform .35s var(--ease-in-out-sine), opacity .15s var(--ease-in-out-sine);
}

.nav-bar__icon .icon-close { opacity: 0; transform: rotate(-45deg); }
.site-nav.open .nav-bar__icon .icon-ham { opacity: 0; transform: rotate(45deg); }
.site-nav.open .nav-bar__icon .icon-close { opacity: 1; transform: none; }

.nav-bar__label { justify-self: end; color: var(--ink); }

/* Header logo: the ASCII firefly, rendered at 10px then scaled down by js/logo.js */
.logo { position: relative; display: block; }

.logo-art {
  position: absolute;
  top: 0;
  left: 0;
  font-size: 10px;
  font-weight: 700;
  transform-origin: 0 0;
}

.logo-art .tail { color: var(--tail); }

/* Menu rows */
.nav-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  pointer-events: none;
}

.site-nav.open .nav-menu { pointer-events: auto; }

.nav-menu ul { margin: 0; padding: 0; list-style: none; }

.nav-item {
  padding: 4px 4px 0;
  background: var(--panel);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .35s var(--ease-out-cubic), transform .45s var(--ease-out-cubic);
  transition-delay: calc((3 - var(--i, 0)) * 30ms);
}

.site-nav.open .nav-item {
  opacity: 1;
  transform: none;
  transition-delay: calc(var(--i, 0) * 50ms);
}

.nav-item a {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  height: 44px;
  padding: 0 10px;
  color: var(--ink);
  text-decoration: none;
  transition: background-color .6s var(--ease-out-cubic);
}

.nav-item a:hover, .nav-item a:focus-visible { background: var(--panel); outline: none; }
.nav-item a[aria-disabled="true"] { cursor: default; }
.nav-item a[aria-disabled="true"] .nav-item__title { color: var(--muted); }

.nav-item__title {
  font-family: var(--grotesk);
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  text-transform: uppercase;
}

.nav-item .arrow { transform: translateX(-4px); transition: transform .35s var(--ease-out-cubic); }
.nav-item a:hover .arrow { transform: none; }

.nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 4px 14px;
}

.theme-switch { display: flex; gap: 4px; }

.theme-switch button {
  padding: 8px 10px;
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: color .35s var(--ease-out-cubic), border-color .35s var(--ease-out-cubic);
}

.theme-switch button:hover { color: var(--ink); }

.test-controls { display: flex; gap: 4px; }

.test-input {
  height: 32px;
  padding: 0 8px;
  font: 400 12px var(--mono);
  color: var(--orange);
  background: transparent;
  border: 1px dashed var(--orange);
  border-radius: 0;
  outline: none;
}

.test-controls button {
  padding: 0 10px;
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
}

.test-controls button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { color: var(--orange); border-color: var(--orange); }

/* ---------- Stage + steps ---------- */

.stage {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 96px var(--margin) max(48px, env(safe-area-inset-bottom));
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(440px, 100%);
}

.step.is-out {
  opacity: 0;
  transform: translateY(-12px);
  transition: opacity .35s var(--ease-in-out-sine), transform .35s var(--ease-in-out-sine);
}

/* Section title: one line, hairline under it */
.step-title {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  user-select: none;
}

.step-line {
  position: relative;
  /* clip only top/bottom (for the slide-up reveal), never the sides,
     so tight letter-spacing can't cut off the last letter */
  clip-path: inset(0 -100vw);
  padding: .14em 0 .12em;
  font-family: var(--serif);
  font-size: clamp(26px, 6vw, 48px);
  font-weight: 300;
  line-height: .9;
  letter-spacing: -0.06em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
}

.step-line em { font-style: normal; color: var(--orange); }

/* hairline draws in from the left */
.step-line::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .85s var(--ease-out-quint);
}

.step.is-in .step-line::after { transform: scaleX(1); }

/* Split-text reveal: each character slides up from below its line */
.split .word { display: inline-block; white-space: nowrap; }

.split .char {
  display: inline-block;
  padding-bottom: .06em;
  transform: translateY(110%);
  transition: transform .85s var(--ease-out-quint);
  transition-delay: calc(var(--i, 0) * 24ms);
}

.step.is-in .split .char { transform: none; }

/* Content under a title fades up after it */
.reveal-up {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .85s var(--ease-out-quint) .3s, transform .85s var(--ease-out-quint) .3s;
}

.step.is-in .reveal-up { opacity: 1; transform: none; }

/* ---------- Forms ---------- */

.phone-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(280px, 100%);
  margin-top: 24px;
}

.phone-input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  font: 500 1.05rem var(--mono); /* >= 16px so iOS doesn't zoom */
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--orange);
  caret-color: var(--orange);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  transition: border-color .35s var(--ease-out-cubic), background-color .35s var(--ease-out-cubic);
}

.phone-input::placeholder { color: var(--muted); opacity: .6; }
.phone-input:hover { background: var(--panel-hover); }
.phone-input:focus { border-color: var(--muted); }
.phone-input.invalid { border-color: #E5484D; }

.field-error { margin: 2px 0 0; color: #E5484D; text-align: center; }

.btn-primary {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  font: 500 14px var(--grotesk);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #000;
  background: var(--orange);
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: opacity .35s var(--ease-out-cubic), filter .35s var(--ease-out-cubic);
}

.btn-primary .arrow { transform: translateX(-4px); transition: transform .35s var(--ease-out-cubic); }
.btn-primary:hover:not(:disabled) .arrow { transform: none; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-primary:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }
.btn-primary:disabled { opacity: .3; cursor: not-allowed; }

/* Profile form: stacked fields with tiny labels */
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(280px, 100%);
  margin-top: 24px;
}

.stack-form .btn-primary { margin-top: 4px; }
.stack-form .link-btn { align-self: center; margin-top: -8px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  text-align: left;
}

.field > legend { padding: 0; margin-bottom: 8px; }

.text-input {
  width: 100%;
  height: 48px;
  padding: 0 12px;
  font: 500 16px var(--mono); /* 16px so iOS doesn't zoom */
  color: var(--orange);
  caret-color: var(--orange);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  transition: border-color .35s var(--ease-out-cubic), background-color .35s var(--ease-out-cubic);
}

.text-input::placeholder { color: var(--muted); opacity: .6; }
.text-input:hover { background: var(--panel-hover); }
.text-input:focus { border-color: var(--muted); }
.text-input.invalid { border-color: #E5484D; }

/* Choice chips (radio buttons) */
.chip-grid { display: grid; gap: 4px; }
.chip-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }
.chip-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.chip { position: relative; display: block; }

.chip input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.chip span {
  display: grid;
  place-items: center;
  height: 40px;
  font: 500 13px var(--mono);
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid transparent;
  transition: color .35s var(--ease-out-cubic), border-color .35s var(--ease-out-cubic), background-color .35s var(--ease-out-cubic);
  pointer-events: none;
}

.chip:hover span { color: var(--ink); background: var(--panel-hover); }
.chip input:checked + span { color: var(--orange); border-color: var(--orange); }
.chip input:focus-visible + span { outline: 1px solid var(--ink); outline-offset: 2px; }

.stack-inner { display: flex; flex-direction: column; gap: 20px; }
.stack-inner .btn-primary { margin-top: 4px; }
.stack-inner .link-btn { align-self: center; margin-top: -8px; }

.chip.is-disabled span { opacity: .3; }
.chip input:disabled { cursor: not-allowed; }
.chip-grid.cols-2 > .chip:last-child:nth-child(odd) { grid-column: span 2; }

.opt { text-transform: none; }

.row-between { display: flex; align-items: center; justify-content: space-between; }

.text-link {
  /* small underlined text, but a finger-sized tap area (padding offset by margin) */
  padding: 15px 4px;
  margin: -15px -4px;
  color: var(--muted);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color .35s var(--ease-out-cubic);
}

.text-link:hover, .text-link:focus-visible { color: var(--ink); outline: none; }

.value-line { font: 500 16px var(--mono); color: var(--orange); }

/* Session info under a title */
.session-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.session-when { color: var(--ink); }

/* Step 04 */
.done-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: min(320px, 100%);
  margin-top: 24px;
}

.list { width: 100%; }

.list-head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.rows { margin: 0; padding: 0; list-style: none; }

/* Table columns: #, name, main, backup */
.rows-head,
.rows li {
  display: grid;
  grid-template-columns: 26px 1fr 66px 66px;
  align-items: center;
}

.rows-head.no-num,
.rows.no-num li { grid-template-columns: 1fr 66px 66px; }

.rows-head {
  height: 32px;
  border-bottom: 1px solid var(--line);
}

.rows li {
  height: 40px;
  border-bottom: 1px solid var(--line);
}

.pos-tally {
  margin: 0;
  padding: 10px 0;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}

.pos-tally .is-full { color: var(--ink); }

.row-name {
  overflow: hidden;
  font: 500 14px var(--grotesk);
  text-transform: uppercase;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.row-main { color: var(--ink); white-space: nowrap; }
.row-backup { color: var(--muted); white-space: nowrap; }
.rows li.is-you .row-name { color: var(--orange); }

.row-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.link-btn.link-next { color: var(--orange); }
.link-btn.link-next:hover, .link-btn.link-next:focus-visible { color: var(--orange); }
.link-btn.is-armed { color: #E5484D; }

/* Step 05: teams */
.step.step-wide { width: min(960px, 100%); }
.step-wide .step-title { width: min(440px, 100%); }

.teams-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  margin-top: 24px;
}

.teams-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: min(320px, 100%);
}

@media (min-width: 900px) {
  .teams-grid { grid-template-columns: repeat(3, 1fr); width: 100%; }
}

.team {
  padding: 4px 12px 0;
  background: var(--panel);
  border: 1px solid transparent;
  transition: border-color .35s var(--ease-out-cubic);
}

.team.is-yours { border-color: var(--orange); }

.team-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  border-bottom: 1px solid var(--line);
}

.team-name {
  font: 500 16px var(--grotesk);
  text-transform: uppercase;
}

.team.is-yours .team-name { color: var(--orange); }

/* role · name · rating · backup tag */
.team-rows li { grid-template-columns: 36px 1fr 28px 48px; }
.row-rating { color: var(--ink); }
.row-note { text-align: right; }
.team-rows li:last-child { border-bottom: 0; }
.team-rows li.is-needed .row-name { color: var(--orange); opacity: .7; font-family: var(--mono); font-size: 11px; }

.waitlist, #early-wrap { width: min(320px, 100%); }

.test-clock {
  position: fixed;
  z-index: 60;
  left: max(var(--margin), env(safe-area-inset-left));
  bottom: max(var(--margin), env(safe-area-inset-bottom));
  padding: 8px 10px;
  color: var(--orange);
  background: var(--panel);
  border: 1px dashed var(--orange);
}

.next-body { display: flex; flex-direction: column; align-items: center; gap: 20px; margin-top: 32px; }
.next-text { color: var(--muted); }

.link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px; /* space between words and arrows (flex drops plain spaces at the edges) */
  min-height: 44px;
  padding: 10px 12px;
  background: var(--panel);
  border: 0;
  cursor: pointer;
  transition: color .35s var(--ease-out-cubic), background-color .35s var(--ease-out-cubic);
}

.link-btn:hover, .link-btn:focus-visible { color: var(--ink); background: var(--panel-hover); outline: none; }

/* =========================================================
   Admin page
   ========================================================= */

.admin-stage { place-items: start center; padding-top: 104px; }

.admin-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  margin-top: 20px;
  padding-bottom: 96px; /* room for the action bar */
}

.hint-line { margin: 0; text-align: center; }
.muted-line { margin: 0; color: var(--muted); line-height: 1.5; }

/* Tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }

.tab {
  min-height: 44px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid transparent;
  cursor: pointer;
  transition: color .35s var(--ease-out-cubic), border-color .35s var(--ease-out-cubic);
}

.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--orange); border-color: var(--orange); }

.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(560px, 100%);
}

#panel-teams { width: 100%; align-items: center; }

/* Cards */
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid transparent;
}

.card-dev { border: 1px dashed var(--orange); background: transparent; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.card-title { font: 500 15px var(--grotesk); text-transform: uppercase; }

.card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card-actions .link-btn { margin: 0; }

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  margin: 0;
}

.facts dt { align-self: center; }
.facts dd { margin: 0; font: 500 14px var(--mono); color: var(--ink); }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px 12px;
}

.form-grid[hidden] { display: none; }

/* Dropdowns look like the Date / Start boxes (same box, font, hover), plus a small arrow */
.select {
  width: 100%;
  height: 44px;
  padding: 0 34px 0 12px;
  font: 500 16px var(--mono);
  color: var(--ink);
  background-color: var(--panel);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237D7D7D' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .35s var(--ease-out-cubic), background-color .35s var(--ease-out-cubic);
}

.select:hover { background-color: var(--panel-hover); }
.select:focus { border-color: var(--muted); }
/* Open dropdown list: same look as the browser's date / time pickers
   (dark gray with light text in dark mode, white in light mode; browser's blue highlight) */
.select option { color: #F2F2F2; background-color: #3B3B3B; }
[data-theme="light"] .select option { color: #0B0B0B; background-color: #FFFFFF; }

.form-card .text-input { height: 44px; font-size: 16px; }
.form-card input[type="date"], .form-card input[type="time"] { color: var(--ink); }

.btn-compact { height: 40px; padding: 0 16px; gap: 10px; justify-content: center; }


/* Admin signup rows: two lines on phones */
.admin-rows.rows-head { display: none; }

.rows.admin-rows li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  grid-template-areas:
    "name rating status"
    "pos  actions actions";
  gap: 6px 12px;
  height: auto;
  padding: 10px 0;
}

.admin-rows li > .row-name { grid-area: name; }
.admin-rows li > .row-rating { grid-area: rating; }
.admin-rows li > .row-main { grid-area: pos; }
.admin-rows li > .status-in,
.admin-rows li > .status-wait { grid-area: status; text-align: right; }
.admin-rows li > .row-actions-inline { grid-area: actions; justify-self: end; display: flex; gap: 14px; }

.status-in { color: var(--orange); }
.status-wait { color: var(--muted); }

.lock-tag {
  margin-left: 8px;
  padding: 2px 5px;
  font-size: 10px;
  color: var(--orange);
  border: 1px solid var(--orange);
  vertical-align: middle;
}

.pos-tally .is-short { color: var(--muted); }

/* Banner above teams */
.banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  width: min(560px, 100%);
  padding: 10px 12px;
  border: 1px solid var(--line);
}

/* Admin team cards: tappable rows */
.admin-teams { width: min(320px, 100%); }
@media (min-width: 900px) { .admin-teams { width: 100%; } }

.slot-row, .wait-row { cursor: pointer; transition: background-color .35s var(--ease-out-cubic); }
.slot-row:hover, .wait-row:hover { background: var(--panel); }
.slot-row:focus-visible, .wait-row:focus-visible { outline: 1px solid var(--muted); outline-offset: -1px; }
.slot-row.is-selected, .wait-row.is-selected { outline: 1px solid var(--orange); outline-offset: -1px; background: var(--panel); }
.slot-row.is-optional .row-name { color: var(--muted); opacity: .7; font-family: var(--mono); font-size: 11px; }

.admin-waitlist .rows li { grid-template-columns: 1fr 28px auto; }

.fill-card { width: min(560px, 100%); border-color: var(--orange); }
.suggest-row { grid-template-columns: 1fr 28px auto auto !important; gap: 10px; height: auto !important; min-height: 40px; }

/* Players */
.rows .player-row { grid-template-columns: 1fr auto 28px 14px; gap: 10px; cursor: pointer; }
.rows .player-row:hover { background: var(--panel); }
.rows .player-edit-row { display: block; height: auto; padding: 12px 0; }
.player-edit { display: flex; flex-direction: column; gap: 12px; }

/* Bottom action bar + toast */
.action-bar {
  position: fixed;
  z-index: 55;
  left: 50%;
  bottom: max(var(--margin), env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: min(calc(100vw - var(--margin) * 2), 520px);
  padding: 12px;
  background: var(--panel);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border: 1px solid var(--orange);
}

.action-bar p { margin: 0; color: var(--ink); text-align: center; line-height: 1.4; }
.action-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.action-buttons .link-btn { margin: 0; }

.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  padding: 10px 14px;
  color: #000;
  background: var(--orange);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .fireflies { display: none; }
  .split .char, .reveal-up, .step-line::after,
  .nav-item, .site-nav { transition: none !important; }
  .split .char { transform: none; }
  .reveal-up { opacity: 1; transform: none; }
  .step-line::after { transform: scaleX(1); }
}
