/* Layout: an airline check-in screen. A departure board on top, the flight
   route under it, and the questions on a boarding pass with a tear-off stub. */
:root {
  --bg: #eef2f5;
  --surface: #ffffff;
  --surface-alt: #f5f8fa;
  --ink: #1f2c3a;
  --muted: #5f6d7b;
  --line: #d6dee6;
  --livery: #46688a;
  --livery-deep: #2f4a66;
  --livery-soft: #c9d8e6;
  --on-livery: #ffffff;
  --board: #17202a;
  --board-cell: #222d39;
  --flap-ink: #f1c45b;
  --board-label: #8b9aab;
  --seat: #e4ebf1;
  --seat-ink: #2f4a66;
  --error: #b2402f;
  --tone-low: #c2412d;
  --tone-mid: #d29214;
  --tone-high: #2f8a4c;
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161d;
    --surface: #18212b;
    --surface-alt: #1d2833;
    --ink: #e6edf3;
    --muted: #9aa8b6;
    --line: #2c3947;
    --livery: #7e9fbd;
    --livery-deep: #a9c1d8;
    --livery-soft: #33475b;
    --on-livery: #0f1720;
    --board: #0a0f14;
    --board-cell: #151d26;
    --seat: #24313e;
    --seat-ink: #c9d8e6;
    --error: #ef8a78;
    --tone-low: #ef7a64;
    --tone-mid: #f0b440;
    --tone-high: #5cc27e;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 980px;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

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

/* --- Top bar --------------------------------------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.brand svg { display: block; }
.topbar-flight {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

main.wrap {
  display: grid;
  gap: 18px;
  padding-block: 22px 48px;
}

/* --- Departure board ------------------------------------------------------- */

.board {
  display: grid;
  grid-template-columns: auto auto auto 1fr;
  gap: 4px 28px;
  align-items: end;
  background: var(--board);
  border-radius: var(--radius);
  padding: 14px 20px 16px;
  color: #ffffff;
}
.board-col { display: grid; gap: 6px; min-width: 0; }
.board-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--board-label);
}
.board-value {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.08em;
  color: #ffffff;
  white-space: nowrap;
}
.flap { display: flex; gap: 3px; flex-wrap: nowrap; }
.flap-cell {
  display: inline-grid;
  place-items: center;
  width: 1.3em;
  height: 1.65em;
  background: var(--board-cell);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--flap-ink);
  position: relative;
}
.flap-cell::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 1px;
  background: var(--board);
  opacity: 0.8;
}

@media (max-width: 720px) {
  .board { grid-template-columns: repeat(3, auto); justify-content: start; }
  .board-status { grid-column: 1 / -1; }
  .flap-cell { width: 1.15em; font-size: 16px; }
}

/* --- Route ----------------------------------------------------------------- */

.route-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 8px 0;
}
#route { display: block; width: 100%; height: auto; overflow: visible; }
.ground { stroke: var(--line); stroke-width: 2; }
.runway line { stroke: var(--muted); stroke-width: 5; stroke-dasharray: 10 8; opacity: 0.45; }
.route-path {
  fill: none;
  stroke: var(--livery-soft);
  stroke-width: 3;
  stroke-dasharray: 2 9;
  stroke-linecap: round;
}
.route-flown {
  fill: none;
  stroke: var(--livery);
  stroke-width: 4;
  stroke-linecap: round;
}
.plane path { fill: var(--livery-deep); stroke: var(--surface); stroke-width: 1.5; }

.station circle {
  fill: var(--surface);
  stroke: var(--livery-soft);
  stroke-width: 3;
  transition: fill 0.3s, stroke 0.3s;
}
.station.done circle { fill: var(--livery); stroke: var(--livery); }
.station.current circle { stroke: var(--livery); stroke-width: 4; }
.station.destination circle { stroke-dasharray: 3 3; }
.station.destination.done circle { stroke-dasharray: none; }
.station-code {
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  fill: var(--ink);
  text-anchor: middle;
  letter-spacing: 0.06em;
}
.station-name {
  font-family: var(--sans);
  font-size: 15px;
  fill: var(--muted);
  text-anchor: middle;
}
.station.current .station-code { fill: var(--livery); }

@media (max-width: 640px) {
  .station-name { display: none; }
  .station-code { font-size: 30px; }
}

/* --- Boarding pass --------------------------------------------------------- */

.pass, .arrival {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px -18px rgba(23, 32, 42, 0.45);
  overflow: hidden;
}
.pass[hidden], .arrival[hidden] { display: none; }
.pass-main, .arrival-main {
  padding: 26px 30px 28px;
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}
.pass-kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--livery);
}
.pass-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  font-weight: 650;
  text-wrap: balance;
}
.pass-intro { margin: 0; color: var(--muted); max-width: 62ch; }

.pass-stub {
  position: relative;
  border-left: 2px dashed var(--line);
  background: var(--surface-alt);
  padding: 26px 20px;
  display: grid;
  gap: 14px;
  align-content: start;
}
.pass-stub::before, .pass-stub::after {
  content: "";
  position: absolute;
  left: -11px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
}
.pass-stub::before { top: -11px; }
.pass-stub::after { bottom: -11px; }
.stub-row { display: grid; gap: 2px; }
.stub-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.stub-value { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.barcode {
  height: 54px;
  margin-top: 6px;
  background: repeating-linear-gradient(90deg,
    var(--ink) 0 2px, transparent 2px 4px,
    var(--ink) 4px 5px, transparent 5px 8px,
    var(--ink) 8px 11px, transparent 11px 12px,
    var(--ink) 12px 13px, transparent 13px 16px);
  opacity: 0.75;
}

@media (max-width: 720px) {
  .pass, .arrival { grid-template-columns: minmax(0, 1fr); }
  .pass-stub { display: none; }
  .pass-main, .arrival-main { padding: 22px 18px 24px; }
  .pass-title { font-size: 22px; }
}

/* Step change: the pass slides in from the right. */
.pass-main.enter { animation: pass-in 0.45s ease-out; }
@keyframes pass-in {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: none; }
}

/* --- Questions ------------------------------------------------------------- */

.questions { display: grid; gap: 22px; margin-top: 6px; }
.section { display: grid; gap: 16px; }
.section-heading {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 650;
  color: var(--livery-deep);
  letter-spacing: 0.02em;
}

.question { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: 8px; }
.question-label { padding: 0; font-weight: 600; font-size: 16px; }
.required-tag {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--livery);
  vertical-align: 1px;
}
.question-help { margin: 0; font-size: 14px; color: var(--muted); }
.question-error { margin: 0; font-size: 14px; color: var(--error); font-weight: 600; }

/* Scale answers are drawn as a row of seats. */
.seats { display: flex; flex-wrap: wrap; gap: 6px; }
.seat { position: relative; }
.seat input, .chip input {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
}
.seat span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 46px;
  border-radius: 10px 10px 6px 6px;
  background: var(--seat);
  color: var(--seat-ink);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 16px;
  border: 2px solid transparent;
  border-bottom-width: 6px;
  border-bottom-color: var(--line);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  user-select: none;
}
.seat span:hover { transform: translateY(-2px); }
.seat input:checked + span {
  background: var(--livery);
  color: var(--on-livery);
  border-bottom-color: var(--livery-deep);
}
.seat input:focus-visible + span { outline: 3px solid var(--livery); outline-offset: 2px; }
.seats-wide .seat span { width: 36px; }
.scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
}
.scale-block { display: grid; gap: 4px; width: max-content; max-width: 100%; }

@media (max-width: 480px) {
  .seat span { width: 38px; height: 42px; }
  .scale-block.wide { width: 100%; }
  .seats-wide {
    display: grid;
    grid-template-columns: repeat(var(--seat-count), minmax(0, 1fr));
    gap: 3px;
  }
  .seats-wide .seat span { width: auto; font-size: 14px; }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-size: 15px;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chip span:hover { border-color: var(--livery); }
.chip input:checked + span {
  background: var(--livery);
  border-color: var(--livery);
  color: var(--on-livery);
}
.chip input:focus-visible + span { outline: 3px solid var(--livery); outline-offset: 2px; }

textarea, input[type="text"], input[type="email"] {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--surface-alt);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
textarea { min-height: 84px; resize: vertical; }
textarea:focus, input:focus { outline: none; border-color: var(--livery); }

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--error);
  color: var(--error);
  font-weight: 600;
}
.form-error[hidden] { display: none; }

/* --- Buttons --------------------------------------------------------------- */

.pass-actions, .arrival-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
}
.arrival-actions { justify-content: flex-start; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: 10px;
  font: inherit;
  font-weight: 650;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.btn.primary { background: var(--livery); color: var(--on-livery); }
.btn.primary:hover { background: var(--livery-deep); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--livery); }
.btn:focus-visible { outline: 3px solid var(--livery); outline-offset: 2px; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.btn.invisible { visibility: hidden; }

/* --- Arrival --------------------------------------------------------------- */

.arrival { grid-template-columns: minmax(0, 1fr); }
.arrival.enter { animation: pass-in 0.6s ease-out; }

/* The summary: one cockpit dial per key rating, colored by the third of
   the scale it falls in. */
.gauges-block { display: grid; gap: 10px; margin-top: 4px; }
.gauges {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.gauge {
  --tone: var(--muted);
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 12px 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}
.gauge:hover { border-color: var(--tone); transform: translateY(-2px); }
.gauge:focus-visible { outline: 3px solid var(--livery); outline-offset: 2px; }
.gauge.low { --tone: var(--tone-low); }
.gauge.mid { --tone: var(--tone-mid); }
.gauge.high { --tone: var(--tone-high); }
.gauge svg { width: 100%; max-width: 150px; height: auto; display: block; }
.gauge-track { fill: none; stroke: var(--seat); stroke-width: 10; stroke-linecap: round; }
.gauge-fill { fill: none; stroke: var(--tone); stroke-width: 10; stroke-linecap: round; }
.gauge.skipped .gauge-fill { display: none; }
.gauge-tick { stroke: var(--muted); stroke-width: 1.5; opacity: 0.6; }
.gauge-needle { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.gauge-hub { fill: var(--ink); }
.gauge-value { font-family: var(--mono); font-size: 15px; color: var(--muted); }
.gauge-value strong { font-size: 24px; color: var(--tone); }
.gauge.skipped .gauge-value { font-family: var(--sans); font-style: italic; }
.gauge-label { font-size: 14px; font-weight: 600; }
.gauges-hint { margin: 0; font-size: 14px; font-style: italic; color: var(--muted); max-width: 70ch; }

@media (max-width: 720px) {
  .gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* The baggage belt runs along the bottom of the card. */
.belt {
  grid-column: 1 / -1;
  position: relative;
  border-top: 2px dashed var(--line);
  background:
    repeating-linear-gradient(90deg, var(--line) 0 2px, transparent 2px 22px) bottom / 100% 22px no-repeat,
    var(--surface-alt);
  height: 92px;
  overflow: hidden;
}
.bag {
  position: absolute;
  bottom: 22px;
  width: 54px;
  height: 40px;
  border-radius: 8px;
  background: var(--livery);
  animation: belt 12s linear infinite;
}
.bag::before {
  content: "";
  position: absolute;
  left: 15px; top: -10px;
  width: 22px; height: 12px;
  border: 3px solid var(--livery-deep);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}
.bag-2 { width: 44px; height: 52px; background: var(--flap-ink); animation-delay: -4s; }
.bag-3 { width: 62px; height: 34px; background: var(--livery-deep); animation-delay: -8s; }
@keyframes belt {
  from { left: -70px; }
  to { left: 100%; }
}

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

.load-error { margin: 0; color: var(--error); font-weight: 600; }
.load-error[hidden] { display: none; }

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