/* ══ Code-Modal (6 Boxen, Orbit, Haken/X) ══════════════════════════════════════════════════════════════════
   Eine Quelle für die Registrierung (starting.php) und Konto-Änderungen mit Code (settings.php).
   Markup: includes/email-verify-modal.php · Verhalten + Motion: assets/js/email-verify.js · Regeln: email-verification.mdc.
   Auf starting.php liefern .wizard-overlay / .wizard-popup (starting.css) Fläche und Karte. Außerhalb davon setzt
   .sl-email-verify-overlay--standalone beides selbst, mit denselben Werten, und bleibt immer dunkel. */

.sl-email-verify-overlay--standalone {
    /* Theme-unabhängige Neutrals (Spec-Aliase in sl-ui.css): das Modal sieht überall aus wie bei der Registrierung. */
    --text: var(--sl-text);
    --text-secondary: var(--sl-text-muted);
    --text-tertiary: var(--sl-text-dim);
    --success: var(--sl-moss);
    --error: var(--sl-muted-red);
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    height: 100dvh;
    padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
    color: var(--text);
    background: rgba(0, 0, 0, 0.72);
    -webkit-backdrop-filter: saturate(120%) blur(20px);
    backdrop-filter: saturate(120%) blur(20px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.4s var(--ease),
        visibility 0.4s var(--ease);
}

.sl-email-verify-overlay--standalone.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.sl-email-verify-overlay--standalone .sl-email-verify-popup {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    padding: 32px 28px 24px;
    background: linear-gradient(180deg, rgba(15, 15, 15, 0.92) 0%, rgba(7, 7, 7, 0.94) 100%);
    border: 0.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    box-shadow:
        0 0 0 0.5px rgba(255, 255, 255, 0.06) inset,
        0 1px 0 rgba(255, 255, 255, 0.07) inset,
        0 8px 28px rgba(0, 0, 0, 0.5),
        0 28px 90px rgba(0, 0, 0, 0.7);
    transform: scale(0.96) translateY(20px);
    transition: transform 0.5s var(--ease-out);
}

.sl-email-verify-overlay--standalone.open .sl-email-verify-popup {
    transform: scale(1) translateY(0);
}

/* Licht von oben + Haarlinie an der Oberkante, wie .wizard-popup */
.sl-email-verify-overlay--standalone .sl-email-verify-popup::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(120% 64% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 58%);
}

.sl-email-verify-overlay--standalone .sl-email-verify-popup::after {
    content: "";
    position: absolute;
    top: 0;
    right: 10%;
    left: 10%;
    height: 1px;
    pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
}

.sl-email-verify-overlay--standalone .sl-otp-nav {
    position: relative;
    display: flex;
    justify-content: center;
}

.sl-email-verify-overlay--standalone .sl-otp-nav > button {
    min-width: 140px;
}

/* Dashboard: Seite hinter dem offenen Modal nicht scrollen (html mit, siehe dashboard.css Scroll-Locks). */
html:has(> body.sl-dash.sl-otp-active),
body.sl-dash.sl-otp-active {
    overflow: hidden;
}

.sl-email-verify-popup {
    max-width: 420px;
    text-align: center;
    max-height: min(84dvh, 100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sl-email-verify-popup h2 {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin: 0 0 6px;
    line-height: 1.2;
}

.sl-email-verify-popup .hint {
    text-align: center;
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0 0 22px;
    letter-spacing: -0.01em;
    line-height: 1.4;
}

#email-verify-address {
    color: var(--text);
    font-weight: 500;
    word-break: break-all;
}

.sl-otp-stage {
    position: relative;
    width: 100%;
    min-height: clamp(120px, 42vw, 168px);
    height: clamp(120px, 42vw, 168px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 8px;
}

.sl-otp-boxes {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 280px;
    gap: clamp(4px, 1.6vw, 8px);
}

.sl-otp-slot {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: 50% 50%;
}

.sl-otp-orbit {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    transform-origin: 0 0;
    pointer-events: none;
    z-index: 1;
}

.sl-otp-orbit.is-active .sl-otp-slot {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
    transform-origin: 50% 50%;
}

.sl-otp-box {
    position: relative;
    width: clamp(32px, 11vw, 42px);
    height: clamp(40px, 13.5vw, 52px);
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    transform-origin: 50% 50%;
    overflow: visible;
}

.sl-otp-shape {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: rgba(255, 255, 255, 0.045);
    box-shadow: 0 0 0 0.5px rgba(255, 255, 255, 0.04) inset;
    pointer-events: none;
    transform-origin: 50% 50%;
    transition:
        border-color 0.28s var(--ease),
        background-color 180ms ease,
        box-shadow 180ms ease;
}

.sl-otp-shape::after {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    box-shadow: 0 0 18px color-mix(in srgb, var(--sl-status-success) 16%, transparent);
    transition: opacity 0.22s var(--ease);
}

.sl-otp-box.is-filled .sl-otp-shape {
    border-color: color-mix(in srgb, var(--sl-status-success) 70%, transparent);
}

.sl-otp-box.is-filled .sl-otp-shape::after {
    opacity: 1;
}

/* Input Focus 2.0: das aktive Code-Feld tönt sich wie jedes Textfeld (Form bleibt, das echte Input ist transparent) */
.sl-otp-box.is-focus .sl-otp-shape {
    border-color: transparent;
    background-color: var(--input-surface-focus);
    box-shadow: var(--input-focus-shadow);
}

.sl-otp-box.is-success .sl-otp-shape {
    border-color: color-mix(in srgb, var(--sl-status-success) 85%, transparent);
}

.sl-otp-box.is-success .sl-otp-shape::after {
    opacity: 1;
    box-shadow: 0 0 16px color-mix(in srgb, var(--sl-status-success) 20%, transparent);
}

.sl-otp-box.is-error .sl-otp-shape {
    border-color: color-mix(in srgb, var(--sl-status-error) 80%, transparent);
}

.sl-otp-box.is-error .sl-otp-shape::after {
    opacity: 1;
    box-shadow: 0 0 14px color-mix(in srgb, var(--sl-status-error) 18%, transparent);
}

.sl-otp-stage.is-motion .sl-otp-orbit.is-active .sl-otp-slot,
.sl-otp-stage.is-motion .sl-otp-box,
.sl-otp-stage.is-motion .sl-otp-shape,
.sl-otp-stage.is-motion .sl-otp-svg {
    will-change: transform, opacity;
}

/* Box → Kapsel: Farbe und Geometrie kommen pro Frame aus JS — keine CSS-Transition dazwischen */
.sl-otp-stage.is-morph .sl-otp-shape,
.sl-otp-stage.is-morph .sl-otp-shape::after {
    transition: none;
}

.sl-otp-input {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 22px;
    font-weight: 600;
    text-align: center;
    caret-color: var(--text);
    outline: none;
    padding: 0;
    letter-spacing: 0;
    appearance: none;
    -webkit-appearance: none;
}

.sl-otp-input:disabled {
    opacity: 1;
}

.sl-otp-mark {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.sl-otp-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    overflow: visible;
    transform-origin: 50% 50%;
}

.sl-otp-svg.is-on {
    visibility: visible;
}

/* Glow erst nach dem Handoff von den Kapseln (die keinen Glow haben) — weich ein und wieder aus */
.sl-otp-svg-check,
.sl-otp-svg-x {
    shape-rendering: geometricPrecision;
    transition: filter 0.28s var(--ease);
}

.sl-otp-svg-check {
    color: var(--success);
    filter: drop-shadow(0 0 0 color-mix(in srgb, var(--sl-status-success) 0%, transparent));
}

.sl-otp-svg-check.is-glow {
    filter: drop-shadow(0 0 12px color-mix(in srgb, var(--sl-status-success) 45%, transparent));
}

.sl-otp-svg-x {
    color: var(--error);
    filter: drop-shadow(0 0 0 color-mix(in srgb, var(--sl-status-error) 0%, transparent));
}

.sl-otp-svg-x.is-glow {
    filter: drop-shadow(0 0 10px color-mix(in srgb, var(--sl-status-error) 35%, transparent));
}

@media (max-width: 860px) and (max-height: 500px) {
    .sl-email-verify-popup {
        max-height: min(88dvh, 100%);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .sl-otp-stage {
        min-height: 110px;
        height: 110px;
    }
}

.sl-otp-status {
    min-height: 22px;
    margin: 4px 0 12px;
    font-size: 14px;
    letter-spacing: -0.01em;
    color: var(--text-secondary);
}

.sl-otp-status.is-ok {
    color: var(--success);
}

.sl-otp-status.is-err {
    color: var(--error);
}

.sl-otp-resend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    align-items: baseline;
    margin: 0 0 16px;
    font-size: 13px;
    color: var(--text-tertiary);
}

.sl-otp-resend {
    border: 0;
    background: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, 0.28);
}

.sl-otp-resend:hover:not(:disabled) {
    color: var(--sl-text);
    text-decoration-color: rgba(255, 255, 255, 0.55);
}

.sl-otp-resend:disabled {
    cursor: default;
    color: var(--text-tertiary);
    text-decoration: none;
}

.sl-otp-nav {
    margin-top: 0;
}

@media (max-width: 480px) {
    .sl-otp-box {
        width: clamp(32px, 10.2vw, 38px);
        height: clamp(40px, 12.8vw, 48px);
    }

    .sl-otp-boxes {
        gap: clamp(4px, 1.4vw, 6px);
    }

    .sl-otp-input {
        font-size: 20px;
    }
}

@media (max-width: 360px) {
    .sl-otp-box {
        width: 32px;
        height: 40px;
    }

    .sl-otp-boxes {
        gap: 4px;
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .sl-email-verify-overlay--standalone .sl-email-verify-popup {
        padding-right: 16px;
        padding-left: 16px;
        border-radius: 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sl-otp-box,
    .sl-otp-boxes,
    .sl-otp-orbit,
    .sl-otp-slot,
    .sl-otp-shape,
    .sl-otp-mark,
    .sl-otp-svg {
        animation: none !important;
        transition: none !important;
    }

    .sl-email-verify-overlay--standalone,
    .sl-email-verify-overlay--standalone .sl-email-verify-popup {
        transition: none;
    }
}
