*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #0a0e17;
    --bg-darker: #060912;
    --surface: #121827;
    --surface-hover: #1a2240;
    --surface-active: #1e2a4a;
    --border: #1e2d4a;
    --border-light: #2a3d6a;
    --text: #e2e8f0;
    --text-muted: #8892b0;
    --text-dim: #4a5578;
    --accent: #6c63ff;
    --accent-glow: rgba(108, 99, 255, 0.3);
    --accent-light: #8b83ff;
    --green: #4ade80;
    --green-glow: rgba(74, 222, 128, 0.2);
    --red: #f87171;
    --orange: #fbbf24;
    --purple: #a78bfa;
    --cyan: #67e8f9;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ── Animated background ─────────────────────────────── */

body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 20% 50%, rgba(108, 99, 255, 0.04) 0%, transparent 50%),
                radial-gradient(ellipse at 80% 20%, rgba(79, 70, 229, 0.03) 0%, transparent 50%),
                radial-gradient(ellipse at 50% 80%, rgba(168, 85, 247, 0.02) 0%, transparent 50%);
    z-index: -1;
    animation: bgShift 30s ease-in-out infinite;
}

@keyframes bgShift {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-2%, 2%); }
    50% { transform: translate(2%, -1%); }
    75% { transform: translate(-1%, -2%); }
}

/* ── Navigation ──────────────────────────────────────── */

.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
    text-decoration: none;
}

.nav-logo span {
    color: var(--accent);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text);
    background: var(--surface-hover);
}

.nav-link.active {
    color: var(--accent-light);
    background: rgba(108, 99, 255, 0.1);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

.nav-avatar img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* ── Containers ──────────────────────────────────────── */

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.container-narrow {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* ── Hero ────────────────────────────────────────────── */

.hero {
    text-align: center;
    padding: 5rem 0 3rem;
    position: relative;
}

.hero::after {
    content: '';
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(108, 99, 255, 0.08) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

.hero-logo {
    display: inline-block;
    margin-bottom: 1.5rem;
}

.hero-logo svg {
    width: 80px;
    height: 80px;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent-light) 50%, var(--purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero .subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
    max-width: 500px;
    margin: 1rem auto 2.5rem;
}

.install-command {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1.5rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--green);
    transition: var(--transition);
}

.install-command:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.copy-btn {
    background: var(--surface-hover);
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.35rem 0.6rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.copy-btn:hover {
    border-color: var(--accent);
    color: var(--accent-light);
}

/* ── Features ────────────────────────────────────────── */

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 4rem 0;
}

.feature-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0;
    transition: var(--transition);
}

.feature-card:hover {
    border-color: var(--border-light);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ── Auth Section ────────────────────────────────────── */

.auth-section {
    text-align: center;
    padding: 3rem 0;
}

.auth-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.auth-section > p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.auth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    min-width: 280px;
}

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

.btn:active {
    transform: translateY(0);
}

.btn-google {
    background: #fff;
    color: #1a1a2e;
}

.btn-google:hover {
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

.btn-github {
    background: #1a1a2e;
    color: #fff;
    border: 1px solid #333;
}

.btn-github:hover {
    border-color: #666;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-email {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-email:hover {
    border-color: var(--text-muted);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent), #5b21b6);
    color: #fff;
}

.btn-primary:hover {
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-danger {
    background: linear-gradient(135deg, var(--red), #dc2626);
    color: #fff;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    min-width: auto;
}

/* ── Auth Page ───────────────────────────────────────── */

.auth-page {
    display: flex;
    justify-content: center;
    padding: 3rem 0;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}

.auth-card h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.auth-card .auth-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.social-auth {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-top: 1px solid var(--border);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-error {
    color: var(--red);
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

.form-success {
    color: var(--green);
    font-size: 0.85rem;
    margin-top: 0.4rem;
}

.switch-auth {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.switch-auth a {
    color: var(--accent-light);
    text-decoration: none;
    font-weight: 500;
}

.switch-auth a:hover {
    text-decoration: underline;
}

/* ── Messages ────────────────────────────────────────── */

.error-message {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    color: var(--red);
    font-size: 0.9rem;
    margin-top: 1rem;
    animation: slideIn 0.3s ease;
}

.success-message {
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    animation: slideIn 0.3s ease;
}

.success-message h2 {
    font-size: 1.5rem;
    color: var(--green);
    margin-bottom: 0.5rem;
}

.success-message p {
    color: var(--text-muted);
}

.token-display {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-darker);
    border-radius: var(--radius-sm);
    position: relative;
}

.token-display p {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.token-display code {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--green);
    word-break: break-all;
    padding: 0.75rem;
    background: rgba(0,0,0,0.3);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading {
    color: var(--text-muted);
    text-align: center;
    padding: 3rem;
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ── Dashboard ───────────────────────────────────────── */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.dashboard-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.user-greeting {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: var(--transition);
}

.stat-card:hover {
    border-color: var(--border-light);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
}

.stat-value.accent { color: var(--accent-light); }
.stat-value.green { color: var(--green); }
.stat-value.purple { color: var(--purple); }
.stat-value.cyan { color: var(--cyan); }

.dashboard-section {
    margin-bottom: 2rem;
}

.dashboard-section h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.model-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.model-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.model-item:hover {
    border-color: var(--border-light);
}

.model-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
}

.model-status {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 100px;
    background: rgba(74, 222, 128, 0.15);
    color: var(--green);
}

/* ── Profile Page ────────────────────────────────────── */

.profile-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2.5rem;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-info h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.profile-info p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.profile-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.profile-section h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.profile-row:last-child {
    border-bottom: none;
}

.profile-row-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-row-value {
    font-weight: 500;
    font-size: 0.95rem;
}

/* ── Models Page ─────────────────────────────────────── */

.models-header {
    margin-bottom: 2rem;
}

.models-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.models-header p {
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.models-list {
    display: grid;
    gap: 0.75rem;
}

/* ── Footer ──────────────────────────────────────────── */

footer {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-dim);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
}

footer a:hover {
    color: var(--accent-light);
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    .features {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .model-grid {
        grid-template-columns: 1fr;
    }
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    .dashboard-header {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    .nav-links .nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}
