/* Long Haul. Deep navy and space around the GeoGames globe; one cream paper
   boarding pass as the whole interface; aviation orange for the route and the
   one action that matters. Archivo for display, Geist Mono for printed data. */
@font-face { font-family: "Archivo"; src: url(../fonts/archivo.woff2) format("woff2"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url(../fonts/geist-mono.woff2) format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  --navy: #0E1B2E;
  --navy-2: #13243B;
  --navy-3: #1C3150;
  --space: #060B14;
  --cream: #F3EBDA;
  --paper: #F6EFDF;
  --paper-2: #ECE2CC;
  --paper-edge: #DCCFB3;
  --ink: #15243A;
  --ink-2: #4A5468;
  --ink-3: #6B6C67;
  --orange: #E07A2F;
  --orange-ink: #B9561A;
  --green: #2E7D4F;
  --red: #B63A2E;
  --gold: #B8892B;
  --gold-2: #E2C47F;
  --purple: #7B4FC9;
  --yellow: #D9A520;
  --white: #FFFFFF;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --topbar: 56px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--space);
  color: var(--cream);
  font-family: var(--display);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.fl { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; margin-right: 0.32em; font-weight: 400; letter-spacing: 0; text-transform: none; }

.app { display: grid; grid-template-rows: var(--topbar) minmax(0, 1fr); height: 100vh; height: 100dvh; }

/* ───────────────────────────── top bar */
.topbar {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px;
  padding: 0 20px; padding-top: env(safe-area-inset-top); background: var(--navy); border-bottom: 1px solid rgba(243, 235, 218, 0.1);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--cream); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; }
.brand-mark path:first-child { fill: var(--orange); }
.brand-mark path:last-child { stroke: var(--cream); stroke-width: 2; fill: none; }
.brand-word { font-weight: 800; font-stretch: 112%; text-transform: uppercase; letter-spacing: 0.16em; font-size: 15px; }
.topbar-meta { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(243, 235, 218, 0.62); justify-self: center; display: flex; gap: 14px; }
.topbar-meta b { color: var(--cream); font-weight: 500; }
.topbar-meta .dev-tag { color: var(--orange); }
.topbar-actions { display: flex; gap: 6px; }
.icon-btn { position: relative; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--cream); }
.icon-btn:hover { background: rgba(243, 235, 218, 0.08); }
.icon-btn:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }
.badge { position: absolute; top: 5px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--orange); color: var(--navy); font: 600 10px/16px var(--mono); }
.icon-btn.snd .w { display: none; }
.icon-btn.snd.on .w { display: inline; }
.icon-btn.snd.on .x { display: none; }
.icon-btn.snd:not(.on) { color: rgba(243, 235, 218, 0.6); }
.icon-btn.bump { animation: bump 600ms var(--spring); }
@keyframes bump { 30% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* ───────────────────────────── stage */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) clamp(370px, 31vw, 446px); min-height: 0; }
.globe-pane { position: relative; overflow: hidden; min-height: 0; background: radial-gradient(ellipse at 50% 45%, #0B1A30 0%, var(--space) 70%); }
.backdrop { position: absolute; inset: 0; pointer-events: none; }
.backdrop canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.bd-twinkle-a { animation: bd-twinkle 5.5s ease-in-out infinite; }
.bd-twinkle-b { animation: bd-twinkle 7s ease-in-out -3.2s infinite; }
@keyframes bd-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.globe { position: absolute; inset: 0; }
/* GuessGlobe's vignette */
.vignette { position: absolute; inset: 0; pointer-events: none; z-index: 1; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.45) 100%); }

/* MapLibre attribution: the small "i" only (as GeoSports does) */
.maplibregl-ctrl-attrib { background: transparent !important; opacity: 0.35; }
.maplibregl-ctrl-attrib:hover { opacity: 0.85; }
.maplibregl-ctrl-attrib a { color: rgba(255, 255, 255, 0.85) !important; }
.maplibregl-ctrl-attrib:not(.lh-open) .maplibregl-ctrl-attrib-inner { display: none !important; }
.maplibregl-ctrl-attrib.lh-open { background: rgba(6, 11, 20, 0.85) !important; opacity: 1; color: rgba(255,255,255,.8); max-width: 70%; }


/* ───────────────────────────── on the globe: the Earth tracker. The running
   total, a hairline for the current lap of the planet, and how many times
   around. A milestone briefly takes its place. */
.odometer { position: absolute; left: 20px; top: 18px; z-index: 2; pointer-events: none; display: grid; padding: 10px 15px 9px; border-radius: 10px; background: linear-gradient(180deg, rgba(14, 27, 46, 0.86), rgba(6, 11, 20, 0.82)); border: 1px solid rgba(243, 235, 218, 0.14); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.odometer > * { grid-area: 1 / 1; transition: opacity 260ms; }
.odo-main { min-width: 168px; }
.odo-top { display: flex; align-items: baseline; gap: 6px; }
.odo-value { font-weight: 800; font-stretch: 104%; font-size: 28px; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; color: var(--white); }
.odo-unit { font: 600 12px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(243, 235, 218, 0.7); }
.odo-lap { position: relative; height: 3px; margin: 9px 0 7px; border-radius: 2px; overflow: hidden;
  background: linear-gradient(90deg, transparent calc(25% - 1px), rgba(243, 235, 218, 0.45) calc(25% - 1px) 25%, transparent 25% calc(50% - 1px), rgba(243, 235, 218, 0.45) calc(50% - 1px) 50%, transparent 50% calc(75% - 1px), rgba(243, 235, 218, 0.45) calc(75% - 1px) 75%, transparent 75%), rgba(243, 235, 218, 0.16); }
.odo-lap i { position: absolute; inset: 0; background: linear-gradient(90deg, var(--orange-ink), var(--orange)); transform-origin: left; transform: scaleX(0); transition: transform 240ms linear; box-shadow: 0 0 8px rgba(224, 122, 47, 0.8); }
/* Laps of the planet: the bar fills over each lap of 24,901 mi, and a pip
   lights for every lap done. */
.odo-lapline { display: flex; align-items: center; gap: 7px; }
.odo-lapline .odo-lap { flex: 1; }
.odo-laps { display: flex; gap: 4px; }
.odo-laps i { width: 7px; height: 7px; border-radius: 50%; border: 1.2px solid rgba(243, 235, 218, 0.38); }
.odo-laps i.on { border-color: var(--gold-2); background: radial-gradient(circle at 35% 35%, #FFF1C9, var(--gold-2) 55%, var(--gold)); box-shadow: 0 0 6px rgba(226, 196, 127, 0.7); }
.odometer.lap .odo-lap i { animation: lap-flare 1200ms ease-out; }
.odometer.lap .odo-laps i.on:not(:has(+ i.on)) { animation: pip-pop 700ms var(--spring); }
.odometer.lap { animation: lap-glow 1300ms ease-out; }
.odometer.lap .odo-value { animation: odo-pop 700ms var(--spring); }
@keyframes lap-flare { 0% { background: var(--gold-2); transform: scaleX(1); box-shadow: 0 0 14px var(--gold-2); } 40% { background: var(--gold-2); transform: scaleX(1); } }
@keyframes pip-pop { 40% { transform: scale(1.9); } }
@keyframes lap-glow { 20% { border-color: rgba(226, 196, 127, 0.8); box-shadow: 0 0 0 3px rgba(226, 196, 127, 0.18), 0 8px 24px rgba(0, 0, 0, 0.35); } }
.odo-earth.target { color: var(--orange-2, #F3A66A); }
.odo-earth.target b { color: var(--white); }
.odo-earth.lapmsg { color: var(--gold-2); font-weight: 700; letter-spacing: 0.08em; }
.odo-earth { font: 500 10.5px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: rgba(243, 235, 218, 0.66); white-space: nowrap; }
.odo-earth b { color: var(--cream); font-weight: 700; letter-spacing: 0.02em; }
.odo-msg { opacity: 0; align-self: center; justify-self: start; max-width: 220px; font-weight: 750; font-size: 16px; line-height: 1.2; color: var(--cream); }
.odometer.msg .odo-main { opacity: 0; }
.odometer.msg .odo-msg { opacity: 1; }
.odometer.msg.gold { border-color: rgba(226, 196, 127, 0.6); }
.odometer.msg.gold .odo-msg { color: var(--gold-2); }
.odometer.pop .odo-value { animation: odo-pop 520ms var(--spring); }
@keyframes odo-pop { 35% { transform: scale(1.12); color: var(--gold-2); } }
.odo-value { display: inline-block; transform-origin: left bottom; }

.globe-hint { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 2; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(243, 235, 218, 0.85); pointer-events: none; transition: opacity 300ms; white-space: nowrap; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
.globe-hint:empty { opacity: 0; }


/* current airport */
.airport-here { position: relative; width: 14px; height: 14px; pointer-events: none; }
.airport-here .dot { position: absolute; inset: 2px; border-radius: 50%; background: var(--orange); border: 2px solid var(--white); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); }
.airport-here .ring { position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid rgba(224, 122, 47, 0.9); animation: here 2.4s ease-out infinite; }
.airport-here .ring.r2 { animation-delay: 1.2s; }
.airport-here .code { position: absolute; left: 50%; top: 18px; transform: translateX(-50%); font: 600 10px/1 var(--mono); letter-spacing: 0.12em; color: var(--white); background: rgba(14, 27, 46, 0.85); padding: 3px 5px; border-radius: 2px; }
@keyframes here { 0% { transform: scale(0.6); opacity: 1; } 100% { transform: scale(2.6); opacity: 0; } }

/* the picked destination's airport: a pin, and the country's name on a tag */
.dest-pin { position: relative; width: 14px; height: 14px; pointer-events: none; }
.dest-pin .tag { position: absolute; left: 50%; bottom: 17px; transform: translateX(-50%); white-space: nowrap; font: 750 11px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--navy); background: var(--paper); padding: 5px 8px 4px; border-radius: 3px; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45); transition: opacity 250ms; }
.dest-pin .tag::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -4px; border: 4px solid transparent; border-top-color: var(--paper); }
.dest-pin.pop .tag { animation: tag-in 240ms var(--ease); }
.dest-pin.flying .tag { opacity: 0; }
/* After a miss: what would have counted, in the paper's own green ink. */
.dest-pin.answer .tag { background: #E6F0E3; color: #1F5A37; }
.dest-pin.answer .tag::after { border-top-color: #E6F0E3; }
.dest-pin.answer .dot { border-color: var(--green); }
@keyframes tag-in { from { opacity: 0; transform: translate(-50%, 5px); } }
/* touchdown: a ring spreads from the airport, wider and gold on a long haul */
.touchdown { position: relative; width: 12px; height: 12px; pointer-events: none; }
.touchdown i { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--cream); animation: touchdown 1200ms cubic-bezier(0.2, 0.7, 0.3, 1) both; }
.touchdown i + i { animation-delay: 180ms; border-width: 1.5px; }
.touchdown.long i { border-color: var(--orange); }
.touchdown.ultra i { border-color: var(--gold-2); animation-duration: 1500ms; }
@keyframes touchdown { from { transform: scale(0.6); opacity: 1; } to { transform: scale(7); opacity: 0; } }
.touchdown.ultra i { --s: 11; }
.touchdown.ultra i { animation-name: touchdown-xl; }
@keyframes touchdown-xl { from { transform: scale(0.6); opacity: 1; } to { transform: scale(11); opacity: 0; } }
.dest-pin .dot { position: absolute; inset: 2px; border-radius: 50%; background: var(--white); border: 2.5px solid var(--orange); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6); animation: pin-in 260ms var(--spring); }
.dest-pin .ring { position: absolute; inset: -3px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.85); animation: here 1.8s ease-out infinite; }
@keyframes pin-in { from { transform: scale(0); } }

/* plane */
.plane { width: calc(30px + 18px * var(--alt, 0)); height: calc(30px + 18px * var(--alt, 0)); pointer-events: none; }
.plane svg { overflow: visible; display: block; }
.plane .plane-body { fill: var(--paper); stroke: var(--navy); stroke-width: 0.9; }
.plane .plane-tail { fill: var(--orange); }
.plane .plane-shadow { fill: rgba(0, 0, 0, 0.45); transform: translate(calc(2px + 9px * var(--alt, 0)), calc(3px + 12px * var(--alt, 0))); filter: blur(1.5px); }
.plane-ghost .plane-body { fill: rgba(255, 255, 255, 0.95); }
.plane-ghost .plane-tail { fill: #ffffff; }

/* ───────────────────────────── passport stamps (arrival + passport pages) */
.pstamp { --c: var(--navy-3); --rot: -6deg; position: relative; display: grid; place-items: center; text-align: center; color: var(--c); width: 148px; height: 148px; transform: rotate(var(--rot)); font-family: var(--mono); text-transform: uppercase; }
.pstamp.on-dark { --c: var(--cream); }
.pstamp .ring-o { position: absolute; inset: 0; border: 3px solid currentColor; border-radius: 50%; }
.pstamp .ring-i { position: absolute; inset: 7px; border: 1px solid currentColor; border-radius: 50%; }
.pstamp.rect .ring-o { border-radius: 10px; }
.pstamp.rect .ring-i { border-radius: 6px; }
.pstamp.oct .ring-o, .pstamp.oct .ring-i { border-radius: 30%; }
.pstamp .st-top { font-size: 9px; letter-spacing: 0.2em; }
.pstamp.on-dark.is-new .st-top { color: var(--gold-2); }
.pstamp .st-code { font-family: var(--display); font-weight: 900; font-stretch: 112%; font-size: 34px; letter-spacing: 0.04em; line-height: 1; margin: 2px 0; }
.pstamp .st-name { font-size: 9px; letter-spacing: 0.12em; max-width: 112px; line-height: 1.25; }
.pstamp .st-date { font-size: 9px; letter-spacing: 0.14em; margin-top: 3px; padding-top: 3px; border-top: 1px solid currentColor; }
.pstamp .st-inner { position: relative; display: grid; justify-items: center; }
.pstamp .st-new, .pstamp .st-count { position: absolute; top: -4px; right: -4px; transform: rotate(calc(-1 * var(--rot))); font: 700 9px/1 var(--mono); letter-spacing: 0.12em; padding: 4px 6px; border-radius: 10px; }
.pstamp .st-new { background: var(--orange); color: var(--white); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); }
.pstamp .st-count { top: auto; bottom: -4px; background: var(--paper); color: var(--ink-2); border: 1px solid var(--paper-edge); }
.pstamp.is-new { animation: new-stamp 900ms var(--spring) both; }
@keyframes new-stamp { 0% { transform: rotate(var(--rot)) scale(1.5); opacity: 0; } 100% { transform: rotate(var(--rot)) scale(1); opacity: 1; } }


/* ───────────────────────────── pass pane */
.pass-pane { position: relative; background: radial-gradient(ellipse at 50% 40%, var(--navy-2), var(--navy) 70%); border-left: 1px solid rgba(243, 235, 218, 0.08); padding: 26px 24px 30px; display: flex; min-height: 0; overflow: hidden; }
.pass-stack { position: relative; flex: 1; min-height: 0; min-width: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); }
.pass-stack > * { grid-area: 1 / 1; }
.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; }

/* ───────────────────────────── the ticket
   One warm sheet: the main part, a dashed perforation between two matched
   cut-outs, and the stub. Sizes come from variables so each layout sets its
   own base and the fit levels (f1…f11, added by fitTicket in app.js until
   nothing overflows) tighten them. */
.ticket {
  --notch: 12px; --pad: 22px; --gap: 16px;
  --code: 52px; --q: 25px; --place: 14px; --next: 15px; --btn: 54px; --res: 40px;
  --ck: 1; --qk: 1;
  position: relative; isolation: isolate; display: flex; flex-direction: column; min-height: 0; max-height: calc(100% - 12px); align-self: center; width: 100%;
  color: var(--ink); filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.42)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3));
  animation: ticket-in 420ms var(--ease) both;
}
.ticket.after-leave { animation-delay: 170ms; }
.ticket.no-anim { animation: none; }
.ticket.leaving { animation: ticket-out 300ms cubic-bezier(0.5, 0, 0.75, 0) forwards; pointer-events: none; z-index: 2; }
@keyframes ticket-in { from { transform: translateY(40px); opacity: 0; } }
@keyframes ticket-out { to { transform: translate(-14px, -70px) rotate(-3deg); opacity: 0; } }
.ticket.press { animation: press 200ms ease-out; }
@keyframes press { 40% { transform: translateY(2px) scale(0.994); } }
.ticket.thud { animation: thud 260ms ease-out; }
@keyframes thud { 30% { transform: translateY(2px) scale(0.996); } }
/* Next flight: the pass stays put; the clue rises out of the stub. */
.ticket.advance .q { animation: clue-up 420ms var(--ease) both; }
.ticket.advance .t-next { animation: fade-in 360ms 160ms ease both; }
.ticket.advance .t-route .code.from, .ticket.advance .place.from { animation: fade-in 320ms ease both; }
@keyframes clue-up { from { transform: translateY(70px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* Paper: warm card stock with a fine grain, a faint security guilloche and,
   on the main part, the airline's watermark. All printed in low contrast so
   the type stays crisp. */
.t-main, .t-stub {
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .26 0 0 0 0 .16 0 0 0 .075 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --guilloche: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='22'%3E%3Cg fill='none' stroke='%2315243A' stroke-opacity='.045' stroke-width='.7'%3E%3Cpath d='M0 11 C 12 1, 36 1, 48 11 S 84 21, 96 11'/%3E%3Cpath d='M0 11 C 12 21, 36 21, 48 11 S 84 1, 96 11'/%3E%3C/g%3E%3C/svg%3E");
  background-color: var(--paper);
  background-image: var(--grain), var(--guilloche), linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 38%);
  background-size: 180px 180px, 96px 22px, 100% 100%;
  position: relative;
}
.t-stub { background-color: #F1E8D4; }
/* the watermark: the airline's wing over a globe, barely there */
.t-main::before { content: ""; position: absolute; right: -24px; bottom: 6%; width: 62%; aspect-ratio: 1; pointer-events: none; opacity: 0.032;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64' fill='none' stroke='%2315243A' stroke-width='1.2'%3E%3Ccircle cx='32' cy='32' r='22'/%3E%3Cellipse cx='32' cy='32' rx='9' ry='22'/%3E%3Cpath d='M10 32h44M14 21h36M14 43h36'/%3E%3Cpath d='M6 40 L40 12 L52 12 L24 40 Z' fill='%2315243A' stroke='none'/%3E%3C/svg%3E") center / contain no-repeat; }
.t-main > * { position: relative; }
.t-main { border-radius: 12px 12px 0 0; padding: calc(var(--pad) - 2px) var(--pad) calc(var(--pad) - 4px); flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; scrollbar-width: none;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000) right / 51% 100% no-repeat; }
.t-main::-webkit-scrollbar { display: none; }
.t-main > * { flex-shrink: 0; }
.t-stub { border-radius: 0 0 12px 12px; padding: 14px var(--pad) 16px; flex: none; display: grid; grid-template-columns: minmax(0, 1fr); align-items: center; gap: 16px;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000) right / 51% 100% no-repeat;
  mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000) left / 51% 100% no-repeat, radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000) right / 51% 100% no-repeat; }
.t-stub:has(> .t-code) { grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.t-stub .t-next { align-self: center; }
/* the perforation runs exactly between the two cut-outs */
.t-stub::before { content: ""; position: absolute; left: calc(var(--notch) + 5px); right: calc(var(--notch) + 5px); top: -1px; border-top: 1.5px dashed rgba(21, 36, 58, 0.3); }

.lbl { display: block; font-family: var(--mono); font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange-ink); margin-bottom: 4px; white-space: nowrap; }

/* the airline band: navy livery across the top, an orange stripe beneath */
.t-band { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: calc(-1 * (var(--pad) - 2px)) calc(-1 * var(--pad)) var(--gap); padding: var(--bandp, 11px) var(--pad) calc(var(--bandp, 11px) - 1px); background: var(--navy); color: var(--cream); border-radius: 12px 12px 0 0; border-bottom: 3px solid var(--orange); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06); }
/* security microprint under the livery */
.t-band::after { content: "LONG HAUL ✈ INTERNATIONAL ✈ LONG HAUL ✈ INTERNATIONAL ✈ LONG HAUL ✈ INTERNATIONAL ✈ LONG HAUL ✈ INTERNATIONAL ✈ LONG HAUL ✈ INTERNATIONAL"; position: absolute; left: 0; right: 0; top: calc(100% + 3px); padding: 2px var(--pad) 0; overflow: hidden; white-space: nowrap; font: 500 5.5px/1 var(--mono); letter-spacing: 0.32em; color: rgba(21, 36, 58, 0.3); pointer-events: none; }
.ticket.gold .t-band { border-bottom-color: var(--gold-2); }
.t-airline { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 800; font-stretch: 115%; font-size: 13px; letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap; }
.t-airline .mark { width: 20px; height: 20px; flex: none; }
.mark path:first-child { fill: var(--orange); }
.mark path:last-child { stroke: var(--cream); stroke-width: 2; fill: none; }
.t-kind { font: 500 10.5px/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: rgba(243, 235, 218, 0.78); white-space: nowrap; }
.band-btn { min-height: 44px; margin: -10px -8px -10px 0; padding: 0 8px; border: 0; background: none; cursor: pointer; font: 700 14px/1 var(--display); color: var(--cream); }
.band-btn:hover { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }

/* printed fields: small labels over mono values, as on a real pass */
.t-fields { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 22px; align-items: end; padding-top: 4px; }
.fld:nth-child(2) { padding-left: 22px; margin-left: -11px; border-left: 1px solid rgba(21, 36, 58, 0.12); }
.fld.status.air .fl-v { color: var(--orange-ink); }
.fld { min-width: 0; display: grid; gap: 3px; }
.fld:last-child { justify-self: end; text-align: right; }
.fl-l { display: block; font: 500 9.5px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); white-space: nowrap; }
.fl-v { font: 600 14px/1.1 var(--mono); letter-spacing: 0.04em; color: var(--ink); white-space: nowrap; text-transform: uppercase; }
.fld.status.ok .fl-v { color: var(--green); }
.fld.status.no .fl-v { color: var(--red); }
.fld.status.best .fl-v { color: var(--gold); }
.fld.status.long .fl-v { color: var(--orange-ink); }

/* flight and clock, with the time line beneath */
.t-clock { font: 700 17px/1 var(--mono); letter-spacing: 0.02em; color: var(--ink); font-variant-numeric: tabular-nums; text-transform: none; }
.ticket.low .t-clock { color: var(--red); font-weight: 800; }
.t-timer { height: 5px; margin-top: 7px; display: flex; align-items: center; background: linear-gradient(rgba(21, 36, 58, 0.12), rgba(21, 36, 58, 0.12)) center / 100% 2px no-repeat; }
.t-timer i { display: block; width: 100%; height: 2px; border-radius: 2px; background: var(--orange); transform-origin: left; }
.ticket.low .t-timer i { height: 5px; background: var(--red); }
.answered .t-timer { visibility: hidden; }

/* route: big codes on a curved, dashed flight path, the airport beneath */
.t-route { margin-top: var(--gap); }
.t-codes { display: grid; grid-template-columns: auto minmax(40px, 1fr) auto; align-items: end; gap: 10px; }
.port { display: grid; gap: 4px; min-width: 0; }
.port.to { justify-items: end; text-align: right; }
.t-route .code { font-weight: 800; font-stretch: 110%; font-size: calc(var(--code) * var(--ck)); line-height: 0.9; letter-spacing: 0.01em; white-space: nowrap; min-width: 2.4ch; }
.t-route .code.open { color: rgba(21, 36, 58, 0.24); letter-spacing: 0.06em; }
.t-route .code.tentative { color: transparent; -webkit-text-stroke: 1.5px var(--orange-ink); }
.t-route .code.inked { animation: ink-set 420ms ease-out both; }
@keyframes ink-set { 0% { color: transparent; -webkit-text-stroke: 1.5px var(--orange-ink); } 40% { color: var(--ink); -webkit-text-stroke: 0 transparent; transform: scale(1.06); } 100% { color: var(--ink); } }
.t-route { position: relative; }
.t-route .code.missed { color: var(--red); text-decoration: line-through; text-decoration-thickness: 3px; opacity: 0.65; }
.t-path { position: relative; align-self: stretch; min-height: calc(var(--code) * var(--ck) * 0.9); margin-bottom: calc(var(--code) * var(--ck) * 0.12); }
.t-path .arc { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 78%; overflow: visible; }
.t-path .arc path { fill: none; stroke: rgba(21, 36, 58, 0.42); stroke-width: 1.5; stroke-dasharray: 2 5; stroke-linecap: round; }
.t-path .plane-ic { position: absolute; left: 50%; top: 43%; width: calc(22px * var(--ck)); height: calc(22px * var(--ck)); transform: translate(-50%, -50%); fill: var(--orange); filter: drop-shadow(0 1px 0 var(--paper)); }
.t-path .arc path.flown { stroke: var(--orange); stroke-width: 2.2; stroke-dasharray: 0 100; opacity: 1; }
.answered .t-path .arc path:first-child { stroke: rgba(185, 86, 26, 0.45); }
.t-path .plane-ic { will-change: left, top; }
.t-places { display: flex; justify-content: space-between; gap: 16px; margin-top: 6px; font-size: var(--place); line-height: 1.25; color: var(--ink-2); }
.t-places .place { min-width: 0; max-width: 50%; }
.t-places .place.to { text-align: right; }
.t-places .place.notice { color: var(--red); font-weight: 600; max-width: 62%; }

/* The destination field: printed like the rest of the pass, with a dotted
   rule to write on. 16px type (so phones don't zoom), drawn at the size of
   the other place names. */
.ticket { --ik: 0.875; }
.t-places:has(.dest) .place.from { max-width: 42%; }
.place.dest { flex: 1 1 auto; max-width: 60%; min-width: 0; }
.dest-in { display: block; width: calc(100% / var(--ik)); margin-left: calc(100% - 100% / var(--ik)); transform: scale(var(--ik)); transform-origin: right center;
  font: 650 16px/1.25 var(--display); color: var(--ink); text-align: right; background: transparent; border: 0; border-bottom: 1.5px dotted rgba(185, 86, 26, 0.7); border-radius: 0; padding: 1px 0 3px; margin-top: -2px; outline: none; -webkit-appearance: none; appearance: none; caret-color: var(--orange); }
.dest-in::placeholder { color: var(--orange-ink); opacity: 1; font-weight: 550; }
.dest-in:disabled { -webkit-text-fill-color: currentColor; opacity: 1; }
.dest-in:disabled::placeholder { color: rgba(185, 86, 26, 0.55); }
.dest-in:focus { border-bottom: 1.5px solid var(--orange); }
.dest-in.notice::placeholder { color: var(--red); font-weight: 650; }
[data-to-port] { cursor: text; }
/* suggestions: a short printed list under the field */
.dest-list { position: absolute; right: 0; top: 100%; z-index: 6; width: min(300px, 100%); max-height: 296px; overflow-y: auto; margin: 6px 0 0; padding: 4px; list-style: none;
  background: var(--paper); border: 1px solid rgba(21, 36, 58, 0.2); border-radius: 6px; box-shadow: 0 14px 34px rgba(14, 27, 46, 0.3), 0 2px 4px rgba(14, 27, 46, 0.12); }
.dest-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 0 10px; border-radius: 4px; cursor: pointer; font: 650 15px/1.2 var(--display); color: var(--ink); }
.dest-list li b { font: 600 11px/1 var(--mono); letter-spacing: 0.14em; color: var(--ink-3); }
.dest-list li.been span { opacity: 0.5; }
.dest-list li.been b { color: var(--red); letter-spacing: 0.08em; text-transform: uppercase; font-size: 10px; }
.dest-list li:hover { background: rgba(21, 36, 58, 0.06); }
.dest-list li.on { background: var(--navy); color: var(--cream); }
.dest-list li.on b { color: var(--orange); }

/* split-flap */
.flap { display: inline-flex; gap: 2px; }
.t-route .flap { font-size: 0.84em; gap: 1.5px; vertical-align: bottom; }
.flap .ch { display: inline-block; min-width: 0.66em; text-align: center; background: var(--navy); color: var(--paper); border-radius: 3px; padding: 0.06em 0.04em 0.02em; position: relative; overflow: hidden; }
.flap .ch::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: rgba(0, 0, 0, 0.55); }
.flap .ch.tick { animation: flip 70ms linear; }
@keyframes flip { 0% { transform: scaleY(1); } 50% { transform: scaleY(0.2); } 100% { transform: scaleY(1); } }

/* the clue: the strongest thing on the pass. The body takes the spare height,
   so there's never a big gap above the button. */
.t-body { flex: 1 0 auto; display: flex; flex-direction: column; justify-content: center; padding: var(--gap) 0; min-height: 0; }
.q { font-weight: 750; font-size: calc(var(--q) * var(--qk)); line-height: 1.2; letter-spacing: -0.01em; margin: 0; text-wrap: pretty; }
.q.long { font-size: calc(var(--q) * var(--qk) * 0.84); line-height: 1.24; }
.q.xlong { font-size: calc(var(--q) * var(--qk) * 0.72); line-height: 1.28; }
/* after an answer the clue stays, small, so the result always has its question */
.has-result .q, .has-result .q.long, .has-result .q.xlong { font-size: 14px; font-weight: 600; line-height: 1.3; letter-spacing: 0; color: var(--ink-2); margin-bottom: 10px; }

/* the outcome, under the clue */
.t-body { position: relative; }
.ticket { --ss: 0.64; }
.t-result { display: flow-root; animation: fade-up 320ms var(--ease) both; }
.t-result > * + * { margin-top: 6px; }
.still .t-result { animation: none; }
@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
/* the stamp sits beside the clue and the miles; the note runs full width beneath */
.t-body:has(.stamped) .q { padding-right: calc(148px * var(--ss) - 2px); }
/* keeps the corner under the stamp clear, so the note wraps around it */
.r-keep { float: right; width: calc(148px * var(--ss) - 8px); height: calc(148px * var(--ss) * 0.62); margin: 0 0 0 10px !important; }
.r-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.r-mi { font-weight: 850; font-size: var(--res); line-height: 1; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.r-mi small { margin-left: 0.18em; font: 600 0.42em/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
/* One treatment per flight: the stamp's ink and the miles share its colour. */
.t-result.long .r-mi { font-size: calc(var(--res) * 1.12); color: var(--orange-ink); }
.t-result.best .r-mi { font-size: calc(var(--res) * 1.12); color: var(--gold); }
.miss .r-mi, .gate .r-mi { font-size: calc(var(--res) * 0.78); color: var(--red); }
.t-result.best .r-sub { color: var(--gold); font-weight: 650; }
.t-result .r-sub { margin: 4px 0 0; font-size: 14px; line-height: 1.35; color: var(--ink-2); text-wrap: pretty; }
.r-line { margin: 0; font-size: 16px; line-height: 1.35; color: var(--ink); text-wrap: pretty; }
.r-sub { color: var(--ink-2); }

/* the arrival: the country's own passport stamp, pressed onto the pass */
.r-stamp { position: absolute; right: -8px; top: calc(var(--gap) - 6px); width: 148px; height: 148px; transform-origin: top right; transform: scale(var(--ss)); opacity: 0; pointer-events: none; mix-blend-mode: multiply; z-index: 1; }
.r-stamp .pstamp { filter: url(#ink); transform: rotate(calc(var(--rot) + var(--tilt, 0deg))); }
/* a miss: a red rubber stamp instead of a country's */
.r-stamp.ink { width: auto; height: auto; right: 2px; top: calc(var(--gap) - 12px); transform: rotate(calc(var(--tilt, 0deg) - 6deg)); transform-origin: center; }
.r-stamp.ink .ink-stamp { position: static; opacity: 1; animation: none; transform: none; }
.r-stamp.ink.show { animation: ink-press-r 460ms cubic-bezier(0.3, 1.35, 0.5, 1) forwards; }
@keyframes ink-press-r { 0% { opacity: 0; transform: rotate(calc(var(--tilt, 0deg) - 6deg)) scale(1.8); } 55% { opacity: 1; transform: rotate(calc(var(--tilt, 0deg) - 6deg)) scale(0.95); } 100% { opacity: 0.92; transform: rotate(calc(var(--tilt, 0deg) - 6deg)) scale(1); } }
.r-stamp .pstamp .ring-o { border-width: 4px; }
.r-stamp .pstamp .st-code { font-size: 40px; }
.r-stamp .pstamp .st-top, .r-stamp .pstamp .st-name, .r-stamp .pstamp .st-date { font-size: 11px; font-weight: 700; }
.r-stamp .pstamp .st-new { font-size: 13px; padding: 5px 8px; }
.r-stamp.show { animation: press-stamp 520ms cubic-bezier(0.3, 1.35, 0.5, 1) forwards; }
.r-stamp.shown { opacity: 0.95; }
@keyframes press-stamp { 0% { opacity: 0; transform: scale(calc(var(--ss) * 1.9)) translateY(-8px); } 55% { opacity: 1; transform: scale(calc(var(--ss) * 0.94)); } 100% { opacity: 0.95; transform: scale(var(--ss)); } }

/* Rubber stamps in ink: BOARDED across the route, MISSED / GATE CLOSED on a
   miss, JOURNEY COMPLETE on the souvenir. Double-ruled, a touch uneven. */
.ink-stamp { --r: -8deg; position: absolute; z-index: 4; pointer-events: none; display: inline-grid; place-items: center; text-align: center; padding: 5px 10px 4px; border: 3px double currentColor; border-radius: 5px;
  font: 800 12px/1.05 var(--mono); letter-spacing: 0.2em; text-transform: uppercase; color: #284772; mix-blend-mode: multiply; filter: url(#ink); opacity: 0; transform: rotate(var(--r)); white-space: nowrap; }
.ink-stamp.red { color: var(--red); }
.ink-stamp.gold { color: var(--gold); }
.ink-stamp.big { font-size: 15px; padding: 7px 12px 6px; border-width: 4px; letter-spacing: 0.16em; }
.ink-stamp.show { animation: ink-press 460ms cubic-bezier(0.3, 1.35, 0.5, 1) forwards; }
.ink-stamp.shown { opacity: 0.85; }
@keyframes ink-press { 0% { opacity: 0; transform: rotate(var(--r)) scale(1.9); } 55% { opacity: 0.95; transform: rotate(var(--r)) scale(0.95); } 100% { opacity: 0.85; transform: rotate(var(--r)) scale(1); } }
/* BOARDED lands across the flight path */
.t-route [data-boarded], .t-route > .ink-stamp { left: 50%; top: calc(var(--code) * var(--ck) * 0.7); translate: -50% 0; --r: -7deg; font-size: 11px; }
/* once the arrival stamp is down, BOARDED fades back so the clue reads clearly */
.has-result .t-route > .ink-stamp { animation: none; opacity: 0.34; }

/* Seven punch positions on the perforation. */
.t-perf { position: relative; height: 0; z-index: 3; flex: none; }
.t-punch { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); display: flex; gap: 9px; }
.t-punch i { --hole: #0A1322; display: block; width: 9px; height: 9px; border-radius: 50%; border: 1.2px solid rgba(21, 36, 58, 0.36); background: var(--paper); }
.t-punch i.now { border-color: var(--orange); box-shadow: 0 0 0 2.5px rgba(224, 122, 47, 0.2); }
.t-punch i.ok, .t-punch i.best { border: 0; background: var(--hole); box-shadow: inset 0 1.5px 1.5px rgba(0, 0, 0, 0.9), 0 0.5px 0 rgba(255, 255, 255, 0.7); }
.t-punch i.best { width: 12px; height: 12px; margin: -1.5px; border-radius: 0; clip-path: polygon(50% 0, 62% 35%, 100% 38%, 70% 60%, 80% 100%, 50% 77%, 20% 100%, 30% 60%, 0 38%, 38% 35%); background: var(--hole); filter: drop-shadow(0 0 0 var(--gold)); }
.t-punch i.best::after { content: ""; }
.t-punch i.miss { border: 0; background: none; position: relative; }
.t-punch i.miss::before, .t-punch i.miss::after { content: ""; position: absolute; left: -1px; right: -1px; top: 50%; height: 2px; margin-top: -1px; background: var(--red); border-radius: 1px; transform: rotate(45deg); opacity: 0.85; }
.t-punch i.miss::after { transform: rotate(-45deg); }
.t-punch i.punching { animation: punch 420ms cubic-bezier(0.3, 1.5, 0.5, 1) both; }
@keyframes punch { 0% { transform: scale(2); opacity: 0; } 60% { transform: scale(0.8); opacity: 1; } 100% { transform: scale(1); } }

/* The passes still to come, peeking out underneath. */
.t-sheets { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.t-sheets i { position: absolute; left: 6px; right: 6px; top: 10px; bottom: -5px; border-radius: 12px; background: #E9DFC8; box-shadow: 0 1px 1.5px rgba(0, 0, 0, 0.3); }
.t-sheets i + i { left: 13px; right: 13px; top: 20px; bottom: -10px; background: #DED2B7; z-index: -1; }
.t-sheets[data-left="1"] i + i, .t-sheets[data-left="0"] i { display: none; }

/* Tearing off: the next pass rises from the stack. */
.ticket.from-under { animation: from-under 560ms 90ms var(--ease) both; }
@keyframes from-under { from { transform: translateY(10px) scale(0.975); } }
.ticket.torn { z-index: 3; }
.ticket.swipeable .t-main { touch-action: none; cursor: grab; -webkit-user-select: none; user-select: none; }
.t-main.dragging { cursor: grabbing; }

/* ink stamps for the day's honors (Perfect Route, new best) */
.stamp {
  position: relative; flex: none; pointer-events: none; padding: 6px 10px 5px; border: 2px solid currentColor; border-radius: 4px;
  font: 700 12px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;
  transform: rotate(-5deg); opacity: 0;
}
.stamp i { font-style: normal; }
.stamp.best { color: var(--gold); background: rgba(226, 196, 127, 0.16); }
.stamp.new { color: var(--navy-3); }
.stamp.shown { opacity: 0.94; }

/* the one button, always at the foot of the main part */
.t-action { display: grid; gap: 2px; }
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: var(--btn); border: 0; border-radius: 8px; cursor: pointer;
  font-weight: 750; font-size: 17px; letter-spacing: 0; font-variant-numeric: tabular-nums;
  background: var(--orange); color: var(--navy); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16); transition: transform 120ms, background 160ms;
}
.btn:hover:not(:disabled) { background: #E8873E; }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.16); }
/* waiting for a pick: quiet, never a dead orange slab */
.btn:disabled { background: transparent; color: var(--ink-2); box-shadow: inset 0 0 0 1.5px rgba(21, 36, 58, 0.22); cursor: default; }
.btn.status, .btn.status:disabled { color: var(--ink-2); }
.btn:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
:where(button, a, summary, [tabindex]):focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.btn .fly-mi { font: 600 0.82em/1 var(--mono); letter-spacing: 0.02em; padding: 5px 8px 4px; border-radius: 4px; background: rgba(14, 27, 46, 0.12); }
.btn.go { animation: go 260ms var(--ease); }
@keyframes go { 40% { transform: scale(1.015); } }
.btn.status:not(:disabled) { justify-content: space-between; padding: 0 18px; background: rgba(21, 36, 58, 0.06); box-shadow: inset 0 0 0 1.5px rgba(21, 36, 58, 0.16); color: var(--ink); }
.btn.status .skip { font: 600 11.5px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.btn.quiet { background: transparent; box-shadow: none; color: var(--ink); min-height: 44px; font-size: 16px; }
.btn.quiet:hover:not(:disabled) { background: rgba(21, 36, 58, 0.06); }
.text-btn { min-height: 44px; min-width: 44px; margin: -12px -8px -12px 0; padding: 0 0 0 8px; border: 0; background: none; cursor: pointer; font: 750 15px/1 var(--display); letter-spacing: 0; text-transform: none; color: var(--ink); }

/* the stub */
.t-next { min-width: 0; }
.t-next p { margin: 0; font-size: var(--next); font-weight: 500; line-height: 1.35; color: var(--ink); text-wrap: pretty; }
.t-next > .lbl:only-child { margin: 0; }
/* the stub prints its label inline, like a field on the pass */
.t-next p .lbl { display: inline; margin: 0 8px 0 0; font-size: 10.5px; vertical-align: 1px; }
.t-teach { font-size: var(--next); }
.t-teach { margin: 0; line-height: 1.35; }
.t-code { display: flex; align-items: stretch; gap: 4px; }
.barcode { display: block; width: var(--bcw, 24px); height: 100%; min-height: 46px; opacity: 0.92; }
.t-serial { writing-mode: vertical-rl; transform: rotate(180deg); font: 500 7px/1 var(--mono); letter-spacing: 0.16em; color: var(--ink-3); white-space: nowrap; overflow: hidden; }
/* the last pass of the day: its stub says so in orange ink */
.t-next .final .lbl { color: var(--paper); background: var(--orange-ink); padding: 3px 6px 2px; border-radius: 2px; letter-spacing: 0.16em; }
.barcode rect { fill: var(--ink); }

/* ───────────────────────────── check-in and closed */
.t-how { margin: calc(var(--gap) * 0.45) 0 0; font-size: calc(15px * var(--qk)); line-height: 1.38; color: var(--ink-2); text-wrap: pretty; }
.t-how + .lbl { margin-top: calc(var(--gap) * 0.9); }
.t-next .lbl .from { color: var(--ink-2); letter-spacing: 0.12em; }
.s-insight { margin: calc(var(--gap) * 0.8) 0 0; font-size: 14px; line-height: 1.35; color: var(--ink); text-wrap: pretty; }
.s-insight::before { content: "✈ "; color: var(--orange-ink); }
.t-goal { margin: 0; font-weight: 800; font-size: calc(var(--q) * var(--qk)); line-height: 1.15; letter-spacing: -0.01em; }
.t-goal + .lbl { margin-top: calc(var(--gap) * 0.8); }
.t-first { margin: 0; font-size: calc(17px * var(--qk)); line-height: 1.35; color: var(--ink); text-wrap: pretty; }

/* ───────────────────────────── the final ticket: the day's souvenir */
.s-body { justify-content: center; }
.s-route { position: relative; }
.s-route .ink-stamp.done { left: 50%; top: calc(var(--code) * var(--ck) * 0.05); translate: -50% 0; --r: -9deg; z-index: 5; }
.s-coupons { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-top: 12px; }
.s-coupons .cp { display: grid; justify-items: center; gap: 5px; padding: 6px 0 6px; border: 1px dashed rgba(21, 36, 58, 0.28); border-radius: 3px; min-width: 0; }
.s-coupons .cp b { font: 700 10.5px/1 var(--mono); letter-spacing: 0.04em; color: var(--ink); }
.s-coupons .cp.miss b { color: var(--red); opacity: 0.6; }
.s-coupons .mk { width: 18px; height: 18px; font-size: 9.5px; }
.celebrate .s-coupons .cp { animation: mark-in 320ms calc(250ms + var(--i) * 80ms) cubic-bezier(0.3, 1.4, 0.5, 1) both; }
.s-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.s-big { display: flex; align-items: baseline; gap: 8px; }
.s-big .n { font-weight: 850; font-size: calc(58px * var(--ck)); letter-spacing: -0.025em; line-height: 1; font-variant-numeric: tabular-nums; }
.s-big .u { font: 600 20px/1 var(--mono); color: var(--ink-2); }
.s-earth { display: grid; justify-items: end; gap: 4px; text-align: right; font: 500 10.5px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap; }
.s-earth b { font: 800 22px/1 var(--display); letter-spacing: -0.01em; color: var(--ink); }
.s-lap { position: relative; width: 76px; height: 3px; margin-top: 3px; border-radius: 2px; background: rgba(21, 36, 58, 0.14); overflow: hidden; }
.s-lap i { position: absolute; inset: 0; background: var(--orange); transform-origin: left; transform: scaleX(var(--p)); }
/* today's new stamps, a fresh row from the passport */
.s-stamps { display: flex; align-items: center; margin-top: 12px; min-height: calc(148px * var(--ms, 0.34)); }
.s-stamps .mini { position: relative; flex: none; width: calc(148px * var(--ms, 0.34) - 6px); height: calc(148px * var(--ms, 0.34)); mix-blend-mode: multiply; }
.s-stamps .mini .pstamp { position: absolute; left: 0; top: 0; transform-origin: top left; transform: scale(var(--ms, 0.34)) rotate(var(--rot)); }
.s-stamps .mini .pstamp .ring-o { border-width: 5px; }
.s-stamps .mini .pstamp .st-code { font-size: 44px; }
.celebrate .s-stamps .mini { animation: mini-in 420ms calc(900ms + var(--i) * 140ms) cubic-bezier(0.3, 1.35, 0.5, 1) both; }
@keyframes mini-in { from { opacity: 0; transform: scale(1.8); } }
.s-stamps-l { margin-left: 10px; font: 700 10.5px/1.2 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--orange-ink); }
.s-pct { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 10px 0 0; font-size: 17px; color: var(--ink); }
.s-pct:empty { display: none; }
.s-marks { display: flex; gap: 7px; margin-top: 12px; }
.s-marks .mk { width: 30px; height: 30px; font-size: 14px; }
.celebrate .s-marks .mk { animation: mark-in 320ms calc(250ms + var(--i) * 80ms) cubic-bezier(0.3, 1.4, 0.5, 1) both; }
@keyframes mark-in { from { opacity: 0; transform: scale(1.7); } }
.s-tomorrow { display: flex; align-items: center; gap: 10px; margin: 0; }
.s-tomorrow b { font-size: 21px; font-weight: 800; line-height: 1.1; }
.s-tomorrow .pl svg { width: 18px; height: 18px; fill: var(--orange); display: block; }
.s-tomorrow .mono { font-size: 16px; font-weight: 600; letter-spacing: 0.04em; }
.s-count { margin: 5px 0 0; font: 500 12px/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* the seven marks: a color and a shape for each grade, so color is never alone */
.mk { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 4px; color: #fff; font-size: 9px; line-height: 1; font-style: normal; flex: none; }
.mk.best { background: var(--purple); }
.mk.great { background: var(--green); }
.mk.fair { background: var(--yellow); color: var(--ink); }
.mk.short { background: var(--orange); color: var(--ink); }
.mk.miss { background: var(--red); }
.mk.best::after { content: "★"; }
.mk.great::after { content: "••"; letter-spacing: 0.05em; }
.mk.fair::after { content: "•"; }
.mk.short::after { content: "○"; }
.mk.miss::after { content: "✕"; }
.help-sq { display: grid; gap: 8px; font-size: 14px; line-height: 1.3; color: var(--ink); padding: 4px 0 2px; }
.help-sq span { display: flex; align-items: center; gap: 10px; }
.help-sq .mk { width: 22px; height: 22px; font-size: 11px; }

/* ───────────────────────────── compare routes */
.cmp-legs { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; margin-top: 12px; }
.cmp-legs button { --c: var(--ink-3); min-height: 42px; padding: 0; border: 0; border-radius: 6px; background: rgba(21, 36, 58, 0.06); box-shadow: inset 0 -4px 0 var(--c); font: 700 15px/1 var(--mono); color: var(--ink); cursor: pointer; }
.cmp-legs button.best { --c: var(--purple); }
.cmp-legs button.great { --c: var(--green); }
.cmp-legs button.fair { --c: var(--yellow); }
.cmp-legs button.short { --c: var(--orange); }
.cmp-legs button.miss { --c: var(--red); }
.cmp-legs button[aria-pressed="true"] { background: var(--navy); color: var(--cream); }
.cmp-body { justify-content: flex-start; }
.cmp-q { margin: 0; font-size: 14.5px; font-weight: 600; line-height: 1.3; color: var(--ink-2); text-wrap: pretty; }
.cmp-rows { display: grid; gap: 7px; margin-top: 12px; }
.cmp-row { display: grid; grid-template-columns: 20px 58px minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 15px; }
.cmp-row .sw { height: 0; border-top: 3px solid var(--orange); }
.cmp-row.perf .sw { border-top: 3px dashed var(--navy); }
.cmp-row .who { font: 600 11px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2); }
.cmp-row .hop { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-row .mi { font-weight: 800; font-variant-numeric: tabular-nums; }
.cmp-gap { margin: 12px 0 0; font-size: 14.5px; font-weight: 700; }
.cmp-note { margin: 4px 0 0; font-size: 15px; line-height: 1.35; min-height: 2.7em; text-wrap: pretty; }
.cmp-ctrl { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; gap: 8px; }
.cmp-ctrl button { min-height: 48px; border-radius: 8px; border: 0; background: rgba(21, 36, 58, 0.08); font: 600 24px/1 var(--display); color: var(--ink); cursor: pointer; }
.cmp-ctrl button:disabled { opacity: 0.35; cursor: default; }
.cmp-ctrl .play { background: var(--orange); color: var(--navy); font: 750 17px/1 var(--display); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16); }
.cmp-tot { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; font: 600 11.5px/1.3 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.cmp-tot span { display: flex; align-items: center; gap: 8px; }
.cmp-tot span::before { content: ""; width: 20px; border-top: 3px solid var(--orange); }
.cmp-tot .perf::before { border-top: 3px dashed var(--navy); }
.cmp-key summary, .help-more summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; font-size: 14px; font-weight: 600; color: var(--ink); }
.cmp-key summary { min-height: 36px; margin-top: 4px; font-size: 13.5px; color: var(--ink-2); }
.cmp-key[open] { padding-bottom: 4px; }

/* ───────────────────────────── fit levels: spacing first, then type. The band,
   fields, route, clue, clock, barcode and button always stay. */
.f1 { --bandp: 9px; --bcw: 18px; }
.f2 { --pad: 16px; }
.f2 .t-stub { padding-top: 11px; padding-bottom: 12px; }
.f3 { --gap: 11px; }
.f4 .port .fl-l { display: none; }
.f5 { --ck: 0.86; }
.f5 .s-stamps { --ms: 0.3; }
.f6 { --qk: 0.92; --res: 34px; }
.f6 .s-marks { margin-top: 10px; }
.f6 { --ss: 0.58; }
.f7 { --btn: 48px; }
.f7 .r-line { font-size: 15px; }
.f8 { --gap: 8px; --next: 13.5px; --place: 13px; }
.f8 .cmp-note { min-height: 0; }
.f8 .t-fields .fl-l { display: none; }
.f8 { --ik: 0.82; }
.f8 .s-coupons { margin-top: 8px; }
.f9 { --ck: 0.74; --bandp: 7px; }
.f9 .t-timer { margin-top: 5px; }
.f9 .s-pct { margin-top: 6px; font-size: 15.5px; }
.f9 .s-stamps { margin-top: 8px; }
.f10 { --qk: 0.84; --res: 30px; }
.f10 .r-line { font-size: 14px; }
.f10 .cmp-q { font-size: 13px; }
.f10 { --ss: 0.52; }
.f10 .has-result .q { font-size: 13px; margin-bottom: 6px; }
/* f11 outranks the per-layout sizes (phones set them on .ticket), and every
   value here is the smallest any layout uses, so it only ever tightens. */
.ticket.f11 { --pad: 14px; --gap: 5px; --next: 12.5px; --place: 12px; --btn: 44px; }
.f11 .t-serial { display: none; }
.f11 .t-stub { padding-top: 8px; padding-bottom: 9px; }
.f11 .t-next .lbl { margin-bottom: 2px; }
.f11 .cmp-ctrl button { min-height: 44px; }
.f11 .barcode { height: 42px; min-height: 0; align-self: center; }
.f11 .r-line, .f11 .r-sub, .f11 .s-insight { font-size: 13px; line-height: 1.32; }
.f11 { --ik: 0.76; }
.f11 .s-coupons .cp { padding: 4px 0; gap: 3px; }
.f11 .s-coupons { margin-top: 6px; }
.f11 .s-coupons .mk { width: 15px; height: 15px; font-size: 8.5px; }
/* the souvenir's two buttons side by side */
.f11 .s-actions { grid-template-columns: 1fr 1fr; gap: 8px; }
/* after landing the stamp and the note name the place; the codes stay */
.f11.has-result .t-places { display: none; }

/* ───────────────────────────── sheets (passport, help, copy) */
.sheet { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(4, 8, 15, 0.72); backdrop-filter: blur(4px); animation: fade 240ms ease; }
@keyframes fade { from { opacity: 0; } }
/* Solid, so it reads on the navy passport cover as well as on paper. */
.sheet-close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(21, 36, 58, 0.18); background: var(--paper); cursor: pointer; font: 400 26px/1 var(--display); color: var(--ink); z-index: 2; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); display: grid; place-items: center; padding: 0 0 3px; }
.sheet-close:hover { background: var(--white); }

.passport-book { position: relative; width: min(940px, 100%); max-height: calc(100dvh - 48px); display: grid; grid-template-columns: 340px minmax(0, 1fr); border-radius: 14px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); animation: book 420ms var(--ease); }
@keyframes book { from { transform: translateY(24px) scale(0.98); opacity: 0; } }
.pp-cover { background: var(--navy); color: var(--cream); padding: 32px 30px 26px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; position: relative; }
.pp-cover::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 18px; background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.35)); pointer-events: none; }
.pp-emblem { width: 56px; height: 56px; color: #C9A55C; }
.pp-title { font-family: var(--mono); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: #C9A55C; }
.pp-cover h2 { margin: 0; font-weight: 800; font-stretch: 112%; font-size: 28px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold-2); }
.pp-count { margin: 6px 0 0; font-size: 16px; color: rgba(243, 235, 218, 0.8); }
.pp-count b { font-size: 26px; font-weight: 800; color: var(--cream); }
.pp-streak { color: var(--cream); font-weight: 600; }
.pp-stats { margin-top: 6px; border-top: 1px solid rgba(243, 235, 218, 0.16); }
.pp-stats summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font: 600 12px/1 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--cream); }
.pp-stats dl { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 4px 0 14px; }
.pp-stats dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(243, 235, 218, 0.62); }
.pp-stats dd { margin: 3px 0 0; font-weight: 800; font-size: 19px; font-variant-numeric: tabular-nums; }
.pp-conts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 6px; }
.pp-cont { position: relative; overflow: hidden; border: 1px solid rgba(243, 235, 218, 0.22); border-radius: 4px; padding: 8px 8px 10px; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(243, 235, 218, 0.55); display: grid; gap: 3px; }
.pp-cont b { font-family: var(--display); font-size: 16px; color: inherit; }
.pp-cont b small { font-family: var(--mono); font-size: 10px; font-weight: 500; opacity: 0.7; }
.pp-cont i { position: absolute; left: 0; bottom: 0; height: 3px; width: var(--p); background: currentColor; }
.pp-cont.on { color: var(--cream); border-color: rgba(243, 235, 218, 0.4); }
.pp-cont.done { color: var(--gold-2); border-color: #C9A55C; background: rgba(201, 165, 92, 0.1); }
.pp-local { margin: 4px 0 0; font-size: 13px; line-height: 1.45; color: rgba(243, 235, 218, 0.68); }
.pp-mrz { margin-top: auto; padding-top: 16px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; color: rgba(243, 235, 218, 0.3); line-height: 1.5; word-break: break-all; }
.pp-pages { background: var(--paper); color: var(--ink); padding: 28px 26px 22px; overflow-y: auto; position: relative; display: flex; flex-direction: column; gap: 6px;
  background-image: repeating-linear-gradient(135deg, rgba(21, 36, 58, 0.025) 0 2px, transparent 2px 9px), radial-gradient(circle at 50% 40%, rgba(224, 122, 47, 0.06), transparent 60%); }
.pp-pages h3 { margin: 0 0 6px; font: 600 11.5px/1 var(--mono); letter-spacing: 0.18em; text-transform: uppercase; color: var(--orange-ink); }
.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 14px 8px; justify-items: center; align-content: start; margin-bottom: 14px; }
.pp-grid .pstamp { width: 104px; height: 104px; }
.pp-grid .pstamp .st-code { font-size: 24px; }
.pp-grid .pstamp .st-name { font-size: 8px; max-width: 82px; }
.pp-grid .pstamp .st-top, .pp-grid .pstamp .st-date { font-size: 7.5px; }
.pp-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: auto; font: 500 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-2); }
.pp-nav button { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid rgba(21, 36, 58, 0.3); background: transparent; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink); }
.pp-nav button:disabled { opacity: 0.3; cursor: default; }
.pp-empty { color: var(--ink-2); font-size: 16px; line-height: 1.5; padding: 40px 0; text-align: center; margin: auto 0; }

.help-card { position: relative; width: min(460px, 100%); background: var(--paper); color: var(--ink); border-radius: 12px; padding: 26px 26px 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); animation: book 360ms var(--ease); max-height: calc(100dvh - 48px); overflow-y: auto; }
.help-card h2 { margin: 0 0 14px; font-weight: 800; font-size: 24px; }
.t-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.t-rules li { position: relative; padding-left: 18px; font-size: 16px; line-height: 1.4; color: var(--ink); }
.t-rules li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 6px; height: 6px; background: var(--orange); border-radius: 1px; transform: rotate(45deg); }
.help-note { margin: 14px 0 10px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.help-more { border-top: 1px solid rgba(21, 36, 58, 0.14); }
.help-more:last-child { border-bottom: 1px solid rgba(21, 36, 58, 0.14); }
.help-more summary { min-height: 46px; }
.help-more p { margin: 0 0 12px; font-size: 14px; line-height: 1.45; color: var(--ink-2); }
.help-more .help-sq { padding-bottom: 12px; }
.help-terms { margin: 0 0 12px; display: grid; gap: 8px; }
.help-terms dt { font-weight: 750; font-size: 14.5px; }
.help-terms dd { margin: 2px 0 0; font-size: 14px; line-height: 1.4; color: var(--ink-2); }
.copy-card { display: grid; gap: 12px; }
.copy-card h2 { margin: 0; }
.copy-card textarea { width: 100%; resize: none; font: 500 15px/1.45 var(--mono); color: var(--ink); background: var(--white); border: 1px solid rgba(21, 36, 58, 0.25); border-radius: 6px; padding: 10px 12px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 30; background: var(--paper); color: var(--ink); padding: 10px 16px; border-radius: 6px; font: 500 13px/1.3 var(--display); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); opacity: 0; pointer-events: none; transition: opacity 200ms, transform 200ms var(--ease); max-width: calc(100vw - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* loading: a single departures-board row */
.loading { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: var(--space); transition: opacity 500ms; }
.loading.done { opacity: 0; pointer-events: none; }
.board-row span { font-family: var(--mono); font-size: 14px; letter-spacing: 0.4em; text-transform: uppercase; color: var(--cream); opacity: 0.7; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.25; } }

/* dev panel */
.dev { position: fixed; left: 12px; bottom: 12px; z-index: 15; font: 12px/1.4 var(--mono); color: var(--cream); }
.dev > button { background: var(--orange); color: var(--navy); border: 0; border-radius: 4px; padding: 5px 9px; font: 600 11px var(--mono); letter-spacing: 0.1em; cursor: pointer; }
.dev-panel { margin-bottom: 8px; background: rgba(14, 27, 46, 0.96); border: 1px solid rgba(243, 235, 218, 0.2); border-radius: 6px; padding: 12px; display: grid; gap: 8px; width: 250px; }
.dev-panel label { display: flex; align-items: center; gap: 8px; }
.dev-panel select { font: inherit; background: var(--navy-2); color: var(--cream); border: 1px solid rgba(243, 235, 218, 0.25); border-radius: 3px; padding: 3px 5px; }
.dev-panel button { font: inherit; background: var(--navy-3); color: var(--cream); border: 1px solid rgba(243, 235, 218, 0.25); border-radius: 3px; padding: 5px 8px; cursor: pointer; text-align: left; }
.dev-panel .dev-title { color: var(--orange); letter-spacing: 0.14em; font-size: 10px; }


/* ───────────────────────────── smaller desktops */
@media (max-width: 1180px) {
  .ticket { --code: 46px; --q: 23px; }
}

/* ───────────────────────────── short landscape screens (phones on their side):
   two panes, the action on the right */
@media (max-height: 540px) and (orientation: landscape) {
  :root { --topbar: 44px; }
  .stage { grid-template-columns: minmax(0, 1fr) clamp(320px, 44vw, 400px); }
  .pass-pane { padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) 10px; }
  .ticket { --notch: 10px; --pad: 16px; --gap: 9px; --code: 32px; --q: 18px; --place: 12.5px; --next: 13px; --btn: 46px; --res: 28px; align-self: stretch; }
  .t-stub { padding-top: 10px; padding-bottom: 11px; }
  .odometer { left: max(12px, env(safe-area-inset-left)); top: 10px; padding: 7px 11px 6px; }
  .odo-main { min-width: 132px; }
  .odo-value { font-size: 20px; }
  .odo-lap { margin: 6px 0 5px; }
  .odo-earth { font-size: 9.5px; }
  .odo-msg { font-size: 13px; }
  .s-big .n { font-size: 40px; }
}

/* ───────────────────────────── stacked: globe on top, pass beneath.
   Phones, and tablets held upright. The split is fixed per state so the globe
   never resizes during play; the pass fits itself into its part. */
@media (max-width: 760px), (max-width: 1100px) and (orientation: portrait) {
  .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) clamp(300px, 56%, 470px); }
  .app[data-state="summary"] .stage { grid-template-rows: minmax(0, 1fr) clamp(340px, 60%, 520px); }
  .app[data-state="compare"] .stage { grid-template-rows: minmax(0, 1fr) clamp(350px, 62%, 500px); }
  .pass-pane { border-left: 0; padding: 0 12px calc(4px + env(safe-area-inset-bottom)); background: transparent; z-index: 3; overflow: visible; }
  .pass-stack { width: min(100%, 560px); margin: 0 auto; }
  .ticket { align-self: stretch; filter: drop-shadow(0 -4px 18px rgba(0, 0, 0, 0.45)) drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
  .toast { top: calc(var(--topbar) + 10px); bottom: auto; transform: translate(-50%, -12px); }
  .toast.show { transform: translate(-50%, 0); }
  /* On the globe the hint sits up top, clear of the pass. */
  .globe-hint { top: auto; bottom: 14px; }
}


/* ───────────────────────────── typing a destination on a phone: the pass rises
   above the keyboard with the clock, the clue, the field and the list. */
@media (max-width: 760px), (max-width: 1100px) and (orientation: portrait) {
  .app.typing .pass-pane { position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100dvh); z-index: 40; padding: 8px 10px; background: rgba(6, 11, 20, 0.6); display: flex; }
  .app.typing .pass-stack { width: min(100%, 560px); margin: 0 auto; }
  .app.typing .ticket { max-height: 100%; height: 100%; align-self: stretch; animation: none; }
  .app.typing .t-main { overflow: hidden; border-radius: 12px; -webkit-mask: none; mask: none; }
  .app.typing .t-stub, .app.typing .t-perf, .app.typing .t-sheets, .app.typing .t-action { display: none; }
  .app.typing .t-band { border-radius: 12px 12px 0 0; }
  .app.typing .t-body { order: 1; flex: none; padding: 10px 0 2px; }
  .app.typing .q { font-size: calc(var(--q) * 0.86); }
  .app.typing .t-route { order: 2; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; margin-top: 8px; --ck: 0.62; }
  .app.typing .t-route > * { flex-shrink: 0; }
  .app.typing .t-places .place.from { display: none; }
  .app.typing .place.dest { max-width: none; }
  .app.typing .dest-in { --ik: 1; width: 100%; margin-left: 0; transform: none; font-size: 18px; text-align: left; padding: 6px 0 7px; }
  .app.typing .dest-list { position: static; flex: 0 1 auto; min-height: 0; width: 100%; max-height: none; margin-top: 8px; box-shadow: none; border-color: rgba(21, 36, 58, 0.14); }
  .app.typing .dest-list li { min-height: 46px; font-size: 16.5px; }
}

/* ───────────────────────────── phones */
@media (max-width: 760px) {
  :root { --topbar: 48px; }
  .topbar { padding: 0 6px 0 14px; padding-top: env(safe-area-inset-top); gap: 8px; }
  .brand-word { font-size: 13px; letter-spacing: 0.14em; }
  .brand-mark { width: 22px; height: 22px; }
  .icon-btn { width: 44px; height: 44px; }
  .topbar-meta { font-size: 10.5px; gap: 8px; }

  .odometer { left: 12px; top: 12px; padding: 8px 12px 7px; }
  .odo-main { min-width: 136px; }
  .odo-value { font-size: 21px; }
  .odo-unit { font-size: 11px; }
  .odo-lap { margin: 7px 0 6px; }
  .odo-earth { font-size: 9.5px; }
  .odo-msg { font-size: 13.5px; max-width: 180px; }
  .globe-hint { font-size: 10.5px; }

  .ticket { --notch: 10px; --pad: 18px; --gap: 12px; --code: 40px; --q: 21px; --place: 13.5px; --next: 14.5px; --btn: 52px; --res: 34px; }
  .t-main { border-radius: 12px 12px 0 0; }
  .t-stub { border-radius: 0 0 12px 12px; padding-top: 12px; padding-bottom: 14px; }
  .s-big .n { font-size: calc(48px * var(--ck)); }
  .s-big .u { font-size: 17px; }
  .s-pct { font-size: 16px; }
  .s-marks .mk { width: 28px; height: 28px; }
  .s-tomorrow b { font-size: 19px; }
  .cmp-row { font-size: 14px; grid-template-columns: 18px 52px minmax(0, 1fr) auto; }

  .dev { left: auto; right: 10px; bottom: auto; top: 58px; }
  .dev > button { float: right; }
  .dev-panel { max-width: calc(100vw - 20px); }

  .sheet { padding: 0; align-items: end; }
  .passport-book { grid-template-columns: 1fr; border-radius: 16px 16px 0 0; max-height: 92dvh; overflow-y: auto; }
  .pp-cover { padding: 22px 20px 14px; gap: 6px; overflow: visible; }
  .pp-cover::after, .pp-mrz, .pp-emblem { display: none; }
  .pp-cover h2 { font-size: 22px; }
  .pp-pages { padding: 18px 14px calc(24px + env(safe-area-inset-bottom)); overflow: visible; }
  .pp-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .pp-grid .pstamp { width: 96px; height: 96px; }
  .pp-grid .pstamp .st-code { font-size: 22px; }
  /* The close button stays put while the passport scrolls. */
  #passport .sheet-close { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; }
  .help-card { border-radius: 16px 16px 0 0; width: 100%; max-height: 92dvh; padding: 22px 20px calc(18px + env(safe-area-inset-bottom)); }
}
/* short phones: smaller codes and clue first */
@media (max-width: 760px) and (max-height: 700px) {
  .ticket { --code: 34px; --q: 19.5px; --gap: 10px; --res: 30px; }
  /* the pass gets a little more of a short screen, so play never scrolls */
  .stage { grid-template-rows: minmax(0, 1fr) clamp(290px, 62%, 430px); }
  .app[data-state="summary"] .stage { grid-template-rows: minmax(0, 1fr) clamp(340px, 64%, 470px); }
  .app[data-state="compare"] .stage { grid-template-rows: minmax(0, 1fr) clamp(340px, 64%, 470px); }
  /* Help explains the colors; a short screen keeps the controls instead. */
  .cmp-key { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 0s !important; transition-delay: 0s !important; }
}
.lc { text-transform: none; }
/* disclosures: a plain + / – instead of the browser's triangle */
.help-more summary, .cmp-key summary, .pp-stats summary { list-style: none; }
.help-more summary::-webkit-details-marker, .cmp-key summary::-webkit-details-marker, .pp-stats summary::-webkit-details-marker { display: none; }
.help-more summary::after, .pp-stats summary::after { content: "+"; margin-left: auto; font: 500 20px/1 var(--display); }
.cmp-key summary::after { content: "+"; margin-left: 8px; font: 500 17px/1 var(--display); }
.help-more[open] summary::after, .cmp-key[open] summary::after, .pp-stats[open] summary::after { content: "–"; }

/* ───────────────────────────── tall: the pass can't fit, so the page scrolls.
   Set by fitTicket only when the tightest fit level still overflows. */
.app.tall .ticket { max-height: none; }
.app.tall .t-main { overflow: visible; flex: none; }
.app.tall .pass-pane { overflow-y: auto; }
@media (max-width: 760px), (max-width: 1100px) and (orientation: portrait) {
  html:has(.app.tall), html:has(.app.tall) body { height: auto; overflow-y: auto; }
  .app.tall { height: auto; min-height: 100dvh; }
  .app.tall .stage { grid-template-rows: var(--globe-h, 50dvh) auto; }
  .app.tall .pass-pane { overflow: visible; }
  .app.tall .topbar { position: sticky; top: 0; }
}
@media (max-height: 540px) and (orientation: landscape) {
  .globe-hint { top: 12px; bottom: auto; font-size: 10.5px; }
}
/* Compare routes reads as a second button, not a link. */
.s-actions .btn.quiet { border: 1.5px solid rgba(21, 36, 58, 0.32); border-radius: 8px; }
