/* ========== Basis & Game-Optik (Desktop: 800×600 fix, zentriert) ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow: hidden;
  background: #1f1f1f;
  color: #e0e0e0;
  font-family: "Press Start 2P", cursive;
  font-size: 10px;
  -webkit-font-smoothing: none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* Feste 800×600 Box, immer zentriert. Dunkler als der Seiten-Hintergrund, damit das Spielfeld sich abhebt. */
#app {
  position: fixed;
  width: 800px;
  height: 600px;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
  background: #0a0a0a;
}

/* Logo unten rechts in jedem Slide (verlinkt mit erechnungs-validator.de) */
.screen {
  position: relative;
}
.screen-logo {
  position: absolute;
  bottom: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  line-height: 0;
  opacity: 0.9;
}
.screen-logo:hover {
  opacity: 1;
}
.screen-logo img {
  width: 100px;
  height: auto;
  max-height: 71px;
  object-fit: contain;
  display: block;
}

/* ========== Slide-Container (links/rechts, 4 × 800px) ========== */
.slide-container {
  display: flex;
  width: 3200px;
  height: 600px;
  transition: transform 0.35s ease-out;
  will-change: transform;
}

.screen {
  flex: 0 0 800px;
  width: 800px;
  height: 600px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
}

.screen-inner {
  width: 100%;
  max-width: 800px;
  height: 600px;
  padding: 1.5rem 1rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.screen-inner.scrollable {
  justify-content: flex-start;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen-cta-inner {
  justify-content: center;
}

.screen-cta-text {
  margin-top: 4rem;
  margin-bottom: 4rem;
}

/* CTA: Terminal-Typing + Einblenden */
.cta-terminal {
  font-family: "VT323", "Courier New", Consolas, monospace;
  font-size: 2.5rem;
  color: #00ff41;
  text-align: left;
  min-height: 3.5em;
  margin: 1rem 0;
}

.cta-terminal-line {
  min-height: 1.4em;
}

.cta-terminal-cursor {
  display: inline-block;
  animation: cta-cursor-blink 0.8s step-end infinite;
}

@keyframes cta-cursor-blink {
  50% { opacity: 0; }
}

.cta-fade-in {
  opacity: 0;
  transition: opacity 0.8s ease-out;
}

.cta-fade-in.cta-fade-in-visible {
  opacity: 1;
}

/* ========== Start-Screen: Vollbild-Hintergrund, Buttons darüber ========== */
.screen-start-inner {
  position: relative;
  background-image: url("startscreen.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  justify-content: flex-end;
  padding-bottom: 3rem;
}

.screen-start-inner .start-actions {
  position: relative;
  z-index: 1;
}

/* ========== Highscore auf Start-Screen ========== */
.highscore-block {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.5rem 0.75rem;
  border: 2px solid #444;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}
.highscore-block:hover {
  background: rgba(0, 0, 0, 0.85);
  border-color: #ffd700;
}
.highscore-block:focus {
  outline: 2px solid #ffd700;
  outline-offset: 2px;
}

/* Collapsed: nur Platz 1 + Hint */
.highscore-block .highscore-list-full {
  display: none;
}
.highscore-block .highscore-preview {
  display: block;
}
.highscore-block .highscore-expand-hint {
  display: block;
  margin: 0.35rem 0 0;
  font-size: 0.55rem;
  color: #666;
}
/* Expanded: volle Liste */
.highscore-block.highscore-block--expanded {
  max-height: 220px;
  overflow: auto;
}
.highscore-block.highscore-block--expanded .highscore-preview,
.highscore-block.highscore-block--expanded .highscore-expand-hint {
  display: none;
}
.highscore-block.highscore-block--expanded .highscore-list-full {
  display: block;
}

.highscore-title {
  font-size: 0.9rem;
  color: #ffd700;
  margin: 0 0 0.35rem;
}

.highscore-preview-line {
  font-size: 0.7rem;
  color: #ccc;
}
.highscore-preview-rank { color: #888; margin-right: 0.4rem; }
.highscore-preview-initials { margin-left: 0.4rem; color: #aaa; }

.highscore-list {
  font-size: 0.65rem;
  color: #ccc;
  text-align: left;
}

.highscore-list table {
  width: 100%;
  border-collapse: collapse;
}

.highscore-list th,
.highscore-list td {
  padding: 0.2rem 0.5rem;
  border-bottom: 1px solid #333;
}

.highscore-list th {
  color: #888;
}

.highscore-list .score { color: #ffd700; }
.highscore-list .level { color: #00b4ff; }
.highscore-empty { margin: 0; color: #666; font-size: 0.7rem; }

/* ========== Highscore-Modal (3 Buchstaben) ========== */
/* ========== Game-Over-Overlay (Phase 1 → nach 2 s Phase 2) ========== */
.game-over-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  text-align: center;
}

.game-over-overlay[aria-hidden="false"] {
  display: flex;
}

.game-over-phase1,
.game-over-phase2 {
  position: absolute;
  transition: opacity 0.6s ease-out;
}

.game-over-phase2 {
  opacity: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.game-over-overlay.game-over-phase2-visible .game-over-phase1 {
  opacity: 0;
  pointer-events: none;
}

.game-over-overlay.game-over-phase2-visible .game-over-phase2 {
  opacity: 1;
  pointer-events: auto;
}

.game-over-title {
  font-size: 2rem;
  color: #ff4444;
  margin: 0 0 1.5rem;
  font-family: "Press Start 2P", cursive;
}

.game-over-line1,
.game-over-line2 {
  font-size: 0.9rem;
  color: #ccc;
  margin: 0 0 0.5rem;
  font-family: "Press Start 2P", cursive;
}

.game-over-check-title {
  font-size: 1.5rem;
  color: #ffd700;
  margin: 0 0 0.75rem;
  font-family: "Press Start 2P", cursive;
}

.game-over-check-text {
  font-size: 1.5rem;
  color: #bbb;
  margin: 0 0 1.5rem;
  font-family: "Press Start 2P", cursive;
}

.game-over-phase2 .btn {
  margin: 0.5rem;
}

.game-over-back {
  display: block;
  margin: 1rem auto 0;
}

.game-over-highscore-block {
  display: none;
  margin-top: 3.5rem;
  padding: 1rem;
  border: 2px solid #ffd700;
  background: rgba(0, 0, 0, 0.6);
  max-width: 320px;
  flex-shrink: 0;
}

.game-over-highscore-block[aria-hidden="false"] {
  display: block;
}

.game-over-highscore-title {
  font-size: 0.85rem;
  color: #ffd700;
  margin: 0 0 0.5rem;
  font-family: "Press Start 2P", cursive;
}

.game-over-highscore-text {
  font-size: 0.65rem;
  color: #bbb;
  margin: 0 0 0.75rem;
  font-family: "Press Start 2P", cursive;
}

.game-over-highscore-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.highscore-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
}

.highscore-modal[aria-hidden="false"] {
  display: flex;
}

.highscore-modal-inner {
  background: #1a1a1a;
  border: 2px solid #ffd700;
  padding: 1.5rem;
  text-align: center;
  max-width: 90%;
}

.highscore-modal-title {
  font-size: 1rem;
  color: #ffd700;
  margin: 0 0 0.5rem;
}

.highscore-modal-text {
  font-size: 0.7rem;
  color: #bbb;
  margin: 0 0 1rem;
}

.highscore-form {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.highscore-initials {
  font-family: "Press Start 2P", cursive;
  font-size: 1rem;
  width: 4rem;
  padding: 0.5rem;
  text-align: center;
  text-transform: uppercase;
  background: #0a0a0a;
  border: 2px solid #555;
  color: #ffd700;
}

/* ========== Buttons ========== */
.btn {
  font-family: inherit;
  cursor: pointer;
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
  margin: 0.5rem;
  transition: transform 0.1s, filter 0.15s;
  text-decoration: none;
}

a.btn:hover,
a.btn:focus {
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(180deg, #00b4ff 0%, #0066aa 100%);
  color: #fff;
  border: 2px solid #00d4ff;
  box-shadow: 0 0 12px rgba(0, 180, 255, 0.4);
}

.btn-secondary {
  background: linear-gradient(180deg, #333 0%, #111 100%);
  color: #ccc;
  border: 2px solid #555;
}

.btn-nav {
  background: transparent;
  color: #888;
  border: 2px solid #444;
  font-size: 1rem;
}

.btn-sound {
  background: transparent;
  color: #888;
  border: 2px solid #444;
  font-size: 2rem;
  line-height: 1;
  padding: 0.5rem;
  min-width: 2.5rem;
}

.start-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.start-actions-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  justify-content: center;
}

/* ========== Anleitung & CTA Screens ========== */
.screen-title {
  font-size: 1.5rem;
  color: #ffd700;
  margin: 0 0 1rem;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.screen-title-alert {
  font-size: 2rem;
  color: #ff4444;
  letter-spacing: 0.2em;
  text-shadow: 0 0 12px rgba(255, 68, 68, 0.6);
}

.content-block {
  text-align: left;
  margin-bottom: 1.5rem;
}

.content-block h3 {
  font-size: 1.5rem;
  color: #00b4ff;
  margin: 0 0 0.5rem;
}

.content-block p {
  font-size: 1rem;
  line-height: 1.7;
  color: #bbb;
  margin: 0;
}

.content-block p + p {
  margin-top: 0.75rem;
}

.content-block-mission p {
  color: #00b4ff;
}

.content-block-mission strong {
  color: #ffd700;
}

.screen-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* ========== Game-Screen Platzhalter (800×600) ========== */
.game-header {
  width: 100%;
  max-width: 800px;
  display: grid;
  grid-template-columns: minmax(0, 140px) 1fr minmax(0, 140px);
  align-items: center;
  padding: 0.5rem 0;
  font-size: 1.5rem;
}

.score-label { color: #ffd700; justify-self: start; min-width: 0; }
.level-label { color: #ff4444; justify-self: center; font-size: 1rem; white-space: nowrap; min-width: 0; }
.lives-label { color: #0f0; display: flex; align-items: center; gap: 0.25rem; justify-self: end; min-width: 0; }
.lives-icons { display: flex; gap: 2px; }
.lives-icons img { width: 28px; height: 14px; object-fit: contain; display: block; }

.game-area {
  width: 800px;
  height: 520px;
  background: #111;
  border: 2px solid #333;
  border-radius: 0;
}

#game {
  display: block;
  width: 800px;
  height: 520px;
}

.game-placeholder {
  font-size: 0.4rem;
  color: #555;
  margin: 0.75rem 0 0;
}

/* Slide-Pfeile entfernt – Wechsel per Mausrad (runter = vor, hoch = zurück) */

/* Verstecktes iframe für Independent-Analytics-Zählseite (WordPress) */
.ia-tracking-iframe {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  border: 0;
  overflow: hidden;
  pointer-events: none;
}
