/* ============================================================
   VIZZO.RU — Styles
   Dark theme, responsive (mobile + desktop)
   Merged: website chrome + MiniApp generation components
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
    /* Core backgrounds — Light theme (default) */
    --bg:           #f5f5f7;
    --bg-card:      #ffffff;
    --bg-card-hover:#f0f0f5;
    --bg-input:     #f0f0f5;
    --bg-overlay:   rgba(0,0,0,0.4);
    --bg-secondary: #eef0f8;
    --bg-hover:     #e8e8f0;

    /* Borders */
    --border:       #d8d8e0;
    --border-focus: #6366f1;

    /* Text */
    --text:         #1a1a2e;
    --text-secondary:#5a5a70;
    --text-muted:   #7a7a90;
    --text-dim:     #a0a0b0;

    /* Primary (site chrome: header, nav, site buttons) */
    --primary:      #6366f1;
    --primary-hover:#5558e6;
    --primary-light:rgba(99,102,241,0.10);

    /* Accent (generation forms, sliders, cost bars — green) */
    --accent:       #10a37f;
    --accent-hover: #0e8c6c;
    --accent-dim:   rgba(16,163,127,0.06);
    --accent-border:rgba(16,163,127,0.20);

    /* Premium */
    --premium:      #f5a623;
    --premium-dim:  rgba(245,166,35,0.06);
    --premium-border:rgba(245,166,35,0.20);

    /* Semantic colours */
    --success:      #16a34a;
    --success-dim:  rgba(22,163,74,0.10);
    --success-light:rgba(22,163,74,0.10);
    --warning:      #d97706;
    --warning-light:rgba(217,119,6,0.10);
    --warn:         #d97706;
    --warn-dim:     rgba(217,119,6,0.10);
    --danger:       #dc2626;
    --danger-light: rgba(220,38,38,0.10);
    --danger-dim:   rgba(220,38,38,0.06);
    --info:         #2563eb;
    --info-dim:     rgba(37,99,235,0.06);

    /* Provider colours */
    --provider-Kling:  #6c5ce7;
    --provider-Google: #4285f4;
    --provider-OpenAI: #10a37f;
    --provider-xAI:    #1d9bf0;
    --provider-Suno:   #fa233b;

    /* Shadows */
    --shadow:       0 2px 8px rgba(0,0,0,0.08);
    --shadow-sm:    0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:    0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg:    0 4px 16px rgba(0,0,0,0.12);

    /* Radii */
    --radius:       10px;
    --radius-sm:    6px;
    --radius-md:    12px;
    --radius-lg:    16px;
    --radius-xl:    20px;
    --radius-full:  50px;

    /* Layout */
    --font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --transition:   0.2s ease;
    --header-h:     60px;
    --container-w:  1200px;
    --safe-b:       env(safe-area-inset-bottom, 0px);

    /* Aliases for old MiniApp var names */
    --card-bg:      var(--bg-card);
    --card-border:  var(--border);
}

/* --- Dark Theme --- */
[data-theme="dark"] {
    --bg:           #0f0f11;
    --bg-card:      #1a1a1f;
    --bg-card-hover:#22222a;
    --bg-input:     #1e1e24;
    --bg-overlay:   rgba(0,0,0,0.6);
    --bg-secondary: #1a1a2e;
    --bg-hover:     #252540;

    --border:       #2a2a33;

    --text:         #e4e4e7;
    --text-secondary:#8e8ea0;
    --text-muted:   #8b8b9e;
    --text-dim:     #5a5a6e;

    --primary-light:rgba(99,102,241,0.12);

    --accent-dim:   rgba(16,163,127,0.08);
    --accent-border:rgba(16,163,127,0.25);

    --premium-dim:  rgba(245,166,35,0.08);
    --premium-border:rgba(245,166,35,0.25);

    --success:      #22c55e;
    --success-dim:  rgba(34,197,94,0.12);
    --success-light:rgba(34,197,94,0.12);
    --warning:      #f59e0b;
    --warning-light:rgba(245,158,11,0.12);
    --warn:         #f59e0b;
    --warn-dim:     rgba(245,158,11,0.12);
    --danger:       #ef4444;
    --danger-light: rgba(239,68,68,0.12);
    --danger-dim:   rgba(239,68,68,0.08);
    --info:         #3b82f6;
    --info-dim:     rgba(59,130,246,0.08);

    --shadow:       0 2px 8px rgba(0,0,0,0.3);
    --shadow-sm:    0 1px 2px rgba(0,0,0,0.2);
    --shadow-md:    0 2px 8px rgba(0,0,0,0.3);
    --shadow-lg:    0 4px 16px rgba(0,0,0,0.4);
}

/* --- Theme Toggle --- */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.theme-toggle:hover {
    color: var(--text);
    border-color: var(--primary);
    background: var(--primary-light);
}

/* Light theme: show moon icon (click to switch to dark) */
.theme-icon-moon { display: inline; }
.theme-icon-sun  { display: none; }

/* Dark theme: show sun icon (click to switch to light) */
[data-theme="dark"] .theme-icon-moon { display: none; }
[data-theme="dark"] .theme-icon-sun  { display: inline; }

html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }
img { max-width: 100%; height: auto; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
button { font-family: inherit; cursor: pointer; }

/* --- Layout --- */
.container { max-width: var(--container-w); margin: 0 auto; padding: 0 20px; width: 100%; }
.site-main { flex: 1; padding: 24px 0; }

/* --- Header --- */
.site-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-h);
}
.header-inner {
    display: flex;
    align-items: center;
    height: 100%;
    gap: 24px;
}
.logo {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: 2px;
}
.logo:hover { color: var(--primary); }
.main-nav {
    display: flex;
    gap: 4px;
    flex: 1;
}
.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}
.nav-link:hover { color: var(--text); background: var(--primary-light); }
.nav-link.active { color: var(--primary); background: var(--primary-light); }
.header-right { display: flex; align-items: center; gap: 12px; }
.balance-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--primary-light);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
}
.mobile-menu-toggle { display: none; }

/* --- Footer --- */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 20px 0;
    margin-top: auto;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-left { display: flex; align-items: center; gap: 12px; }
.footer-logo { font-weight: 700; letter-spacing: 1px; color: var(--text-muted); }
.footer-copy { font-size: 0.8rem; color: var(--text-dim); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--text-muted); font-size: 0.8rem; }
.footer-links a:hover { color: var(--text); }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }
.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; color: #fff; }
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
}
.btn-icon:hover { background: var(--primary-light); color: var(--text); }

.btn-secondary {
    width: 100%;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    transition: all .2s;
}
.btn-secondary:active {
    background: var(--bg-hover);
    transform: scale(.98);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
}
.card:hover { border-color: var(--border-focus); }
.card-clickable { cursor: pointer; }
.card-clickable:hover { background: var(--bg-card-hover); transform: translateY(-1px); box-shadow: var(--shadow); }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    box-sizing: border-box;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dim); }
.form-textarea { resize: vertical; min-height: 100px; line-height: 1.5; }
.form-error { color: var(--danger); font-size: 0.82rem; margin-top: 4px; }
.form-hint { color: var(--text-dim); font-size: 0.82rem; margin-top: 4px; }

/* --- Auth forms (centered) --- */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-h) - 120px);
    padding: 24px 20px;
}
.auth-card {
    width: 100%;
    max-width: 420px;
}
.auth-card h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}
.auth-card .subtitle {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.9rem;
}
.auth-links {
    text-align: center;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ================================================================
   BADGES & TAGS
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }

.badge-new {
    background: var(--accent);
    color: #fff;
}
.badge-pro {
    background: var(--premium);
    color: #000;
}
.badge-motion {
    background: var(--info);
    color: #fff;
}
.badge-omni {
    background: var(--provider-Kling);
    color: #fff;
}

.type-tag {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
}
.type-tag.image {
    background: var(--info-dim);
    color: var(--info);
}
.type-tag.video {
    background: var(--accent-dim);
    color: var(--accent);
}
.type-tag.audio {
    background: rgba(250, 35, 59, 0.1);
    color: var(--provider-Suno);
}

.cost-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ================================================================
   SECTION LABELS
   ================================================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-title { font-size: 1.1rem; font-weight: 700; }
.section-subtitle { color: var(--text-muted); font-size: 0.85rem; }

.section-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin: 20px 0 10px;
}
.section-label:first-child {
    margin-top: 4px;
}
.section-label-sm {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 20px 0 10px;
}

/* ================================================================
   FILTER PILLS
   ================================================================ */
.filter-pills {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }

.filter-pill {
    flex: 1 0 auto;
    padding: 7px 12px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: all .15s;
    text-align: center;
    cursor: pointer;
    font-family: inherit;
}
.filter-pill.active {
    background: var(--bg-hover);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

/* ================================================================
   FEATURED CARD
   ================================================================ */
.featured-card {
    display: flex;
    gap: 14px;
    padding: 16px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all .2s;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}
.featured-card:active {
    transform: scale(.985);
}
.featured-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    flex-shrink: 0;
    color: #fff;
}
.featured-body {
    flex: 1;
    min-width: 0;
}
.featured-name {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.featured-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}
.featured-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

/* ================================================================
   MODEL GRID (generate page)
   ================================================================ */
.model-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.model-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
}
.model-card .model-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}
.model-card .model-info { flex: 1; }
.model-card .model-name { font-weight: 600; font-size: 0.95rem; }
.model-card .model-desc { color: var(--text-muted); font-size: 0.82rem; margin-top: 2px; }
.model-card .model-cost { color: var(--text-dim); font-size: 0.78rem; margin-top: 4px; }

/* Model card icon with provider colours */
.model-card-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}
.model-card-body {
    flex: 1;
    min-width: 0;
}
.model-card-name {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.model-card-desc {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}
.model-card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.model-card-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-left: 4px;
}

/* ================================================================
   GENERATION FORM
   ================================================================ */
.gen-form {
    max-width: 720px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px;
}
.gen-form .cost-display {
    padding: 12px 16px;
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    font-weight: 600;
    color: var(--primary);
    text-align: center;
    margin-bottom: 16px;
}
.form-section {
    margin-bottom: 18px;
}
.form-placeholder {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
    font-size: 14px;
}
.char-count {
    text-align: right;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ================================================================
   MODE GRID
   ================================================================ */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.mode-card {
    padding: 14px 8px;
    text-align: center;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all .2s;
}
.mode-card.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.mode-card:active {
    transform: scale(.97);
}
.mode-card.disabled {
    opacity: .3;
    pointer-events: none;
}
.mode-icon {
    font-size: 22px;
    margin-bottom: 4px;
}
.mode-label {
    font-size: 12px;
    font-weight: 600;
}
.mode-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
    padding: 10px 14px;
    background: var(--accent-dim);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent);
    line-height: 1.5;
}

/* ================================================================
   VARIANT GRID
   ================================================================ */
.variant-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}
.variant-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}
.variant-card {
    padding: 14px 10px;
    text-align: center;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all .2s;
}
.variant-card.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.variant-card:active {
    transform: scale(.97);
}
.variant-card.disabled {
    opacity: .3;
    pointer-events: none;
}
.variant-icon {
    font-size: 22px;
    margin-bottom: 4px;
}
.variant-label {
    font-size: 14px;
    font-weight: 700;
}
.variant-sub {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.3;
}
.variant-sub.premium {
    color: var(--premium);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 9px;
}

/* ================================================================
   RATIO GRID
   ================================================================ */
.ratio-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.ratio-card {
    padding: 12px 8px;
    text-align: center;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all .15s;
}
.ratio-card.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.ratio-card:active {
    transform: scale(.97);
}
.ratio-icon {
    font-size: 18px;
    margin-bottom: 2px;
    color: var(--text-muted);
    transition: color .15s;
}
.ratio-card.active .ratio-icon {
    color: var(--accent);
}
.ratio-label {
    font-size: 12px;
    font-weight: 600;
}

/* ================================================================
   PILL BUTTONS
   ================================================================ */
.pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.pill-row.pill-wrap {
    flex-wrap: wrap;
}
.pill {
    padding: 8px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all .15s;
    font-family: inherit;
}
.pill.active {
    border-color: var(--accent);
    color: var(--text);
    background: var(--accent-dim);
}

/* ================================================================
   SLIDER
   ================================================================ */
.slider-row {
    display: flex;
    align-items: center;
    gap: 14px;
}
.range-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    outline: none;
}
.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--bg);
    box-shadow: 0 2px 8px rgba(16, 163, 127, .3);
}
.slider-value {
    font-size: 17px;
    font-weight: 700;
    color: var(--accent);
    min-width: 40px;
    text-align: right;
}

/* ================================================================
   TOGGLE SWITCH
   ================================================================ */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
}
.toggle-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}
.toggle-icon {
    font-size: 18px;
}
.toggle-switch {
    position: relative;
    width: 48px;
    height: 28px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    left: 2px;
    top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: all .3s cubic-bezier(.4, 0, .2, 1);
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
    border-color: var(--accent);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #fff;
}

/* ================================================================
   COLLAPSIBLE SECTIONS
   ================================================================ */
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 10px 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: color .2s;
}
.collapsible-header:active {
    color: var(--text);
}
.coll-arrow {
    font-size: 14px;
    transition: transform .25s ease;
}
.collapsible-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
}
.form-section.open .coll-arrow {
    transform: rotate(90deg);
}
.form-section.open .collapsible-body {
    max-height: 250px;
}
.suno-advanced-collapsible.open .collapsible-body {
    max-height: 1200px;
}

/* ================================================================
   UPLOAD AREA
   ================================================================ */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 28px 16px;
    text-align: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all .25s;
    background: var(--bg-overlay);
}
.upload-area:active {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.upload-area.has-file {
    border-style: solid;
    border-color: var(--accent);
    background: var(--accent-dim);
}
.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
.upload-icon {
    font-size: 28px;
    margin-bottom: 8px;
    color: var(--text-muted);
}
.upload-text {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}
.upload-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}
.upload-preview {
    max-width: 100%;
    max-height: 180px;
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    object-fit: contain;
}
.upload-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: transform .15s;
}
.upload-remove:active {
    transform: scale(.9);
}

/* ================================================================
   ADDITIONAL IMAGES
   ================================================================ */
.additional-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.ref-img-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}
.ref-img-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ref-img-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ref-img-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, .7);
    color: var(--accent);
    font-size: 9px;
    text-align: center;
    padding: 2px;
    font-family: monospace;
}
.ref-img-add {
    width: 80px;
    height: 80px;
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    transition: all .2s;
}
.ref-img-add:active {
    border-color: var(--accent);
}
.ref-img-add .upload-icon {
    font-size: 24px;
    color: var(--text-muted);
}
.ref-img-add input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* ================================================================
   AUDIO ID INPUT
   ================================================================ */
.audio-id-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.audio-id-input-wrap .form-input {
    padding-right: 48px;
}
.audio-id-upload-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.15s;
    padding: 0;
}
.audio-id-upload-btn:hover {
    opacity: 0.85;
}
.audio-id-upload-btn.uploading,
.audio-id-upload-btn.processing {
    background: transparent;
    cursor: default;
}
.spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.spinner-sm.processing {
    border-top-color: var(--success);
}
.audio-id-copy-btn {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.audio-id-copy-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

/* ================================================================
   COST BAR
   ================================================================ */
.cost-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    margin: 20px 0 14px;
}
.cost-icon {
    font-size: 20px;
    color: var(--accent);
}
.cost-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
}
.cost-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ================================================================
   GENERATE BUTTON
   ================================================================ */
.btn-generate {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all .2s;
    letter-spacing: .3px;
    font-family: inherit;
}
.btn-generate:hover {
    background: var(--accent-hover);
}
.btn-generate:active {
    transform: scale(.98);
}
.btn-generate:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

/* ================================================================
   TEMPLATE BUTTONS
   ================================================================ */
.template-buttons {
    margin-top: 12px;
}
.template-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}
.template-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.template-btn {
    padding: 6px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all .15s;
}
.template-btn:active {
    transform: scale(.95);
    background: var(--accent-dim);
}
.template-btn.vid {
    color: var(--premium);
    border-color: var(--premium-border);
}
.template-btn.vid:active {
    background: var(--premium-dim);
}

/* ================================================================
   SUNO FORM CONTROLS
   ================================================================ */
.suno-time-row {
    display: flex;
    gap: 12px;
}
.suno-time-field {
    flex: 1;
}
.suno-time-field label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.suno-gen-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}
.suno-gen-input {
    flex: 1;
    min-width: 0;
}
.btn-suno-gen {
    white-space: nowrap;
    padding: 10px 16px;
    border: 1px solid var(--provider-Suno);
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--provider-Suno);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
    font-family: inherit;
}
.btn-suno-gen:hover {
    background: var(--provider-Suno);
    color: #fff;
}
.btn-suno-gen:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.btn-suno-remove {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.btn-suno-lyrics-suggest {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px dashed var(--provider-Suno);
    border-radius: var(--radius-md);
    color: var(--provider-Suno);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-suno-lyrics-suggest:hover {
    background: rgba(250, 35, 59, 0.06);
}
.btn-suno-lyrics-suggest:active {
    transform: scale(0.98);
}
.suno-style-link-btn {
    background: none;
    border: none;
    color: var(--provider-Suno);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.suno-style-link-btn:hover {
    opacity: 0.8;
}
.suno-style-link-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.suno-mashup-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.suno-mashup-item .form-input {
    flex: 1;
}
.suno-mode-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}
.suno-mode-tab {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    font-family: inherit;
}
.suno-mode-tab.active {
    background: var(--provider-Suno);
    color: #fff;
    border-color: var(--provider-Suno);
}
.suno-range-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.suno-range-row input[type="range"] {
    flex: 1;
}
.suno-range-val {
    min-width: 36px;
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Suno generation banner */
.suno-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    background: var(--provider-Suno);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 16px rgba(250, 35, 59, 0.25);
    transform: translateY(-100%);
    opacity: 0;
    transition: transform .35s cubic-bezier(.22, 1, .36, 1), opacity .35s ease;
}
.suno-banner.show {
    transform: translateY(0);
    opacity: 1;
}
.suno-banner.fading {
    opacity: 0;
    transform: translateY(-100%);
}
.suno-banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}
.suno-banner-icon {
    font-size: 18px;
}
.suno-banner-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.suno-banner-link {
    color: #fff;
    text-decoration: underline;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    text-underline-offset: 2px;
}
.suno-banner-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}
.suno-banner-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 0 2px 2px 0;
    animation: suno-banner-shrink 3s linear forwards;
}
@keyframes suno-banner-shrink {
    from { width: 100%; }
    to { width: 0%; }
}

/* ================================================================
   HISTORY LIST
   ================================================================ */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
}
.history-item .thumb {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    flex-shrink: 0;
    object-fit: cover;
}
.history-item .info { flex: 1; min-width: 0; }
.history-item .info .model-name { font-weight: 600; font-size: 0.9rem; }
.history-item .info .prompt-preview {
    color: var(--text-muted);
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.history-item .meta {
    text-align: right;
    flex-shrink: 0;
}
.history-item .meta .time { color: var(--text-dim); font-size: 0.78rem; }

/* History thumbs (MiniApp style) */
.history-thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
    position: relative;
}
.history-thumb video,
.history-thumb img,
.hist-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumb-play {
    width: 100%;
    height: 100%;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.thumb-play::after {
    content: '';
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent var(--accent);
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, .2));
}
.thumb-img-wrap {
    width: 100%;
    height: 100%;
    position: relative;
}
.thumb-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumb-audio {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--provider-Suno);
}
.thumb-lyrics {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--provider-Suno);
}

.history-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.history-info .prompt {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.history-info .meta {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    margin-top: 6px;
}
.status-badge.processing {
    background: var(--info-dim);
    color: var(--info);
}
.status-badge.completed {
    background: var(--success-dim);
    color: var(--success);
}
.status-badge.failed {
    background: var(--danger-dim);
    color: var(--danger);
}
.status-badge.pending {
    background: var(--warn-dim);
    color: var(--warn);
}

/* ================================================================
   GENERATION DETAIL
   ================================================================ */
.gen-detail {
    padding: 16px;
}
.media-container {
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-secondary);
    margin-bottom: 20px;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
}
.media-container video {
    width: 100%;
    height: auto;
    display: block;
}
.media-container.img-container {
    aspect-ratio: auto;
}
.gen-result-img {
    width: 100%;
    height: auto;
    display: block;
}
.processing-animation {
    text-align: center;
    padding: 48px 20px;
}
.processing-ring {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 1.2s linear infinite;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    gap: 12px;
}
.detail-row .label {
    color: var(--text-secondary);
    flex-shrink: 0;
    font-weight: 500;
}
.detail-row .value {
    color: var(--text);
    font-weight: 500;
    text-align: right;
    max-width: 65%;
    word-break: break-word;
}
.detail-actions {
    margin-top: 20px;
}
.gen-error-box {
    text-align: center;
    padding: 32px 20px;
    background: var(--danger-dim);
    border-radius: var(--radius-md);
}
.gen-error-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.gen-error-text {
    color: var(--danger);
    font-size: 14px;
    line-height: 1.5;
    font-weight: 500;
}
.gen-detail-repeat {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.gen-detail-repeat .btn-secondary {
    width: 100%;
}

/* ================================================================
   EMPTY STATES
   ================================================================ */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    color: var(--text-muted);
}
.empty-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--text-muted);
    opacity: .5;
}
.empty-state p {
    font-size: 15px;
    font-weight: 500;
}

/* ================================================================
   PROFILE
   ================================================================ */
.profile-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    padding: 16px;
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-card .stat-label { color: var(--text-muted); font-size: 0.82rem; margin-top: 4px; }
.stat-num {
    font-size: 22px;
    font-weight: 700;
}
.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
    padding: 18px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.profile-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.profile-name {
    font-size: 17px;
    font-weight: 700;
}
.profile-username {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 1px;
}

.credits-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    margin-bottom: 16px;
}
.credits-total {
    text-align: center;
    margin-bottom: 16px;
}
.credits-total .number {
    font-size: 40px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
}
.credits-total .label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}
.credits-breakdown {
    display: flex;
    gap: 10px;
}
.credits-breakdown .item {
    flex: 1;
    text-align: center;
    padding: 12px;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.credits-breakdown .num {
    font-size: 20px;
    font-weight: 700;
}
.credits-breakdown .lbl {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sub-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.sub-card.active {
    border-color: var(--accent-border);
    background: var(--accent-dim);
}
.sub-status {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}
.sub-details {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

/* Support section in profile */
.support-section {
    margin-top: 16px;
}
.support-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    color: var(--text);
}
.support-link:active {
    background: var(--bg-hover);
}
.support-link-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--info-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--info);
    flex-shrink: 0;
}
.support-link-text {
    flex: 1;
}
.support-link-title {
    font-size: 14px;
    font-weight: 600;
}
.support-link-sub {
    font-size: 12px;
    color: var(--text-muted);
}

/* ================================================================
   BALANCE HISTORY
   ================================================================ */
.bal-hist-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.bal-hist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}
.bal-hist-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}
.bal-hist-icon.positive {
    background: rgba(16, 163, 127, 0.12);
    color: var(--accent);
}
.bal-hist-icon.negative {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}
.bal-hist-info {
    flex: 1;
    min-width: 0;
}
.bal-hist-desc {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}
.bal-hist-meta {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}
.bal-hist-amount {
    font-size: 15px;
    font-weight: 600;
    flex-shrink: 0;
}
.bal-hist-amount.positive {
    color: var(--accent);
}
.bal-hist-amount.negative {
    color: var(--danger);
}
.bal-hist-dates {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    margin-bottom: 12px;
}
.bal-hist-date-field {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    cursor: pointer;
    transition: border-color 0.2s;
}
.bal-hist-date-field:active {
    border-color: var(--accent);
}
.bal-hist-date-field svg {
    flex-shrink: 0;
    color: var(--text-secondary);
}
.bal-hist-date-text {
    font-size: 13px;
    color: var(--text-secondary);
}
.bal-hist-date-field input[type="date"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

/* ================================================================
   TARIFF CARDS
   ================================================================ */
.tariff-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}
.tariff-card {
    padding: 24px;
    text-align: center;
    position: relative;
}
.tariff-card.current { border-color: var(--primary); }
.tariff-card .tariff-name { font-size: 1.2rem; font-weight: 700; }
.tariff-card .tariff-price { font-size: 1.8rem; font-weight: 800; margin: 12px 0 4px; }
.tariff-card .tariff-price small { font-size: 0.8rem; font-weight: 400; color: var(--text-muted); }
.tariff-card .tariff-tokens { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 16px; }
.tariff-card .tariff-discount {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--success-light);
    color: var(--success);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Buy credits / packages */
.packages-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.package-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 12px;
    text-align: center;
    cursor: pointer;
    transition: all .2s;
}
.package-card:active {
    border-color: var(--accent);
    transform: scale(.97);
}
.credits-num {
    font-size: 24px;
    font-weight: 800;
    color: var(--accent);
}
.credits-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.stars-price {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--premium-dim);
    padding: 5px 12px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    color: var(--premium);
    border: 1px solid var(--premium-border);
}

/* Locked notice */
.locked-notice {
    padding: 28px 20px;
    background: var(--danger-dim);
    border: 1px solid rgba(239, 68, 68, .15);
    border-radius: var(--radius-lg);
    text-align: center;
}
.locked-icon {
    font-size: 36px;
    margin-bottom: 10px;
}
.locked-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ================================================================
   ALERTS
   ================================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 16px;
}
.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger  { background: var(--danger-light);  color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); }
.alert-info    { background: var(--primary-light);  color: var(--primary); }

/* ================================================================
   TOAST
   ================================================================ */
.toast {
    position: fixed;
    top: 16px;
    left: 16px;
    right: 16px;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    z-index: 500;
    transform: translateY(calc(-100% - 100px));
    opacity: 0;
    transition: transform .35s cubic-bezier(.22, 1, .36, 1), opacity .35s ease;
    text-align: center;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.toast.show {
    transform: translateY(0);
    opacity: 1;
}
.toast.success {
    background: var(--info);
    color: #fff;
}
.toast.error {
    background: var(--danger);
    color: #fff;
}
.toast.info {
    background: var(--info);
    color: #fff;
}
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 0 2px 2px 0;
    animation: toast-shrink 3s linear forwards;
}
@keyframes toast-shrink {
    from { width: 100%; }
    to { width: 0%; }
}

/* ================================================================
   LOADING SPINNER
   ================================================================ */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 12px;
    color: var(--text-muted);
}

/* Loading screen (splash) */
#loading-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    z-index: 1000;
    transition: opacity .4s ease, visibility .4s;
}
#loading-screen:not(.active) {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}
.loading-content {
    text-align: center;
}
.logo-text {
    font-size: 44px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 6px;
    animation: logoPulse 2.5s ease-in-out infinite;
}
.loading-sub {
    color: var(--text-muted);
    font-size: 13px;
    margin: 8px 0 24px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}
@keyframes logoPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .7; transform: scale(.98); }
}

/* ================================================================
   ELEMENT IDS
   ================================================================ */
.element-ids-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.element-id-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-full);
    padding: 5px 12px;
}
.element-id-tag {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    font-family: monospace;
}
.element-id-remove {
    width: 18px;
    height: 18px;
    background: transparent;
    border: none;
    color: var(--danger);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.element-id-input-row {
    display: flex;
    gap: 8px;
}
.element-id-input {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color .2s;
}
.element-id-input:focus {
    border-color: var(--border-focus);
}
.element-id-add-btn {
    padding: 10px 18px;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all .15s;
}
.element-id-add-btn:active {
    transform: scale(.97);
}

/* ================================================================
   AUDIO DETAIL
   ================================================================ */
.audio-result {
    margin-bottom: 16px;
}
.audio-tracks-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.audio-tab {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.audio-tab.active {
    background: var(--provider-Suno);
    color: #fff;
    border-color: var(--provider-Suno);
}
.audio-track-panel {
    display: none;
}
.audio-track-panel.active {
    display: block;
}
.audio-cover-art {
    width: 200px;
    height: 200px;
    margin: 0 auto 16px;
    border-radius: 12px;
    overflow: hidden;
}
.audio-cover-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.audio-title {
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: var(--text);
}
.audio-style {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 12px;
}
.audio-player {
    width: 100%;
    margin-bottom: 8px;
    border-radius: 8px;
}
.audio-duration {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 12px;
}
.audio-lyrics-block {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.audio-lyrics-toggle {
    display: block;
    width: 100%;
    padding: 10px 16px;
    background: var(--bg-input);
    border: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
}
.audio-lyrics-content {
    display: none;
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
}
.audio-lyrics-content pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}
.audio-lyrics-block.open .audio-lyrics-content {
    display: block;
}
.audio-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.audio-suno-id {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    font-size: 12px;
}
.audio-suno-id-label {
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}
.audio-suno-id-value {
    color: var(--text-muted);
    font-family: monospace;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.audio-suno-id-copy {
    border: none;
    background: none;
    color: var(--accent);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.audio-suno-id-copy:active {
    opacity: 0.7;
}

/* ================================================================
   PRESET GRID
   ================================================================ */
.preset-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}
.preset-card {
    padding: 12px 8px;
    text-align: center;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all .15s;
}
.preset-card.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.preset-card:active {
    transform: scale(.96);
}
.preset-label {
    font-size: 11px;
    font-weight: 600;
}

/* ================================================================
   MODALS
   ================================================================ */

/* Lyrics modal */
.lyrics-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 20px;
}
.lyrics-modal-overlay.show {
    opacity: 1;
}
.lyrics-modal {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.25s;
}
.lyrics-modal-overlay.show .lyrics-modal {
    transform: translateY(0);
}
.lyrics-modal-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 12px;
    display: block;
}
.lyrics-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.lyrics-modal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}
.lyrics-modal-price {
    font-size: 13px;
    font-weight: 600;
    color: var(--provider-Suno);
    margin-bottom: 20px;
}
.lyrics-modal-btn {
    width: 100%;
    padding: 12px;
    background: var(--provider-Suno);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: opacity 0.15s;
    font-family: inherit;
}
.lyrics-modal-btn:hover {
    opacity: 0.9;
}
.lyrics-modal-cancel {
    width: 100%;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}
.lyrics-modal-cancel:hover {
    color: var(--text);
}

/* Audio upload modal */
.audio-upload-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 20px;
}
.audio-upload-modal-overlay.show {
    opacity: 1;
}
.audio-upload-modal {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.25s;
}
.audio-upload-modal-overlay.show .audio-upload-modal {
    transform: translateY(0);
}
.audio-upload-modal-icon {
    font-size: 40px;
    line-height: 1;
    margin-bottom: 12px;
}
.audio-upload-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.audio-upload-modal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
}
.audio-upload-modal-btn {
    width: 100%;
    padding: 12px;
    background: var(--provider-Suno);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 10px;
    transition: opacity 0.15s;
    font-family: inherit;
}
.audio-upload-modal-btn:hover {
    opacity: 0.9;
}
.audio-upload-modal-cancel {
    width: 100%;
    padding: 10px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}
.audio-upload-modal-cancel:hover {
    color: var(--text);
}

/* Error modal */
.error-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 20px;
}
.error-modal-overlay.show {
    opacity: 1;
}
.error-modal {
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    max-width: 340px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.25s;
    border-top: 3px solid var(--danger);
}
.error-modal-overlay.show .error-modal {
    transform: translateY(0);
}
.error-modal-icon {
    color: var(--danger);
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}
.error-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.error-modal-msg {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 20px;
    word-break: break-word;
}
.error-modal-btn {
    width: 100%;
    padding: 12px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
    font-family: inherit;
}
.error-modal-btn:hover {
    opacity: 0.9;
}

/* ================================================================
   PERSONA / LYRICS RESULT DETAIL
   ================================================================ */
.persona-result {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.persona-result-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.persona-result-row:last-child {
    margin-bottom: 0;
}
.persona-result-label {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 80px;
    flex-shrink: 0;
}
.persona-result-value {
    font-size: 14px;
    color: var(--text);
    font-family: monospace;
    word-break: break-all;
    flex: 1;
}
.lyrics-result {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}
.lyrics-result-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    text-align: center;
}
.lyrics-result-text {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}
.lyrics-result-text pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin: 0;
}
.btn-copy-lyrics {
    width: 100%;
    padding: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-copy-lyrics:hover {
    border-color: var(--provider-Suno);
    color: var(--provider-Suno);
}

/* Remix audio info modal */
.remix-audio-info-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}
.remix-audio-info-desc li {
    margin-bottom: 6px;
}
.remix-audio-info-desc li:last-child {
    margin-bottom: 0;
}

/* ================================================================
   PAGE TRANSITION
   ================================================================ */
@keyframes pageIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.page {
    animation: pageIn .2s ease-out;
}

/* ================================================================
   TABLES
   ================================================================ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.5px; }

/* ================================================================
   PAGINATION
   ================================================================ */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 20px; }
.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: var(--text-muted);
}
.pagination a:hover { background: var(--primary-light); color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; }

/* ================================================================
   404
   ================================================================ */
.page-404 { text-align: center; padding: 80px 20px; }
.page-404 h1 { font-size: 4rem; font-weight: 800; color: var(--primary); }
.page-404 p { color: var(--text-muted); margin: 12px 0 24px; }

/* ================================================================
   SCROLLBAR
   ================================================================ */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* ================================================================
   UTILITY
   ================================================================ */
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-center  { text-align: center; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.gap-8  { gap: 8px; }
.gap-16 { gap: 16px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.hidden { display: none !important; }

/* --- Mobile menu overlay --- */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: 200;
    display: none;
    align-items: flex-start;
    justify-content: flex-end;
    padding-top: var(--header-h);
}
.mobile-menu-overlay.open { display: flex; }
.mobile-menu {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    width: 260px;
    padding: 8px;
}
.mobile-menu-link {
    display: block;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
}
.mobile-menu-link:hover { background: var(--primary-light); color: var(--primary); }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 380px) {
    .mode-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 340px) {
    .variant-grid {
        gap: 6px;
    }
    .variant-card {
        padding: 12px 8px;
    }
}

@media (min-width: 420px) {
    .gen-form {
        padding: 22px;
    }
    .ratio-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    :root { --container-w: 100%; }
    .main-nav { display: none; }
    .mobile-menu-toggle { display: inline-flex; }
    .header-right .btn { display: none; }
    .model-grid { grid-template-columns: 1fr; }
    .tariff-grid { grid-template-columns: 1fr; }
    .profile-stats { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { flex-direction: column; text-align: center; }
    .footer-links { justify-content: center; }
}

@media (min-width: 769px) {
    .mobile-menu-toggle { display: none; }
    .mobile-menu-overlay { display: none !important; }
}
