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

body {
  background: #050510;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  font-family: 'Courier New', Courier, monospace;
  color: #fff;
  touch-action: none;
}

#game-container {
  position: relative;
  width: 600px;
  height: 800px;
  transform-origin: top center;
}

#game-canvas {
  display: block;
  width: 600px;
  height: 800px;
  background: #050510;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

/* ── Consent Banner ───────────────────────────────────── */
#consent-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  font-family: 'Courier New', Courier, monospace;
}

#consent-screen.hidden { display: none; }

.consent-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 32px;
  max-width: 500px;
  text-align: center;
}

.consent-text {
  font-size: 0.95rem;
  line-height: 1.7;
  color: #ccc;
}

.consent-de {
  color: #888;
  font-size: 0.85rem;
}

.consent-link {
  font-size: 0.75rem;
  color: #ff00cc;
  text-decoration: none;
  letter-spacing: 1px;
}

.consent-link:hover {
  text-decoration: underline;
}

#game-container.hidden { display: none; }

/* ── Screens ──────────────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  background: rgba(5, 5, 16, 0.92);
  z-index: 10;
}

.screen.hidden {
  display: none;
}

.screen-title {
  font-size: 2.6rem;
  font-weight: 900;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
}

.screen-title.accent {
  color: #ff00cc;
  text-shadow:
    0 0 10px #ff00cc,
    0 0 30px #ff00cc,
    0 0 60px rgba(255, 0, 204, 0.4);
}

.screen-title.red {
  color: #ff3333;
  text-shadow: 0 0 20px rgba(255, 51, 51, 0.8);
}

.hint {
  font-size: 0.7rem;
  color: #555;
  letter-spacing: 1px;
}

/* ── Menu Screen (Sprite Background) ─────────────────── */
#menu-screen {
  background: #050510;
  gap: 0;
  padding: 0;
  /* Menü-Grafik ist fix 3:4 – in der ggf. höheren Spielfläche zentriert halten,
     damit die prozentual positionierten Buttons auf dem Hintergrund sitzen. */
  inset: auto;
  top: 50%;
  left: 50%;
  width: 600px;
  height: 800px;
  transform: translate(-50%, -50%);
}

.menu-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
}

.menu-btn {
  position: absolute;
  left: 35%;
  width: 30%;
  background: transparent;
  border: none;
  color: transparent;
  cursor: pointer;
  font-size: 0;
  padding: 0;
  margin: 0;
  transition: filter 0.15s, transform 0.1s;
}

.menu-btn:hover {
  filter: brightness(1.3);
  transform: scale(1.03);
}

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

.menu-btn-play {
  top: 22.5%;
  height: 8.5%;
}

.menu-btn-leaderboard {
  top: 34%;
  height: 4.7%;
}

.menu-btn-mainmenu {
  top: 44%;
  height: 5.5%;
  cursor: default;
  pointer-events: none;
}

.menu-privacy-link {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
  letter-spacing: 1px;
  z-index: 1;
}

.menu-privacy-link:hover {
  color: rgba(255, 255, 255, 0.6);
}

/* ── Leaderboard ─────────────────────────────────────── */
#leaderboard-screen {
  background: rgba(5, 5, 16, 0.95);
  z-index: 20;
}

.lb-panel {
  width: 85%;
  max-height: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: #0d0d1a;
  border: 2px solid #ff00cc44;
  padding: 24px 16px;
  overflow: hidden;
}

.lb-title {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ff00cc;
  text-shadow: 0 0 15px rgba(255, 0, 204, 0.5);
}

/* ── Item-Legende ─────────────────────────────────────── */
.legend-panel {
  width: 88%;
  max-width: 420px;
  max-height: 85%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  background: #0d0d1a;
  border: 2px solid #ff00cc44;
  padding: 24px 18px;
  overflow: hidden;
}

.legend-list {
  list-style: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.legend-icon {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  padding: 3px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.legend-sprite {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.4);
}

.legend-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.8rem;
  line-height: 1.25;
  color: #cfcfe0;
}

.legend-text b {
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fff;
}

.lb-list {
  width: 100%;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 400px;
}

.lb-row {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(255, 255, 255, 0.03);
}

.lb-row:nth-child(1) { background: rgba(255, 215, 0, 0.1); }
.lb-row:nth-child(2) { background: rgba(192, 192, 192, 0.08); }
.lb-row:nth-child(3) { background: rgba(205, 127, 50, 0.08); }

.lb-row.lb-self {
  background: rgba(255, 0, 204, 0.12);
  border-left: 3px solid #ff00cc;
}

.lb-rank {
  width: 36px;
  color: #666;
  font-size: 0.75rem;
}

.lb-row:nth-child(1) .lb-rank { color: #ffd700; }
.lb-row:nth-child(2) .lb-rank { color: #c0c0c0; }
.lb-row:nth-child(3) .lb-rank { color: #cd7f32; }

.lb-name {
  flex: 1;
  color: #ddd;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  color: #aaa;
  font-variant-numeric: tabular-nums;
}

.lb-empty {
  text-align: center;
  color: #555;
  font-size: 0.8rem;
  padding: 40px 0;
  letter-spacing: 1px;
}

.lb-loading {
  text-align: center;
  color: #ff00cc;
  font-size: 0.8rem;
  padding: 40px 0;
  letter-spacing: 2px;
  animation: pulse 0.6s infinite alternate;
}

/* ── Username Prompt ─────────────────────────────────── */
#username-screen {
  z-index: 25;
}

.username-input {
  width: 100%;
  padding: 12px 14px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  color: #fff;
  background: #0a0a18;
  border: 2px solid #ff00cc44;
  outline: none;
  transition: border-color 0.15s;
}

.username-input::placeholder {
  color: #444;
  text-transform: none;
  letter-spacing: 1px;
  font-weight: 400;
}

.username-input:focus {
  border-color: #ff00cc;
  box-shadow: 0 0 10px rgba(255, 0, 204, 0.3);
}

/* ── Buttons (Game Over) ─────────────────────────────── */
.btn-primary {
  padding: 14px 44px;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: transparent;
  color: #ff00cc;
  border: 2px solid #ff00cc;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.1s, box-shadow 0.15s;
  box-shadow: 0 0 10px rgba(255, 0, 204, 0.3);
}

.btn-primary:hover {
  background: #ff00cc;
  color: #050510;
  box-shadow: 0 0 20px rgba(255, 0, 204, 0.7);
  transform: scale(1.04);
}

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

/* ── Game Over Result ─────────────────────────────────── */
#score-result,
#highscore-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.result-label {
  font-size: 0.65rem;
  color: #666;
  letter-spacing: 2px;
}

.result-value {
  font-size: 2.4rem;
  font-weight: 900;
  color: #fff;
  letter-spacing: 2px;
}

.new-record {
  font-size: 1rem;
  font-weight: 900;
  color: #ff00cc;
  letter-spacing: 3px;
  text-transform: uppercase;
  text-shadow: 0 0 10px #ff00cc;
  animation: pulse 0.6s infinite alternate;
}

.new-record.hidden { display: none; }

@keyframes pulse {
  from { opacity: 1; }
  to   { opacity: 0.4; }
}

/* ── HUD ──────────────────────────────────────────────── */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
}

#hud.hidden { display: none; }

#hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 16px 0;
}

#hud-score {
  line-height: 1;
}

#score-value {
  font-size: 2rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 0 8px rgba(255,255,255,0.4);
  letter-spacing: 2px;
}

/* Meilenstein: Zahl leuchtet einmal kurz groß auf (zentriert, über dem Spiel) */
.milestone-flash {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 15;
  font-family: 'Courier New', Courier, monospace;
  font-size: 5rem;
  font-weight: 900;
  letter-spacing: 3px;
  color: #ffd700;
  text-shadow: 0 0 30px rgba(255, 215, 0, 0.9), 0 0 70px rgba(255, 200, 40, 0.55);
  opacity: 0;
}

.milestone-flash.hidden { display: none; }

.milestone-flash.play {
  animation: milestoneFlash 2.4s ease-out forwards;
}

@keyframes milestoneFlash {
  0%   { opacity: 0; transform: scale(0.3); }
  20%  { opacity: 1; transform: scale(1.15); }
  55%  { opacity: 1; transform: scale(1.0); }
  100% { opacity: 0; transform: scale(1.0); }
}

#hud-highscore {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  margin-right: 46px;   /* Platz für den Pause-Button */
}

.pause-btn {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 6;
  pointer-events: auto;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 2px;
  cursor: pointer;
}

.pause-btn:hover {
  background: rgba(255, 0, 204, 0.25);
  border-color: #ff00cc;
}

#pause-screen {
  background: rgba(5, 5, 16, 0.82);
  gap: 18px;
  z-index: 30;
}

.hud-label {
  font-size: 0.6rem;
  color: #555;
  letter-spacing: 1px;
}

#highscore-value {
  font-size: 0.9rem;
  color: #888;
}

/* ── Effect Badges ────────────────────────────────────── */
#hud-effects {
  display: flex;
  gap: 8px;
  padding: 6px 16px;
}

.effect-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 1px;
  border-radius: 3px;
}

.effect-badge.hidden { display: none; }

/* Timer: Ring (conic-gradient) läuft von voll auf leer; im Zentrum das Item-Sprite */
.badge-timer {
  flex: 0 0 auto;
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  padding: 2.5px;              /* Ringdicke */
  border-radius: 50%;
  background: conic-gradient(currentColor calc(var(--frac, 1) * 360deg), rgba(255, 255, 255, 0.18) 0);
}

.badge-sprite {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.55);  /* deckt Ring-Zentrum ab, freigestellte Kanten sauber */
}

.effect-badge.star {
  background: rgba(255, 215, 0, 0.2);
  color: #ffd700;
  border: 1px solid #ffd70088;
}

.effect-badge.joint {
  background: rgba(0, 200, 80, 0.2);
  color: #00e676;
  border: 1px solid #00e67688;
}

.effect-badge.lipstick {
  background: rgba(225, 29, 58, 0.2);
  color: #ff4060;
  border: 1px solid #e11d3a88;
}

.effect-badge.micro {
  background: rgba(168, 85, 247, 0.2);
  color: #c084fc;
  border: 1px solid #a855f788;
}

.effect-badge.beer {
  background: rgba(201, 166, 107, 0.2);
  color: #d9bd86;
  border: 1px solid #c9a66b88;
}

.effect-badge.mega {
  background: rgba(255, 215, 0, 0.28);
  color: #ffe14d;
  border: 1px solid #ffd700;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

#multiplier-badge {
  background: rgba(255, 0, 204, 0.2);
  color: #ff00cc;
  border: 1px solid #ff00cc88;
}

/* ── Loading Screen ───────────────────────────────────── */
#loading-bar-wrap {
  width: 280px;
  height: 6px;
  background: #1a1a2e;
  border: 1px solid #ff00cc44;
  margin-top: 8px;
}

#loading-bar {
  height: 100%;
  width: 0%;
  background: #ff00cc;
  box-shadow: 0 0 10px #ff00cc;
  transition: width 0.2s ease;
}

#loading-label {
  margin-top: 10px;
  color: #555;
  font-size: 0.7rem;
  letter-spacing: 2px;
}
