/* RaceFlags – RacingFuel orange, condensed italic caps, dark pit-lane look. */
:root {
  --bg: #0a0b0d;
  --panel: #14171c;
  --panel-2: #1b1f26;
  --panel-3: #242a33;
  --line: #262b34;
  --line-hi: #3b424e;
  --text: #f4f5f7;
  --muted: #8f97a4;
  --accent: #e98b17;
  --accent-hi: #ffa53a;
  --accent-ink: #1a1206;
  --accent-soft: rgba(233, 139, 23, .13);
  --danger: #ff453a;
  --ok: #30d158;
  --f-green: #00b050;
  --f-yellow: #ffd200;
  --f-red: #e10600;
  --f-blue: #1e88ff;
  --radius: 16px;
  /* Condensed faces that ship with the phones themselves: iPhone/Mac, Windows, Android. */
  --display: "Avenir Next Condensed", "Bahnschrift", "Roboto Condensed", sans-serif-condensed, "Arial Narrow", sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--text);
  font: 16px/1.45 var(--body);
  background:
    radial-gradient(900px 420px at 88% -140px, rgba(233, 139, 23, .17), transparent 70%),
    radial-gradient(700px 380px at -15% 105%, rgba(30, 136, 255, .07), transparent 70%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .016) 0 2px, transparent 2px 7px),
    var(--bg);
  background-attachment: fixed;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }

.display, h1, h2 { font-family: var(--display); font-stretch: condensed; }
h1 {
  font-size: 38px; font-weight: 900; font-style: italic; text-transform: uppercase;
  line-height: 1; letter-spacing: .005em; margin: 4px 0 18px; overflow-wrap: anywhere;
}
h2 { font-size: 19px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.eyebrow {
  display: flex; align-items: center; margin: 18px 0 6px; color: var(--accent);
  font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 18px; height: 3px; margin-right: 8px; border-radius: 2px; background: currentColor; transform: skewX(-20deg); }
.lead-sm { color: var(--muted); margin: -8px 0 20px; }

/* chequered strip across the top, fading out */
.checker {
  height: 10px;
  background: repeating-conic-gradient(#f4f5f7 0 25%, #0a0b0d 0 50%) 0 0 / 10px 10px;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, .65) 35%, transparent 75%);
  mask-image: linear-gradient(90deg, #000 0%, rgba(0, 0, 0, .65) 35%, transparent 75%);
}
body.racing .checker { display: none; }

/* ---------- logo */
.logo { display: inline-flex; align-items: center; color: var(--text); text-decoration: none; }
.logo-mark {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 3px;
  width: 30px; height: 30px; margin-right: 10px; transform: skewX(-9deg); flex: 0 0 auto;
}
.logo-mark i { display: block; border-radius: 3px; }
.logo-mark i:nth-child(1) { background: var(--f-green); }
.logo-mark i:nth-child(2) { background: var(--f-yellow); }
.logo-mark i:nth-child(3) { background: var(--f-red); }
.logo-mark i:nth-child(4) { background: repeating-conic-gradient(#fff 0 25%, #111 0 50%) 0 0 / 6px 6px; }
.logo-text {
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic;
  text-transform: uppercase; font-size: 25px; line-height: 1; letter-spacing: .02em;
}
.logo-text b { color: var(--accent); font-weight: inherit; }
.logo.big .logo-mark { width: 46px; height: 46px; gap: 4px; margin-right: 14px; }
.logo.big .logo-mark i:nth-child(4) { background-size: 8px 8px; }
.logo.big .logo-text { font-size: 40px; }
.logo.small .logo-mark { width: 22px; height: 22px; gap: 2px; margin-right: 8px; }
.logo.small .logo-mark i:nth-child(4) { background-size: 4px 4px; }
.logo.small .logo-text { font-size: 19px; }

/* ---------- screens */
.screen {
  max-width: 540px; margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}
.screen.center { min-height: 80vh; display: flex; align-items: center; justify-content: center; }
.screen-head { display: flex; align-items: center; justify-content: space-between; min-height: 44px; margin-bottom: 4px; }
.who { color: var(--muted); font-size: 14px; text-align: right; }
.who b { color: var(--text); }
.who .link { margin-left: 10px; }

.card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 24px 48px -28px rgba(0, 0, 0, .8);
}
.card.accent { box-shadow: inset 0 3px 0 var(--accent), inset 0 1px 0 rgba(255, 255, 255, .04), 0 24px 48px -28px rgba(0, 0, 0, .8); }

.form label { display: block; font-weight: 700; font-size: 13px; color: var(--muted); margin-bottom: 14px; letter-spacing: .02em; }
.form input {
  display: block; width: 100%; margin-top: 6px; padding: 14px; font-size: 17px; color: var(--text);
  background: #0c0e11; border: 1px solid var(--line); border-radius: 12px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form input::placeholder { color: #4f5662; }
.form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233, 139, 23, .22); }
.form small { display: block; font-weight: 400; margin-top: 7px; line-height: 1.4; }
.error { color: var(--danger); margin: 0 0 12px; font-weight: 700; }
.error:empty { display: none; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px;
  border-radius: 12px; border: 1px solid var(--line-hi); background: var(--panel-3); color: var(--text);
  font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: border-color .15s, background .15s, transform .08s;
}
.btn:hover { border-color: #56606e; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: var(--accent-ink); border-color: transparent;
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .05em;
  box-shadow: 0 10px 26px -12px rgba(233, 139, 23, .9), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn.big { width: 100%; padding: 14px; font-size: 21px; }
.btn.light { background: #fff; color: #111; border-color: #fff; }
.btn.dark { background: #111; color: #fff; border-color: #111; }
.btn.ghost { background: transparent; }
.link {
  background: none; border: 0; padding: 4px 0; color: var(--muted); cursor: pointer;
  text-decoration: underline; text-decoration-color: rgba(143, 151, 164, .4); text-underline-offset: 3px;
}
.link:hover { color: var(--text); }
.link.danger { color: var(--danger); text-decoration-color: rgba(255, 69, 58, .4); }
.back { display: inline-block; color: var(--muted); text-decoration: none; font-size: 15px; }
.back:hover { color: var(--text); }

.tabs { display: flex; background: #0c0e11; border: 1px solid var(--line); border-radius: 14px; padding: 4px; margin-bottom: 14px; }
.tabs button {
  flex: 1; padding: 11px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer;
  font-family: var(--display); font-stretch: condensed; font-weight: 800; font-style: italic; text-transform: uppercase; letter-spacing: .06em; font-size: 16px;
}
.tabs button.active { background: var(--panel-3); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

.pill {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
}
.pill.live { background: rgba(48, 209, 88, .13); color: var(--ok); }
.pill.live::before { content: ""; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: currentColor; animation: livedot 1.6s ease-out infinite; }
.pill.closed { background: var(--panel-3); color: var(--muted); }
@keyframes livedot { 0% { box-shadow: 0 0 0 0 rgba(48, 209, 88, .7); } 100% { box-shadow: 0 0 0 7px rgba(48, 209, 88, 0); } }

.list { display: grid; gap: 10px; }
.list-item {
  display: flex; align-items: center; text-align: left; width: 100%; padding: 15px 16px; cursor: pointer;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 14px;
  color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s;
}
.list-item:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.list-item:disabled { opacity: .5; cursor: default; }
.li-body { flex: 1 1 auto; min-width: 0; }
.li-title {
  display: block; font-family: var(--display); font-stretch: condensed; font-weight: 800; font-style: italic;
  text-transform: uppercase; font-size: 22px; line-height: 1.05; overflow-wrap: anywhere;
}
.li-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--muted); font-size: 14px; margin-top: 5px; }
.li-arrow { flex: 0 0 auto; margin-left: 12px; color: var(--accent); font-size: 22px; font-weight: 700; }

.code-input {
  text-transform: uppercase; text-align: center; letter-spacing: .32em; text-indent: .32em;
  font-family: var(--display) !important; font-stretch: condensed; font-weight: 900; font-style: italic; font-size: 34px !important;
  border-style: dashed !important; border-color: var(--line-hi) !important; background: var(--accent-soft) !important; color: var(--accent) !important;
}

.checklist ol { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.checklist li { counter-increment: step; position: relative; padding-left: 42px; min-height: 28px; margin-bottom: 13px; }
.checklist li:last-child { margin-bottom: 0; }
.checklist li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent);
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; font-size: 17px;
}

.spinner { width: 38px; height: 38px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- landing */
.landing { max-width: 560px; margin: 0 auto; padding: 26px 16px max(36px, env(safe-area-inset-bottom)); }
.hero-title { font-size: 58px; font-size: clamp(42px, 12vw, 68px); margin: 34px 0 14px; line-height: .95; }
.hero-title span { color: var(--accent); }
.lead { color: var(--muted); font-size: 18px; margin: 0 0 26px; max-width: 30em; }
.flag-row { display: flex; margin: 0 0 26px; }
.flag-row span { flex: 1 1 0; height: 30px; border-radius: 6px; background: var(--fc); transform: skewX(-12deg); margin-right: 6px; }
.flag-row span:last-child { margin-right: 0; }
.flag-row span[data-flag="chequered"] { background: repeating-conic-gradient(#fff 0 25%, #111 0 50%) 0 0 / 10px 10px; }
.flag-row span[data-flag="black"] { box-shadow: inset 0 0 0 2px #fff; }
.choice {
  position: relative; display: flex; align-items: center; padding: 18px; margin-bottom: 14px; overflow: hidden;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 20px;
  text-decoration: none; transition: border-color .15s, transform .15s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 24px 48px -28px rgba(0, 0, 0, .8);
}
.choice:hover { border-color: var(--accent); transform: translateY(-2px); }
.choice-icon {
  flex: 0 0 60px; height: 60px; margin-right: 16px; border-radius: 16px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent);
}
.choice-icon svg { width: 32px; height: 32px; }
.choice-body { flex: 1 1 auto; min-width: 0; }
.choice-title {
  display: block; font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic;
  text-transform: uppercase; font-size: 28px; line-height: 1;
}
.choice-text { display: block; color: var(--muted); margin-top: 5px; font-size: 15px; line-height: 1.35; }
.choice-arrow { flex: 0 0 auto; margin-left: 12px; color: var(--accent); font-size: 26px; font-weight: 700; }
.footer-note { color: #5d6470; font-size: 13px; text-align: center; margin-top: 26px; letter-spacing: .04em; }

/* ---------- flag colours (chips, buttons, rows, the big flag) */
[data-flag="green"] { --fc: var(--f-green); --fi: #fff; }
[data-flag="yellow"], [data-flag="fcy"] { --fc: var(--f-yellow); --fi: #111; }
[data-flag="red"] { --fc: var(--f-red); --fi: #fff; }
[data-flag="blue"] { --fc: var(--f-blue); --fi: #fff; }
[data-flag="black"] { --fc: #000; --fi: #fff; }
[data-flag="chequered"] { --fc: #fff; --fi: #111; }
[data-flag="clear"], [data-flag="closed"] { --fc: var(--panel-3); --fi: var(--muted); }

.chip {
  display: inline-block; padding: 3px 8px; border-radius: 6px; white-space: nowrap; background: var(--fc); color: var(--fi);
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; font-size: 13px; letter-spacing: .05em; line-height: 1.2;
}
.chip[data-flag="black"] { box-shadow: inset 0 0 0 1px #fff; }
.chip[data-flag="clear"] { box-shadow: inset 0 0 0 1px var(--line-hi); }
.chip[data-flag="chequered"]::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px;
  background: repeating-conic-gradient(#111 0 25%, #fff 0 50%) 0 0 / 5px 5px; outline: 1px solid #111;
}

/* ---------- driver: ready / START */
.start-wrap { display: flex; flex-direction: column; align-items: center; margin: 34px 0 6px; }
.start-btn {
  position: relative; width: 214px; height: 214px; border-radius: 50%; border: 0; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--display); font-stretch: condensed; font-style: italic; text-transform: uppercase;
  background: radial-gradient(circle at 50% 28%, #47ea8b 0%, #00b050 46%, #00742f 100%);
  box-shadow: 0 0 0 10px #15181d, 0 0 0 13px #2d333d, 0 20px 56px -8px rgba(0, 176, 80, .6),
    inset 0 -12px 20px rgba(0, 0, 0, .35), inset 0 9px 14px rgba(255, 255, 255, .3);
  transition: transform .08s;
}
.start-btn::before {
  content: ""; position: absolute; top: -13px; right: -13px; bottom: -13px; left: -13px; border-radius: 50%;
  animation: startring 2.2s ease-out infinite;
}
@keyframes startring { 0% { box-shadow: 0 0 0 0 rgba(0, 176, 80, .55); } 100% { box-shadow: 0 0 0 26px rgba(0, 176, 80, 0); } }
.start-btn:active { transform: scale(.96); }
.s-small { font-size: 15px; font-weight: 800; letter-spacing: .24em; opacity: .9; text-indent: .24em; }
.s-big { font-size: 62px; font-weight: 900; line-height: .95; letter-spacing: .02em; text-shadow: 0 2px 0 rgba(0, 0, 0, .18); }
.start-hint { color: var(--muted); font-size: 14px; margin: 26px 0 0; text-align: center; max-width: 24em; }
.start-hint b { color: var(--text); }

/* ---------- driver race screen */
body.racing { overflow: hidden; overscroll-behavior: none; background: #000; }
.race {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0;
  display: flex; flex-direction: column; background: #000; color: #fff;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}
.race-main { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 3vmin; }
.flag {
  position: relative; flex: 1 1 auto; min-height: 0; border-radius: 4vmin; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--fc); color: var(--fi); container-type: size;
}
.flag::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none;
  background: linear-gradient(155deg, rgba(255, 255, 255, .2) 0%, rgba(255, 255, 255, 0) 36%, rgba(0, 0, 0, 0) 62%, rgba(0, 0, 0, .16) 100%);
}
.flag[data-flag="black"] { box-shadow: inset 0 0 0 max(8px, 1.6vmin) #fff; }
.flag[data-flag="chequered"] { background: repeating-conic-gradient(#000 0 25%, #fff 0 50%) 0 0 / 20vmin 20vmin; }
.flag[data-flag="clear"] { background: radial-gradient(circle at 50% 40%, #16191e, #0d0f12); box-shadow: inset 0 0 0 2px #1f232a; }
.flag[data-flag="closed"] { background: #15171b; }
.flag[data-flag="clear"]::after, .flag[data-flag="closed"]::after { display: none; }

/* what is written inside the flag – readable at a glance, also for colour-blind drivers */
.flag-inner {
  position: relative; z-index: 1; max-width: 100%; padding: 0 5vmin;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; text-transform: uppercase; line-height: .86;
}
.g-word { font-size: 36vmin; font-size: 44cqmin; letter-spacing: -.01em; }
.g-two { font-size: 15vmin; font-size: 19cqmin; letter-spacing: .01em; }
.g-name { font-size: 15vmin; font-size: min(21cqw, 28cqh); overflow-wrap: anywhere; }
.g-sub { margin-top: .3em; font-size: 8vmin; font-size: 11cqmin; opacity: .9; }
.g-fcy { font-size: 24vmin; font-size: 30cqmin; }
.g-limit {
  display: flex; align-items: center; justify-content: center; margin-top: 4vmin; margin-top: 4cqmin;
  width: 28vmin; height: 28vmin; width: 34cqmin; height: 34cqmin; border-radius: 50%;
  background: #fff; color: #111; border: 3vmin solid var(--f-red); border-width: 4cqmin;
  font-style: normal; font-size: 11vmin; font-size: 14cqmin; letter-spacing: -.02em; line-height: 1;
}
.g-icon { display: block; width: 40vmin; width: 52cqmin; height: auto; }
.g-wait {
  font-family: var(--body); font-style: normal; text-transform: none; font-weight: 700; line-height: 1.25;
  font-size: 5.5vmin; color: #5d6470;
}
.g-wait i { display: block; width: 16px; height: 16px; margin: 0 auto 16px; border-radius: 50%; background: var(--accent); animation: waitpulse 1.6s ease-out infinite; }
@keyframes waitpulse { 0% { box-shadow: 0 0 0 0 rgba(233, 139, 23, .6); } 100% { box-shadow: 0 0 0 24px rgba(233, 139, 23, 0); } }

.flag-caption { flex: 0 0 auto; text-align: center; padding-top: 2.5vmin; }
.flag-label {
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; text-transform: uppercase;
  font-size: clamp(28px, 9.5vmin, 84px); line-height: 1; letter-spacing: .01em;
}
.flag-text { font-size: clamp(18px, 5.4vmin, 46px); font-weight: 700; margin-top: .25em; line-height: 1.15; color: #e4e6ea; }
.flag-note {
  display: inline-block; margin-top: .45em; padding: .12em .5em; border-radius: 8px; background: #fff; color: #000;
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; text-transform: uppercase;
  font-size: clamp(20px, 6vmin, 48px); letter-spacing: .02em;
}
.flag-time { color: #5d6470; font-size: 14px; margin-top: .55em; font-variant-numeric: tabular-nums; }

@media (orientation: landscape) {
  .race-main { flex-direction: row; }
  .flag { flex: 1.45 1 0; }
  .flag-caption { flex: 1 1 0; padding: 0 0 0 3.5vmin; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; text-align: left; }
  .flag-label { font-size: clamp(28px, 11vmin, 84px); }
  .flag-text { font-size: clamp(18px, 6.2vmin, 48px); }
}

.flag.flash { animation: flagflash 1.8s steps(1, end) 1; }
@keyframes flagflash {
  0% { opacity: 1; } 16% { opacity: .1; } 33% { opacity: 1; } 50% { opacity: .1; } 66% { opacity: 1; } 83% { opacity: .1; } 100% { opacity: 1; }
}

.race-bar {
  flex: 0 0 auto; display: flex; align-items: center; padding: 9px max(12px, 3vmin) max(9px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #0f1114, #08090b); border-top: 1px solid #1c1f25;
}
.race-bar > * + * { margin-left: 12px; }
.bar-exit { background: none; border: 1px solid #2c3038; color: #7d8592; border-radius: 9px; padding: 8px 10px; font-size: 13px; cursor: pointer; }
.bar-status { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; flex: 1 1 auto; }
.conn {
  display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; background: rgba(48, 209, 88, .13); color: var(--ok);
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; font-size: 14px; letter-spacing: .1em;
}
.conn::before { content: ""; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: currentColor; }
.conn.connecting { background: var(--accent-soft); color: var(--accent); }
body.signal-lost .conn { background: rgba(255, 69, 58, .16); color: var(--danger); }
.bar-sub { color: var(--muted); font-size: 12.5px; margin-top: 4px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-sub .warn { color: var(--accent); font-weight: 700; }
.bar-clock {
  font-family: var(--display); font-stretch: condensed; font-weight: 800; font-size: 28px; color: #e4e6ea;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.sos-btn {
  flex: 0 0 auto; width: 74px; height: 74px; border-radius: 50%; color: #fff; text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; font-size: 25px; letter-spacing: .04em;
  background: radial-gradient(circle at 50% 30%, #ff5a4f 0%, #e10600 55%, #a30000 100%);
  box-shadow: 0 0 0 4px #0b0c0e, 0 0 0 7px rgba(225, 6, 0, .5), 0 8px 22px rgba(225, 6, 0, .45), inset 0 4px 8px rgba(255, 255, 255, .25);
}
.sos-btn:active { transform: scale(.95); }

.signal-banner {
  display: none; position: absolute; left: 0; right: 0; top: env(safe-area-inset-top); padding: 12px; text-align: center;
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; text-transform: uppercase; letter-spacing: .03em;
  font-size: clamp(20px, 5.5vmin, 38px); color: #fff;
  background: repeating-linear-gradient(45deg, #a00000 0 24px, #e10600 24px 48px); animation: blink 1s steps(1) infinite;
}
body.signal-lost .signal-banner { display: block; }
@keyframes blink { 50% { opacity: .6; } }

/* In the flow (not on top): it shrinks the flag instead of covering it. */
.sos-banner {
  flex: 0 0 auto; margin: 0 3vmin 2vmin; background: var(--f-red); color: #fff; border-radius: 14px;
  padding: 8px 10px 8px 14px; display: flex; align-items: center;
}
.sos-banner.acked { background: var(--f-green); }
.sos-banner-text {
  flex: 1 1 auto; min-width: 0; margin-right: 10px; line-height: 1.1;
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; text-transform: uppercase; font-size: 20px;
}
.sos-banner-actions { display: flex; }
.sos-banner-actions > * + * { margin-left: 8px; }
.sos-banner .btn { padding: 8px 12px; }
.sos-banner .btn.ghost { border-color: rgba(255, 255, 255, .7); color: #fff; }

/* ---------- Race Control console */
.console { min-height: 100vh; padding: 12px 16px 90px; max-width: 1400px; margin: 0 auto; }
.console-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px;
  padding: 6px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.ch-nav { display: flex; flex-direction: column; align-items: flex-start; }
.ch-nav .link { font-size: 14px; margin-top: 2px; }
.ch-title { flex: 1 1 260px; min-width: 0; }
.ch-title .eyebrow { margin: 0 0 4px; }
.ch-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; }
.ch-row h1 { margin: 0; font-size: 34px; }
.t-label { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.ticket {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 10px 8px 14px; border-radius: 14px;
  border: 1px dashed #4a4136; background: var(--accent-soft);
}
.code-box { display: flex; flex-direction: column; line-height: 1.05; margin-right: 6px; }
.code {
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; font-size: 32px;
  letter-spacing: .12em; color: var(--accent);
}
.ch-sos { font-size: 15px; line-height: 1.3; }
.ch-sos b { font-size: 17px; }

.console-body {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  grid-template-areas: "send grid" "log grid";
}
.send-panel { grid-area: send; }
.grid-panel { grid-area: grid; }
.log-panel { grid-area: log; }
@media (max-width: 860px) {
  .console-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "send" "grid" "log"; }
  .ch-row h1 { font-size: 30px; }
}
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 24px 48px -30px rgba(0, 0, 0, .8);
}
.panel h2 { display: flex; align-items: baseline; gap: 10px; }
.panel h2 .muted { font-family: var(--body); font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 14px; }

.target {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; padding: 12px 16px; border-radius: 14px;
  background: #0c0e11; border: 2px solid var(--line); margin-bottom: 10px;
}
.target b {
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; font-size: 28px;
  text-transform: uppercase; line-height: 1;
}
.target.single { border-color: var(--accent); background: var(--accent-soft); }
.target.single .t-label { color: var(--accent); }
.target .link { margin-left: auto; }
.grid-now { color: var(--muted); font-size: 14px; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.note { display: block; margin: 0 0 14px; font-size: 13px; color: var(--muted); font-weight: 700; }
.note input {
  display: block; width: 100%; margin-top: 6px; padding: 12px 14px; background: #0c0e11; border: 1px solid var(--line);
  border-radius: 12px; color: var(--text); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.note input::placeholder { color: #4f5662; }
.note input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233, 139, 23, .22); }

.flag-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 1200px) { .flag-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.flag-btn {
  position: relative; overflow: hidden; min-height: 108px; padding: 12px 13px; border-radius: 14px; border: 0; cursor: pointer;
  background: var(--fc); color: var(--fi); text-align: left; display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 10px 22px -16px rgba(0, 0, 0, .9);
  transition: transform .08s, box-shadow .15s;
}
.flag-btn::after {
  content: ""; position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none;
  background: linear-gradient(155deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, 0) 42%, rgba(0, 0, 0, .12) 100%);
}
.flag-btn:hover:not(:disabled) { transform: translateY(-2px); }
.flag-btn:active:not(:disabled) { transform: scale(.97); }
.flag-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.fb-label, .fb-text, .fb-hint { position: relative; z-index: 1; }
.fb-label {
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; text-transform: uppercase;
  font-size: 22px; line-height: 1; letter-spacing: .01em;
}
.fb-text { font-size: 13px; font-weight: 600; opacity: .85; margin-top: 4px; line-height: 1.25; }
.fb-hint { display: none; font-size: 12px; font-weight: 700; margin-top: 4px; }
.flag-btn:disabled { opacity: .28; cursor: not-allowed; }
.flag-btn:disabled .fb-hint { display: block; }
.flag-btn:disabled .fb-text { display: none; }
.flag-btn[data-flag="black"] { box-shadow: inset 0 0 0 3px #fff; }
.flag-btn[data-flag="chequered"] { background: repeating-conic-gradient(#000 0 25%, #fff 0 50%) 0 0 / 28px 28px; }
.flag-btn[data-flag="chequered"] .fb-label,
.flag-btn[data-flag="chequered"] .fb-text,
.flag-btn[data-flag="chequered"] .fb-hint { align-self: flex-start; background: #fff; color: #111; padding: 1px 5px; border-radius: 4px; }
.flag-btn[data-flag="clear"] { color: var(--text); box-shadow: inset 0 0 0 1px var(--line-hi); }
.flag-btn[data-flag="clear"]::after { display: none; }
.flag-btn.sent { animation: sent .9s ease-out 1; }
@keyframes sent { 0% { box-shadow: 0 0 0 0 rgba(233, 139, 23, .95); } 100% { box-shadow: 0 0 0 16px rgba(233, 139, 23, 0); } }

/* grid list – timing-tower rows, colour bar = what that phone shows */
.grid-row {
  position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #15191f;
  margin-bottom: 8px; padding-left: 6px; transition: border-color .15s, box-shadow .15s;
}
.grid-row::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 6px; background: var(--fc, var(--line-hi)); }
.grid-row[data-flag="chequered"]::before { background: repeating-conic-gradient(#fff 0 25%, #111 0 50%) 0 0 / 6px 6px; }
.grid-row[data-flag="black"]::before { background: #000; box-shadow: inset -1px 0 0 #6b7280; }
.grid-row[data-flag="clear"]::before { background: var(--line-hi); }
.grid-row:hover { border-color: var(--line-hi); }
.grid-row.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 26px -8px rgba(233, 139, 23, .65); }
button.grid-row { display: flex; width: 100%; flex-direction: column; align-items: flex-start; padding: 12px 14px 12px 20px; color: var(--text); cursor: pointer; text-align: left; }
.gr-main { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 14px 6px; background: none; border: 0; color: var(--text); cursor: pointer; text-align: left; }
.gr-name {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: var(--display); font-stretch: condensed; font-weight: 800; font-style: italic; text-transform: uppercase; font-size: 21px; line-height: 1.1;
}
.gr-sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.gr-deliv { font-size: 13px; font-weight: 700; white-space: nowrap; }
.gr-deliv.ok { color: var(--ok); }
.gr-deliv.wait { color: var(--accent); }
.gr-deliv.bad { color: var(--danger); }
.gr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 0 14px 11px 34px; color: var(--muted); font-size: 13px; }
.gr-meta a { color: var(--text); }
.gr-meta .warn { color: var(--accent); font-weight: 700; }
.gr-meta .link { margin-left: auto; padding: 0; font-size: 13px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; background: #555; }
.dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.off { background: var(--danger); }
.empty { color: var(--muted); padding: 6px 2px 10px; }

.log { list-style: none; margin: 0; padding: 0; max-height: 380px; overflow: auto; }
.log li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log li:last-child { border-bottom: 0; }
.log-time { font-variant-numeric: tabular-nums; color: var(--muted); }
.log-note { color: var(--accent); }
.history { margin: 14px 0 0; padding-left: 18px; font-size: 14px; color: var(--muted); }
.history li { margin-bottom: 4px; }

.conn-banner, .sound-banner { display: block; padding: 11px 14px; border-radius: 12px; margin-bottom: 14px; font-weight: 700; }
.conn-banner { background: var(--f-red); color: #fff; }
.sound-banner { background: var(--accent-soft); border: 1px dashed var(--accent); color: var(--accent); cursor: pointer; width: 100%; text-align: left; }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: #fff; color: #111; padding: 12px 18px 12px 16px; border-radius: 12px; border-left: 5px solid var(--accent);
  font-weight: 800; box-shadow: 0 14px 34px rgba(0, 0, 0, .55); max-width: calc(100% - 32px);
}
.toast.bad { background: var(--f-red); color: #fff; border-left-color: #fff; }

.sos-overlay {
  position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 100; overflow: auto;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(120, 0, 0, .94); animation: sosbg 1s steps(1) infinite;
}
@keyframes sosbg { 50% { background: rgba(225, 6, 0, .96); } }
.sos-cards { width: 100%; max-width: 560px; margin: auto; }
.sos-card { background: #fff; color: #111; border-radius: 22px; padding: 24px; text-align: center; margin-bottom: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); }
.sos-card > * + * { margin-top: 12px; }
.sos-word {
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic;
  font-size: 72px; color: var(--f-red); letter-spacing: .08em; line-height: .9;
}
.sos-driver {
  font-family: var(--display); font-stretch: condensed; font-weight: 900; font-style: italic; text-transform: uppercase;
  font-size: 40px; line-height: 1; overflow-wrap: anywhere;
}
.sos-when { color: #555; font-weight: 600; }
.sos-card .btn { display: flex; width: 100%; }
