/* ==========================================================================
   Easter Egg / 404 — Modal-Overlay auf der Hauptseite
   Version 2.0

   Funktionsweise:
   • #page-wrap  — wrapper um den gesamten Seiteninhalt, bekommt den CSS-Filter
   • #egg-overlay — Modal mit Ben + Steuerung, liegt ausserhalb von #page-wrap
                    (nicht vom Filter betroffen)
   ========================================================================== */

/* ========================================================================
   PASSER-EFFEKT auf der Seite
   CSS drop-shadow auf #page-wrap simuliert CMYK-Farbhöfe (Passerfehler).
   Werte werden per inline style gesetzt (JS → pageWrap.style.filter = ...).
   ======================================================================== */
#page-wrap {
    /* Übergang beim Snap: 0.35s → dann wird auf '' zurückgesetzt */
    /* Normaler Zustand: kein filter gesetzt */
}

/* Beim Einblenden des Modals: Scrollen auf der Seite sperren */
body.egg-active {
    overflow: hidden;
}

/* ========================================================================
   OVERLAY + MODAL
   ======================================================================== */
.egg-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.egg-overlay[hidden] { display: none !important; }

/* Halbtransparenter Hintergrund — die «kaputte» Seite bleibt sichtbar */
.egg-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 15, 26, 0.25);
}

/* Das eigentliche Modal-Fenster */
.egg-modal {
    position: relative;
    z-index: 1;
    background: #141B2D;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255,255,255,0.04);
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.75rem;
    font-family: 'Outfit', sans-serif;
    color: #F8FAFC;
    animation: modal-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* Mode-Panels: nur das aktive wird gezeigt */
.egg-panel[hidden] { display: none !important; }
.egg-panel { display: flex; flex-direction: column; gap: 1.25rem; }

/* ---- Ben + Sprechblase ---- */
.egg-intro {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.egg-ben-img {
    width: 90px;
    height: auto;
    flex-shrink: 0;
    filter: drop-shadow(0 4px 16px rgba(99, 102, 241, 0.28));
}

.egg-speech {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 1rem 1.15rem;
    position: relative;
}

/* Sprechblasen-Pfeil */
.egg-speech::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 20px;
    border: 10px solid transparent;
    border-right-color: rgba(255, 255, 255, 0.07);
}
.egg-speech::after {
    content: '';
    position: absolute;
    left: -8px;
    top: 21px;
    border: 8px solid transparent;
    border-right-color: #1e2a40;
}

.egg-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0 0 0.35rem;
    line-height: 1.3;
}

.egg-subtitle {
    font-size: 0.88rem;
    color: #94A3B8;
    margin: 0 0 0.7rem;
    line-height: 1.55;
}

.egg-hint {
    font-size: 0.85rem;
    color: #6366F1;
    font-style: italic;
    margin: 0;
    padding-left: 0.7rem;
    border-left: 3px solid #6366F1;
    line-height: 1.5;
}

/* ========================================================================
   PASSER-STEUERUNG
   ======================================================================== */
.egg-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.1rem;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    padding: 1rem 1.25rem;
}

/* -- Separation-Auswahl -- */
.sep-selector {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.sep-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid;
    background: transparent;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.78rem;
    cursor: pointer;
    transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.sep-c { color: #00E5FF; border-color: #00E5FF; }
.sep-m { color: #FF4DD8; border-color: #FF4DD8; }
.sep-y { color: #FFD600; border-color: #FFD600; }
.sep-k { color: #9CA3AF; border-color: #4B5563; cursor: not-allowed; opacity: 0.5; }

.sep-btn.active { color: #0A0F1A; }
.sep-c.active { background: #00E5FF; box-shadow: 0 0 12px rgba(0,229,255,0.4); }
.sep-m.active { background: #FF4DD8; box-shadow: 0 0 12px rgba(255,77,216,0.4); }
.sep-y.active { background: #FFD600; box-shadow: 0 0 12px rgba(255,214,0,0.4); }

.sep-btn:not(.sep-k):hover { transform: scale(1.1); }

/* -- Pfeilkreuz -- */
.arrow-pad {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.18rem;
}

.arr-row {
    display: flex;
    align-items: center;
    gap: 0.18rem;
}

.arr-btn {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #0A0F1A;
    color: #F8FAFC;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.arr-btn:hover  { background: #6366F1; border-color: #6366F1; }
.arr-btn:active { transform: scale(0.88); }

.arr-center {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: #94A3B8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.12s, color 0.12s;
    -webkit-tap-highlight-color: transparent;
}

.arr-center:hover { border-color: #6366F1; color: #6366F1; }

/* -- Offset-Panel -- */
.offset-panel {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.76rem;
}

.offset-row {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.offset-row-k { opacity: 0.4; }

.offset-label {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.76rem;
    width: 13px;
    text-align: center;
}

.sep-c-text { color: #00E5FF; }
.sep-m-text { color: #FF4DD8; }
.sep-y-text { color: #FFD600; }
.sep-k-text { color: #9CA3AF; }

.offset-val {
    color: #94A3B8;
    min-width: 2.2ch;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.offset-sep { color: rgba(255,255,255,0.2); font-size: 0.72rem; }

/* Tastatur-Hinweis */
.egg-keyboard-hint {
    font-size: 0.76rem;
    color: #94A3B8;
    text-align: center;
    margin: -0.25rem 0 0;
    opacity: 0.6;
}

/* ========================================================================
   ICC-MODUS
   ======================================================================== */
.egg-icc-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.22);
    border-radius: 10px;
    padding: 0.55rem 0.8rem;
    font-size: 0.82rem;
    color: #F59E0B;
    margin-bottom: 0.6rem;
    line-height: 1.5;
}

.profile-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.profile-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.65rem 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    color: #F8FAFC;
    font-family: 'Outfit', sans-serif;
    font-size: 0.86rem;
    cursor: pointer;
    transition: border-color 0.14s, background 0.14s, transform 0.1s;
    text-align: left;
}

.profile-btn:hover { border-color: #6366F1; background: rgba(99,102,241,0.06); }
.profile-btn:active { transform: scale(0.99); }

.profile-btn.selected-correct { border-color: #10B981; background: rgba(16,185,129,0.06); }
.profile-btn.selected-wrong   { border-color: #EF4444; animation: shake 0.32s ease; }

.profile-name { flex: 1; }

.profile-tag {
    font-size: 0.67rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 999px;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}

.tag-rgb  { background: rgba(99,102,241,0.16);  color: #818CF8; }
.tag-cmyk { background: rgba(16,185,129,0.16);  color: #34D399; }
.tag-gray { background: rgba(148,163,184,0.12); color: #94A3B8; }

.icc-feedback {
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
    font-size: 0.86rem;
    line-height: 1.5;
}

.icc-feedback[hidden] { display: none; }

.icc-feedback-success {
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.22);
    color: #34D399;
}

.icc-feedback-error {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.22);
    color: #F87171;
}

/* ========================================================================
   ERFOLGS-PANEL
   ======================================================================== */
.egg-success {
    align-items: center;
    text-align: center;
    padding: 0.5rem 0;
    gap: 1rem;
}

.success-ben {
    width: clamp(120px, 30vw, 180px);
    height: auto;
    animation: pop-in 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pop-in {
    from { transform: scale(0.5) translateY(20px); opacity: 0; }
    to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

#egg-success-heading {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 800;
    margin: 0;
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pop-in 0.5s 0.1s cubic-bezier(0.16, 1, 0.3, 1) both;
}

#egg-success-text {
    color: #94A3B8;
    font-size: 0.98rem;
    margin: 0;
    animation: pop-in 0.5s 0.18s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ========================================================================
   BUTTON
   ======================================================================== */
.ee-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.75rem;
    border-radius: 10px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    border: none;
    transition: transform 0.15s, box-shadow 0.15s;
    animation: pop-in 0.5s 0.26s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.ee-btn-primary {
    background: linear-gradient(135deg, #6366F1, #8B5CF6);
    color: #fff;
    box-shadow: 0 4px 18px rgba(99,102,241,0.32);
}

.ee-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(99,102,241,0.48);
}

/* ========================================================================
   GEHEIME BUBBLE (oberhalb des Dyslexia-Toggles)
   Positionierung: scroll-top 46px + 20px gap + dyslexia 48px + 12px gap + secret 48px
   ======================================================================== */
.secret-bubble {
    position: fixed;
    /* scroll-top(20px rand + 46px höhe + 20px abstand) + dyslexia(48px + 12px abstand) */
    bottom: calc(20px + 46px + 20px + 48px + 12px);
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #141B2D;
    color: #94A3B8;
    border: 2px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    z-index: 9998;
    transition: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    opacity: 0.55;
}

.secret-bubble:hover {
    opacity: 1;
    transform: translateY(-3px) scale(1.06);
    background: #8B5CF6;
    color: #fff;
    border-color: #8B5CF6;
    box-shadow: 0 8px 26px rgba(139,92,246,0.42);
}

@media (max-width: 768px) {
    .secret-bubble {
        bottom: calc(1.25rem + 42px + 15px + 42px + 10px);
        right: 1.25rem;
        width: 42px;
        height: 42px;
        font-size: 1.05rem;
    }
}

/* ========================================================================
   ANIMATIONEN
   ======================================================================== */
@keyframes shake {
    0%,100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}

/* ========================================================================
   RESPONSIVE
   ======================================================================== */
@media (max-width: 540px) {
    .egg-modal { padding: 1.25rem; }

    .egg-intro {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .egg-ben-img { width: 70px; }
    .egg-speech::before, .egg-speech::after { display: none; }
    .egg-hint { text-align: left; }

    .egg-controls { gap: 0.75rem; padding: 0.85rem; }
    .sep-selector  { flex-direction: row; }

    .egg-keyboard-hint { display: none; }
}
