/* ================= Intro experience ================= */

.splash {
  display: none;
}

.intro-open,
.intro-open body {
  overflow: hidden;
}

.intro-open .splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: block;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(ellipse at 50% 115%, rgba(40, 96, 168, 0.55) 0%, transparent 60%),
    linear-gradient(180deg, #030914 0%, #071d3a 62%, #0f2d57 100%);
  transition:
    opacity 0.7s ease,
    transform 0.7s ease;
}

.splash[hidden] {
  display: none !important;
}

.splash.exit {
  opacity: 0;
  transform: scale(1.06);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.sky,
.ripples {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.ripples {
  position: fixed;
  z-index: 1000;
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 16px 72px;
  overflow-y: auto;
  text-align: center;
}

.splash[data-screen="home"] .screen-home,
.splash[data-screen="draw"] .screen-draw,
.splash[data-screen="board"] .screen-board,
.splash[data-screen="pilot"] .screen-pilot,
.splash[data-screen="end"] .screen-end,
.splash[data-screen="game"] .screen-game {
  display: flex;
}

.splash[data-screen="pilot"] .sky {
  display: none;
}

/* ---------- Liquid glass ---------- */
.glass {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at var(--mx, 30%) var(--my, 0%), rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 55%, rgba(255, 255, 255, 0.09));
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 24px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 24px rgba(255, 255, 255, 0.05),
    0 24px 60px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  backdrop-filter: blur(18px) saturate(170%);
}

.glass::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 38%);
  content: "";
  pointer-events: none;
}

.glass-btn {
  padding: 9px 16px;
  font-size: 14px;
  color: #fff;
  font-family: inherit;
  font-weight: 720;
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease;
}

.glass-btn:hover,
.glass-btn:focus-visible {
  border-color: #e0b35c;
  outline: none;
  transform: translateY(-2px);
}

.intro-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 14px;
  color: #071d3a;
  font-family: inherit;
  font-weight: 780;
  text-decoration: none;
  background: linear-gradient(180deg, #f1cd7c, #d9a441);
  border: 1px solid rgba(255, 240, 200, 0.7);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 10px 26px rgba(217, 164, 65, 0.3);
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.intro-btn:hover,
.intro-btn:focus-visible {
  outline: none;
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 14px 34px rgba(217, 164, 65, 0.45);
}

.intro-btn:focus-visible,
.glass-btn:focus-visible,
.ctl:focus-visible,
.feel-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.intro-btn.big {
  padding: 10px 20px;
  font-size: 15px;
}

/* ---------- Home ---------- */
.intro-eyebrow {
  margin: 0 0 18px;
  color: #e0b35c;
  font-size: 12px;
  font-weight: 820;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: rise 0.8s ease both;
}

.title-card {
  padding: clamp(22px, 4vw, 40px) clamp(22px, 5vw, 56px);
  transform: perspective(1000px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 0.25s ease-out;
  animation: rise 0.9s 0.1s ease both;
}

.intro-title {
  margin: 0;
  font-size: clamp(24px, 3.8vw, 46px);
  line-height: 1.15;
  transform: translateZ(40px);
  font-weight: 560;
  letter-spacing: 0.005em;
  text-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
}

.intro-title span {
  display: block;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-top: clamp(28px, 5vh, 44px);
  animation: rise 0.8s 0.3s ease both;
}

.home-hint {
  margin: 22px 0 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 13px;
  animation: rise 0.8s 0.5s ease both;
}

.intro-skip {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 5;
  padding: 7px 12px;
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.intro-skip:hover,
.intro-skip:focus-visible {
  color: #fff;
  border-color: #e0b35c;
}

.back-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 5;
  padding: 7px 12px;
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  cursor: pointer;
}

/* ---------- Animations ---------- */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

.pop {
  animation: pop 0.45s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

/* ---------- Omikuji ---------- */
.draw-box {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.draw-box[hidden],
.fortune[hidden],
.end-ask[hidden],
.end-result[hidden],
.scorecard[hidden],
.game-star[hidden],
.game-hint[hidden],
.ctl-main[hidden] {
  display: none !important;
}

.draw-hint {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
}

.omikuji {
  position: relative;
  width: 120px;
  height: 190px;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45));
}

.omikuji svg {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
}

.omikuji-stick {
  position: absolute;
  top: 20px;
  left: 56px;
  width: 8px;
  height: 90px;
  background: linear-gradient(180deg, #c0392b 0 16px, #ead7ad 16px);
  border-radius: 3px;
  transform: translateY(30px);
  transition: transform 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.omikuji.out .omikuji-stick {
  transform: translateY(-46px);
}

.omikuji.shaking {
  animation: shake 0.35s ease-in-out 3;
}

@keyframes shake {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-18deg) translateY(-8px);
  }
  75% {
    transform: rotate(18deg) translateY(-8px);
  }
}

.fortune {
  width: min(440px, 100%);
  padding: 22px 24px 24px;
  color: #101820;
  background:
    radial-gradient(circle at 90% 8%, rgba(184, 50, 42, 0.12), transparent 30%),
    linear-gradient(180deg, #fffaf0, #f6eedc);
  border-top: 8px solid #b8322a;
  border-radius: 8px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
  transform-origin: 50% 0;
}

.fortune.unfold {
  animation: unfold 0.65s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}

@keyframes unfold {
  from {
    opacity: 0;
    transform: perspective(800px) rotateX(-80deg);
  }
}

.fortune-no {
  margin: 0;
  color: #8c6a2e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.fortune-kanji {
  margin: 4px 0 0;
  color: #b8322a;
  font-size: 66px;
  font-weight: 850;
  line-height: 1.1;
}

.fortune-name {
  margin: 4px 0 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fortune-msg {
  margin: 0 0 8px;
  font-size: 19px;
  line-height: 1.4;
}

.fortune-item {
  margin: 0 0 20px;
  color: #5a6675;
  font-size: 14px;
  font-style: italic;
}

.feel-q {
  margin: 20px 0 10px;
  color: #3a4654;
  font-size: 14px;
  font-weight: 700;
}

.feel {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.feel-btn {
  padding: 7px 14px;
  font-size: 14px;
  color: #101820;
  font-family: inherit;
  font-weight: 720;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(16, 24, 32, 0.2);
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.feel-btn:hover {
  transform: translateY(-2px) scale(1.04);
}

.fortune-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.fortune-actions[hidden],
.feel-wrap[hidden] {
  display: none;
}

.feel-wrap .feel-q {
  margin-top: 4px;
}

@keyframes float {
  50% {
    transform: translateY(-8px) rotate(-4deg);
  }
}

.offer-text {
  margin: 0 0 18px;
  font-size: 18px;
  line-height: 1.45;
}

.offer-text em {
  color: #e0b35c;
  font-style: normal;
  font-weight: 760;
}

/* ---------- Boarding ---------- */
.screen-board {
  overflow: hidden;
}

.board {
  display: none;
}

.screen-board[data-vehicle="train"] .board-train,
.screen-board[data-vehicle="rocket"] .board-rocket {
  display: block;
}

.scene-station,
.scene-pad {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}

.screen-board[data-vehicle="train"] .scene-station,
.screen-board[data-vehicle="rocket"] .scene-pad {
  display: block;
}

.screen-board.arrive .scene-station,
.screen-board.arrive .scene-pad {
  animation: scene-in 0.7s ease both;
}

@keyframes scene-in {
  from {
    opacity: 0;
  }
}

/* Station platform */
.scene-station {
  background: linear-gradient(180deg, #0f1b36 0%, #33386a 45%, #c9786a 78%, #f0a56e 100%);
}

.station-roof {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 9vh;
  background: #161c28;
  box-shadow: 0 6px 0 #232b3a;
}

.station-roof::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -14px;
  height: 6px;
  background: radial-gradient(circle, #fff3c4 0 3px, transparent 4px) 0 0 / 60px 6px repeat-x;
  filter: drop-shadow(0 0 6px #ffe7a0);
  content: "";
}

.station-pillars {
  position: absolute;
  top: 9vh;
  bottom: 22vh;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-around;
}

.station-pillars i {
  width: 16px;
  background: linear-gradient(90deg, #2c3442, #46505f, #2c3442);
}

.led-board {
  position: absolute;
  top: calc(9vh + 26px);
  left: 50%;
  width: min(520px, 82vw);
  padding: 8px 0;
  overflow: hidden;
  color: #ffb02e;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: clamp(13px, 2vw, 17px);
  font-weight: 700;
  white-space: nowrap;
  background: #05080d;
  border: 3px solid #2c3442;
  border-radius: 6px;
  transform: translateX(-50%);
}

.led-board span {
  display: inline-block;
  padding-left: 100%;
  animation: marquee 9s linear infinite;
}

@keyframes marquee {
  to {
    transform: translateX(-100%);
  }
}

.board {
  position: absolute;
}

.board svg {
  display: block;
  width: 100%;
  height: auto;
}

.board-train {
  left: 0;
  bottom: calc(22vh + 3px);
  width: max(920px, 160vw);
  transform: translateX(6vw);
  transform-origin: 22.5% 32%;
}

.rails {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 22vh;
  z-index: 1;
  height: 7px;
  background: linear-gradient(180deg, #d6dbe1 0 2px, #6d747d 2px 5px, #3a3f46 5px);
}

.screen-board.arrive .board-train {
  animation: train-in 2.9s cubic-bezier(0.12, 0.72, 0.22, 1) both;
}

@keyframes train-in {
  from {
    transform: translateX(105vw);
  }
  to {
    transform: translateX(6vw);
  }
}

.headlight {
  filter: drop-shadow(0 0 3px #fff6d0);
}

.platform {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 22vh;
  background: linear-gradient(180deg, #a3a09b 0%, #8a8782 40%, #6f6c68 100%);
}

.platform-edge {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: #e7e4de;
}

.platform-line {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  height: 12px;
  background: repeating-linear-gradient(90deg, #f2c230 0 26px, #d9ad25 26px 30px);
}

/* Launch pad */
.scene-pad {
  background: linear-gradient(180deg, #0d1b3a 0%, #2f4f86 42%, #e9a77a 82%, #f7d39b 100%);
}

.pad-sun {
  position: absolute;
  right: 14%;
  bottom: 16vh;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 244, 214, 0.95) 0 14%, rgba(255, 200, 130, 0.45) 30%, transparent 65%);
}

.pad-hills {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18vh;
  height: 12vh;
  background: #22304a;
  clip-path: polygon(0 70%, 12% 40%, 24% 62%, 38% 30%, 52% 58%, 66% 35%, 80% 60%, 92% 42%, 100% 55%, 100% 100%, 0 100%);
}

.pad-ground {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  height: 18vh;
  background: linear-gradient(180deg, #2b3442, #1a212c);
}

.pad-deck {
  position: absolute;
  left: 50%;
  bottom: 18vh;
  z-index: 2;
  width: 240px;
  height: 16px;
  background: #4a5462;
  border-radius: 3px 3px 0 0;
  transform: translateX(-50%);
}

.board-rocket {
  left: 50%;
  bottom: calc(18vh + 16px);
  z-index: 1;
  display: flex;
  flex-direction: column;
  width: clamp(80px, 12vh, 110px);
  transform: translateX(-50%);
  transform-origin: 50% 36%;
}

.part {
  position: relative;
}

.part-upper,
.part-booster {
  margin-top: -1px;
}

.screen-board.arrive .part-booster {
  animation: rise-up 1.3s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.screen-board.arrive .part-upper {
  animation: drop-in 1s 1.3s cubic-bezier(0.3, 1.25, 0.5, 1) both;
}

.screen-board.arrive .part-nose {
  animation: drop-in 0.9s 2.3s cubic-bezier(0.3, 1.25, 0.5, 1) both;
}

@keyframes rise-up {
  from {
    transform: translateY(110%);
  }
}

@keyframes drop-in {
  from {
    opacity: 0;
    transform: translateY(-80vh);
  }
  60% {
    opacity: 1;
  }
}

.pad-tower {
  position: absolute;
  left: calc(50% - 150px);
  bottom: 18vh;
  z-index: 1;
  width: 40px;
  height: calc(clamp(80px, 12vh, 110px) * 2.8 + 40px);
  background:
    repeating-linear-gradient(45deg, transparent 0 12px, #c0392b 12px 15px),
    repeating-linear-gradient(-45deg, transparent 0 12px, #c0392b 12px 15px);
  border: 3px solid #c0392b;
}

.arm {
  position: absolute;
  left: 100%;
  width: 84px;
  height: 8px;
  background: #c0392b;
  transform-origin: 0 50%;
}

.arm-top {
  top: 26%;
}

.arm-mid {
  top: 58%;
}

.screen-board.arrive .arm {
  animation: arm-swing 0.7s 3.2s ease-out both;
}

@keyframes arm-swing {
  from {
    transform: rotate(-70deg);
  }
}

.beacon {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 10px;
  height: 10px;
  background: #ff4d3a;
  border-radius: 50%;
  box-shadow: 0 0 10px #ff4d3a;
  transform: translateX(-50%);
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.15;
  }
}

.vapor {
  position: absolute;
  bottom: 0;
  width: 40px;
  height: 40px;
  background: rgba(240, 244, 248, 0.8);
  border-radius: 50%;
  opacity: 0;
}

.v1 {
  left: -20%;
}

.v2 {
  left: 30%;
}

.v3 {
  left: 80%;
}

.screen-board.arrive .vapor {
  animation: vapor 2.2s 3.4s ease-out infinite;
}

.screen-board.arrive .v2 {
  animation-delay: 3.9s;
}

.screen-board.arrive .v3 {
  animation-delay: 4.4s;
}

@keyframes vapor {
  0% {
    opacity: 0.8;
    transform: scale(0.3);
  }
  100% {
    opacity: 0;
    transform: translateY(-30px) scale(2.2);
  }
}

/* Offer card + boarding */
.arrive-card {
  position: absolute;
  top: calc(9vh + 84px);
  left: 50%;
  z-index: 3;
  width: min(460px, calc(100% - 32px));
  padding: 24px 24px 26px;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
  pointer-events: none;
}

.screen-board[data-vehicle="rocket"] .arrive-card {
  top: max(64px, 9vh);
}

.screen-board.ready .arrive-card {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.board-text {
  position: absolute;
  bottom: 9vh;
  left: 0;
  right: 0;
  z-index: 3;
  margin: 0;
  font-size: clamp(18px, 3vw, 24px);
  font-weight: 760;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
}

.board-fade {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.screen-board.go .board-train {
  z-index: 3;
  animation: train-zoom 2.6s cubic-bezier(0.6, 0, 0.8, 0.4) forwards;
}

.screen-board.go .board-rocket {
  z-index: 3;
  animation: rocket-zoom 2.6s cubic-bezier(0.6, 0, 0.8, 0.4) forwards;
}

.screen-board.go .board-fade {
  animation: board-fade 2.6s ease forwards;
}

.screen-board.go .cab-door {
  animation: door 0.6s 0.3s ease forwards;
}

@keyframes train-zoom {
  0%,
  25% {
    transform: translateX(6vw) scale(1);
  }
  100% {
    transform: translateX(6vw) scale(14);
  }
}

@keyframes rocket-zoom {
  0%,
  25% {
    transform: translateX(-50%) scale(1);
  }
  100% {
    transform: translateX(-50%) scale(14);
  }
}

@keyframes board-fade {
  0%,
  72% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes door {
  to {
    transform: translateX(14px);
  }
}

/* Driver walking to the cab door */
.walker {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  display: none;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

.walker.on {
  display: block;
}

.walker svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.walker.flip svg {
  transform: scaleX(-1);
}

.walker .w-leg,
.walker .w-arm {
  transform-box: fill-box;
  transform-origin: 50% 8%;
  transition: transform 0.2s ease;
}

.walker.walking .w-leg-f,
.walker.walking .w-arm-b {
  animation: swing 0.42s ease-in-out infinite alternate;
}

.walker.walking .w-leg-b,
.walker.walking .w-arm-f {
  animation: swing 0.42s ease-in-out infinite alternate-reverse;
}

.walker.walking .bob {
  animation: bob 0.21s ease-in-out infinite alternate;
}

.walker.press .w-arm-f {
  transform: rotate(-80deg);
}

@keyframes swing {
  from {
    transform: rotate(28deg);
  }
  to {
    transform: rotate(-28deg);
  }
}

@keyframes bob {
  to {
    transform: translateY(-1.5px);
  }
}

.cab-door {
  transform-box: view-box;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.screen-board.door-open .cab-door {
  transform: translateX(27px);
}

.door-btn .door-led {
  transition: fill 0.2s ease;
}

.door-btn.pressed .door-led {
  fill: #ffd84a;
  filter: drop-shadow(0 0 3px #ffd84a);
}

.screen-board.walk-out .arrive-card {
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
}

.screen-board.fade-out .board-fade {
  opacity: 1;
  transition: opacity 0.6s ease;
}

/* ---------- Pilot mode ---------- */
.screen-pilot {
  padding: 0;
  overflow: hidden;
  background: #05080d;
}

.world {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.window-frame {
  position: absolute;
  top: 4vh;
  left: 3vw;
  right: 3vw;
  bottom: var(--win-bottom, 34vh);
  border-radius: 48% 48% 5% 5% / 26% 26% 6% 6%;
  box-shadow:
    0 0 0 200vmax #0b1018,
    inset 0 0 0 3px rgba(255, 255, 255, 0.08),
    inset 0 0 60px rgba(0, 0, 0, 0.55);
  pointer-events: none;
}

.screen-pilot[data-vehicle="rocket"] .window-frame {
  border-radius: 34px;
  box-shadow:
    0 0 0 200vmax #0c1119,
    inset 0 0 0 6px #1c2532,
    inset 0 0 0 8px rgba(255, 255, 255, 0.08),
    inset 0 0 80px rgba(0, 0, 0, 0.6);
}


.shade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.screen-pilot.boot .shade {
  animation: shade-open 1.3s ease forwards;
}

@keyframes shade-open {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.hud-top {
  position: absolute;
  top: calc(4vh + 12px);
  left: 50%;
  display: flex;
  gap: 14px;
  align-items: center;
  max-width: calc(100vw - 140px);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  border-radius: 999px;
  transform: translateX(-50%);
}

.hud-title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-time {
  color: #e0b35c;
  font-variant-numeric: tabular-nums;
}

.toast {
  position: absolute;
  top: calc(4vh + 62px);
  left: 50%;
  max-width: min(90vw, 560px);
  margin: 0;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 999px;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.big-count {
  position: absolute;
  top: 30vh;
  left: 0;
  right: 0;
  margin: 0;
  color: #e0b35c;
  font-size: clamp(80px, 16vw, 170px);
  font-weight: 860;
  line-height: 1;
  text-shadow: 0 0 40px rgba(224, 179, 92, 0.5);
  pointer-events: none;
}

.dash {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  display: none;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px 18px;
  text-align: left;
  border-radius: 22px;
  background:
    radial-gradient(circle at var(--mx, 30%) var(--my, 0%), rgba(255, 255, 255, 0.14), transparent 40%),
    linear-gradient(140deg, rgba(30, 44, 64, 0.75), rgba(12, 18, 28, 0.82));
}

.screen-pilot[data-vehicle="train"] .dash-train,
.screen-pilot[data-vehicle="rocket"] .dash-rocket {
  display: grid;
}

.gauge {
  position: relative;
  width: 112px;
  height: 112px;
}

.gauge svg {
  width: 100%;
  height: 100%;
  transform: rotate(135deg);
}

.gauge circle {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
}

.g-bg {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-dasharray: 236 314;
}

.g-val {
  stroke: #e0b35c;
  stroke-dasharray: 0 314;
  filter: drop-shadow(0 0 6px rgba(224, 179, 92, 0.6));
  transition: stroke-dasharray 0.15s linear;
}

.g-read {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}

.g-read b,
.alt b {
  font-size: 30px;
  font-weight: 820;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.g-read small,
.alt small,
.stats small {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dash-mid {
  min-width: 0;
}

.route {
  position: relative;
  padding: 10px 0 26px;
}

.route-bar {
  position: relative;
  height: 6px;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.route-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, #4aa3ff, #e0b35c);
  border-radius: inherit;
}

.route-dot {
  position: absolute;
  top: 50%;
  left: 0;
  font-size: 20px;
  font-style: normal;
  transform: translate(-50%, -58%) scaleX(-1);
}

.route-stops span {
  position: absolute;
  top: 6px;
  transform: translateX(-50%);
}

.route-stops i {
  display: block;
  width: 8px;
  height: 8px;
  margin: 0 auto;
  background: #fff;
  border-radius: 50%;
}

.route-stops em {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.route-stops span:first-child em {
  transform: translateX(30%);
}

.route-stops span:last-child em {
  transform: translateX(-30%);
}

.dash-line {
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dash-keys {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 8px;
  align-items: center;
}

.ctl-main {
  grid-column: 1 / -1;
  padding: 9px 16px;
  font-size: 15px;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.6),
      0 0 0 8px rgba(224, 179, 92, 0.18);
  }
}

.ctl {
  min-height: 34px;
  padding: 6px 11px;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 720;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition:
    transform 0.1s ease,
    background 0.15s ease;
}

.ctl:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
}

.ctl:active:not(:disabled) {
  transform: scale(0.95);
}

.ctl:disabled {
  opacity: 0.4;
  cursor: default;
}

.ctl[aria-pressed="true"] {
  color: #071d3a;
  background: #ffe9a8;
}

.ctl.alert {
  color: #fff;
  background: #c0392b;
  border-color: #ff8a7a;
  animation: alert 0.6s ease-in-out infinite;
}

@keyframes alert {
  50% {
    box-shadow: 0 0 0 6px rgba(255, 90, 70, 0.35);
  }
}

.notch {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.notch .ctl {
  width: 42px;
}

.alt {
  display: grid;
  min-width: 120px;
  gap: 4px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stats span {
  display: grid;
  gap: 2px;
  font-size: 13px;
}

.stats b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}

.fuel i {
  display: block;
  height: 10px;
  margin-top: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}

.fuel em {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff7a45, #ffd84a);
  transition: width 0.2s linear;
}

.r-region {
  color: #9fd0ff;
}

/* ---------- Journey end ---------- */
.end-card {
  width: min(560px, 100%);
  padding: 30px 26px;
}

.end-emoji {
  margin: 0;
  font-size: 54px;
}

.end-title {
  margin: 8px 0 4px;
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 820;
}

.end-sub {
  margin: 0 0 20px;
  color: rgba(255, 255, 255, 0.7);
}

.end-q {
  margin: 0 0 12px;
  font-weight: 760;
}

.end-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.end-options .glass-btn {
  padding: 9px 10px;
  font-size: 14px;
  border-radius: 16px;
}

.end-reply {
  margin: 0 0 20px;
  font-size: 19px;
  line-height: 1.45;
}

.end-actions,
.sc-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ---------- Star game ---------- */
.game-hud {
  position: fixed;
  top: 14px;
  left: 14px;
  white-space: nowrap;
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 8px 10px 8px 18px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
}

.game-hud.bump {
  animation: bump 0.3s ease;
}

@keyframes bump {
  50% {
    transform: scale(1.08);
  }
}

.game-quit {
  padding: 6px 12px;
  color: #fff;
  font: inherit;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  cursor: pointer;
}

.game-hint {
  position: fixed;
  bottom: 40px;
  left: 0;
  right: 0;
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
}

.game-star {
  position: fixed;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  padding: 0;
  background:
    radial-gradient(circle, #fff 0 10%, rgba(255, 236, 170, 0.9) 18%, rgba(255, 210, 110, 0.35) 38%, transparent 62%);
  border: 0;
  border-radius: 50%;
  cursor: crosshair;
  touch-action: manipulation;
}

.game-star::before,
.game-star::after {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70px;
  height: 3px;
  background: linear-gradient(90deg, transparent, #fff, transparent);
  transform: translate(-50%, -50%);
  content: "";
}

.game-star::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.game-star.flash {
  animation:
    star-in 0.25s ease-out,
    star-blink 0.5s 0.25s ease-in-out infinite alternate;
}

@keyframes star-in {
  from {
    opacity: 0;
    transform: scale(0.2) rotate(-45deg);
  }
}

@keyframes star-blink {
  to {
    opacity: 0.55;
    transform: scale(0.82) rotate(20deg);
  }
}

.game-star:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}

.scorecard {
  width: min(420px, 100%);
  padding: 28px 24px;
}

.sc-badge {
  margin: 0;
  font-size: 60px;
  animation: float 2.4s ease-in-out infinite;
}

.sc-title {
  margin: 6px 0 0;
  color: #e0b35c;
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sc-score {
  margin: 6px 0 16px;
  font-size: 26px;
  font-weight: 820;
}

.sc-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
}

.sc-stats div {
  padding: 10px 6px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 12px;
}

.sc-stats dt {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.sc-stats dd {
  margin: 4px 0 0;
  font-size: 14px;
  overflow-wrap: anywhere;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.sc-note {
  margin: 0 0 18px;
  line-height: 1.45;
}

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .dash {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px 14px;
    padding: 12px;
    left: 8px;
    right: 8px;
    bottom: 8px;
  }

  .controls {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .ctl-main,
  .notch {
    grid-column: span 2;
  }

  .ctl-main[hidden] + .notch {
    grid-column: span 2;
  }

  .gauge {
    width: 88px;
    height: 88px;
  }

  .g-read b,
  .alt b {
    font-size: 24px;
  }

  .alt {
    min-width: 92px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .stats b {
    font-size: 16px;
  }

  .dash-keys,
  .route-stops span:not(:first-child):not(:last-child) em {
    display: none;
  }

  .hud-top {
    font-size: 12px;
    top: calc(4vh + 8px);
  }

  .toast {
    font-size: 13px;
    top: calc(4vh + 52px);
  }

  .end-options {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .splash *,
  .splash {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.screen-pilot.painted-cab .window-frame {
  display: none;
}

/* ---------- Real cab controls ---------- */
.g-limit {
  transform-origin: 60px 60px;
  transform: rotate(-135deg);
  transition: transform 0.4s ease;
}

.g-limit rect {
  fill: #ff5a3c;
  filter: drop-shadow(0 0 3px #ff5a3c);
}

.g-limit.off rect {
  fill: transparent;
  filter: none;
}

.gauge svg .g-limit {
  transform-box: view-box;
}

.g-val.over {
  stroke: #ff5a3c;
  filter: drop-shadow(0 0 6px rgba(255, 90, 60, 0.7));
}

.t-limit {
  display: block;
  margin-top: 3px;
  color: #ff8a6a;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.lamps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.lamp {
  padding: 3px 8px;
  color: rgba(255, 255, 255, 0.35);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.lamp.on {
  color: #062a12;
  background: #4ee28a;
  border-color: #8ff5b8;
  box-shadow: 0 0 10px rgba(78, 226, 138, 0.6);
}

.l-atc.on,
.l-brake.on {
  color: #2a1400;
  background: #ffb02e;
  border-color: #ffd07a;
  box-shadow: 0 0 10px rgba(255, 176, 46, 0.6);
}

.l-tasc.on {
  color: #00203a;
  background: #5cc4ff;
  border-color: #a6e0ff;
  box-shadow: 0 0 10px rgba(92, 196, 255, 0.6);
}

.cab-controls {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px 12px;
  align-items: center;
}

.cab-controls .ctl-main {
  grid-column: 1 / -1;
}

.levers {
  display: flex;
  gap: 14px;
}

.lever {
  display: grid;
  grid-template-columns: 26px auto;
  grid-template-rows: auto 1fr;
  gap: 2px 6px;
  height: 118px;
  touch-action: none;
  cursor: grab;
  user-select: none;
  outline: none;
}

.lever.grab {
  cursor: grabbing;
}

.lever:focus-visible .lever-track {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.lever-name {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.6);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.lever-track {
  position: relative;
  width: 10px;
  margin: 0 auto;
  background: linear-gradient(90deg, #0b0f15, #232b36, #0b0f15);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
}

.lever-knob {
  position: absolute;
  left: 50%;
  top: calc(var(--pos, 1) * 100%);
  width: 28px;
  height: 14px;
  background: linear-gradient(180deg, #e9edf2, #9aa4b1);
  border: 1px solid #fff;
  border-radius: 5px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
  transform: translate(-50%, -50%);
  transition: top 0.12s ease;
}

.lever-power .lever-knob {
  background: linear-gradient(180deg, #ffe08a, #d9a441);
  border-color: #fff3c4;
}

.lever-brake .lever-knob {
  background: linear-gradient(180deg, #ff9a86, #c83a26);
  border-color: #ffd2c8;
}

.lever-power {
  --pos: 1;
}

.lever-brake {
  --pos: 0;
}

.lever-marks {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin: -5px 0;
  padding: 0;
  color: rgba(255, 255, 255, 0.5);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  list-style: none;
}

.lever-brake .lever-marks li:last-child {
  color: #ff7a66;
}

.lever.engaged .lever-name {
  color: #fff;
}

.mini-ctl {
  display: grid;
  gap: 8px;
}

@media (max-width: 760px) {
  .cab-controls {
    grid-template-columns: auto 1fr;
  }

  .lever {
    height: 96px;
  }

  .lamps {
    gap: 4px;
  }

  .lamp {
    padding: 2px 5px;
    font-size: 9px;
  }
}
