/* ============================================================
   LoveAIMade — Next-Gen AI Studio Design System
   Dark & Light Theme CSS with Glassmorphism & High-End Polish
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

/* Dynamic glowing border property */
@property --border-glow {
    syntax: '<color>';
    inherits: true;
    initial-value: #10b981;
}

/* ============================================================
   THEME VARIABLES & DESIGN TOKENS
   ============================================================ */

:root,
[data-theme="dark"] {
    --bg-page: #090d16;
    --bg-secondary: #0d1322;
    --bg-surface: #131b2e;
    --bg-surface-elevated: #1e293b;
    --bg-glass: rgba(19, 27, 46, 0.75);
    --bg-glass-nav: rgba(13, 19, 34, 0.85);

    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(16, 185, 129, 0.4);
    --border-glow: #10b981;

    --primary-color: #10b981;
    --primary-hover: #34d399;
    --accent-indigo: #6366f1;
    --accent-orange: #f59e0b;
    --accent-emerald: #10b981;

    --gradient-brand: linear-gradient(135deg, #10b981 0%, #6366f1 100%);
    --gradient-brand-short: linear-gradient(90deg, #10b981, #3b82f6, #6366f1);
    --gradient-warm: linear-gradient(135deg, #f59e0b, #10b981);
    --gradient-vivid: linear-gradient(90deg, #10b981, #3b82f6, #8b5cf6, #ec4899, #10b981);

    --chat-user-bg: #1e293b;
    --chat-ai-bg: #0f172a;
    --sidebar-width: 280px;

    --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.25);
}

[data-theme="light"] {
    --bg-page: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f8fafc;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-nav: rgba(255, 255, 255, 0.92);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --border-color: #e2e8f0;
    --border-hover: rgba(5, 150, 105, 0.4);
    --border-glow: #059669;

    --primary-color: #059669;
    --primary-hover: #047857;
    --accent-indigo: #4f46e5;
    --accent-orange: #d97706;
    --accent-emerald: #059669;

    --gradient-brand: linear-gradient(135deg, #059669 0%, #4f46e5 100%);
    --gradient-brand-short: linear-gradient(90deg, #059669, #2563eb, #4f46e5);
    --gradient-warm: linear-gradient(135deg, #d97706, #059669);
    --gradient-vivid: linear-gradient(90deg, #059669, #2563eb, #7c3aed, #db2777, #059669);

    --chat-user-bg: #e2e8f0;
    --chat-ai-bg: #ffffff;

    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 25px 50px -12px rgba(15, 23, 42, 0.12);
    --shadow-glow: 0 0 20px rgba(5, 150, 105, 0.15);
}

/* Base Resets */
* {
    box-sizing: border-box;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
}

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

a:hover {
    color: var(--primary-hover);
}

/* ============================================================
   TOP NAVIGATION BAR
   ============================================================ */

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    height: 64px;
    background: var(--bg-glass-nav);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.nav-brand {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 800;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.nav-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
}

.nav-tab.active {
    color: #ffffff;
    background: var(--gradient-brand);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.nav-icon {
    font-size: 1rem;
}

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

.nav-credit-badge {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 20px;
    background: var(--gradient-brand);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

/* Theme Toggle Button */
.theme-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-surface-elevated);
    transform: scale(1.05);
}

.theme-icon {
    width: 20px;
    height: 20px;
}

/* User Avatar & Dropdown */
.user-menu-wrapper {
    position: relative;
}

.user-menu-trigger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 0.95rem;
    font-family: var(--font-heading);
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.3);
    background: var(--gradient-brand);
    transition: all 0.2s ease;
}

.user-menu-trigger:hover .user-avatar {
    transform: scale(1.06);
    box-shadow: var(--shadow-glow);
}

.user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 260px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 12px;
    box-shadow: var(--shadow-lg);
    z-index: 200;
}

.user-dropdown.open {
    display: block;
    animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.user-dropdown-header {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 8px 8px;
}

.user-dropdown-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.user-dropdown-plan {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-color);
    letter-spacing: 0.05em;
}

.user-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 8px 0;
}

.user-dropdown-balance {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 8px;
}

.balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.82rem;
}

.balance-label {
    color: var(--text-secondary);
}

.balance-value {
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-action-btn {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.dropdown-action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.dropdown-action-btn.upgrade-btn {
    background: var(--gradient-brand);
    color: #ffffff;
    border: none;
}

.dropdown-action-btn.upgrade-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.dropdown-action-btn.logout-btn {
    color: #ef4444;
}

.dropdown-action-btn.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

/* ============================================================
   LANDING / HOME HERO
   ============================================================ */

.home-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6rem 1.5rem 4rem;
    max-width: 900px;
    margin: 0 auto;
}

.home-title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.15;
}

.home-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 650px;
    margin-bottom: 2.5rem;
}

.home-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.25rem;
    width: 100%;
    margin-top: 3rem;
}

.home-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 2rem 1.25rem;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.home-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
}

.home-card-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
}

.home-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;

}

.home-card p {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin: 0;
}

/* Buttons */
.btn-primary {
    background: var(--gradient-brand);
    color: #ffffff;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
    filter: brightness(1.08);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.8rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    background: var(--bg-surface-elevated);
    transform: translateY(-2px);
}

/* ============================================================
   AUTH PAGES (LOGIN & REGISTER)
   ============================================================ */

.auth-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: clamp(1.25rem, 4vw, 4rem);
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 15%, rgba(16, 185, 129, 0.16), transparent 34%),
        radial-gradient(circle at 85% 85%, rgba(99, 102, 241, 0.16), transparent 36%),
        var(--bg-page);
}

.auth-card {
    position: relative;
    background: var(--bg-glass);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: clamp(1.5rem, 4vw, 2.75rem);
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
}

.auth-brand {
    display: block;
    margin: 0 auto 2.25rem;
    padding: 0;
    border: 0;
    background: var(--gradient-brand);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.035em;
    cursor: pointer;
}

.auth-eyebrow {
    margin-bottom: 0.55rem;
    color: var(--primary-color);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-align: center;
    text-transform: uppercase;
}

.auth-title {
    font-size: clamp(1.8rem, 5vw, 2.25rem);
    text-align: center;
    margin-bottom: 0.65rem;
    line-height: 1.18;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin: 0 auto 2rem;
    max-width: 340px;
    font-size: 0.94rem;
}

.auth-error {
    display: none;
    margin-bottom: 1.25rem;
    padding: 0.8rem 1rem;
    border: 1px solid rgba(239, 68, 68, 0.45);
    border-radius: 12px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    font-size: 0.88rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
}

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

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

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-hint {
    display: block;
    margin-top: 0.4rem;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.auth-submit-btn {
    width: 100%;
    padding: 0.9rem;
    margin-top: 0.4rem;
}

.auth-switch {
    margin: 1.35rem 0 0;
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9rem;
}

.auth-switch a {
    font-weight: 700;
}

.auth-provider-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1.5rem 0 0;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.74rem;
    text-align: center;
}

.auth-provider-note span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.13);
}

/* ============================================================
   DASHBOARD & CORE FEATURE LAYOUTS
   ============================================================ */

.page-content {
    flex: 1;
    padding: 2.5rem 3rem;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
}

.gen-container {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem 3rem;
    box-shadow: var(--shadow-md);
    max-width: 1000px;
    margin: 0 auto 3rem auto;
}

.gen-header {
    margin-bottom: 1.75rem;
}

.gen-header h2 {
    font-size: 1.85rem;
    margin-bottom: 0.4rem;
}

.gen-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin: 0;
}

.gen-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.gen-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.gen-input-group label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.gen-input-group textarea,
.gen-input-group input[type="text"] {
    width: 100%;
    padding: 0.85rem 1.1rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    resize: vertical;
    transition: all 0.2s ease;
}

.gen-input-group textarea:focus,
.gen-input-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.gen-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.gen-option {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.gen-option label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.gen-option select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gen-option select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

option.cost-tier-green { color: #16a34a; font-weight: 700; }
option.cost-tier-yellow { color: #ca8a04; font-weight: 700; }
option.cost-tier-red { color: #dc2626; font-weight: 700; }

.model-cost-select.cost-tier-green { border-left: 5px solid #22c55e; }
.model-cost-select.cost-tier-yellow { border-left: 5px solid #eab308; }
.model-cost-select.cost-tier-red { border-left: 5px solid #ef4444; }

.cost-tier-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.65rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.35;
}

.reservation-note {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    border: 1px solid color-mix(in srgb, var(--primary-color) 28%, var(--border-color));
    border-radius: 13px;
    background: color-mix(in srgb, var(--primary-color) 7%, var(--bg-surface-elevated));
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.reservation-note > span:first-child,
.reservation-note strong {
    color: var(--primary-color);
}

.gen-info-box {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.gen-btn {
    width: 100%;
    padding: 0.9rem;
    font-size: 1.05rem;
    font-weight: 700;
    border-radius: 12px;
    margin-top: 0.5rem;
}

.gen-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    margin-top: 2rem;
    font-size: 0.95rem;
}

.gen-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
    padding: 0.85rem 1.25rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
}

.gen-mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.35rem;
    padding: 0.35rem;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-page) 72%, transparent);
}

.mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0.65rem 0.9rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-btn:hover:not(.active) {
    border-color: var(--border-color);
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.mode-btn.active {
    border-color: transparent;
    background: var(--gradient-brand);
    color: #ffffff;
    box-shadow: 0 4px 14px color-mix(in srgb, var(--primary-color) 28%, transparent);
}

.mode-btn .studio-icon {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

/* Keep generated images at a comfortable viewing size. The original can
   still be viewed at the available viewport size by opening the lightbox. */
.image-gallery {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2rem;
}

.image-gallery .gen-empty {
    width: 100%;
    margin-top: 0;
}

.image-card {
    width: min(100%, 680px);
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--bg-surface-elevated);
    box-shadow: var(--shadow-sm);
}

.image-card-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 180px;
    overflow: hidden;
    background: #070a10;
}

.image-card img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(60vh, 480px);
    object-fit: contain;
}

.image-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
}

.image-card-prompt {
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-card-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.45rem;
}

.track-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.track-download-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 38px;
    padding: 0.5rem 0.8rem;
    border: 1px solid color-mix(in srgb, var(--primary-color) 38%, var(--border-color));
    border-radius: 10px;
    background: color-mix(in srgb, var(--primary-color) 10%, var(--bg-surface-elevated));
    color: var(--text-primary);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.track-download-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #ffffff;
    box-shadow: 0 5px 14px color-mix(in srgb, var(--primary-color) 24%, transparent);
    transform: translateY(-1px);
}

.track-download-btn .studio-icon,
.image-delete-btn .studio-icon,
.track-delete-btn .studio-icon {
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
}

.delete-tooltip-wrapper {
    display: inline-flex;
}

.image-delete-btn,
.track-delete-btn {
    display: inline-grid;
    width: 38px;
    height: 38px;
    padding: 0;
    place-items: center;
    border: 1px solid color-mix(in srgb, #ef4444 30%, var(--border-color));
    border-radius: 10px;
    background: color-mix(in srgb, #ef4444 8%, var(--bg-surface-elevated));
    color: #f87171;
    cursor: pointer;
    transition: all 0.2s ease;
}

.image-delete-btn:hover,
.track-delete-btn:hover {
    border-color: color-mix(in srgb, #ef4444 70%, var(--border-color));
    background: color-mix(in srgb, #ef4444 18%, var(--bg-surface-elevated));
    color: #fca5a5;
    box-shadow: 0 5px 14px rgba(239, 68, 68, 0.16);
    transform: translateY(-1px);
}

/* Keep generated videos at a comfortable viewing size instead of allowing
   their native dimensions to stretch beyond the generator panel. */
.video-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-top: 2rem;
}

.video-results .gen-empty {
    width: 100%;
    margin-top: 0;
}

.video-card {
    width: min(100%, 680px);
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--bg-surface-elevated);
    box-shadow: var(--shadow-sm);
}

.video-card-player {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 180px;
    overflow: hidden;
    background: #070a10;
}

.video-player {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(60vh, 480px);
    object-fit: contain;
}

.video-placeholder {
    display: grid;
    place-items: center;
    min-height: 240px;
    color: var(--text-muted);
    font-size: 2rem;
}

.video-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
}

.video-card-prompt {
    min-width: 0;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-card-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.45rem;
}

.file-input-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.75rem 1.2rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-input-label:hover {
    border-color: var(--primary-color);
    background: var(--bg-surface-elevated);
}

.dashboard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    max-width: 1300px;
    margin: 0 auto;
    width: 100%;
}

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

.section-title {
    font-size: 1.6rem;
    margin: 0;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

/* Chat Layout */
.chat-page {
    flex: 1;
    width: 100%;
    padding: clamp(1rem, 2vw, 2rem);
    min-height: 0;
}

.chat-layout {
    display: flex;
    gap: clamp(1rem, 1.6vw, 1.5rem);
    width: 100%;
    max-width: 1480px;
    height: calc(100dvh - 64px - clamp(2rem, 4vw, 4rem));
    min-height: 600px;
    margin: 0 auto;
}

.chat-sidebar {
    flex: 0 0 var(--sidebar-width);
    min-width: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.chat-history-title {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

.new-chat-btn {
    width: 100%;
    padding: 0.7rem;
    border: 1px dashed var(--border-color);
    background: transparent;
    color: var(--text-primary);
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.2s ease;
}

.new-chat-btn span {
    color: var(--primary-color);
    font-size: 1.05rem;
}

.new-chat-btn:hover {
    border-color: var(--primary-color);
    background: var(--bg-surface-elevated);
    color: var(--primary-color);
}

.chat-history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-item {
    padding: 0.65rem 0.7rem 0.65rem 0.8rem;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
}

.history-item:hover, .history-item.active {
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.history-item.active {
    box-shadow: inset 2px 0 0 var(--primary-color);
}

.conversation-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.conversation-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-delete-btn {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    opacity: 0;
}

.conversation-item:hover .chat-delete-btn,
.chat-delete-btn:focus-visible {
    opacity: 1;
}

.chat-delete-btn:hover {
    background: rgba(239, 68, 68, 0.12);
}

.chat-storage-note {
    margin-top: 0.8rem;
    padding: 0.8rem 0.35rem 0.1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

.chat-main {
    flex: 1;
    min-width: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.chat-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.1rem 1.35rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.chat-toolbar-copy h1 {
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: -0.02em;
}

.chat-kicker {
    display: block;
    margin-bottom: 0.1rem;
    color: var(--primary-color);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.chat-model-control {
    display: grid;
    grid-template-columns: auto minmax(190px, 250px);
    align-items: center;
    gap: 0.15rem 0.6rem;
}

.chat-model-control label {
    grid-row: 1;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.chat-model-control .cost-tier-legend {
    grid-column: 2;
}

.chat-main > .reservation-note {
    margin: 0.85rem 1.5rem 0;
}

.chat-model-select {
    width: 100%;
    padding: 0.55rem 2rem 0.55rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.82rem;
    font-weight: 600;
}

.chat-model-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background:
        radial-gradient(circle at 80% 15%, rgba(99, 102, 241, 0.055), transparent 26%),
        var(--bg-secondary);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.chat-empty {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    color: var(--text-muted);
    text-align: center;
}

.chat-empty span {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin-bottom: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    background: var(--bg-surface);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    font-size: 1.2rem;
}

.chat-empty strong {
    color: var(--text-primary);
    font-size: 1rem;
}

.chat-empty small {
    margin-top: 0.25rem;
    font-size: 0.8rem;
}

.message-row {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.message-row.user {
    align-items: flex-end;
}

.message-row.ai {
    align-items: flex-start;
}

.chat-bubble {
    max-width: min(78%, 780px);
    padding: 1rem 1.25rem;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    box-shadow: var(--shadow-sm);
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--gradient-brand);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chat-bubble.ai {
    align-self: flex-start;
    background: var(--chat-ai-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    padding: 1rem 1.15rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chat-composer-input {
    flex: 1;
    min-width: 0;
    height: 46px;
    padding: 0 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    outline: none;
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.92rem;
}

.chat-composer-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.chat-composer-input::placeholder {
    color: var(--text-muted);
}

.chat-attach-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    height: 46px;
    padding: 0 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-page);
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.chat-attach-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.chat-send-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-width: 108px;
    height: 46px;
    padding: 0 1.15rem;
}

.chat-send-btn span {
    font-size: 1.05rem;
}

.chat-file-preview {
    padding: 0.65rem 1.15rem 0;
    border-top: 1px solid var(--border-color);
}

.typing-bubble {
    display: flex;
    gap: 5px;
    min-width: 62px;
    opacity: 0.75;
}

.typing-bubble span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typingPulse 1.2s infinite ease-in-out;
}

.typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
.typing-bubble span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingPulse {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

.chat-textarea {
    flex: 1;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.95rem;
    resize: none;
    outline: none;
}

.chat-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* Generator Panels (Image, Music, Video) */
.generator-grid {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 128px);
}

.generator-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
}

.generator-output {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* ============================================================
   MODALS (SUBSCRIPTION & PRICING)
   ============================================================ */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.25rem;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.subscription-modal-content {
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
    border-color: var(--primary-color);
}

.plan-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.plan-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 1.75rem 1.25rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    transition: all 0.25s ease;
}

.plan-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

.plan-card.current {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

.plan-name {
    font-size: 1.25rem;
    font-weight: 800;
}

.plan-price {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
}

.plan-points {
    font-size: 0.88rem;
    color: var(--text-muted);
    font-weight: 600;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
}

.plan-features li {
    padding: 4px 0;
}

.plan-features li::before {
    content: '✓ ';
    color: var(--primary-color);
    font-weight: 700;
}

.plan-btn {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 10px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
}

.plan-btn.upgrade {
    background: var(--gradient-brand);
    border: none;
    color: #ffffff;
}

.plan-btn.upgrade:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.topup-section {
    grid-column: 1 / -1;
    margin-top: 0.75rem;
}

.topup-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

.topup-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 1.5rem;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    transition: all 0.25s ease;
}

.topup-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-3px);
    box-shadow: var(--shadow-glow);
}

/* Loading screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 1rem;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Responsive */
@media (max-width: 900px) {
    .top-nav {
        height: auto;
        min-height: 64px;
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .nav-tabs {
        order: 3;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .nav-tabs::-webkit-scrollbar {
        display: none;
    }

    .nav-tab {
        flex: 0 0 auto;
    }

    .home-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .generator-grid {
        grid-template-columns: 1fr;
        height: auto;
    }
    .chat-layout {
        flex-direction: column;
        height: auto;
        min-height: 0;
    }
    .chat-sidebar {
        width: 100%;
        flex: 0 0 210px;
    }
    .chat-main {
        min-height: 68vh;
    }
}

@media (max-width: 600px) {
    .top-nav {
        align-items: center;
    }

    .nav-brand {
        font-size: 1.1rem;
    }

    .nav-right {
        gap: 7px;
    }

    .nav-credit-badge {
        padding: 5px 9px;
        font-size: 0.76rem;
    }

    .nav-tab {
        padding: 7px 11px;
        font-size: 0.8rem;
    }

    .chat-page {
        padding: 0.75rem;
    }

    .chat-layout {
        gap: 0.75rem;
    }

    .chat-sidebar,
    .chat-main {
        border-radius: 14px;
    }

    .chat-toolbar {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.8rem;
        padding: 0.9rem 1rem;
    }

    .chat-model-control {
        width: 100%;
        grid-template-columns: auto minmax(0, 1fr);
    }

    .chat-messages {
        padding: 1rem;
    }

    .chat-bubble {
        max-width: 92%;
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    .chat-input-area {
        display: grid;
        grid-template-columns: auto 1fr;
        padding: 0.8rem;
    }

    .chat-composer-input {
        grid-column: 1 / -1;
        grid-row: 1;
    }

    .chat-attach-btn,
    .chat-send-btn {
        grid-row: 2;
    }

    .chat-send-btn {
        justify-self: end;
        min-width: 112px;
    }

    .auth-container {
        align-items: flex-start;
        padding: 1rem;
    }

    .auth-card {
        margin-top: 2vh;
        border-radius: 18px;
    }

    .auth-brand {
        margin-bottom: 1.6rem;
    }

    .home-cards {
        grid-template-columns: 1fr;
    }
    .plan-list {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   LOVEAI STUDIO REFRESH
   A calmer, editorial creative workspace for light and dark UI.
   ============================================================ */

:root,
[data-theme="dark"] {
    --bg-page: #0b0d14;
    --bg-secondary: #10131d;
    --bg-surface: #151925;
    --bg-surface-elevated: #1c2130;
    --bg-glass: rgba(21, 25, 37, 0.82);
    --bg-glass-nav: rgba(11, 13, 20, 0.82);
    --text-primary: #f5f6fa;
    --text-secondary: #a8afc0;
    --text-muted: #747d92;
    --border-color: rgba(255, 255, 255, 0.085);
    --border-hover: rgba(126, 111, 255, 0.45);
    --primary-color: #7567f8;
    --primary-hover: #8c80ff;
    --accent-indigo: #7567f8;
    --accent-emerald: #27c4ad;
    --gradient-brand: linear-gradient(135deg, #25c5ad 0%, #7567f8 100%);
    --gradient-brand-short: linear-gradient(90deg, #25c5ad, #5a8df7, #7567f8);
    --shadow-sm: 0 8px 28px rgba(0, 0, 0, 0.16);
    --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.22);
    --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.38);
    --shadow-glow: 0 16px 45px rgba(117, 103, 248, 0.18);
    --studio-chat: #8b7cff;
    --studio-images: #ff7d9c;
    --studio-music: #ffb75f;
    --studio-video: #35cbb4;
}

[data-theme="light"] {
    --bg-page: #f5f6fa;
    --bg-secondary: #eef0f6;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f7f8fb;
    --bg-glass: rgba(255, 255, 255, 0.86);
    --bg-glass-nav: rgba(250, 251, 253, 0.86);
    --text-primary: #141827;
    --text-secondary: #5c6477;
    --text-muted: #838b9d;
    --border-color: rgba(20, 24, 39, 0.085);
    --border-hover: rgba(102, 86, 230, 0.36);
    --primary-color: #6656e6;
    --primary-hover: #5848d5;
    --accent-indigo: #6656e6;
    --accent-emerald: #159c89;
    --gradient-brand: linear-gradient(135deg, #19a994 0%, #6656e6 100%);
    --gradient-brand-short: linear-gradient(90deg, #19a994, #4b7ee8, #6656e6);
    --shadow-sm: 0 8px 28px rgba(30, 35, 58, 0.055);
    --shadow-md: 0 18px 48px rgba(30, 35, 58, 0.085);
    --shadow-lg: 0 28px 80px rgba(30, 35, 58, 0.14);
    --shadow-glow: 0 16px 45px rgba(102, 86, 230, 0.12);
    --studio-chat: #6c5ce7;
    --studio-images: #e9587c;
    --studio-music: #dd8927;
    --studio-video: #139d8a;
}

html {
    background: var(--bg-page);
    scroll-behavior: smooth;
}

body {
    min-width: 300px;
    background:
        radial-gradient(circle at 8% 0%, color-mix(in srgb, var(--studio-video) 8%, transparent), transparent 30rem),
        radial-gradient(circle at 92% 8%, color-mix(in srgb, var(--studio-chat) 9%, transparent), transparent 34rem),
        var(--bg-page);
}

button,
input,
textarea,
select {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--primary-color) 35%, transparent);
    outline-offset: 3px;
}

#app {
    overflow-x: hidden;
}

.studio-icon {
    display: block;
    width: 1.15rem;
    height: 1.15rem;
}

/* Navigation */
.top-nav {
    height: 72px;
    min-height: 72px;
    padding: 0 1.5rem;
    background: var(--bg-glass-nav);
    border-bottom: 1px solid var(--border-color);
    box-shadow: none;
}

.nav-shell {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    width: 100%;
    max-width: 1480px;
    margin: 0 auto;
}

.nav-brand {
    flex: 0 0 auto;
    gap: 0.65rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    -webkit-text-fill-color: currentColor;
    font-size: 1.18rem;
    letter-spacing: -0.045em;
}

.nav-brand > span:last-child > span {
    color: var(--text-muted);
    font-weight: 600;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: var(--gradient-brand);
    color: #fff;
    box-shadow: 0 8px 22px rgba(102, 86, 230, 0.22);
    -webkit-text-fill-color: #fff;
    font-size: 0.95rem;
}

.nav-tabs {
    gap: 2px;
    padding: 4px;
    border: 0;
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-surface-elevated) 80%, transparent);
}

.nav-tab {
    gap: 0.45rem;
    min-height: 38px;
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 650;
}

.nav-tab .studio-icon {
    width: 1rem;
    height: 1rem;
}

.nav-tab.active {
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.nav-tab.active .studio-icon {
    color: var(--primary-color);
}

.nav-right {
    gap: 0.6rem;
}

.theme-toggle-btn,
.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 12px;
}

.theme-toggle-btn {
    background: transparent;
}

.theme-toggle-btn:hover {
    transform: none;
    background: var(--bg-surface);
}

.nav-credit-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.38rem;
    min-height: 38px;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-surface);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.nav-credit-badge > span {
    color: #d99a2b;
}

.nav-credit-badge small {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
}

.user-avatar {
    background: var(--text-primary);
    color: var(--bg-page);
    box-shadow: none;
}

.user-menu-trigger:hover .user-avatar {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.user-dropdown {
    top: calc(100% + 12px);
    width: 280px;
    padding: 0.85rem;
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
}

.nav-auth-btn {
    min-height: 40px;
    padding: 0.55rem 1rem;
    border-radius: 11px;
    font-size: 0.82rem;
}

/* Public home */
.home-page {
    position: relative;
    isolation: isolate;
    min-height: calc(100vh - 72px);
    padding: 0 1.5rem 7rem;
}

.home-orb {
    position: absolute;
    z-index: -1;
    border-radius: 999px;
    filter: blur(2px);
    pointer-events: none;
}

.home-orb-one {
    top: 5rem;
    left: -11rem;
    width: 30rem;
    height: 30rem;
    background: radial-gradient(circle, color-mix(in srgb, var(--studio-video) 16%, transparent), transparent 68%);
}

.home-orb-two {
    top: 0;
    right: -12rem;
    width: 38rem;
    height: 38rem;
    background: radial-gradient(circle, color-mix(in srgb, var(--studio-chat) 17%, transparent), transparent 68%);
}

.home-hero {
    position: relative;
    max-width: 900px;
    min-height: min(760px, calc(100vh - 72px));
    padding: clamp(6rem, 13vh, 9rem) 1rem 5rem;
}

.home-eyebrow,
.dashboard-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.home-eyebrow span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--studio-video);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--studio-video) 15%, transparent);
}

.home-title {
    max-width: 900px;
    margin: 1.7rem 0 1.5rem;
    color: var(--text-primary);
    background: none;
    -webkit-text-fill-color: currentColor;
    font-size: clamp(3.8rem, 8.2vw, 7.4rem);
    font-weight: 800;
    line-height: 0.96;
    letter-spacing: -0.075em;
}

.home-title span {
    background: var(--gradient-brand-short);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.home-subtitle {
    max-width: 650px;
    margin: 0 auto 2rem;
    color: var(--text-secondary);
    font-size: clamp(1.05rem, 1.8vw, 1.24rem);
    line-height: 1.75;
}

.home-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.home-primary-action,
.home-secondary-action {
    min-height: 52px;
    padding: 0.8rem 1.4rem;
    border-radius: 14px;
}

.home-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
}

.home-primary-action span {
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.home-primary-action:hover span {
    transform: translateX(3px);
}

.home-trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.65rem 1.5rem;
    margin-top: 2.3rem;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.home-trust span {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
}

.home-trust i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--studio-video);
}

.home-showcase {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    scroll-margin-top: 100px;
}

.home-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 310px;
    padding: clamp(1.5rem, 3vw, 2.4rem);
    overflow: hidden;
    border-radius: 28px;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.home-card::after {
    content: '';
    position: absolute;
    right: -5rem;
    bottom: -7rem;
    width: 16rem;
    height: 16rem;
    border-radius: 50%;
    opacity: 0.11;
    background: currentColor;
    transition: transform 0.4s ease;
}

.home-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.home-card:hover::after {
    transform: scale(1.12);
}

.home-card-chat { color: var(--studio-chat); }
.home-card-images { color: var(--studio-images); }
.home-card-music { color: var(--studio-music); }
.home-card-video { color: var(--studio-video); }

.home-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.home-card-icon {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    margin: 0;
    border-radius: 16px;
    background: color-mix(in srgb, currentColor 13%, var(--bg-surface));
}

.home-card-icon .studio-icon {
    width: 1.35rem;
    height: 1.35rem;
}

.home-card-number {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

.home-card h2 {
    margin: 2.5rem 0 0.6rem;
    color: var(--text-primary);
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    line-height: 1.1;
}

.home-card p {
    max-width: 31rem;
    color: var(--text-secondary);
    font-size: 0.94rem;
    line-height: 1.7;
}

.home-card-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 2rem;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-weight: 700;
}

.home-card-link b {
    color: currentColor;
    font-size: 1.2rem;
}

/* Logged-in dashboard */
.dashboard-page {
    flex: 1;
    padding: clamp(1.5rem, 3.5vw, 3.5rem) clamp(1rem, 3vw, 2.5rem) 5rem;
}

.dashboard-container {
    max-width: 1320px;
    padding: 0;
}

.dashboard-hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    min-height: 190px;
    padding: clamp(1.7rem, 4vw, 3rem);
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 28px;
    background:
        radial-gradient(circle at 86% 30%, color-mix(in srgb, var(--studio-chat) 17%, transparent), transparent 19rem),
        radial-gradient(circle at 68% 130%, color-mix(in srgb, var(--studio-video) 12%, transparent), transparent 22rem),
        var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.dashboard-hero::after {
    content: '✦';
    position: absolute;
    top: -2rem;
    right: 4rem;
    color: color-mix(in srgb, var(--text-primary) 6%, transparent);
    font-size: 13rem;
    line-height: 1;
    pointer-events: none;
}

.dashboard-hero-copy,
.dashboard-balance {
    position: relative;
    z-index: 1;
}

.dashboard-eyebrow {
    color: var(--primary-color);
}

.dashboard-hero h1 {
    margin: 0.45rem 0 0.45rem;
    color: var(--text-primary);
    font-size: clamp(2rem, 4.5vw, 3.35rem);
    line-height: 1.08;
    letter-spacing: -0.055em;
}

.dashboard-hero p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.dashboard-balance {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 255px;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg-surface) 74%, transparent);
    color: var(--text-primary);
    backdrop-filter: blur(16px);
    cursor: pointer;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.dashboard-balance:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.dashboard-balance-icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: color-mix(in srgb, #d99a2b 13%, var(--bg-surface));
    color: #d99a2b;
}

.dashboard-balance > span:nth-child(2) {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.dashboard-balance small {
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 650;
    letter-spacing: 0.03em;
}

.dashboard-balance strong {
    font-size: 0.86rem;
}

.dashboard-balance b {
    color: var(--text-muted);
    font-size: 1rem;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
}

.dashboard-action {
    --action-color: var(--studio-chat);
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
    min-height: 92px;
    padding: 1rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-surface);
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.dashboard-action-images { --action-color: var(--studio-images); }
.dashboard-action-music { --action-color: var(--studio-music); }
.dashboard-action-video { --action-color: var(--studio-video); }

.dashboard-action::after {
    content: '';
    position: absolute;
    right: -2.5rem;
    bottom: -3.5rem;
    width: 8rem;
    height: 8rem;
    border-radius: 50%;
    background: var(--action-color);
    opacity: 0.065;
    transition: transform 0.25s ease;
}

.dashboard-action:hover {
    border-color: color-mix(in srgb, var(--action-color) 40%, var(--border-color));
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.dashboard-action:hover::after {
    transform: scale(1.2);
}

.dashboard-action-icon,
.dashboard-panel-icon,
.dashboard-chat-mark,
.dashboard-empty-icon {
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    color: var(--action-color, var(--primary-color));
}

.dashboard-action-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: color-mix(in srgb, var(--action-color) 12%, var(--bg-surface));
}

.dashboard-action-copy {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.dashboard-action-copy strong {
    overflow: hidden;
    font-size: 0.85rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-action-copy small {
    overflow: hidden;
    margin-top: 0.12rem;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-action-arrow {
    position: relative;
    z-index: 1;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dashboard-section-label {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin: 2.8rem 0 1rem;
}

.dashboard-section-label span {
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 750;
    letter-spacing: -0.03em;
}

.dashboard-section-label small {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.dashboard-activity-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.dashboard-panel {
    --panel-color: var(--studio-chat);
    display: flex;
    min-width: 0;
    min-height: 330px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
}

.dashboard-panel-images { --panel-color: var(--studio-images); }
.dashboard-panel-music { --panel-color: var(--studio-music); }
.dashboard-panel-video { --panel-color: var(--studio-video); }

.dashboard-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
}

.dashboard-panel-header > div {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.dashboard-panel-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    background: color-mix(in srgb, var(--panel-color) 12%, var(--bg-surface));
    color: var(--panel-color);
}

.dashboard-panel-icon .studio-icon {
    width: 1rem;
    height: 1rem;
}

.dashboard-panel-header h2 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.96rem;
    letter-spacing: -0.02em;
}

.dashboard-panel-header > button,
.dashboard-empty button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 650;
}

.dashboard-panel-header > button:hover,
.dashboard-empty button:hover {
    color: var(--panel-color, var(--primary-color));
}

.dashboard-panel-header button span,
.dashboard-empty button span {
    margin-left: 0.25rem;
}

.dashboard-panel-body {
    display: flex;
    min-height: 0;
    flex: 1;
    flex-direction: column;
    padding: 0.7rem;
    overflow: auto;
}

.dashboard-panel-images .dashboard-panel-body,
.dashboard-panel-video .dashboard-panel-body {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 0.55rem;
}

.dashboard-chat-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 63px;
    padding: 0.65rem 0.7rem;
    border-radius: 14px;
    cursor: pointer;
}

.dashboard-chat-item:hover {
    background: var(--bg-surface-elevated);
}

.dashboard-chat-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: color-mix(in srgb, var(--studio-chat) 10%, var(--bg-surface));
    color: var(--studio-chat);
}

.dashboard-chat-mark .studio-icon {
    width: 0.95rem;
    height: 0.95rem;
}

.dashboard-chat-copy,
.dashboard-song-info {
    min-width: 0;
    flex: 1;
}

.dashboard-chat-title,
.dashboard-song-title {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.82rem;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-chat-date,
.dashboard-song-style {
    margin-top: 0.08rem;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-item-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.dashboard-image-card,
.dashboard-video-card {
    position: relative;
    min-width: 0;
    min-height: 116px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 15px;
    background: var(--bg-surface-elevated);
    cursor: pointer;
}

.dashboard-image-card img,
.dashboard-video-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.dashboard-image-card:hover img,
.dashboard-video-card:hover video {
    transform: scale(1.04);
}

.dashboard-media-overlay {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 2.2rem 0.75rem 0.65rem;
    background: linear-gradient(transparent, rgba(5, 7, 13, 0.82));
    color: #fff;
    text-align: left;
}

.dashboard-media-overlay span {
    overflow: hidden;
    font-size: 0.68rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-media-overlay b {
    flex: 0 0 auto;
    font-size: 0.85rem;
}

.dashboard-video-placeholder {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 116px;
    color: var(--studio-video);
    background: color-mix(in srgb, var(--studio-video) 9%, var(--bg-surface-elevated));
}

.dashboard-video-placeholder .studio-icon {
    width: 1.8rem;
    height: 1.8rem;
}

.dashboard-song-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 66px;
    padding: 0.65rem;
    border-radius: 14px;
    cursor: pointer;
}

.dashboard-song-item:hover {
    background: var(--bg-surface-elevated);
}

.dashboard-song-cover,
.dashboard-song-cover-placeholder {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 12px;
    object-fit: cover;
}

.dashboard-song-cover-placeholder {
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--studio-music) 11%, var(--bg-surface));
    color: var(--studio-music);
}

.dashboard-song-cover-placeholder .studio-icon {
    width: 1.05rem;
    height: 1.05rem;
}

.dashboard-song-audio {
    width: min(210px, 42%);
    height: 32px;
}

.dashboard-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 235px;
    flex: 1;
    flex-direction: column;
    padding: 2rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.dashboard-empty-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    background: var(--bg-surface-elevated);
    color: var(--panel-color, var(--primary-color));
}

.dashboard-empty-icon .studio-icon {
    width: 1.2rem;
    height: 1.2rem;
}

.dashboard-empty strong {
    color: var(--text-primary);
    font-size: 0.88rem;
}

.dashboard-empty p {
    max-width: 260px;
    margin: 0.35rem 0 0.9rem;
    font-size: 0.72rem;
    line-height: 1.6;
}

/* Shared surfaces */
.page-content {
    max-width: 1320px;
    padding: clamp(1.5rem, 3vw, 3rem) clamp(1rem, 3vw, 2.5rem);
}

.gen-container,
.chat-sidebar,
.chat-main,
.auth-card {
    border-radius: 24px;
}

.gen-container {
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--gradient-brand);
    box-shadow: 0 9px 24px rgba(102, 86, 230, 0.19);
}

.btn-primary:hover {
    box-shadow: 0 13px 30px rgba(102, 86, 230, 0.25);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(5, 7, 13, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* Account and subscription management */
.plan-manage-btn {
    padding: 0.35rem 0;
    border: 0;
    background: transparent;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 700;
}

.plan-manage-btn:hover {
    color: var(--primary-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.account-modal-content {
    width: min(620px, 100%);
    max-height: min(90vh, 860px);
    padding: 0;
    overflow-y: auto;
    border-radius: 26px;
}

.account-modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem 1.65rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
    background: color-mix(in srgb, var(--bg-surface) 92%, transparent);
    backdrop-filter: blur(18px);
}

.account-modal-header span {
    color: var(--primary-color);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.account-modal-header h2 {
    margin: 0.18rem 0 0;
    color: var(--text-primary);
    font-size: 1.55rem;
}

.account-modal-close {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 11px;
    background: var(--bg-surface-elevated);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.35rem;
}

.account-modal-close:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

#account-details {
    padding: 1.25rem 1.65rem 1.65rem;
}

.account-feedback {
    display: none;
    margin: 1rem 1.65rem 0;
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
    font-size: 0.78rem;
    line-height: 1.5;
}

.account-feedback.success,
.account-feedback.error {
    display: block;
}

.account-feedback.success {
    border: 1px solid color-mix(in srgb, var(--studio-video) 35%, transparent);
    background: color-mix(in srgb, var(--studio-video) 10%, transparent);
    color: var(--studio-video);
}

.account-feedback.error,
.account-load-error {
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.08);
    color: #ef6464;
}

.account-profile-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: var(--bg-surface-elevated);
}

.account-profile-avatar {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
    background: var(--gradient-brand);
    color: #fff;
    font-weight: 800;
}

.account-profile-card > div:nth-child(2) {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

.account-profile-card strong {
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.88rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-profile-card > div:nth-child(2) span {
    overflow: hidden;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-plan-pill {
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary-color) 11%, transparent);
    color: var(--primary-color);
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
}

.account-settings-section {
    margin-top: 1.4rem;
}

.account-section-heading h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 0.92rem;
}

.account-section-heading p {
    margin: 0.18rem 0 0.75rem;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.account-subscription-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 16px;
}

.account-subscription-status {
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
}

.account-subscription-status > span {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    margin-top: 0.35rem;
    border-radius: 50%;
    background: var(--text-muted);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--text-muted) 10%, transparent);
}

.account-subscription-status.active > span {
    background: var(--studio-video);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--studio-video) 12%, transparent);
}

.account-subscription-status.scheduled > span {
    background: var(--studio-music);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--studio-music) 12%, transparent);
}

.account-subscription-status strong {
    color: var(--text-primary);
    font-size: 0.8rem;
}

.account-subscription-status p {
    max-width: 310px;
    margin: 0.15rem 0 0;
    color: var(--text-muted);
    font-size: 0.7rem;
    line-height: 1.5;
}

.account-secondary-btn,
.account-delete-reveal,
.account-delete-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0.55rem 0.8rem;
    border-radius: 11px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 750;
}

.account-secondary-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
}

.account-secondary-btn:hover {
    border-color: var(--border-hover);
}

.account-cancel-btn,
.account-delete-reveal {
    color: #dc5454;
}

.account-danger-zone {
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.account-delete-reveal {
    border: 1px solid rgba(239, 68, 68, 0.22);
    background: rgba(239, 68, 68, 0.055);
}

.account-delete-reveal:hover {
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.1);
}

.delete-account-form {
    flex-direction: column;
    gap: 0.6rem;
    padding: 1rem;
    border: 1px solid rgba(239, 68, 68, 0.22);
    border-radius: 16px;
    background: rgba(239, 68, 68, 0.045);
}

.account-warning {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.35rem;
}

.account-warning strong {
    color: #dc5454;
    font-size: 0.78rem;
}

.account-warning span {
    margin-top: 0.18rem;
    color: var(--text-secondary);
    font-size: 0.69rem;
    line-height: 1.5;
}

.delete-account-form label {
    margin-top: 0.3rem;
    color: var(--text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
}

.delete-account-form input {
    width: 100%;
    min-height: 42px;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 11px;
    background: var(--bg-page);
    color: var(--text-primary);
}

.delete-account-form input:focus {
    border-color: #dc5454;
    outline-color: rgba(239, 68, 68, 0.2);
}

.delete-account-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    margin-top: 0.6rem;
}

.account-delete-btn {
    border: 1px solid #dc5454;
    background: #dc5454;
    color: #fff;
}

.account-delete-btn:hover {
    border-color: #c84545;
    background: #c84545;
}

.account-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    flex-direction: column;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.account-loading .loading-spinner {
    width: 30px;
    height: 30px;
}

.account-load-error {
    padding: 0.85rem;
    border-radius: 12px;
    font-size: 0.76rem;
}

/* Responsive studio */
@media (max-width: 1080px) {
    .nav-shell {
        flex-wrap: wrap;
        padding-top: 0.7rem;
    }

    .top-nav {
        height: auto;
        min-height: 72px;
    }

    .nav-tabs {
        order: 3;
        width: 100%;
        overflow-x: auto;
    }

    .dashboard-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-page,
    .chat-page,
    .page-content {
        padding-top: 1.5rem;
    }
}

@media (max-width: 760px) {
    .home-hero {
        min-height: auto;
        padding-top: 6rem;
        padding-bottom: 5rem;
    }

    .home-showcase,
    .dashboard-activity-grid {
        grid-template-columns: 1fr;
    }

    .home-card {
        min-height: 280px;
    }

    .dashboard-hero {
        align-items: stretch;
        flex-direction: column;
        min-height: 0;
    }

    .dashboard-balance {
        width: 100%;
    }

    .dashboard-panel {
        min-height: 310px;
    }
}

@media (max-width: 560px) {
    .top-nav {
        padding: 0 0.75rem;
    }

    .nav-shell {
        gap: 0.65rem;
    }

    .nav-brand {
        font-size: 1rem;
    }

    .brand-mark {
        width: 32px;
        height: 32px;
    }

    .nav-right {
        margin-left: auto;
    }

    .nav-credit-badge {
        display: none;
    }

    .nav-tab {
        flex: 1 1 20%;
        justify-content: center;
        min-width: 0;
        padding: 0.5rem 0.32rem;
        gap: 0.3rem;
        font-size: 0.72rem;
    }

    .nav-auth-btn {
        padding: 0.5rem 0.7rem;
    }

    .home-page {
        padding-right: 1rem;
        padding-left: 1rem;
    }

    .home-title {
        font-size: clamp(3.15rem, 17vw, 4.8rem);
    }

    .home-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .home-actions button {
        justify-content: center;
        width: 100%;
    }

    .home-trust {
        align-items: flex-start;
        flex-direction: column;
    }

    .home-card {
        min-height: 255px;
        border-radius: 22px;
    }

    .dashboard-page {
        padding: 1rem 0.75rem 3rem;
    }

    .dashboard-hero {
        padding: 1.45rem;
        border-radius: 22px;
    }

    .dashboard-hero h1 {
        font-size: 2rem;
    }

    .dashboard-actions {
        grid-template-columns: 1fr;
    }

    .dashboard-action {
        min-height: 76px;
    }

    .dashboard-section-label {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.1rem;
        margin-top: 2.2rem;
    }

    .dashboard-panel {
        border-radius: 20px;
    }

    .dashboard-panel-header > button {
        max-width: 120px;
        text-align: right;
    }

    .dashboard-song-audio {
        width: 44%;
    }

    .image-card-preview {
        min-height: 140px;
    }

    .image-card img {
        max-height: 65vh;
    }

    .image-card-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .image-card-prompt {
        width: 100%;
        white-space: normal;
    }

    .video-card-player {
        min-height: 140px;
    }

    .video-player {
        max-height: 65vh;
    }

    .video-card-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .video-card-prompt {
        width: 100%;
        white-space: normal;
    }

    .subscription-modal-content {
        padding: 1.35rem;
        border-radius: 20px;
    }

    .account-modal-content {
        max-height: 94vh;
        border-radius: 20px;
    }

    .account-modal-header {
        padding: 1.2rem 1.1rem 0.95rem;
    }

    #account-details {
        padding: 1rem 1.1rem 1.25rem;
    }

    .account-feedback {
        margin-right: 1.1rem;
        margin-left: 1.1rem;
    }

    .account-subscription-card {
        align-items: stretch;
        flex-direction: column;
    }

    .account-secondary-btn,
    .account-delete-reveal {
        width: 100%;
    }

    .delete-account-actions {
        flex-direction: column-reverse;
    }

    .delete-account-actions button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
