:root {
  --oben: 0%;
  --rechts: 0%;
  --unten: 0%;
  --links: 0%;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Futura", "Futura PT", "Trebuchet MS", sans-serif;
    min-height: 100vh;
    position: relative;
    background-color: #ffffff;
    overflow-x: hidden;
}

/* --- HINTERGRUNDBILD ANLEGEN --- */
.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('IMG.jpeg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 1;
}

/* --- ÜBERSCHRIFT: DESKTOP --- */
.main-title {
    position: fixed;
    top: 40px;
    left: 50px;
    margin: 0;
    font-family: "Futura", "Futura PT", sans-serif;
    font-size: 54px;
    font-weight: 900;
    letter-spacing: -0.04em;
    color: #0000ff;
    z-index: 100;
    text-transform: uppercase;
}

#zeichenBereich {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    position: relative;
    z-index: 10;
}

#letter {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(7, 1fr);
    background: transparent;
    width: 40vw;
    max-width: 450px;
    aspect-ratio: 5/7;
    position: relative;
}

/* Grid-Flächen */
.p2_2 { grid-area: 2/2/3/3; } .p2_3 { grid-area: 2/3/3/4; } .p2_4 { grid-area: 2/4/3/5; }
.p3_2 { grid-area: 3/2/4/3; } .p3_3 { grid-area: 3/3/4/4; } .p3_4 { grid-area: 3/4/4/5; }
.p4_2 { grid-area: 4/2/5/3; } .p4_3 { grid-area: 4/3/5/4; } .p4_4 { grid-area: 4/4/5/5; }
.p5_2 { grid-area: 5/2/6/3; } .p5_3 { grid-area: 5/3/6/4; } .p5_4 { grid-area: 5/4/6/5; }
.p6_2 { grid-area: 6/2/7/3; } .p6_3 { grid-area: 6/3/7/4; } .p6_4 { grid-area: 6/4/7/5; }

.modul {
    aspect-ratio: 1/1;
    background: #0000ff;
    position: relative;
    box-shadow: 0 0 0 1px #0000ff; 
}

.modul .zack { 
    position: absolute;
    background-color: #0000ff;
    will-change: height, width, top, right, bottom, left;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
}

.o { bottom: 100%; height: var(--oben); width: 100%; -webkit-mask-image: url('zackO.svg'); mask-image: url('zackO.svg'); }
.r { left: 100%; width: var(--rechts); height: 100%; -webkit-mask-image: url('zackR.svg'); mask-image: url('zackR.svg'); }
.u { top: 100%; width: 100%; height: var(--unten); -webkit-mask-image: url('zackU.svg'); mask-image: url('zackU.svg'); }
.l { right: 100%; height: 100%; width: var(--links); -webkit-mask-image: url('zackL.svg'); mask-image: url('zackL.svg'); }

/* --- UI BUTTONS DESKTOP --- */
footer {
    position: fixed;
    bottom: 40px;
    right: 40px;
    z-index: 90;
    display: flex;
    gap: 10px;
}

footer button {
    background: #0000ff;
    color: #ffffff;
    border: 1px solid #0000ff;
    padding: 15px 30px;
    font-family: "Futura", "Futura PT", sans-serif;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

footer button:hover {
    background: #ffffff;
    color: #0000ff;
}

#gyroBtn {
    background: #00008b;
    border-color: #00008b;
}

/* --- TASTATUR OVERLAY BASE --- */
#keyboardOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.96);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.25s ease;
}

#keyboardOverlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.keyboard-content {
    position: relative;
    width: 90%;
    max-width: 650px;
    padding: 40px 20px;
    box-sizing: border-box;
}

.close-btn {
    position: absolute;
    top: -20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 36px;
    cursor: pointer;
    color: #0000ff;
}

.keyboard-grid {
    display: grid;
    grid-template-columns: repeat(20, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 550px;
}

.keyboard-grid button {
    grid-column: span 2;
    aspect-ratio: 1;
    background: transparent;
    border: none;
    font-family: "Futura", "Futura PT", sans-serif;
    font-size: 18px;
    font-weight: bold;
    text-transform: uppercase;
    color: #0000ff;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

.keyboard-grid button:hover {
    background: #0000ff;
    color: #ffffff;
}

.spacer.half { grid-column: span 1; pointer-events: none; }
.spacer.double-half { grid-column: span 5; pointer-events: none; }


/* ==========================================================================
   --- RESPONSIVE MOBILE (SMARTPHONES) ---
   ========================================================================== */
@media (max-width: 768px) {
    body { 
        overflow: hidden; 
    }
    
    .main-title {
        position: absolute;
        top: 40px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 32px;
        letter-spacing: 0.05em;
        width: 100%;
        text-align: center;
        color: #0000ff;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.85) 30%, rgba(255, 255, 255, 0) 70%);
        padding: 20px 0;
    }
    
    #zeichenBereich {
        position: absolute;
        top: 45%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 65vw;
        max-width: 260px;
        min-height: auto;
    }
    
    #letter { 
        width: 100%; 
        height: auto; 
    }
    
    footer {
        position: absolute;
        bottom: 110px; 
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        width: 85%;
        justify-content: center;
        flex-direction: column;
        gap: 8px;
    }
    
    footer button {
        padding: 14px 20px;
        font-size: 13px;
        width: 100%;
    }
}


/* ==========================================================================
   --- GRAFISCHER EFFEKT: HARTE LINIEN & VERSCHÄRFTES COOLDOWN-BEBEN ---
   ========================================================================== */

/* Grafisches rhythmisches Flackern vor dem Ausbruch */
.letter-shake {
    animation: letterFlicker 0.3s steps(2, start) infinite;
}

@keyframes letterFlicker {
    0% { filter: brightness(2) contrast(2); transform: scale(1.03); }
    100% { filter: brightness(1) contrast(1); transform: scale(0.98); }
}

/* Messerscharfe, grafische Ringe statt weicher Blenden */
.shockwave-container {
    position: fixed;
    top: var(--wave-y, 50%);
    left: var(--wave-x, 50%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 5;
}

/* Die 3 harten Ringe, die nacheinander herausschießen */
.shockwave-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    /* Harte, fette grafische Kontur und Füllung */
    border: 12px solid #ffea00;
    background: transparent;
    box-sizing: border-box;
    opacity: 0;
    animation: hardWave 2.4s cubic-bezier(0.1, 0.7, 0.1, 1) forwards;
}

/* Zeitliche Versetzung der Ringe für den grafischen Wellen-Look */
.shockwave-ring:nth-child(2) { animation-delay: 0.2s; border-width: 8px; }
.shockwave-ring:nth-child(3) { animation-delay: 0.4s; border-width: 4px; }

@keyframes hardWave {
    0% {
        width: 0vw;
        height: 0vw;
        opacity: 0;
    }
    5% {
        opacity: 1;
        background: #ffea00; /* Startet als komplett ausgefüllter harter Kreis */
    }
    15% {
        background: transparent; /* Wird blitzartig innen hohl -> wird zum Ring */
    }
    90% {
        opacity: 1;
    }
    100% {
        width: 250vw;
        height: 250vw;
        opacity: 0; /* Verschwindet schlagartig am Rand */
    }
}