/* Station blue and turnout gold: the colours of a hall, not a SaaS dashboard.
   Fonts are bundled so phones make no third-party requests. */

@font-face {
  font-family: 'Barlow Condensed';
  src: url('/fonts/barlow-condensed-latin-600-normal.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Barlow Condensed';
  src: url('/fonts/barlow-condensed-latin-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --station: #123b5c;
  --station-deep: #0b2740;
  --nomex: #d9a441;
  --nomex-soft: #f3e2b8;
  --paper: #f3f5f6;
  --surface: #ffffff;
  --ink: #13212d;
  --steel: #56656f;
  --line: #c6d0d6;
  --alert: #a8352b;
  --focus: #d9a441;
  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --text: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not(.screen) {
    --paper: #0d1c29;
    --surface: #142a3c;
    --ink: #eef2f4;
    --steel: #9fb0bc;
    --line: #2b4559;
    --station: #2f6c9b;
    --alert: #f08a7e;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 var(--text);
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- phone pages ---------- */
.phone {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 34rem;
  margin: 0 auto;
  padding: 1rem 1rem 1.25rem;
}
.phone header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding-bottom: .75rem;
  border-bottom: 2px solid var(--nomex);
  color: var(--steel);
  font-size: .9rem;
}
.phone header .event { font-family: var(--display); font-weight: 600; font-size: 1.05rem; color: var(--ink); }
.phone main { flex: 1; padding: 1.5rem 0 1rem; }
.phone footer { color: var(--steel); font-size: .82rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.phone footer p { margin: 0; }
.phone .host-logo { flex: none; width: 34px; height: 34px; }
.byline { display: flex; align-items: center; gap: .45rem; margin-top: .6rem !important; font-weight: 600; }
.byline img { flex: none; width: 22px; height: auto; }

/* A logo with a navy and a white version: show the one that suits the theme. */
.on-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not(.screen) .on-dark { display: inline; }
  :root:not(.screen) .on-light { display: none; }
}
.product-logo { margin: 1.5rem 0 .5rem; line-height: 0; }
.product-logo img { width: 10rem; height: auto; }

h1.prompt {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 7vw, 2.2rem);
  line-height: 1.08;
  margin: 0 0 .5rem;
  letter-spacing: -.005em;
}
.detail { margin: 0 0 1.25rem; color: var(--steel); }
.detail a { color: var(--ink); font-weight: 600; text-decoration-color: var(--nomex); text-decoration-thickness: 2px; text-underline-offset: .2em; }
.lead { font-family: var(--display); font-weight: 600; font-size: 1.6rem; line-height: 1.15; margin: 0 0 .5rem; }

.options { display: grid; gap: .6rem; margin-top: 1.25rem; }
.option {
  display: flex;
  align-items: center;
  gap: .9rem;
  width: 100%;
  min-height: 3.6rem;
  padding: .7rem 1rem;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: left;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.45rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.option:active { transform: translateY(1px); }
.option .tick {
  flex: none;
  width: 1.3rem; height: 1.3rem;
  border-radius: 50%;
  border: 2px solid var(--line);
}
.option[aria-pressed="true"] { border-color: var(--station); background: var(--station); color: #fff; }
.option[aria-pressed="true"] .tick { border-color: var(--nomex); background: var(--nomex); box-shadow: inset 0 0 0 3px var(--station); }
.option:disabled { cursor: default; opacity: .55; }
.option[aria-pressed="true"]:disabled { opacity: 1; }

.status { min-height: 1.5em; margin: 1rem 0 0; color: var(--steel); }
.status.error { color: var(--alert); font-weight: 600; }

/* results on phones */
.results { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: .85rem; }
.results li { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; align-items: baseline; }
.results .label { font-family: var(--display); font-weight: 600; font-size: 1.3rem; }
.results .pct { font-family: var(--display); font-weight: 700; font-size: 1.3rem; }
.results .track { grid-column: 1 / -1; height: .7rem; background: var(--line); border-radius: 4px; overflow: hidden; }
.results .fill { height: 100%; background: var(--nomex); width: 0; }
.results li.mine .label::after { content: ' (you)'; font-weight: 600; color: var(--steel); font-size: 1rem; }

/* code entry */
.join-form { display: grid; gap: .75rem; margin-top: 1.5rem; }
.join-form input {
  font-family: var(--display); font-weight: 700; font-size: 2.2rem; letter-spacing: .12em;
  text-transform: uppercase; text-align: center;
  padding: .5rem; border: 2px solid var(--line); border-radius: 10px; background: var(--surface);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3.2rem; padding: .6rem 1.2rem;
  border: 0; border-radius: 10px;
  background: var(--station); color: #fff;
  font-family: var(--display); font-weight: 700; font-size: 1.35rem; letter-spacing: .01em;
  cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: .6; cursor: progress; }
.btn.secondary { background: transparent; color: var(--ink); border: 2px solid var(--line); }

/* feedback form */
form.feedback { display: grid; gap: 1.6rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend, .field > label { display: block; font-weight: 600; margin-bottom: .45rem; }
.hint { color: var(--steel); font-size: .88rem; font-weight: 400; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .4rem; }
.seg button {
  min-height: 3rem; padding: .4rem; border: 2px solid var(--line); border-radius: 8px;
  background: var(--surface); font-family: var(--display); font-weight: 600; font-size: 1.15rem; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--station); border-color: var(--station); color: #fff; }
.scale-ends { display: flex; justify-content: space-between; color: var(--steel); font-size: .82rem; margin-top: .3rem; }
textarea, input[type="email"], input[type="text"] {
  width: 100%; padding: .7rem .8rem; border: 2px solid var(--line); border-radius: 8px; background: var(--surface);
}
textarea { min-height: 5.5rem; resize: vertical; }
.check { display: grid; grid-template-columns: auto 1fr; gap: .7rem; align-items: start; margin-top: .7rem; }
.check input { width: 1.35rem; height: 1.35rem; margin: .15rem 0 0; accent-color: var(--station); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.panel > .check:first-child { margin-top: 0; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- projector screen ---------- */
.screen body, body.screen {
  background: var(--station-deep);
  color: #fff;
  overflow: hidden;
}
.stage {
  position: fixed; inset: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 4.5vh 5vw 3.5vh;
}
.stage-join {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5vw;
  align-items: center;
}
.qr-card { background: #fff; padding: 1.4vw; border-radius: 1vw; line-height: 0; }
.qr-card img { width: min(38vw, 62vh); height: auto; display: block; }
.join-copy .on-phone { font-size: 2.6vw; color: var(--nomex-soft); margin: 0 0 1vh; }
.join-copy .url { font-family: var(--display); font-weight: 700; font-size: 4.6vw; line-height: 1; margin: 0; white-space: nowrap; }
.join-copy .url span { color: var(--nomex); }
.join-copy .closing-head { font-family: var(--display); font-weight: 700; font-size: 6vw; line-height: 1; margin: 0 0 1.5vh; color: #fff; }
.join-copy .closing-body { font-size: 2.2vw; color: #fff; margin: 0 0 6vh; max-width: 30ch; }
.join-copy .note { font-size: 1.7vw; color: #b9c8d4; margin: 3vh 0 0; max-width: 36ch; }

.brand-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 3vw;
  padding-top: 2.2vh; border-top: 2px solid rgba(217,164,65,.55);
  font-family: var(--display); font-weight: 600; font-size: 1.9vw; color: #dbe5ec;
}
.brand-bar .brand { display: flex; align-items: center; gap: 1vw; white-space: nowrap; }
.brand-bar .crest { height: 8vh; width: auto; }
.brand-bar .mark { height: 5.5vh; width: auto; }
.brand-bar .by { color: #9fb3c2; font-weight: 600; }
.brand-bar .sep { width: 2px; height: 4vh; background: rgba(255,255,255,.25); margin: 0 .6vw; }
.brand-bar .wordmark { height: 3vh; width: auto; }

.stage-q { display: grid; grid-template-rows: auto 1fr; gap: 4vh; min-height: 0; padding-bottom: 3vh; }
.stage-q h1 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(2rem, 4.6vw, 7rem); line-height: 1.04;
  margin: 0; max-width: 24ch;
}
.stage-q .detail { color: #c4d2dc; font-size: 2vw; margin: 1.5vh 0 0; max-width: 52ch; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; align-content: center; gap: 2.4vh; }
.bars li { display: grid; grid-template-columns: minmax(10vw, auto) 1fr 9vw; align-items: center; gap: 2vw; }
.bars .label { font-family: var(--display); font-weight: 600; font-size: 3vw; line-height: 1; }
.bars .track { height: 5.2vh; background: rgba(255,255,255,.09); border-radius: .5vw; overflow: hidden; }
.bars .fill { height: 100%; width: 0; background: var(--nomex); border-radius: .5vw; transition: width 900ms cubic-bezier(.2,.7,.2,1); }
.bars .pct { font-family: var(--display); font-weight: 700; font-size: 3.4vw; line-height: 1; text-align: right; }
.bars.hidden-results .track, .bars.hidden-results .pct { visibility: hidden; }

.stage-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 2vw;
  padding-top: 2.5vh; border-top: 2px solid rgba(217,164,65,.55);
  font-size: 1.7vw; color: #c4d2dc;
}
.stage-foot .count { font-family: var(--display); font-weight: 700; font-size: 3vw; line-height: 1; color: #fff; }
.stage-foot .state { margin-left: 1.2vw; }
.stage-foot .mini { display: flex; align-items: center; gap: 1.2vw; }
.stage-foot .mini img { width: 7vh; height: 7vh; background: #fff; padding: .4vh; border-radius: .4vh; }

.help {
  position: fixed; right: 2vw; bottom: 12vh; background: rgba(4,18,30,.92); color: #e3ebf0;
  padding: 1.2rem 1.4rem; border-radius: 10px; font-size: 15px; line-height: 1.7; max-width: 26rem;
}
.help kbd { font-family: var(--text); background: #29445a; border-radius: 4px; padding: 0 .4em; }
.toast {
  position: fixed; left: 50%; top: 2vh; transform: translateX(-50%);
  background: var(--alert); color: #fff; padding: .5rem 1rem; border-radius: 8px; font-size: 15px;
}

@media (prefers-reduced-motion: reduce) {
  .bars .fill { transition: none; }
}

/* ---------- control page ---------- */
.control { max-width: 46rem; margin: 0 auto; padding: 1rem; }
.control h1 { font-family: var(--display); font-weight: 700; font-size: 1.9rem; margin: .25rem 0 .25rem; }
.control .sub { color: var(--steel); margin: 0 0 1rem; }
.control .row { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.control .btn { font-size: 1.1rem; min-height: 2.8rem; padding: .4rem .9rem; }
.qcard { background: var(--surface); border: 2px solid var(--line); border-radius: 10px; padding: .9rem 1rem; margin: .8rem 0; }
.qcard.live { border-color: var(--nomex); }
.qcard h2 { font-size: 1.05rem; margin: 0 0 .5rem; line-height: 1.35; }
.qcard .live-tag { display: inline-block; background: var(--nomex); color: var(--station-deep); font-weight: 700; font-size: .8rem; padding: .05rem .5rem; border-radius: 4px; margin-bottom: .4rem; }
.mini-bars { display: grid; grid-template-columns: auto 1fr auto; gap: .25rem .6rem; align-items: center; font-size: .92rem; }
.mini-bars .t { height: .55rem; background: var(--line); border-radius: 3px; overflow: hidden; }
.mini-bars .f { height: 100%; background: var(--nomex); }
/* Next / Back: the clicker, on your phone. Stays at the top while you scroll. */
.stepper {
  position: sticky; top: 0; z-index: 5;
  margin: .5rem -1rem 1rem; padding: .75rem 1rem .6rem;
  background: var(--paper); border-bottom: 2px solid var(--nomex);
}
.stepper .now { margin: 0 0 .6rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.stepper .now .k { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--steel); }
.stepper .now strong { font-size: 1.05rem; }
.stepper .now .votes { color: var(--steel); font-size: .92rem; }
.step-btns { display: grid; grid-template-columns: 1fr 2.2fr; gap: .6rem; }
.control .step-btns .btn { min-height: 4.6rem; font-size: 1.6rem; }
.step-btns .next { flex-direction: column; line-height: 1.05; gap: .25rem; }
.step-btns .next .what { font-family: var(--text); font-weight: 600; font-size: .88rem; opacity: .85; }
.step-btns .next:disabled { cursor: default; }
.stepper .status { margin: .5rem 0 0; min-height: 0; }

.tabs { display: flex; gap: .4rem; flex-wrap: wrap; }
.tabs button { border: 2px solid var(--line); background: var(--surface); border-radius: 8px; padding: .35rem .8rem; cursor: pointer; font-weight: 600; }
.tabs button[aria-pressed="true"] { border-color: var(--station); background: var(--station); color: #fff; }
.links a { color: inherit; }
.small { font-size: .88rem; color: var(--steel); }
.check.flush { margin-top: 0; }
.field.spaced { margin-top: .8rem; }
.btn.full { width: 100%; }

/* product panel on the feedback form: the one dark block on the page */
.promo {
  background: var(--station-deep);
  color: #fff;
  border-radius: 10px;
  border-top: 4px solid var(--nomex);
  padding: 1.1rem 1rem 1.2rem;
}
.promo h2 { font-family: var(--display); font-weight: 700; font-size: 1.55rem; line-height: 1.1; margin: 0 0 .5rem; }
.promo p { margin: 0 0 1rem; color: #d3dee6; }
.promo legend { color: #fff; }
.promo .seg button { background: transparent; border-color: #3d5c75; color: #fff; }
.promo .seg button[aria-pressed="true"] { background: var(--nomex); border-color: var(--nomex); color: var(--station-deep); }
.promo .check input { accent-color: var(--nomex); }
.promo .promo-link { margin: .9rem 0 0; }
.promo a { color: var(--nomex-soft); }
.promo-logo { display: block; width: 11rem; height: auto; margin: .2rem 0 .9rem; }
