:root {
    --bg: #070b14;
    --bg-elevated: #0f1629;
    --text: #e8eefc;
    --muted: #93a4c7;
    --accent: #5b8cff;
    --accent-2: #7c5cff;
    --success: #3ecf8e;
    --error: #ff6b7a;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
    --radius: 18px;
    --input-bg: #0b1220;
    /* Darker than --accent so white button text meets WCAG AA (>=4.5:1). */
    --btn-from: #3f6fe0;
    --btn-to: #6a45f0;
    --focus-ring: #9ec1ff;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
.btn:focus-visible,
.lang-switcher-trigger:focus-visible,
.lang-switcher-option:focus-visible,
.wm-nav-item:focus-visible,
.wm-icon-btn:focus-visible,
.wm-back:focus-visible,
.copy-btn:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}
body {
    font-family: "DM Sans", system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 10%, rgba(91, 140, 255, 0.18), transparent 35%),
        radial-gradient(circle at 80% 0%, rgba(124, 92, 255, 0.14), transparent 30%);
    z-index: -1;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    padding: 1.25rem 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: var(--shadow);
}

.nav { display: flex; gap: 1rem; align-items: center; }
.nav a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
}
.nav a.active, .nav a:hover { color: var(--text); }

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.5rem 4rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .85rem 1.25rem;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(135deg, var(--btn-from), var(--btn-to));
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(63, 111, 224, 0.28);
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn-sm { padding: .55rem 1rem; font-size: .95rem; }
.btn-ghost {
    background: transparent;
    border: 1px solid var(--border);
    box-shadow: none;
    color: var(--text);
}
.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
    filter: none;
}
.btn-block { width: 100%; }
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}
.btn.is-loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1.05em;
    height: 1.05em;
    margin: -.525em 0 0 -.525em;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: yho-spin .6s linear infinite;
}
@keyframes yho-spin { to { transform: rotate(360deg); } }

.hero {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 2rem;
    align-items: center;
    padding: 2rem 0 3rem;
}
.hero h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.08;
    margin: .5rem 0 1rem;
}
.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .12em;
    font-size: .78rem;
    font-weight: 700;
}
.lead { color: var(--muted); font-size: 1.08rem; max-width: 52ch; }
.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }

.hero-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: grid;
    gap: 1rem;
    box-shadow: var(--shadow);
}
.stat {
    display: flex;
    flex-direction: column;
    padding: .85rem 1rem;
    border-radius: 14px;
    background: var(--bg-elevated);
}
.stat span { font-size: 1.35rem; font-weight: 700; }
.stat small { color: var(--muted); }

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.feature {
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.feature:hover {
    border-color: rgba(91, 140, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}
.feature h3 { margin-top: 0; }

.setup-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    background: rgba(255,255,255,0.02);
}
.setup-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}
.setup-grid code, .setup-grid a {
    display: block;
    margin-top: .4rem;
    color: var(--accent);
    word-break: break-all;
}
.setup-grid code {
    font-family: ui-monospace, 'Cascadia Code', monospace;
    font-size: .85rem;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: .45rem .6rem;
    color: #b8ccff;
}
.setup-grid div > strong {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}
.setup-box h2 { font-size: 1.4rem; margin-top: 0; }

.auth-card {
    max-width: 480px;
    margin: 2rem auto;
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(15, 22, 41, 0.85);
    box-shadow: var(--shadow);
}
.auth-card h1 { margin-top: 0; }
.muted { color: var(--muted); }

.form { display: grid; gap: 1rem; margin-top: 1.25rem; }
.form label { display: grid; gap: .45rem; font-weight: 500; }
.form input {
    width: 100%;
    padding: .85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
    font: inherit;
}
.form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.18);
}
.form input:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}
input::placeholder,
textarea::placeholder {
    color: #7e8aa8;
    opacity: 1;
}
.input-group {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .5rem;
    align-items: center;
}
.suffix {
    color: var(--muted);
    padding: .85rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    white-space: nowrap;
}
.hp-field {
    position: absolute;
    left: -9999px;
    opacity: 0;
    height: 0;
    width: 0;
}

.alert {
    padding: .85rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}
.alert-error {
    background: rgba(255, 107, 122, 0.12);
    border: 1px solid rgba(255, 107, 122, 0.35);
    color: #ffb3bc;
}
.alert-success {
    background: rgba(62, 207, 142, 0.12);
    border: 1px solid rgba(62, 207, 142, 0.35);
    color: #b7f5d7;
}

.form-footer { text-align: center; color: var(--muted); }
.form-footer a { color: var(--accent); font-weight: 600; text-decoration: none; }
.form-footer a:hover { text-decoration: underline; }

/* Password show/hide toggle (injected by app.js) */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 2.9rem; }
.pw-toggle {
    position: absolute;
    right: .4rem;
    top: 50%;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.05rem;
    line-height: 1;
}
.pw-toggle:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.pw-toggle.is-on { color: var(--accent); }

.footer {
    text-align: center;
    color: var(--muted);
    padding: 2rem 1rem 3rem;
    font-size: .92rem;
}
.footer-links a { color: var(--muted); }

@media (max-width: 900px) {
    .hero, .features, .setup-grid { grid-template-columns: 1fr; }
    .nav { gap: .65rem; }
    .nav a:not(.btn) { font-size: .95rem; }
}

.auth-card-wide { max-width: 540px; }
.success-badge {
    display: inline-block;
    padding: .35rem .75rem;
    border-radius: 999px;
    background: rgba(62, 207, 142, 0.15);
    color: #b7f5d7;
    font-weight: 600;
    font-size: .88rem;
    margin-bottom: .75rem;
}
.password-mode {
    border: 0;
    padding: 0;
    margin: 0;
}
.password-mode legend {
    padding: 0;
    margin-bottom: .5rem;
    font-size: .95rem;
}
.radio-card {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: .85rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255,255,255,0.02);
    cursor: pointer;
    margin-bottom: .5rem;
}
.radio-card:hover { border-color: rgba(91, 140, 255, 0.3); }
.radio-card:has(input:checked) {
    border-color: var(--accent);
    background: rgba(91, 140, 255, 0.08);
}
.radio-card input { margin-top: .2rem; accent-color: var(--accent); width: 18px; height: 18px; }
.radio-card strong { display: block; margin-bottom: .2rem; }
.radio-card small { color: var(--muted); line-height: 1.5; font-size: .85rem; }
.is-hidden { display: none !important; }
.credential-reveal {
    display: grid;
    gap: .75rem;
    margin: 1.25rem 0;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255,255,255,0.03);
}
.credential-row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: .75rem;
    align-items: center;
}
.credential-label { color: var(--muted); font-size: .88rem; }
.credential-value {
    font-family: ui-monospace, monospace;
    word-break: break-all;
    color: var(--accent);
}
.credential-actions {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.tips-list {
    margin: 0;
    padding-left: 1.1rem;
    font-size: .92rem;
}
.tips-list li { margin-bottom: .35rem; }
@media (max-width: 600px) {
    .credential-row { grid-template-columns: 1fr; }
}

/* Language switcher */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.lang-switcher {
    position: relative;
    display: inline-flex;
}

.lang-switcher-trigger {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .45rem .75rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: border-color .15s, background .15s, box-shadow .15s;
}

.lang-switcher-trigger:hover,
.lang-switcher-trigger[aria-expanded="true"] {
    border-color: rgba(91, 140, 255, 0.45);
    background: rgba(91, 140, 255, 0.1);
    box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.1);
}

.lang-switcher-code {
    display: inline-grid;
    place-items: center;
    min-width: 1.85rem;
    padding: .15rem .35rem;
    border-radius: 6px;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    background: linear-gradient(135deg, rgba(91, 140, 255, 0.35), rgba(124, 92, 255, 0.28));
    color: #dce6ff;
}

.lang-switcher-name {
    color: var(--muted);
    max-width: 7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lang-switcher-trigger[aria-expanded="true"] .lang-switcher-name,
.lang-switcher-option.is-active .lang-switcher-name {
    color: var(--text);
}

.lang-switcher-chevron {
    font-size: .65rem;
    color: var(--muted);
    transition: transform .15s;
}

.lang-switcher-trigger[aria-expanded="true"] .lang-switcher-chevron {
    transform: rotate(180deg);
}

.lang-switcher-menu {
    position: absolute;
    top: calc(100% + .35rem);
    right: 0;
    z-index: 50;
    min-width: 11rem;
    max-height: 16rem;
    overflow: auto;
    margin: 0;
    padding: .35rem;
    list-style: none;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #0f1629;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
    scrollbar-width: thin;
    scrollbar-color: rgba(91, 140, 255, 0.45) rgba(255, 255, 255, 0.06);
}

.lang-switcher-menu::-webkit-scrollbar {
    width: 8px;
}

.lang-switcher-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin: 4px 0;
}

.lang-switcher-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(91, 140, 255, 0.55), rgba(124, 92, 255, 0.45));
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.lang-switcher-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(91, 140, 255, 0.75), rgba(124, 92, 255, 0.65));
    background-clip: padding-box;
}

.lang-switcher-option {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .55rem .65rem;
    border-radius: 10px;
    color: var(--muted);
    text-decoration: none;
    font-size: .88rem;
    transition: background .12s, color .12s;
}

.lang-switcher-option:hover {
    background: rgba(91, 140, 255, 0.14);
    color: var(--text);
}
.lang-switcher-option:focus-visible {
    background: rgba(91, 140, 255, 0.14);
    color: var(--text);
    outline-offset: -2px;
}

.lang-switcher-option.is-active {
    background: rgba(91, 140, 255, 0.18);
    color: var(--text);
}

.nav .lang-switcher { margin-left: .25rem; }

@media (max-width: 900px) {
    .lang-switcher-name { display: none; }
    .nav .lang-switcher { margin-left: 0; }
}
