*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

* { -webkit-tap-highlight-color: transparent; }

.btn, .nav-link { touch-action: manipulation; }

:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface2: #162032;
    --amber: #ff9100;
    --amber-dim: rgba(255, 145, 0, 0.12);
    --white: #ffffff;
    --muted: #64748b;
    --text: #cbd5e1;
    --text-dim: #94a3b8;
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 145, 0, 0.5);
    --input-bg: rgba(15, 23, 42, 0.6);
    --error: #f87171;
    --success: #4ade80;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--white);
    font-family: 'Inter', sans-serif;
    min-height: 100%;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,145,0,0.2); border-radius: 100px; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,145,0,0.2) transparent; }

/* ── BACKGROUND GLOW ── */
.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(ellipse at center, rgba(255,145,0,0.055) 0%, transparent 60%);
    animation: pulse-glow 6s ease-in-out infinite;
}

.bg-glow::after {
    content: '';
    position: absolute;
    top: -80px;
    left: -80px;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,145,0,0.025) 0%, transparent 70%);
}

@keyframes pulse-glow {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.65; transform: translate(-50%, -50%) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
    .bg-glow::before { animation: none; }
}

/* ── HEADER ── */
header {
    position: relative;
    z-index: 10;
    padding: 20px 32px;
    display: flex;
    align-items: center;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-left: calc(32px + env(safe-area-inset-left));
    padding-right: calc(32px + env(safe-area-inset-right));
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    flex-shrink: 0;
}

.logo-wordmark {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--white);
    letter-spacing: -0.02em;
}

.logo-wordmark span { color: var(--amber); }

/* ── MAIN ── */
main {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px 48px;
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
}

/* ── CARD ── */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 20px;
    padding: 40px 36px 32px;
    box-shadow:
    0 0 0 1px rgba(255,145,0,0.04),
    0 24px 64px rgba(0,0,0,0.4),
    0 4px 16px rgba(0,0,0,0.25);
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(255,145,0,0.5) 40%, rgba(255,145,0,0.5) 60%, transparent 100%);
}

/* ── CARD HEADER ── */
.card-header {
    text-align: center;
    margin-bottom: 28px;
}

.card-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-dim);
    font-weight: 300;
    line-height: 1.5;
}

/* ── GOOGLE BUTTON ── */
.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: var(--white);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    letter-spacing: 0.01em;
}

.btn-google:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(255,255,255,0.18);
    transform: translateY(-1px);
}

.btn-google:active { transform: translateY(0); }

.google-logo {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ── DIVIDER ── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.07);
}

.divider-text {
    font-size: 0.75rem;
    color: var(--muted);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-weight: 500;
}

/* ── FORM ── */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    letter-spacing: 0.01em;
}

.input-wrap {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--muted);
    pointer-events: none;
    transition: color 0.2s;
}

.input-icon svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

input[type="email"],
input[type="password"],
input[type="text"] {
    width: 100%;
    padding: 11px 13px 11px 40px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--white);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 400;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="text"]::placeholder {
    color: var(--muted);
    font-weight: 300;
}

input[type="email"]:focus,
input[type="password"]:focus,
input[type="text"]:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(255,145,0,0.1);
    background: rgba(15, 23, 42, 0.8);
}

.input-wrap:focus-within .input-icon { color: var(--amber); }

/* password toggle */
.pw-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 4px;
    transition: color 0.2s;
}

.pw-toggle:hover { color: var(--text); }

.pw-toggle svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

input[type="password"] { padding-right: 40px; }

/* ── PASSWORD STRENGTH ── */
.pw-strength {
    margin-top: 8px;
}

.pw-strength-bar {
    height: 3px;
    border-radius: 100px;
    background: rgba(255,255,255,0.07);
    overflow: hidden;
    margin-bottom: 5px;
}

.pw-strength-fill {
    height: 100%;
    border-radius: 100px;
    width: 0%;
    transition: width 0.3s ease, background-color 0.3s ease;
    background: var(--muted);
}

.pw-strength-fill.weak   { width: 25%; background: var(--error); }
.pw-strength-fill.fair   { width: 50%; background: #fb923c; }
.pw-strength-fill.good   { width: 75%; background: #fbbf24; }
.pw-strength-fill.strong { width: 100%; background: var(--success); }

.pw-strength-label {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 400;
}

.pw-strength-label.weak   { color: var(--error); }
.pw-strength-label.fair   { color: #fb923c; }
.pw-strength-label.good   { color: #fbbf24; }
.pw-strength-label.strong { color: var(--success); }

/* ── FIELD ERROR ── */
.field-error {
    font-size: 0.75rem;
    color: var(--error);
    display: none;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
}

.field-error.visible { display: flex; }

.field-error svg {
    width: 13px;
    height: 13px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    flex-shrink: 0;
}

input.has-error {
    border-color: rgba(248,113,113,0.5);
    box-shadow: 0 0 0 3px rgba(248,113,113,0.08);
}

/* ── SUBMIT ── */
.form-actions {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-primary {
    width: 100%;
    padding: 12px 16px;
    background: var(--amber);
    border: none;
    border-radius: 10px;
    color: #0f172a;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.15s;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background: #ffaa33;
    box-shadow: 0 0 24px rgba(255,145,0,0.35);
    transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(15,23,42,0.3);
    border-top-color: #0f172a;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn-primary.loading .spinner { display: block; }
.btn-primary.loading .btn-label { opacity: 0.6; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── CARD FOOTER ── */
.card-footer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.switch-text {
    font-size: 0.825rem;
    color: var(--muted);
    text-align: center;
}

.switch-text a {
    color: var(--amber);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.switch-text a:hover {
    color: #ffaa33;
    text-decoration: underline;
    text-decoration-color: rgba(255,145,0,0.4);
}

.forgot-link {
    font-size: 0.775rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-link:hover { color: var(--text-dim); }

/* ── TOAST ── */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(248,113,113,0.3);
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 0.825rem;
    color: var(--error);
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 100;
    white-space: nowrap;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast svg {
    width: 15px;
    height: 15px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    flex-shrink: 0;
}

/* ── RESPONSIVE ── */
@media (max-width: 480px) {
    header {
    padding: 16px 20px;
    }

    main {
    padding: 16px 12px 40px;
    align-items: flex-start;
    padding-top: 28px;
    }

    .auth-card {
    padding: 28px 20px 24px;
    border-radius: 16px;
    max-width: 100%;
    }

    .card-title {
    font-size: 1.45rem;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    main {
    padding: 32px 24px 48px;
    }
}