:root {
    /* Brand palette */
    --brand-purple: #8B5CF6;
    --brand-pink: #EC4899;
    --brand-blue: #3B82F6;
    --brand-cyan: #22D3EE;
    --brand-navy: #0F172A;
    --brand-surface: #1E293B;

    --bg-primary: #0F172A;
    --bg-card: #1E293B;
    --bg-elevated: #243044;
    --bg-hover: #2d3a4f;
    --accent: var(--brand-purple);
    --accent-secondary: var(--brand-pink);
    --accent-blue: var(--brand-blue);
    --accent-cyan: var(--brand-cyan);
    --accent-gradient: linear-gradient(135deg, #8B5CF6 0%, #EC4899 35%, #3B82F6 70%, #22D3EE 100%);
    --accent-gradient-soft: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(236, 72, 153, 0.1) 50%, rgba(59, 130, 246, 0.15) 100%);
    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --border: rgba(148, 163, 184, 0.15);
    --border-glow: rgba(139, 92, 246, 0.35);
    --success: #22c55e;
    --danger: #ef4444;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --header-height: 64px;
    --bottom-nav-height: 64px;
    --footer-padding: 2rem;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    background-image:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 100% 0%, rgba(59, 130, 246, 0.08), transparent);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-secondary);
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: var(--header-height);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.25rem;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.15rem;
    text-decoration: none;
}

.logo:hover {
    color: var(--text-primary);
    opacity: 0.92;
}

.logo-image {
    height: 40px;
    width: 40px;
    display: block;
}

.logo-image-sm {
    height: 32px;
    width: 32px;
}

.logo-icon {
    display: none;
}

.header-nav {
    display: flex;
    gap: 1.5rem;
    flex: 1;
}

.header-nav a {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.header-nav a:hover {
    color: var(--text-primary);
}

.header-premium-link,
.header-premium-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-gradient);
    color: white !important;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 22px rgba(139, 92, 246, 0.28);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.header-premium-link:hover,
.header-premium-chip:hover {
    color: white !important;
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(139, 92, 246, 0.34);
}

.header-premium-link {
    padding: 0.45rem 0.95rem;
    font-size: 0.8rem;
    letter-spacing: 0.01em;
}

.header-premium-chip {
    margin-left: -0.75rem;
    padding: 0.38rem 0.8rem;
    font-size: 0.74rem;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.user-greeting {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Main */
.site-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem calc(var(--bottom-nav-height) + 2rem);
    min-height: calc(100vh - var(--header-height));
}

body.no-nav .site-main {
    padding-bottom: 2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    opacity: 0.9;
    color: white;
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--text-dim);
}

.btn-google {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    background: #fff;
    color: #3c4043;
    border: 1px solid var(--border);
    font-weight: 600;
}

.btn-google:hover {
    background: #f8f9fa;
    color: #202124;
    border-color: var(--text-dim);
}

.btn-google-icon {
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--text-dim);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
}

.inline-form {
    display: inline;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    height: var(--bottom-nav-height);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 0.5rem;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    color: var(--text-dim);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: var(--brand-purple);
}

.bottom-nav-item .nav-icon {
    font-size: 1.25rem;
}

/* Footer */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 2.5rem 1.25rem 1rem;
    margin-bottom: var(--bottom-nav-height);
}

body.no-nav .site-footer {
    margin-bottom: 0;
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.footer-tagline {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.footer-col h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dim);
    margin: 0 0 0.75rem;
}

.footer-col a {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

.footer-col a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    max-width: 1280px;
    margin: 2rem auto 0;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-bottom p {
    color: var(--text-dim);
    font-size: 0.8rem;
    margin: 0;
}

/* Age Gate */
.age-gate {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.age-gate.hidden {
    display: none;
}

.age-gate-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.age-gate-modal {
    position: relative;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 60px rgba(139, 92, 246, 0.2);
}

.age-gate-logo {
    display: block;
    margin: 0 auto 1rem;
    height: auto;
    max-width: 140px;
}

.age-gate-badge {
    display: inline-block;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.35rem 1rem;
    border-radius: 999px;
    margin-bottom: 1.25rem;
}

.age-gate-modal h2 {
    margin: 0 0 0.75rem;
    font-size: 1.5rem;
}

.age-gate-modal p {
    color: var(--text-muted);
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
}

.age-gate-sub {
    margin-bottom: 1.5rem !important;
}

.age-gate-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Hero */
.hero {
    text-align: center;
    padding: 2rem 0 2.5rem;
}

.hero-logo {
    display: block;
    margin: 0 auto 1rem;
    max-width: min(200px, 70vw);
    height: auto;
}

.hero-tagline {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 600;
    margin: 0 0 0.75rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-positioning {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 640px;
    margin: 0 auto 1.5rem;
    line-height: 1.65;
}

.hero-pillars {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    max-width: 720px;
    margin: 0 auto;
}

.feature-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    background: var(--accent-gradient-soft);
    border: 1px solid var(--border-glow);
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

.feature-pill-icon {
    font-size: 0.95rem;
}

.hero h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0 0 0.75rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.05rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Filters */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    align-items: center;
}

.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--accent);
}

.tag-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}

.tag-chip {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.tag-chip:hover,
.tag-chip.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
}

/* Character Grid */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.character-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.25s;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
}

.character-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(139, 92, 246, 0.12);
    color: inherit;
}

.character-card-avatar {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: var(--text-dim);
}

.character-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.character-card-body {
    padding: 1rem;
}

.character-card-name {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.character-card-age {
    color: var(--text-dim);
    font-weight: 400;
}

.character-card-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.5;
    margin: 0.5rem 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.character-card-stats {
    display: flex;
    gap: 1rem;
    color: var(--text-dim);
    font-size: 0.75rem;
    margin-top: 0.75rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h2 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
}

.empty-state p {
    color: var(--text-muted);
    margin: 0 0 1.5rem;
}

/* Page sections */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header-logo {
    display: block;
    margin: 0 auto 0.75rem;
    max-width: 180px;
    height: auto;
}

.page-header h1 {
    font-size: 1.75rem;
    margin: 0 0 0.5rem;
}

.page-header p {
    color: var(--text-muted);
    margin: 0;
}

/* Legal */
.legal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 800px;
}

.legal-content h2 {
    font-size: 1.15rem;
    margin: 2rem 0 0.75rem;
    color: var(--text-primary);
}

.legal-content h2:first-child {
    margin-top: 0;
}

.legal-content p,
.legal-content li {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.legal-content ul {
    padding-left: 1.25rem;
}

.legal-meta {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Forms */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 420px;
    margin: 2rem auto;
}

.form-card-logo {
    display: block;
    margin: 0 auto 1rem;
    max-width: 160px;
    height: auto;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.4rem;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-error {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.text-danger {
    color: var(--danger);
    font-size: 0.85rem;
}

/* Wizard */
.wizard-steps {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    overflow-x: auto;
}

.wizard-step {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-dim);
}

.wizard-step.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(139, 92, 246, 0.08);
}

.wizard-step.done {
    border-color: var(--success);
    color: var(--success);
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.option-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
}

.option-card:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-1px);
}

.option-card.selected {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent);
}

.option-card.selected:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
}

.generation-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
    padding: 2rem 1rem;
}

.generation-card {
    width: min(100%, 420px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}

.generation-card h2 {
    margin: 1.25rem 0 0.75rem;
    font-size: 1.35rem;
}

.generation-status {
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.generation-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 1.5rem;
}

.generation-spinner {
    width: 72px;
    height: 72px;
    margin: 0 auto;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #8B5CF6, #EC4899, #3B82F6, #22D3EE, #8B5CF6);
    animation: generation-spin 1.1s linear infinite;
    position: relative;
}

.generation-spinner::after {
    content: "";
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    background: var(--bg-card);
}

.generation-spinner-sm {
    width: 48px;
    height: 48px;
}

.generation-spinner-sm::after {
    inset: 6px;
}

.generation-retry.hidden {
    display: none;
}

@keyframes generation-spin {
    to {
        transform: rotate(360deg);
    }
}

/* FAQ */
.faq-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1.25rem;
    margin-bottom: 0.75rem;
}

.faq-item h3 {
    font-size: 0.95rem;
    margin: 0 0 0.5rem;
}

.faq-item p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
}

/* Contact */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.contact-info {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.contact-info h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
}

.contact-info p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0 0 0.5rem;
}

/* Utility */
.desktop-only {
    display: none;
}

.mobile-only {
    display: flex;
}

.mobile-only-inline {
    display: inline-flex;
}

@media (min-width: 768px) {
    .desktop-only {
        display: flex;
    }

    .mobile-only {
        display: none !important;
    }

    .mobile-only-inline {
        display: none !important;
    }

    .site-main {
        padding-bottom: 2rem;
    }

    .site-footer {
        margin-bottom: 0;
    }

    .footer-inner {
        grid-template-columns: 1fr 3fr;
    }

    .contact-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 767px) {
    .header-inner {
        gap: 0.75rem;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }

    .footer-links {
        grid-template-columns: repeat(2, 1fr);
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .header-actions .user-greeting {
        display: none;
    }

    .header-actions {
        gap: 0.5rem;
    }

    .header-actions .btn,
    .header-actions .btn-ghost {
        padding: 0.45rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* Chat */
body.no-nav .site-main {
    max-width: none;
    padding: 0;
    min-height: calc(100vh - var(--header-height));
}

body.no-nav .site-footer {
    display: none;
}

.no-scrollbar {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.chat-layout {
    display: flex;
    height: calc(100vh - var(--header-height));
    max-width: 1280px;
    margin: 0 auto;
    background: var(--bg-primary);
}

.site-main:has(.chat-layout) {
    max-width: none;
    padding: 0;
}

.chat-layout-index {
    height: auto;
    min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height) - 3rem);
}

@media (min-width: 768px) {
    .chat-layout-index {
        height: calc(100vh - var(--header-height));
        min-height: 0;
    }
}

.chat-sidebar {
    width: 300px;
    flex-shrink: 0;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg-card);
    overflow: hidden;
}

.chat-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-sidebar-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.chat-sidebar-explore {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}

.chat-sidebar-explore:hover {
    color: white;
    opacity: 0.9;
}

.chat-sidebar-list {
    flex: 1;
    overflow-y: auto;
}

.chat-sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.chat-sidebar-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chat-sidebar-item.active {
    background: var(--bg-elevated);
    box-shadow: inset 3px 0 0 var(--brand-purple);
}

.chat-sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.chat-sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-sidebar-info {
    flex: 1;
    min-width: 0;
}

.chat-sidebar-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.chat-sidebar-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-sidebar-time {
    font-size: 0.7rem;
    color: var(--text-dim);
    flex-shrink: 0;
}

.chat-sidebar-preview {
    display: block;
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.chat-panel-empty {
    align-items: center;
    justify-content: center;
}

.chat-empty-panel {
    text-align: center;
    padding: 2rem;
    max-width: 360px;
}

.chat-empty-panel-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.chat-empty-panel h2 {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
}

.chat-empty-panel p {
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
}

.chat-list-mobile {
    flex: 1;
    min-width: 0;
    padding: 0 1.25rem 1.5rem;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
    background: var(--bg-primary);
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

.chat-back {
    color: var(--text-muted);
    font-size: 1.25rem;
    padding: 0.25rem 0.5rem;
    text-decoration: none;
    line-height: 1;
}

.chat-back:hover {
    color: var(--text-primary);
}

.chat-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--border-glow);
}

.chat-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-header-info h1 {
    font-size: 1rem;
    margin: 0;
    font-weight: 600;
}

.chat-header-status {
    font-size: 0.75rem;
    color: var(--success);
}

.chat-hearts-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: var(--accent-gradient-soft);
    border: 1px solid var(--border-glow);
    color: var(--brand-pink);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    cursor: pointer;
}

.chat-hearts-badge:hover {
    color: var(--brand-pink);
    border-color: rgba(236, 72, 153, 0.45);
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.14);
    transform: translateY(-1px);
}

.chat-hearts-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    overscroll-behavior: contain;
}

.chat-bubble {
    max-width: min(75%, 520px);
    padding: 0.65rem 0.9rem 0.45rem;
    border-radius: 18px;
    font-size: 0.9rem;
    line-height: 1.55;
    word-break: break-word;
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--accent-gradient);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.25);
}

.chat-bubble.assistant {
    align-self: flex-start;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
}

.chat-bubble-content {
    white-space: pre-wrap;
}

.chat-bubble-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.15rem;
    margin-top: 0.3rem;
}

.chat-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    opacity: 0.72;
    cursor: pointer;
    transition: background 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

.chat-bubble.assistant .chat-action-btn {
    color: var(--text-muted);
}

.chat-action-btn:hover:not(:disabled),
.chat-action-btn.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.chat-bubble.assistant .chat-action-btn:hover:not(:disabled),
.chat-bubble.assistant .chat-action-btn.active {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.chat-action-btn.active {
    color: #ff6b8a;
}

.chat-action-btn:disabled {
    cursor: default;
    opacity: 0.45;
}

.chat-action-icon {
    width: 15px;
    height: 15px;
    fill: currentColor;
    display: block;
    pointer-events: none;
}

.chat-error {
    padding: 0.5rem 1rem;
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    flex-shrink: 0;
}

.chat-error.hidden {
    display: none;
}

.chat-paywall-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-glow);
    border-bottom: 1px solid var(--border-glow);
    background: var(--accent-gradient-soft);
}

.chat-paywall-banner strong {
    display: block;
    margin-bottom: 0.2rem;
}

.chat-paywall-banner p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.chat-input-bar {
    display: flex;
    gap: 0.65rem;
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
    align-items: flex-end;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.7rem 1rem;
    border-radius: 22px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    transition: border-color 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: var(--accent);
}

.chat-send {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.otp-input {
    font-size: 1.5rem;
    letter-spacing: 0.4em;
    text-align: center;
    font-weight: 600;
}

/* Premium / Paywall */
.paywall-shell {
    display: flex;
    justify-content: center;
    padding: 2rem 0 3rem;
}

.paywall-card {
    width: min(100%, 760px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 12px 40px rgba(139, 92, 246, 0.12);
}

.paywall-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.paywall-header h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.1;
    font-weight: 700;
}

.paywall-header p {
    margin: 0;
    color: var(--text-muted);
}

.paywall-accent.premium {
    background: linear-gradient(135deg, var(--brand-purple) 0%, var(--brand-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.paywall-accent.deluxe {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.paywall-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.45rem;
    width: fit-content;
    margin: 0 auto 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.paywall-toggle-option {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 0.7rem 1.25rem;
    border-radius: 999px;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.paywall-toggle-option:hover {
    color: var(--text-primary);
}

.paywall-toggle-option.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.35);
}

.paywall-toggle-chip {
    color: var(--brand-cyan);
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 999px;
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
}

.paywall-plans {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.paywall-plan {
    position: relative;
    display: block;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    color: inherit;
    transition: all 0.25s;
}

.paywall-plan:hover {
    color: inherit;
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(139, 92, 246, 0.1);
}

.paywall-plan.active.premium {
    border-color: var(--brand-pink);
    box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.35), 0 8px 24px rgba(139, 92, 246, 0.15);
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.12) 0%, rgba(236, 72, 153, 0.06) 100%), var(--bg-elevated);
}

.paywall-plan.active.deluxe {
    border-color: var(--brand-cyan);
    box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.35), 0 8px 24px rgba(59, 130, 246, 0.15);
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.12) 0%, rgba(34, 211, 238, 0.06) 100%), var(--bg-elevated);
}

.paywall-plan-name {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
}

.paywall-plan.premium .paywall-plan-name,
.paywall-plan.active.premium .paywall-plan-name {
    color: var(--brand-pink);
}

.paywall-plan.deluxe .paywall-plan-name,
.paywall-plan.active.deluxe .paywall-plan-name {
    color: var(--brand-cyan);
}

.paywall-best-value {
    position: absolute;
    top: -0.75rem;
    right: 0.9rem;
    background: var(--accent-gradient);
    color: white;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.35);
}

.paywall-price-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.paywall-price {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
}

.paywall-period,
.paywall-old-price,
.paywall-billing-line,
.paywall-note,
.paywall-free-note {
    color: var(--text-muted);
}

.paywall-old-price {
    margin-top: 0.35rem;
    text-decoration: line-through;
    color: var(--text-dim);
}

.paywall-billing-line,
.paywall-note,
.paywall-free-note {
    text-align: center;
}

.paywall-billing-line {
    margin: 0.75rem 0 1.5rem;
}

.paywall-cta {
    width: 100%;
    margin-bottom: 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    padding: 1rem 1.5rem;
    border: none;
}

.paywall-cta.premium {
    background: var(--accent-gradient);
    color: white;
}

.paywall-cta.premium:hover {
    color: white;
    opacity: 0.92;
}

.paywall-cta.deluxe {
    background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-cyan) 100%);
    color: white;
}

.paywall-cta.deluxe:hover {
    color: white;
    opacity: 0.92;
}

.paywall-note {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
}

.paywall-free-note {
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
}

.paywall-features,
.paywall-feature-list,
.checkout-summary,
.checkout-unavailable {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.paywall-features {
    margin-bottom: 1rem;
}

.premium-highlight {
    border-color: rgba(139, 92, 246, 0.35);
    background: var(--accent-gradient-soft);
}

.deluxe-highlight {
    border-color: rgba(59, 130, 246, 0.35);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12) 0%, rgba(34, 211, 238, 0.08) 100%);
}

.paywall-highlight-item,
.paywall-feature-item {
    font-weight: 600;
    color: var(--text-primary);
}

.paywall-highlight-item + .paywall-highlight-item,
.paywall-feature-item + .paywall-feature-item {
    margin-top: 0.85rem;
}

.paywall-feature-item::before {
    content: "✓ ";
    color: var(--brand-purple);
}

.checkout-card {
    max-width: 640px;
}

.checkout-summary {
    margin-bottom: 1rem;
}

.checkout-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--text-muted);
}

.checkout-row strong {
    color: var(--text-primary);
}

.checkout-row + .checkout-row {
    margin-top: 0.85rem;
}

.checkout-unavailable {
    margin-bottom: 1rem;
    border-color: rgba(139, 92, 246, 0.25);
    background: var(--accent-gradient-soft);
}

.checkout-unavailable h2 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.checkout-unavailable p {
    margin: 0;
    color: var(--text-muted);
}

.checkout-unavailable p + p {
    margin-top: 0.65rem;
}

.checkout-actions {
    display: flex;
    gap: 0.85rem;
}

@media (max-width: 767px) {
    .chat-paywall-banner,
    .checkout-actions {
        flex-direction: column;
    }

    .paywall-card {
        padding: 1.25rem;
        border-radius: var(--radius);
    }

    .paywall-plans {
        grid-template-columns: 1fr;
    }

    .paywall-toggle {
        width: 100%;
        justify-content: stretch;
    }

    .paywall-toggle-option {
        flex: 1;
    }
}

