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

html, body { 
    width: 100%; 
    height: 100%; 
    background-color: #000 !important; 
    color: #00ff41; 
    font-family: 'Courier New', monospace; 
    overflow: hidden; 
}

/* ==========================================================================
   DER CRT-LOOK & DAS RAUSCHEN (OVERLAY)
   ========================================================================== 
*/
.crt-overlay {
    position: fixed; 
    inset: 0; 
    z-index: 9999; 
    pointer-events: none; 
    
    background: 
        repeating-linear-gradient(0deg, transparent 0px, transparent 3px, rgba(0,0,0,0.12) 3px, rgba(0,0,0,0.12) 4px),
        radial-gradient(ellipse 90% 90% at 50% 50%, transparent 45%, rgba(0,0,0,0.75) 100%);
    
    /* NEU: Erlaubt das sanfte Ausblenden des GESAMTEN Filters */
    transition: opacity 0.5s ease;
}

.crt-overlay::before {
    content: "";
    position: absolute;
    inset: -100%; 
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.95' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.04; 
    z-index: -1;
    pointer-events: none; 
    animation: noise-subtle 0.15s steps(3) infinite;
}

/* Schaltet den Röhren-Look komplett ab (für die modernen Sektionen) */
.crt-overlay.off {
    opacity: 0 !important;
}

@keyframes noise-subtle {
    0%   { transform: translate(0, 0); }
    33%  { transform: translate(1%, -0.5%); }
    66%  { transform: translate(-0.8%, 1%); }
    100% { transform: translate(0.5%, -1%); }
}

/* ==========================================================================
   CRT POWER OFF ANIMATION (ALTER PC SCHLIESST SICH)
   ========================================================================== 
*/
.crt-power-off {
    animation: crtTurnOff 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards !important;
    transform-origin: center center;
}

.crt-power-off::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #ffffff;
    z-index: 10000;
    animation: crtFlash 0.7s forwards;
}

@keyframes crtTurnOff {
    0%   { transform: scale(1, 1); }
    40%  { transform: scale(1, 0.006); }
    70%  { transform: scale(0.006, 0.006); }
    100% { transform: scale(0, 0); }
}

@keyframes crtFlash {
    0%   { opacity: 0; background: #ffffff; }
    10%  { opacity: 1; background: #ffffff; box-shadow: 0 0 50px 10px #ffffff; }
    40%  { opacity: 1; background: #00ff41; box-shadow: 0 0 100px 30px #00ff41; }
    70%  { opacity: 1; background: #00ff41; box-shadow: 0 0 50px 10px #00ff41; }
    100% { opacity: 0; }
}

/* ==========================================================================
   SEKTIONS-LOGIK
   ========================================================================== 
*/
.stage {
    position: absolute; 
    inset: 0;
    display: none; 
    opacity: 0;
    transition: opacity 0.8s ease;
    background-color: #000; 
}

.stage.active {
    display: flex; 
    flex-direction: column; 
    opacity: 1;
}

/* ══════════════════════════════
   GEMEINSAMER WINDOWS DESKTOP
══════════════════════════════ */
.win-desktop {
    position: absolute; inset: 0; z-index: 10;
    display: flex; flex-direction: column;
    /* Windows 11 Bloom Style */
    background-color: #0a1628;
    background-image:
        radial-gradient(ellipse 80% 70% at 60% 55%,
            rgba(100, 80, 200, 0.45) 0%,
            rgba(40, 80, 180, 0.3) 35%,
            transparent 70%),
        radial-gradient(ellipse 50% 50% at 30% 40%,
            rgba(0, 120, 212, 0.3) 0%,
            transparent 60%),
        linear-gradient(135deg, #0a1628 0%, #0d1f3c 50%, #0a1628 100%);
}

.win-taskbar {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 48px;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(20px);
    display: flex; align-items: center;
    padding: 0 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.win-taskbar-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border-radius: 6px;
    transition: background 0.15s;
}
.win-taskbar-btn:hover { background: rgba(255,255,255,0.1); }
.win-taskbar-btn svg { width: 16px; height: 16px; }

.win-tb-item {
    height: 36px; padding: 0 12px;
    display: flex; align-items: center; gap: 7px;
    font-size: 12px; color: rgba(255,255,255,0.85);
    border-radius: 6px; cursor: default;
    transition: background 0.15s; margin-left: 4px;
    font-family: 'Segoe UI', Arial, sans-serif;
}
.win-tb-item:hover { background: rgba(255,255,255,0.08); }
.win-tb-item.active {
    background: rgba(255,255,255,0.12);
    border-bottom: 2px solid #0078d4;
}

.win-tb-clock {
    margin-left: auto;
    font-size: 11px; color: rgba(255,255,255,0.8);
    text-align: right; padding: 0 10px;
    line-height: 1.5;
    font-family: 'Segoe UI', Arial, sans-serif;
}

/* Gemeinsame Desktop-Icons */
.desk-icon {
    position: absolute; display: flex; flex-direction: column;
    align-items: center; gap: 5px; padding: 8px;
    border-radius: 4px; cursor: default; width: 76px;
    transition: background 0.15s; text-align: center;
}
.desk-icon:hover { background: rgba(255,255,255,0.12); }
.desk-icon-img { font-size: 32px; line-height: 1; }
.desk-icon-lbl {
    font-size: 11px; color: #fff;
    text-align: center;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.3;
}

/* ══════════════════════════════
   GEMEINSAMER WINDOWS DESKTOP
══════════════════════════════ */
.win-desktop {
    position: absolute; inset: 0; z-index: 10;
    display: flex; flex-direction: column;
    background-color: #0a1628;
    background-image:
        radial-gradient(ellipse 80% 70% at 60% 55%,
            rgba(100, 80, 200, 0.45) 0%,
            rgba(40, 80, 180, 0.3) 35%,
            transparent 70%),
        radial-gradient(ellipse 50% 50% at 30% 40%,
            rgba(0, 120, 212, 0.3) 0%,
            transparent 60%),
        linear-gradient(135deg, #0a1628 0%, #0d1f3c 50%, #0a1628 100%);
}

.win-taskbar {
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 48px;
    background: rgba(10, 10, 15, 0.88);
    backdrop-filter: blur(20px);
    display: flex; align-items: center;
    padding: 0 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
    z-index: 100;
}

.win-taskbar-btn {
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; border-radius: 6px;
    transition: background 0.15s;
}
.win-taskbar-btn:hover { background: rgba(255,255,255,0.1); }
.win-taskbar-btn svg { width: 16px; height: 16px; }

.win-tb-item {
    height: 36px; padding: 0 12px;
    display: flex; align-items: center; gap: 7px;
    font-size: 12px; color: rgba(255,255,255,0.85);
    border-radius: 6px; cursor: default;
    transition: background 0.15s; margin-left: 4px;
    font-family: 'Segoe UI', Arial, sans-serif;
}
.win-tb-item:hover { background: rgba(255,255,255,0.08); }
.win-tb-item.active {
    background: rgba(255,255,255,0.12);
    border-bottom: 2px solid #0078d4;
}

.win-tb-clock {
    margin-left: auto;
    font-size: 11px; color: rgba(255,255,255,0.8);
    text-align: right; padding: 0 10px;
    line-height: 1.5;
    font-family: 'Segoe UI', Arial, sans-serif;
}

.desk-icon {
    position: absolute; display: flex; flex-direction: column;
    align-items: center; gap: 5px; padding: 8px;
    border-radius: 4px; cursor: default; width: 76px;
    transition: background 0.15s; text-align: center;
}
.desk-icon:hover { background: rgba(255,255,255,0.12); }
.desk-icon-img { font-size: 32px; line-height: 1; }
.desk-icon-lbl {
    font-size: 11px; color: #fff;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
    font-family: 'Segoe UI', Arial, sans-serif;
    line-height: 1.3;
}

/* ── MOBILE FIX ── */
@supports (height: 100dvh) {
    html, body {
        height: 100dvh;
    }
}

@media screen and (max-width: 1024px) {
    #outro-term-lines {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #editor-area {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    #active-slide {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
}