:root {
    --blue: #2f6fed;
    --blue-bright: #4a86ff;
    --blue-dim: #1a3a8f;
    --ruby: #e0264f;
    --ruby-bright: #ff4d6d;
    --gold: #f0b93a;
    --success: #2fd680;

    --radius: 14px;
    --radius-sm: 9px;
    --max-width: 480px;
    --max-width-wide: 760px;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Sora', sans-serif;

    /* Dark theme (default) */
    --bg: #0a0e1a;
    --bg-elevated: #121729;
    --bg-input: #0d1220;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #eef1f8;
    --text-dim: #8b93ab;
    --text-faint: #5b6280;
    --glow-1: rgba(47, 111, 237, 0.16);
    --glow-2: rgba(224, 38, 79, 0.10);
    --card-shadow: 0 20px 60px rgba(47, 111, 237, 0.12);
}

[data-theme="light"] {
    --bg: #f6f7fb;
    --bg-elevated: #ffffff;
    --bg-input: #f0f2f8;
    --border: rgba(20, 25, 50, 0.08);
    --border-strong: rgba(20, 25, 50, 0.14);
    --text: #14172a;
    --text-dim: #5c6480;
    --text-faint: #969cb5;
    --glow-1: rgba(47, 111, 237, 0.08);
    --glow-2: rgba(224, 38, 79, 0.05);
    --card-shadow: 0 16px 40px rgba(47, 111, 237, 0.08);
    --success: #1f9d5c;
    --gold: #b8850a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
    color-scheme: dark;
}
html[data-theme="light"] {
    color-scheme: light;
}

body {
    background:
        radial-gradient(60% 40% at 20% -10%, var(--glow-1), transparent 60%),
        radial-gradient(45% 35% at 100% 0%, var(--glow-2), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    transition: background-color 0.2s ease, color 0.2s ease;
}

a { color: var(--blue-bright); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
}

p { margin: 0; color: var(--text-dim); }

/* Layout shells */

.page {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px 48px;
    width: 100%;
    flex: 1 0 auto;
}

.page-wide { max-width: var(--max-width-wide); }

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    flex-shrink: 0;
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text);
}
.brand:hover { text-decoration: none; }

.brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-strong);
}

.brand em { font-style: normal; color: var(--ruby-bright); }

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--bg-elevated);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s ease, transform 0.1s ease;
}
.theme-toggle:hover { border-color: var(--blue-bright); }
.theme-toggle:active { transform: scale(0.92); }

.site-nav {
    display: flex;
    gap: 14px;
    align-items: center;
    font-size: 0.9rem;
}
.site-nav a { color: var(--text-dim); }
.site-nav a.active { color: var(--text); }

footer.site-footer {
    max-width: var(--max-width);
    margin: 40px auto 0;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-faint);
    font-size: 0.78rem;
    flex-shrink: 0;
    width: 100%;
}

/* Cards */

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

/* Forms */

.field { margin-bottom: 16px; }

.field label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 6px;
}

.field input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 13px 14px;
    border-radius: var(--radius-sm);
    outline: none;
    transition: border-color 0.15s ease;
}
.field input::placeholder { color: var(--text-faint); }
.field input:focus { border-color: var(--blue-bright); }

.field-error {
    color: var(--ruby-bright);
    font-size: 0.8rem;
    margin-top: 6px;
    display: none;
}
.field-error.show { display: block; }

.field-hint { color: var(--text-faint); font-size: 0.78rem; margin-top: 6px; }

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    border: none;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--blue-bright), var(--blue));
    color: #fff;
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn-ruby {
    background: linear-gradient(135deg, var(--ruby-bright), var(--ruby));
    color: #fff;
}
.btn-ruby:hover:not(:disabled) { filter: brightness(1.08); }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text);
}
.btn-ghost:hover:not(:disabled) { border-color: var(--blue-bright); }

.btn-link {
    width: auto;
    background: none;
    color: var(--blue-bright);
    padding: 8px 0;
    font-weight: 500;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Alerts */

.alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: 0.88rem;
    margin-bottom: 16px;
    display: none;
}
.alert.show { display: block; }

.alert-error {
    background: rgba(224, 38, 79, 0.12);
    border: 1px solid rgba(224, 38, 79, 0.3);
    color: var(--ruby-bright);
}
.alert-success {
    background: rgba(47, 214, 128, 0.1);
    border: 1px solid rgba(47, 214, 128, 0.3);
    color: var(--success);
}
.alert a { color: inherit; text-decoration: underline; }

/* Toasts */

#toast-host {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: calc(100% - 32px);
    max-width: 400px;
    align-items: center;
}

.toast {
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    width: 100%;
    text-align: center;
}
.toast-in { opacity: 1; transform: translateY(0); }
.toast-success { border-color: rgba(47, 214, 128, 0.4); }
.toast-error { border-color: rgba(224, 38, 79, 0.4); }

/* OTP code input */

.code-input {
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.6rem;
    letter-spacing: 0.5em;
    padding-left: 22px;
}

/* Pills */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(240, 185, 58, 0.12);
    border: 1px solid rgba(240, 185, 58, 0.3);
    color: var(--gold);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 100px;
}

/* Utility */

.center-text { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* Responsive */

@media (min-width: 640px) {
    :root { --max-width: 520px; }

    .features { grid-template-columns: repeat(2, 1fr) !important; }

    .hero-art { max-width: 440px; margin: 0 auto; }
}

@media (min-width: 960px) {
    :root { --max-width-wide: 900px; }

    .hero {
        display: grid;
        grid-template-columns: 1.1fr 0.9fr;
        gap: 40px;
        align-items: center;
    }
    .hero-art { max-width: none; margin: 0; }

    .features { grid-template-columns: repeat(4, 1fr) !important; }
}
