:root {
  --arsenic: #d6e000;
  --arsenic-bright: #eaff00;
  --arsenic-deep: #9aa300;
  --bg: #08090c;
  --bg-2: #0d0f0a;
  --text: #eef0e6;
  --muted: #8a8f7a;
  --panel: rgba(18, 20, 12, 0.55);
  --glow: 0 0 18px rgba(214, 224, 0, 0.55), 0 0 48px rgba(214, 224, 0, 0.25);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Rajdhani", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 90% at 50% 120%, rgba(214, 224, 0, 0.12), transparent 60%),
    radial-gradient(80% 60% at 50% -10%, rgba(214, 224, 0, 0.06), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg));
  overflow: hidden;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* 3D canvas sits behind everything */
#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
}

/* ---------- HUD brackets + scanlines ---------- */
.hud {
  position: fixed;
  width: 46px;
  height: 46px;
  border: 2px solid rgba(214, 224, 0, 0.55);
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(214, 224, 0, 0.4));
}
.hud--tl { top: 22px; left: 22px; border-right: 0; border-bottom: 0; }
.hud--tr { top: 22px; right: 22px; border-left: 0; border-bottom: 0; }
.hud--bl { bottom: 22px; left: 22px; border-right: 0; border-top: 0; }
.hud--br { bottom: 22px; right: 22px; border-left: 0; border-top: 0; }

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.18) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
}

/* ---------- Stage / layout ---------- */
.stage {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0; /* allow it to shrink within the flex column */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 40px 28px 12px;
  text-align: center;
}
/* scaled by JS so the whole deck always fits the viewport (no scroll) */
.fit {
  transform-origin: center center;
  will-change: transform;
}
.deck {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(32px, 4vw, 56px);
  padding: 12px;
}
.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 1.6vh, 18px);
  max-width: none; /* size to content so the countdown can't overflow into the photo */
  position: relative;
  z-index: 2;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Share Tech Mono", monospace;
  font-size: clamp(0.7rem, 1.4vw, 0.92rem);
  letter-spacing: 0.34em;
  color: var(--arsenic);
  text-transform: uppercase;
  padding: 8px 16px;
  border: 1px solid rgba(214, 224, 0, 0.32);
  border-radius: 999px;
  background: rgba(214, 224, 0, 0.04);
  backdrop-filter: blur(4px);
  animation: fadeUp 0.9s 0.05s both;
}
.eyebrow .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--arsenic-bright);
  box-shadow: var(--glow);
  animation: pulse 1.6s ease-in-out infinite;
}

.title {
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: clamp(1.8rem, 4.8vh, 3.4rem);
  line-height: 0.95;
  letter-spacing: 0.04em;
  color: var(--text);
  text-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  animation: fadeUp 0.9s 0.12s both;
}
.title__accent {
  color: var(--arsenic);
  text-shadow: var(--glow);
}

.subtitle {
  font-family: "Share Tech Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.42em;
  font-size: clamp(0.7rem, 1.5vw, 0.95rem);
  color: var(--muted);
  margin-top: -6px;
  animation: fadeUp 0.9s 0.18s both;
}

/* ---------- RS457 photo (floating 3D tilt) ---------- */
.photo {
  margin: 0;
  width: clamp(210px, 24vw, 340px);
  transform-style: preserve-3d;
  will-change: transform;
  animation: fadeUp 0.9s 0.22s both;
  position: relative;
  z-index: 1;
}
.photo__frame {
  position: relative;
  isolation: isolate;
  aspect-ratio: 3 / 4; /* portrait — matches the real photo */
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid rgba(214, 224, 0, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 26px 70px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(214, 224, 0, 0.22);
}
.photo__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  /* keep the bike's real colours, just a touch of pop */
  filter: contrast(1.06) saturate(1.14);
}
/* subtle bottom fade so the badge stays legible (no recolour) */
.photo__duo {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 58%, rgba(8, 9, 6, 0.6));
}
/* gentle vignette so it sits in the scene without hiding the bike */
.photo__vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(125% 105% at 50% 45%, transparent 62%, rgba(8, 9, 6, 0.62) 100%);
}
.photo__scan {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0 2px,
    rgba(0, 0, 0, 0.22) 3px
  );
  mix-blend-mode: multiply;
  opacity: 0.5;
}
.photo__glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    240px 240px at var(--mx, 30%) var(--my, 30%),
    rgba(234, 255, 0, 0.22),
    transparent 60%
  );
  mix-blend-mode: screen;
}
.photo__badge {
  position: absolute;
  left: 14px;
  bottom: 12px;
  z-index: 2;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: clamp(1rem, 3vw, 1.6rem);
  letter-spacing: 0.08em;
  color: var(--arsenic-bright);
  text-shadow: 0 0 14px rgba(214, 224, 0, 0.7);
}
.photo__tick {
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 2;
  border: 2px solid var(--arsenic);
  opacity: 0.8;
}
.photo__tick--tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.photo__tick--tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.photo__tick--bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.photo__tick--br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.photo__cap {
  margin-top: 10px;
  text-align: center;
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.28em;
  font-size: clamp(0.6rem, 1.2vw, 0.78rem);
  color: var(--muted);
}

/* ---------- Countdown reels ---------- */
.countdown {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(8px, 1.6vw, 20px);
  animation: fadeUp 0.9s 0.24s both;
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.reels {
  display: flex;
  gap: 4px;
  padding: clamp(10px, 1.6vw, 18px) clamp(8px, 1.4vw, 16px);
  background: var(--panel);
  border: 1px solid rgba(214, 224, 0, 0.22);
  border-radius: 14px;
  backdrop-filter: blur(8px);
  box-shadow:
    inset 0 0 30px rgba(214, 224, 0, 0.06),
    0 18px 50px rgba(0, 0, 0, 0.55);
}

.digit {
  height: 1em;
  overflow: hidden;
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
  font-size: clamp(1.8rem, 6vh, 3.6rem);
  line-height: 1;
  color: var(--arsenic);
  text-shadow: 0 0 16px rgba(214, 224, 0, 0.55);
  font-variant-numeric: tabular-nums;
}
.reel {
  display: flex;
  flex-direction: column;
  transform: translateY(calc(var(--digit, 0) * -1em));
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.reel span {
  height: 1em;
  display: flex;
  align-items: center;
  justify-content: center;
}

.label {
  font-family: "Share Tech Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: clamp(0.6rem, 1.2vw, 0.8rem);
  color: var(--muted);
}

.sep {
  align-self: center;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: clamp(1.6rem, 5vw, 3.4rem);
  color: rgba(214, 224, 0, 0.45);
  padding-top: 0.1em;
  animation: blink 1s steps(2, start) infinite;
}

.target {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: "Share Tech Mono", monospace;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: clamp(0.72rem, 1.5vw, 0.95rem);
  color: var(--arsenic);
  animation: fadeUp 0.9s 0.3s both;
}
.target__bar {
  width: clamp(24px, 8vw, 70px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--arsenic));
}
.target__bar:last-child { transform: scaleX(-1); }

/* ---------- Driver's licence card ---------- */
.license-wrap {
  perspective: 1100px;
  margin-top: clamp(6px, 1.5vh, 18px);
  animation: fadeUp 1s 0.38s both;
}
.license {
  width: min(86vw, 372px);
  padding: 14px 18px 12px;
  border-radius: 16px;
  text-align: left;
  position: relative;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 0.18s ease-out;
  background:
    linear-gradient(135deg, rgba(214, 224, 0, 0.14), rgba(214, 224, 0, 0.02)),
    linear-gradient(180deg, rgba(22, 24, 16, 0.92), rgba(12, 13, 9, 0.92));
  border: 1px solid rgba(214, 224, 0, 0.35);
  box-shadow:
    0 30px 70px rgba(0, 0, 0, 0.6),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
.license__sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    220px 220px at var(--mx, 30%) var(--my, 20%),
    rgba(234, 255, 0, 0.18),
    transparent 60%
  );
  mix-blend-mode: screen;
}
.license__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Orbitron", sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: var(--arsenic);
  border-bottom: 1px dashed rgba(214, 224, 0, 0.28);
  padding-bottom: 10px;
}
.license__class {
  background: var(--arsenic);
  color: #0c0d08;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 0.7rem;
}
.license__body {
  display: flex;
  gap: 16px;
  padding: 14px 0;
}
.license__photo {
  width: 74px;
  flex: 0 0 74px;
  border-radius: 8px;
  background: rgba(214, 224, 0, 0.07);
  border: 1px solid rgba(214, 224, 0, 0.28);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 0;
}
.license__photo svg {
  width: 42px;
  height: 48px;
  fill: none;
  stroke: var(--arsenic);
  stroke-width: 3;
  opacity: 0.85;
}
.license__photo-tag {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  color: var(--muted);
}
.license__fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  align-content: center;
}
.license__fields dt {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.55rem;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.license__fields dd {
  font-family: "Rajdhani", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  line-height: 1.1;
}
.license__fields dd.hl { color: var(--arsenic); text-shadow: 0 0 12px rgba(214, 224, 0, 0.4); }

.license__strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px dashed rgba(214, 224, 0, 0.28);
  padding-top: 10px;
}
.license__barcode {
  flex: 1;
  height: 26px;
  background-image: repeating-linear-gradient(
    90deg,
    var(--arsenic) 0 2px,
    transparent 2px 4px,
    var(--arsenic) 4px 5px,
    transparent 5px 9px,
    var(--arsenic) 9px 12px,
    transparent 12px 14px
  );
  opacity: 0.8;
  border-radius: 2px;
}
.license__id {
  font-family: "Share Tech Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--muted);
}

/* ---------- Footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0 16px 12px;
  text-align: center;
  font-family: "Share Tech Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: rgba(138, 143, 122, 0.7);
  pointer-events: none;
}
.footer .credit {
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: rgba(138, 143, 122, 0.45);
}

/* ---------- Finished state ---------- */
body.finished .subtitle { color: var(--arsenic-bright); }
body.finished .title__accent { animation: shake 0.5s ease-in-out infinite alternate; }

.confetti {
  position: fixed;
  top: -16px;
  width: 10px;
  height: 16px;
  z-index: 5;
  pointer-events: none;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.6); opacity: 0.5; }
}
@keyframes blink {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.15; }
}
@keyframes shake {
  from { transform: translateX(-3px) rotate(-1deg); }
  to { transform: translateX(3px) rotate(1deg); }
}
@keyframes confettiFall {
  to { transform: translateY(105vh) rotate(720deg); opacity: 0.9; }
}

@media (prefers-reduced-motion: reduce) {
  .reel { transition: none; }
  .sep, .eyebrow .dot { animation: none; }
}

/* Stack photo above the panel on narrow / portrait screens */
@media (max-width: 880px) {
  .deck { flex-direction: column; gap: 18px; }
  .photo { width: clamp(160px, 46vw, 240px); }
}

@media (max-width: 560px) {
  .label { letter-spacing: 0.18em; }
  .sep { display: none; }
  .countdown { gap: 6px; }
  .reels { padding: 8px 6px; border-radius: 10px; }
  .footer { font-size: 0.58rem; }
}
