/* FTR: Fly The Roadster. Launch-suit orange ripstop, navy twill patches, gold merrow, black name tapes.
   Everything sits on one 4px stitch grid. */

@font-face { font-family: "Bungee"; src: url("fonts/bungee.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Bungee Inline"; src: url("fonts/bungee-inline.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Atkinson Next"; src: url("fonts/atkinson-next.woff2") format("woff2"); font-weight: 200 800; font-display: swap; }

:root {
  --orange: #FF4F00;
  --navy: #1D2340;
  --gold: #D9A63E;
  --gold-deep: #9C6E1C;
  --cherry: #B3121E;
  --cream: #EFE4CC;
  --tape: #141414;
  --earth: #2F6FA8;
  --rust: #B4532A;
  --space: #0F1230;
  --u: 4px;
  --display: "Bungee", "Arial Black", sans-serif;
  --inline: "Bungee Inline", "Bungee", sans-serif;
  --text: "Atkinson Next", "Atkinson Hyperlegible", system-ui, sans-serif;
  color-scheme: light;
  accent-color: var(--cherry);
  scrollbar-color: var(--navy) var(--orange);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  position: relative;
  min-height: 100svh;
  background-color: var(--orange);
  /* ripstop: a reinforcement thread every 16px each way */
  background-image: url("img/ripstop.png");
  background-size: 48px 48px;
  color: var(--navy);
  font: 500 18px/1.5 var(--text);
  caret-color: var(--cherry);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow-x: hidden;
}

::selection { background: var(--navy); color: var(--cream); }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.patch :focus-visible, .landed :focus-visible, .tape :focus-visible, .hem :focus-visible { outline-color: var(--gold); }

/* the real roadster's orbit, sewn in running stitch down the whole page */
.flight, .below { position: relative; }
.orbit { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.orbit path { fill: none; stroke: var(--cream); stroke-width: 3; stroke-dasharray: 12 9; stroke-linecap: round; opacity: .6; }
.orbit .o-wide { display: none; }
.mars-marker { display: none; position: absolute; width: 64px; height: 64px; right: 9%; top: 3%; z-index: 1; overflow: visible; filter: drop-shadow(0 4px 5px rgba(60, 14, 0, .3)); }
.mars__field { fill: var(--rust); }
.mars__rim { fill: none; stroke: var(--gold); stroke-width: 5; stroke-dasharray: 1.6 1.1; }
.mars__cap { fill: rgba(239, 228, 204, .55); }
.flight > :not(.orbit):not(.mars-marker), .below > :not(.orbit) { position: relative; z-index: 1; }
@media (min-width: 900px) {
  .orbit .o-wide { display: inline; }
  .orbit .o-narrow { display: none; }
  .mars-marker { display: block; }
}

header, main, footer { position: relative; z-index: 1; }

/* ---------- name tape ---------- */
.tape {
  margin: 16px 16px 0;
  background: var(--tape);
  border-radius: 8px;
  padding: 12px 16px;
  position: relative;
  box-shadow: 0 3px 8px rgba(60, 14, 0, .35);
}
.tape::before {
  content: ""; position: absolute; inset: 5px;
  border: 2px dashed rgba(239, 228, 204, .5); border-radius: 4px; pointer-events: none;
}
.tape h1 {
  margin: 0; text-align: center; color: var(--cream);
  font-family: var(--display); font-weight: 400; font-size: 16px; line-height: 1.1; letter-spacing: .03em; text-transform: uppercase; white-space: nowrap;
}
.tape .dot { color: var(--gold); }

@media (min-width: 360px) { .tape h1 { font-size: 18px; } }
@media (min-width: 400px) { .tape h1 { font-size: 20px; } }
@media (min-width: 560px) { .tape h1 { font-size: 26px; } }

/* ---------- patches ---------- */
.patch { position: relative; background: var(--navy); }
.merrow { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.merrow rect, .merrow circle { fill: none; stroke: var(--gold); stroke-width: 10; stroke-dasharray: 1.6 1.1; }
.merrow--round circle { stroke-width: 9; }

/* ---------- first viewport ---------- */
.flight {
  display: grid; gap: 24px;
  justify-items: center;
  padding: 20px 16px 40px;
}

.patch--game {
  --h: min(calc(100svh - 132px), calc((100vw - 32px) * 16 / 9 + 28px), 900px);
  height: var(--h);
  aspect-ratio: 9 / 16;
  max-width: calc(100vw - 32px);
  border-radius: 36px;
  padding: 14px;
  box-shadow: 0 6px 18px rgba(60, 14, 0, .4);
  background-image: url("img/twill.png"); background-size: 24px 24px;
}
.screen {
  position: relative; width: 100%; height: 100%; container-type: size;
  border-radius: 22px; overflow: hidden;
}
.screen iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--space); }

.landed {
  position: absolute; inset: 0;
  background-color: var(--navy);
  background-image: url("img/twill.png"); background-size: 24px 24px;
}
.landed[hidden] { display: none; }
.landed canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.landed__foot {
  position: absolute; left: 0; right: 0; bottom: 0; top: 56.5%;
  display: grid; align-content: space-evenly; justify-items: center; gap: 2.4cqw; padding: 2cqw 9cqw 5cqh;
}
.landed__line {
  margin: 0; max-width: 30ch; text-align: center; color: var(--cream);
  font-family: var(--text); font-weight: 600; font-size: clamp(13px, 5cqw, 17px); line-height: 1.35; text-wrap: balance;
}
.landed__actions { display: flex; flex-wrap: nowrap; gap: 18px; justify-content: center; white-space: nowrap; }
.landed .btn--share { width: min(100%, 280px); min-height: clamp(42px, 14cqw, 52px); font-size: clamp(15px, 5cqw, 18px); }
.landed .landed__again { width: min(100%, 280px); min-height: clamp(38px, 12cqw, 46px); font-size: clamp(14px, 4.6cqw, 16px); background: var(--tape); color: var(--cream); outline-color: rgba(217, 166, 62, .75); }
.landed .linkish { font-size: clamp(13px, 4.4cqw, 15px); }
.landed__perk { margin: 0; color: var(--gold); font: 600 15px/1.4 var(--text); text-align: center; }

/* ---------- sewn buttons ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 24px;
  border-radius: 12px;
  font: 400 18px/1 var(--display); letter-spacing: .05em; text-transform: uppercase;
  outline: 2px dashed rgba(239, 228, 204, .65); outline-offset: -7px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, .35);
  transition: transform 160ms cubic-bezier(.16, 1, .3, 1), box-shadow 160ms cubic-bezier(.16, 1, .3, 1);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 12px rgba(0, 0, 0, .35); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }
.btn--share { background: var(--cherry); color: var(--cream); }
.btn--again, .btn--top { background: var(--tape); color: var(--cream); }

/* ---------- the log beside the game ---------- */
.log { width: 100%; max-width: 440px; display: grid; gap: 20px; justify-items: start; }

.dayseal {
  position: relative; width: 176px; aspect-ratio: 1; border-radius: 50%;
  background: var(--navy);
  background-image: url("img/twill.png"); background-size: 24px 24px;
  display: grid; place-content: center; text-align: center; gap: 2px; padding: 20px;
  box-shadow: 0 5px 12px rgba(60, 14, 0, .35);
  justify-self: center;
}
.dayseal p { margin: 0; }
.dayseal__day { color: var(--gold); font: 400 18px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; display: grid; gap: 4px; }
.dayseal__day b { font: 400 50px/1 var(--inline); color: var(--cream); letter-spacing: 0; font-variant-numeric: tabular-nums; }
.dayseal__sub { color: var(--cream); font: 400 14px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; }

.lede { margin: 0; max-width: 34ch; font: 600 20px/1.45 var(--text); text-wrap: pretty; }

.readout {
  margin: 0; width: 100%;
  background: var(--navy); color: var(--cream);
  border-radius: 14px; padding: 8px 20px;
  box-shadow: 0 4px 10px rgba(60, 14, 0, .3);
  position: relative;
}
.readout::before { content: ""; position: absolute; inset: 5px; border: 2px dashed rgba(217, 166, 62, .55); border-radius: 10px; pointer-events: none; }
.readout div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; }
.readout div + div { border-top: 2px dashed rgba(239, 228, 204, .22); }
.readout dt { color: var(--gold); font: 700 14px/1.3 var(--text); letter-spacing: .06em; text-transform: uppercase; }
.readout dd { margin: 0; font: 700 20px/1.2 var(--text); font-variant-numeric: tabular-nums lining-nums; text-align: right; }

.source, .demo-note { margin: 0; font: 500 15px/1.45 var(--text); max-width: 40ch; }
.demo-note { font-weight: 700; }

/* ---------- sections below ---------- */
.below > section { padding: 48px 20px; max-width: 1120px; margin: 0 auto; }
h2 { margin: 0 0 24px; font-family: var(--display); font-weight: 400; font-size: 32px; line-height: 1.05; text-transform: uppercase; letter-spacing: .02em; text-wrap: balance; }

.tapes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; justify-items: start; }
.tapes li {
  position: relative; background: var(--tape); color: var(--cream);
  padding: 12px 20px; border-radius: 6px;
  font: 600 17px/1.35 var(--text); max-width: 100%;
  box-shadow: 0 3px 6px rgba(60, 14, 0, .3);
}
.tapes li::before { content: ""; position: absolute; inset: 4px; border: 2px dashed rgba(239, 228, 204, .4); border-radius: 3px; pointer-events: none; }
.tapes b { font: 400 17px/1 var(--display); letter-spacing: .05em; text-transform: uppercase; color: var(--gold); margin-right: .4em; }
.tapes li:nth-child(2) { margin-left: 24px; }
.tapes li:nth-child(3) { margin-left: 8px; }
.tapes li:nth-child(4) { margin-left: 36px; }
.tapes li:nth-child(5) { margin-left: 16px; }
.keys { margin: 20px 0 0; font: 600 16px/1.4 var(--text); }

.rack__intro { margin: 0 0 32px; max-width: 52ch; font: 500 19px/1.5 var(--text); }
.patches { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 32px 24px; align-items: end; }
.emblem { display: grid; justify-items: center; text-align: center; gap: 4px; width: 136px; }
.emblem--tab { width: 168px; }
.emblem svg { width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 4px 5px rgba(60, 14, 0, .3)); }
.emblem .field { fill: transparent; }
.emblem .rim { fill: none; stroke: var(--navy); stroke-width: 4; stroke-dasharray: 5 5; }
.emblem .glyph, .emblem .planet, .emblem .mars { fill: none; stroke: var(--navy); stroke-width: 3; stroke-dasharray: 4 4; }
.emblem .path { fill: none; stroke: var(--navy); stroke-width: 2; stroke-dasharray: 3 4; }
.emblem text { font: 400 26px var(--display); fill: var(--navy); opacity: .85; }
.emblem use { opacity: .35; }
.emblem b { font: 400 16px/1.2 var(--display); text-transform: uppercase; letter-spacing: .04em; margin-top: 8px; }
.emblem span { font: 600 15px/1.35 var(--text); }
.emblem.is-earned .field { fill: var(--navy); }
.emblem.is-earned .rim { stroke: var(--gold); stroke-width: 8; stroke-dasharray: 1.6 1.1; }
.emblem.is-earned .glyph { fill: var(--cherry); stroke: var(--cream); stroke-dasharray: none; }
.emblem.is-earned .planet { fill: var(--earth); stroke: none; }
.emblem.is-earned .mars { fill: var(--rust); stroke: none; }
.emblem.is-earned .path { stroke: var(--cream); }
.emblem.is-earned text { fill: var(--cream); opacity: 1; }
.emblem.is-earned use { opacity: 1; }

.manifest { list-style: none; margin: 0 0 40px; padding: 0; display: grid; gap: 20px; max-width: 56ch; }
.manifest li { position: relative; padding-left: 40px; font: 600 19px/1.45 var(--text); }
.manifest li::before { content: ""; position: absolute; left: 0; top: .72em; width: 26px; border-top: 3px dashed var(--navy); }

.hem {
  margin-top: 24px;
  background: var(--tape); color: var(--cream);
  padding: 32px 20px calc(40px + env(safe-area-inset-bottom));
  position: relative;
}
.hem::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; border-top: 2px dashed rgba(239, 228, 204, .45); }
.hem p { margin: 0 auto 8px; max-width: 1120px; font: 500 15px/1.5 var(--text); }

.defs { position: absolute; }

/* ---------- desktop: game patch left, the log on the suit to its right ---------- */
@media (min-width: 900px) {
  .tape { margin: 24px auto 0; max-width: 1120px; }
  .tape h1 { font-size: 34px; }
  h2 { font-size: 46px; }
  .flight {
    grid-template-columns: auto minmax(320px, 440px);
    justify-content: center; align-items: center;
    gap: 64px;
    min-height: calc(100svh - 96px);
    padding-top: 24px;
  }
  .patch--game { --h: min(calc(100svh - 150px), 900px); max-width: none; }
  .log { justify-items: start; }
  .dayseal { justify-self: start; width: 200px; }
  .dayseal__day b { font-size: 58px; }
  .below { display: grid; grid-template-columns: 1fr 1fr; column-gap: 32px; max-width: 1200px; margin: 0 auto; padding: 0 40px; }
  .below > section { max-width: none; margin: 0; padding-left: 0; padding-right: 0; }
  .sleeve { grid-column: 1; grid-row: 1; }
  .board { grid-column: 2; grid-row: 1; }
  .rack { grid-column: 1 / -1; grid-row: 2; }
  .pad { grid-column: 1 / -1; grid-row: 3; }
  .manifest { grid-template-columns: repeat(3, 1fr); max-width: none; column-gap: 32px; }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- quiet text buttons ---------- */
.linkish {
  appearance: none; background: none; border: 0; padding: 4px 2px; cursor: pointer;
  color: inherit; font: 700 16px/1.3 var(--text);
  text-decoration: underline; text-decoration-style: dashed; text-underline-offset: 5px; text-decoration-thickness: 2px;
}
.landed .linkish { color: var(--cream); }
.linkish:hover { text-decoration-style: solid; }
.landed__src { margin: -6px 0 0; color: var(--gold); font: 700 12px/1.3 var(--text); letter-spacing: .04em; }
.hem a { color: var(--cream); text-decoration-style: dashed; text-underline-offset: 4px; }

/* ---------- today's board ---------- */
.pilot { display: grid; gap: 16px; justify-items: start; margin-bottom: 32px; }
.pilot__tape {
  position: relative; display: flex; align-items: center; gap: 16px;
  background: var(--tape); color: var(--cream); border-radius: 8px; padding: 12px 20px 12px 12px;
  box-shadow: 0 3px 6px rgba(60, 14, 0, .3);
}
.pilot__tape[hidden] { display: none; }
.pilot__tape::before { content: ""; position: absolute; inset: 4px; border: 2px dashed rgba(239, 228, 204, .4); border-radius: 5px; pointer-events: none; }
.pilot__tape p { margin: 0; display: grid; gap: 2px; }
.pilot__tape b { font: 400 18px/1.1 var(--display); letter-spacing: .04em; }
.pilot__tape span { font: 600 14px/1.3 var(--text); color: var(--gold); font-variant-numeric: tabular-nums; }
.pilot__actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pilot__note { margin: 0; max-width: 52ch; font: 500 17px/1.5 var(--text); }
.avatar { width: 48px; height: 48px; border-radius: 6px; image-rendering: pixelated; background: var(--navy); flex: none; }

.ranks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 640px; counter-reset: rank; }
.ranks li {
  display: grid; grid-template-columns: 40px 40px 1fr auto; align-items: center; gap: 12px;
  background: var(--navy); color: var(--cream); border-radius: 10px; padding: 8px 16px 8px 12px;
  background-image: url("img/twill.png"); background-size: 24px 24px;
  box-shadow: 0 3px 6px rgba(60, 14, 0, .28);
}
.ranks li:first-child { outline: 3px solid var(--gold); outline-offset: -3px; }
.ranks .r { font: 400 20px/1 var(--inline); color: var(--gold); text-align: center; font-variant-numeric: tabular-nums; }
.ranks .avatar { width: 40px; height: 40px; }
.ranks .who { display: grid; min-width: 0; }
.ranks .who b { font: 400 16px/1.2 var(--display); letter-spacing: .03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranks .who span { font: 600 13px/1.3 var(--text); color: rgba(239, 228, 204, .8); }
.ranks .km { font: 700 18px/1 var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.ranks__empty { margin: 0; font: 600 17px/1.5 var(--text); max-width: 52ch; }
.ranks__empty[hidden] { display: none; }

/* ---------- plain pages ---------- */
.tape__home { color: inherit; text-decoration: none; }
.doc { max-width: 720px; margin: 0 auto; padding: 48px 20px 64px; }
.doc p { margin: 0 0 16px; max-width: 65ch; font: 500 18px/1.6 var(--text); }
.doc h3 { margin: 40px 0 8px; font: 400 20px/1.2 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.doc a:not(.btn) { color: var(--navy); text-decoration-style: dashed; text-underline-offset: 4px; }

/* ---------- /token: getting $FTRG ---------- */
.token__status {
  display: inline-block; margin: 0 0 24px; padding: 10px 16px; border-radius: 8px;
  background: var(--tape); color: var(--cream); font: 700 16px/1.4 var(--text);
}
.token__status[data-live="true"] { background: var(--navy); color: var(--gold); }
.ca {
  position: relative; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--navy); color: var(--cream); border-radius: 12px; padding: 16px 16px 16px 20px;
  box-shadow: 0 4px 10px rgba(60, 14, 0, .3); margin-bottom: 12px;
}
.ca::before { content: ""; position: absolute; inset: 5px; border: 2px dashed rgba(217, 166, 62, .5); border-radius: 8px; pointer-events: none; }
.ca__value { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; font: 700 18px/1.4 var(--text); letter-spacing: .03em; font-variant-numeric: tabular-nums; }
.ca__copy { min-height: 44px; }
.ca__note, .trade__note { font-size: 16px; }
.trade { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 12px; }
.trade .btn[aria-disabled="true"], .socials .linkish[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.steps { margin: 0 0 8px; padding-left: 24px; display: grid; gap: 12px; max-width: 65ch; }
.steps li { font: 500 18px/1.55 var(--text); padding-left: 4px; }
.steps li::marker { font: 400 18px var(--display); color: var(--navy); }
.rules { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; max-width: 65ch; }
.rules li { position: relative; padding-left: 40px; font: 500 17px/1.55 var(--text); }
.rules li::before { content: ""; position: absolute; left: 0; top: .78em; width: 26px; border-top: 3px dashed var(--navy); }
.socials { list-style: none; margin: 0 0 32px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.hem__row { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.hem .linkish { color: var(--cream); font-size: 15px; }
.hem .linkish[aria-disabled="true"] { opacity: .65; text-decoration-style: dotted; cursor: default; }

/* ---------- /roadmap: the flight plan ---------- */
.plan { list-style: none; margin: 32px 0 48px; padding: 0; position: relative; display: grid; gap: 28px; }
.plan::before { /* the stitched spine joining the milestone patches */
  content: ""; position: absolute; left: 31px; top: 32px; bottom: 32px;
  border-left: 3px dashed var(--cream); opacity: .7;
}
.plan__item { position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 20px; align-items: start; }
.plan__patch { width: 64px; height: 64px; overflow: visible; filter: drop-shadow(0 4px 5px rgba(60, 14, 0, .3)); }
.plan__patch .f { fill: var(--orange); }
.plan__patch .r { fill: none; stroke: var(--navy); stroke-width: 3; stroke-dasharray: 4 4; }
.plan__patch .g { fill: none; stroke: var(--navy); stroke-width: 3; stroke-dasharray: 3 3; stroke-linecap: round; stroke-linejoin: round; }
.plan__item[data-state="done"] .f { fill: var(--navy); }
.plan__item[data-state="done"] .r { stroke: var(--gold); stroke-width: 6; stroke-dasharray: 1.6 1.1; }
.plan__item[data-state="done"] .g { stroke: var(--cream); stroke-dasharray: none; stroke-width: 4; }
.plan__item[data-state="next"] .f { fill: var(--navy); }
.plan__item[data-state="next"] .r { stroke: var(--gold); stroke-dasharray: 5 4; }
.plan__item[data-state="next"] .g { stroke: var(--gold); stroke-dasharray: none; }
.plan__text h3 { margin: 4px 0 6px; font: 400 20px/1.2 var(--display); text-transform: uppercase; letter-spacing: .03em; }
.plan__text p { margin: 0; max-width: 60ch; font: 500 17px/1.55 var(--text); }
.plan__text .plan__when { font: 700 14px/1.3 var(--text); letter-spacing: .06em; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.plan__item[data-state="done"] .plan__when { color: var(--navy); }
.plan__text a { color: var(--navy); text-decoration-style: dashed; text-underline-offset: 4px; }

.pad__more { margin: -24px 0 32px; }

.token__head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 8px; }
.token__head h2 { margin: 0; }
.token__icon { width: 96px; height: 96px; border-radius: 50%; filter: drop-shadow(0 5px 8px rgba(60, 14, 0, .35)); }
@media (min-width: 900px) { .token__icon { width: 128px; height: 128px; } }
.locker { margin: 0 0 32px; }
.ranks .mark { font: 700 12px/1 var(--text); letter-spacing: .06em; text-transform: uppercase; color: var(--gold); margin-left: 6px; }
