/*
  Copyright (c) 2026 Martin Bundschuh, SeeBubble Media FlexCo. All rights reserved.
  Written by Martin Bundschuh.

  FEDERKRAWALL – Die Schopfhühner kommen
  Stylesheet für das Spiel (spiel.html). Eigenständig; die Tokens entsprechen
  denen der Webseite (css/style.css), damit alles aus einem Guss wirkt.

  Inhalt
  ------
   1. Tokens
   2. Grundlagen, Canvas, Overlay-Ebenen
   3. Glas & Knöpfe (wie Webseite)
   4. HUD (Punkte, Zeit, Munition, Warnungen)
   5. Bildschirme (Menü, Panels, Countdown, Rundenende)
   6. Titel-Animation
   7. Highscore-Liste, Statistik, Namensformular
   8. Touch-Bedienung (Nachladen, Kamera-Pfeile)
   9. Reduzierte Bewegung, Responsiv
  10. Level: HUD-Panel, Schwierigkeits-Pips, Auswahl-Karten, Intro-Karte, Sterne, Finale
  11. Boss-Kampf: Warnstreifen, Namens-/Siegkarte, Zeit-Anzeige, Abzeichen
*/

/* ==========================================================================
   1. Tokens
   ========================================================================== */
:root {
  --c-bg: #070b1f;
  --c-bg-2: #0d1433;
  --c-text: #eef1ff;
  --c-muted: #9aa3c7;
  --c-cyan: #5ef2ff;
  --c-pink: #ff6ad5;
  --c-violet: #8b5cff;
  --c-gold: #ffd36e;
  --c-mint: #6dffb3;
  --c-red: #ff5a5a;

  --c-line: color-mix(in oklab, var(--c-text) 12%, transparent);
  --c-line-strong: color-mix(in oklab, var(--c-text) 24%, transparent);
  --c-glass: color-mix(in oklab, var(--c-bg-2) 42%, transparent);
  --c-glass-strong: color-mix(in oklab, var(--c-bg-2) 70%, transparent);
  --c-focus: var(--c-cyan);

  --iri-linear: linear-gradient(120deg,
      var(--c-cyan) 0%, var(--c-violet) 28%, var(--c-pink) 52%, var(--c-gold) 76%, var(--c-mint) 100%);

  --font-display: "Titan One", "Arial Rounded MT Bold", "Arial Black", system-ui, sans-serif;
  --font-text: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;

  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-pill: 999px;
  --shadow-glass: 0 20px 60px -20px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .08);
  --glow-cyan: 0 0 40px -6px color-mix(in oklab, var(--c-cyan) 60%, transparent);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

/* ==========================================================================
   2. Grundlagen
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: none;
}
body.is-menu #game,
body.is-paused #game,
body.is-over #game { cursor: default; }

#flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: #fff;
  opacity: 0;
  z-index: 2;
}
#flash.slowmo {
  background: radial-gradient(60% 60% at 50% 50%, transparent 40%, color-mix(in oklab, var(--c-violet) 40%, transparent));
  opacity: 1;
  transition: opacity .2s;
}

#ui {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
#ui button, #ui a, #ui input, #ui form, #ui [tabindex] { pointer-events: auto; }
:focus-visible { outline: 2px solid var(--c-focus); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ==========================================================================
   3. Glas & Knöpfe
   ========================================================================== */
.glass {
  background: var(--c-glass);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-glass);
}

.btn {
  --btn-bg: var(--c-glass-strong);
  --btn-color: var(--c-text);
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  padding: .9rem 1.6rem;
  border-radius: var(--r-pill);
  font-family: var(--font-text);
  font-weight: 800;
  font-size: .95rem;
  letter-spacing: .02em;
  line-height: 1;
  color: var(--btn-color);
  background: var(--btn-bg);
  border: 1px solid var(--c-line-strong);
  text-decoration: none;
  overflow: hidden;
  white-space: nowrap;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: transform .5s var(--ease-spring), box-shadow .4s, border-color .3s, color .3s;
}
.btn__icon { width: 18px; height: 18px; flex: none; }
.btn--lg { padding: 1.1rem 2.2rem; font-size: 1.05rem; }
.btn--primary {
  --btn-color: var(--c-bg);
  background: var(--iri-linear);
  border-color: transparent;
  box-shadow: 0 10px 30px -10px color-mix(in oklab, var(--c-pink) 60%, transparent);
}
.btn--primary::after {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.55) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform .8s var(--ease-out);
}
.btn--primary:hover::after, .btn--primary:focus-visible::after { transform: translateX(120%); }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -12px color-mix(in oklab, var(--c-cyan) 70%, transparent); }
.btn--ghost:hover { border-color: var(--c-cyan); box-shadow: var(--glow-cyan); transform: translateY(-2px); }
.btn:active { transform: translateY(1px) scale(.98); }

.iconbtn {
  width: 44px; height: 44px;
  display: inline-grid; place-items: center;
  padding: 0;
  border-radius: 50%;
  color: var(--c-text);
  cursor: pointer;
  transition: transform .3s var(--ease-spring), border-color .3s;
}
.iconbtn svg { width: 22px; height: 22px; fill: currentColor; }
.iconbtn:hover { border-color: var(--c-cyan); transform: scale(1.06); }
.iconbtn .ico-off { display: none; }
.iconbtn[aria-pressed="false"] .ico-on { display: none; }
.iconbtn[aria-pressed="false"] .ico-off { display: block; }
.iconbtn[aria-pressed="false"] { color: var(--c-muted); }
.js-music[aria-pressed="false"] svg { opacity: .45; }

/* ==========================================================================
   4. HUD
   ========================================================================== */
#hud {
  position: absolute;
  inset: 0;
  padding: calc(14px + var(--safe-t)) calc(14px + var(--safe-r)) calc(14px + var(--safe-b)) calc(14px + var(--safe-l));
}
.hud__group {
  position: absolute;
  top: calc(14px + var(--safe-t));
  padding: .5rem .9rem .55rem;
  min-width: 120px;
  pointer-events: none;
}
.hud__group--left { left: calc(14px + var(--safe-l)); }
.hud__group--center { left: 50%; transform: translateX(-50%); text-align: center; min-width: 110px; }
.hud__group--right {
  right: calc(14px + var(--safe-r));
  display: flex; gap: 8px;
  padding: 0; min-width: 0; background: none; border: 0; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
.hud__label {
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--c-muted);
  font-weight: 800;
}
.hud__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  transition: transform .15s var(--ease-spring);
}
.hud__value.bump { transform: scale(1.18); }
.hud__value--time.warn { color: var(--c-red); animation: time-pulse .5s ease-in-out infinite alternate; }
@keyframes time-pulse { from { transform: scale(1); } to { transform: scale(1.12); } }
.hud__combo {
  margin-top: .15rem;
  font-weight: 800;
  font-size: .85rem;
  color: var(--c-gold);
  min-height: 1em;
}
.hud__combo.pop { animation: combo-pop .35s var(--ease-spring); }
@keyframes combo-pop { 0% { transform: scale(.6); } 100% { transform: scale(1); } }

/* Munition */
#ammo {
  position: absolute;
  right: calc(14px + var(--safe-r));
  bottom: calc(14px + var(--safe-b));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  padding: .6rem .8rem;
  color: var(--c-text);
  cursor: pointer;
  font: inherit;
  transition: border-color .3s, transform .2s;
}
#ammo:hover { border-color: var(--c-gold); }
#ammo.empty { border-color: var(--c-red); animation: ammo-shake .4s; }
#ammo.reloading { border-color: var(--c-cyan); }
@keyframes ammo-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.ammo__shells { display: flex; gap: 4px; height: 30px; }
.shell {
  width: 11px; height: 30px;
  border-radius: 4px 4px 3px 3px;
  background: linear-gradient(#ff5a5a 0 70%, #e2b45a 70% 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.25), inset 2px 0 0 rgba(255,255,255,.25);
  transition: transform .5s var(--ease-out), opacity .5s;
  transform-origin: 50% 100%;
}
.shell.out { transform: translateY(42px) rotate(60deg); opacity: 0; }
.shell.in { animation: shell-in .35s var(--ease-spring) both; }
@keyframes shell-in { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
.ammo__bar { width: 100%; height: 4px; border-radius: 2px; background: var(--c-line-strong); overflow: hidden; }
.ammo__bar i { display: block; height: 100%; width: 0; background: var(--iri-linear); }
.ammo__text { font-size: .72rem; letter-spacing: .12em; color: var(--c-muted); font-weight: 800; font-variant-numeric: tabular-nums; }

.hud__warn {
  position: absolute;
  left: 50%; top: 62%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.6rem, 6vw, 4rem);
  letter-spacing: .06em;
  color: #fff;
  -webkit-text-stroke: 2px var(--c-red);
  text-shadow: 0 0 30px color-mix(in oklab, var(--c-red) 80%, transparent), 0 4px 0 rgba(0,0,0,.4);
  animation: warn-blink .5s steps(2) infinite, warn-pop .4s var(--ease-spring);
  pointer-events: none;
}
@keyframes warn-blink { to { opacity: .35; } }
@keyframes warn-pop { from { transform: translate(-50%, -50%) scale(.5) rotate(-6deg); } }

.hud__banner {
  position: absolute;
  left: 50%; top: 24%;
  transform: translateX(-50%);
  padding: .5rem 1.2rem;
  border-radius: var(--r-pill);
  background: var(--c-glass-strong);
  border: 1px solid var(--c-line-strong);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1rem, 3vw, 1.6rem);
  color: var(--c-gold);
  text-align: center;
  animation: banner-in .5s var(--ease-spring) both;
  pointer-events: none;
  white-space: nowrap;
}
@keyframes banner-in { from { transform: translate(-50%, -20px) scale(.8); opacity: 0; } }

/* ==========================================================================
   5. Bildschirme
   ========================================================================== */
.screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  background: radial-gradient(80% 80% at 50% 40%, color-mix(in oklab, var(--c-bg) 45%, transparent), color-mix(in oklab, var(--c-bg) 80%, transparent));
  overflow: auto;
  animation: screen-in .35s var(--ease-out);
  pointer-events: auto;
}
.screen--transparent { background: none; pointer-events: none; }
@keyframes screen-in { from { opacity: 0; } }

.menu { text-align: center; max-width: 900px; width: 100%; }
.menu__eyebrow {
  margin: 0 0 .6rem;
  font-size: .8rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--c-gold);
  font-weight: 800;
}
.menu__lead { color: var(--c-muted); font-size: clamp(1rem, 1.6vw, 1.2rem); margin: .4rem auto 1.8rem; max-width: 560px; }
.menu__nav { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; }
.menu__hint { margin-top: 1.6rem; font-size: .8rem; color: var(--c-muted); }

.panel {
  width: min(100%, 560px);
  padding: clamp(1.2rem, 3vw, 2.2rem);
  border-radius: var(--r-lg);
  text-align: center;
  background: var(--c-glass-strong);
}
.panel--narrow { width: min(100%, 380px); }
.panel--wide { width: min(100%, 720px); }
.panel__title {
  margin: 0 0 .6rem;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  line-height: 1.1;
}
.panel__title span { background: var(--iri-linear); -webkit-background-clip: text; background-clip: text; color: transparent; }
.panel__note { color: var(--c-muted); margin: .2rem 0 1rem; }
.panel__actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin-top: 1.2rem; }
.panel__actions--col { flex-direction: column; align-items: stretch; }

.howto { text-align: left; padding-left: 1.2rem; margin: 0 0 1rem; line-height: 1.55; }
.howto li + li { margin-top: .5rem; }
kbd {
  font-family: var(--font-text);
  font-size: .8em;
  font-weight: 800;
  padding: .1em .45em;
  border-radius: 6px;
  border: 1px solid var(--c-line-strong);
  background: rgba(255,255,255,.06);
  box-shadow: 0 2px 0 rgba(0,0,0,.35);
}

/* Countdown */
.countdown {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(6rem, 25vw, 16rem);
  color: #fff;
  -webkit-text-stroke: 3px var(--c-bg);
  text-shadow: 0 0 60px color-mix(in oklab, var(--c-gold) 70%, transparent), 0 8px 0 rgba(0,0,0,.35);
  animation: count-pop .9s var(--ease-out) both;
}
@keyframes count-pop {
  0%   { transform: scale(2.2) rotate(-8deg); opacity: 0; }
  25%  { transform: scale(1) rotate(0); opacity: 1; }
  80%  { transform: scale(.95); opacity: 1; }
  100% { transform: scale(.6); opacity: 0; }
}

/* Vorspann (SeeBubble Media) */
.screen--intro {
  background: radial-gradient(70% 60% at 50% 45%, #121a3d, var(--c-bg) 75%);
  cursor: pointer;
  animation: none;
  transition: opacity .5s;
}
.screen--intro.is-out { opacity: 0; pointer-events: none; }
.intro { text-align: center; animation: intro-in 1.1s var(--ease-out) both; }
.intro__bubble {
  display: block;
  width: clamp(64px, 12vw, 110px); height: clamp(64px, 12vw, 110px);
  margin: 0 auto 1.2rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255,255,255,.95) 0 8%, rgba(255,255,255,0) 30%),
    conic-gradient(from 20deg, var(--c-cyan), var(--c-violet), var(--c-pink), var(--c-gold), var(--c-mint), var(--c-cyan));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25), inset -12px -14px 30px rgba(255,255,255,.18), 0 0 60px -10px var(--c-cyan);
  opacity: .9;
  animation: intro-float 3s ease-in-out infinite;
}
.intro__name { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.5rem, 4.5vw, 2.8rem); letter-spacing: .02em; }
.intro__sub { margin: .4rem 0 0; color: var(--c-muted); letter-spacing: .3em; text-transform: uppercase; font-size: .8rem; font-weight: 800; animation: intro-in 1.1s .4s var(--ease-out) both; }
.intro__skip { position: absolute; bottom: calc(18px + var(--safe-b)); left: 0; right: 0; text-align: center; color: var(--c-muted); font-size: .75rem; opacity: .6; margin: 0; }
@keyframes intro-in { from { opacity: 0; transform: translateY(14px) scale(.96); } }
@keyframes intro-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

.credit {
  margin: 1.2rem 0 0;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c-muted);
  font-weight: 800;
  opacity: .8;
}
.credit--menu { position: absolute; bottom: calc(14px + var(--safe-b)); left: 0; right: 0; text-align: center; margin: 0; }

/* ==========================================================================
   6. Titel-Animation
   ========================================================================== */
.title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.9rem, 8.2vw, 7.5rem);
  line-height: .95;
  letter-spacing: .01em;
  display: flex;
  flex-wrap: nowrap;
  white-space: nowrap;
  justify-content: center;
  color: #fff;
  text-shadow: 0 6px 0 color-mix(in oklab, var(--c-violet) 60%, #000), 0 20px 50px rgba(0,0,0,.6);
}
.title span {
  display: inline-block;
  animation: title-bounce 2.6s var(--ease-spring) infinite;
  animation-delay: calc(var(--i, 0) * .07s);
  transform-origin: 50% 100%;
}
.title .title__gap { display: none; }
.title span:nth-child(1)  { --i: 0;  color: var(--c-gold); }
.title span:nth-child(2)  { --i: 1; }
.title span:nth-child(3)  { --i: 2; }
.title span:nth-child(4)  { --i: 3; }
.title span:nth-child(5)  { --i: 4; }
.title span:nth-child(7)  { --i: 5;  color: var(--c-pink); }
.title span:nth-child(8)  { --i: 6; }
.title span:nth-child(9)  { --i: 7; }
.title span:nth-child(10) { --i: 8; }
.title span:nth-child(11) { --i: 9; }
.title span:nth-child(12) { --i: 10; }
.title span:nth-child(13) { --i: 11; color: var(--c-cyan); }
@keyframes title-bounce {
  0%, 100% { transform: translateY(0) rotate(0); }
  8%  { transform: translateY(-14%) rotate(-4deg) scaleY(1.08); }
  16% { transform: translateY(0) rotate(2deg) scaleY(.94); }
  24% { transform: translateY(-4%) rotate(0); }
  32% { transform: translateY(0); }
}

/* ==========================================================================
   7. Highscore-Liste, Statistik, Namensformular
   ========================================================================== */
.scores {
  list-style: none;
  margin: 0 0 .6rem;
  padding: 0;
  text-align: left;
  max-height: min(50vh, 440px);
  overflow: auto;
}
.scores li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: .8rem;
  align-items: center;
  padding: .55rem .7rem;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  animation: row-in .5s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
@keyframes row-in { from { opacity: 0; transform: translateX(-12px); } }
.scores li:nth-child(odd) { background: rgba(255,255,255,.04); }
.scores li.is-new {
  border-color: var(--c-gold);
  background: color-mix(in oklab, var(--c-gold) 14%, transparent);
  animation: row-new .9s var(--ease-spring) both;
}
@keyframes row-new {
  0%   { transform: scale(.85); opacity: 0; }
  50%  { transform: scale(1.06); opacity: 1; box-shadow: 0 0 40px -4px var(--c-gold); }
  100% { transform: scale(1); }
}
.scores .rank { font-family: var(--font-display); font-weight: 700; color: var(--c-muted); text-align: center; }
.scores li:nth-child(1) .rank { color: var(--c-gold); }
.scores li:nth-child(2) .rank { color: #d9dde8; }
.scores li:nth-child(3) .rank { color: #d9975a; }
.scores .name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores .meta { display: block; font-size: .72rem; color: var(--c-muted); font-weight: 500; }
.scores .pts { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; }
.scores--compact { max-height: 220px; }
.scores--compact li { padding: .35rem .6rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .6rem;
  margin: 1rem 0;
}
.stat {
  padding: .6rem .4rem;
  border-radius: var(--r-md);
  background: rgba(255,255,255,.05);
  border: 1px solid var(--c-line);
}
.stat__label { display: block; font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--c-muted); font-weight: 800; }
.stat__value { display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.stat:first-child .stat__value { color: var(--c-gold); }

.nameform { margin: .6rem 0 1rem; }
.nameform label { display: block; font-weight: 800; color: var(--c-gold); margin-bottom: .5rem; }
.nameform__row { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.nameform input {
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  padding: .8rem 1rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--c-line-strong);
  background: rgba(0,0,0,.3);
  color: var(--c-text);
  min-width: 200px;
  -webkit-user-select: text; user-select: text;
}
.nameform input:focus { border-color: var(--c-cyan); outline: none; box-shadow: var(--glow-cyan); }

/* ==========================================================================
   8. Touch-Bedienung
   ========================================================================== */
#btn-reload-touch, #btn-rocket-touch {
  position: absolute;
  left: calc(14px + var(--safe-l));
  bottom: calc(14px + var(--safe-b));
  padding: 1rem 1.6rem;
  font-size: 1rem;
}
#btn-rocket-touch { bottom: calc(78px + var(--safe-b)); border-color: #ff8f5e; }
.pan {
  position: absolute;
  top: 50%;
  width: 56px; height: 110px;
  transform: translateY(-50%);
  display: grid; place-items: center;
  color: var(--c-text);
  cursor: pointer;
  font-size: 1.6rem;
  opacity: .8;
}
.pan--left { left: calc(6px + var(--safe-l)); border-radius: 0 var(--r-md) var(--r-md) 0; }
.pan--right { right: calc(6px + var(--safe-r)); border-radius: var(--r-md) 0 0 var(--r-md); }
.pan:active { opacity: 1; border-color: var(--c-cyan); }

/* ==========================================================================
   9. Reduzierte Bewegung, Responsiv
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .title span, .hud__warn, .countdown, .scores li, .screen, .hud__banner, .intro, .intro__sub, .intro__bubble { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
  .btn, .shell, .hud__value { transition: none; }
}

@media (max-width: 720px) {
  .hud__group { padding: .3rem .5rem; min-width: 72px; }
  .hud__group--center { left: calc(14px + var(--safe-l) + 80px); transform: none; text-align: left; }
  .hud__value { font-size: 1.05rem; }
  .hud__label { font-size: .56rem; letter-spacing: .12em; }
  .hud__group--right { gap: 4px; }
  .iconbtn { width: 34px; height: 34px; }
  .iconbtn svg { width: 17px; height: 17px; }
  #ammo { padding: .45rem .6rem; }
  .shell { width: 8px; height: 22px; }
  .ammo__shells { height: 22px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .menu__nav .btn { flex: 1 1 40%; }
  .menu__hint { display: none; }
}
@media (max-height: 460px) {
  .hud__group--center { top: calc(8px + var(--safe-t)); }
  .panel { padding: .9rem 1.1rem; }
  .panel__title { font-size: 1.2rem; }
  .stats { gap: .35rem; margin: .5rem 0; }
  .stat { padding: .3rem; }
  .stat__value { font-size: .95rem; }
  .scores--compact { max-height: 110px; }
  .menu__lead { margin-bottom: .8rem; }
}

/* ==========================================================================
   10. Level: HUD-Panel, Pips, Auswahl, Intro-Karte, Sterne, Finale
   ========================================================================== */
.hud__group--level {
  top: auto;
  left: calc(14px + var(--safe-l));
  bottom: calc(14px + var(--safe-b));
  min-width: 150px;
  max-width: 260px;
  padding: .45rem .8rem .5rem;
}
body.is-touch .hud__group--level { bottom: calc(142px + var(--safe-b)); }
.hud__label--level { color: var(--c-gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.goal { display: block; width: 100%; height: 5px; margin: .35rem 0 .3rem; border-radius: 3px; background: var(--c-line-strong); overflow: hidden; }
.goal i { display: block; height: 100%; width: 0; background: var(--iri-linear); transition: width .4s var(--ease-out); }
.goal.done i { background: var(--c-mint); box-shadow: 0 0 12px var(--c-mint); }
.hud__row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.hud__goaltext { font-size: .72rem; font-weight: 800; color: var(--c-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pips { display: inline-flex; gap: 3px; align-items: flex-end; }
.pip { display: block; width: 6px; height: 10px; border-radius: 2px; background: rgba(255,255,255,.14); border: 1px solid var(--c-line-strong); }
.pip:nth-child(2) { height: 12px; } .pip:nth-child(3) { height: 14px; } .pip:nth-child(4) { height: 16px; } .pip:nth-child(5) { height: 18px; } .pip:nth-child(6) { height: 20px; }
.pip.is-on { background: var(--iri-linear); border-color: transparent; box-shadow: 0 0 8px -2px var(--c-cyan); }
.pip--big { width: 10px; } .pip--big:nth-child(n) { height: calc(12px + 3px * var(--n, 1)); }
.pip--big:nth-child(1) { height: 12px; } .pip--big:nth-child(2) { height: 15px; } .pip--big:nth-child(3) { height: 18px; } .pip--big:nth-child(4) { height: 21px; } .pip--big:nth-child(5) { height: 24px; } .pip--big:nth-child(6) { height: 27px; }

/* Schwierigkeitswahl im Menü */
.seg { display: inline-flex; align-items: center; gap: 4px; margin-top: 1.1rem; padding: 4px; border-radius: var(--r-pill); background: var(--c-glass); border: 1px solid var(--c-line); }
.seg__label { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--c-muted); font-weight: 800; padding: 0 .6rem 0 .8rem; }
.seg__btn { font: inherit; font-weight: 800; font-size: .85rem; padding: .5rem .9rem; border-radius: var(--r-pill); border: 1px solid transparent; background: transparent; color: var(--c-muted); cursor: pointer; transition: background .25s, color .25s; }
.seg__btn:hover { color: var(--c-text); }
.seg__btn[aria-pressed="true"] { background: var(--iri-linear); color: var(--c-bg); }

/* Levelauswahl */
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin: .4rem 0 .4rem; text-align: left; }
.lvcard {
  display: flex; flex-direction: column; padding: 0; overflow: hidden;
  font: inherit; color: var(--c-text); cursor: pointer; text-align: left;
  transition: transform .4s var(--ease-spring), border-color .3s, box-shadow .3s;
}
.lvcard:hover:not(:disabled), .lvcard:focus-visible { transform: translateY(-3px); border-color: var(--c-cyan); box-shadow: var(--glow-cyan); }
.lvcard.is-locked { cursor: not-allowed; opacity: .55; }
.lvcard.is-locked .lvcard__img { filter: grayscale(1) brightness(.6); }
.lvcard__pv { position: relative; aspect-ratio: 16 / 9; background: #0d1433; overflow: hidden; }
.lvcard__img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lvcard__num { position: absolute; left: 8px; top: 8px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--c-glass-strong); font-family: var(--font-display); font-size: .9rem; color: var(--c-gold); border: 1px solid var(--c-line-strong); }
.lvcard__lock { position: absolute; inset: auto 8px 8px auto; padding: .2rem .6rem; border-radius: var(--r-pill); background: rgba(0,0,0,.55); font-size: .7rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--c-muted); }
.lvcard__body { padding: .6rem .75rem .7rem; display: grid; gap: .15rem; }
.lvcard__body b { font-family: var(--font-display); font-weight: 400; font-size: 1rem; line-height: 1.15; }
.lvcard__body small { color: var(--c-muted); font-size: .76rem; }
.lvcard__goal { font-size: .7rem; color: var(--c-muted); font-weight: 800; letter-spacing: .04em; }
.lvcard__stars { display: inline-flex; gap: 3px; margin-top: .2rem; }
.lvcard__stars .star { width: 14px; height: 14px; }

/* Sterne (Levelauswahl klein, Level geschafft groß) */
.star {
  display: inline-block; width: 46px; height: 46px;
  background: rgba(255,255,255,.1);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6L2.5 9.4l6.6-.8z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6L2.5 9.4l6.6-.8z'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: background .3s;
}
.star.is-on { background: linear-gradient(180deg, #fff0a8, var(--c-gold) 55%, #f0a020); }
.star.is-pop { animation: star-pop .7s var(--ease-spring) both; }
@keyframes star-pop { 0% { transform: scale(.2) rotate(-40deg); } 60% { transform: scale(1.35) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
.stars { display: flex; justify-content: center; gap: .6rem; margin: .4rem 0 .6rem; }
.stars .star:nth-child(2) { transform-origin: 50% 50%; width: 58px; height: 58px; margin-top: -8px; }
.stats--3 { grid-template-columns: repeat(3, 1fr); }

/* Level-Intro-Karte: durchsichtig, die Kamerafahrt dahinter bleibt sichtbar */
.screen--intro-card { background: linear-gradient(180deg, rgba(7,11,31,.25), rgba(7,11,31,.55)); align-content: end; place-items: end center; cursor: pointer; }
.levelcard { width: min(100%, 560px); padding: 1.2rem 1.6rem 1.4rem; margin-bottom: 6vh; text-align: center; background: var(--c-glass-strong); border-radius: var(--r-lg); animation: card-in .7s var(--ease-spring) both; cursor: default; }
@keyframes card-in { from { opacity: 0; transform: translateY(30px) scale(.94); } }
.levelcard__name { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(1.8rem, 6vw, 3.2rem); line-height: 1.05; background: var(--iri-linear); -webkit-background-clip: text; background-clip: text; color: transparent; }
.levelcard__sub { margin: .2rem 0 .6rem; color: var(--c-gold); font-weight: 800; letter-spacing: .08em; }
.levelcard__desc { margin: 0 auto .6rem; max-width: 460px; color: var(--c-text); line-height: 1.45; }
.levelcard__goal { margin: 0 0 .6rem; color: var(--c-mint); font-weight: 800; }
.levelcard__row { display: flex; justify-content: center; align-items: center; gap: .6rem; margin-bottom: .9rem; }

.pause__info { margin: -.4rem 0 1rem; font-size: .82rem; color: var(--c-gold); font-weight: 800; line-height: 1.4; }

/* Finale / Abspann */
.finale { margin: .6rem 0 .4rem; padding: 1rem 1.2rem; border-radius: var(--r-md); border: 1px solid var(--c-line-strong); background: linear-gradient(135deg, color-mix(in oklab, var(--c-violet) 22%, transparent), color-mix(in oklab, var(--c-pink) 14%, transparent)); animation: finale-glow 3s ease-in-out infinite alternate; }
@keyframes finale-glow { from { box-shadow: 0 0 30px -12px var(--c-cyan); } to { box-shadow: 0 0 50px -8px var(--c-pink); } }
.finale__title { margin: 0; font-family: var(--font-display); font-size: clamp(1.1rem, 3vw, 1.6rem); background: var(--iri-linear); -webkit-background-clip: text; background-clip: text; color: transparent; }
.finale__text { margin: .5rem 0; line-height: 1.45; }
.finale__credits { margin: 0; font-size: .74rem; color: var(--c-muted); letter-spacing: .06em; line-height: 1.6; }
body.is-finale #over-title { background: var(--iri-linear); -webkit-background-clip: text; background-clip: text; color: transparent; }

@media (max-width: 720px) {
  .levels { grid-template-columns: repeat(2, 1fr); gap: .5rem; }
  .lvcard__body { padding: .45rem .55rem .55rem; }
  .lvcard__body b { font-size: .85rem; }
  .hud__group--level { min-width: 120px; max-width: 46vw; padding: .3rem .55rem .35rem; }
  .hud__label--level { font-size: .56rem; }
  .hud__goaltext { font-size: .62rem; }
  .pip { width: 4px; }
  .seg { flex-wrap: wrap; justify-content: center; border-radius: var(--r-md); }
  .seg__label { width: 100%; text-align: center; padding: .2rem 0 .1rem; }
  .stats--3 { grid-template-columns: repeat(3, 1fr); }
  .star { width: 36px; height: 36px; }
  .stars .star:nth-child(2) { width: 46px; height: 46px; }
  .levelcard { padding: .9rem 1rem 1rem; margin-bottom: 3vh; }
  .levelcard__desc { font-size: .9rem; }
}
@media (max-height: 460px) {
  .levelcard { margin-bottom: 1vh; padding: .6rem 1rem .8rem; }
  .levelcard__desc, .levelcard__row { display: none; }
  .levels { grid-template-columns: repeat(3, 1fr); }
  .lvcard__pv { aspect-ratio: 16 / 7; }
  .stars { margin: .1rem 0 .3rem; }
}

/* ==========================================================================
   11. Boss-Kampf: Warnstreifen, Namens-/Siegkarte, Zeit-Anzeige, Abzeichen
   ========================================================================== */
.hud__value--time.boss { color: var(--c-red); font-size: 1.15rem; letter-spacing: .04em; }
@media (max-width: 720px) { .hud__value--time.boss { font-size: .9rem; } }

/* „BOSS NAHT!“: rote Warnstreifen oben/unten, Text pulsiert */
.boss-warn { position: absolute; inset: 0; pointer-events: none; animation: bosswarn-in .4s var(--ease-out) both; }
.boss-warn__stripe {
  position: absolute; left: 0; right: 0; height: clamp(18px, 3.2vh, 32px);
  background: repeating-linear-gradient(-45deg, #ff2a2a 0 28px, #1b0d12 28px 56px);
  background-size: 80px 100%;
  box-shadow: 0 0 30px rgba(255,42,42,.55);
  animation: bosswarn-stripes .6s linear infinite;
  opacity: .92;
}
.boss-warn__stripe--top { top: 0; }
.boss-warn__stripe--bottom { bottom: 0; animation-direction: reverse; }
.boss-warn__text {
  position: absolute; left: 50%; top: 50%; margin: 0;
  transform: translate(-50%, -50%);
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(2.2rem, 9vw, 6rem); letter-spacing: .08em; line-height: 1;
  color: #fff; -webkit-text-stroke: 3px #ff2a2a; paint-order: stroke fill;
  text-shadow: 0 0 40px rgba(255,42,42,.85), 0 6px 0 rgba(0,0,0,.45);
  animation: bosswarn-pulse .5s steps(2) infinite, bosswarn-pop .5s var(--ease-spring) both;
}
@keyframes bosswarn-in { from { opacity: 0; } }
@keyframes bosswarn-stripes { to { background-position: 80px 0; } }
@keyframes bosswarn-pulse { to { opacity: .45; } }
@keyframes bosswarn-pop { from { transform: translate(-50%, -50%) scale(.4) rotate(-8deg); } }

/* Namenskarte (Auftritt) und Siegkarte: Comic-Einblendung mit Rahmen und Schrägstellung */
.boss-card {
  position: absolute; left: 50%; top: 58%;
  transform: translate(-50%, -50%) rotate(-2deg);
  width: min(92vw, 560px); padding: 1rem 1.6rem 1.1rem;
  text-align: center; pointer-events: none;
  background: linear-gradient(135deg, #1b0d12, #3a1020 55%, #1b0d12);
  border: 4px solid #fff; border-radius: 18px 28px 18px 28px;
  box-shadow: 0 0 0 4px #ff2a2a, 0 24px 60px -12px rgba(0,0,0,.7), 0 0 60px -10px rgba(255,42,42,.7);
  animation: bosscard-in .55s var(--ease-spring) both;
}
.boss-card::before { /* Comic-„Sprechblasen-Zacke“ */
  content: ""; position: absolute; left: 50%; bottom: -22px; width: 0; height: 0;
  transform: translateX(-50%); border: 14px solid transparent; border-top: 18px solid #fff; border-bottom: 0;
}
.boss-card__eyebrow { margin: 0; color: var(--c-gold); font-weight: 800; letter-spacing: .3em; text-transform: uppercase; font-size: .72rem; }
.boss-card__name {
  margin: .1rem 0 0; font-family: var(--font-display); font-weight: 400;
  font-size: clamp(1.7rem, 6.5vw, 3.1rem); line-height: 1.05; color: #fff;
  text-shadow: 0 4px 0 #ff2a2a, 0 8px 0 rgba(0,0,0,.4);
  animation: bosscard-shake .4s .2s var(--ease-spring) both;
}
.boss-card__title { margin: .25rem 0 0; color: #ffd36e; font-weight: 800; font-size: clamp(.9rem, 2.4vw, 1.15rem); letter-spacing: .06em; }
.boss-card__lines { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem .8rem; }
.boss-card__lines li { padding: .2rem .7rem; border-radius: var(--r-pill); background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); font-weight: 800; font-size: .85rem; color: #fff; animation: bosscard-line .45s var(--ease-spring) both; }
.boss-card__lines li:nth-child(2) { animation-delay: .25s; }
.boss-card__lines li:nth-child(3) { animation-delay: .5s; color: var(--c-mint); }
.boss-card.is-win { background: linear-gradient(135deg, #0d1433, #2a1a5a 55%, #0d1433); box-shadow: 0 0 0 4px var(--c-gold), 0 24px 60px -12px rgba(0,0,0,.7), 0 0 70px -8px rgba(255,211,110,.8); transform: translate(-50%, -50%) rotate(2deg); top: 54%; }
.boss-card.is-win .boss-card__name { text-shadow: 0 4px 0 #c98a1a, 0 8px 0 rgba(0,0,0,.4); font-size: clamp(1.3rem, 4.5vw, 2rem); }
.boss-card.is-win .boss-card__title { color: #fff; font-family: var(--font-display); font-size: clamp(1.6rem, 6vw, 2.8rem); background: var(--iri-linear); -webkit-background-clip: text; background-clip: text; color: transparent; }
.boss-card.is-win::before { border-top-color: #fff; }
@keyframes bosscard-in { from { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(10deg); } }
@keyframes bosscard-shake { 0% { transform: scale(1.4); } 100% { transform: scale(1); } }
@keyframes bosscard-line { from { opacity: 0; transform: translateY(10px) scale(.7); } }

/* „Level geschafft!“: Boss-Zeilen und Abzeichen */
.stat--boss .stat__value { color: var(--c-pink); }
.badge {
  display: inline-flex; align-items: center; gap: .5rem; margin: .2rem auto .4rem;
  padding: .4rem 1rem .4rem .6rem; border-radius: var(--r-pill);
  background: linear-gradient(120deg, color-mix(in oklab, var(--c-gold) 30%, transparent), color-mix(in oklab, var(--c-pink) 18%, transparent));
  border: 1px solid var(--c-gold); color: #fff; font-weight: 800; font-size: .9rem;
  box-shadow: 0 0 24px -6px var(--c-gold);
  animation: badge-in .7s .9s var(--ease-spring) both;
}
.badge__icon {
  width: 22px; height: 22px; flex: none;
  background: linear-gradient(180deg, #fff0a8, var(--c-gold) 55%, #f0a020);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
@keyframes badge-in { from { opacity: 0; transform: scale(.4) rotate(-12deg); } }

@media (max-width: 720px) {
  .boss-card { padding: .7rem 1rem .8rem; top: 56%; }
  .boss-card__lines li { font-size: .75rem; }
  .boss-warn__text { -webkit-text-stroke: 2px #ff2a2a; }
}
@media (max-height: 460px) {
  .boss-card { top: 60%; padding: .5rem .9rem .6rem; }
  .boss-card__name { font-size: 1.5rem; }
  .boss-warn__stripe { height: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .boss-warn, .boss-warn__stripe, .boss-warn__text, .boss-card, .boss-card__name, .boss-card__lines li, .badge { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
}
