:root {
  --bg: #05070d;
  --panel: #0e1422;
  --line: #24304a;
  --text: #d8e2f5;
  --dim: #7d8aa6;
  --accent: #4fd1ff;
  --danger: #ff5a6e;
  --emoji: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, sans-serif, var(--emoji);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  display: flex;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
}

#center {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px;
}

#hud {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 16px;
  line-height: 22px;
  white-space: nowrap;
}
#hud span { padding: 0 2px; }
#hud-hp.low { color: var(--danger); font-weight: 700; }

#stage {
  position: relative;
  border: 2px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #000;
  line-height: 0;
}
#view { display: block; }

#log {
  height: 51px;
  padding: 0 8px;
  font-size: 13px;
  line-height: 17px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
#log div {
  opacity: .5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .4s;
}
#log div:last-child { opacity: 1; }
#log div.new { color: var(--accent); transition: none; }

.hud-btn {
  background: none;
  border: 0;
  padding: 0 2px;
  font-size: inherit;
  line-height: inherit;
  cursor: pointer;
}
#hud-tool.got { color: #ffd84f; font-weight: 700; }
#hud-card.got { color: #ffd84f; font-weight: 700; }
#hud [hidden] { display: none; }
#hud-shield { color: var(--dim); }
#hud-shield.ready { color: var(--accent); font-weight: 700; }
#hud-o2 { display: inline-flex; align-items: center; gap: 4px; }
#hud-o2 .bar {
  display: inline-block;
  width: 48px; height: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: #0a0f1a;
}
#hud-o2 .bar i { display: block; height: 100%; width: 100%; background: #8fd8ff; transition: width .25s; }
#hud-o2.low { color: #ffb14f; }
#hud-o2.low .bar i { background: #ffb14f; }
#hud-o2.empty { color: var(--danger); font-weight: 700; animation: blink .8s infinite; }
#hud-leaks.done { color: #8ef58e; }
#hud-o2.regen { color: #8ef58e; }
#hud-o2.regen .bar i { background: #6dff8a; }
@keyframes blink { 50% { opacity: .35; } }

/* Deck-Wechsel mit dem Aufzug */
#banner {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s;
  z-index: 15;
}
#banner.show { opacity: 1; pointer-events: auto; }
#banner-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  transform: translateY(10px);
  transition: transform 1.2s;
}
#banner.show #banner-title { transform: none; }

#keys { color: var(--dim); font-size: 12px; line-height: 16px; }

/* Gameboy-Steuerung – nur auf Touch-Geräten */
.pad { display: none; }

@media (pointer: coarse) {
  .pad {
    display: flex;
    flex: 0 0 140px;
    align-items: center;
    justify-content: center;
  }
  #keys { display: none; }
  /* das HUD darf über die (oben freien) Steuerpads hinausragen */
  #hud { font-size: 13px; line-height: 18px; gap: 7px; width: calc(100vw - 200px); flex-shrink: 0; }
  #hud-o2 .bar { width: 34px; }
  #hud-o2-val { display: none; }
  #hud .long { display: none; }
  /* Ton- und Pause-Knopf wandern in die freie Ecke über den Aktionsknöpfen */
  .hud-btn { position: fixed; top: 6px; z-index: 5; font-size: 20px; padding: 4px; }
  #hud-pause { right: 10px; }
  #hud-sound { right: 48px; }
  #log { height: 30px; font-size: 12px; line-height: 15px; }
  #log div:not(:nth-last-child(-n+2)) { display: none; }
}

#dpad {
  display: grid;
  grid-template: repeat(3, 44px) / repeat(3, 44px);
  gap: 2px;
}
#dpad [data-dir="up"]    { grid-area: 1 / 2; }
#dpad [data-dir="left"]  { grid-area: 2 / 1; }
#dpad [data-dir="right"] { grid-area: 2 / 3; }
#dpad [data-dir="down"]  { grid-area: 3 / 2; }
.dbtn span { display: inline-block; }
[data-dir="right"] span { transform: rotate(90deg); }
[data-dir="down"] span { transform: rotate(180deg); }
[data-dir="left"] span { transform: rotate(-90deg); }

button {
  font: inherit;
  color: var(--text);
  touch-action: none;
}

.dbtn, .abtn {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 10px;
  font-size: 18px;
  padding: 0;
}
.dbtn.active, .abtn.active { background: #1c2a45; border-color: var(--accent); }

#pad-right { flex-direction: column; gap: 18px; }
.abtn {
  width: 76px; height: 76px;
  border-radius: 50%;
  font-size: 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}
.abtn small { font-size: 10px; color: var(--dim); }
#btn-shoot { margin-right: 24px; }
#btn-item { margin-left: 24px; }

/* Overlays */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 10, .88);
  z-index: 10;
  padding: 16px;
}
.overlay.hidden { display: none; }
.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 18px 26px;
  max-width: 460px;
  text-align: center;
  max-height: 100%;
  overflow: auto;
}
.panel h1 { margin: 4px 0 8px; font-size: 26px; color: var(--accent); }
.panel p { margin: 0 0 14px; line-height: 1.45; font-size: 15px; }
.big { font-size: 46px; line-height: 1.2; font-family: var(--emoji); }
.panel .primary {
  background: var(--accent);
  color: #03121a;
  border: 0;
  border-radius: 10px;
  padding: 10px 26px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
}

.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.panel .ghost {
  background: none;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 8px 18px;
  font-size: 15px;
  color: var(--dim);
  cursor: pointer;
}

/* Einsatzbesprechung als Funkübertragung */
#briefing { z-index: 11; }
#pause { z-index: 13; }
.comms {
  max-width: 620px;
  width: 100%;
  text-align: left;
  padding: 0;
  overflow: hidden;
  border-color: #2b5a6e;
  box-shadow: 0 0 30px rgba(79, 209, 255, .15);
}
.comms-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: #0a1b26;
  border-bottom: 1px solid #1f4152;
  font-size: 13px;
}
.comms-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #ff5a6e;
  box-shadow: 0 0 8px #ff5a6e;
  animation: blink 1s infinite;
}
.comms-title { color: var(--accent); font-weight: 700; letter-spacing: .04em; }
.comms-deck { margin-left: auto; color: var(--dim); white-space: nowrap; }
.comms-body { display: flex; gap: 12px; padding: 12px 14px; }
.comms-avatar { flex: 0 0 76px; text-align: center; color: var(--dim); font-size: 11px; line-height: 1.25; }
.comms-face {
  position: relative;
  width: 64px; height: 64px;
  margin: 0 auto 4px;
  border: 2px solid #2b5a6e;
  border-radius: 10px;
  background: radial-gradient(circle, #123444, #07141c);
  font-family: var(--emoji);
  font-size: 40px;
  line-height: 62px;
  overflow: hidden;
  animation: comms-flicker 4s infinite;
}
/* Bildschirm-Rauschen über dem Gesicht */
.comms-face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(79, 209, 255, .08) 0 2px, transparent 2px 4px);
  animation: comms-scan 3s linear infinite;
}
@keyframes comms-scan { to { background-position: 0 40px; } }
@keyframes comms-flicker { 0%, 94%, 100% { opacity: 1; } 95% { opacity: .6; } 97% { opacity: .9; } }
.comms-msgs {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 7px;
  /* feste Höhe: die Karte darf beim Eintippen nicht wachsen */
  height: 260px;
  /* Scrollbalken immer eingeblendet, damit er nicht auf- und abtaucht */
  overflow-y: scroll;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #2f7390 #0a1b26;
}
.comms-msgs::-webkit-scrollbar { width: 8px; }
.comms-msgs::-webkit-scrollbar-track { background: #0a1b26; border-radius: 4px; }
.comms-msgs::-webkit-scrollbar-thumb { background: #2f7390; border-radius: 4px; }
.comms-msg {
  align-self: flex-start;
  padding: 7px 11px;
  border-radius: 4px 12px 12px 12px;
  background: #102532;
  border: 1px solid #1f4152;
  font-size: 14px;
  line-height: 1.4;
  animation: comms-in .25s ease-out;
}
.comms-msg:last-child { border-color: #2f7390; }
@keyframes comms-in { from { opacity: 0; transform: translateY(6px); } }
.comms-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px 12px;
}
.comms .brief-reward { flex: 1; margin: 0; color: #8ef58e; font-size: 13px; }
.comms .primary { flex: 0 0 auto; min-width: 140px; }
@media (max-height: 460px) {
  .comms-head { padding: 5px 12px; font-size: 12px; }
  .comms-body { padding: 8px 12px; gap: 10px; }
  .comms-avatar { flex-basis: 58px; font-size: 10px; }
  .comms-face { width: 50px; height: 50px; font-size: 30px; line-height: 48px; }
  .comms-msgs { height: 175px; gap: 5px; }
  .comms-msg { font-size: 12.5px; padding: 5px 9px; }
  .comms-foot { padding: 4px 12px 8px; }
  .comms .brief-reward { font-size: 12px; }
  .comms .primary { padding: 7px 18px; font-size: 14px; min-width: 124px; }
}

/* ---------- Titelbildschirm ---------- */
#title {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(ellipse at 70% 25%, #13264a 0%, #070b16 55%, #03050a 100%);
}
#title.hidden { display: none; }
#stars { position: absolute; inset: 0; width: 100%; height: 100%; }

.t-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  text-align: center;
}
.t-hero {
  font-family: var(--emoji);
  font-size: 84px;
  line-height: 1;
  animation: t-float 4.5s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(79, 209, 255, .35));
}
@keyframes t-float {
  0%, 100% { transform: translateY(0) rotate(-7deg); }
  50% { transform: translateY(-14px) rotate(7deg); }
}
.t-logo {
  margin: 0;
  font-family: "Orbitron", system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 8vw, 76px);
  line-height: 1;
  letter-spacing: .08em;
  color: #e8f6ff;
  text-shadow: 0 0 10px rgba(79, 209, 255, .85), 0 0 34px rgba(79, 209, 255, .45);
}
.t-logo span {
  margin-left: .3em;
  color: #ffb14f;
  text-shadow: 0 0 10px rgba(255, 177, 79, .85), 0 0 34px rgba(255, 110, 40, .45);
  animation: t-flicker 6s infinite;
}
/* kaputte Leuchtschrift */
@keyframes t-flicker {
  0%, 90%, 100% { opacity: 1; }
  91% { opacity: .25; } 92% { opacity: 1; } 94% { opacity: .45; } 95% { opacity: 1; }
}
.t-tag { margin: 0; max-width: 470px; color: #9fb0cf; font-size: 15px; line-height: 1.45; }
.t-route {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--emoji);
  font-size: 26px;
}
.t-route i { font-style: normal; color: var(--dim); font-family: system-ui, sans-serif; }
.t-route span { filter: drop-shadow(0 0 8px rgba(79, 209, 255, .5)); }
.t-route span.soon { opacity: .28; filter: grayscale(1); }
#title-start {
  margin-top: 4px;
  padding: 12px 30px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #03121a;
  font-family: "Orbitron", system-ui, sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .04em;
  cursor: pointer;
  animation: t-pulse 2.2s ease-in-out infinite;
}
@keyframes t-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 209, 255, .55); }
  50% { box-shadow: 0 0 0 12px rgba(79, 209, 255, 0); }
}
.t-hint { color: var(--dim); font-size: 12px; }
#title-sound {
  position: absolute;
  top: 10px; right: 12px;
  background: none;
  border: 0;
  font-size: 22px;
  cursor: pointer;
}

/* beschädigtes Schiff im Hintergrund */
/* Position und Neigung setzt game.js jedes Bild – die Rakete kreuzt durch die obere Bildhälfte */
.t-ship {
  position: absolute;
  top: 0; left: 0;
  width: 1.2em; height: 1.2em;
  font-family: var(--emoji);
  font-size: clamp(56px, 9vw, 110px);
  line-height: 1;
  opacity: .95;
  will-change: transform;
  filter: drop-shadow(0 0 14px rgba(255, 140, 60, .25));
}
.t-ship span { position: absolute; left: 0; top: 0; }
.t-ship .ship { transform: rotate(45deg); }
/* Triebwerksstrahl: gezeichneter Kegel statt 🔥-Emoji (das wirkt liegend wie zwei Feuerbälle).
   Maße in em der Rakete; die rechte Kante sitzt an der Düse. */
.plume {
  width: .62em; height: .22em;
  border-radius: 50% 20% 20% 50% / 50%;
  background: radial-gradient(ellipse 100% 50% at 100% 50%, #fffbe0 0%, #ffd93d 30%, #ff8a2a 62%, rgba(255, 70, 20, 0) 100%);
  filter: blur(.5px) drop-shadow(0 0 6px rgba(255, 140, 40, .8));
  transform-origin: 100% 50%;
  animation: plume .11s ease-in-out infinite alternate;
}
@keyframes plume {
  from { transform: scale(1, 1); }
  to { transform: scale(.72, .85); }
}
.t-ship .fire { left: -.46em; top: .43em; }
.t-ship .smoke { font-size: .45em; left: -18%; top: 32%; opacity: 0; animation: t-smoke 2.4s linear infinite; }
.t-ship .s2 { animation-delay: .8s; }
.t-ship .s3 { animation-delay: 1.6s; }
@keyframes t-fire { 0% { transform: scale(1); } 100% { transform: scale(.75) translateX(2px); } }
@keyframes t-smoke {
  0% { opacity: .8; transform: translate(0, 0) scale(.6); }
  100% { opacity: 0; transform: translate(-4em, .7em) scale(1.6); }
}

/* niedrige Querformat-Bildschirme (Handy) */
@media (max-height: 460px) {
  .t-content { gap: 7px; padding: 8px; }
  .t-hero { font-size: 46px; }
  .t-logo { font-size: 36px; }
  .t-tag { font-size: 12.5px; max-width: 400px; }
  .t-route { font-size: 20px; }
  #title-start { padding: 9px 24px; font-size: 15px; }
  .t-ship { font-size: 62px; }
}
@media (pointer: coarse) {
  .t-hint { display: none; }
}

/* Titel-Buttons */
.t-buttons { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
.t-buttons #title-start { margin-top: 0; }
#title-lab {
  padding: 10px 18px;
  border: 2px solid rgba(201, 167, 255, .55);
  border-radius: 12px;
  background: rgba(20, 14, 40, .6);
  color: #e3d6ff;
  font-family: "Orbitron", system-ui, sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
#title-lab span { margin-left: 6px; color: #c9a7ff; }
#hud-cores { color: #c9a7ff; }
#hud-droid { color: var(--accent); }
#hud-rad.hot { color: #9dff6b; font-weight: 700; animation: blink .8s infinite; }
#bossbar {
  position: absolute;
  top: 6px; left: 50%;
  transform: translateX(-50%);
  width: min(70%, 420px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border: 1px solid rgba(199, 125, 255, .6);
  border-radius: 8px;
  background: rgba(10, 5, 20, .75);
  font-size: 13px;
  line-height: 1.2;
  color: #e3c8ff;
  pointer-events: none;
}
#bossbar[hidden] { display: none; }
#bossbar span { white-space: nowrap; font-weight: 700; }
#bossbar b { flex: 1; height: 10px; border-radius: 5px; background: #2a1638; overflow: hidden; }
#bossbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #8f3dff, #ff5ac8); transition: width .3s; }
#hud-droid.down { color: var(--dim); }

/* ---------- Forschungslabor ---------- */
#lab {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: radial-gradient(ellipse at 30% 20%, #1d1440 0%, #0a0818 55%, #04030a 100%);
}
#lab.hidden { display: none; }
.lab-panel { max-width: 860px; width: 100%; text-align: left; position: relative; }
.lab-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lab-head h1 { margin: 0; color: #c9a7ff; font-family: "Orbitron", system-ui, sans-serif; font-size: 24px; }
.lab-cores { font-size: 22px; font-weight: 700; color: #e3d6ff; white-space: nowrap; }
.panel .lab-sub { margin: 6px 0 12px; color: var(--dim); font-size: 14px; }
#lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.up-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #0b1020;
  text-align: center;
  transition: border-color .2s, transform .2s;
}
.up-card.affordable { border-color: rgba(201, 167, 255, .6); }
.up-card.bought { animation: up-pop .45s; }
@keyframes up-pop { 40% { transform: scale(1.06); border-color: #c9a7ff; } }
.up-icon { font-family: var(--emoji); font-size: 30px; line-height: 1.1; }
.up-name { font-weight: 700; font-size: 14px; }
.up-desc { color: var(--dim); font-size: 12px; line-height: 1.3; min-height: 2.6em; }
.up-pips { letter-spacing: 3px; color: #c9a7ff; font-size: 12px; }
.up-pips i { font-style: normal; color: #2d3550; }
.up-buy {
  margin-top: 2px;
  width: 100%;
  padding: 6px 4px;
  border: 0;
  border-radius: 8px;
  background: #c9a7ff;
  color: #150b2e;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.up-buy:disabled { background: #1c2236; color: var(--dim); cursor: default; }
.up-card.soon { opacity: .6; }
.lab-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
#lab-stats { color: var(--dim); font-size: 12px; }
.lab-meta { display: flex; flex-direction: column; gap: 2px; }
.lab-meta { gap: 6px; }
.panel .lab-reset {
  align-self: flex-start;
  padding: 5px 12px;
  border: 1px solid #5a2a35;
  border-radius: 8px;
  background: none;
  color: #e08a98;
  font-size: 12px;
  cursor: pointer;
}
/* zweiter Klick nötig: Button wird rot */
.panel .lab-reset.confirm { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 700; }
.panel .lab-reset.done { border-color: #2f6b3a; color: #8ef58e; }
@media (max-height: 460px) {
  #lab { padding: 6px; }
  .lab-head h1 { font-size: 18px; }
  .lab-cores { font-size: 17px; }
  .panel .lab-sub { display: none; }
  #lab-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 8px 0; }
  .up-card { padding: 6px 4px; gap: 2px; }
  .up-icon { font-size: 22px; }
  .up-name { font-size: 11.5px; }
  .up-desc { font-size: 10.5px; }
  .up-buy { font-size: 12px; padding: 4px 2px; }
  #title-lab { padding: 8px 14px; font-size: 13px; }
}

/* ---------- Abspann ---------- */
#outro {
  position: fixed;
  inset: 0;
  z-index: 14;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #0e1d3a 0%, #05070f 60%, #000 100%);
  cursor: pointer;
}
#outro.hidden { display: none; }
#outro-stars { position: absolute; inset: 0; width: 100%; height: 100%; }

/* repariert: kein Rauch mehr, nur sauberes Triebwerksfeuer */
#outro-ship {
  position: absolute;
  left: 28%; top: 40%;
  font-family: var(--emoji);
  font-size: clamp(70px, 11vw, 140px);
  line-height: 1;
  animation: outro-bob 3s ease-in-out infinite;
  transition: transform 2.6s cubic-bezier(.6, 0, .9, .4), opacity .4s 2.3s, left 2.6s cubic-bezier(.6, 0, .9, .4);
  filter: drop-shadow(0 0 20px rgba(255, 150, 60, .4));
}
#outro-ship .rocket { display: inline-block; transform: rotate(45deg); }
#outro-ship .flame { position: absolute; left: -.46em; top: .43em; }
@keyframes outro-bob { 50% { margin-top: -14px; } }
#outro.warp #outro-ship { left: 110%; transform: scale(.05); opacity: 0; animation: none; }
/* beim Warp-Sprung wird der Strahl lang */
#outro.warp #outro-ship .flame { width: 1.4em; height: .28em; left: -1.24em; top: .4em; }

.outro-comms {
  position: absolute;
  left: 50%; bottom: 9%;
  transform: translateX(-50%);
  width: min(620px, calc(100% - 32px));
  display: flex; gap: 12px; align-items: center;
  transition: opacity .5s;
}
#outro.warp .outro-comms, #outro.credits-on .outro-comms { opacity: 0; }
.outro-comms .comms-face { flex: 0 0 auto; margin: 0; }
#outro-msg {
  flex: 1;
  min-height: 3.2em;
  padding: 10px 14px;
  border: 1px solid #2f7390;
  border-radius: 4px 14px 14px 14px;
  background: rgba(10, 27, 38, .85);
  font-size: 16px;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s, transform .35s;
}
#outro-msg.show { opacity: 1; transform: none; }

#outro-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
#outro.flash #outro-flash { opacity: 1; }
#outro.credits-on #outro-flash { opacity: 0; transition: opacity 1.4s; }
#outro.credits-on #outro-ship { display: none; }

#credits {
  position: absolute;
  left: 50%; top: 100%;
  width: min(560px, calc(100% - 32px));
  transform: translateX(-50%);
  text-align: center;
  display: none;
}
#outro.credits-on #credits { display: block; }
@keyframes credits-roll {
  from { top: 100%; transform: translate(-50%, 0); }
  to { top: 0; transform: translate(-50%, -100%); }
}
#credits.parked { top: 0; transform: translate(-50%, -100%); }
.cr-logo {
  font-family: "Orbitron", system-ui, sans-serif; font-weight: 900;
  font-size: clamp(34px, 7vw, 64px); letter-spacing: .08em; color: #e8f6ff;
  text-shadow: 0 0 10px rgba(79, 209, 255, .85), 0 0 34px rgba(79, 209, 255, .45);
}
.cr-logo span { margin-left: .3em; color: #ffb14f; text-shadow: 0 0 10px rgba(255, 177, 79, .85), 0 0 34px rgba(255, 110, 40, .45); }
.cr-sub { color: #9fb0cf; font-size: 17px; line-height: 1.5; margin: 14px 0 50px; }
#credits h3 {
  margin: 44px 0 10px;
  font-family: "Orbitron", system-ui, sans-serif;
  font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent);
}
#credits dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; }
#credits dt { text-align: right; font-family: var(--emoji); font-size: 22px; }
#credits dd { margin: 0; text-align: left; font-size: 17px; line-height: 30px; }
.cr-line { margin: 0; font-size: 18px; line-height: 1.5; }
.cr-thanks { margin: 80px 0 0; font-size: 26px; font-weight: 700; color: #e8f6ff; }

#outro-end {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(ellipse at center, rgba(5, 10, 20, .6), rgba(0, 0, 0, .85));
  cursor: default;
}
#outro-end.hidden { display: none; }
#outro-end h2 { margin: 0; font-family: "Orbitron", system-ui, sans-serif; color: #e8f6ff; font-size: 28px; }
#outro-end .primary {
  background: var(--accent); color: #03121a; border: 0; border-radius: 10px;
  padding: 10px 24px; font-size: 17px; font-weight: 700; cursor: pointer;
}
#outro-end .ghost {
  background: none; border: 2px solid var(--line); border-radius: 10px;
  padding: 8px 18px; font-size: 15px; color: var(--dim); cursor: pointer;
}
.outro-skip { position: absolute; right: 14px; bottom: 10px; font-size: 12px; color: #4a5470; pointer-events: none; }
#outro-end:not(.hidden) ~ .outro-skip { display: none; }
@media (max-height: 460px) {
  #outro-msg { font-size: 13.5px; padding: 7px 11px; }
  .outro-comms { bottom: 6%; }
  .outro-comms .comms-face { width: 46px; height: 46px; font-size: 28px; line-height: 44px; }
  #outro-ship { top: 22%; }
  .cr-sub { font-size: 14px; margin-bottom: 30px; }
  #credits h3 { margin-top: 28px; }
  #credits dd, .cr-line { font-size: 15px; }
}

#rotate { display: none; z-index: 20; }
@media (orientation: portrait) and (pointer: coarse) {
  #rotate { display: flex; }
}
