/* --- 1. VARIABLEN & RESET --- */
:root {
    --nixie-orange: #ff5500;
    --nixie-glow: #ff2200;
    --bg-amber: #ffaa33;
    --panel-bg: rgba(5, 5, 5, 0.95);
    --slot-bg: #000;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: #010101;
    color: #fff;
    font-family: 'Courier New', monospace;
    scroll-snap-type: y mandatory;
    overflow-y: scroll;
    scrollbar-width: none; /* Firefox */
}

body::-webkit-scrollbar { display: none; } /* Chrome/Safari */

/* Hintergrund-Canvas fixieren */
#bgCanvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    pointer-events: none; /* Wichtig für Scroll-Durchlässigkeit */
}

/* Sektions-Container für Scroll-Snap */
.module-section {
    height: 100vh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
    scroll-snap-align: start;
    position: relative;
    z-index: 2;
}

/* --- 2. NIXIE UHR --- */
.nixie-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 45px 65px 25px 65px;
    background: var(--panel-bg);
    border-radius: 4px;
    border: 1px solid rgba(255, 170, 51, 0.1);
    box-shadow: 0 0 100px rgba(0,0,0,1);
    backdrop-filter: blur(15px);
    transition: all 0.3s ease;
}

.nixie-wrapper:hover {
    border-color: rgba(255, 170, 51, 0.4);
    box-shadow: 0 0 150px rgba(255, 85, 0, 0.15);
}

.tubes-container {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 25px;
}

.tube {
    position: relative;
    width: 85px;
    height: 155px;
    background: linear-gradient(135deg, #0a0a0a 0%, #151515 50%, #0a0a0a 100%);
    border-radius: 42px 42px 4px 4px;
    border: 1px solid #222;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 0 0 30px #000;
    overflow: hidden;
}

.digit-stack {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    filter: url(#distort) blur(0.3px);
}

.digit {
    position: absolute;
    font-size: 90px;
    font-weight: 900;
    color: #1a0f05;
    opacity: 0.1;
    user-select: none;
}

.digit.active {
    color: #ffdab9;
    opacity: 1;
    z-index: 6;
    text-shadow: 0 0 10px var(--nixie-orange), 0 0 25px var(--nixie-orange), 0 0 50px var(--nixie-glow);
    animation: hum 0.2s infinite alternate;
}

.nixie-wrapper:hover .digit.active {
    animation: discharge 0.05s infinite !important;
    color: #ffffff;
    text-shadow: 0 0 15px #fff, 0 0 30px var(--nixie-orange), 0 0 60px var(--nixie-orange), 0 0 100px var(--nixie-glow);
}

.date-display {
    color: var(--nixie-orange);
    font-size: 20px;
    letter-spacing: 3px;
    opacity: 0.7;
    text-shadow: 0 0 8px var(--nixie-orange);
    text-transform: uppercase;
    border-top: 1px solid rgba(255, 170, 51, 0.1);
    padding-top: 15px;
    width: 100%;
    text-align: center;
}

.separator { font-size: 40px; color: #111; align-self: center; padding-bottom: 10px; }
.scroll-hint { position: absolute; bottom: 30px; color: #222; font-size: 10px; letter-spacing: 3px; }

/* --- 3. SPIELFELD (FIXIERTES GRID) --- */
.game-board {
    background: var(--panel-bg);
    border: 1px solid rgba(255, 170, 51, 0.1);
    padding: 50px;
    border-radius: 4px;
    box-shadow: 0 0 100px rgba(0,0,0,1);
    backdrop-filter: blur(20px);
    width: 950px; /* Fixe Gesamtbreite */
    height: 800px; /* Fixe Gesamthöhe */
    position: relative;
    overflow: hidden;
}

.main-layout {
    display: grid;
    grid-template-columns: 550px 300px; /* Fixierte Spaltenbreiten */
    gap: 50px;
    align-items: start;
}

.board-header {
    color: var(--nixie-orange);
    font-size: 11px;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 30px;
    text-align: center;
    opacity: 0.7;
}

/* --- 4. REIHEN & SLOTS --- */
.rows-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.row {
    display: flex;
    align-items: center;
    height: 55px; /* Fixierte Reihenhöhe */
    padding: 0 15px;
    background: rgba(255,255,255,0.02);
    border-radius: 4px;
    border: 1px solid transparent;
    transition: background 0.3s;
}

.row.active {
    opacity: 1;
    background: rgba(255, 170, 51, 0.05);
    border: 1px solid rgba(255, 170, 51, 0.1);
}

.row-number { color: #333; font-size: 10px; width: 25px; }

/* Slot-Container fixiert, damit Layout nicht springt */
.slots {
    display: flex;
    gap: 15px;
    width: 320px; /* Genug Platz für 6 Slots */
    justify-content: flex-start;
}

.slot {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--slot-bg);
    box-shadow: inset 0 2px 10px #000;
    border: 1px solid #222;
    transition: all 0.2s;
}

/* Feedback-Container fixiert */
.feedback-grid, .feedback-grid.easy-mode {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    width: 60px;
    margin-left: auto;
}

.hint-slot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #080808;
    border: 1px solid #1a1a1a;
}

/* --- 5. EINSTELLUNGEN & CONTROLS --- */
.controls-panel {
    border-left: 1px solid rgba(255,255,255,0.05);
    padding-left: 40px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.settings-panel {
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Tooltips */
.setting-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0; top: -35px;
    background: var(--nixie-orange);
    color: #000;
    padding: 5px 10px;
    font-size: 10px;
    white-space: nowrap;
    border-radius: 2px;
    opacity: 0;
    pointer-events: none;
    transition: 0.2s;
    z-index: 100;
}
.setting-item:hover::after { opacity: 1; top: -45px; }

/* Range Slider */
input[type=range] { -webkit-appearance: none; background: #222; height: 4px; border-radius: 2px; }
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none; height: 16px; width: 16px; border-radius: 50%;
    background: var(--nixie-orange); cursor: pointer; box-shadow: 0 0 10px var(--nixie-orange);
}

/* Toggle Switch */
.switch-label { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-size: 11px; color: #888; }
.switch-label input { display: none; }
.slider { width: 34px; height: 18px; background: #222; position: relative; border-radius: 10px; transition: 0.3s; }
.slider:before { content: ""; position: absolute; height: 12px; width: 12px; left: 3px; bottom: 3px; background: #444; border-radius: 50%; transition: 0.3s; }
input:checked + .slider { background: var(--nixie-orange); }
input:checked + .slider:before { transform: translateX(16px); background: #000; }

.instruction { font-size: 10px; color: #555; margin-bottom: 20px; text-transform: uppercase; }
.color-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 30px; }
.picker-slot { width: 45px; height: 45px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; transition: 0.2s; }
.picker-slot:hover { transform: scale(1.1); }

.button-group { display: flex; flex-direction: column; gap: 10px; }
.sub-buttons { display: flex; gap: 10px; }

.submit-btn {
    width: 100%; background: transparent; border: 1px solid var(--nixie-orange);
    color: var(--nixie-orange); padding: 15px; font-family: 'Courier New', monospace;
    cursor: pointer; text-transform: uppercase; letter-spacing: 2px; transition: 0.3s;
}
.submit-btn:hover { background: var(--nixie-orange); color: #000; box-shadow: 0 0 20px var(--nixie-orange); }

.secondary-btn {
    flex: 1; background: rgba(255, 255, 255, 0.05); border: 1px solid #333; color: #666;
    padding: 10px; font-family: 'Courier New', monospace; font-size: 10px; cursor: pointer; text-transform: uppercase; transition: 0.2s;
}
.secondary-btn:hover { border-color: #555; color: #aaa; background: rgba(255, 255, 255, 0.1); }

.status-monitor { margin-top: auto; font-size: 11px; color: #333; padding: 15px; background: #000; border: 1px solid #111; min-height: 20px; }

/* --- 6. GAME OVER OVERLAY --- */
.game-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.96);
    display: flex; justify-content: center; align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    transition: opacity 0.5s ease;
}

.game-overlay.hidden { display: none; }
.overlay-content { text-align: center; }
#overlay-title { font-size: 42px; letter-spacing: 10px; margin-bottom: 10px; text-transform: uppercase; }

.win-state #overlay-title { color: #44ff44; text-shadow: 0 0 20px #44ff44; }
.lose-state #overlay-title { color: #ff4444; text-shadow: 0 0 20px #ff4444; animation: glitch 0.3s infinite; }

.secret-reveal { display: flex; gap: 15px; justify-content: center; margin: 40px 0; }

/* --- 7. KEYFRAMES --- */
@keyframes hum { from { filter: brightness(1); } to { filter: brightness(1.1); } }
@keyframes discharge {
    0% { transform: translate(1px, 1px); filter: brightness(2); }
    50% { transform: translate(-1px, -1px); filter: brightness(4); }
    100% { transform: translate(0, 0); filter: brightness(2); }
}
@keyframes glitch {
    0% { transform: translate(0); }
    25% { transform: translate(-2px, 2px); }
    50% { transform: translate(2px, -2px); }
    75% { transform: translate(-1px, -1px); }
    100% { transform: translate(0); }
}

/* --- MOBILE OPTIMIERUNG --- */
@media (max-width: 1000px) {
    /* 1. Uhr skalieren */
    .nixie-wrapper {
        padding: 20px;
        transform: scale(0.8); /* Verkleinert die Uhr, damit sie nicht übersteht */
    }

    .tube {
        width: 60px; /* Kleinere Röhren für Mobile */
        height: 110px;
    }

    .digit { font-size: 60px; }
    .date-display { font-size: 14px; }

    /* 2. Spielfeld flexibel machen */
    .game-board {
        width: 95vw; /* Fast volle Breite des Handys */
        height: auto; /* Höhe passt sich nun dem Inhalt an */
        min-height: 90vh;
        padding: 20px;
        overflow-y: auto; /* Scrollen innerhalb des Boards erlauben */
    }

    .main-layout {
        grid-template-columns: 1fr; /* Spalten untereinander stapeln */
        gap: 30px;
    }

    /* 3. Reihen & Slots anpassen */
    .slots {
        width: auto;
        gap: 8px;
    }

    .slot {
        width: 30px;
        height: 30px;
    }

    .row {
        gap: 10px;
        padding: 5px;
    }

    /* 4. Controls & Picker */
    .controls-panel {
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.05);
        padding-left: 0;
        padding-top: 30px;
    }

    .color-picker {
        grid-template-columns: repeat(6, 1fr); /* Alle 6 Farben in eine Reihe */
        gap: 10px;
    }

    .picker-slot {
        width: 40px;
        height: 40px;
    }

    .overlay-content #overlay-title {
        font-size: 24px;
        letter-spacing: 4px;
    }
}