/* Lost In Space - base */
:root {
  --gsa-bg: #060a12;
  --gsa-panel: rgba(8, 16, 28, 0.82);
  --gsa-line: rgba(94, 214, 255, 0.35);
  --gsa-cyan: #5ed6ff;
  --gsa-cyan-dim: #2e7d99;
  --gsa-orange: #ff9d33;
  --gsa-white: #e8f2f8;
  --gsa-red: #ff4444;
  --gsa-green: #7dff8a;
  --alien-green: #58ff9d;
  --font-hud: 'Consolas', 'Lucida Console', monospace;
  --font-title: 'Segoe UI', 'Arial', sans-serif;
}

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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--gsa-bg);
  font-family: var(--font-hud);
  color: var(--gsa-white);
  user-select: none;
}

#game-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
}

.hidden { display: none !important; }

/* ═══ Screens (fullscreen states) ═══ */
.screen {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  z-index: 50;
}

.screen.overlay {
  background:
    linear-gradient(180deg, rgba(4, 8, 16, 0.88) 0%, rgba(4, 10, 18, 0.94) 100%);
  backdrop-filter: blur(3px);
}

.screen-title {
  font-family: var(--font-title);
  font-size: 42px;
  font-weight: 200;
  letter-spacing: 14px;
  color: var(--gsa-white);
  text-shadow: 0 0 24px rgba(94, 214, 255, 0.45);
}
.screen-title.red { color: var(--gsa-red); text-shadow: 0 0 24px rgba(255, 68, 68, 0.5); }

.pause-sub {
  font-size: 12px; letter-spacing: 5px;
  color: var(--gsa-cyan-dim);
}
.pause-sub.big { font-size: 20px; letter-spacing: 8px; color: var(--gsa-cyan); animation: pulse-sub 2s infinite; }
@keyframes pulse-sub { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }

/* ═══ Loading ═══ */
#screen-loading {
  background: radial-gradient(ellipse at 50% 40%, #0a1524 0%, #04070d 70%);
  z-index: 90;
}

.gsa-logo {
  width: 110px; height: 110px;
  border: 1px solid rgba(218, 170, 92, 0.45);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: visible;
  color: transparent;
  font-size: 0;
  line-height: 0;
  text-indent: -9999px;
  background-color: rgba(2, 4, 10, 0.45);
  background-image: url("../assets/ui/lost-in-space/lost-in-space-clean-badge.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 118% 118%;
  box-shadow: 0 0 40px rgba(218, 170, 92, 0.22), inset 0 0 24px rgba(94, 214, 255, 0.08);
}
.gsa-logo img {
  width: 118%;
  height: 118%;
  object-fit: contain;
  border-radius: 50%;
  filter:
    drop-shadow(0 0 16px rgba(218, 170, 92, 0.35))
    drop-shadow(0 0 24px rgba(94, 214, 255, 0.18));
  position: relative;
  z-index: 1;
  text-indent: 0;
}
.gsa-logo::after {
  content: '';
  position: absolute; inset: -12px;
  border: 1px solid rgba(218, 170, 92, 0.28);
  border-radius: 50%;
  border-top-color: var(--gsa-cyan);
  border-right-color: rgba(94, 214, 255, 0.12);
  animation: logo-orbit 4s linear infinite;
}
@keyframes logo-orbit { to { transform: rotate(360deg); } }
.gsa-logo.small { width: 86px; height: 86px; }

.loading-title {
  font-family: var(--font-title);
  font-size: 26px; font-weight: 200; letter-spacing: 10px;
  margin-top: 12px;
}
.loading-sub {
  font-size: 13px; letter-spacing: 12px;
  color: var(--gsa-orange);
}

.loading-bar-wrap {
  width: 320px; height: 3px;
  background: rgba(94, 214, 255, 0.15);
  margin-top: 26px;
}
#loading-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--gsa-cyan-dim), var(--gsa-cyan));
  box-shadow: 0 0 12px rgba(94, 214, 255, 0.6);
  transition: width 0.25s ease;
}
#loading-status {
  font-size: 11px; letter-spacing: 2px;
  color: var(--gsa-cyan-dim);
}

/* ═══ Startup splash ═══ */
#screen-splash {
  z-index: 95;
  overflow: hidden;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(2, 4, 10, 0.98) 0%, rgba(6, 12, 20, 0.96) 46%, rgba(1, 3, 8, 1) 100%);
}
#screen-splash::before,
#screen-splash::after {
  content: '';
  position: absolute;
  inset: 0;
}
#screen-splash::before {
  background:
    linear-gradient(115deg, transparent 0%, rgba(94, 214, 255, 0.08) 44%, rgba(255, 157, 51, 0.18) 50%, rgba(94, 214, 255, 0.08) 56%, transparent 100%);
  transform: translateX(-130%);
}
#screen-splash::after {
  background:
    linear-gradient(90deg, rgba(94, 214, 255, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(94, 214, 255, 0.035) 1px, transparent 1px);
  background-size: 78px 78px;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 20%, black 75%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, black 20%, black 75%, transparent 100%);
  opacity: 0;
}

.splash-stars,
.splash-scanline {
  position: absolute;
  inset: 0;
}
.splash-stars {
  background-image:
    radial-gradient(circle at 12% 18%, rgba(232, 242, 248, 0.75) 0 1px, transparent 2px),
    radial-gradient(circle at 28% 72%, rgba(94, 214, 255, 0.7) 0 1px, transparent 2px),
    radial-gradient(circle at 44% 26%, rgba(232, 242, 248, 0.5) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 64%, rgba(255, 157, 51, 0.6) 0 1px, transparent 2px),
    radial-gradient(circle at 86% 34%, rgba(232, 242, 248, 0.75) 0 1px, transparent 2px);
  background-size: 360px 240px;
  opacity: 0.42;
}
.splash-scanline {
  background: linear-gradient(180deg, transparent 0%, rgba(94, 214, 255, 0.15) 50%, transparent 100%);
  height: 34%;
  top: -38%;
  opacity: 0;
}

.splash-stage {
  position: relative;
  width: min(1100px, 100vw);
  height: min(680px, 100vh);
  display: flex;
  align-items: center;
  justify-content: center;
}
.splash-mark {
  position: absolute;
  object-fit: contain;
  opacity: 0;
  transform-origin: center;
  filter: drop-shadow(0 0 22px rgba(94, 214, 255, 0.28));
}
.splash-games-logo {
  width: min(250px, 24vw);
  top: 8%;
  left: 50%;
  transform: translate(-50%, -18px) scale(0.82);
  filter: drop-shadow(0 0 28px rgba(232, 242, 248, 0.28));
}
.splash-agency-logo {
  width: min(170px, 18vw);
  right: 8%;
  top: 17%;
  transform: translateY(-8px) rotate(8deg) scale(0.86);
}
.splash-cast {
  position: absolute;
  inset: 0;
}
.splash-character {
  position: absolute;
  bottom: -5%;
  width: auto;
  object-fit: contain;
  opacity: 0;
  filter:
    drop-shadow(0 20px 24px rgba(0, 0, 0, 0.6))
    drop-shadow(0 0 18px rgba(94, 214, 255, 0.16));
}
.splash-fred {
  left: 4%;
  max-height: 76%;
  transform: translateX(-80px) scale(0.94);
}
.splash-mary {
  left: 50%;
  max-height: 69%;
  transform: translateX(-50%) translateY(46px) scale(0.88);
  filter:
    drop-shadow(0 20px 24px rgba(0, 0, 0, 0.62))
    drop-shadow(0 0 16px rgba(255, 157, 51, 0.16));
}
.splash-tim {
  right: 3%;
  max-height: 76%;
  transform: translateX(80px) scale(0.94);
}
.splash-title {
  position: relative;
  z-index: 2;
  text-align: center;
  padding-top: 92px;
  text-shadow: 0 0 26px rgba(94, 214, 255, 0.55), 0 2px 18px rgba(0, 0, 0, 0.95);
  opacity: 0;
  transform: translateY(24px) scale(0.98);
}
.splash-title span,
.splash-title strong {
  display: block;
}
.splash-title span {
  font-family: var(--font-title);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--gsa-white);
}
.splash-title strong {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 14px;
  color: var(--gsa-orange);
}

#screen-splash.splash-run::before { animation: splash-light-sweep 5.6s ease-out forwards; }
#screen-splash.splash-run::after { animation: splash-grid 5.6s ease-out forwards; }
#screen-splash.splash-run .splash-stars { animation: splash-stars 5.6s ease-out forwards; }
#screen-splash.splash-run .splash-scanline { animation: splash-scan 5.6s ease-out forwards; }
#screen-splash.splash-run .splash-games-logo { animation: splash-games-logo 5.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
#screen-splash.splash-run .splash-agency-logo { animation: splash-agency-logo 5.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
#screen-splash.splash-run .splash-fred { animation: splash-fred 5.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
#screen-splash.splash-run .splash-mary { animation: splash-mary 5.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
#screen-splash.splash-run .splash-tim { animation: splash-tim 5.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
#screen-splash.splash-run .splash-title { animation: splash-title 5.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes splash-light-sweep {
  0% { transform: translateX(-130%); opacity: 0; }
  15% { opacity: 1; }
  62% { transform: translateX(130%); opacity: 0.7; }
  100% { transform: translateX(130%); opacity: 0; }
}
@keyframes splash-grid {
  0%, 14% { opacity: 0; transform: perspective(700px) rotateX(58deg) translateY(110px); }
  30%, 76% { opacity: 0.5; transform: perspective(700px) rotateX(58deg) translateY(30px); }
  100% { opacity: 0; transform: perspective(700px) rotateX(58deg) translateY(0); }
}
@keyframes splash-stars {
  0% { opacity: 0; transform: scale(1.05); }
  18%, 78% { opacity: 0.42; }
  100% { opacity: 0; transform: scale(1.16); }
}
@keyframes splash-scan {
  0%, 8% { opacity: 0; top: -38%; }
  18% { opacity: 0.45; }
  54% { opacity: 0.12; top: 100%; }
  100% { opacity: 0; top: 100%; }
}
@keyframes splash-games-logo {
  0% { opacity: 0; transform: translate(-50%, -22px) scale(0.78); }
  16%, 70% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -10px) scale(1.04); }
}
@keyframes splash-agency-logo {
  0%, 18% { opacity: 0; transform: translateY(-8px) rotate(8deg) scale(0.86); }
  34%, 72% { opacity: 0.92; transform: translateY(0) rotate(0deg) scale(1); }
  100% { opacity: 0; transform: translateY(-4px) rotate(-4deg) scale(1.04); }
}
@keyframes splash-fred {
  0%, 10% { opacity: 0; transform: translateX(-80px) scale(0.94); }
  28%, 82% { opacity: 0.75; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(-18px) scale(1.02); }
}
@keyframes splash-mary {
  0%, 16% { opacity: 0; transform: translateX(-50%) translateY(46px) scale(0.88); }
  34%, 82% { opacity: 0.66; transform: translateX(-50%) translateY(20px) scale(0.98); }
  100% { opacity: 0; transform: translateX(-50%) translateY(10px) scale(1.02); }
}
@keyframes splash-tim {
  0%, 12% { opacity: 0; transform: translateX(80px) scale(0.94); }
  30%, 82% { opacity: 0.75; transform: translateX(0) scale(1); }
  100% { opacity: 0; transform: translateX(18px) scale(1.02); }
}
@keyframes splash-title {
  0%, 12% { opacity: 0; transform: translateY(24px) scale(0.98); }
  24%, 82% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-10px) scale(1.02); }
}

@media (max-width: 760px) {
  .splash-stage { height: 100vh; }
  .splash-games-logo {
    width: 172px;
    top: 9%;
  }
  .splash-agency-logo {
    width: 92px;
    right: 4%;
    top: 18%;
  }
  .splash-title {
    padding-top: 60px;
    width: 92vw;
  }
  .splash-title span {
    font-size: 28px;
    letter-spacing: 5px;
  }
  .splash-title strong {
    font-size: 14px;
    letter-spacing: 9px;
  }
  .splash-fred {
    left: -13%;
    max-height: 58%;
  }
  .splash-mary {
    max-height: 51%;
    bottom: -7%;
  }
  .splash-tim {
    right: -19%;
    max-height: 58%;
  }
}

@media (prefers-reduced-motion: reduce) {
  #screen-splash.splash-run::before,
  #screen-splash.splash-run::after,
  #screen-splash.splash-run .splash-stars,
  #screen-splash.splash-run .splash-scanline,
  #screen-splash.splash-run .splash-games-logo,
  #screen-splash.splash-run .splash-agency-logo,
  #screen-splash.splash-run .splash-fred,
  #screen-splash.splash-run .splash-mary,
  #screen-splash.splash-run .splash-tim,
  #screen-splash.splash-run .splash-title {
    animation-duration: 3.2s;
  }
}

/* Minimal Gurnerman Games studio sting */
#screen-splash {
  --studio-splash-duration: 9.2s;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(21, 33, 42, 0.62) 0%, rgba(5, 9, 15, 0.92) 42%, #000 78%),
    linear-gradient(180deg, #000 0%, #03060c 48%, #000 100%);
  opacity: 1;
}
#screen-splash::before {
  background:
    linear-gradient(115deg, transparent 0%, rgba(94, 214, 255, 0.04) 38%, rgba(255, 255, 255, 0.16) 48%, rgba(255, 68, 68, 0.08) 56%, transparent 68%),
    repeating-linear-gradient(90deg, rgba(94, 214, 255, 0.018) 0 1px, transparent 1px 92px);
  transform: translateX(-145%);
  mix-blend-mode: screen;
  opacity: 0;
}
#screen-splash::after {
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 5px),
    radial-gradient(ellipse at 50% 52%, transparent 0%, rgba(0, 0, 0, 0.28) 68%, rgba(0, 0, 0, 0.74) 100%);
  -webkit-mask-image: none;
  mask-image: none;
  opacity: 0;
}
.splash-stars {
  background-image:
    radial-gradient(circle at 13% 20%, rgba(232, 242, 248, 0.68) 0 1px, transparent 2px),
    radial-gradient(circle at 31% 74%, rgba(94, 214, 255, 0.42) 0 1px, transparent 2px),
    radial-gradient(circle at 61% 24%, rgba(232, 242, 248, 0.48) 0 1px, transparent 2px),
    radial-gradient(circle at 79% 69%, rgba(255, 68, 68, 0.34) 0 1px, transparent 2px),
    radial-gradient(circle at 91% 36%, rgba(232, 242, 248, 0.56) 0 1px, transparent 2px);
  background-size: 420px 280px;
  opacity: 0.14;
}
.splash-scanline {
  height: 22%;
  top: -24%;
  background: linear-gradient(180deg, transparent, rgba(94, 214, 255, 0.22), transparent);
}
.splash-stage {
  width: min(920px, 94vw);
  height: min(640px, 90vh);
  flex-direction: column;
  gap: 18px;
  position: relative;
}
.splash-logo-wrap {
  position: relative;
  width: min(470px, 64vw);
  aspect-ratio: 1;
  transform-origin: center;
  display: grid;
  place-items: center;
}
.splash-logo-wrap::before,
.splash-logo-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: url("../assets/ui/gurnerman/gurnerman-games-logo.png") center / contain no-repeat;
  opacity: 0;
  pointer-events: none;
}
.splash-logo-wrap::before {
  filter: brightness(1.45) sepia(1) saturate(7) hue-rotate(145deg);
  mix-blend-mode: screen;
}
.splash-logo-wrap::after {
  filter: brightness(1.5) sepia(1) saturate(9) hue-rotate(300deg);
  mix-blend-mode: screen;
}
.splash-mark,
.splash-games-logo {
  position: relative;
  inset: auto;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transform: scale(1.06);
  filter:
    brightness(1.02)
    drop-shadow(0 0 26px rgba(232, 242, 248, 0.24))
    drop-shadow(0 0 56px rgba(94, 214, 255, 0.2));
}
#screen-splash:not(.splash-run) .splash-games-logo {
  opacity: 1;
  transform: scale(1.08);
}
#screen-splash:not(.splash-run) .splash-title {
  opacity: 0.86;
  transform: translate(-50%, 0) scale(1);
}
.splash-agency-logo,
.splash-cast,
.splash-character {
  display: none;
}
.splash-title {
  position: absolute;
  left: 50%;
  top: calc(100% + clamp(54px, 8.5vh, 76px));
  z-index: 3;
  width: max-content;
  max-width: 92vw;
  padding-top: 0;
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, 14px) scale(0.98);
  text-shadow: 0 0 24px rgba(94, 214, 255, 0.36), 0 0 44px rgba(255, 68, 68, 0.16);
  pointer-events: none;
  white-space: nowrap;
}
.splash-title strong {
  --presents-tracking: clamp(11px, 1.45vw, 22px);
  display: inline-block;
  margin-top: 0;
  font-size: clamp(18px, 2.1vw, 30px);
  font-weight: 400;
  letter-spacing: var(--presents-tracking);
  text-indent: var(--presents-tracking);
  color: rgba(232, 242, 248, 0.82);
}
#screen-splash.splash-run { animation: studio-screen-fade var(--studio-splash-duration) ease-in-out forwards; }
#screen-splash.splash-run::before { animation: studio-light-sweep var(--studio-splash-duration) ease-in-out forwards; }
#screen-splash.splash-run::after { animation: studio-static-field var(--studio-splash-duration) linear forwards; }
#screen-splash.splash-run .splash-stars { animation: studio-starfield var(--studio-splash-duration) ease-in-out forwards; }
#screen-splash.splash-run .splash-scanline { animation: studio-scanline var(--studio-splash-duration) ease-in-out forwards; }
#screen-splash.splash-run .splash-logo-wrap { animation: studio-logo-float var(--studio-splash-duration) ease-in-out forwards; }
#screen-splash.splash-run .splash-logo-wrap::before { animation: studio-red-channel var(--studio-splash-duration) ease-in-out forwards; }
#screen-splash.splash-run .splash-logo-wrap::after { animation: studio-cyan-channel var(--studio-splash-duration) ease-in-out forwards; }
#screen-splash.splash-run .splash-games-logo { animation: studio-logo-reveal var(--studio-splash-duration) ease-in-out forwards; }
#screen-splash.splash-run .splash-title { animation: studio-presents var(--studio-splash-duration) ease-in-out forwards; }

@keyframes studio-screen-fade {
  0% { opacity: 0; }
  13%, 82% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes studio-logo-reveal {
  0% { opacity: 0; transform: scale(0.82); filter: brightness(0.2) blur(5px); }
  15% { opacity: 1; transform: scale(1.05); filter: brightness(1.04) blur(0); }
  55% { opacity: 1; transform: scale(1.13); filter: brightness(1.02) blur(0); }
  61% { opacity: 1; transform: scale(1.16); filter: brightness(1.16) contrast(1.08); }
  66% { opacity: 0.72; transform: translateX(-10px) scale(1.17) skewX(-2deg); filter: brightness(1.9) contrast(1.35); }
  69% { opacity: 1; transform: translateX(8px) scale(1.18) skewX(1deg); filter: brightness(0.85) contrast(1.75); }
  73% { opacity: 1; transform: scale(1.18); filter: brightness(1.08); }
  78% { opacity: 0.86; transform: translateY(-5px) scale(1.2); filter: brightness(1.75) blur(0.5px); }
  83% { opacity: 0.98; transform: scale(1.21); filter: brightness(1.04); }
  100% { opacity: 0; transform: scale(1.28); filter: brightness(0) blur(8px); }
}
@keyframes studio-presents {
  0%, 18% { opacity: 0; transform: translate(-50%, 14px) scale(0.98); }
  30% { opacity: 0.9; transform: translate(-50%, 0) scale(1); }
  61% { opacity: 0.94; transform: translate(-50%, 0) scale(1); }
  67% { opacity: 0.48; transform: translate(calc(-50% + 7px), 0) scale(1.02); }
  70% { opacity: 0.92; transform: translate(calc(-50% - 5px), 0) scale(1.01); }
  75%, 82% { opacity: 0.9; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -12px) scale(1.02); }
}
@keyframes studio-logo-float {
  0% { transform: translateY(14px); }
  16%, 56% { transform: translateY(0); }
  64% { transform: translate(1px, -2px); }
  68% { transform: translate(-3px, 1px); }
  72% { transform: translate(2px, -1px); }
  84%, 100% { transform: translateY(-8px); }
}
@keyframes studio-red-channel {
  0%, 58%, 63%, 72%, 82%, 100% { opacity: 0; transform: translate(0, 0) scale(1.18); clip-path: inset(0 0 0 0); }
  64% { opacity: 0.58; transform: translate(-20px, 3px) scale(1.18); clip-path: inset(9% 0 66% 0); }
  66% { opacity: 0.86; transform: translate(-12px, -2px) scale(1.18); clip-path: inset(37% 0 38% 0); }
  69% { opacity: 0.5; transform: translate(14px, 2px) scale(1.18); clip-path: inset(64% 0 13% 0); }
  77% { opacity: 0.46; transform: translate(-18px, 0) scale(1.2); clip-path: inset(21% 0 55% 0); }
}
@keyframes studio-cyan-channel {
  0%, 58%, 63%, 72%, 82%, 100% { opacity: 0; transform: translate(0, 0) scale(1.18); clip-path: inset(0 0 0 0); }
  64% { opacity: 0.58; transform: translate(20px, -2px) scale(1.18); clip-path: inset(67% 0 10% 0); }
  67% { opacity: 0.82; transform: translate(12px, 2px) scale(1.18); clip-path: inset(22% 0 52% 0); }
  70% { opacity: 0.5; transform: translate(-14px, -1px) scale(1.18); clip-path: inset(45% 0 32% 0); }
  78% { opacity: 0.45; transform: translate(18px, -2px) scale(1.2); clip-path: inset(12% 0 70% 0); }
}
@keyframes studio-static-field {
  0%, 18% { opacity: 0; background-position: 0 0, center; }
  28%, 58% { opacity: 0.12; background-position: 0 0, center; }
  64%, 71% { opacity: 0.42; background-position: 0 18px, center; }
  78% { opacity: 0.34; background-position: 0 -16px, center; }
  100% { opacity: 0; background-position: 0 40px, center; }
}
@keyframes studio-light-sweep {
  0%, 22% { transform: translateX(-145%); opacity: 0; }
  38% { opacity: 0.78; }
  54% { transform: translateX(145%); opacity: 0; }
  71% { transform: translateX(-145%); opacity: 0; }
  80% { opacity: 0.52; }
  100% { transform: translateX(145%); opacity: 0; }
}
@keyframes studio-starfield {
  0% { opacity: 0; transform: scale(1); }
  18%, 74% { opacity: 0.24; }
  100% { opacity: 0; transform: scale(1.16); }
}
@keyframes studio-scanline {
  0%, 17% { opacity: 0; top: -24%; }
  30% { opacity: 0.42; }
  62% { opacity: 0.1; top: 100%; }
  69% { opacity: 0.5; top: -24%; }
  82% { opacity: 0.08; top: 100%; }
  100% { opacity: 0; top: 100%; }
}

@media (max-width: 760px) {
  .splash-stage { gap: 14px; }
  .splash-logo-wrap { width: min(360px, 82vw); }
  .splash-title strong {
    --presents-tracking: clamp(9px, 2.4vw, 13px);
    font-size: clamp(16px, 4.2vw, 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #screen-splash {
    --studio-splash-duration: 9.2s;
  }
  #screen-splash.splash-run,
  #screen-splash.splash-run::before,
  #screen-splash.splash-run::after,
  #screen-splash.splash-run .splash-stars,
  #screen-splash.splash-run .splash-scanline,
  #screen-splash.splash-run .splash-logo-wrap,
  #screen-splash.splash-run .splash-logo-wrap::before,
  #screen-splash.splash-run .splash-logo-wrap::after,
  #screen-splash.splash-run .splash-games-logo,
  #screen-splash.splash-run .splash-title {
    animation-duration: var(--studio-splash-duration);
  }
}

/* ═══ Stats grid (mission complete) ═══ */
.stats-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px 32px;
  font-size: 14px;
  letter-spacing: 2px;
  padding: 18px 30px;
  border: 1px solid var(--gsa-line);
  background: var(--gsa-panel);
}
.stats-grid .stat-label { color: var(--gsa-cyan-dim); }
.stats-grid .stat-value { color: var(--gsa-orange); text-align: right; }

.credits-body {
  text-align: center; line-height: 2.1;
  font-size: 13px; letter-spacing: 2px;
  color: var(--gsa-cyan-dim);
}

/* ═══ Fatal error ═══ */
#fatal-error {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(720px, calc(100vw - 40px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  transform: translate(-50%, -50%);
  z-index: 200;
  padding: 20px 24px;
  background: rgba(60, 8, 8, 0.95);
  border: 1px solid var(--gsa-red);
  color: #ffbdbd;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  box-shadow: 0 0 40px rgba(255, 68, 68, 0.22);
}

