/* V8 */

/* Grundlayout: 16:9, kein Scrollen */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;   /* verhindert horizontales Scrollen */
    overflow-y: hidden;   /* optional – falls der vertikale Balken ebenfalls weg soll */
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: Arial, sans-serif;
    background: radial-gradient(circle at top, rgba(0, 170, 255, 0.20), rgba(0, 0, 0, 0.75)), #141235;
    color: white;
    display: flex;
    flex-direction: column;
        position: relative;
    padding-top: 4vh;
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}

/* Flash-Overlay für richtig/falsch (ganze Seite, zweimal blinken) */
@keyframes flashOverlayGreen {
    0%, 100% { opacity: 0; }
    25%, 75% { opacity: 0.6; }
    50% { opacity: 0; }
}

@keyframes flashOverlayRed {
    0%, 100% { opacity: 0; }
    25%, 75% { opacity: 0.6; }
    50% { opacity: 0; }
}

body.flash-correct::before,
body.flash-wrong::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
}

body.flash-correct::before {
    background: rgba(46, 204, 113, 0.4);
    animation: flashOverlayGreen 0.9s ease;
}

body.flash-wrong::before {
    background: rgba(231, 76, 60, 0.4);
    animation: flashOverlayRed 0.9s ease;
}

/* Grobe Höhenaufteilung, in Summe ~100vh */
#timeline-section {
    flex: 0 0 26vh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
}

#middle-row {
    flex: 0 0 30vh;
    display: flex;
    padding: 0 1.5vw;
    gap: 1.5vw;
    align-items: flex-start;
    position: relative;
}


#timer-container {
    display: none;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(calc(-50% - 17.5vw), calc(-50% + 2vw));
    text-align: center;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

body.player-view #timer-container {
    display: flex;
}


body.player-view #timer-container {
    display: flex;
}


#round-timer {
    min-width: 140px;
    padding: 1vh 2.4vw;
    border-radius: 999px;
    border: 2px solid #00c3ff;
    background: rgba(0, 170, 255, 0.9);
    font-size: 50px;
    font-weight: bold;
    letter-spacing: 0.08em;
    color: #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#round-timer.timer-urgent {
    border-color: #ff4d4d;
    background: rgba(231, 76, 60, 0.92);
    box-shadow: 0 0 18px rgba(231, 76, 60, 0.55), 0 0 10px rgba(255, 255, 255, 0.25);
}


@keyframes timerPulseSlow {
    0%   { transform: scale(1.0); }
    50%  { transform: scale(1.05); }
    100% { transform: scale(1.0); }
}

#round-timer.timer-pulse-slow {
    animation: timerPulseSlow 1.4s ease-in-out infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

#round-timer.hidden {
    display: none;
}

@keyframes timerFadeOut {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

.timer-fade-out {
    animation: timerFadeOut 1.5s ease forwards;
}



#players-section {
    flex: 0 0 28vh;
    padding: 0 1.5vw;
}

#controls-section {
    flex: 0 0 16vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}


/* Kopfzeile mit Rundenanzeige + Thema */
#timeline-header-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.5vh;
    margin-bottom: 5vh;
    padding: 0 1.5vw;
}


/* Rundenfeld links neben dem Thema */
#round-indicator {
    position: absolute;
    right: 1.5vw;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 170, 255, 0.9);
    border-radius: 999px;
    padding: 4px 14px;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    border: 2px solid #00c3ff;
    letter-spacing: 0.05em;
}


/* Thema-Text */

#set-theme {
    text-align: center;
    font-size: 28px;
    font-weight: bold;
    margin-top: 1.2vh;
    margin-bottom: 1.2vh;
}




/* Bild zwischen Zahlreihe und Timeline, zentriert mit dezentem Glow */
#timeline-divider {
    display: block;
    margin: 0.6vh auto;
    max-width: 1746px;
    width: 100%;
    height: auto;
    /* Glow nur entlang der nicht-transparenten Pixel (drop-shadow nutzt den Alphakanal) */
    animation: timelineGlow 2.6s ease-in-out infinite;
}

@keyframes timelineGlow {
    0% {
        filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    }
    50% {
        filter: drop-shadow(0 0 22px rgba(255, 255, 255, 0.5));
    }
    100% {
        filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
    }
}



@keyframes activeCamGlow {
    0% {
        box-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
    }
    50% {
        box-shadow: 0 0 14px rgba(255, 255, 255, 0.7);
    }
    100% {
        box-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
    }
}

/* ===== Zeitstrahl ===== */

/* Obere Achse 1–15 mit Strichen + Querlinie */
#timeline-axis {
    width: 100%;
    padding: 0 1.5vw;
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    justify-items: center;
    align-items: center;
    margin-bottom: 0.4vh;
    position: relative;
    height: 40px;
}

#timeline-axis::after {
    content: "";
    position: absolute;
    left: 1.5vw;
    right: 1.5vw;
    top: 50%;
    transform: translateY(-50%);
    height: 2px;
    background: #888;
}

.axis-slot {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.axis-number {
    font-size: 12px;
    opacity: 0.85;
    margin-bottom: 14px;
}

.axis-mark {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 18px;
    background: #888;
    top: 50%;
    transform-origin: center;
    margin-top: -9px;
}

.axis-mark.axis-mark-end {
    width: 3px;
    height: 22px;
    background: #ffffff;
    margin-top: -11px;
}

/* Reihe mit Karten: links / Mitte / rechts, 15 Spalten Grid */
#timeline-row {
    width: 100%;
    padding: 0 1.5vw;
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    align-items: center;
}

#left-strip {
    grid-column: 1 / 8;
    display: flex;
    justify-content: flex-end;
    gap: 0;
    align-items: center;
}


#center-item {
    grid-column: 8 / 9;
    display: flex;
    justify-content: center;
    align-items: center;
}

#right-strip {
    grid-column: 9 / 16;
    display: flex;
    justify-content: flex-start;
    gap: 0;
    align-items: center;
}


/* Range-/Mittelwerte direkt unter 1, 8, 15 */
#timeline-values {
    width: 100%;
    padding: 0 1.5vw;
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    align-items: flex-start;
}

.range-label {
    font-size: 22px;
    font-weight: bold;
}

#min-label {
    grid-column: 1;
    text-align: center;
    transform: translateX(10px);
}


#center-value-label {
    grid-column: 8;
    text-align: center;
}

#max-label {
    grid-column: 15;
    text-align: center;
    transform: translateX(-10px);
}


/* ===== Karten – quadratisch, überall gleich (Zeitstrahl) ===== */

.img-placeholder {
    width: 6vw;
    aspect-ratio: 1 / 1;
    background: #444;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    border: 2px solid transparent;
    overflow: hidden;
}

.img-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-placeholder.selected {
    border-color: #ffffff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.8);
    animation: imgSelectSnap 0.18s ease-out, activeCamGlow 2.2s ease-in-out infinite;
}


/* Größere Karten für zu sortierende Bilder */
.unsorted-card {
    width: 6vw;
}

/* Platzhalter mit Haken für korrekt sortierte Bilder */
.done-placeholder {
    background: #181f19;
    border-color: #2a7f4c;
    display: flex;
    align-items: center;
    justify-content: center;
}

.done-check {
    font-size: 20px;
    color: #36c46b;
    opacity: 0.85;
}

/* ===== Bereich "Zu sortierende Bilder" ===== */

#unsorted-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

#unsorted {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, auto); /* 7 pro Reihe -> 2 Reihen */
    gap: 0.6vw;
    justify-content: center;
    align-content: center;
    position: relative;
    z-index: 1;
}

#unsorted-shadow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;

    /* gleiche Grid-Definition wie #unsorted */
    display: grid;
    grid-template-columns: repeat(7, auto);
    gap: 0.6vw;
    justify-content: center;
    align-content: center;
}


/* ===== Kamerarahmen (Nestfloh + Spieler) ===== */

.cam-frame {
    background: #000;
    border: 3px solid #00aaff;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 12px rgba(0, 170, 255, 0.5);
}



/* Spieler-Bereich */
#players {
    display: flex;
    gap: 1vw;
    width: 100%;
    height: 100%;
}

#moderator-cam video,
.player-cam .video-box iframe {
    transform-origin: center center;
    transition: transform 0.15s ease-out;
    transform: scale(1.1);   /* ← Standard-Zoom aller Cams */
}


.player {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-cam {
    width: 451px;
    height: 253px;
    aspect-ratio: 16 / 9;
}


/* Placeholder für Spieler-Video */
.video-box {
    width: 100%;
    height: 100%;
    background: #000;
    color: #777;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Highlight für aktiven Spieler */
.player.active .cam-frame {
    border-color: #ffffff;
    animation: activeCamGlow 2.2s ease-in-out infinite;
}

/* ===== Badges (Namen, Punkte, Herzen, Moderator) ===== */

.info-badge {
    position: absolute;
    background: rgba(0, 170, 255, 0.9);
    border-radius: 999px;
    padding: 3px 10px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 2px solid #00c3ff;
}

/* Name + Punkte zentriert unten */
.name-badge {
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
}

/* Herzen / Moderator oben rechts */
.corner-badge {
    top: 6px;
    right: 6px;
}

.cam-name {
    white-space: nowrap;
    transition: opacity 0.2s ease;
}


.cam-role {
    white-space: nowrap;
    font-size: 13px; /* Moderator kleiner */
}

.lives {
    font-size: 13px; /* kleinere Herzen */
}

.score {
    transition: opacity 0.2s ease;
}


/* ===== Kontrollen unten ===== */

#round-control {
    margin-bottom: 0.5vh;
}

#round-select {
    margin-left: 5px;
}

#current-player-label {
    margin-bottom: 0.8vh;
    font-weight: bold;
    font-size: 16px;
}

#buttons-row button {
    padding: 0.8vh 1.5vw;
    margin: 0.2vh 0.6vw;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
}

#correct {
    background: #2ecc71;
}

#wrong {
    background: #e74c3c;
}

#reset {
    background: #ff9800;
}

#view-toggle {
    background: #2196f3;
    color: #ffffff;
}

#hide-top-toggle {
    background: #1976d2;
    color: #ffffff;
}


/* Numbers above each timeline slot */
#timeline-number-row {
    width: 100%;
    padding: 0 1.5vw;
    display: grid;
    grid-template-columns: repeat(15, minmax(0, 1fr));
    justify-items: center;
    text-align: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 0.5vh;
}



/* Animation: Karte ploppt kurz auf, wenn sie einsortiert wird */
@keyframes slotPop {
    0%   { transform: scale(0.5); opacity: 0; }
    60%  { transform: scale(1.05); opacity: 1; }
    100% { transform: scale(1.0); opacity: 1; }
}

.slot-animate {
    animation: slotPop 0.25s ease-out;
}


/* Karten im Zeitstrahl nach rechts aus dem Bild gleiten lassen */
@keyframes cardOutCascade {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(40vw) scale(0.9);
        opacity: 0;
    }
}


/* Test-Button */
#auto-sort {
    background: #3f51b5;
    color: #fff;
}


/* Einheitliche Abstände zwischen allen Karten im Zeitstrahl */
.timeline-strip .img-placeholder {
    margin-left: 0.4vw;
}
.timeline-strip .img-placeholder:first-child {
    margin-left: 0;
}

/* Abstand zwischen Mitte (8) und den Nachbarn links/rechts */
#center-item .img-placeholder {
    margin-left: 0.4vw;
}

#right-strip .img-placeholder:first-child {
    margin-left: 0.4vw;
}


/* Animation, wenn ein Spieler ein Herz verliert */
@keyframes heartHit {
    0%   { transform: scale(1);   opacity: 1; }
    30%  { transform: scale(1.3); opacity: 1; }
    60%  { transform: scale(0.8); opacity: 0.6; }
    100% { transform: scale(1);   opacity: 1; }
}

.lives.hit {
    animation: heartHit 0.35s ease-out;
}


/* ===== Konfetti-Overlay ===== */
#confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 9998;
}

.confetti-piece {
    position: absolute;
    width: 8px;
    height: 14px;
    background: red;
    opacity: 0.9;
    top: -20px;
    border-radius: 2px;
    animation-name: confetti-fall;
    animation-timing-function: linear;
    animation-iteration-count: 1;
}

@keyframes confetti-fall {
    0% {
        transform: translate3d(0, 0, 0) rotateZ(0deg);
        opacity: 1;
    }
    100% {
        transform: translate3d(0, 110vh, 0) rotateZ(360deg);
        opacity: 0;
    }
}


/* ===== Moderator-Panel ===== */
#moderator-panel {
    margin-top: 0.5vh;
    width: 100%;
    max-width: none;
    padding: 0.5vh 1.2vw 0.7vh;
    border-radius: 12px 12px 0 0;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #00aaff;
    box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.75);
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 2fr) minmax(0, 1.2fr);
    grid-auto-rows: auto;
    column-gap: 1vw;
    row-gap: 0.4vh;
    align-items: flex-start;
    font-size: 14px;
}

#moderator-panel h3 {
    grid-column: 1 / -1;
    margin: 0 0 0.4vh 0;
    font-size: 16px;
    text-align: left;
}

/* linke Spalte: Spieler-Steuerung */
#mod-players {
    grid-column: 1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6vh 0.8vw;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    padding: 0.4vh 0.6vw;
}

.mod-player-row {
    display: flex;
    flex-direction: column;
    gap: 0.2vh;
}

.mod-player-row label {
    font-weight: bold;
}

.mod-player-row input[type="text"] {
    width: 100%;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #555;
    background: #111;
    color: #fff;
}

.mod-player-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.mod-player-controls button {
    padding: 2px 6px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 12px;
}

/* Kamera-Link-Reihe im Spielerblock */
.mod-player-cam-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    position: relative;
    z-index: 3;
}


.mod-player-cam-row input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #555;
    background: #111;
    color: #fff;
}

.mod-player-cam-row button {
    padding: 2px 8px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 12px;
}

/* mittlere Spalte: Bildwerte direkt neben Spielern */
#mod-values {
    grid-column: 2;
    grid-row: 2;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    padding: 0.4vh 0.6vw;
    margin-top: 0;
}

.mod-values-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.4vh 0.6vw;
    row-gap: 0.4vh;
}

.mod-value-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}

.mod-value-item input[type="number"] {
    width: 100%;
    padding: 2px 4px;
    border-radius: 4px;
    border: 1px solid #555;
    background: #111;
    color: #fff;
}

/* rechte Spalte: Thema, Runde, Anwenden kompakt übereinander */
#mod-theme-row {
    grid-column: 3;
    grid-row: 2;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    padding: 0.5vh 0.8vw;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4vh;
}

#mod-theme-row label {
    font-weight: bold;
}

#mod-theme-row input[type="text"] {
    flex: 0 0 auto;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #555;
    background: #111;
    color: #fff;
}

/* Rundenzähler direkt unter dem Thema */
#mod-round-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4vw;
    margin-top: 0.4vh;
}

#mod-round-row button {
    padding: 2px 8px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 12px;
}

/* Aktualisieren-Button direkt unter der Runde, rechtsbündig */
#mod-apply-row {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 0.4vh;
}

#mod-apply {
    padding: 0.6vh 1.4vw;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    background: #00aaff;
    color: #fff;
    font-weight: bold;
}



.heading-badge {
    position: static;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 2px solid #ffffff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
    animation: activeCamGlow 2.2s ease-in-out infinite;
}


@keyframes imgSelectSnap {
    0%   { transform: scale(0.85); }
    60%  { transform: scale(1.08); }
    100% { transform: scale(1.0); }
}

/* ===== Ausgeschiedene Spieler (Cam + Name + Rahmen ausgegraut) ===== */
@keyframes playerEliminatedFade {
    0% {
        filter: none;
        opacity: 1;
    }
    100% {
        filter: grayscale(100%) brightness(0.8);
        opacity: 1;
    }
}

.player.eliminated .cam-frame,
.player.eliminated .video-box,
.player.eliminated .info-badge {
    animation: playerEliminatedFade 7s ease forwards;
}

.player.eliminated .cam-frame {
    border-color: #555;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.85);
}

.player.eliminated .score,
.player.eliminated .lives {
    color: #e0e0e0;
}

@keyframes playerReviveFade {
    0% {
        filter: grayscale(100%) brightness(0.8);
        opacity: 1;
    }
    100% {
        filter: none;
        opacity: 1;
    }
}

.player.revived .cam-frame,
.player.revived .video-box,
.player.revived .info-badge {
    animation: playerReviveFade 3s ease forwards;
}

.player.revived .score,
.player.revived .lives {
    color: #ffffff;
}


/* ===== Set-Wechsel: Kameras fahren nach unten raus / wieder rein ===== */
@keyframes camOutDown {
    0%   { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(40vh); opacity: 0; }
}

@keyframes camInUp {
    0%   { transform: translateY(40vh); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* Grundzustand der Spieler-Cams (für Animationen) */
#players .player .player-cam {
    transform-origin: center center;
}

/* Outgoing-Phase: Kameras nacheinander nach unten */
body.player-view.set-change-out #players .player:nth-child(1) .player-cam {
    animation: camOutDown 0.45s ease forwards;
    animation-delay: 0s;
}
body.player-view.set-change-out #players .player:nth-child(2) .player-cam {
    animation: camOutDown 0.45s ease forwards;
    animation-delay: 0.2s;
}
body.player-view.set-change-out #players .player:nth-child(3) .player-cam {
    animation: camOutDown 0.45s ease forwards;
    animation-delay: 0.4s;
}
body.player-view.set-change-out #players .player:nth-child(4) .player-cam {
    animation: camOutDown 0.45s ease forwards;
    animation-delay: 0.6s;
}

/* Incoming-Phase: Kameras von unten nach oben (1 zuerst, 4 zuletzt) */
body.player-view.set-change-in #players .player:nth-child(1) .player-cam {
    animation: camInUp 0.45s ease forwards;
    animation-delay: 0s;
    animation-fill-mode: both;
}
body.player-view.set-change-in #players .player:nth-child(2) .player-cam {
    animation: camInUp 0.45s ease forwards;
    animation-delay: 0.2s;
    animation-fill-mode: both;
}
body.player-view.set-change-in #players .player:nth-child(3) .player-cam {
    animation: camInUp 0.45s ease forwards;
    animation-delay: 0.4s;
    animation-fill-mode: both;
}
body.player-view.set-change-in #players .player:nth-child(4) .player-cam {
    animation: camInUp 0.45s ease forwards;
    animation-delay: 0.6s;
    animation-fill-mode: both;
}


/* ===== Set-Wechsel: Thema rutscht raus / droppt rein ===== */
@keyframes setTitleOutUp {
    0%   { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-20vh); opacity: 1; }
}

@keyframes setTitleDropIn {
    0%   { transform: translateY(-20vh); opacity: 1; }
    100% { transform: translateY(0); opacity: ; }
}

/* ===== Set-Wechsel: Rundenfeld raus / rein ===== */
@keyframes roundIndicatorOutUp {
    0%   { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-20vh); opacity: 1; }
}

@keyframes roundIndicatorDropIn {
    0%   { transform: translateY(-20vh); opacity: 1; }
    100% { transform: translateY(0); opacity: 1; }
}



#set-theme {
    display: inline-block; /* wichtig für transform-Animation */
}

body.player-view.set-change-out .heading-badge {
    animation: setTitleOutUp 0.4s ease forwards;
    animation-fill-mode: both;
}


body.player-view.set-change-in .heading-badge {
    animation: setTitleDropIn 0.45s ease forwards;
    animation-delay: 2.15s;
    animation-fill-mode: both;
}

/* Rundenfeld verhält sich beim Set-Wechsel wie die Überschrift */
body.player-view.set-change-out #round-indicator {
    animation: roundIndicatorOutUp 0.4s ease forwards;
    animation-fill-mode: both;
}

body.player-view.set-change-in #round-indicator {
    animation-delay: 2.15s;
    animation-fill-mode: both;
}



/* ===== Set-Wechsel: Range-/Mittelwerte ausblenden / später einblenden ===== */
@keyframes rangeFadeOut {
    0%   { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes rangeFadeIn {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}


.range-label {
    transition: opacity 0.2s ease;
}

body.player-view.set-change-out #timeline-values .range-label {
    animation: rangeFadeOut 0.35s ease forwards;
}

body.player-view.set-change-in #timeline-values .range-label {
    animation: rangeFadeIn 0.45s ease forwards;
    animation-delay: 0.3s; /* Werte kommen erst ganz zum Schluss */
    animation-fill-mode: both;
}


/* ===== Set-Wechsel: Karten fliegen raus ===== */
@keyframes cardOutCascade {
    0% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
    100% {
        /* Basis-Shift + pro Karte zusätzlicher Shift über CSS-Variable */
        transform: translateX(calc(60vw + var(--extra-shift, 0vw))) scale(0.95);
        opacity: 0;
    }
}



/* Platzhalterklasse für JS, falls du sie brauchst */
.card-out-anim {
    animation: cardOutCascade 0.4s ease forwards;
}

/* ===== Set-Wechsel: Karten ploppen rein ===== */
/* slotPop existiert schon – wir nutzen es mit Delay */
.card-intro {
    animation: slotPop 0.25s ease-out forwards;
    animation-fill-mode: both;
}



/* ===== Ansicht-Umschalter (Moderator / Spieler) ===== */
#view-toggle {
    padding: 0.8vh 1.5vw;
    margin: 0 0.4vw;
    border-radius: 999px;
    border: 2px solid #ffffff;
    background: #2196f3;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#view-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* In der Spieler-Ansicht: alles unterhalb der Kameras ausblenden */
body.player-view #controls-section {
    display: none;
}

/* In der Moderator-Ansicht bestimmte Elemente ausblenden
   (Spieler-Ansicht bleibt unverändert) */
body:not(.player-view) #middle-row,
body:not(.player-view) .heading-badge,
body:not(.player-view) #round-indicator,
body:not(.player-view) #timeline-divider,
body:not(.player-view) #timeline-number-row,
body:not(.player-view) #timeline-values,
body:not(.player-view) #timeline-axis,
body:not(.player-view) #players-section,
body:not(.player-view) #moderator-cam {
    display: none;
}

#view-toggle-top {
    position: absolute;
    left: 1.5vw;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px 14px;
    border-radius: 999px;
    border: 2px solid #ffffff;
    background: rgba(0, 0, 0, 0.6);
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: none; /* standardmäßig unsichtbar (Moderator-Ansicht) */
}

#view-toggle-top:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* In der Spieler-Ansicht: oberen Toggle einblenden */
body.player-view #view-toggle-top {
    display: inline-flex;
}

/* ===== View per URL gelockt: Umschalter immer aus ===== */
body.view-locked #view-toggle,
body.view-locked #view-toggle-top,
body.view-locked #hide-top-toggle {
    display: none !important;
}


#hide-top-toggle {
    padding: 0.8vh 1.5vw;
    margin: 0 0.4vw;
    border-radius: 999px;
    border: 2px solid #ffffff;
    background: #1976d2;
    color: #ffffff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

#hide-top-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}


/* Werte-Overlay auf den Karten nur in Moderator-Ansicht sichtbar */
.value-label {
    display: inline-block;
}

body.player-view .value-label {
    display: none !important;
}
body.player-view.round-won .value-label {
    display: inline-block !important;
}
/* NEU: Wenn der Moderator es erzwingt, Werte auch in der Spieler-Ansicht anzeigen */
body.player-view.show-values .value-label {
    display: inline-block !important;
}

/* ===== Name-Overlay (für data.txt Zeilen 3,5,7,...) ===== */
.name-label {
    position: absolute;
    left: 50%;
    bottom: 2px;               /* gleicher Bottom-Abstand wie value-label */
    transform: translateX(-50%);
    text-align: center;
    line-height: 1.05;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.9);
    padding: 2px 5px;
    pointer-events: none;
    white-space: normal;

    /* NEU (V7): dunkler Kasten wie bei Werten */
    background: rgba(0,0,0,0.6);
    border-radius: 3px;
}


/* Zeile 1 normal, Zeile 2 kleiner */
.name-label .name-line1 {
    font-size: 14px;
}
.name-label .name-line2 {
    font-size: 12px;
    font-weight: 700;
    opacity: 0.95;
}

/* Standard: Namen ausblenden (Moderator sieht ohnehin Werte) */
.name-label {
    display: none;
}

/* Spieler-Ansicht: Namen sichtbar, solange Werte NICHT sichtbar sind */
body.player-view:not(.show-values):not(.round-won) .name-label {
    display: block !important;
}

/* Wenn Werte sichtbar sind (show-values oder round-won), Namen ausblenden */
body.player-view.show-values .name-label,
body.player-view.round-won .name-label {
    display: none !important;
}



/* vdo.ninja-Frames: keine Hover-Overlays / keine Interaktion bei den Teilnehmer-Kameras */
.player-cam .video-box iframe {
    pointer-events: none !important;
    cursor: default;
}

/* In der Spieler-Ansicht: Kameras wieder anklickbar machen */
body.player-view .player-cam .video-box iframe,
body.player-view .player-cam .video-box video {
    pointer-events: auto !important;
    cursor: pointer;
}


/* Abstand zwischen Bereich 2 (Moderator-Cam + zu sortierende Bilder)
   und Bereich 3 (Teilnehmer-Cams) in allen Auflösungen enger machen,
   insbesondere im Fullscreen (F11). */
#middle-row {
    align-items: flex-end;
}

#players {
    align-items: flex-start;
}

.player {
    align-items: flex-start;
}

/* Feiner Abstand zwischen Bereich 2 (Moderator-Cam + zu sortierende Bilder)
   und Bereich 3 (Teilnehmer-Cams), ungefähr wie zwischen Thema und Zahlenreihe */
#players {
    margin-top: 3vh;
}


/* Sound-Einstellungen im Moderator-Panel */
#mod-sound-row {
    grid-column: 1 / -1;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    padding: 0.4vh 0.6vw;
    margin-top: 0.4vh;
}

#mod-unsorted-container {
    background: rgba(0, 0, 0, 0.45);
    border-radius: 8px;
    padding: 0.4vh 0.6vw 0.6vh;
    margin-top: 0.4vh;
}

#mod-unsorted-container h4 {
    margin: 0 0 0.4vh 0;
    font-size: 14px;
}

#mod-unsorted-container #unsorted-section {
    width: 100%;
    flex: 0 0 auto;
    align-items: flex-start;
}

#mod-unsorted-container #unsorted {
    justify-content: flex-start;
    align-content: flex-start;
}

/* Im Moderator-Panel etwas kleinere Karten verwenden */
#moderator-panel #unsorted .img-placeholder {
    width: 4vw;
}

#mod-sound-row h4 {
    margin: 0 0 0.4vh 0;
    font-size: 14px;
}

.mod-sound-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.4vh 0.8vw;
}

.mod-sound-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
}

.mod-sound-item input[type="range"] {
    width: 100%;
}


body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url('Bilder/background.png') center center / cover no-repeat;
    opacity: 0.2;
    pointer-events: none;
    z-index: -1;
    animation: bgPulse 40s ease-in-out infinite;
    transform-origin: center;
}

@keyframes bgPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.04);
    }
}


#camera-tuning h4 {
    margin: 0 0 0.4vh 0;
    font-size: 14px;
}

.cam-tuning-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0.4vh 0.4vw;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.35);
    position: relative;
    z-index: 1;
}

.cam-tuning-block span {
    font-weight: bold;
    font-size: 12px;
}

.cam-tuning-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.cam-tuning-row label {
    min-width: 32px;
}

.cam-tuning-row input[type="range"] {
    flex: 1;
}


/* Sicherstellen, dass die Ansicht-Buttons blau dargestellt werden */
#view-toggle,
#view-toggle-top {
    background: #2196f3 !important;
    color: #ffffff !important;
}

#hide-top-toggle {
    background: #1976d2 !important;
    color: #ffffff !important;
}

#center-value-label {
    transform: translateX(0.15vw);
}

/* ===== Leaderboard-Overlay / Gewinner-Ansicht ===== */
.leaderboard {
    position: fixed;
    inset: 0;
    padding-top: 6vh;
    padding-bottom: 4vh;
    padding-left: 4vw;
    padding-right: 4vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, rgba(0, 170, 255, 0.20), rgba(0, 0, 0, 0.75));
    z-index: 12000;
    pointer-events: none; /* Klicks auf die Oberfläche bleiben möglich */
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}


.leaderboard.visible {
    opacity: 1;
    transform: scale(1);
}


.leaderboard:not(.visible) {
    pointer-events: none;
    opacity: 0;
}

.leaderboard-inner {
    max-width: 720px;
    width: 100%;
    background: rgba(0, 0, 0, 0.9);
    border-radius: 18px;
    border: 2px solid #00c3ff;
    box-shadow: 0 0 30px rgba(0, 170, 255, 0.9);
    padding: 2.5vh 3vw 3vh;
    text-align: center;
    animation: activeCamGlow 2.2s ease-in-out infinite; /* Leuchten wie aktive Cam */
    pointer-events: none; /* Interaktion im Panel möglich */
}

.leaderboard-inner h2 {
    margin-top: 0;
    margin-bottom: 1.8vh;
    font-size: 32px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.leaderboard-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.leaderboard-list li {
    display: grid;
    grid-template-columns: 0.6fr 2fr 1.2fr;
    align-items: center;
    padding: 0.8vh 1vw;
    margin-bottom: 0.4vh;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(0, 195, 255, 0.4);
    font-size: 20px;
}

.leaderboard-list li .lb-rank {
    text-align: left;
}

.leaderboard-list li .lb-name {
    text-align: left;
}

.leaderboard-list li .lb-score {
    text-align: right;
}
/* Gewinner-Feld pulsieren lassen */
@keyframes winnerPulse {
    0%   { transform: scale3d(1.00, 1.00, 1.00); box-shadow: 0 0 10px rgba(0, 170, 255, 0.6); }
    50%  { transform: scale3d(1.02, 1.02, 1.00); box-shadow: 0 0 26px rgba(0, 170, 255, 1.0); }
    100% { transform: scale3d(1.00, 1.00, 1.00); box-shadow: 0 0 10px rgba(0, 170, 255, 0.6); }
}

.leaderboard-list li.winner {
    background: linear-gradient(90deg, rgba(0, 170, 255, 0.35), rgba(0, 0, 0, 0.9));
    border-color: rgba(0, 170, 255, 0.95);
    font-weight: bold;
    font-size: 22px;
    transform-origin: center center;
    will-change: transform, box-shadow;
    animation: winnerPulse 1.4s ease-in-out infinite;
}

#moderator-cam .video-box {
    width: 100%;
    height: 100%;
}

#moderator-cam iframe,
#moderator-cam video {
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

/* Standard-Zoom + Transform-Support für alle Cams */
#moderator-cam iframe,
#moderator-cam video,
.player-cam .video-box iframe {
    transform-origin: center center;
    transition: transform 0.15s ease-out;
    transform: scale(1.1);   /* ← Standard-Zoom aller Cams */
}
