/* ═══════════════════════════════════════════════════════════
   NAWI-TRAKT ESCAPE QUIZ — style.css
   Beamer-optimiert, 16:9, kein Internet, keine Frameworks
   ═══════════════════════════════════════════════════════════ */

/* ── Reset & Basis ───────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --red:        #e63946;
    --red-dim:    rgba(230, 57, 70, 0.45);
    --red-glow:   rgba(230, 57, 70, 0.9);
    --green:      #2dc653;
    --green-dim:  rgba(45, 198, 83, 0.3);
    --green-glow: 0 0 24px 6px rgba(45, 198, 83, 0.8);
    --yellow:     #ffe600;
    --black:      #0a0a0a;
    --dark:       #111218;
    --card-bg:    rgba(10, 10, 18, 0.82);
    --text-light: #f0f0f0;
    --font-mono:  'Courier New', Courier, monospace;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--black);
    color: var(--text-light);
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 18px;
    user-select: none;
}

/* ── Screen-System ───────────────────────────────────────── */
.screen {
    display: none;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    z-index: 10;
}

.screen.active {
    display: flex;
}

/* Spielscreen liegt im Hintergrund, Startscreen-Overlay darüber */
#screen-game  { z-index: 10; }
#screen-start { z-index: 50; }

/* ═══════════════════════════════════════════════════════════
   SCREEN 1: LEHRPERSONENFENSTER
   ═══════════════════════════════════════════════════════════ */
#screen-teacher {
    background: linear-gradient(135deg, #0d0d1a 0%, #1a1a2e 100%);
    align-items: center;
    justify-content: center;
}

.teacher-panel {
    background: rgba(20, 20, 40, 0.97);
    border: 2px solid #2a2a5a;
    border-radius: 16px;
    padding: 48px 60px;
    max-width: 680px;
    width: 90%;
    box-shadow: 0 0 60px rgba(80, 80, 200, 0.25);
}

.teacher-header {
    text-align: center;
    margin-bottom: 36px;
}

.teacher-header h1 {
    font-size: 2rem;
    letter-spacing: 0.12em;
    color: #8888ff;
    text-transform: uppercase;
}

.teacher-subtitle {
    margin-top: 8px;
    font-size: 0.9rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 28px;
}

.control-group label {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.control-group input[type="number"] {
    width: 140px;
    padding: 12px;
    font-size: 2rem;
    text-align: center;
    background: #0a0a18;
    border: 2px solid #3a3a8a;
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-mono);
    outline: none;
}

.control-group input[type="number"]:focus {
    border-color: #8888ff;
}

.control-buttons {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.teacher-btn {
    padding: 16px 28px;
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    letter-spacing: 0.06em;
    transition: filter 0.15s, transform 0.1s;
    text-transform: uppercase;
}

.teacher-btn:hover   { filter: brightness(1.2); }
.teacher-btn:active  { transform: scale(0.97); }

.alarm-btn  { background: var(--red);    color: #fff; }
.start-btn  { background: #1a6e2e;       color: #fff; font-size: 1.15rem; }

.alarm-volume-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid #444;
    border-radius: 8px;
}

.alarm-volume-wrap label {
    font-size: 0.95rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    white-space: nowrap;
    margin: 0;
}

#alarm-volume {
    flex: 1;
    accent-color: var(--red);
    cursor: pointer;
    height: 6px;
}

#alarm-volume-display {
    font-size: 1rem;
    font-family: var(--font-mono);
    color: #fff;
    min-width: 48px;
    text-align: right;
}

.teacher-info {
    margin-top: 28px;
    padding: 14px;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    font-size: 0.85rem;
    color: #888;
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════
   SCREEN 2: SCHÜLER:INNEN-STARTSEITE
   Liegt als Overlay über dem Spielscreen (z-index höher).
   Wenn die Hälften ausfahren, wird der Spielscreen sichtbar.
   ═══════════════════════════════════════════════════════════ */
#screen-start {
    flex-direction: column;
    background: transparent;
    overflow: hidden;
    z-index: 50;
}

/* ── Zwei Hälften: zeigen nawi-unlocked.jpg ──────────────── */
.start-half {
    position: relative;
    width: 100%;
    height: 50%;
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 1s cubic-bezier(0.7, 0, 1, 0.5);
}

/* Hintergrundbild der Hälften: nawi-unlocked.jpg */
.start-half-bg {
    position: absolute;
    width: 100%;
    height: 200%;
    background: url('../images/nawi-unlocked.jpg') center/cover no-repeat;
}

/* Obere Hälfte: obere Bildhälfte zeigen */
.start-half-top  .start-half-bg { top: 0; }

/* Untere Hälfte: untere Bildhälfte zeigen */
.start-half-bottom .start-half-bg { top: -100%; }

/* Ausfahren beim Klick */
.start-half-top.slide-out-top       { transform: translateY(-100%); }
.start-half-bottom.slide-out-bottom { transform: translateY(100%);  }

/* ── Inhalt: zentriert über beiden Hälften ───────────────── */
.start-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 60;
    text-align: center;
    padding: 36px 48px;
    max-width: 900px;
    width: 90%;
    background: rgba(0, 0, 0, 0.72);
    border-radius: 10px;
}

.alert-bar {
    display: inline-block;
    background: var(--red);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    padding: 8px 28px;
    border-radius: 4px;
    margin-bottom: 20px;
    animation: blink-alert 1s step-end infinite;
}

@keyframes blink-alert {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

.start-title {
    font-size: 2.8rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    color: #fff;
    text-shadow: 0 0 30px var(--red-glow), 0 0 60px var(--red-dim);
    text-transform: uppercase;
    line-height: 1.2;
    margin-bottom: 20px;
}

.mission-time-display {
    font-size: 1.4rem;
    color: var(--red);
    font-weight: 700;
    letter-spacing: 0.1em;
    margin-bottom: 18px;
    font-family: var(--font-mono);
}

.start-mission-text {
    font-size: 1.3rem;
    color: #ddd;
    line-height: 1.7;
    margin-bottom: 40px;
}

.mission-start-btn {
    background: var(--red);
    color: #fff;
    border: none;
    padding: 22px 70px;
    font-size: 1.8rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    border-radius: 8px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 0 40px rgba(230, 57, 70, 0.6);
    transition: transform 0.1s, box-shadow 0.2s;
}

.mission-start-btn:hover {
    box-shadow: 0 0 70px rgba(230, 57, 70, 0.9);
    transform: scale(1.03);
}

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

/* ═══════════════════════════════════════════════════════════
   SCREEN 3: HAUPTSPIELANSICHT
   ═══════════════════════════════════════════════════════════ */
#screen-game {
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 0;
}

/* Hintergrundbild */
.game-bg {
    position: absolute;
    inset: 0;
    background: url('../images/nawi-bg.jpg') center/cover no-repeat;
    z-index: 0;
}

/* Kein Abdunkel-Overlay */
.game-bg::after {
    content: none;
}

/* ── Countdown ───────────────────────────────────────────── */
.countdown-wrapper {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 10px 0 0;
}

.countdown {
    font-family: var(--font-mono);
    font-size: 5.5rem;
    font-weight: 900;
    color: #fff;
    letter-spacing: 0.08em;
    text-shadow:
        0 0 20px var(--red-glow),
        0 0 50px var(--red-dim);
    line-height: 1;
}

.countdown-label {
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    color: #aaa;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Blinken wenn < 5 Minuten */
.countdown.warning {
    color: var(--red);
    animation: countdown-blink 0.8s ease-in-out infinite;
    text-shadow:
        0 0 30px #ff0000,
        0 0 80px rgba(255,0,0,0.7);
}

@keyframes countdown-blink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.65; transform: scale(1.04); }
}

/* ── Sektoren-Ring ───────────────────────────────────────── */
.sectors-ring {
    position: absolute;
    inset: 0;
    z-index: 10;
    pointer-events: none;
}

/* Linke Spalte: Karten 1–3 */
#sector-teilchenmodell        { top:  8%;  left: 1%; }
#sector-reaktion               { top: 38%; left: 1%; }
#sector-atombau                { top: 68%; left: 1%; }

/* Rechte Spalte: Karten 4–6 */
#sector-stoechiometrie         { top:  8%;  right: 1%; }
#sector-elektronenpaarbindung  { top: 38%; right: 1%; }
#sector-metalle                { top: 68%; right: 1%; }

/* ── Sektorkarten ────────────────────────────────────────── */
.sector-card {
    position: absolute;
    width: 429px;
    pointer-events: all;
    background: var(--card-bg);
    border: 2px solid var(--red);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(6px);
    transition: box-shadow 0.4s, border-color 0.4s, opacity 0.5s, transform 0.5s;
    /* Kacheln starten unsichtbar */
    opacity: 0;
    transform: scale(0.88);
    pointer-events: none;
}

.sector-card.visible {
    opacity: 1;
    transform: scale(1);
    pointer-events: all;
}

.sector-card.locked {
    box-shadow: 0 0 14px var(--red-dim), inset 0 0 8px rgba(200,0,0,0.12);
}

.sector-card.unlocked {
    border-color: var(--green);
    box-shadow: var(--green-glow);
    background: rgba(10, 30, 14, 0.85);
}

.sector-card.activating {
    animation: sector-activate 0.5s ease-out;
}

@keyframes sector-activate {
    0%   { transform: scale(0.94); opacity: 0.85; }
    60%  { transform: scale(1.04); }
    100% { transform: scale(1);    opacity: 1; }
}

/* ── Kartenbilder ────────────────────────────────────────── */
.sector-img-wrap {
    position: relative;
    height: 136px;
    overflow: hidden;
    flex-shrink: 0;
}

.sector-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: filter 0.4s;
}

.sector-card.locked  .sector-img { filter: none; }
.sector-card.unlocked .sector-img { display: none; }

/* Schloss-Icons */
.sector-lock-icon,
.sector-unlock-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    line-height: 1;
    pointer-events: none;
}

.sector-lock-icon   { display: none; }
.sector-unlock-icon { display: none; font-size: 3rem; filter: drop-shadow(0 0 10px var(--green)); }

.sector-card.unlocked .sector-lock-icon   { display: none; }
.sector-card.unlocked .sector-unlock-icon { display: block; }

/* ── Kartentitel ─────────────────────────────────────────── */
.sector-title {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    padding: 6px 8px;
    color: var(--red);
    background: rgba(0,0,0,0.55);
    flex-shrink: 0;
    transition: color 0.4s;
}

.sector-card.unlocked .sector-title { color: var(--green); }

/* ── Eingabefeld ─────────────────────────────────────────── */
.sector-input-wrap {
    padding: 5px 6px 6px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
}

.sector-input {
    width: 100%;
    padding: 5px 8px;
    font-size: 1.32rem;
    font-family: var(--font-mono);
    background: rgba(0,0,0,0.6);
    border: 1px solid #444;
    border-radius: 4px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
    text-transform: none;
}

.sector-input:focus { border-color: var(--red); }

.sector-card.unlocked .sector-input-wrap { display: none; }

/* Statusmeldung */
.sector-status {
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: center;
    min-height: 24px;
    transition: color 0.2s;
}

.sector-status.error   { color: var(--red); }
.sector-status.success { color: var(--green); }

.sector-input:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: #333;
}

/* ── Fortschrittsanzeige ─────────────────────────────────── */
.progress-bar-wrap {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 6px 0 10px;
    width: 100%;
}

.progress-text {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #fff;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
    margin-bottom: 5px;
}

.progress-track {
    width: 400px;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    margin: 0 auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--green);
    border-radius: 3px;
    transition: width 0.5s ease;
    box-shadow: 0 0 10px var(--green);
}

/* ── Lautstärke-Fader ────────────────────────────────────── */
.bg-volume-control {
    position: fixed;
    bottom: 12px;
    right: 14px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.45;
    transition: opacity 0.2s;
}

.bg-volume-control:hover { opacity: 1; }

.bg-volume-control label {
    font-size: 1rem;
    cursor: pointer;
}

#bg-volume {
    width: 80px;
    accent-color: var(--green);
    cursor: pointer;
}

/* ── Reset-Button ────────────────────────────────────────── */
.reset-btn {
    position: fixed;
    bottom: 12px;
    left: 14px;
    z-index: 20;
    background: rgba(30,30,30,0.7);
    border: 1px solid #444;
    color: #666;
    font-size: 0.7rem;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.reset-btn:hover { opacity: 1; color: #ccc; border-color: #888; }

/* ═══════════════════════════════════════════════════════════
   SCREEN 4: ERFOLGSSCREEN — Zwei-Hälften-Animation
   ═══════════════════════════════════════════════════════════ */
#screen-success {
    flex-direction: column;
    background: #000;
    overflow: hidden;
}

.success-reveal {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;   /* Leiste unten */
}

.success-bg {
    position: absolute;
    inset: 0;
    background: url('../images/nawi-unlocked.jpg') center/cover no-repeat;
    filter: brightness(0.8);
    z-index: 0;
}

.success-content {
    position: relative;
    z-index: 10;
    width: 100%;
    text-align: center;
    padding: 20px 60px;
    background: rgba(0, 18, 5, 0.88);
    border-top: 3px solid var(--green);
    box-shadow: 0 -6px 60px rgba(45, 198, 83, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
    opacity: 0;
    transition: opacity 0.6s ease 0.7s;
}

.success-content.visible {
    opacity: 1;
}

.success-icon {
    font-size: 3.2rem;
    line-height: 1;
    filter: drop-shadow(0 0 14px var(--green));
    animation: pulse-green 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse-green {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.08); }
}

.success-title {
    font-size: 2.6rem;
    font-weight: 900;
    color: var(--green);
    text-shadow: 0 0 24px var(--green), 0 0 50px rgba(45,198,83,0.45);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin: 0;
}

.success-text {
    font-size: 1.2rem;
    color: #cfc;
    margin: 0;
}

.success-subtext {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.08em;
}

/* ── Zwei Hälften des Spielbildes ────────────────────────── */
.success-half {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 50%;
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 0.9s cubic-bezier(0.7, 0, 1, 0.5);
}

.success-half-bg {
    position: absolute;
    width: 100%;
    height: 200%;
    background: url('../images/nawi-bg.jpg') center/cover no-repeat;
}

.success-top .success-half-bg  { top: 0; }
.success-bottom .success-half-bg { top: -100%; }

.success-half.slide-out-top    { transform: translateY(-100%); }
.success-half.slide-out-bottom { transform: translateY(100%);  }

/* ═══════════════════════════════════════════════════════════
   SCREEN 5: LOCKDOWN-SCREEN
   ═══════════════════════════════════════════════════════════ */
#screen-lockdown {
    flex-direction: column;
    overflow: hidden;
    position: fixed;
    inset: 0;
}

.lockdown-half {
    position: relative;
    width: 100%;
    height: 50%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.8s cubic-bezier(0.7, 0, 1, 0.5);
}

.stripes-inner {
    position: absolute;
    inset: -50%;
    background: repeating-linear-gradient(
        -45deg,
        var(--yellow) 0px,
        var(--yellow) 40px,
        #1a1a00 40px,
        #1a1a00 80px
    );
    opacity: 0.88;
    z-index: 0;
}

.lockdown-content-top,
.lockdown-content-bottom {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 20px 40px;
    background: rgba(0,0,0,0.65);
    border-radius: 8px;
}

.lockdown-icon {
    font-size: 3.5rem;
    line-height: 1;
    margin-bottom: 8px;
    animation: shake-lock 1.5s ease-in-out infinite;
}

@keyframes shake-lock {
    0%, 100% { transform: rotate(0deg); }
    25%       { transform: rotate(-6deg); }
    75%       { transform: rotate(6deg); }
}

.lockdown-title {
    font-size: 2.8rem;
    font-weight: 900;
    color: var(--yellow);
    text-shadow: 0 0 20px rgba(255,200,0,0.7), 2px 2px 0 #000;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.lockdown-text {
    font-size: 1.2rem;
    color: #eee;
    line-height: 1.6;
    margin-bottom: 20px;
    text-shadow: 1px 1px 2px #000;
}

.special-unit-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.special-unit-label {
    font-size: 1rem;
    font-weight: 700;
    color: var(--yellow);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px #000;
}

.special-unit-input {
    width: 260px;
    padding: 12px 16px;
    font-size: 1.4rem;
    font-family: var(--font-mono);
    text-align: center;
    letter-spacing: 0.3em;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--yellow);
    border-radius: 6px;
    color: var(--yellow);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.special-unit-input:focus {
    border-color: #fff;
    box-shadow: 0 0 16px rgba(255, 230, 0, 0.5);
}

.special-unit-input::placeholder {
    color: rgba(255, 230, 0, 0.35);
    letter-spacing: 0.1em;
}

.lockdown-pw-feedback {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--red);
    letter-spacing: 0.1em;
    min-height: 20px;
}

.lockdown-half.slide-out-top    { transform: translateY(-100%); }
.lockdown-half.slide-out-bottom { transform: translateY(100%);  }

/* Spezialeinheit-Erfolg-Overlay */
.special-success-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.special-success-overlay.hidden { display: none; }

.special-success-bg {
    position: absolute;
    inset: 0;
    background: url('../images/nawi-unlocked.jpg') center/cover no-repeat;
    filter: brightness(0.75);
    z-index: 0;
}

.special-success-content {
    position: relative;
    z-index: 10;
    width: 100%;
    text-align: center;
    padding: 18px 60px;
    background: rgba(0, 20, 5, 0.90);
    border-top: 3px solid var(--green);
    box-shadow: 0 -6px 60px rgba(45, 198, 83, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 28px;
    flex-wrap: wrap;
}

.special-success-title {
    font-size: 2rem;
    font-weight: 900;
    color: var(--green);
    text-shadow: 0 0 20px var(--green);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
}

.special-success-text {
    font-size: 1.1rem;
    color: #cfc;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE: kleinere Beamer / Notebooks
   ═══════════════════════════════════════════════════════════ */
@media (max-height: 700px) {
    .countdown { font-size: 3.8rem; }
    .sector-img-wrap { height: 90px; }
    .sector-card { width: 338px; }
    .sector-title { font-size: 0.9rem; }
    #sector-teilchenmodell        { top:  5%; }
    #sector-reaktion               { top: 36%; }
    #sector-atombau                { top: 67%; }
    #sector-stoechiometrie         { top:  5%; }
    #sector-elektronenpaarbindung  { top: 36%; }
    #sector-metalle                { top: 67%; }
}

@media (max-width: 1100px) {
    .countdown { font-size: 4rem; }
    .sector-card { width: 364px; }
    .start-title { font-size: 2rem; }
    .success-title { font-size: 2.5rem; }
}

@media (max-width: 800px) {
    .sector-card { width: 286px; }
    .sector-img-wrap { height: 100px; }
}
