:root {
  --red: #c4384a;
  --red-deep: #9d2636;
  --paper: #241c16;
  --paper-hi: #3a2e24;
  --cream: #f4efe4;
  --manila: #f3e6c4;
  --ink: #1a140f;
  --safe-top: max(8px, env(safe-area-inset-top));
  --safe-bottom: max(10px, env(safe-area-inset-bottom));
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #120e0c;
  font-family: "Special Elite", Georgia, serif;
  color: var(--cream);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  color: inherit;
}

#app {
  position: relative;
  width: min(430px, 100vw);
  height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background:
    radial-gradient(rgba(255, 255, 255, 0.04) 0.6px, transparent 0.7px),
    linear-gradient(180deg, var(--paper-hi), var(--paper) 34%);
  background-size: 4px 4px, auto;
}

.scene { position: absolute; inset: 0; }
.scene[hidden] { display: none !important; }

/* ---------- gate ---------- */

#scene-gate {
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 20px);
}
#app[data-scene="gate"] .mute,
#app[data-scene="tease"] .mute { display: none; }

.gate-prompt {
  margin: 4px 0 16px;
  min-height: 28px;
  text-align: center;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: #b7a891;
}
.gate-prompt.is-roast {
  margin: 0 0 16px;
  padding: 6px 14px 3px;
  background: var(--cream);
  color: var(--ink);
  font-family: "Permanent Marker", cursive;
  font-size: 22px;
  letter-spacing: 0;
  transform: rotate(-2deg);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35);
}

.gate-slots {
  display: flex;
  gap: 10px;
  margin: 0 0 22px;
}
.gate-slot {
  width: 52px;
  height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--cream);
  color: var(--ink);
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 36px;
  letter-spacing: 0.04em;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35);
  transform: rotate(-1.2deg);
}
.gate-slot:nth-child(2) { transform: rotate(1.6deg); }
.gate-slot:nth-child(3) { transform: rotate(-0.6deg); }
.gate-slot:nth-child(4) { transform: rotate(2deg); }
.gate-slot.is-filled { box-shadow: 2px 3px 0 var(--red); }
#scene-gate.is-wrong .gate-slots {
  animation: gate-shake 0.42s ease;
}
#scene-gate.is-open .gate-slot {
  box-shadow: 2px 3px 0 #57e08a;
}
@keyframes gate-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-7px); }
  80% { transform: translateX(7px); }
}

.gate-pad {
  display: grid;
  grid-template-columns: repeat(3, 72px);
  gap: 12px;
  justify-content: center;
}
.gate-key {
  width: 72px;
  height: 62px;
  border-radius: 16px;
  background: linear-gradient(180deg, #4a4f57, #23262c 62%, #171a1f);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.22),
    inset 0 -6px 10px rgba(0, 0, 0, 0.5),
    0 8px 14px rgba(0, 0, 0, 0.45);
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 28px;
  letter-spacing: 0.1em;
  color: #eef1f5;
}
.gate-key:active { transform: scale(0.96); }
.gate-key.is-clear {
  background: var(--cream);
  color: var(--ink);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35);
}
.gate-key.is-del {
  font-size: 20px;
  letter-spacing: 0.16em;
  color: #c9ced6;
}

/* ---------- cover ---------- */

#scene-ignition {
  z-index: 3;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: calc(var(--safe-top) + 28px) 20px calc(var(--safe-bottom) + 24px);
}

.speedo {
  position: relative;
  flex: 0 0 auto;
  width: min(248px, 72vw);
  height: min(248px, 72vw);
  margin: 8px 0 28px;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.55));
}
.speedo-face {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background:
    repeating-conic-gradient(from 18deg, rgba(255, 255, 255, 0.03) 0 1.5deg, transparent 1.5deg 3deg),
    radial-gradient(circle at 50% 34%, #3a3f48 0 18%, #15181e 58%, #07080a 78%);
  box-shadow:
    inset 0 0 0 6px #0b0c0e,
    inset 0 0 0 8px #c4384a,
    inset 0 0 0 11px #9aa0a8,
    inset 0 -18px 28px rgba(0, 0, 0, 0.55),
    inset 0 10px 14px rgba(255, 255, 255, 0.08);
}
.speedo-redline {
  fill: none;
  stroke: #ff2d3c;
  stroke-width: 7;
  stroke-linecap: round;
  opacity: 0.92;
}
.speedo-tick {
  fill: none;
  stroke: #f3efe6;
  stroke-width: 2;
  stroke-linecap: square;
}
.speedo-tick.is-major { stroke-width: 3; }
.speedo-tick.is-sixteen {
  stroke: #ff2d3c;
  stroke-width: 4;
}
.speedo-tick.is-redline { stroke: #ff2d3c; }
.speedo-num {
  fill: #f4efe4;
  font-family: Anton, Impact, sans-serif;
  font-size: 14px;
  letter-spacing: 0.04em;
  text-anchor: middle;
  dominant-baseline: middle;
}
.speedo-num.is-sixteen {
  fill: #ff2d3c;
  font-size: 20px;
}
.speedo-num.is-redline { fill: #ff2d3c; }
.speedo-unit {
  fill: #8b919a;
  font-family: Anton, Impact, sans-serif;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-anchor: middle;
}
.speedo-badge {
  fill: #c4384a;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 16px;
  letter-spacing: 0.18em;
  text-anchor: middle;
}
.speedo-needle {
  position: absolute;
  left: 50%;
  bottom: 50%;
  width: 3px;
  height: 38%;
  margin-left: -1.5px;
  clip-path: polygon(50% 0, 100% 88%, 50% 100%, 0 88%);
  background: linear-gradient(180deg, #ffe8ea, #ff2d3c 18%, #9d2636);
  transform-origin: 50% 100%;
  transform: rotate(var(--speedo-from, -120deg));
  filter: drop-shadow(0 0 4px rgba(255, 45, 60, 0.55));
  z-index: 1;
}
#app.is-revving .speedo-needle {
  animation: speedo-rev 1.2s cubic-bezier(0.18, 0.7, 0.22, 1) forwards;
  filter: drop-shadow(0 0 8px rgba(255, 45, 60, 0.95));
}
#app.is-revving .speedo-face {
  box-shadow:
    inset 0 0 0 6px #0b0c0e,
    inset 0 0 0 8px #ff2d3c,
    inset 0 0 0 11px #9aa0a8,
    inset 0 -18px 28px rgba(0, 0, 0, 0.55),
    0 0 22px rgba(255, 45, 60, 0.35);
}
@keyframes speedo-rev {
  0% { transform: rotate(var(--speedo-from, -120deg)); }
  72% { transform: rotate(var(--speedo-over, 84deg)); }
  100% { transform: rotate(var(--speedo-to, 72deg)); }
}
.speedo-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f2f4f7, #6b7078 42%, #1a1c20);
  box-shadow: 0 0 0 2px #c4384a, 0 0 0 4px #9aa0a8;
  z-index: 2;
}

.cover-copy {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.cover-line {
  margin: 0;
  text-align: center;
  font-size: clamp(28px, 7vw, 34px);
  letter-spacing: 0.12em;
  color: var(--cream);
}
.cover-name {
  margin: 0;
  padding: 6px 22px 2px;
  transform: rotate(-2deg);
  background: var(--cream);
  color: var(--ink);
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(48px, 13vw, 58px);
  letter-spacing: 0.08em;
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35);
}
.cover-hint {
  margin: 14px 0 0;
  text-align: center;
  font-size: 14px;
  color: #b7a891;
}

#app[data-start="push"] .start-fob { display: none; }
#app[data-start="fob"] .start-push { display: none; }

.start-push {
  position: relative;
  z-index: 3;
  width: 132px;
  height: 132px;
  border-radius: 34px;
  background: linear-gradient(180deg, #4a4f57, #23262c 62%, #171a1f);
  box-shadow:
    inset 0 2px 2px rgba(255, 255, 255, 0.22),
    inset 0 -6px 10px rgba(0, 0, 0, 0.5),
    0 16px 26px rgba(0, 0, 0, 0.5);
}
.start-push-ring {
  position: absolute;
  inset: 12px;
  border-radius: 24px;
  box-shadow: 0 0 0 2px var(--red), 0 0 14px rgba(196, 56, 74, 0.7);
  animation: pushpulse 1.8s ease-in-out infinite;
}
@keyframes pushpulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.start-push-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-family: "Bebas Neue", Impact, sans-serif;
  letter-spacing: 0.14em;
  color: #eef1f5;
}
.start-push-small { font-size: 15px; color: #aeb4bd; }
.start-push-big { font-size: 30px; line-height: 0.9; }
.start-push:active { transform: scale(0.96); }
#app.is-fired .start-push .start-push-ring {
  animation: none;
  box-shadow: 0 0 0 2px #57e08a, 0 0 18px rgba(87, 224, 138, 0.8);
}

.start-fob {
  position: relative;
  z-index: 3;
  width: 122px;
  height: 168px;
  background: transparent;
}
.fob-ring {
  position: absolute;
  left: 50%;
  top: -14px;
  width: 26px;
  height: 26px;
  margin-left: -13px;
  border-radius: 50%;
  border: 4px solid #c9ccd2;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}
.fob-ring::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 3px;
  height: 16px;
  margin-left: -1.5px;
  background: linear-gradient(180deg, #c9ccd2, #7c7f86);
}
.fob-body {
  position: absolute;
  inset: 18px 0 0;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(180deg, #2c2f36, #17191e);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.14), 0 16px 26px rgba(0, 0, 0, 0.5);
}
.fob-brand {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 14px;
  letter-spacing: 0.22em;
  color: #9aa0a9;
}
.fob-start {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: #fff;
  background: radial-gradient(circle at 50% 38%, #e0566a, var(--red) 55%, var(--red-deep));
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.4), 0 4px 8px rgba(0, 0, 0, 0.45);
  animation: pushpulse 1.8s ease-in-out infinite;
}
.fob-mini { display: flex; gap: 12px; }
.fob-mini span {
  width: 16px;
  height: 10px;
  border-radius: 3px;
  background: #3a3d44;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.12);
}
.start-fob:active .fob-body { transform: translateY(2px); }
#app.is-fired .start-fob .fob-start { animation: none; }

#app.is-fired #scene-ignition {
  animation: cover-out 0.7s 0.35s ease forwards;
  pointer-events: none;
}
@keyframes cover-out {
  to { opacity: 0; visibility: hidden; }
}

/* ---------- night drive / windshield ---------- */

.arrival {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #05070d;
}
.arrival[hidden] { display: none !important; }
.arrival video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.18);
  transition: opacity 0.7s ease, transform 1.1s ease;
}
#app.is-drifting .arrival video {
  opacity: 1;
  transform: scale(1);
}
#app.is-teasing .arrival video {
  opacity: 0.68;
  transition: opacity 0.45s ease;
}
#app.is-teasing .arrival::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(8, 6, 4, 0.18), rgba(8, 6, 4, 0.52) 72%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.32), transparent 22%, transparent 68%, rgba(0, 0, 0, 0.4));
}
/* once we are in the car the clip keeps rolling behind the glass, dimmed */
#app.has-arrived .arrival video {
  opacity: 0.55;
  transition: opacity 0.8s ease;
}
#app.has-arrived .arrival::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 18%, transparent 62%, rgba(18, 14, 12, 0.9));
}

/* ---------- tease ---------- */

#scene-tease { z-index: 5; isolation: isolate; }
.tease {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
}
.tease-line {
  margin: 0;
  padding: 6px 14px 3px;
  background: var(--cream);
  color: var(--ink);
  font-family: "Permanent Marker", cursive;
  font-size: 26px;
  transform: rotate(-2deg);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35);
}
.tease-ask {
  margin: 6px 0 22px;
  font-size: 20px;
  color: var(--cream);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
}
.tease-btns {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  gap: 18px;
}
.tease-yes,
.tease-no {
  min-width: 110px;
  height: 52px;
  padding: 0 22px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 26px;
  letter-spacing: 0.1em;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35);
}
.tease-yes { background: var(--red); color: #fff8f4; transform: rotate(-1.5deg); }
.tease-no { transform: rotate(2deg); transition: left 0.25s ease, top 0.25s ease, transform 0.25s ease; }
.tease-no.is-loose { position: absolute; margin: 0; }
.tease-no.is-tiny { transform: rotate(2deg) scale(0.62); }

/* ---------- dashboard scene ---------- */

#scene-dash { z-index: 2; }

.cabin {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  transform: translateY(108%);
}
#app.has-arrived .cabin {
  transform: translateY(0);
  transition: transform 0.75s cubic-bezier(0.16, 0.84, 0.22, 1);
}

.dice {
  position: relative;
  width: 76px;
  height: 42px;
  margin: 36px 0 0;
  padding: 0;
  background: transparent;
}
.die {
  position: absolute;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 34px;
  height: 34px;
  padding: 5px;
  border-radius: 7px;
  background: linear-gradient(145deg, #fff, #e6e0d4);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.08), 0 5px 8px rgba(0, 0, 0, 0.18);
}
.die i {
  width: 5px;
  height: 5px;
  margin: auto;
  border-radius: 50%;
  background: var(--red);
  opacity: 0;
}
.die-a { left: 0; top: 0; transform: rotate(-12deg); }
.die-b { right: 0; top: 6px; transform: rotate(10deg); }
.die[data-face="1"] i:nth-child(5) { opacity: 1; }
.die[data-face="2"] i:nth-child(3),
.die[data-face="2"] i:nth-child(7) { opacity: 1; }
.die[data-face="3"] i:nth-child(1),
.die[data-face="3"] i:nth-child(5),
.die[data-face="3"] i:nth-child(9) { opacity: 1; }
.die[data-face="4"] i:nth-child(1),
.die[data-face="4"] i:nth-child(3),
.die[data-face="4"] i:nth-child(7),
.die[data-face="4"] i:nth-child(9) { opacity: 1; }
.die[data-face="5"] i:nth-child(1),
.die[data-face="5"] i:nth-child(3),
.die[data-face="5"] i:nth-child(5),
.die[data-face="5"] i:nth-child(7),
.die[data-face="5"] i:nth-child(9) { opacity: 1; }
.die[data-face="6"] i:nth-child(1),
.die[data-face="6"] i:nth-child(3),
.die[data-face="6"] i:nth-child(4),
.die[data-face="6"] i:nth-child(6),
.die[data-face="6"] i:nth-child(7),
.die[data-face="6"] i:nth-child(9) { opacity: 1; }
.dice.is-rolling { animation: dice-shake 0.28s ease-in-out infinite; }
.dice.is-rolling .die-a { animation: tumble 0.3s linear infinite; }
.dice.is-rolling .die-b { animation: tumble 0.3s linear infinite reverse; }
.dice.is-sixteen .die-a,
.dice.is-sixteen .die-b {
  top: 4px;
  transform: rotate(0deg);
  transition: transform 0.3s ease, top 0.3s ease;
}
.dice.is-sixteen .die-a { left: 0; }
.dice.is-sixteen .die-b { right: 0; }
@keyframes tumble {
  to { transform: rotate(360deg); }
}
@keyframes dice-shake {
  0%, 100% { transform: rotate(-5deg); }
  50% { transform: rotate(5deg); }
}

.dash {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  overflow: visible;
  display: flex;
  flex-direction: column;
  margin: calc(var(--safe-top) + 8px) 12px 6px;
  padding-bottom: 14px;
  background:
    radial-gradient(rgba(255, 255, 255, 0.04) 0.6px, transparent 0.7px),
    linear-gradient(180deg, #3d3128, var(--paper) 22%);
  background-size: 4px 4px, auto;
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45), inset 0 2px 0 rgba(255, 255, 255, 0.1);
}

.glass {
  flex: 1 1 auto;
  min-height: 36px;
}

.clips {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 12px 18px;
}
.clip {
  position: relative;
  display: inline-block;
  padding: 5px 12px 3px;
  line-height: 0.9;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.45);
}
.clip::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 34px;
  height: 12px;
  margin-left: -17px;
  background: rgba(232, 220, 180, 0.45);
  transform: rotate(-8deg);
}
.clip-elite {
  font-family: "Special Elite", serif;
  font-size: 28px;
  background: var(--manila);
  transform: rotate(-3deg);
}
.clip-bebas {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(30px, 9.2vw, 42px);
  letter-spacing: 0.05em;
  white-space: nowrap;
  transform: rotate(-1.2deg);
  padding: 4px 14px 1px;
}
.clip-marker {
  font-family: "Permanent Marker", cursive;
  font-size: 36px;
  background: var(--red);
  color: #fff8f4;
  transform: rotate(-2deg);
}

.hint {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  margin: 6px 0 calc(var(--safe-bottom) + 8px);
  text-align: center;
  font-size: 13px;
  color: #b7a891;
}

.license {
  position: relative;
  z-index: 2;
  display: block;
  width: min(340px, calc(100% - 36px));
  margin: 22px auto 0;
  transform: rotate(-1.2deg);
  padding: 12px 14px 10px;
  text-align: left;
  color: #1a140f;
  border-radius: 18px;
  background:
    radial-gradient(circle at 86% 18%, rgba(212, 168, 48, 0.16), transparent 28%),
    repeating-linear-gradient(118deg, transparent 0 16px, rgba(45, 110, 168, 0.045) 16px 17px),
    #f7f3ea;
  box-shadow: 0 14px 22px rgba(0, 0, 0, 0.4);
}
.license::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -10px;
  width: 84px;
  height: 18px;
  margin-left: -42px;
  background: rgba(240, 232, 214, 0.55);
  transform: rotate(-4deg);
}

.lic-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.lic-title {
  margin: 0;
  font-family: Anton, Impact, sans-serif;
  font-size: 18px;
  letter-spacing: 0.08em;
  color: #2d6ea8;
}
.lic-state {
  margin: 1px 0 0;
  font-family: Anton, Impact, sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #8aa3bd;
}
.lic-star {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2b93b;
  color: #fff8e8;
  font-size: 16px;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.lic-body {
  display: flex;
  align-items: stretch;
  gap: 14px;
}
.lic-photo {
  display: block;
  flex: 0 0 96px;
  width: 96px;
  align-self: stretch;
  min-height: 118px;
  overflow: hidden;
  border-radius: 8px;
  background:
    radial-gradient(circle at 50% 28%, #cbb394 0 16px, transparent 17px),
    radial-gradient(ellipse at 50% 78%, #cbb394 0 28px, transparent 29px),
    linear-gradient(180deg, #d8c7ad, #b79a76);
  box-shadow: inset 0 0 0 1px rgba(45, 110, 168, 0.18);
}
.lic-photo.has-photo { background: #1a140f; }
.lic-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}
.lic-fields {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: 2px;
}
.lic-ids {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lic-name {
  margin: 8px 0 6px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 30px;
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: #1a140f;
}
.lic-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.lic-meta {
  margin: 0;
  font-family: Anton, Impact, sans-serif;
  letter-spacing: 0.04em;
  font-size: 13px;
  line-height: 1.15;
}
.lic-meta span {
  display: inline;
  margin-right: 6px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #2d6ea8;
}
.lic-open {
  margin: 8px 0 0;
  text-align: right;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--red);
}

.visor {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  height: 168px;
  margin: 0 10px 0;
  padding: 0;
  border-radius: 10px 10px 18px 18px;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 5px),
    linear-gradient(180deg, #4a4139, #2b241e);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, 0.1), 0 -8px 20px rgba(0, 0, 0, 0.45);
}
.visor-shots {
  position: absolute;
  inset: 16px 8px 28px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.visor-shots .polaroid {
  position: relative;
  flex: 0 0 auto;
  margin: 0 -10px;
}
.visor-shots .polaroid:nth-child(1) { transform: rotate(-8deg); z-index: 1; }
.visor-shots .polaroid:nth-child(2) { transform: rotate(-2deg); z-index: 3; }
.visor-shots .polaroid:nth-child(3) { transform: rotate(3deg); z-index: 2; }
.visor-shots .polaroid:nth-child(4) { transform: rotate(8deg); z-index: 1; }
.visor-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 10px;
  border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, #1a1511, #2a221c 50%, #14100d);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}
.visor-tag {
  position: absolute;
  right: 12px;
  bottom: 8px;
  padding: 2px 8px 0;
  background: var(--manila);
  color: var(--ink);
  font-size: 11px;
  transform: rotate(-3deg);
  box-shadow: 1px 2px 0 rgba(0, 0, 0, 0.35);
}

/* ---------- overlays ---------- */

.text-btn {
  position: absolute;
  top: max(14px, var(--safe-top));
  left: 16px;
  z-index: 6;
  height: 36px;
  padding: 0 12px;
  background: var(--cream);
  color: var(--ink);
  font-family: "Permanent Marker", cursive;
  font-size: 16px;
  border-radius: 3px;
  transform: rotate(-2deg);
}

.gallery {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 8px calc(12px + var(--safe-bottom));
  background:
    radial-gradient(rgba(255, 255, 255, 0.04) 0.6px, transparent 0.7px),
    rgba(18, 14, 12, 0.96);
  background-size: 4px 4px, auto;
}
.gallery[hidden] { display: none !important; }
.gallery-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
}
.gallery-shot {
  display: flex;
  justify-content: center;
  flex: 0 1 auto;
  background: transparent;
  padding: 0;
  touch-action: pan-y;
}
.gallery-nav {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  background: var(--cream);
  color: var(--ink);
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 34px;
  line-height: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
}
.gallery-nav:active { transform: scale(0.94); }
.gallery-count {
  margin: 0;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 20px;
  letter-spacing: 0.08em;
  color: #eadcc8;
}
.gallery-hint {
  margin: 0;
  font-size: 12px;
  color: #8a8174;
}
.gallery-strip {
  display: flex;
  gap: 8px;
  width: min(100%, 420px);
  max-width: 100%;
  overflow-x: auto;
  padding: 8px 10px 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.gallery-strip::-webkit-scrollbar { display: none; }
.gallery-thumb {
  flex: 0 0 auto;
  width: 44px;
  height: 58px;
  padding: 0;
  overflow: hidden;
  border-radius: 4px;
  background: #2b241e;
  box-shadow: inset 0 0 0 1px rgba(244, 239, 228, 0.2);
  opacity: 0.55;
}
.gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}
.gallery-thumb.is-current {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--red);
}

.polaroid {
  display: flex;
  flex-direction: column;
  width: min(78vw, 280px);
  padding: 14px 14px 46px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 12px 18px rgba(0, 0, 0, 0.38);
}
.polaroid.mini {
  width: 86px;
  padding: 6px 6px 18px;
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.5);
}
.polaroid .shot {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.35), transparent 42%),
    linear-gradient(160deg, #efe2cc, #c9b294);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.polaroid .shot img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
}
.polaroid .cap {
  display: block;
  margin-top: 8px;
  min-height: 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.2;
}

/* ticket drop */
.drop {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 24px 18px;
  background: rgba(8, 6, 4, 0.72);
}
.drop[hidden] { display: none !important; }
.ticket {
  position: relative;
  width: min(330px, 100%);
  padding: 16px 20px 14px;
  text-align: left;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 50%, transparent 10px, var(--manila) 10.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 10px, var(--manila) 10.5px) right / 51% 100% no-repeat;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.5));
  transform: rotate(-2deg);
  animation: ticket-drop 0.7s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}
@keyframes ticket-drop {
  from { opacity: 0; transform: translateY(-70vh) rotate(-14deg); }
  to { opacity: 1; transform: translateY(0) rotate(-2deg); }
}
.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 2px dashed rgba(26, 20, 15, 0.35);
}
.ticket-title {
  font-family: Anton, Impact, sans-serif;
  font-size: 18px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
}
.ticket-no {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 24px;
  letter-spacing: 0.06em;
}
.ticket-rows {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 14px;
  margin: 12px 0 0;
}
.ticket-rows dt {
  font-family: Anton, Impact, sans-serif;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8a8174;
  padding-top: 3px;
}
.ticket-rows dd {
  margin: 0;
  font-family: "Permanent Marker", cursive;
  font-size: 18px;
  line-height: 1.2;
}
.ticket-stub {
  margin: 14px 0 0;
  padding-top: 8px;
  border-top: 2px dashed rgba(26, 20, 15, 0.35);
  text-align: center;
  font-size: 13px;
}

/* opened card */
.bigcard {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: calc(max(14px, var(--safe-top)) + 46px) 14px calc(var(--safe-bottom) + 12px);
  background: rgba(8, 6, 4, 0.82);
}
.bigcard[hidden] { display: none !important; }
.bigcard-inner {
  width: min(360px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 22px 22px 24px;
  text-align: center;
  color: var(--ink);
  background:
    radial-gradient(rgba(0, 0, 0, 0.03) 0.6px, transparent 0.7px),
    linear-gradient(180deg, #fbf6ec, #f2e9d6);
  background-size: 4px 4px, auto;
  border-radius: 6px;
  box-shadow: 0 26px 44px rgba(0, 0, 0, 0.5);
  transform-origin: top center;
  animation: card-open 0.5s cubic-bezier(0.2, 0.8, 0.25, 1);
}
@keyframes card-open {
  from { transform: scaleY(0.04); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}
.bc-heading {
  margin: 0;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 40px;
  line-height: 0.9;
  letter-spacing: 0.03em;
  color: var(--red);
}
.bc-acts {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 36px;
  margin: 8px 0 0;
}
.bc-act {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 88px;
}
.bc-act-label {
  margin: 8px 0 0;
  font-family: "Permanent Marker", cursive;
  font-size: 14px;
  line-height: 1.1;
  color: #6d6458;
}
.bc-wish {
  margin: 10px 0 0;
  font-family: "Permanent Marker", cursive;
  font-size: 18px;
  line-height: 1.2;
  opacity: 0;
}
.bigcard-inner.is-out .bc-wish { opacity: 1; transition: opacity 0.6s ease 0.28s; }
.bc-note {
  margin: 16px 0 0;
  text-align: left;
  font-size: 15px;
  line-height: 1.5;
}
.bc-sign {
  margin: 16px 0 0;
  text-align: right;
  font-family: "Permanent Marker", cursive;
  font-size: 18px;
  color: var(--red-deep);
}

/* candle */
.candle {
  position: relative;
  width: 60px;
  height: 78px;
  margin: 0;
  background: transparent;
  padding: 0;
}
.candle:disabled { opacity: 1; }
.wax {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 24px;
  height: 40px;
  margin-left: -12px;
  border-radius: 3px 3px 5px 5px;
  background: repeating-linear-gradient(180deg, #f7f1e6 0 7px, var(--red) 7px 10px, #f7f1e6 10px 18px);
  box-shadow: inset -4px 0 0 rgba(0, 0, 0, 0.08);
}
.wax::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -8px;
  width: 2px;
  height: 10px;
  margin-left: -1px;
  background: #2b241c;
}
.flame {
  position: absolute;
  left: 50%;
  bottom: 44px;
  width: 16px;
  height: 26px;
  margin-left: -8px;
  border-radius: 50% 50% 46% 46%;
  background: radial-gradient(circle at 50% 78%, #fff6c2, #ffb703 38%, #ff5a1f 70%, transparent 74%);
  transform-origin: 50% 100%;
  animation: flicker 0.16s infinite alternate;
  filter: drop-shadow(0 0 8px rgba(255, 140, 40, 0.85));
}
@keyframes flicker {
  from { transform: scaleX(1) scaleY(1) rotate(-2deg); }
  to { transform: scaleX(0.86) scaleY(1.08) rotate(2deg); }
}
.bigcard-inner.is-out .flame { animation: snuff 0.45s ease forwards; }
@keyframes snuff {
  to { transform: scale(0.15) translateY(8px); opacity: 0; }
}

.mute {
  position: absolute;
  top: max(10px, var(--safe-top));
  right: 10px;
  z-index: 20;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: rgba(18, 14, 12, 0.58);
  color: var(--cream);
  box-shadow: 0 0 0 1px rgba(244, 239, 228, 0.32), 0 4px 10px rgba(0, 0, 0, 0.35);
  opacity: 0.82;
}
.mute:hover,
.mute:focus-visible {
  opacity: 1;
}
.mute svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: 9px auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mute-body { fill: currentColor; stroke: none; }
.mute-slash { opacity: 0; }
#app.is-muted .mute-wave { opacity: 0; }
#app.is-muted .mute-slash { opacity: 1; }

/* ---------- responsive ---------- */

@media (max-height: 720px) {
  #scene-ignition { padding-top: calc(var(--safe-top) + 18px); }
  #scene-gate { padding-top: calc(var(--safe-top) + 14px); }
  .cover-copy { margin-bottom: 12px; }
  .cover-line { font-size: 24px; }
  .cover-name { font-size: 42px; padding: 5px 18px 1px; }
  .gate-prompt { margin-bottom: 10px; }
  .gate-slots { margin-bottom: 14px; }
  .gate-slot { width: 44px; height: 52px; font-size: 30px; }
  .gate-pad { grid-template-columns: repeat(3, 62px); gap: 10px; }
  .gate-key { width: 62px; height: 52px; font-size: 24px; border-radius: 14px; }
  .speedo { width: min(200px, 62vw); height: min(200px, 62vw); margin: 4px 0 18px; }
  .start-push { width: 112px; height: 112px; }
  .start-push-big { font-size: 26px; }
  .visor { height: 140px; }
  .polaroid.mini { width: 72px; padding: 5px 5px 14px; }
  .clip-bebas { font-size: 30px; }
  .clip-marker { font-size: 28px; }
  .clips { padding-top: 10px; padding-bottom: 14px; gap: 6px; }
  .lic-name { font-size: 24px; }
  .lic-photo { width: 78px; min-height: 98px; }
  .license { margin-top: 16px; padding: 10px 12px 8px; }
}

@media (min-width: 700px) {
  body { display: grid; place-items: center; background: #120e0c; }
  #app {
    height: min(100dvh, 900px);
    border-radius: 28px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  }
}
