:root {
  --bg: #07090d;
  --ink: #eef1f5;
  --ink-2: #c3cad4;
  --muted: #7f8896;
  --line: rgba(255, 255, 255, 0.12);
  --line-2: rgba(255, 255, 255, 0.22);
  --panel: rgba(10, 13, 18, 0.62);
  --panel-solid: rgba(10, 13, 18, 0.86);
  --cyan: #9fdcff;
  --cyan-2: #5fc3ff;
  --amber: #ffb963;
  --red: #ff5c55;
  --font: 'Segoe UI', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Roboto, Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  position: fixed;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

/* ----------------------------------------------------------------- brand */
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.08em;
  font-size: 22px;
  letter-spacing: 0.32em;
  line-height: 1;
  text-transform: uppercase;
  margin: 0;
}
.brand .b-play {
  font-weight: 300;
  color: var(--ink-2);
}
.brand .b-road {
  font-weight: 700;
  color: var(--ink);
}
.brand.big {
  font-size: clamp(24px, 6.4vw, 34px);
  letter-spacing: 0.17em;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- screens */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
  pointer-events: none;
}
.screen.show {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease;
  pointer-events: auto;
}

#loading {
  background: radial-gradient(120% 90% at 50% 60%, #0d1118 0%, #05070a 70%);
}
.load-wrap {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.load-bar {
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.load-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #d6dde6, var(--cyan));
  transform-origin: 0 50%;
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.load-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.error {
  font-size: 13px;
  line-height: 1.5;
  color: #ffd2cf;
  border-left: 2px solid var(--red);
  padding: 8px 12px;
  background: rgba(255, 92, 85, 0.08);
}

#menu {
  justify-content: flex-start;
  align-items: flex-end;
  background: linear-gradient(90deg, rgba(5, 7, 10, 0.78) 0%, rgba(5, 7, 10, 0.35) 42%, rgba(5, 7, 10, 0) 65%);
}
.menu-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 26px 24px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  max-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
#menu .menu-card {
  margin: 0 0 4vh 4vw;
}
.menu-card.compact {
  width: min(320px, 100%);
}
.menu-card.wide {
  width: min(460px, 100%);
}
.to-mars {
  margin-top: -8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.62em;
  color: #ff9a6b;
}
.load-sub {
  margin-top: -10px;
  font-size: 11px;
  letter-spacing: 0.6em;
  color: #ff9a6b;
}
.go-milestone {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.go-milestone span {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.go-milestone b {
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--cyan);
}
.rank-line {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.rank-line b {
  color: var(--ink);
}
.eyebrow {
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
}
.tagline {
  margin: -2px 0 6px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-2);
  font-weight: 300;
}
.title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
#start-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field span,
.select span {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input {
  appearance: none;
  border: 1px solid var(--line-2);
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  padding: 12px 14px;
  font-size: 16px;
  letter-spacing: 0.04em;
  border-radius: 2px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.field input:focus {
  border-color: var(--cyan-2);
  box-shadow: 0 0 0 3px rgba(95, 195, 255, 0.15);
}
.field-error {
  font-size: 12px;
  color: var(--amber);
  margin-top: -4px;
}
.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink);
  padding: 12px 16px;
  font-size: 12.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  touch-action: manipulation;
}
.btn:hover {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.05);
}
.btn:focus-visible,
.icon:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cyan-2);
  outline-offset: 2px;
}
.btn.primary {
  background: var(--ink);
  color: #07090d;
  border-color: var(--ink);
  font-weight: 600;
  padding: 15px 16px;
}
.btn.primary:hover {
  background: #fff;
}
.btn.ghost {
  flex: 1;
  font-size: 11px;
  padding: 11px 10px;
}
.row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: wrap;
}
.select {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}
.select select {
  appearance: none;
  background: rgba(0, 0, 0, 0.35) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238a94a3'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--ink);
  border: 1px solid var(--line-2);
  padding: 7px 26px 7px 10px;
  font-size: 13px;
  border-radius: 2px;
}
/* contract address card (menu) */
.ca {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line-2);
  border-radius: 2px;
}
.ca-label {
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.ca-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ca-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 13px/1.4 ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  color: var(--ink-2);
  user-select: all;
  -webkit-user-select: all;
}
.ca-copy {
  appearance: none;
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  min-width: 30px;
  padding: 0 7px;
  justify-content: center;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-2);
  border-radius: 2px;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.ca-copy:hover {
  color: var(--ink);
  border-color: rgba(255, 255, 255, 0.45);
}
.ca-copy:focus-visible {
  outline: 2px solid var(--cyan-2);
  outline-offset: 2px;
}
.ca-copy.copied {
  color: var(--cyan);
  border-color: rgba(159, 220, 255, 0.5);
}
.ca-copied {
  font-size: 11px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.ca-copied:empty {
  display: none;
}
.controls-hint {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 5px;
  margin: 0 1px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  font: 600 10.5px/18px var(--font);
  text-align: center;
  color: var(--ink-2);
}
.fine {
  margin: 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: #616a77;
}
.only-touch {
  display: none;
}
@media (hover: none) and (pointer: coarse) {
  .only-touch {
    display: block;
  }
  .only-desktop {
    display: none;
  }
}

/* ----------------------------------------------------------------- HUD */
#hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
  --accent: var(--cyan);
}
#hud[hidden] {
  display: none;
}
#hud.fs {
  --accent: #d6f4ff;
}
.hud-tl,
.hud-tr,
.hud-bl,
.hud-br {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hud-tl {
  top: calc(18px + var(--safe-t));
  left: calc(22px + var(--safe-l));
}
.hud-tr {
  top: calc(18px + var(--safe-t));
  right: calc(70px + var(--safe-r));
  align-items: flex-end;
}
.hud-bl {
  left: calc(22px + var(--safe-l));
  bottom: calc(20px + var(--safe-b));
  align-items: center;
  width: 74px;
}
.hud-br {
  right: calc(22px + var(--safe-r));
  bottom: calc(20px + var(--safe-b));
  align-items: flex-end;
}
.lbl {
  font-size: 10px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}
.num.big {
  font-size: 34px;
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.05;
}
.sub {
  display: flex;
  gap: 14px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.sub b {
  color: var(--ink-2);
  font-weight: 600;
}
.speed,
.alt {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.speed .num.big {
  font-size: 44px;
  font-weight: 200;
}
.alt .num.big {
  font-size: 30px;
  font-weight: 300;
}
.unit {
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
}
#h-zone {
  color: var(--accent);
  letter-spacing: 0.2em;
}

/* G-force meter */
.gmeter {
  width: 64px;
  height: 40px;
  overflow: visible;
}
.gtrack,
.garc {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}
.gtrack {
  stroke: rgba(255, 255, 255, 0.12);
}
.garc {
  stroke: var(--accent);
  stroke-dasharray: 82;
  stroke-dashoffset: 82;
  transition: stroke 0.3s ease;
}
.garc.hi {
  stroke: var(--amber);
}
.gread {
  margin-top: -18px;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.gread b {
  font-size: 17px;
  font-weight: 500;
}
.gread span {
  font-size: 10px;
  color: var(--muted);
}

/* combo + freestyle (top centre) */
.hud-tc {
  position: absolute;
  left: 50%;
  top: calc(16px + var(--safe-t));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.combo {
  display: flex;
  align-items: baseline;
  gap: 8px;
  opacity: 0.45;
  transition: opacity 0.25s ease;
  white-space: nowrap;
}
.combo b {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
}
.combo i {
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
}
.combo.live {
  opacity: 1;
}
.combo.live b {
  color: var(--accent);
}
.combo.pop b {
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.combo.lost b {
  color: var(--red);
}
.freestyle {
  position: relative;
  padding: 6px 16px 8px;
  border: 1px solid rgba(214, 244, 255, 0.7);
  background: linear-gradient(90deg, rgba(95, 195, 255, 0.25), rgba(255, 215, 120, 0.22));
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.34em;
  color: #fff;
  text-shadow: 0 0 12px rgba(159, 220, 255, 0.9);
  animation: fsglow 0.9s ease-in-out infinite alternate;
  white-space: nowrap;
}
.freestyle[hidden] {
  display: none;
}
.freestyle i {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 100%;
  background: #fff;
  transform-origin: 0 50%;
}

/* fuel gauge (bottom centre) */
.hud-bc {
  position: absolute;
  left: 50%;
  bottom: calc(20px + var(--safe-b));
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 260px));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.fuel-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.fuel-top .lbl {
  color: var(--ink-2);
}
.fuel-pct {
  margin-left: auto;
  font-size: 22px;
  font-weight: 300;
  min-width: 44px;
  text-align: right;
}
.pill {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.22em;
  padding: 3px 8px;
  border: 1px solid var(--line-2);
  color: var(--ink-2);
  background: rgba(8, 10, 14, 0.45);
}
.pill.ready {
  color: var(--cyan);
  border-color: rgba(159, 220, 255, 0.5);
}
.pill.air {
  color: #07090d;
  background: var(--cyan);
  border-color: var(--cyan);
}
.pill.warn {
  color: var(--amber);
  border-color: rgba(255, 185, 99, 0.5);
}
.fuel-bar {
  position: relative;
  height: 16px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line-2);
  overflow: hidden;
}
.fuel-bar i {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform: scaleX(0.72);
}
#h-fuel {
  background: linear-gradient(90deg, #1f6fb8, #4fb3ef 55%, #bfeaff);
}
.fuel-bar .ghost {
  background: rgba(255, 255, 255, 0.55);
  transition: transform 0.6s ease 0.15s;
}
.fuel-bar .segs {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(5% - 2px), rgba(7, 9, 13, 0.92) calc(5% - 2px) 5%);
}
.fuel-bar.full {
  animation: goldpulse 0.8s ease-in-out infinite alternate;
  border-color: rgba(255, 214, 120, 0.9);
}
.fuel-bar.full #h-fuel {
  background: linear-gradient(90deg, #4fb3ef, #ffe7a3 70%, #fff6d8);
}
.fuel-bar.critical {
  border-color: var(--red);
  animation: critpulse 0.6s ease-in-out infinite alternate;
}
.fuel-bar.critical #h-fuel {
  background: linear-gradient(90deg, #a3241f, #ff6a4d);
}
.fuel-bar.recoil {
  animation: recoil 0.35s ease;
}
.fuel-bar.gain #h-fuel {
  filter: brightness(1.6);
}
.hud-bc.fs .fuel-bar #h-fuel {
  background: linear-gradient(90deg, #8fe0ff, #fff 50%, #ffe7a3);
}

.next-chip {
  position: absolute;
  left: 50%;
  top: calc(96px + var(--safe-t));
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 5px 12px;
  border: 1px solid var(--line);
  background: rgba(8, 10, 14, 0.45);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
  opacity: 0;
  transition: opacity 0.25s ease;
  white-space: nowrap;
}
.next-chip.show {
  opacity: 1;
}
.next-chip b {
  color: var(--amber);
  font-weight: 600;
}

.flash {
  position: absolute;
  left: 50%;
  top: 30%;
  transform: translate(-50%, -50%);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.flash-title {
  text-transform: uppercase;
  font-size: clamp(26px, 7vw, 54px);
  font-weight: 200;
  letter-spacing: 0.42em;
  margin-right: -0.42em;
  color: var(--ink);
}
.flash-sub {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 0.24em;
  color: var(--cyan);
  text-transform: uppercase;
}
.flash.show {
  animation: flash 1.2s ease-out forwards;
}
.flash.perfect .flash-title {
  color: #ffe08a;
  font-weight: 300;
  text-shadow: 0 0 22px rgba(255, 200, 80, 0.75);
}
.flash.perfect .flash-sub {
  color: #ffd56a;
}
.flash.close .flash-title {
  color: #d9f3ff;
  text-shadow: 0 0 18px rgba(150, 215, 255, 0.7);
}
.flash.warn .flash-title {
  color: var(--amber);
}
.flash.crash .flash-title {
  color: var(--red);
  font-weight: 300;
}
.flash.miss .flash-title {
  color: var(--muted);
  font-size: clamp(18px, 4vw, 28px);
}
.flash.stunt .flash-title {
  color: #e8f7ff;
  font-size: clamp(20px, 5vw, 36px);
}

.milestone {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}
.ms-title {
  font-size: clamp(26px, 7.5vw, 64px);
  font-weight: 200;
  letter-spacing: 0.3em;
  margin-right: -0.3em;
  color: #fff;
  text-shadow: 0 0 30px rgba(159, 220, 255, 0.5);
}
.ms-sub {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.4em;
  color: var(--ink-2);
  text-transform: uppercase;
}
.milestone.mars .ms-title {
  color: #ffd2b0;
  text-shadow: 0 0 34px rgba(255, 120, 60, 0.6);
}
.milestone.show {
  animation: milestone 3.6s ease-out forwards;
}
.pops {
  position: absolute;
  left: 50%;
  bottom: calc(86px + var(--safe-b));
  width: 0;
  height: 0;
}
.fpop {
  position: absolute;
  left: 0;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.14em;
  white-space: nowrap;
  animation: popup 1.1s ease-out forwards;
}
.fpop.plus {
  color: #9fe0ff;
}
.fpop.gold {
  color: #ffd56a;
}
.fpop.minus {
  color: var(--red);
}
.warn {
  position: absolute;
  left: 50%;
  top: calc(132px + var(--safe-t));
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: var(--red);
  padding: 4px 10px;
  border: 1px solid rgba(255, 92, 85, 0.6);
  background: rgba(40, 6, 6, 0.4);
  animation: blink 0.7s steps(2, end) infinite;
  white-space: nowrap;
}
.warn[hidden] {
  display: none;
}
.screen-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
}
.screen-flash.gold {
  background: radial-gradient(ellipse at center, rgba(255, 210, 110, 0) 35%, rgba(255, 200, 90, 0.38) 100%);
  animation: sflash 0.7s ease-out forwards;
}
.screen-flash.blue {
  background: radial-gradient(ellipse at center, rgba(160, 220, 255, 0) 40%, rgba(170, 225, 255, 0.28) 100%);
  animation: sflash 0.55s ease-out forwards;
}
.screen-flash.red {
  background: radial-gradient(ellipse at center, rgba(255, 60, 50, 0) 30%, rgba(255, 40, 30, 0.42) 100%);
  animation: sflash 0.6s ease-out forwards;
}
.screen-flash.crit {
  background: radial-gradient(ellipse at center, rgba(255, 60, 50, 0) 55%, rgba(255, 40, 30, 0.16) 100%);
  opacity: 1;
  animation: critvig 1s ease-in-out infinite alternate;
}
.fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.fade.on {
  opacity: 0.85;
}

/* ----------------------------------------------------------------- toolbar */
#toolbar {
  position: absolute;
  top: calc(14px + var(--safe-t));
  right: calc(14px + var(--safe-r));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  z-index: 5;
}
.icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(8, 10, 14, 0.5);
  color: var(--ink-2);
  cursor: pointer;
  border-radius: 2px;
  fill: currentColor;
  touch-action: manipulation;
}
.icon[hidden] {
  display: none;
}
.icon:hover {
  color: var(--ink);
  border-color: var(--line-2);
}
.x-link {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: #fff;
  fill: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.x-link svg {
  width: 20px;
  height: 20px;
  fill: #fff;
}
.x-link[hidden] {
  display: none;
}
.x-link:hover,
.x-link:focus-visible {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}
.x-link:focus-visible {
  outline: 2px solid var(--cyan-2);
  outline-offset: 2px;
}
#mute-btn .off {
  display: none;
}
#mute-btn[aria-pressed='true'] .on {
  display: none;
}
#mute-btn[aria-pressed='true'] .off {
  display: block;
}

/* ----------------------------------------------------------------- touch */
#touch {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  touch-action: none;
}
#touch[hidden] {
  display: none;
}
.stick {
  position: absolute;
  left: 0;
  top: 0;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: radial-gradient(circle, rgba(159, 220, 255, 0.08), rgba(8, 10, 14, 0.25) 70%);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.stick.on {
  opacity: 1;
}
.stick i {
  position: absolute;
  left: 46px;
  top: 46px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(214, 244, 255, 0.35);
  border: 1px solid rgba(214, 244, 255, 0.7);
}
.stick-hint {
  position: absolute;
  left: calc(24px + var(--safe-l));
  bottom: calc(40px + var(--safe-b));
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.32);
  pointer-events: none;
}
#thrust-btn {
  position: absolute;
  right: calc(18px + var(--safe-r));
  bottom: calc(28px + var(--safe-b));
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid rgba(159, 220, 255, 0.55);
  background: radial-gradient(circle at 50% 40%, rgba(159, 220, 255, 0.22), rgba(8, 10, 14, 0.55) 70%);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2em;
  touch-action: none;
}
#thrust-btn.active {
  background: radial-gradient(circle at 50% 40%, rgba(200, 236, 255, 0.55), rgba(40, 90, 120, 0.5) 70%);
  border-color: var(--cyan);
}
body.touch .hud-bc {
  bottom: calc(136px + var(--safe-b));
  width: min(340px, calc(100vw - 40px));
}
body.touch .hud-bl {
  bottom: auto;
  top: calc(88px + var(--safe-t));
  left: calc(14px + var(--safe-l));
  transform: scale(0.85);
  transform-origin: 0 0;
}
body.touch .hud-br {
  bottom: auto;
  top: calc(82px + var(--safe-t));
  /* left of the pause / mute column so the altitude readout never sits under the buttons */
  right: calc(66px + var(--safe-r));
}

#replay-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#replay-ui[hidden] {
  display: none;
}
.replay-tag {
  position: absolute;
  left: calc(22px + var(--safe-l));
  top: calc(8vh + 14px + var(--safe-t));
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink);
  z-index: 2;
}
.replay-tag i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  animation: blink 1s steps(2, end) infinite;
}
#replay-skip {
  position: absolute;
  right: calc(70px + var(--safe-r));
  top: calc(8vh + 8px + var(--safe-t));
  pointer-events: auto;
  flex: none;
  z-index: 2;
}
#replay-ui::before,
#replay-ui::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 8vh;
  background: #000;
}
#replay-ui::before {
  top: 0;
}
#replay-ui::after {
  bottom: 0;
}

#dev {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 380px;
  pointer-events: auto;
  font: 11px/1.3 ui-monospace, Consolas, monospace;
  z-index: 20;
}
#dev[hidden] {
  display: none;
}
#dev button {
  background: rgba(0, 0, 0, 0.6);
  color: #9fe;
  border: 1px solid rgba(159, 238, 255, 0.4);
  padding: 4px 6px;
  cursor: pointer;
  font: inherit;
}
#dev button.on {
  background: rgba(40, 120, 140, 0.7);
}

/* ----------------------------------------------------------------- game over / board */
#gameover {
  background: radial-gradient(80% 80% at 50% 50%, rgba(5, 7, 10, 0.25), rgba(5, 7, 10, 0.75));
}
#pause {
  background: rgba(5, 7, 10, 0.55);
}
.pb {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #07090d;
  background: var(--cyan);
  padding: 5px 10px;
}
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}
.stats > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stats span {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.stats b {
  font-size: 20px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.share-box textarea {
  width: 100%;
  resize: none;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink-2);
  border: 1px solid var(--line);
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.5;
  user-select: text;
  -webkit-user-select: text;
}
#board {
  background: rgba(5, 7, 10, 0.6);
  z-index: 10;
}
.board {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  counter-reset: rank;
}
.board li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.board li .r {
  color: var(--muted);
  font-size: 12px;
}
.board li .n {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.board li .s {
  font-weight: 600;
}
.board li .ms {
  grid-column: 2 / 4;
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: -4px;
}
.board li .m {
  grid-column: 2 / 4;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  margin-top: -4px;
}
.board li.me .n,
.board li.me .s {
  color: var(--cyan);
}
.board .empty {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

#debug {
  position: absolute;
  left: 8px;
  bottom: 8px;
  font: 11px/1.45 ui-monospace, Consolas, monospace;
  color: #9fe;
  background: rgba(0, 0, 0, 0.55);
  padding: 6px 8px;
  white-space: pre;
  pointer-events: none;
}
.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--ink);
}

@keyframes pop {
  0% {
    transform: scale(0.7);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes flash {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.96);
  }
  12% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -54%) scale(1.02);
  }
}
@keyframes milestone {
  0% {
    opacity: 0;
    letter-spacing: 0.1em;
  }
  14% {
    opacity: 1;
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes popup {
  0% {
    opacity: 0;
    transform: translate(-50%, 8px);
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -46px);
  }
}
@keyframes goldpulse {
  from {
    box-shadow: 0 0 0 0 rgba(255, 210, 110, 0.2);
  }
  to {
    box-shadow: 0 0 18px 2px rgba(255, 210, 110, 0.65);
  }
}
@keyframes critpulse {
  from {
    box-shadow: 0 0 0 0 rgba(255, 70, 60, 0.1);
    opacity: 1;
  }
  to {
    box-shadow: 0 0 14px 2px rgba(255, 70, 60, 0.6);
    opacity: 0.75;
  }
}
@keyframes recoil {
  0% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  55% {
    transform: translateX(4px);
  }
  100% {
    transform: translateX(0);
  }
}
@keyframes sflash {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
@keyframes critvig {
  from {
    opacity: 0.35;
  }
  to {
    opacity: 1;
  }
}
@keyframes fsglow {
  from {
    box-shadow: 0 0 6px rgba(159, 220, 255, 0.3);
  }
  to {
    box-shadow: 0 0 22px rgba(255, 220, 140, 0.55);
  }
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

/* ----------------------------------------------------------------- responsive */
@media (max-width: 760px) {
  .hud-bc {
    width: min(360px, calc(100vw - 200px));
  }
}
@media (max-width: 640px) {
  #menu {
    align-items: flex-end;
    justify-content: center;
    background: linear-gradient(0deg, rgba(5, 7, 10, 0.88) 0%, rgba(5, 7, 10, 0.4) 55%, rgba(5, 7, 10, 0) 80%);
  }
  #menu .menu-card {
    margin: 0;
    padding: 20px 18px 18px;
    gap: 11px;
  }
  .num.big {
    font-size: 24px;
  }
  .speed .num.big {
    font-size: 30px;
  }
  .alt .num.big {
    font-size: 22px;
  }
  .hud-tl {
    left: calc(14px + var(--safe-l));
    top: calc(12px + var(--safe-t));
  }
  .hud-tr {
    right: calc(62px + var(--safe-r));
    top: calc(12px + var(--safe-t));
  }
  .hud-tc {
    top: calc(52px + var(--safe-t));
  }
  .combo b {
    font-size: 20px;
  }
  .freestyle {
    font-size: 11px;
    letter-spacing: 0.24em;
    padding: 5px 10px 7px;
  }
  .sub {
    gap: 8px;
    font-size: 10px;
  }
  .hud-bc {
    width: calc(100vw - 40px);
    bottom: calc(76px + var(--safe-b));
  }
  .hud-bl {
    bottom: calc(10px + var(--safe-b));
    left: calc(10px + var(--safe-l));
  }
  .hud-br {
    bottom: calc(14px + var(--safe-b));
    right: calc(16px + var(--safe-r));
  }
  .next-chip {
    top: calc(122px + var(--safe-t));
    font-size: 10px;
  }
  .warn {
    top: calc(156px + var(--safe-t));
  }
  .stats b {
    font-size: 17px;
  }
  .pops {
    bottom: calc(150px + var(--safe-b));
  }
  /* reward / milestone text wraps inside the viewport instead of running off both edges */
  .flash,
  .milestone {
    width: calc(100vw - 24px);
    white-space: normal;
  }
  .flash-sub {
    font-size: 11px;
    letter-spacing: 0.16em;
    line-height: 1.5;
  }
  .ms-sub {
    letter-spacing: 0.24em;
    line-height: 1.5;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  #menu .menu-card {
    margin: 0 0 0 3vw;
    max-height: calc(100vh - 24px);
  }
  .tagline {
    display: none;
  }
  #thrust-btn {
    bottom: calc(18px + var(--safe-b));
    width: 84px;
    height: 84px;
  }
  body.touch .hud-bc {
    bottom: calc(16px + var(--safe-b));
    width: min(300px, calc(100vw - 340px));
  }
  body.touch .hud-bl {
    top: calc(64px + var(--safe-t));
  }
  body.touch .hud-br {
    top: calc(60px + var(--safe-t));
  }
  .hud-tc {
    top: calc(10px + var(--safe-t));
  }
  .next-chip {
    top: calc(64px + var(--safe-t));
  }
  .milestone {
    top: 38%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen,
  .screen.show,
  .load-bar i,
  .next-chip {
    transition: none;
  }
  .combo.pop b,
  .fuel-bar.full,
  .fuel-bar.critical,
  .freestyle,
  .fuel-bar.recoil {
    animation: none;
  }
  .flash.show {
    animation: flash-static 1.1s steps(1, end) forwards;
  }
  @keyframes flash-static {
    0% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
  }
}

/* ----------------------------------------------------------------- SOL tokens (HUD) */
.tokens {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.tokens b {
  font-size: 17px;
  font-weight: 600;
  color: #e9ddff;
  min-width: 2ch;
}
.tokens em {
  font-style: normal;
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.sol-ico {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9c3cff 0%, #5a7bff 50%, #19f0a0 100%);
  box-shadow: 0 0 10px rgba(156, 60, 255, 0.6), inset 0 0 0 1.5px rgba(255, 220, 140, 0.8);
}
.tok-next {
  position: relative;
  width: 44px;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.tok-next i {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #9c3cff, #19f0a0);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.wpops {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.wpop {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #e7d4ff;
  text-shadow: 0 0 10px rgba(156, 60, 255, 0.9), 0 0 2px #19f0a0;
  animation: wpop 0.9s ease-out forwards;
  white-space: nowrap;
}
.wpop.mars {
  color: #ffd3a0;
  text-shadow: 0 0 10px rgba(255, 110, 40, 0.9);
}
.wpop.orbit {
  color: #eef4ff;
  text-shadow: 0 0 10px rgba(170, 200, 255, 0.9);
}
@keyframes wpop {
  0% {
    opacity: 0;
    margin-top: 0;
  }
  15% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    margin-top: -54px;
  }
}

/* ----------------------------------------------------------------- cinematic titles */
.cine {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  text-align: center;
  padding: 0 16px;
  z-index: 3;
}
.cine-title {
  font-size: clamp(26px, 7vw, 64px);
  font-weight: 100;
  letter-spacing: 0.55em;
  margin-right: -0.55em;
  color: #fff;
  text-transform: uppercase;
}
.cine-sub {
  margin-top: 12px;
  font-size: 11px;
  letter-spacing: 0.5em;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
}
.cine.show {
  animation: cine var(--dur, 2s) ease-in-out forwards;
}
.cine.earth .cine-title {
  text-shadow: 0 0 24px rgba(200, 225, 255, 0.35);
}
.cine.mars .cine-title {
  font-weight: 700;
  letter-spacing: 0.32em;
  margin-right: -0.32em;
  color: #ff5a2a;
  text-shadow: 0 0 28px rgba(255, 70, 20, 0.85), 0 0 2px #ffb08a;
}
.cine.mars .cine-sub {
  color: #ffb08a;
}
.cine.full {
  background: radial-gradient(ellipse at center, rgba(120, 30, 8, 0.35) 0%, rgba(40, 8, 2, 0.88) 75%);
}
.cine.full .cine-title {
  font-size: clamp(34px, 10vw, 104px);
  font-weight: 800;
  letter-spacing: 0.18em;
  margin-right: -0.18em;
  color: #ffd2b0;
  text-shadow: 0 0 40px rgba(255, 90, 30, 0.9);
}
@keyframes cine {
  0% {
    opacity: 0;
    transform: scale(1.04);
  }
  18% {
    opacity: 1;
    transform: scale(1);
  }
  78% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* ----------------------------------------------------------------- launch + game over rank */
.btn.launch {
  font-size: 15px;
  letter-spacing: 0.42em;
  padding: 17px 16px;
}
.rank-hero {
  padding: 12px 14px;
  border: 1px solid rgba(255, 214, 120, 0.55);
  background: linear-gradient(90deg, rgba(255, 200, 90, 0.16), rgba(156, 60, 255, 0.12));
}
.rh-big {
  font-size: clamp(22px, 6vw, 30px);
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #fff;
}
.rh-big b {
  color: #ffd56a;
}
.rh-sub {
  margin-top: 2px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.handle-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.handle-form[hidden] {
  display: none;
}
.handle-form .field {
  flex: 1 1 180px;
}
.handle-form .btn {
  flex: 0 0 auto;
}
.handle-form .field-error {
  flex-basis: 100%;
  margin-top: 0;
}
.ranks-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: -6px;
}
.live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #6dffb0;
}
.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #33ff99;
  box-shadow: 0 0 8px #33ff99;
  animation: livepulse 1.4s ease-in-out infinite;
}
.live.offline,
.live.local {
  color: var(--amber);
}
.live.offline i,
.live.local i {
  background: var(--amber);
  box-shadow: none;
  animation: none;
}
.live.loading i {
  animation-duration: 0.5s;
}
@keyframes livepulse {
  50% {
    opacity: 0.25;
  }
}
.ranks {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.rk {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto 72px 56px;
  gap: 8px;
  align-items: baseline;
  padding: 7px 4px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.rk span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rk .c-r {
  color: var(--muted);
  font-size: 12px;
}
.rk .c-s {
  font-weight: 600;
  text-align: right;
}
.rk .c-t {
  color: var(--cyan);
  font-size: 11.5px;
  letter-spacing: 0.06em;
}
.rk .c-d {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.rk.head {
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 6px;
}
.rk.head span {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 400;
}
.rk.me-top {
  background: linear-gradient(90deg, rgba(255, 200, 90, 0.28), rgba(255, 200, 90, 0.06));
  box-shadow: inset 3px 0 0 #ffd56a;
}
.rk.me-top span,
.rk.me-top .c-r {
  color: #ffe6a3;
}
.rk.me-out {
  background: linear-gradient(90deg, rgba(95, 195, 255, 0.3), rgba(156, 60, 255, 0.12));
  box-shadow: inset 3px 0 0 #5fc3ff;
}
.rk.me-out span,
.rk.me-out .c-r {
  color: #dff3ff;
}
.rk-sep {
  text-align: center;
  color: var(--muted);
  letter-spacing: 0.4em;
  padding: 4px 0 0;
}
.rk-label {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--amber);
}
.rk-total {
  margin-top: 4px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-2);
}
.rk-empty {
  padding: 12px 4px;
  font-size: 13px;
  color: var(--muted);
}
.board-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
}
.board-tabs .live {
  margin-left: auto;
}
.tab {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 2px;
}
.tab.on {
  color: var(--ink);
  border-color: var(--line-2);
  background: rgba(255, 255, 255, 0.06);
}
@media (max-width: 420px) {
  .rk {
    grid-template-columns: 40px minmax(0, 1fr) auto 54px;
    font-size: 12.5px;
  }
  .rk .c-d {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cine.show {
    animation: flash-static var(--dur, 2s) steps(1, end) forwards;
  }
  .live i {
    animation: none;
  }
}

/* ----------------------------------------------------------------- fuel rewards: louder feedback */
.fpop.plus,
.fpop.gold {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.12em;
  animation-duration: 1.6s;
}
.fpop.plus {
  text-shadow: 0 0 14px rgba(120, 210, 255, 0.95), 0 0 2px #fff;
}
.fpop.gold {
  text-shadow: 0 0 16px rgba(255, 200, 80, 0.95), 0 0 2px #fff;
}
.fuel-bar.gain {
  border-color: #bfeaff;
  box-shadow: 0 0 18px 3px rgba(120, 210, 255, 0.75);
  transition: box-shadow 0.15s ease;
}
.fuel-bar.gain #h-fuel {
  filter: brightness(2);
}

/* ----------------------------------------------------------------- orbit: rocket hatch guide */
.rk-guide {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.rk-guide[hidden] {
  display: none;
}
.rk-target {
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 30px;
  will-change: transform;
  animation: rkpulse 1.1s ease-in-out infinite;
}
.rk-target i {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #bfe7ff;
  filter: drop-shadow(0 0 6px rgba(120, 200, 255, 0.9));
}
.rk-target i:nth-child(1) {
  left: 0;
  top: 0;
  border-right: 0;
  border-bottom: 0;
}
.rk-target i:nth-child(2) {
  right: 0;
  top: 0;
  border-left: 0;
  border-bottom: 0;
}
.rk-target i:nth-child(3) {
  left: 0;
  bottom: 0;
  border-right: 0;
  border-top: 0;
}
.rk-target i:nth-child(4) {
  right: 0;
  bottom: 0;
  border-left: 0;
  border-top: 0;
}
.rk-label {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  font-size: clamp(13px, 2.4vw, 19px);
  font-weight: 700;
  letter-spacing: 0.32em;
  color: #e9f6ff;
  text-shadow: 0 0 14px rgba(110, 195, 255, 0.95), 0 1px 2px rgba(0, 0, 0, 0.6);
  will-change: transform;
}
.rk-arrow {
  display: inline-block;
  font-size: 1.6em;
  line-height: 1;
  color: #9fdcff;
  animation: rknudge 0.8s ease-in-out infinite;
}
@keyframes rkpulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.55;
  }
}
@keyframes rknudge {
  0%,
  100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(8px);
  }
}
.cine-black {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}

/* ----------------------------------------------------------------- Mars ending */
#ending {
  align-items: flex-end;
  justify-content: center;
  z-index: 5;
  background: linear-gradient(180deg, rgba(10, 3, 1, 0) 0%, rgba(10, 3, 1, 0) 38%, rgba(22, 7, 2, 0.5) 72%, rgba(12, 4, 1, 0.82) 100%);
  transition: opacity 1.6s ease, visibility 0s linear 1.6s;
}
#ending.show {
  transition: opacity 1.6s ease;
}
.end-sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.end-earth {
  position: absolute;
  left: 57%;
  top: 11%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #a9d6ff;
  box-shadow: 0 0 5px 2px rgba(130, 190, 255, 0.85), 0 0 22px 7px rgba(80, 140, 255, 0.28);
  opacity: 0;
  transition: opacity 2.5s ease 1.2s;
}
.end-earth-tag {
  position: absolute;
  left: calc(57% + 12px);
  top: calc(11% - 6px);
  font-size: 9.5px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(200, 225, 255, 0.55);
  opacity: 0;
  transition: opacity 2s ease 4s;
}
#ending.show .end-earth,
#ending.show .end-earth-tag {
  opacity: 1;
}
.end-wrap {
  position: relative;
  width: min(620px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  text-align: center;
  margin-bottom: 5vh;
}
.end-line {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}
.end-line.in {
  opacity: 1;
  transform: none;
}
.end-title {
  margin: 0 -0.14em 8px 0;
  font-size: clamp(27px, 6.6vw, 66px);
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1.1;
  color: #ffe4cc;
  text-shadow: 0 0 34px rgba(255, 110, 40, 0.8), 0 0 4px rgba(255, 190, 150, 0.9);
}
.end-title.in {
  animation: endhit 2.6s ease-out 1;
}
@keyframes endhit {
  0% {
    transform: scale(1.12);
    filter: brightness(2.2);
    letter-spacing: 0.3em;
  }
  35% {
    filter: brightness(1.25);
  }
  100% {
    transform: none;
    filter: none;
    letter-spacing: 0.14em;
  }
}
.end-handle {
  font-size: clamp(16px, 3.2vw, 22px);
  font-weight: 600;
  letter-spacing: 0.34em;
  margin-right: -0.34em;
  color: #fff;
  text-transform: uppercase;
  min-height: 1.2em;
}
.end-form {
  display: flex;
  gap: 8px;
  width: min(360px, 100%);
}
.end-form[hidden] {
  display: none;
}
.end-form input {
  flex: 1;
  min-width: 0;
  appearance: none;
  border: 1px solid rgba(255, 210, 180, 0.4);
  background: rgba(0, 0, 0, 0.45);
  color: var(--ink);
  padding: 11px 13px;
  font-size: 16px;
  border-radius: 2px;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}
.end-form input:focus {
  border-color: #ffb08a;
}
.end-form .btn.primary {
  padding: 11px 16px;
}
.end-stat {
  font-size: clamp(11.5px, 2.2vw, 14px);
  letter-spacing: 0.3em;
  color: rgba(255, 224, 204, 0.72);
  font-variant-numeric: tabular-nums;
}
.end-stat b {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.12em;
}
.end-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
  width: 100%;
}
.end-actions .btn {
  flex: 0 1 200px;
  min-width: 150px;
}
.end-actions .btn.ghost {
  font-size: 12.5px;
  padding: 15px 16px;
  border-color: rgba(255, 220, 200, 0.5);
  background: rgba(0, 0, 0, 0.3);
}
.end-status {
  min-height: 1.3em;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: #ffd8bf;
}
@media (prefers-reduced-motion: reduce) {
  .end-line,
  .end-title.in {
    transition: opacity 0.3s ease;
    transform: none;
    animation: none;
  }
}
