html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro", "Segoe UI", Roboto, sans-serif;
}

#game {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1;
  pointer-events: none;
}

#game.starfield-active {
  z-index: 50;
  pointer-events: auto;
  cursor: pointer;
}

#game.starfield-tv-clip {
  inset: auto;
  overflow: hidden;
}

/* White stars like Level 1 */
.star {
  position: absolute;
  background: #fff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
}

@keyframes star-twinkle {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.95; }
}

@keyframes star-drift-full {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-220vw, 8vh, 0); }
}

/* Floating animation for humans */
@keyframes human-float {
  0%, 100% { 
    left: calc(var(--base-left, 50%) + 0px); 
    top: calc(var(--base-top, 50%) + 0px); 
  }
  25% { left: calc(var(--base-left, 50%) + 8px); top: calc(var(--base-top, 50%) - 5px); }
  50% { left: calc(var(--base-left, 50%) - 6px); top: calc(var(--base-top, 50%) + 7px); }
  75% { left: calc(var(--base-left, 50%) + 4px); top: calc(var(--base-top, 50%) - 4px); }
}

.level3-human {
  position: fixed;
  animation: human-float 22s ease-in-out infinite var(--float-delay, 0s);
  object-fit: contain;
  pointer-events: auto;
  cursor: pointer;
  z-index: 10;
  transition: opacity 450ms ease;
  opacity: 1;
  min-width: 120px;
  min-height: 120px;
  border: none;
  box-shadow: none;
  filter: none;
}

/* Scene frames - chronological gang sequence from anfang/ */
/* gang1.jpg → gang4 → gang5(fernseher_an) → video → gang6 (sterne) → gang7 (menschen spawn) */
#boot-intro-screen {
  position: fixed;
  inset: 0;
  z-index: 5450;
  background: #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease;
}

#boot-intro-screen.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#boot-intro-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
  display: block;
}

#intro-blackout {
  position: fixed;
  inset: 0;
  z-index: 5001;
  background: #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 2800ms ease;
}

#intro-blackout.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

#intro-blackout.is-released {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#tv-frame {
  position: fixed;
  inset: 0;
  z-index: 100;  /* organic PNG on top */
  background-image: url('/anfang/gang1.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #000; /* opaque for JPG scenes; set transparent for PNG cutouts */
  pointer-events: none;
  opacity: 0;
}

#tv-frame.transparent-hole {
  background-color: transparent !important;
}

#tv-frame.film-mode {
  pointer-events: none;
}

#tv-viewport.is-active {
  display: block !important;
  z-index: 90;
  visibility: visible;
  opacity: 1;
}

#tv-viewport.is-active video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 1;
  visibility: visible;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
}

#tv-frame.victory-zoom {
  transform-origin: center center;
  will-change: transform;
}

body.game-low-perf #tv-frame.victory-zoom {
  will-change: auto;
}

body.game-low-perf .level3-human {
  animation: none;
}

body.game-mobile .level3-human {
  animation: none;
  min-width: 58px;
  min-height: 58px;
}

/* Optional helper layer for early corridor clicks (not required) */
#scene-advance {
  position: fixed;
  inset: 0;
  z-index: 5200;
  cursor: pointer;
  background: transparent;
  display: none;
  pointer-events: none;
}

#scene-advance.is-active {
  display: block;
  pointer-events: auto;
}

#tv-viewport {
  position: fixed;
  z-index: 5;  /* behind the PNG so film shows through transparent areas of the hole */
  overflow: hidden;
  background: #000;
  pointer-events: none;
}

#tv-viewport video {
  filter: brightness(0.68) contrast(1.08);
}

#tv-button-hitarea {
  position: fixed;
  left: 64%;
  top: 65%;
  width: 11%;
  height: 16%;
  border-radius: 50%;
  z-index: 200;
  cursor: pointer;
  background: transparent;
  display: none;
  pointer-events: none;
  /* for debugging: background: rgba(255,0,0,0.2); */
}

body.game-mobile #tv-button-hitarea {
  inset: 0;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  border-radius: 0;
  z-index: 5200;
  -webkit-tap-highlight-color: transparent;
}

#website-preload-frame {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  background: #000;
}

#website-preload-frame.website-active {
  z-index: 10000;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 900ms ease;
  transform: translateZ(0);
  height: 100vh;
  height: 100dvh;
}

#website-preload-frame.website-active.website-active-instant {
  transition: none;
}

#website-tap-gate {
  position: fixed;
  inset: 0;
  z-index: 5300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
  color: #f1f1f1;
  cursor: pointer;
  padding: 2rem;
  box-sizing: border-box;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#website-tap-gate p {
  margin: 0;
  font-family: 'Metal Mania', cursive;
  font-weight: 400;
  font-size: clamp(1.05rem, 3.8vw, 1.45rem);
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
  color: #9b5b57;
}

body.website-open #game,
body.website-open #tv-frame,
body.website-open #tv-viewport,
body.website-open #tv-button-hitarea,
body.website-open #scene-advance {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

body.website-open > *:not(#website-preload-frame) {
  pointer-events: none !important;
}

body.website-open #website-preload-frame {
  pointer-events: auto !important;
}

#game-impressum-popup,
#game-about-popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5100;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  box-sizing: border-box;
}

#game-impressum-popup.is-open,
#game-about-popup.is-open {
  display: flex;
}

#game-impressum-popup .impressum-popup-panel,
#game-about-popup .about-popup-panel {
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  max-width: 40rem;
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  padding: 1.5rem 1.75rem 1.75rem;
  position: relative;
  font-size: 0.84rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

#game-impressum-popup .impressum-popup-close,
#game-about-popup .about-popup-close {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

#game-impressum-popup .impressum-popup-close:hover,
#game-about-popup .about-popup-close:hover {
  color: #fff;
}

#game-about-popup .about-popup-heading {
  font-size: 1.35rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #f1f1f1;
  margin: 0 0 0.35rem;
  font-weight: 600;
}

#game-about-popup .about-popup-tagline {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: #b8726d;
  margin: 0 0 1.1rem;
}

#game-about-popup .about-popup-portrait {
  margin: 0 0 1rem;
  max-width: 11rem;
}

#game-about-popup .about-popup-portrait img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.65rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

#game-about-popup .about-popup-body p {
  margin: 0 0 0.9rem;
  color: rgba(255, 255, 255, 0.78);
}

#game-about-popup .about-popup-body em {
  font-style: italic;
  color: rgba(255, 255, 255, 0.9);
}

#game-about-popup .about-popup-body a {
  color: #b8726d;
  text-decoration: none;
}

#game-about-popup .about-popup-body a:hover {
  color: #d48f8a;
}

#game-about-popup .about-popup-intro {
  color: rgba(255, 255, 255, 0.88);
  margin-bottom: 1rem;
}

#game-about-popup .about-social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

#game-about-popup .about-social-link,
#game-about-popup .about-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 0.35rem;
  font: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

#game-about-popup .about-social-link:hover,
#game-about-popup .about-social-link:focus-visible,
#game-about-popup .about-share-btn:hover,
#game-about-popup .about-share-btn:focus-visible {
  border-color: #9b5b57;
  background: rgba(155, 91, 87, 0.14);
  color: #fff;
  outline: none;
}

#game-about-popup .about-social-arrow {
  color: #b8726d;
}

#game-impressum-popup .impressum-popup-title {
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f1f1f1;
  margin: 0 0 0.35rem;
}

#game-impressum-popup .impressum-popup-subtitle {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.42);
  margin: 0 0 1.15rem;
}

#game-impressum-popup .impressum-section {
  margin: 0 0 1rem;
}

#game-impressum-popup .impressum-section h3 {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 0.4rem;
  font-weight: 600;
}

#game-impressum-popup .impressum-section p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
}

#game-impressum-popup .impressum-popup-mail {
  color: #b8726d;
  text-decoration: none;
}

#game-impressum-popup .impressum-popup-mail:hover {
  color: #d48f8a;
}

#game-impressum-popup .legal-part-heading {
  font-size: 0.88rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f1f1f1;
  margin: 1.25rem 0 0.85rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

#game-impressum-popup .legal-part-heading:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.seo-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#game-legal-foot {
  position: fixed;
  left: 50%;
  bottom: 0.55rem;
  transform: translateX(-50%);
  z-index: 5050;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

body.website-open #game-legal-foot,
body.boot-intro-active #game-legal-foot {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#game-legal-foot button {
  background: transparent;
  border: none;
  padding: 0.25rem 0.5rem;
  font: inherit;
  font-size: 0.56rem;
  letter-spacing: 0.07em;
  color: rgba(255, 255, 255, 0.24);
  cursor: pointer;
  transition: color 180ms ease;
  white-space: nowrap;
}

#game-legal-foot button:hover,
#game-legal-foot button:focus-visible {
  color: rgba(255, 255, 255, 0.52);
  outline: none;
}

body.boot-active #tv-button-hitarea,
body.boot-active #scene-advance {
  display: none !important;
  pointer-events: none !important;
}

#boot-screen {
  position: fixed;
  inset: 0;
  z-index: 5400;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  background: #000;
  color: #f1f1f1;
  padding: 2rem 1.5rem;
  box-sizing: border-box;
  transition: opacity 500ms ease;
}

#boot-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
}

#boot-screen .boot-logo-slot {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

#boot-screen .boot-logo {
  display: block;
  width: min(78vw, 520px);
  max-width: 520px;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  visibility: hidden;
}

#boot-screen .boot-logo.is-ready {
  opacity: 1;
  visibility: visible;
}

#boot-screen .boot-ai-notice {
  margin: -0.35rem 0 0;
  max-width: 22rem;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.48);
  opacity: 0;
  visibility: hidden;
  transition: opacity 400ms ease;
}

#boot-screen.is-stable .boot-ai-notice {
  opacity: 1;
  visibility: visible;
}

#boot-screen .boot-status {
  display: none;
}

#boot-screen .boot-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(82vw, 360px);
  gap: 1.1rem;
  opacity: 0;
  visibility: hidden;
}

#boot-screen.is-stable .boot-content {
  opacity: 1;
  visibility: visible;
}

#boot-screen .boot-progress-slot {
  width: 100%;
  min-height: 2.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#boot-screen .boot-action-slot {
  width: 100%;
  min-height: 3.35rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

#boot-screen .boot-progress-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

#boot-screen .boot-progress-group.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

#boot-screen .boot-bar-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

#boot-screen .boot-bar-fill {
  height: 100%;
  width: 0%;
  background: #9b5b57;
  border-radius: 999px;
  transition: width 180ms ease-out;
}

#boot-screen .boot-percent {
  font-family: 'Metal Mania', cursive;
  font-weight: 400;
  font-size: 1rem;
  letter-spacing: 0.08em;
  line-height: 1;
  color: rgba(155, 91, 87, 0.95);
  font-variant-numeric: tabular-nums;
}

#boot-start-btn {
  padding: 0.9rem 2.6rem;
  border: 1px solid #9b5b57;
  background: transparent;
  color: #9b5b57;
  font-family: 'Metal Mania', cursive;
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: background 180ms ease, color 180ms ease;
}

#boot-start-btn.is-visible {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

#boot-browser-hint {
  margin: 0.15rem 0 0;
  max-width: 22rem;
  text-align: center;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.55);
}

#boot-screen .boot-status.is-error {
  color: rgba(184, 114, 109, 0.95);
}

#boot-start-btn:hover,
#boot-start-btn:focus-visible {
  background: #9b5b57;
  color: #f1f1f1;
  outline: none;
}
