* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;

    /* HIER DEIN BILD */
    background-image: url("hintergrund.jpg");
    background-color: #000;

    position: relative;

    /* Bild wird exakt auf die Fenstergröße gestreckt */
    background-size: 100% 100%;

    /* Bild wird mittig ausgerichtet */
    background-position: center;

    /* Bild wiederholt sich nicht */
    background-repeat: no-repeat;

    /* Hintergrund bleibt beim Scrollen */
    background-attachment: fixed;

    font-family: Arial, sans-serif;
    color: white;
}

/* ============================================================
   EXPLOSIONS-CANVAS
   Wichtig: fixed, damit das Canvas keinen Platz im Layout
   erzeugt und beim Laden kein zusätzliches Scrollen verursacht.
   ============================================================ */

#explosion-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

/* ============================================================
   SAFE MODE
   ESC blendet einen komplett schwarzen Bildschirm ein.
   ESC erneut drücken = Safe Mode verlassen.
   ============================================================ */

#safe-mode {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    display: none;
    z-index: 2147483647;

    /* Mausinteraktionen abfangen */
    pointer-events: auto;

    /* Mauszeiger unsichtbar */
    cursor: none;
}

#safe-mode.active {
    display: block;
    cursor: none;
}


/* Dunkle Schicht über dem Bild,
   damit man den Text besser lesen kann */
.overlay {
    min-height: 100vh;

    background: transparent;

    display: flex;
    justify-content: center;
    align-items: center;
}

.bg-control {
    position: fixed;
    top: 14px;
    right: 14px;
    display: flex;
    gap: 8px;
    z-index: 50;
}

.bg-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.45);
    color: white;
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.bg-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px) scale(1.08);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.5);
}

.bg-btn:active {
    transform: translateY(-1px) scale(0.95);
}

.container {
    text-align: center;
    padding: 40px;
    width: 100%;
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.tab {
    padding: 12px 22px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    color: white;
    cursor: pointer;
    font-size: 16px;
    backdrop-filter: blur(8px);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.tab:hover,
.tab.active {
    background: rgba(255, 255, 255, 0.2);
}

.tab:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.5);
}

.tab:active {
    transform: translateY(-1px) scale(0.97);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

#start-countdown {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

h1 {
    font-size: 42px;
    margin-bottom: 40px;
    text-shadow: 0 3px 10px rgba(0, 0, 0, 0.8);
}

#countdown {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.time-box {
    min-width: 140px;
    padding: 25px;

    /* Durchsichtige Box */
    background: rgba(0, 0, 0, 0.55);

    border-radius: 15px;

    /* Glas-Effekt */
    backdrop-filter: blur(8px);

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    border: 1px solid rgba(255, 255, 255, 0.2);
}

.time-box span {
    display: block;
    font-size: 55px;
    font-weight: bold;

    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
}

.time-box small {
    font-size: 18px;
    color: #eeeeee;
}

#message {
    margin-top: 30px;
    font-size: 22px;

    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.8);
}

/* ============================================================
   SPIELE
   ============================================================ */

.game-picker {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.game-btn {
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.45);
    color: white;
    cursor: pointer;
    font-size: 15px;
    backdrop-filter: blur(8px);
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.game-btn:hover,
.game-btn.active {
    background: rgba(255, 255, 255, 0.2);
}

.game-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    border-color: rgba(255, 255, 255, 0.5);
}

.game-btn:active {
    transform: translateY(-1px) scale(0.97);
}

.game-btn.small {
    margin-top: 18px;
    font-size: 13px;
    padding: 8px 16px;
}

.snake-start {
    background: rgba(46, 204, 113, 0.35);
    border-color: rgba(46, 204, 113, 0.6);
    font-weight: bold;
}

.snake-start:hover {
    background: rgba(46, 204, 113, 0.5);
}

.game-panel {
    display: none;
    flex-direction: column;
    align-items: center;
}

.game-panel.active {
    display: flex;
}

.game-info {
    display: flex;
    gap: 25px;
    font-size: 17px;
    margin-bottom: 15px;

    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.game-hint {
    margin-top: 12px;
    font-size: 13px;
    color: #dddddd;

    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

#snake-canvas {
    background: rgba(0, 0, 0, 0.55);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    max-width: 90vw;
    touch-action: none;
}

/* ============================================================
   MINESWEEPER
   ============================================================ */

.mines-diff-picker {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.mines-diff-btn {
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.45);
    color: white;
    cursor: pointer;
    font-size: 13px;

    backdrop-filter: blur(8px);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease,
        border-color 0.2s ease;
}

.mines-diff-btn:hover,
.mines-diff-btn.active {
    background: rgba(255, 255, 255, 0.2);
}

.mines-diff-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

.mines-diff-btn:active {
    transform: translateY(-1px) scale(0.97);
}

.mines-custom-box {
    display: none;
    justify-content: center;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;

    margin-bottom: 16px;
    padding: 12px;

    background: rgba(0, 0, 0, 0.35);

    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.mines-custom-box label {
    display: flex;
    flex-direction: column;
    gap: 4px;

    font-size: 12px;
    color: #ddd;
}

.mines-custom-box input {
    width: 64px;
    padding: 6px 8px;

    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);

    background: rgba(255, 255, 255, 0.1);
    color: white;

    font-size: 14px;
}

.mines-grid {
    --mine-cell-size: 30px;

    display: grid;

    grid-template-columns: repeat(10, var(--mine-cell-size));
    grid-template-rows: repeat(10, var(--mine-cell-size));

    gap: 3px;

    background: rgba(0, 0, 0, 0.45);

    padding: 8px;
    border-radius: 12px;

    border: 1px solid rgba(255, 255, 255, 0.2);

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    max-width: 90vw;
    overflow: auto;
}

.mine-cell {
    width: var(--mine-cell-size);
    height: var(--mine-cell-size);

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 14px;
    font-weight: bold;

    border-radius: 4px;

    background: rgba(255, 255, 255, 0.18);
    color: white;

    cursor: pointer;
    user-select: none;

    transition:
        transform 0.12s ease,
        background 0.12s ease;
}

.mine-cell:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.08);
}

.mine-cell.revealed:hover {
    transform: none;
}

.mine-cell.revealed {
    background: rgba(0, 0, 0, 0.35);
    cursor: default;
}

.mine-cell.mine {
    background: #c0392b;
}

.mine-cell.flag {
    background: rgba(241, 196, 15, 0.35);
}

/* ============================================================
   2048
   ============================================================ */

.t2048-grid {
    position: relative;

    display: grid;

    grid-template-columns: repeat(4, 70px);
    grid-template-rows: repeat(4, 70px);

    gap: 8px;

    background: rgba(0, 0, 0, 0.45);

    padding: 10px;
    border-radius: 12px;

    border: 1px solid rgba(255, 255, 255, 0.2);

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    max-width: 90vw;
    touch-action: none;
}

.t2048-cell,
.t2048-tile {
    width: 70px;
    height: 70px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 22px;
    font-weight: bold;

    border-radius: 8px;
}

.t2048-cell {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

/* Die Kacheln liegen als eigene, animierte Ebene über dem
   statischen Hintergrundraster. */
.t2048-tile {
    position: absolute;

    top: 10px;
    left: 10px;

    color: white;

    transform-origin: top left;

    transition:
        transform 0.12s ease-in-out,
        background 0.1s ease;

    will-change: transform;
}

/* ============================================================
   CANVAS-SPIELE
   ============================================================ */

#pong-canvas,
#flappy-canvas,
#dino-canvas,
#tetris-canvas {
    background: rgba(0, 0, 0, 0.55);

    border-radius: 12px;

    border: 1px solid rgba(255, 255, 255, 0.2);

    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

    max-width: 90vw;

    touch-action: none;
}

/* ============================================================
   SCHERE STEIN PAPIER
   ============================================================ */

.rps-result {
    margin: 20px 0;

    font-size: 18px;

    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

.rps-choices {
    display: flex;
    justify-content: center;

    gap: 12px;
    flex-wrap: wrap;
}

/* ============================================================
   TIC TAC TOE
   ============================================================ */

.ttt-grid {
    display: grid;

    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);

    gap: 6px;

    justify-content: center;

    margin: 0 auto;
}

.ttt-cell {
    background: rgba(0, 0, 0, 0.45);

    border: 1px solid rgba(255, 255, 255, 0.2);

    border-radius: 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 36px;
    font-weight: bold;

    cursor: pointer;

    transition: background 0.15s ease;
}

.ttt-cell:hover {
    background: rgba(255, 255, 255, 0.15);
}

.ttt-cell.ttt-x {
    color: #3498db;
}

.ttt-cell.ttt-o {
    color: #e74c3c;
}

/* ============================================================
   MEMORY
   ============================================================ */

.memory-grid {
    display: grid;

    grid-template-columns: repeat(4, 60px);
    grid-template-rows: repeat(4, 60px);

    gap: 8px;

    justify-content: center;

    margin: 0 auto;
}

.memory-card {
    background: rgba(0, 0, 0, 0.5);

    border: 1px solid rgba(255, 255, 255, 0.2);

    border-radius: 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 28px;

    cursor: pointer;

    transition:
        transform 0.15s ease,
        background 0.15s ease;
}

.memory-card:hover {
    transform: scale(1.05);
}

.memory-card.flipped {
    background: rgba(255, 255, 255, 0.2);
}

.memory-card.matched {
    background: rgba(46, 204, 113, 0.35);
    cursor: default;
}

/* ============================================================
   REAKTIONSTEST
   ============================================================ */

.reaction-box {
    width: 280px;
    height: 160px;

    margin: 20px auto;

    background: rgba(0, 0, 0, 0.5);

    border: 1px solid rgba(255, 255, 255, 0.2);

    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 18px;
    font-weight: bold;

    cursor: pointer;

    text-align: center;

    padding: 10px;

    transition: background 0.15s ease;
}

.reaction-box.go {
    background: rgba(46, 204, 113, 0.6);
}

.reaction-box.too-early {
    background: rgba(231, 76, 60, 0.5);
}

/* ============================================================
   WORDLE
   ============================================================ */

.wordle-grid {
    display: flex;
    flex-direction: column;

    gap: 6px;

    align-items: center;

    margin-bottom: 20px;
}

.wordle-row {
    display: flex;
    gap: 6px;
}

.wordle-cell {
    width: 44px;
    height: 44px;

    border: 2px solid rgba(255, 255, 255, 0.25);

    border-radius: 6px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 20px;
    font-weight: bold;

    text-transform: uppercase;

    background: rgba(0, 0, 0, 0.35);
}

.wordle-cell.correct {
    background: #2ecc71;
    border-color: #2ecc71;
}

.wordle-cell.present {
    background: #f1c40f;
    border-color: #f1c40f;
    color: #222;
}

.wordle-cell.absent {
    background: rgba(255, 255, 255, 0.08);
}

.wordle-keyboard {
    display: flex;
    flex-direction: column;

    gap: 6px;

    align-items: center;
}

.wordle-key-row {
    display: flex;
    gap: 4px;
}

.wordle-key {
    padding: 10px 10px;

    min-width: 30px;

    border: none;

    border-radius: 6px;

    background: rgba(255, 255, 255, 0.15);

    color: white;

    font-weight: bold;

    cursor: pointer;
}

.wordle-key.wide {
    min-width: 55px;
    font-size: 12px;
}

.wordle-key.correct {
    background: #2ecc71;
}

.wordle-key.present {
    background: #f1c40f;
    color: #222;
}

.wordle-key.absent {
    background: rgba(255, 255, 255, 0.05);
    color: #777;
}

/* ============================================================
   SUDOKU
   ============================================================ */

.sudoku-grid {
    display: grid;

    grid-template-columns: repeat(9, 32px);
    grid-template-rows: repeat(9, 32px);

    justify-content: center;

    margin: 0 auto 16px;

    background: rgba(0, 0, 0, 0.4);

    padding: 6px;

    border-radius: 8px;
}

.sudoku-cell {
    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 15px;

    background: rgba(255, 255, 255, 0.08);

    cursor: pointer;

    border: 1px solid rgba(255, 255, 255, 0.08);
}

.sudoku-cell.border-left {
    border-left: 2px solid rgba(255, 255, 255, 0.4);
}

.sudoku-cell.border-top {
    border-top: 2px solid rgba(255, 255, 255, 0.4);
}

.sudoku-cell.fixed {
    font-weight: bold;

    color: #f1c40f;

    cursor: default;

    background: rgba(255, 255, 255, 0.03);
}

.sudoku-cell.selected {
    background: rgba(46, 204, 113, 0.4);
}

.sudoku-numpad {
    display: flex;

    justify-content: center;

    gap: 6px;

    flex-wrap: wrap;
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 600px) {

    .mines-grid {
        --mine-cell-size: 26px;
    }

    .t2048-grid {
        grid-template-columns: repeat(4, 58px);
        grid-template-rows: repeat(4, 58px);
    }

    .t2048-cell,
    .t2048-tile {
        width: 58px;
        height: 58px;

        font-size: 18px;
    }

    h1 {
        font-size: 30px;
        margin-bottom: 30px;
    }

    .container {
        padding: 20px;
    }

    .tabs {
        margin-bottom: 30px;
    }

    .tab {
        font-size: 14px;
        padding: 10px 16px;
    }

    .time-box {
        min-width: 120px;
        padding: 20px;
    }

    .time-box span {
        font-size: 40px;
    }

    .time-box small {
        font-size: 16px;
    }

    #message {
        font-size: 18px;
    }

    .ttt-grid {
        grid-template-columns: repeat(3, 64px);
        grid-template-rows: repeat(3, 64px);
    }

    .memory-grid {
        grid-template-columns: repeat(4, 48px);
        grid-template-rows: repeat(4, 48px);
    }

    .sudoku-grid {
        grid-template-columns: repeat(9, 26px);
        grid-template-rows: repeat(9, 26px);
    }
}
