:root {
    --bg-0: #05060d;
    --bg-1: #0b0e1f;
    --bg-2: #120d28;
    --surface: rgba(255, 255, 255, 0.045);
    --surface-strong: rgba(255, 255, 255, 0.07);
    --border: rgba(255, 255, 255, 0.09);
    --border-soft: rgba(255, 255, 255, 0.06);
    --text: #f2f3fa;
    --text-muted: #9297b5;
    --text-dim: #5c6187;
    --accent-blue: #5b8cff;
    --accent-violet: #a06bff;
    --accent-green: #3ee6a3;
    --accent-red: #ff7a7a;
    --accent-gradient: linear-gradient(120deg, var(--accent-blue), var(--accent-violet));

    /* Bewusst keine Web-Fonts: jeder externe Host waere eine Stelle, an der
       fremder Code in eine Seite gelangen koennte, auf der Passwoerter
       eingegeben werden. Deshalb System-Schriften und CSP 'self'. */
    --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font-ui);
    position: relative;
    overflow-x: hidden;
}

/* Grossflaechiger Verlaufshintergrund plus weiche Glow-Flecken fuer die
   Tiefenwirkung. Fixed, damit er beim Scrollen ruhig bleibt. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(1100px 700px at 15% -10%, rgba(91, 140, 255, 0.18), transparent 60%),
        radial-gradient(900px 600px at 90% 0%, rgba(160, 107, 255, 0.16), transparent 60%),
        linear-gradient(160deg, var(--bg-1) 0%, var(--bg-0) 45%, var(--bg-2) 100%);
}

.wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 56px 24px 72px;
}

/* ---------- Kopfbereich ---------- */

.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 18px;
}

.hero-logo-link {
    display: inline-flex;
    line-height: 0;
}

.hero-logo {
    height: 48px;
    width: auto;
}

.hero h1 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.hero h1 .accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.version-badge {
    align-self: flex-start;
    margin-top: 6px;
    padding: 3px 9px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-dim);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.hero p {
    margin: 6px 0;
    color: var(--text-muted);
    font-size: 1.02rem;
}

.hero-claim {
    color: var(--accent-green) !important;
}

/* ---------- Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 32px;
    backdrop-filter: blur(12px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.noscript-card {
    margin-bottom: 28px;
    color: var(--accent-red);
    text-align: center;
}

/* ---------- Modus-Umschalter ---------- */

.mode-switch {
    display: flex;
    gap: 6px;
    padding: 6px;
    margin-bottom: 28px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-soft);
    border-radius: 14px;
}

.mode-btn {
    flex: 1;
    padding: 11px 16px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease;
}

.mode-btn:hover {
    color: var(--text);
}

.mode-btn.is-active {
    background: var(--accent-gradient);
    color: #fff;
    box-shadow: 0 6px 18px rgba(91, 140, 255, 0.28);
}

/* ---------- Felder ---------- */

.field-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.io-field {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 0.92rem;
    line-height: 1.55;
    resize: vertical;
}

.io-field::placeholder {
    color: var(--text-dim);
}

.io-field:focus {
    outline: none;
    border-color: rgba(91, 140, 255, 0.6);
    box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.14);
}

textarea.io-field {
    margin-bottom: 22px;
    /* Base64 waechst um rund ein Drittel gegenueber dem Klartext - ohne feste
       Obergrenze wuerde ein grosses Ergebnis die Seite sprengen. */
    max-height: 40vh;
    overflow-y: auto;
}

.result-field {
    margin-bottom: 0;
    color: var(--accent-green);
}

.password-row {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
}

.password-row .io-field {
    flex: 1;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-strong);
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.icon-btn:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.18);
}

.icon-btn svg {
    width: 20px;
    height: 20px;
}

/* Die [hidden]-Regel der Browser gilt nur fuer HTML-Elemente, nicht fuer SVG -
   ohne diese Zeile liegen beide Augen-Icons uebereinander. */
.icon-btn svg[hidden] {
    display: none;
}

/* ---------- Buttons ---------- */

.actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.primary-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    border: 0;
    border-radius: 14px;
    background: var(--accent-gradient);
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(91, 140, 255, 0.3);
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.primary-btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.primary-btn:disabled {
    opacity: 0.65;
    cursor: default;
}

.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.primary-btn.is-busy .btn-spinner {
    display: inline-block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.ghost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-strong);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.ghost-btn:hover {
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.18);
}

.ghost-btn.small {
    padding: 8px 14px;
    font-size: 0.85rem;
}

.ghost-btn svg {
    width: 16px;
    height: 16px;
}

.ghost-btn.is-copied {
    color: var(--accent-green);
    border-color: rgba(62, 230, 163, 0.4);
}

/* ---------- Ergebnis & Fehler ---------- */

.error-box {
    margin: 0 0 20px;
    padding: 13px 16px;
    border: 1px solid rgba(255, 122, 122, 0.35);
    border-radius: 12px;
    background: rgba(255, 122, 122, 0.09);
    color: var(--accent-red);
    font-size: 0.92rem;
}

.result {
    margin-top: 28px;
    padding-top: 26px;
    border-top: 1px solid var(--border-soft);
}

.result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.result-head .field-label {
    margin-bottom: 0;
}

/* ---------- Hinweis-Card & Footer ---------- */

.note-card {
    margin-top: 28px;
    padding: 26px 30px;
}

.note-card h2 {
    margin: 0 0 12px;
    font-size: 1.05rem;
    font-weight: 600;
}

.note-card p {
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.65;
}

.note-warn {
    color: var(--text) !important;
    font-weight: 500;
}

footer {
    margin-top: 34px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .wrap {
        padding: 36px 16px 56px;
    }

    .card {
        padding: 22px 18px;
        border-radius: 18px;
    }

    .hero h1 {
        font-size: 1.9rem;
    }

    .hero-logo {
        height: 38px;
    }

    .hero-title-row {
        gap: 10px;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .note-card {
        padding: 22px 18px;
    }
}
