:root {
  --ink: #172026;
  --muted: #5c6670;
  --paper: #f7f3eb;
  --platform: #d6d0c2;
  --track: #3a4046;
  --red: #cf2434;
  --green: #168060;
  --yellow: #f0c344;
  --blue: #276fbf;
  --panel: #fffaf0;
  --shadow: 0 18px 40px rgba(17, 24, 31, 0.22);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  min-height: 100%;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #1d252c;
  color: var(--ink);
  overflow: hidden;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.app-frame {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 0;
  overflow: hidden;
  touch-action: manipulation;
  background:
    linear-gradient(180deg, rgba(29, 37, 44, 0.15), rgba(29, 37, 44, 0.42)),
    var(--paper);
}

.device-indicator {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  z-index: 30;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid rgba(38, 49, 58, 0.14);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.86);
  color: #26313a;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  font-size: 1.45rem;
}

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-style: normal;
  font-weight: normal;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.screen[hidden],
.start-screen[hidden] {
  display: none !important;
}

.start-screen {
  display: grid;
  height: 100%;
  min-height: 0;
  align-content: center;
  justify-items: center;
  gap: 24px;
  padding: max(26px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(23, 32, 38, 0.12), rgba(23, 32, 38, 0.36)),
    url("assets/city_hall_platform.png");
  background-position: center;
  background-size: cover;
  overflow: hidden;
  text-align: center;
}

.title-lockup {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.title-lockup h1 {
  max-width: 8ch;
  margin: 0 auto;
  color: #fff2e2;
  font-family: Creepster, Impact, fantasy;
  font-size: clamp(3.3rem, 19vw, 5.8rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.88;
  text-shadow:
    0 3px 0 rgba(23, 32, 38, 0.78),
    0 10px 24px rgba(159, 12, 28, 0.58),
    0 0 18px rgba(207, 36, 52, 0.42);
}

.title-lockup p {
  max-width: min(31ch, calc(100vw - 40px));
  margin: 0;
  color: #fffdf6;
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1.28;
  text-shadow: 0 2px 8px rgba(23, 32, 38, 0.72);
}

.nowrap {
  white-space: nowrap;
}

.start-screen > .primary {
  width: min(100%, 320px);
  padding: 0 18px;
}

.start-actions {
  display: grid;
  width: min(100%, 320px);
  gap: 10px;
}

.start-actions > .primary,
.start-actions > .secondary {
  width: 100%;
  padding: 0 18px;
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.icon-text-button .material-symbols-rounded {
  font-size: 1.25rem;
}

.menu-link {
  text-decoration: none;
}

.challenge-link {
  min-height: 66px;
  line-height: 1.15;
  text-align: center;
}

.post-link {
  width: 100%;
  margin-top: 12px;
  padding: 0 16px;
  text-align: center;
}

.settings-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: max(22px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: var(--panel);
}

.settings-header {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
}

.settings-header h2 {
  margin: 4px 0 0;
  font-size: 1.6rem;
  line-height: 1;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid rgba(38, 49, 58, 0.14);
  border-radius: 999px;
  background: #fff9ea;
  color: #26313a;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
  font-size: 1.35rem;
}

.settings-form {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 2px 18px;
}

.settings-form fieldset {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 2px solid rgba(38, 49, 58, 0.12);
  border-radius: 8px;
  background: #ffffff;
}

.settings-note {
  margin: 0;
  padding: 12px 14px;
  border: 2px solid rgba(38, 49, 58, 0.12);
  border-radius: 8px;
  background: #ffffff;
  color: #33404a;
  font-size: 0.88rem;
  font-weight: 650;
  line-height: 1.35;
}

.settings-form legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-form label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px 38px;
  align-items: center;
  gap: 8px;
  color: #33404a;
  font-size: 0.9rem;
  font-weight: 750;
}

.settings-form input {
  width: 100%;
  min-height: 40px;
  padding: 0 8px;
  border: 2px solid rgba(38, 49, 58, 0.16);
  border-radius: 6px;
  background: #fffaf0;
  color: var(--ink);
  font: inherit;
  text-align: right;
}

.settings-form small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.advanced-settings {
  display: grid;
  gap: 10px;
}

.advanced-settings summary {
  min-height: 42px;
  padding: 10px 12px;
  border: 2px solid rgba(38, 49, 58, 0.12);
  border-radius: 8px;
  background: transparent;
  color: #26313a;
  font-weight: 850;
  list-style-position: inside;
  cursor: pointer;
}

.advanced-settings-body {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.advanced-settings-body p {
  margin: 0;
  color: #33404a;
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.35;
}

.station-duration-settings,
.audio-preview-row {
  display: grid;
  gap: 10px;
}

.audio-preview-row {
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
}

.audio-preview-row label {
  min-width: 0;
}

.preview-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 2px solid rgba(38, 49, 58, 0.14);
  border-radius: 999px;
  background: #fff9ea;
  color: #26313a;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.12);
  font-size: 1.35rem;
}

.preview-button.active {
  background: #26313a;
  color: #fff9ea;
}

.upright-visual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.upright-card {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  padding: 12px 8px;
  border: 2px solid rgba(38, 49, 58, 0.12);
  border-radius: 8px;
  background: #fffaf0;
  color: #26313a;
  text-align: center;
}

.upright-card strong {
  font-size: 0.9rem;
  font-weight: 900;
}

.upright-card small {
  font-size: 0.7rem;
  line-height: 1.15;
  text-transform: none;
}

.upright-card img {
  display: block;
  width: min(100%, 116px);
  height: 76px;
  object-fit: contain;
}

.upright-tester {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.upright-test-status {
  min-width: 96px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(22, 128, 96, 0.14);
  color: #116c50;
  font-size: 0.82rem;
  font-weight: 900;
  text-align: center;
}

.upright-test-status.not-upright {
  background: rgba(207, 36, 52, 0.14);
  color: #a31826;
}

.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding-top: 12px;
}

.settings-actions > button {
  padding: 0 14px;
}

.credits-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
  padding: max(22px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background: var(--panel);
}

.credits-content {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 2px 18px;
}

.credits-content section {
  padding: 16px;
  border: 2px solid rgba(38, 49, 58, 0.12);
  border-radius: 8px;
  background: #ffffff;
}

.credits-content h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.credits-content p {
  margin: 0;
  color: #26313a;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
}

.credits-content a:not(.primary):not(.secondary) {
  color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.success-screen {
  position: relative;
  display: grid;
  height: 100%;
  min-height: 0;
  align-content: center;
  justify-items: center;
  gap: 28px;
  padding: max(34px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom));
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 250, 240, 0.82), rgba(255, 250, 240, 0.96)),
    url("assets/mrt_interior.jpg");
  background-position: center;
  background-size: cover;
  text-align: center;
}

.success-copy {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 12px;
}

.success-copy h2 {
  max-width: 8ch;
  margin: 0;
  font-size: clamp(3rem, 16vw, 5rem);
  line-height: 0.88;
}

.success-copy p {
  max-width: 28ch;
  margin: 0;
  color: #33404a;
  font-size: 1.05rem;
  font-weight: 850;
  line-height: 1.35;
}

.success-screen > .primary {
  position: relative;
  z-index: 2;
  width: min(100%, 320px);
  padding: 0 18px;
  background: var(--green);
  box-shadow: 0 10px 18px rgba(22, 128, 96, 0.24);
}

.confetti {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}

.confetti span {
  position: absolute;
  top: -10%;
  left: calc(var(--x) * 1%);
  width: 10px;
  height: 18px;
  border-radius: 3px;
  background: var(--c);
  animation: confetti-fall var(--d) linear infinite;
  animation-delay: var(--delay);
  transform: rotate(var(--r));
}

.confetti span:nth-child(1) {
  --x: 8;
  --c: #cf2434;
  --d: 4.8s;
  --delay: -0.2s;
  --r: 14deg;
}

.confetti span:nth-child(2) {
  --x: 17;
  --c: #f0c344;
  --d: 5.4s;
  --delay: -1.8s;
  --r: -24deg;
}

.confetti span:nth-child(3) {
  --x: 26;
  --c: #168060;
  --d: 4.4s;
  --delay: -1s;
  --r: 31deg;
}

.confetti span:nth-child(4) {
  --x: 35;
  --c: #276fbf;
  --d: 5.9s;
  --delay: -2.8s;
  --r: 9deg;
}

.confetti span:nth-child(5) {
  --x: 44;
  --c: #cf2434;
  --d: 5.1s;
  --delay: -3.2s;
  --r: -38deg;
}

.confetti span:nth-child(6) {
  --x: 53;
  --c: #f0c344;
  --d: 4.7s;
  --delay: -2s;
  --r: 45deg;
}

.confetti span:nth-child(7) {
  --x: 62;
  --c: #168060;
  --d: 5.7s;
  --delay: -0.8s;
  --r: -16deg;
}

.confetti span:nth-child(8) {
  --x: 71;
  --c: #276fbf;
  --d: 4.9s;
  --delay: -3.6s;
  --r: 22deg;
}

.confetti span:nth-child(9) {
  --x: 80;
  --c: #cf2434;
  --d: 5.3s;
  --delay: -1.4s;
  --r: -31deg;
}

.confetti span:nth-child(10) {
  --x: 88;
  --c: #f0c344;
  --d: 4.6s;
  --delay: -2.4s;
  --r: 18deg;
}

.confetti span:nth-child(11) {
  --x: 95;
  --c: #168060;
  --d: 5.8s;
  --delay: -4s;
  --r: -12deg;
}

.confetti span:nth-child(12) {
  --x: 3;
  --c: #276fbf;
  --d: 5.2s;
  --delay: -3s;
  --r: 36deg;
}

@keyframes confetti-fall {
  0% {
    transform: translate3d(-12px, -20%, 0) rotate(var(--r));
  }

  100% {
    transform: translate3d(18px, 120vh, 0) rotate(calc(var(--r) + 540deg));
  }
}

.game {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--paper);
}

.game.rush-shake {
  animation: rush-screen-shake 180ms cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.game.auntie-shake {
  animation: auntie-screen-shake 140ms linear infinite;
}

@keyframes rush-screen-shake {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  18% {
    transform: translate3d(-5px, 2px, 0) rotate(-0.35deg);
  }

  36% {
    transform: translate3d(6px, -2px, 0) rotate(0.4deg);
  }

  54% {
    transform: translate3d(-4px, -1px, 0) rotate(-0.25deg);
  }

  72% {
    transform: translate3d(3px, 1px, 0) rotate(0.18deg);
  }
}

@keyframes auntie-screen-shake {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  25% {
    transform: translate3d(var(--auntie-shake-x), var(--auntie-shake-y-neg), 0);
  }

  50% {
    transform: translate3d(var(--auntie-shake-x-neg), var(--auntie-shake-y), 0);
  }

  75% {
    transform: translate3d(var(--auntie-shake-y), var(--auntie-shake-x-neg), 0);
  }
}

.scene {
  position: relative;
  isolation: isolate;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.08), rgba(23, 32, 38, 0.16));
}

.scene::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(255, 250, 240, 0.04), rgba(23, 32, 38, 0.18));
  content: "";
  pointer-events: none;
}

.scene::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  background-image: url("assets/city_hall_platform.png");
  background-position: center;
  background-size: cover;
  content: "";
  pointer-events: none;
}

.scene.doors-open::after {
  background-image: url("assets/city_hall_platform_doors_open.png");
}

.station-sign {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: 50%;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 2px solid #26313a;
  border-radius: 6px;
  background: #fff9ea;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
  font-size: 0.95rem;
  font-weight: 800;
  transform: translateX(-50%);
}

.line-code {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 4px;
  background: var(--red);
  color: white;
  font-size: 0.8rem;
  letter-spacing: 0;
}

.status-ribbon {
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(23, 32, 38, 0.86);
  color: #fffdf6;
  font-size: 0.9rem;
  font-weight: 750;
}

.status-ribbon.success {
  background: var(--green);
}

.status-ribbon.danger {
  background: var(--red);
}

.status-text {
  position: absolute;
  top: max(74px, calc(env(safe-area-inset-top) + 68px));
  left: 50%;
  z-index: 60;
  width: min(calc(100% - 32px), 380px);
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(23, 32, 38, 0.94);
  color: #fffdf6;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28);
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.25;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -12px);
  transition:
    opacity 420ms ease,
    transform 420ms ease;
}

.status-text.success {
  background: rgba(22, 128, 96, 0.96);
}

.status-text.danger {
  background: rgba(207, 36, 52, 0.96);
}

.status-text.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.status-text[hidden] {
  display: none;
}

.skip-button {
  position: absolute;
  top: 50%;
  right: max(12px, env(safe-area-inset-right));
  z-index: 70;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid rgba(38, 49, 58, 0.16);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.92);
  color: #26313a;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
  font-size: 1.55rem;
  transform: translateY(-50%);
}

.skip-button:disabled {
  opacity: 0.42;
}

.skip-button[hidden] {
  display: none;
}

.sleep-dim {
  position: absolute;
  inset: 0;
  z-index: 55;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

.auntie-vignette {
  position: absolute;
  inset: 0;
  z-index: 54;
  background:
    radial-gradient(
      circle at center,
      rgba(207, 36, 52, 0) 38%,
      rgba(207, 36, 52, 0.34) 72%,
      rgba(143, 15, 31, 0.72) 100%
    ),
    rgba(207, 36, 52, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms linear;
}

.train {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: url("assets/mrt_train.png");
  background-position: center;
  background-size: cover;
  transform: translateX(-105%);
  transition: transform 4000ms cubic-bezier(0.22, 0.9, 0.25, 1);
  will-change: transform;
}

.train.approaching,
.train.arrived {
  transform: translateX(0);
}

.train.boarding {
  background-image: url("assets/mrt_train_doors_open.png");
}

.train > * {
  display: none;
}

.train.boarding .door.left {
  transform: translateX(-28px);
}

.train.boarding .door.right {
  transform: translateX(28px);
}

.train-light {
  position: absolute;
  right: -14px;
  bottom: 44px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 26px 10px rgba(240, 195, 68, 0.4);
}

.train-car {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border: 3px solid #26313a;
  border-radius: 8px 22px 8px 8px;
  background: linear-gradient(180deg, #f2f6f4 0 25%, #d9e1e0 25% 100%);
  box-shadow: var(--shadow);
}

.train-car::before {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  height: 10px;
  background: var(--red);
  content: "";
}

.train-car::after {
  position: absolute;
  right: 24px;
  bottom: 14px;
  width: 130px;
  height: 12px;
  border-radius: 999px;
  background: #434c54;
  box-shadow: -360px 0 0 #434c54;
  content: "";
}

.window {
  position: absolute;
  top: 18px;
  left: 36px;
  width: 134px;
  height: 46px;
  border: 3px solid #26313a;
  border-radius: 6px;
  background: linear-gradient(135deg, #91c7db, #e4f4f4);
}

.window.small {
  left: auto;
  right: 42px;
  width: 112px;
}

.door {
  position: absolute;
  top: 16px;
  bottom: 18px;
  width: 92px;
  border: 3px solid #26313a;
  background: linear-gradient(180deg, #eef3f1 0 23%, #c8d1d0 23%);
  transition: transform 520ms ease;
}

.door::before {
  position: absolute;
  top: 8px;
  left: 12px;
  right: 12px;
  height: 42px;
  border: 3px solid #26313a;
  border-radius: 5px;
  background: linear-gradient(135deg, #86bdd2, #d9f3ee);
  content: "";
}

.door.left {
  left: 236px;
  border-radius: 6px 0 0 6px;
}

.door.right {
  left: 328px;
  border-radius: 0 6px 6px 0;
}

.platform-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 27%;
  display: none;
  height: 16px;
  background: repeating-linear-gradient(90deg, var(--yellow) 0 48px, transparent 48px 72px);
  box-shadow: 0 10px 0 rgba(32, 35, 37, 0.16);
}

.queue {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 16%;
  display: none;
  justify-content: center;
  align-items: end;
  gap: clamp(8px, 3vw, 18px);
  transition:
    transform 420ms ease,
    opacity 320ms ease;
}

.queue.rushing {
  transform: translateY(-12px) scale(1.03);
}

.queue.hidden {
  opacity: 0;
}

.commuter {
  position: relative;
  width: 28px;
  height: 74px;
  border-radius: 14px 14px 8px 8px;
  background: var(--blue);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.16);
}

.commuter::before {
  position: absolute;
  top: -23px;
  left: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #8f5c46;
  content: "";
}

.commuter::after {
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: -18px;
  height: 22px;
  border-radius: 6px;
  background: #2f3439;
  content: "";
}

.commuter.player {
  width: 34px;
  height: 84px;
  background: var(--green);
}

.commuter.bag {
  background: #7d5fbc;
}

.commuter.bag::after {
  right: -8px;
  bottom: 6px;
  left: auto;
  width: 14px;
  height: 22px;
  border-radius: 4px;
  background: #2d2838;
}

.commuter.cap {
  background: #d86f45;
}

.commuter.cap::before {
  box-shadow: 7px -3px 0 -3px #24313a;
}

.commuter.tote {
  background: #5c8b8b;
}

.train-interior {
  position: absolute;
  inset: 0;
  z-index: 4;
  background:
    linear-gradient(180deg, rgba(23, 32, 38, 0.08), rgba(23, 32, 38, 0.18)),
    url("assets/mrt_interior.jpg");
  background-position: center;
  background-size: cover;
}

.train-interior[hidden] {
  display: none;
}

.auntie-event {
  position: absolute;
  top: 10%;
  bottom: 0;
  z-index: 7;
  display: flex;
  width: min(46%, 220px);
  align-items: end;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 420ms ease,
    transform var(--auntie-slide-duration, 2200ms) cubic-bezier(0.22, 0.82, 0.26, 1);
}

.auntie-event.from-left {
  left: 0;
  justify-content: flex-start;
  transform: translateX(-112%);
}

.auntie-event.from-right {
  right: 0;
  justify-content: flex-end;
  transform: translateX(112%);
}

.auntie-event.visible {
  opacity: 1;
  transform: translateX(0);
}

.auntie-event img {
  max-width: 100%;
  max-height: 82%;
  object-fit: contain;
  filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.28));
}

.auntie-event[hidden] {
  display: none;
}

.hud {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  padding: 18px 18px max(18px, env(safe-area-inset-bottom));
  background: var(--panel);
  box-shadow: 0 -16px 30px rgba(0, 0, 0, 0.16);
}

.station-segment {
  display: grid;
  grid-template-columns: minmax(78px, auto) 1fr minmax(78px, auto);
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.station-segment > span:last-child {
  text-align: right;
}

.segment-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #d7d1c4;
}

.segment-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b91f2d, #e54555);
  transition: width 180ms linear;
}

.meters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.meters[hidden] {
  display: none;
}

.meters.single {
  grid-template-columns: 1fr;
}

.meter {
  min-width: 0;
  padding: 13px 14px;
  border: 2px solid rgba(38, 49, 58, 0.12);
  border-radius: 8px;
  background: #ffffff;
}

.meter[hidden] {
  display: none;
}

.meter span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.meter strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(1.25rem, 8vw, 2.35rem);
  line-height: 1;
}

.message {
  min-height: 48px;
  margin: 0;
  color: #33404a;
  font-size: 1rem;
  font-weight: 720;
  line-height: 1.35;
}

.actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: auto;
}

.primary,
.secondary,
.sensor-fallback {
  min-height: 54px;
  border-radius: 8px;
  font-weight: 850;
  letter-spacing: 0;
}

.primary {
  background: var(--red);
  color: white;
  box-shadow: 0 10px 18px rgba(207, 36, 52, 0.25);
}

.primary:active {
  transform: translateY(2px);
}

.action-button {
  position: relative;
  overflow: hidden;
  min-height: 82px;
  border: 3px solid transparent;
  background: var(--green);
  font-size: 1.35rem;
  box-shadow: 0 12px 22px rgba(22, 128, 96, 0.26);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.action-button[data-action="rush"] {
  border-color: #ffb000;
  background: linear-gradient(180deg, #ffe45c 0%, #ffb000 48%, #ff7a00 100%);
  color: #172026;
  box-shadow:
    0 0 0 4px rgba(255, 176, 0, 0.24),
    0 14px 28px rgba(255, 122, 0, 0.38);
}

.action-button[data-action="rush"]::before,
.action-button[data-action="rush"]::after {
  position: absolute;
  right: 18px;
  bottom: 14px;
  left: 18px;
  height: 8px;
  border-radius: 999px;
  content: "";
}

.action-button[data-action="rush"]::before {
  background: rgba(23, 32, 38, 0.2);
}

.action-button[data-action="rush"]::after {
  width: calc(100% - 36px);
  background: linear-gradient(90deg, #8f0f1f, #cf2434);
  transform: scaleX(var(--seat-progress-ratio, 0));
  transform-origin: left center;
  transition: transform 120ms linear;
}

.action-button.seat-ready {
  border-color: #f0c344;
  box-shadow: 0 0 0 4px rgba(240, 195, 68, 0.22), 0 12px 22px rgba(22, 128, 96, 0.26);
}

.action-button[data-action="rush"].seat-ready::after {
  background: linear-gradient(90deg, #137457, #24a77b);
}

.action-button[data-action="sleep"] {
  border-color: #f7f3eb;
  background: linear-gradient(180deg, #1f2933, #0d1116);
  color: #fffaf0;
  touch-action: none;
  box-shadow:
    0 0 0 4px rgba(23, 32, 38, 0.22),
    0 14px 28px rgba(0, 0, 0, 0.34);
}

.action-button[data-action="walk"] {
  border-color: #f0c344;
  background: linear-gradient(180deg, #26313a, #172026);
  color: #fffdf6;
  box-shadow:
    0 0 0 4px rgba(240, 195, 68, 0.18),
    0 14px 28px rgba(0, 0, 0, 0.3);
}

.action-button:disabled {
  background: #8b949b;
  color: #f2f4f3;
  box-shadow: none;
}

.action-button:disabled:active {
  transform: none;
}

.secondary {
  background: #26313a;
  color: white;
}

.secondary.compact {
  min-height: 44px;
  background: #3f4a52;
  font-size: 0.92rem;
}

.sensor-fallback {
  justify-self: center;
  min-height: 40px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  text-decoration: underline;
}

.upright-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  background: rgba(23, 32, 38, 0.68);
  color: white;
  font-size: clamp(1.5rem, 8vw, 3rem);
  font-weight: 900;
  text-align: center;
  pointer-events: none;
}

.upright-overlay[hidden] {
  display: none;
}

.upright-overlay img {
  width: min(76%, 280px);
  max-height: 48vh;
  object-fit: contain;
  filter: drop-shadow(0 12px 22px rgba(0, 0, 0, 0.35));
}

.arrival-pulse .station-sign {
  animation: pulse 700ms ease alternate infinite;
}

@keyframes pulse {
  from {
    transform: translate(-50%, 0);
  }

  to {
    transform: translate(-50%, -3px);
  }
}

@media (min-width: 760px) {
  body {
    display: grid;
    min-height: 100vh;
    place-items: center;
    overflow: auto;
    padding: 28px;
  }

  .app-frame {
    width: min(430px, 100%);
    height: min(880px, calc(100vh - 56px));
    min-height: 0;
    overflow: hidden;
    border: 8px solid #10171c;
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  }

  .game,
  .start-screen,
  .success-screen {
    height: 100%;
    min-height: 0;
  }
}

@media (max-height: 690px) {
  .game {
    grid-template-rows: minmax(0, 1fr) auto;
  }

  .hud {
    gap: 10px;
    padding-top: 12px;
  }

  .message {
    min-height: 38px;
    font-size: 0.94rem;
  }

  .action-button {
    min-height: 62px;
  }
}
