/* Delta – Beat-Saber-Look: dunkler Nebel, Neonröhren-Schrift in Blau/Rot */
:root {
  --fg: #e8fbff;
  --muted: #7d8db0;
  --cyan: #19f0ff;
  --cyan-rgb: 25, 240, 255;
  --yellow: #ffe14d;
  --green: #3dff9a;
  --red: #ff3d6e;
  --bs-red: #ff2346;
  --bs-blue: #1e96ff;
  --bs-ice: #bef5ff;
  --tube-blue: 0 0 2px #fff, 0 0 8px #bef5ff, 0 0 18px #1e96ff, 0 0 40px #1e96ff, 0 0 80px rgba(30, 150, 255, .7);
  --tube-red: 0 0 2px #fff, 0 0 8px #ffb3c0, 0 0 18px #ff2346, 0 0 40px #ff2346, 0 0 80px rgba(255, 35, 70, .7);
  --text: "Exo 2", system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #05060d; color: var(--fg);
  font-family: var(--text);
  -webkit-user-select: none; user-select: none;
}
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.screen {
  position: fixed; inset: 0; display: none;
  align-items: center; justify-content: center;
  padding: 24px 16px;
}
.screen.active { display: flex; }
.screen.leaving { animation: fadeOut .5s forwards; }
@keyframes fadeOut { to { opacity: 0; } }

h2 {
  font-style: italic; font-weight: 600; letter-spacing: .04em; margin: 0 0 12px;
  font-size: clamp(24px, 3.4vw, 44px); color: #f2fbff; text-shadow: var(--tube-blue);
}

.panel {
  background: rgba(2, 12, 22, .72);
  border: 2px solid rgba(190, 245, 255, .55);
  border-radius: 18px;
  padding: clamp(20px, 3vw, 44px);
  box-shadow: 0 0 6px rgba(190, 245, 255, .6), 0 0 26px rgba(30, 150, 255, .55), 0 0 70px rgba(30, 150, 255, .25), inset 0 0 26px rgba(30, 150, 255, .18);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  max-width: 100%;
}
.panel.center { text-align: center; min-width: min(560px, 100%); }
.panel.wide { width: min(1200px, 100%); max-height: 100%; display: flex; flex-direction: column; }
.panel.warn { border-color: rgba(255, 61, 110, .6); box-shadow: 0 0 50px rgba(255, 61, 110, .3); }
.panel.warn h2 { text-shadow: 0 0 18px rgba(255, 61, 110, .8); }

.meta { color: var(--muted); font-size: clamp(15px, 1.5vw, 20px); margin: 0 0 20px; }

/* Logo (Magnific): dunkler Hintergrund verschmilzt per "screen" mit der Szene, Ränder weich ausgeblendet */
.intro-logo, .mini-logo {
  mix-blend-mode: screen;
  -webkit-mask-image: radial-gradient(circle at 50% 52%, #000 48%, transparent 71%);
          mask-image: radial-gradient(circle at 50% 52%, #000 48%, transparent 71%);
}
.mini-logo { width: 96px; height: 96px; margin-bottom: -6px; }

/* Intro */
.intro { display: flex; flex-direction: column; align-items: center; }
.intro-logo { width: min(52vh, 74vw); height: auto; opacity: 0; animation: logoIn 2.6s ease-out forwards; }
.logo-type {
  font-style: italic; font-weight: 400; letter-spacing: .18em; margin: 10px 0 0 .18em;
  font-size: clamp(36px, 7vw, 96px); color: #fff4f6; text-shadow: var(--tube-red);
  opacity: 0; animation: typeIn 2.6s ease-out .5s forwards;
}
@keyframes logoIn {
  0% { opacity: 0; transform: scale(.6); filter: brightness(.4) drop-shadow(0 0 0 var(--cyan)); }
  35% { opacity: 1; transform: scale(1.08); filter: brightness(2.2) drop-shadow(0 0 60px var(--cyan)); }
  55% { transform: scale(1); filter: brightness(1.2) drop-shadow(0 0 30px var(--cyan)); }
  100% { opacity: 1; transform: scale(1); filter: brightness(1) drop-shadow(0 0 22px var(--cyan)); }
}
@keyframes typeIn { 0% { opacity: 0; letter-spacing: .6em; } 60%, 100% { opacity: 1; letter-spacing: .18em; } }

/* Profilkarten + Buttons */
.cards { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.card, .btn {
  font-family: var(--text); font-style: italic; color: var(--fg); cursor: pointer;
  background: rgba(4, 14, 26, .8); border: 2px solid rgba(30, 150, 255, .55);
}
.card {
  width: min(232px, 80vw); padding: 26px 16px; border-radius: 18px;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.card-name {
  font-style: italic; font-weight: 600; font-size: clamp(36px, 4.5vw, 60px); letter-spacing: .04em;
  white-space: nowrap; color: #f2fbff; text-shadow: var(--tube-blue);
}
[data-profile="expert"] .card-name { font-size: clamp(26px, 3vw, 40px); line-height: 1.5; }

/* Klassenauswahl */
.grades { display: grid; grid-template-columns: repeat(4, minmax(64px, 110px)); gap: 14px; justify-content: center; margin: 18px 0 8px; }
.btn.grade { font-size: clamp(32px, 4vw, 52px); font-weight: 600; padding: 14px 0; text-shadow: var(--tube-blue); }
.card-sub { color: var(--muted); font-size: 16px; }

.menu { display: flex; flex-direction: column; gap: 12px; align-items: stretch; margin: 16px auto 0; max-width: 460px; }
.btn {
  font-weight: 700; font-size: clamp(18px, 1.9vw, 24px);
  border-radius: 14px; padding: 14px 22px;
  transition: transform .12s, box-shadow .12s, border-color .12s, background .12s;
}
.btn.primary { border-color: rgba(var(--cyan-rgb), .6); }
.btn.ghost { background: transparent; }
.tab.selected { border-color: var(--cyan); background: rgba(var(--cyan-rgb), .2); box-shadow: 0 0 18px rgba(var(--cyan-rgb), .4); }
.nav.focused, .nav:hover {
  border-color: #fff; background: rgba(30, 150, 255, .22);
  box-shadow: 0 0 4px #fff, 0 0 16px var(--bs-blue), 0 0 44px rgba(30, 150, 255, .7), inset 0 0 18px rgba(30, 150, 255, .35);
  transform: scale(1.03); outline: none;
}
.nav:focus-visible { outline: none; }
.card.nav.focused .card-name { color: #fff4f6; text-shadow: var(--tube-red); }
.pad-status { margin: 22px 0 0; color: var(--muted); font-size: 15px; }
.pad-status.ok { color: var(--green); }

/* HUD */
#s-game { align-items: stretch; justify-content: stretch; padding: 0; }
.hud {
  position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: start; padding: clamp(10px, 2vh, 24px) clamp(16px, 2.5vw, 36px); pointer-events: none;
}
.hud-label { font-style: italic; font-weight: 600; font-size: 12px; letter-spacing: .25em; color: rgba(190, 245, 255, .7); text-transform: uppercase; }
.hud-right { text-align: right; justify-self: end; transform-origin: right top; }
.clock, .score { font-style: italic; font-weight: 600; color: #f2fbff; text-shadow: var(--tube-blue); font-variant-numeric: tabular-nums; }
.clock { font-size: clamp(32px, 4.5vw, 64px); }
.clock.frozen { opacity: .85; }
.clock.low { color: #fff4f6; text-shadow: var(--tube-red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .55; } }
.score { font-size: clamp(56px, 8vw, 128px); line-height: 1; }
.score.pop { animation: scorePop .5s ease-out; }
@keyframes scorePop { 0% { transform: scale(1.35); color: var(--green); text-shadow: 0 0 20px #fff, 0 0 50px var(--green), 0 0 110px var(--green); } 100% { transform: scale(1); } }
.combo {
  display: inline-block; margin-top: 6px; font-style: italic; font-weight: 700; font-size: clamp(18px, 2vw, 28px);
  color: #fff4f6; text-shadow: var(--tube-red); opacity: 0;
}
.combo.show { opacity: 1; }
.combo.pop { animation: pop .45s ease-out; }
@keyframes pop { 0% { transform: scale(1.9); } 100% { transform: scale(1); } }
.bonus {
  transform-origin: left center; font-style: italic; font-weight: 800; font-size: clamp(18px, 2vw, 28px);
  color: var(--green); text-shadow: 0 0 14px var(--green); opacity: 0;
}
.bonus.go { animation: bonus 1.3s ease-out; }
@keyframes bonus { 0% { opacity: 0; transform: translateY(14px) scale(.8); } 15% { opacity: 1; transform: translateY(0) scale(1.15); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-16px); } }
.task {
  font-style: italic; font-weight: 600; font-size: clamp(56px, 9.5vw, 156px); letter-spacing: .02em; line-height: 1.05;
  padding: .05em .7em .12em; border-radius: 18px; white-space: nowrap;
  color: #f2fbff; text-shadow: var(--tube-blue);
  background: radial-gradient(ellipse at center, rgba(0, 8, 16, .65) 0%, rgba(0, 8, 16, .35) 55%, rgba(0, 8, 16, 0) 75%);
  transition: opacity .3s, transform .3s;
}
.task.hidden { opacity: 0; transform: translateY(-10px); }
.task.long { font-size: clamp(40px, 6.2vw, 104px); }
.task .q { color: #fff4f6; text-shadow: var(--tube-red); }
.task .pick { color: #fff; text-shadow: 0 0 4px #fff, 0 0 20px var(--bs-ice), 0 0 50px var(--bs-blue); }
.hint {
  position: absolute; bottom: clamp(10px, 2.5vh, 28px); left: 0; right: 0; text-align: center; pointer-events: none;
  font-style: italic; font-size: clamp(15px, 1.6vw, 22px); color: rgba(190, 245, 255, .8); text-shadow: 0 0 10px rgba(30, 150, 255, .8);
}
.hint.answer {
  bottom: clamp(16px, 5vh, 56px); font-weight: 700; font-size: clamp(30px, 4.2vw, 60px);
  color: #eafff3; text-shadow: 0 0 4px #fff, 0 0 18px var(--green), 0 0 44px var(--green);
}
/* Combo-Balken: 3 Felder, voll = X3 (strahlt) */
.combo-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 10px; }
.combo-bar { display: flex; gap: 6px; }
.combo-bar i {
  width: clamp(34px, 4.4vw, 70px); height: clamp(12px, 1.5vw, 20px); border-radius: 10px;
  border: 2px solid rgba(190, 245, 255, .4); background: rgba(4, 14, 26, .6);
  transition: background .25s, box-shadow .25s, border-color .25s;
}
.combo-bar i.on { background: var(--bs-blue); border-color: #fff; box-shadow: 0 0 10px var(--bs-blue), 0 0 22px rgba(30, 150, 255, .7); }
.combo-bar.full i { background: #fff4f6; border-color: #fff; box-shadow: 0 0 10px #fff, 0 0 24px var(--bs-red), 0 0 50px var(--bs-red);
  animation: barGlow .7s ease-in-out infinite alternate; }
@keyframes barGlow { to { box-shadow: 0 0 16px #fff, 0 0 38px var(--bs-red), 0 0 90px var(--bs-red); } }
.combo-bar.break i { animation: barBreak .55s ease-out; }
@keyframes barBreak {
  0% { background: var(--red); box-shadow: 0 0 20px var(--red); }
  35% { transform: translateY(-5px) rotate(-8deg); }
  100% { transform: none; }
}
.combo { margin-top: 0; opacity: 1; min-width: 2.2em; text-align: right; font-size: clamp(26px, 3vw, 46px); }
.combo.dim { opacity: .35; text-shadow: none; }
/* Combo-Ausruf: erscheint an der Stelle der Aufgabe und fliegt mit dem Bonus zur Punktzahl */
.callout { position: fixed; left: 0; top: 0; z-index: 60; pointer-events: none; text-align: center; white-space: nowrap; }
.callout .main { font-style: italic; font-weight: 800; font-size: clamp(42px, 6vw, 100px); line-height: 1; color: #fff4f6; text-shadow: var(--tube-red); }
.callout .sub { font-style: italic; font-weight: 800; font-size: clamp(30px, 4vw, 64px); line-height: 1.1; color: #fff;
  text-shadow: 0 0 10px #fff, 0 0 30px var(--green), 0 0 70px var(--green); }
.score.mega { animation: scoreMega .9s ease-out; }
@keyframes scoreMega {
  0% { transform: scale(1.9); color: #fff4f6; text-shadow: 0 0 20px #fff, 0 0 60px var(--bs-red), 0 0 130px var(--bs-red); }
  40% { transform: scale(.92); }
  100% { transform: scale(1); }
}
/* "+100", das zur Punktzahl fliegt */
.fly {
  position: fixed; left: 0; top: 0; z-index: 50; pointer-events: none;
  font-style: italic; font-weight: 800; font-size: clamp(40px, 5vw, 80px); color: #fff;
  text-shadow: 0 0 10px #fff, 0 0 30px var(--green), 0 0 70px var(--green);
}

/* Kamerabild im Spiel */
.cam-mini {
  position: absolute; right: 16px; bottom: 16px; width: clamp(140px, 16vw, 240px); aspect-ratio: 4 / 3;
  border-radius: 12px; overflow: hidden; border: 2px solid rgba(var(--cyan-rgb), .5); display: none; background: #000;
}
.cam-mini.on { display: block; }
.cam-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.cam-lane { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); pointer-events: none; z-index: 1; }
.cam-lane i { border-right: 1px dashed rgba(var(--cyan-rgb), .4); }
.cam-lane i:last-child { border-right: 0; }
.cam-lane i.on { background: rgba(255, 225, 77, .25); }

.overlay {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(2, 3, 10, .6); padding: 16px;
}
.overlay.active { display: flex; }

/* Start + Countdown */
.btn.start { font-size: clamp(30px, 3.6vw, 48px); padding: 18px 22px; text-shadow: var(--tube-blue); }
.overlay.count { background: radial-gradient(circle at center, rgba(0, 4, 10, .7) 0%, rgba(0, 4, 10, .35) 40%, rgba(0, 4, 10, 0) 70%); }
.count-num {
  font-style: italic; font-weight: 600; font-size: min(42vh, 46vw); line-height: 1;
  color: #f2fbff; text-shadow: var(--tube-blue);
}
.count-num.go { color: #fff4f6; text-shadow: var(--tube-red); font-size: min(30vh, 34vw); }
.count-num.pop { animation: countPop .9s ease-out forwards; }
@keyframes countPop {
  0% { opacity: 1; transform: scale(1.7); }
  20% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: scale(.85); }
}

/* Ergebnis */
.result { display: flex; gap: 48px; justify-content: center; margin: 10px 0 8px; }
.result div { display: flex; flex-direction: column; }
.result .big { font-style: italic; font-weight: 800; font-size: clamp(44px, 6vw, 80px); text-shadow: 0 0 22px var(--cyan); }
.result .lbl { color: var(--muted); letter-spacing: .2em; text-transform: uppercase; font-size: 14px; }
.newhs { font-weight: 800; color: var(--yellow); text-shadow: 0 0 16px var(--yellow); min-height: 1.3em; font-size: 20px; margin: 8px 0; }

/* Statistik */
.stats-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.stats-head h2 { margin: 0; }
.tabs { display: flex; gap: 10px; }
.tabs .btn { padding: 10px 18px; font-size: 18px; }
.stats-sum { color: var(--muted); font-size: 18px; margin: 6px 0 16px; }
.stats-sum b { font-weight: 800; color: var(--fg); font-size: 28px; text-shadow: 0 0 14px var(--cyan); margin: 0 6px; }
.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; overflow-y: auto; padding: 4px; }
.week {
  border-radius: 14px; padding: 12px 10px; text-align: center;
  border: 1px solid rgba(var(--cyan-rgb), .12); background: rgba(var(--cyan-rgb), .03);
  color: rgba(232, 251, 255, .32);
}
.week .kw { font-weight: 600; font-size: 13px; letter-spacing: .15em; }
.week .range { font-size: 12px; margin-top: 2px; }
.week .n { font-style: italic; font-weight: 800; font-size: 30px; margin-top: 6px; }
.week.l1 { color: var(--fg); border-color: rgba(var(--cyan-rgb), .45); background: rgba(var(--cyan-rgb), .1); box-shadow: 0 0 10px rgba(var(--cyan-rgb), .2); }
.week.l2 { color: var(--fg); border-color: rgba(var(--cyan-rgb), .65); background: rgba(var(--cyan-rgb), .18); box-shadow: 0 0 18px rgba(var(--cyan-rgb), .35); }
.week.l3 { color: #fff; border-color: var(--cyan); background: rgba(var(--cyan-rgb), .28); box-shadow: 0 0 26px rgba(var(--cyan-rgb), .5); }
.week.l4 { color: #fff; border-color: #b8fbff; background: rgba(var(--cyan-rgb), .42); box-shadow: 0 0 36px rgba(var(--cyan-rgb), .7); }
.week.future { border-style: dashed; opacity: .55; }
.week.current {
  color: #fff; border: 2px solid var(--bs-red); background: rgba(255, 35, 70, .18); opacity: 1;
  box-shadow: 0 0 6px #fff, 0 0 24px var(--bs-red), inset 0 0 18px rgba(255, 35, 70, .4);
  animation: glowPulse 2s ease-in-out infinite;
}
.week.current .kw::after { content: " · JETZT"; }
@keyframes glowPulse { 50% { box-shadow: 0 0 8px #fff, 0 0 44px var(--bs-red), inset 0 0 24px rgba(255, 35, 70, .55); } }

/* Kameratest */
.camtest { display: grid; grid-template-columns: minmax(0, 2fr) minmax(220px, 1fr); gap: 24px; align-items: start; }
.cam-view {
  position: relative; aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: #000;
  border: 2px solid rgba(var(--cyan-rgb), .4);
}
.cam-view .cam-video { position: absolute; inset: 0; }
#cam-overlay { position: absolute; inset: 0; width: 100%; height: 100%; transform: scaleX(-1); z-index: 1; }
.cam-info { display: flex; flex-direction: column; gap: 8px; }
.cam-persons { font-size: 36px; font-weight: 800; margin-bottom: 10px; }
.cam-persons.bad { color: var(--red); text-shadow: 0 0 14px var(--red); }
.lanes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.lanes span {
  text-align: center; padding: 14px 4px; border-radius: 10px; border: 1px solid rgba(var(--cyan-rgb), .25);
  color: var(--muted); font-weight: 700;
}
.lanes span.on { color: #fff; border-color: var(--yellow); background: rgba(255, 225, 77, .2); box-shadow: 0 0 18px rgba(255, 225, 77, .5); }
.ygest {
  font-style: italic; font-weight: 800; font-size: 64px; text-align: center; border-radius: 14px; padding: 6px;
  border: 1px solid rgba(var(--cyan-rgb), .25); color: rgba(232, 251, 255, .25); transition: all .15s;
}
.ygest.on { color: #fff; border-color: var(--green); background: rgba(61, 255, 154, .2); text-shadow: 0 0 22px var(--green); box-shadow: 0 0 30px rgba(61, 255, 154, .5); }

@media (max-width: 760px) {
  .camtest { grid-template-columns: 1fr; }
  .result { gap: 24px; }
  .hud { grid-template-columns: auto 1fr auto; gap: 8px; }
  .task { justify-self: center; }
}

/* Combo-Stufen: X2 magenta, X3 Regenbogen (Aufgabe, Uhr, Punkte) */
[data-combo="2"] .task, [data-combo="2"] .score, [data-combo="2"] .clock {
  text-shadow: 0 0 2px #fff, 0 0 8px #ffb3f0, 0 0 18px #ff28c8, 0 0 40px #b040ff, 0 0 80px rgba(176, 64, 255, .7);
}
[data-combo="3"] .task, [data-combo="3"] .score, [data-combo="3"] .clock, [data-combo="3"] .combo-bar {
  text-shadow: var(--tube-red);
  animation: rainbow 1.6s linear infinite;
}
@keyframes rainbow { from { filter: hue-rotate(0deg) saturate(1.4); } to { filter: hue-rotate(360deg) saturate(1.4); } }
[data-combo="3"] .score.mega { animation: scoreMega .9s ease-out, rainbow 1.6s linear infinite; }
[data-combo="3"] .score.pop { animation: scorePop .5s ease-out, rainbow 1.6s linear infinite; }

/* Kleines 1x1: kompakter Ausruf direkt bei den Punkten */
.callout.small .main { font-size: clamp(24px, 2.8vw, 44px); }
.callout.small .sub { font-size: clamp(20px, 2.2vw, 34px); }

/* Schritt-Anzeige im Spiel-Ablauf (Modus → Klasse → Steuerung) */
.step { margin: 0 0 6px; font-style: italic; font-weight: 600; font-size: 14px; letter-spacing: .25em; text-transform: uppercase; color: rgba(190, 245, 255, .6); }
/* Schnellstart: groß "Weiter spielen", darunter die letzte Auswahl */
.btn.quick { font-size: clamp(24px, 2.6vw, 34px); padding: 16px 22px; text-shadow: var(--tube-blue); }
.btn.quick small { display: block; margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--muted); text-shadow: none; }
/* Karten im Spiel-Ablauf: etwas breiter, Namen kleiner */
#s-mode .card, #s-control .card { width: min(300px, 80vw); }
#s-mode .card-name, #s-control .card-name { font-size: clamp(28px, 3vw, 42px); }
