/* LORA AI Mini App - Neon Cyber Studio Theme */

:root {
    /* Core palette */
    --bg-deep: #05050a;
    --bg-base: #0a0a12;
    --bg-elevated: #12121f;
    --bg-card: rgba(18, 18, 31, 0.7);

    /* Neon accents */
    --neon-cyan: #00f5ff;
    --neon-magenta: #ff00ff;
    --neon-purple: #8b5cf6;
    --neon-blue: #3b82f6;
    --neon-green: #00ff88;
    --neon-orange: #ff6b35;

    /* Единый красный (NEW-бейджи, лайки, ошибки, акценты) */
    --red: #ff3b3b;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-magenta) 100%);
    --gradient-card: linear-gradient(145deg, rgba(139, 92, 246, 0.15) 0%, rgba(0, 245, 255, 0.08) 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);

    /* Effects */
    --glow-cyan: 0 0 20px rgba(0, 245, 255, 0.5);
    --glow-magenta: 0 0 20px rgba(255, 0, 255, 0.5);
    --glow-purple: 0 0 30px rgba(139, 92, 246, 0.4);

    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    /* Animation */
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Animated Background */
.bg-mesh {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(139, 92, 246, 0.15), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 245, 255, 0.1), transparent),
        var(--bg-deep);
    z-index: -3;
}

.bg-grid {
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -2;
}

.bg-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    z-index: -1;
    animation: floatGlow 8s ease-in-out infinite;
}

.bg-glow-1 {
    background: var(--neon-purple);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.bg-glow-2 {
    background: var(--neon-cyan);
    bottom: 20%;
    left: -100px;
    animation-delay: -4s;
}

@keyframes floatGlow {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, 20px) scale(1.1); }
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 12px 16px;
    background: rgba(5, 5, 10, 0.8);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
}

.logo-icon svg {
    width: 100%;
    height: 100%;
}

.logo-text {
    font-family: 'Exo 2', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-ai {
    font-weight: 800;
}

.balance-chip {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
    overflow: hidden;
}

.balance-chip-glow {
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.balance-chip:hover .balance-chip-glow {
    opacity: 0.1;
}

.balance-chip-icon {
    font-size: 14px;
    position: relative;
    z-index: 1;
}

.balance-chip-value {
    position: relative;
    z-index: 1;
}

/* Main Content */
.main-content {
    padding: 16px;
    padding-bottom: 100px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Staggered entrance animation */
.main-content > section {
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.6s var(--ease-out-expo) forwards;
    animation-delay: calc(var(--delay) * 0.1s);
}

@keyframes slideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hero Card */
.hero-card {
    position: relative;
    border-radius: var(--radius-xl);
    padding: 24px;
    overflow: hidden;
}

.hero-card-bg {
    position: absolute;
    inset: 0;
    background: var(--gradient-primary);
    opacity: 0.9;
}

.hero-card-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 20%, rgba(255,255,255,0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(0,0,0,0.3) 0%, transparent 50%);
}

.hero-card-content {
    position: relative;
    z-index: 1;
}

.hero-profile {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.avatar-ring {
    padding: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
}

.avatar {
    width: 56px;
    height: 56px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.avatar-emoji {
    font-size: 28px;
}

.hero-info {
    flex: 1;
}

.hero-name {
    font-family: 'Exo 2', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(255,255,255,0.15);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: var(--neon-green);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--neon-green);
}

.balance-showcase {
    text-align: center;
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-radius: var(--radius-lg);
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.balance-label {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.balance-amount {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

.balance-number {
    font-family: 'Exo 2', sans-serif;
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 0 40px rgba(255,255,255,0.3);
}

.balance-unit {
    font-size: 16px;
    opacity: 0.8;
}

.balance-held {
    margin-top: 12px;
    font-size: 13px;
    opacity: 0.7;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cta-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-lg);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
    backdrop-filter: blur(10px);
}

.cta-button:active {
    transform: scale(0.97);
    background: rgba(255,255,255,0.25);
}

.cta-arrow {
    transition: transform 0.3s;
}

.cta-button:hover .cta-arrow {
    transform: translateX(4px);
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-xl);
    padding: 20px;
}

/* Section Label */
.section-label {
    font-family: 'Exo 2', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

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

.section-header .section-label {
    margin-bottom: 0;
}

.see-all-btn {
    background: none;
    border: none;
    color: var(--neon-cyan);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: gap 0.3s;
}

.see-all-btn:hover {
    gap: 8px;
}

/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s var(--ease-spring);
}

.action-card:active {
    transform: scale(0.95);
}

.action-card:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.1);
}

.action-icon-wrap {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-card);
    border-radius: var(--radius-md);
}

.action-icon {
    font-size: 22px;
}

.action-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.action-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: -4px;
}

/* Stats */
.stats-row {
    display: flex;
    align-items: center;
}

.stat-block {
    flex: 1;
    text-align: center;
    padding: 8px;
}

.stat-number {
    display: block;
    font-family: 'Exo 2', sans-serif;
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.stat-name {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.1);
}

/* History Gallery */
.history-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.history-thumb {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--gradient-card);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s var(--ease-spring);
}

.history-thumb:active {
    transform: scale(0.95);
}

.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(0, 245, 255, 0.2));
}

.history-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
}

.loader {
    width: 32px;
    height: 32px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Models Scroll */
.models-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.models-scroll::-webkit-scrollbar {
    display: none;
}

.model-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
}

.model-chip:hover {
    background: rgba(139, 92, 246, 0.25);
    border-color: rgba(139, 92, 246, 0.4);
}

.model-icon {
    font-size: 16px;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300; /* выше .page (z-index:200), чтобы навигация всегда была видна */
    display: flex;
    justify-content: space-around;
    padding: 8px 16px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
}

.nav-bg {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 10, 0.9);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255,255,255,0.05);
}

.nav-btn {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.2s;
}

.nav-btn:active {
    transform: scale(0.9);
}

.nav-icon-wrap {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon {
    width: 22px;
    height: 22px;
    color: var(--text-muted);
    transition: all 0.3s;
}

.nav-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    transition: color 0.3s;
}

.nav-btn.active .nav-icon {
    color: var(--neon-cyan);
    filter: drop-shadow(0 0 8px var(--neon-cyan));
}

.nav-btn.active .nav-label {
    color: var(--neon-cyan);
}

/* FAB "Создать" — приподнятая круглая кнопка в центре нижней навигации */
.nav-fab {
    position: relative;
    margin-top: -28px;
    padding-top: 0;
}

.nav-fab-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, var(--neon-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(34, 211, 238, 0.45),
                0 0 0 4px rgba(5, 5, 10, 0.9),
                0 0 20px rgba(34, 211, 238, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}

.nav-fab:active .nav-fab-circle {
    transform: scale(0.92);
}

.nav-fab-circle svg {
    width: 28px;
    height: 28px;
    color: #fff;
}

.nav-fab .nav-label {
    color: var(--text-primary);
    margin-top: 2px;
}

/* Create Sheet — bottom sheet с 3x3 сеткой быстрого доступа */
.create-sheet {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.25s, visibility 0.25s;
}

.create-sheet.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.create-sheet-content {
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(18, 18, 28, 0.98), rgba(10, 10, 18, 0.98));
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
    transform: translateY(0);
    transition: transform 0.3s var(--ease-out-expo);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.create-sheet.hidden .create-sheet-content {
    transform: translateY(100%);
}

.create-sheet-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 0 auto 12px;
}

.create-sheet-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin: 0 0 16px;
}

.create-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* Заголовки групп в шите «Создать» (Фото/Видео/Музыка/Инструменты) */
.create-group-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary, #9aa0b4);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    margin: 18px 4px 10px;
}
.create-group-label:first-of-type {
    margin-top: 4px;
}

.create-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s, border-color 0.2s;
    min-height: 96px;
}

.create-card:active {
    transform: scale(0.94);
    background: rgba(34, 211, 238, 0.08);
    border-color: rgba(34, 211, 238, 0.3);
}

/* Выделение новинки — Seedance 2.5 */
.create-card--new {
    position: relative;
    border-color: #7b5cff;
    box-shadow: 0 0 16px rgba(123, 92, 255, 0.45);
    background: rgba(123, 92, 255, 0.08);
}
.create-card-badge-new {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 8px;
    z-index: 2;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.create-card-icon {
    font-size: 28px;
    line-height: 1;
}

.create-card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    line-height: 1.2;
}

.create-card-sub {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.2;
}

/* Placeholder-страницы create-* */
.create-placeholder {
    padding: 24px 16px;
}

.coming-soon {
    text-align: center;
    padding: 32px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 20px;
}

.coming-soon-icon {
    font-size: 64px;
    margin-bottom: 16px;
    line-height: 1;
}

.coming-soon h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.coming-soon p {
    color: var(--text-secondary);
    margin: 8px 0;
    line-height: 1.4;
}

.coming-soon-note {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 16px !important;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.coming-soon .generate-btn {
    margin-top: 20px;
}

.coming-soon .btn-secondary {
    margin-top: 12px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}

.coming-soon .btn-secondary:active {
    background: rgba(255, 255, 255, 0.1);
}

/* === Custom Create Forms (Phase B+) === */
.cc-form-section {
    margin: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
}

.cc-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.cc-photo-grid {
    display: grid;
    gap: 8px;
    /* Дефолт для всех вариантов (включая Seedance v2 с 9 слотами) — 3 колонки.
       Узкие 1/2-слотовые варианты переопределяются ниже. */
    grid-template-columns: repeat(3, 1fr);
}
.cc-photo-grid-1 { grid-template-columns: 1fr; }
.cc-photo-grid-2 { grid-template-columns: 1fr 1fr; }
/* Для 3+ слотов используем общий дефолт (3 колонки). cc-photo-grid-3..9 — не нужны
   отдельные правила, дефолт сработает. */

.cc-photo-slot {
    position: relative;
    /* Для grid из 1 слота — высокий портрет (3/4). Для всех остальных —
       квадрат, чтобы 9 слотов не растягивали экран в столбец. */
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, background 0.2s;
}
.cc-photo-grid-1 .cc-photo-slot { aspect-ratio: 3/4; }

.cc-photo-slot:active {
    transform: scale(0.97);
}

.cc-photo-slot:has(.cc-photo-preview[style*="block"]) {
    border: 1px solid rgba(34, 211, 238, 0.4);
}

.cc-photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.cc-photo-icon {
    font-size: 24px;
}

.cc-photo-label {
    font-size: 11px;
    text-align: center;
    padding: 0 4px;
}

.cc-required {
    color: var(--red);
    margin-left: 2px;
}

.cc-photo-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cc-photo-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    border: none;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.cc-textarea {
    width: 100%;
    min-height: 90px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    box-sizing: border-box;
}

.cc-aspect-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* === Seedance v2: toggle row, media slots, prompt @-autocomplete === */

.cc-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    user-select: none;
}
.cc-toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--neon-cyan);
    cursor: pointer;
}
.cc-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.cc-toggle-hint {
    margin-top: 6px;
    padding: 0 4px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.cc-media-grid {
    margin-top: 10px;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(3, 1fr);
}
.cc-media-grid.hidden { display: none; }

.cc-media-slot {
    position: relative;
    aspect-ratio: 1;
    background: rgba(255,255,255,0.03);
    border: 1px dashed rgba(255,255,255,0.18);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.cc-media-slot:hover {
    border-color: rgba(34,211,238,0.45);
    background: rgba(34,211,238,0.04);
}
.cc-media-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    color: var(--text-muted);
}
.cc-media-placeholder .cc-photo-icon {
    font-size: 22px;
}
.cc-media-placeholder .cc-photo-label {
    font-size: 11px;
    font-weight: 500;
}
.cc-media-preview {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(34,211,238,.18), rgba(155,130,255,.18));
}
.cc-media-tag {
    font-weight: 700;
    color: #fff;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.cc-prompt-hint {
    margin-top: 8px;
    padding: 10px 12px;
    background: rgba(34,211,238,0.07);
    border: 1px solid rgba(34,211,238,0.18);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.cc-prompt-hint code {
    background: rgba(255,255,255,0.08);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11.5px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--neon-cyan);
}

.cc-autocomplete {
    margin-top: 4px;
    background: #1a1d2e;
    border: 1px solid rgba(34,211,238,0.35);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    max-height: 180px;
    overflow-y: auto;
}
.cc-autocomplete.hidden { display: none; }
.cc-autocomplete-item {
    padding: 8px 12px;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    color: var(--text-primary);
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cc-autocomplete-item:last-child { border-bottom: none; }
.cc-autocomplete-item:hover,
.cc-autocomplete-item.active {
    background: rgba(34,211,238,0.18);
    color: #fff;
}
.cc-autocomplete-empty {
    padding: 10px 12px;
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.cc-aspect-chip {
    padding: 8px 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 999px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s ease;
    font-family: inherit;
}
.cc-aspect-chip:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.16);
}
.cc-aspect-chip.selected {
    background: linear-gradient(135deg, rgba(34,211,238,.22), rgba(155,130,255,.22));
    border-color: rgba(34,211,238,0.55);
    color: #fff;
    box-shadow: 0 0 12px rgba(34,211,238,.25);
}

.cc-textarea:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.4);
}

.cc-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: calc(100% - 32px);
    margin: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #3b82f6, var(--neon-cyan));
    border: none;
    border-radius: 14px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(34, 211, 238, 0.3);
    transition: transform 0.15s, box-shadow 0.2s;
}

.cc-submit-btn:active {
    transform: scale(0.98);
}

.cc-submit-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.cc-characters {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 8px;
}

.cc-characters-empty {
    grid-column: 1/-1;
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

.cc-character {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.2s;
}

.cc-character:active {
    transform: scale(0.95);
}

.cc-character.selected {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.35);
}

.cc-character img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cc-character-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 3px 4px;
    background: linear-gradient(0deg, rgba(0,0,0,0.85), transparent);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-character-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--neon-cyan);
    color: #000;
    font-weight: 900;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
}

.cc-character.selected .cc-character-check {
    display: flex;
}

/* Блок выбора персонажей внутри trending/idea/photoset модалки */
.modal-characters-section {
    margin: 12px 16px 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 14px;
}
.modal-characters-section .cc-form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}
.modal-char-create-btn {
    margin-top: 10px;
    width: 100%;
    padding: 10px 14px;
    border: 1px dashed rgba(139, 92, 246, 0.5);
    background: transparent;
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.modal-char-create-btn:hover {
    background: rgba(139, 92, 246, 0.12);
    border-style: solid;
}

.cc-status {
    margin: 16px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.cc-status-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(34, 211, 238, 0.2);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

.cc-status-body {
    flex: 1;
    min-width: 0;
}

.cc-status-text {
    color: var(--text-primary);
    font-size: 14px;
}

.cc-status-progress {
    color: var(--neon-cyan);
    font-weight: 700;
}

.cc-status-hint {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
}

.cc-result {
    margin: 16px;
    padding: 16px;
    background: rgba(34, 211, 238, 0.05);
    border: 1px solid rgba(34, 211, 238, 0.25);
    border-radius: 16px;
}

.cc-result-header {
    font-size: 16px;
    font-weight: 700;
    color: var(--neon-cyan);
    margin-bottom: 12px;
    text-align: center;
}

.cc-result-media {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 12px;
}

.cc-result-actions {
    display: flex;
    justify-content: center;
}

.cc-result-btn {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

/* SUNO mode toggle */
.suno-mode-btn {
    flex: 1;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.suno-mode-btn.active {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.4);
    color: var(--neon-cyan);
}

.suno-track {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}

.suno-track:last-child {
    margin-bottom: 0;
}

.suno-track-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.suno-track-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.suno-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.suno-chip {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 18px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.suno-chip:active {
    transform: scale(0.95);
}

.suno-chip.active {
    background: rgba(34, 211, 238, 0.15);
    border-color: rgba(34, 211, 238, 0.5);
    color: var(--neon-cyan);
    font-weight: 700;
}

.suno-lyrics-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.suno-ai-btn {
    padding: 8px 14px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(34, 211, 238, 0.2));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    color: #a78bfa;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s;
}

.suno-ai-btn:active {
    transform: scale(0.95);
}

.suno-ai-lyrics-box {
    margin-bottom: 12px;
    padding: 12px;
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
}

.suno-ai-generate-btn {
    flex: 1;
    padding: 10px;
    background: linear-gradient(135deg, #8b5cf6, var(--neon-cyan));
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.suno-ai-generate-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.suno-ai-status {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.btn-secondary {
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
}

/* === Banners carousel === */
.banners-section {
    margin: 6px 0 8px;
    padding: 0;
}

.banners-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding: 0 16px;
}

.banners-track::-webkit-scrollbar { display: none; }

.banner-slide {
    flex: 0 0 calc(100% - 32px);
    scroll-snap-align: center;
    position: relative;
    height: 96px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    transition: transform 0.15s;
}

.banner-slide:active {
    transform: scale(0.98);
}

.banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.banner-preset {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-preset.gradient-blue   { background: linear-gradient(135deg, #3b82f6, #06b6d4); }
.banner-preset.gradient-purple { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.banner-preset.gradient-orange { background: linear-gradient(135deg, #f97316, #ef4444); }
.banner-preset.gradient-green  { background: linear-gradient(135deg, #10b981, #06b6d4); }
.banner-preset.gradient-gold   { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.banner-preset.gradient-dark   { background: linear-gradient(135deg, #1e293b, #22d3ee); }

.banner-preset-icon {
    font-size: 40px;
    opacity: 0.7;
}

.banner-overlay {
    position: absolute;
    inset: 0;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.65) 0%, rgba(0, 0, 0, 0.1) 60%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
}

.banner-title {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

.banner-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 11px;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.banners-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 6px;
}

.banner-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    transition: all 0.25s;
    cursor: pointer;
}

.banner-dot.active {
    width: 20px;
    border-radius: 3px;
    background: var(--neon-cyan);
}

/* Stories-кружочки тегов */
.stories-section {
    margin: 2px 0 8px;
    padding: 0;
}

.stories-track {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 14px;
    padding: 4px 16px 8px;
}

.stories-track::-webkit-scrollbar { display: none; }

.tag-story {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    width: 60px;
    transition: transform 0.15s;
}

.tag-story:active {
    transform: scale(0.94);
}

.tag-story-ring {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    padding: 2px;
    background: conic-gradient(from 180deg, var(--neon-cyan), var(--neon-magenta), #8b5cf6, var(--neon-cyan));
    box-shadow: 0 2px 10px rgba(139, 92, 246, 0.3);
}

.tag-story-inner {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid var(--bg-primary, #0b0b12);
}

.tag-story-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Кружок-вход в каталог фотосетов: красная обводка + бейдж NEW */
.tag-story-photosets {
    position: relative;
}
.tag-story-photosets .tag-story-ring {
    background: conic-gradient(from 180deg, #ff3b3b, var(--red), var(--red), #ff3b3b);
    box-shadow: 0 2px 12px rgba(255, 59, 48, 0.5);
}
.tag-story-badge-new {
    position: absolute;
    top: -3px;
    right: 2px;
    background: #ff3b3b;
    color: #fff;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.4px;
    padding: 2px 5px;
    border-radius: 8px;
    z-index: 2;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.tag-story-name {
    font-size: 10px;
    line-height: 1.2;
    color: var(--text-secondary, rgba(255,255,255,0.85));
    text-align: center;
    max-width: 60px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seedance-warning {
    background: rgba(255, 159, 67, 0.12);
    border: 1px solid rgba(255, 159, 67, 0.3);
    color: #ffb870;
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.4;
}

/* Ползунок длительности (Seedance 2.5) */
.cc-duration-slider {
    width: 100%;
    margin: 8px 0 2px;
    accent-color: #7b61ff;
}
.cc-slider-scale {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Живой расчёт стоимости (Seedance 2.5) */
.cc-liveprice {
    background: rgba(123, 97, 255, 0.12);
    border: 1px solid rgba(123, 97, 255, 0.3);
    color: #c3b7ff;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
}

/* Кнопки разделов в профиле (Галерея / Партнёрский кабинет) */
.profile-sections-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.profile-section-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s, border-color 0.2s;
    text-align: left;
}

.profile-section-btn:active {
    transform: scale(0.98);
    background: rgba(34, 211, 238, 0.08);
    border-color: rgba(34, 211, 238, 0.3);
}

.profile-section-icon {
    font-size: 24px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    flex-shrink: 0;
}

.profile-section-body {
    flex: 1;
    min-width: 0;
}

.profile-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.profile-section-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.profile-section-arrow {
    color: var(--text-muted);
    font-size: 18px;
    flex-shrink: 0;
}

/* Pages */
.page {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--bg-deep);
    overflow-y: auto;
    /* запас под bottom-nav (≈80px) + safe-area, чтобы последний контент не прятался под навигацию */
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-out-expo);
}

.page:not(.hidden) {
    transform: translateX(0);
}

.page.hidden {
    pointer-events: none;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: rgba(5, 5, 10, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.back-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.05);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.back-btn:active {
    background: rgba(255,255,255,0.1);
}

.back-btn svg {
    width: 20px;
    height: 20px;
    color: var(--text-primary);
}

.page-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 18px;
    font-weight: 600;
}

.page-content {
    padding: 16px;
    padding-bottom: 100px;
}

/* Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.gallery-item {
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--gradient-card);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s var(--ease-spring);
}

.gallery-item:active {
    transform: scale(0.97);
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.gallery-likes {
    font-size: 11px;
    color: var(--red);
    font-weight: 500;
}
.pub-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 6px;
    line-height: 1.4;
}
.pub-approved { background: rgba(94, 230, 168, 0.18); color: #5ee6a8; }
.pub-pending  { background: rgba(255, 200, 97, 0.18); color: #ffc861; }
.pub-rejected { background: rgba(255, 107, 138, 0.18); color: var(--red); }

/* Идея → блок автора в модалке */
.idea-author { margin: 12px 16px 0; }
.idea-author-btn {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 10px 12px; border: 1px solid var(--border, rgba(255,255,255,0.1));
    background: rgba(123,91,255,0.08); border-radius: 12px;
    color: inherit; cursor: pointer; text-align: left;
    transition: background 0.2s, transform 0.1s;
}
.idea-author-btn:hover { background: rgba(123,91,255,0.16); }
.idea-author-btn:active { transform: scale(0.98); }
.idea-author-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
    color: #fff; font-weight: 700; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 36px;
}
.idea-author-info { display: flex; flex-direction: column; gap: 2px; }
.idea-author-name { font-size: 14px; font-weight: 600; }
.idea-author-sub  { font-size: 11px; color: var(--text3, #9B8FC9); }

/* Баннер «Идеи: <Автор>» наверху страницы Идеи */
.author-filter-banner {
    display: flex; align-items: center; gap: 10px;
    background: rgba(123,91,255,0.12); border: 1px solid rgba(123,91,255,0.3);
    border-radius: 12px; padding: 10px 12px; margin-bottom: 12px;
}
.author-filter-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, #8B5CF6, #EC4899);
    color: #fff; font-weight: 700; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    flex: 0 0 32px;
}
.author-filter-text { flex: 1; font-size: 14px; color: inherit; }
.author-filter-clear {
    background: transparent; border: none; color: var(--text3, #9B8FC9);
    font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 8px;
}
.author-filter-clear:hover { color: var(--text, #fff); background: rgba(255,255,255,0.06); }

/* === Статусы карточек галереи (когда нет result_url) === */
.gallery-state {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 6px; padding: 12px;
    text-align: center;
}
.gallery-state-label {
    font-size: 13px; font-weight: 600;
}
.gallery-state-sub {
    font-size: 10px; opacity: 0.7; line-height: 1.3;
}
/* В процессе — пульсирующий лоадер, фиолетовая тонировка */
.gallery-item-progress {
    background: linear-gradient(135deg, rgba(123,91,255,0.16), rgba(236,72,153,0.12));
    border: 1px solid rgba(123,91,255,0.28);
}
.gallery-state-progress { color: #d6ccff; }
.gallery-state-spinner {
    width: 26px; height: 26px; border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,0.18);
    border-top-color: #a78bfa;
    animation: gallerySpin 0.9s linear infinite;
}
@keyframes gallerySpin { to { transform: rotate(360deg); } }
/* Не удалось — красноватая тонировка */
.gallery-item-failed {
    background: rgba(255, 107, 138, 0.08);
    border: 1px solid rgba(255, 107, 138, 0.25);
}
.gallery-state-failed { color: var(--red); }
.gallery-state-failed .gallery-state-icon {
    font-size: 22px; line-height: 1;
}

.gallery-item-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.gallery-item-type {
    font-size: 12px;
    font-weight: 500;
    color: var(--neon-cyan);
}

.gallery-item-date {
    font-size: 11px;
    color: var(--text-muted);
}

/* Models List */
.models-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.model-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s;
}

.model-card:active {
    transform: scale(0.98);
}

.model-card:hover {
    border-color: rgba(139, 92, 246, 0.3);
}

.model-card-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    font-size: 24px;
}

.model-card-info {
    flex: 1;
}

.model-card-name {
    font-weight: 600;
    margin-bottom: 2px;
}

.model-card-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.model-card-price {
    font-family: 'Exo 2', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--neon-cyan);
}

/* Packages Grid */
.packages-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.package-card {
    padding: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s;
}

.package-card:active {
    transform: scale(0.98);
}

.package-card.featured {
    background: var(--gradient-primary);
    border: none;
}

.package-card.featured .package-label {
    background: rgba(255,255,255,0.2);
}

.package-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.package-name {
    font-family: 'Exo 2', sans-serif;
    font-size: 18px;
    font-weight: 700;
}

.package-label {
    padding: 4px 10px;
    background: rgba(139, 92, 246, 0.2);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.package-tokens {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.package-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.package-price {
    font-family: 'Exo 2', sans-serif;
    font-size: 24px;
    font-weight: 800;
}

.package-btn {
    padding: 10px 20px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-weight: 600;
    cursor: pointer;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
}

/* Safe area for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .main-content {
        padding-bottom: calc(100px + env(safe-area-inset-bottom));
    }
}

/* History Items (for recent history) */
.history-item {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--gradient-card);
    position: relative;
    cursor: pointer;
    transition: transform 0.3s var(--ease-spring);
}

.history-item:active {
    transform: scale(0.95);
}

.history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
}

.history-item-type {
    font-size: 14px;
}

.history-item-no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(0, 245, 255, 0.1));
}

.history-item-icon {
    font-size: 24px;
}

.history-item-model {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    padding: 0 4px;
}

/* Empty States */
.history-empty,
.gallery-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 48px;
    opacity: 0.5;
}

.gallery-empty p {
    font-size: 14px;
    margin-bottom: 16px;
}

.gallery-empty.error {
    color: var(--neon-orange);
}

/* Gallery Item Extended */
.gallery-item.no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(0, 245, 255, 0.1));
}

.gallery-icon {
    font-size: 32px;
}

.gallery-type {
    font-size: 12px;
    font-weight: 500;
    color: var(--neon-cyan);
    display: block;
    margin-bottom: 2px;
}

.gallery-date {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}

.gallery-tokens {
    font-size: 10px;
    color: var(--neon-magenta);
    display: block;
    margin-top: 2px;
}

/* Превью промпта в карточке галереи */
.gallery-prompt {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.3;
    color: var(--text-secondary, rgba(255,255,255,0.65));
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Model Card Price Extended */
.model-card-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
}

.model-card-price .price-value {
    font-family: 'Exo 2', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--neon-cyan);
}

.model-card-price .price-label {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'Outfit', sans-serif;
}

/* Package Card Extended */
.package-card {
    position: relative;
    overflow: visible;
}

.package-card.popular {
    border-color: var(--neon-purple);
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.2), var(--bg-card));
}

.package-badge {
    position: absolute;
    top: -10px;
    right: 16px;
    padding: 4px 12px;
    background: var(--gradient-primary);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.package-discount {
    position: absolute;
    top: -10px;
    left: 16px;
    padding: 4px 10px;
    background: var(--neon-green);
    color: var(--bg-deep);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.package-tokens {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.package-amount {
    font-family: 'Exo 2', sans-serif;
    font-size: 36px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.1;
}

.package-tokens .package-label {
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: lowercase;
}

.package-price {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    margin-bottom: 8px;
}

.package-price .price-currency {
    font-size: 18px;
    color: var(--text-secondary);
}

.package-price .price-value {
    font-family: 'Exo 2', sans-serif;
    font-size: 28px;
    font-weight: 800;
}

.package-bonus {
    text-align: center;
    font-size: 12px;
    color: var(--neon-green);
    font-weight: 600;
}

.package-name {
    text-align: center;
    font-family: 'Exo 2', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.package-desc {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Avatar Image */
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* Premium Badge */
.hero-badge.premium {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 165, 0, 0.2));
    border: 1px solid rgba(255, 215, 0, 0.4);
}

.hero-badge.premium .badge-dot {
    background: #ffd700;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.6);
}

/* Gallery Filters */
.gallery-filters {
    display: flex;
    gap: 8px;
    padding: 0 16px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.gallery-filters::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.filter-btn:not(.active):hover {
    border-color: var(--neon-purple);
    color: var(--text-primary);
}

/* Load More Button */
.load-more-btn {
    width: 100%;
    padding: 16px;
    margin-top: 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.load-more-btn:hover {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 70px 20px 30px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    overflow-y: auto;
}

.lightbox:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 28px;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.2);
}

.lightbox-content {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 50vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-info {
    margin-top: 16px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

.lightbox-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.lightbox-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.lightbox-btn:hover {
    border-color: var(--neon-cyan);
    transform: translateY(-2px);
}

/* Models Page Header */
.models-header {
    padding: 0 16px 16px;
}

.models-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.models-count {
    font-size: 12px;
    color: var(--text-muted);
}

/* Enhanced Model Card */
.model-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.model-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s;
}

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

.model-card:active {
    transform: scale(0.98);
}

.model-card:hover {
    border-color: rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.1);
}

.model-card-use {
    padding: 8px 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}

.model-card-use:hover {
    transform: scale(1.05);
    box-shadow: var(--glow-cyan);
}

/* Packages Page */
.packages-header {
    padding: 0 16px 16px;
}

.current-balance-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 20px;
    background: var(--gradient-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
}

.balance-label-sm {
    font-size: 13px;
    color: var(--text-muted);
}

.balance-value-lg {
    font-family: 'Exo 2', sans-serif;
    font-size: 24px;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.balance-unit-sm {
    font-size: 13px;
    color: var(--text-muted);
}

.packages-note {
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-top: 20px;
    padding: 16px;
    background: rgba(255,255,255,0.03);
    border-radius: var(--radius-lg);
}

/* Enhanced Package Card */
.package-card {
    padding: 24px 20px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    text-align: center;
}

.package-card:hover {
    border-color: var(--neon-cyan);
    transform: translateY(-4px);
    box-shadow: 0 10px 40px rgba(0, 245, 255, 0.1);
}

.package-card:active {
    transform: translateY(-2px);
}

.package-buy-btn {
    width: 100%;
    padding: 12px;
    margin-top: 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.package-buy-btn:hover {
    transform: scale(1.02);
    box-shadow: var(--glow-cyan);
}

/* === REFERRAL PAGE === */

.referral-hero {
    text-align: center;
    padding: 32px 20px;
    margin-bottom: 16px;
}

.referral-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.referral-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.referral-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.referral-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.referral-stat-card {
    text-align: center;
    padding: 20px 16px;
}

.referral-stat-icon {
    font-size: 28px;
    display: block;
    margin-bottom: 8px;
}

.referral-stat-number {
    font-family: 'Exo 2', sans-serif;
    font-size: 32px;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.referral-stat-label {
    font-size: 13px;
    color: var(--text-muted);
}

.referral-link-section {
    margin-bottom: 16px;
}

.referral-link-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.referral-link-box {
    display: flex;
    gap: 8px;
}

.referral-link-input {
    flex: 1;
    padding: 14px 16px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: monospace;
    outline: none;
    cursor: pointer;
}

.referral-link-input:focus {
    border-color: var(--neon-cyan);
}

.referral-copy-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.2s;
}

.referral-copy-btn:active {
    transform: scale(0.95);
}

.referral-copy-btn svg {
    width: 20px;
    height: 20px;
    color: white;
}

.referral-link-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}

.referral-share-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.share-btn:active {
    transform: scale(0.98);
}

.share-telegram {
    background: linear-gradient(135deg, #0088cc 0%, #00a0e9 100%);
    color: white;
}

.share-telegram:hover {
    box-shadow: 0 4px 20px rgba(0, 136, 204, 0.4);
}

.share-copy {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-primary);
}

.share-copy:hover {
    border-color: var(--neon-cyan);
}

.share-icon {
    font-size: 18px;
}

.referral-how {
    margin-top: 20px;
}

.referral-how-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.referral-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.referral-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.referral-step:last-child {
    border-bottom: none;
}

.step-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Clickable stat block */
.stat-clickable {
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
    border-radius: var(--radius-md);
    margin: -8px;
    padding: 16px 8px;
}

.stat-clickable:hover {
    background: rgba(255,255,255,0.05);
}

.stat-clickable:active {
    background: rgba(255,255,255,0.08);
}

.stat-arrow {
    font-size: 12px;
    color: var(--neon-cyan);
    margin-top: 4px;
    display: block;
    transition: transform 0.2s;
}

.stat-clickable:hover .stat-arrow {
    transform: translateX(4px);
}

/* === AI MODELS === */

/* Featured Action Card */
.action-card-featured {
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.25), rgba(0, 245, 255, 0.15));
    border-color: rgba(139, 92, 246, 0.4);
}

.action-icon-glow {
    background: var(--gradient-primary);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.5);
}

/* AI Search */
.ai-search-section {
    padding: 0 16px 12px;
}

.ai-search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    margin-bottom: 12px;
}

.ai-search-icon {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.ai-search-input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 15px;
    outline: none;
}

.ai-search-input::placeholder {
    color: var(--text-muted);
}

.ai-search-clear {
    width: 24px;
    height: 24px;
    padding: 0;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-search-clear svg {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
}

.ai-search-clear.hidden {
    display: none;
}

/* AI Categories */
.ai-category-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.ai-category-scroll::-webkit-scrollbar {
    display: none;
}

.ai-category-btn {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.3s;
}

.ai-category-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.ai-category-btn:not(.active):hover {
    border-color: var(--neon-purple);
}

/* AI Models Grid */
.ai-models-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.ai-model-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.ai-model-card:active {
    transform: scale(0.97);
}

.ai-model-card:hover {
    border-color: rgba(139, 92, 246, 0.4);
}

.ai-card-thumb {
    aspect-ratio: 1;
    background: var(--gradient-card);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ai-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-card-icon {
    font-size: 40px;
    opacity: 0.5;
}

.ai-card-content {
    padding: 12px;
}

.ai-card-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-card-category {
    font-size: 11px;
    color: var(--neon-cyan);
    background: rgba(0, 245, 255, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
}

/* AI Generate Page */
.ai-model-info {
    display: flex;
    gap: 16px;
    padding: 16px;
    margin-bottom: 16px;
}

.ai-model-thumb {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    background: var(--gradient-card);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-model-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-thumb-icon {
    font-size: 32px;
    opacity: 0.5;
}

.ai-model-details {
    flex: 1;
    min-width: 0;
}

.ai-model-details h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.ai-model-details p {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-model-price {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    color: var(--neon-cyan);
}

.price-icon {
    font-size: 14px;
}

/* AI Form */
.ai-form-section {
    margin-bottom: 100px;
}

.ai-form-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.ai-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ai-form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.ai-required {
    color: var(--neon-magenta);
    margin-left: 2px;
}

.ai-form-input,
.ai-form-textarea,
.ai-form-select {
    width: 100%;
    padding: 14px 16px;
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.ai-form-input:focus,
.ai-form-textarea:focus,
.ai-form-select:focus {
    border-color: var(--neon-cyan);
}

.ai-form-input::placeholder,
.ai-form-textarea::placeholder {
    color: var(--text-muted);
}

.ai-form-textarea {
    resize: vertical;
    min-height: 80px;
}

.ai-form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px;
}

/* Toggle Switch */
.ai-form-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.ai-form-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ai-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.1);
    border-radius: 28px;
    transition: 0.3s;
}

.ai-toggle-slider::before {
    content: '';
    position: absolute;
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
}

.ai-form-toggle input:checked + .ai-toggle-slider {
    background: var(--gradient-primary);
}

.ai-form-toggle input:checked + .ai-toggle-slider::before {
    transform: translateX(24px);
}

/* Advanced Parameters */
.ai-form-advanced {
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ai-form-advanced summary {
    padding: 12px 16px;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-form-advanced summary::-webkit-details-marker {
    display: none;
}

.ai-form-advanced summary::before {
    content: '▸';
    transition: transform 0.2s;
}

.ai-form-advanced[open] summary::before {
    transform: rotate(90deg);
}

.ai-form-advanced-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Generate Button */
.ai-generate-btn {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 18px 24px;
    padding-bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px));
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    z-index: 100;
    transition: opacity 0.2s;
}

.ai-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-generate-icon {
    font-size: 18px;
}

.ai-generate-cost {
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    background: rgba(0,0,0,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
}

/* AI Status Page */
.ai-status-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    padding: 20px;
}

.ai-status-card {
    text-align: center;
    padding: 40px 20px;
}

.ai-status-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-pulse-ring {
    position: absolute;
    inset: 0;
    border: 2px solid var(--neon-cyan);
    border-radius: 50%;
    opacity: 0;
    animation: pulseRing 2s ease-out infinite;
}

.ai-pulse-ring.delay-1 {
    animation-delay: 0.6s;
}

.ai-pulse-ring.delay-2 {
    animation-delay: 1.2s;
}

@keyframes pulseRing {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.ai-status-animation.error .ai-pulse-ring {
    border-color: var(--neon-orange);
}

.ai-status-icon {
    font-size: 48px;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.ai-status-animation.error .ai-status-icon {
    animation: none;
}

.ai-status-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-status-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.ai-progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin: 0 auto;
    overflow: hidden;
}

.ai-progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0;
}

/* AI Result */
.ai-result {
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.ai-result img {
    width: 100%;
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.ai-result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-result-actions .lightbox-btn {
    width: 100%;
    justify-content: center;
}

.ai-result-actions .cta-button {
    background: var(--gradient-primary);
    border: none;
}

/* === TRENDING PHOTOS === */

.trending-section {
    margin-top: 4px;
}

.trending-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.trending-section .section-label {
    margin-bottom: 0;
}

.section-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Trends Type Toggle (Фото/Видео) */
.trends-type-toggle {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-bottom: 10px;
    background: linear-gradient(145deg, rgba(0, 245, 255, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 245, 255, 0.25);
}

.trends-type-btn {
    padding: 8px 12px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

.trends-type-btn.active {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
    color: #fff;
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.3);
}

.trends-type-btn:not(.active):hover {
    background: rgba(0, 245, 255, 0.1);
    color: var(--text-primary);
}

.gender-toggle {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
    background: linear-gradient(145deg, rgba(139, 92, 246, 0.12) 0%, rgba(0, 245, 255, 0.06) 100%);
    padding: 5px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(139, 92, 246, 0.25);
    position: relative;
    overflow: hidden;
}

.gender-toggle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@media (max-width: 400px) {
    .gender-toggle {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px;
    }
}

.gender-toggle-btn {
    padding: 7px 4px;
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    background: rgba(20, 20, 35, 0.6);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    white-space: nowrap;
    min-height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

@media (max-width: 400px) {
    .gender-toggle-btn {
        padding: 8px 6px;
        font-size: 12px;
        min-height: 36px;
    }
}

.gender-toggle-btn:active {
    transform: scale(0.96);
}

.gender-toggle-btn.active {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-purple) 50%, var(--neon-magenta) 100%);
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
    color: #fff;
    border-color: rgba(0, 245, 255, 0.5);
    box-shadow:
        0 0 30px rgba(0, 245, 255, 0.4),
        0 0 60px rgba(139, 92, 246, 0.3),
        0 4px 20px rgba(255, 0, 255, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
    font-weight: 800;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.gender-toggle-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    background-size: 200% 200%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { background-position: -100% -100%; }
    100% { background-position: 100% 100%; }
}

.gender-toggle-btn:not(.active):hover {
    background: rgba(139, 92, 246, 0.25);
    color: var(--text-primary);
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.2);
}

/* Tags Scroll */
.tags-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0 16px;
    margin: 0 -4px;
    padding-left: 4px;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.tags-scroll::-webkit-scrollbar {
    display: none;
}

.tag-chip {
    flex-shrink: 0;
    padding: 8px 16px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    background: rgba(20, 20, 35, 0.8);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.tag-chip:active {
    transform: scale(0.95);
}

.tag-chip.active {
    background: linear-gradient(135deg, var(--neon-cyan) 0%, var(--neon-purple) 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 12px rgba(0, 245, 255, 0.3);
}

.tag-chip:not(.active):hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
    color: var(--text-primary);
}

/* Tag search input (текстовый поиск над .tag-select) — в одном стиле с .tag-select */

/* Override .tags-scroll (display:flex, горизонтальный скролл) — для #trending-tags
   нам нужно вертикально: input сверху, select снизу. */
#trending-tags {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-x: visible;
    padding: 0;
    margin: 0 0 8px;
}

.tag-search-wrap {
    width: 100%;
    margin-bottom: 0;
}
.tag-search-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    background: rgba(20, 20, 35, 0.9);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.25s ease;
    box-sizing: border-box;
}
.tag-search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
.tag-search-input:hover {
    background-color: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
}
.tag-search-input:focus {
    border-color: var(--neon-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* Tag Select Dropdown */
.tag-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    background: rgba(20, 20, 35, 0.9);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: all 0.25s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path fill="%238b5cf6" d="M1.41 0L6 4.59L10.59 0L12 1.41l-6 6l-6-6z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 40px;
}

.tag-select:hover {
    background-color: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
}

.tag-select:focus {
    border-color: var(--neon-purple);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.tag-select option {
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 8px;
}

/* Компактный кастомный дропдаун тем (замена нативного <select>, который iOS
   разворачивает на весь экран). Список скроллится внутри max-height. */
.tag-select-custom {
    position: relative;
    width: 100%;
}
.tag-select-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 12px;
    background: rgba(20, 20, 35, 0.9);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    text-align: left;
    transition: all 0.25s ease;
    box-sizing: border-box;
}
.tag-select-trigger::after {
    content: '';
    width: 12px;
    height: 8px;
    margin-left: 10px;
    flex-shrink: 0;
    background: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path fill="%238b5cf6" d="M1.41 0L6 4.59L10.59 0L12 1.41l-6 6l-6-6z"/></svg>') no-repeat center;
    transition: transform 0.2s ease;
}
.tag-select-custom.open .tag-select-trigger::after { transform: rotate(180deg); }
.tag-select-trigger:hover {
    background-color: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.5);
}
.tag-select-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 60;
    max-height: 45vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--bg-elevated, rgba(20, 20, 35, 0.98));
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    padding: 4px;
}
.tag-select-custom.open .tag-select-panel { display: block; }
.tag-select-option {
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease;
}
.tag-select-option:active { background: rgba(139, 92, 246, 0.25); }
.tag-select-option.active {
    background: rgba(139, 92, 246, 0.35);
    font-weight: 600;
}

.trending-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.trending-card {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s var(--ease-spring);
}

.trending-card:active {
    transform: scale(0.97);
}

.trending-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.trending-card-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 10px 8px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    line-height: 1.25;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.55) 50%, rgba(0,0,0,0.85) 100%);
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    pointer-events: none;
}

.badge-new {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--red);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    z-index: 10;
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(255, 71, 87, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 71, 87, 0.6);
    }
}

.badge-popular {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
    z-index: 10;
    animation: badge-glow 2s ease-in-out infinite;
}

@keyframes badge-glow {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: 0 4px 20px rgba(255, 215, 0, 0.8);
    }
}

.badge-photo-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    backdrop-filter: blur(4px);
    z-index: 10;
}

.badge-media {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border-radius: 50%;
    font-size: 13px;
    line-height: 1;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    z-index: 10;
    pointer-events: none;
}
.badge-media.is-video {
    background: rgba(139, 92, 246, 0.85);
}
.badge-media.is-photo {
    background: rgba(6, 182, 212, 0.85);
}

.badge-text {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: linear-gradient(135deg, #7B2FBE 0%, #A855F7 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.45);
    z-index: 10;
}

.badge-buy-single {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: linear-gradient(135deg, #FF6B35 0%, #FF1493 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(255, 20, 147, 0.45);
    z-index: 10;
}

.badge-purchased {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.45);
    z-index: 10;
}

.trending-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
}

.trending-model {
    font-size: 10px;
    color: var(--neon-cyan);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.trending-price {
    font-family: 'Exo 2', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.trending-loading,
.trending-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
    text-align: center;
}

/* Skeleton loading cards */
.skeleton-card {
    aspect-ratio: 1;
    border-radius: var(--radius-lg);
    background: linear-gradient(
        110deg,
        var(--bg-elevated) 8%,
        rgba(139, 92, 246, 0.15) 18%,
        var(--bg-elevated) 33%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* === TEMPLATES PAGE === */

.templates-intro {
    padding: 0 16px 12px;
}

.templates-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
}

.templates-categories {
    display: flex;
    gap: 8px;
    padding: 0 16px 16px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.templates-categories::-webkit-scrollbar {
    display: none;
}

.template-category-btn {
    flex-shrink: 0;
    padding: 10px 16px;
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.template-category-btn:hover {
    background: rgba(139, 92, 246, 0.2);
}

.template-category-btn.active {
    background: var(--gradient-primary);
    color: var(--bg-deep);
    border-color: transparent;
    font-weight: 600;
}

.skeleton-chip {
    flex-shrink: 0;
    width: 100px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: linear-gradient(
        110deg,
        var(--bg-elevated) 8%,
        rgba(139, 92, 246, 0.15) 18%,
        var(--bg-elevated) 33%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s linear infinite;
}

.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 16px;
}

.template-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(255,255,255,0.05);
}

.template-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-purple);
}

.template-card:active {
    transform: scale(0.98);
}

.template-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3/4;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: var(--text-muted);
}

.template-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-card-info {
    padding: 12px;
}

.template-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.template-card-price {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--neon-cyan);
    font-weight: 500;
}

.templates-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.templates-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* === CHAT PAGE === */

#page-chat {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#page-chat .page-header {
    flex-shrink: 0;
}

.chat-clear-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 100, 100, 0.2);
    border: none;
    color: var(--red);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.chat-clear-btn svg {
    width: 18px;
    height: 18px;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-welcome {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.chat-welcome-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.chat-welcome h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 14px;
    color: var(--text-muted);
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    position: relative;
}

.chat-message-content {
    word-wrap: break-word;
}

.chat-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

.chat-message:hover .chat-copy-btn {
    opacity: 1;
}

.chat-copy-btn svg {
    width: 14px;
    height: 14px;
    color: var(--text-secondary);
}

.chat-copy-btn:hover {
    background: rgba(255,255,255,0.2);
}

.chat-copy-btn.copied {
    background: rgba(0, 255, 136, 0.2);
}

.chat-copy-btn.copied svg {
    color: var(--neon-green);
}

.chat-message.user {
    align-self: flex-end;
    background: var(--gradient-primary);
    color: var(--bg-deep);
}

.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.1);
}

.chat-message.assistant pre {
    background: var(--bg-deep);
    padding: 10px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    font-size: 13px;
}

.chat-message.assistant code {
    background: var(--bg-deep);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.chat-message.typing {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.chat-message.typing span {
    width: 8px;
    height: 8px;
    background: var(--neon-cyan);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.chat-message.typing span:nth-child(1) { animation-delay: -0.32s; }
.chat-message.typing span:nth-child(2) { animation-delay: -0.16s; }
.chat-message.typing span:nth-child(3) { animation-delay: 0s; }

@keyframes typingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.chat-input-area {
    flex-shrink: 0;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-top: 1px solid rgba(255,255,255,0.1);
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.chat-input {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: var(--neon-cyan);
}

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

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: var(--bg-deep);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, opacity 0.2s;
    flex-shrink: 0;
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chat-send-btn:not(:disabled):active {
    transform: scale(0.95);
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

.chat-cost-hint {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Chat Attachment */
.chat-attach-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    flex-shrink: 0;
}

.chat-attach-btn:hover {
    background: rgba(255,255,255,0.15);
    color: var(--neon-cyan);
}

.chat-attach-btn:active {
    transform: scale(0.95);
}

.chat-attach-btn svg {
    width: 20px;
    height: 20px;
}

/* Chat Image Preview */
.chat-image-preview {
    position: relative;
    padding: 8px;
    margin-bottom: 8px;
    background: rgba(255,255,255,0.05);
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.chat-image-preview.hidden {
    display: none;
}

.chat-image-preview img {
    max-width: 120px;
    max-height: 80px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.chat-preview-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-preview-remove:hover {
    background: var(--error);
}

.chat-preview-remove svg {
    width: 14px;
    height: 14px;
}

/* Chat message with image */
.chat-message-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    object-fit: contain;
    display: block;
}

/* Compress loader */
.compress-loader {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-secondary);
}

.compress-loader .loader {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

/* === SELFIE MODAL === */

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-elevated);
    border-radius: var(--radius-xl);
    padding: 24px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
    z-index: 10;
}

.modal-close:hover {
    background: rgba(255,255,255,0.2);
}

.modal-title {
    font-family: 'Exo 2', sans-serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
    padding-right: 40px;
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* Trending Preview in Modal */
.trending-preview {
    margin-bottom: 16px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.trending-preview img {
    width: 100%;
    max-height: 280px;
    object-fit: contain;
    display: block;
}

/* Муз-шаблоны: обложка в модалке — компактный баннер, не на весь экран */
.mt-cover { width: 100%; margin-bottom: 10px; }
.mt-cover img { width: 100%; height: 190px; object-fit: cover; border-radius: 12px; display: block; }
.mt-card-badge { font-size: 11px; color: var(--text-secondary, #9aa3b2); margin-top: 2px; }
.mt-card-play { position: absolute; right: 8px; bottom: 8px; width: 32px; height: 32px; border-radius: 50%; border: none; background: rgba(0,0,0,0.55); color: #fff; font-size: 13px; cursor: pointer; }
/* Селектор голоса в модалке муз-шаблона */
.mt-voice { margin-top: 12px; }
.mt-voice-label { font-size: 13px; color: var(--text-secondary, #9aa3b2); margin-bottom: 6px; }
.mt-voice-btns { display: flex; gap: 8px; }
.mt-voice-btn { flex: 1; padding: 8px 6px; border-radius: 10px; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.05); color: #fff; font-size: 13px; cursor: pointer; }
.mt-voice-btn.active { background: linear-gradient(135deg, #7c5cff, #22d3ee); border-color: transparent; font-weight: 600; }

.trending-preview-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Selfie Upload Area */
.selfie-upload-area {
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: var(--radius-lg);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255,255,255,0.02);
}

.selfie-upload-area:hover {
    border-color: var(--neon-cyan);
    background: rgba(0, 245, 255, 0.05);
}

.selfie-upload-area.dragover {
    border-color: var(--neon-magenta);
    background: rgba(255, 0, 255, 0.1);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
    display: block;
}

.upload-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-muted);
}

/* Selfie Preview */
.selfie-preview {
    margin-top: 20px;
    text-align: center;
}

.selfie-preview img {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    border: 3px solid var(--neon-cyan);
    box-shadow: var(--glow-cyan);
}

.selfie-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
}

.selfie-thumb {
    position: relative;
    width: 80px;
    height: 80px;
}

.selfie-thumb img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 2px solid var(--neon-cyan);
}

.selfie-thumb-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(255, 80, 80, 0.95);
    color: white;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.selfie-preview-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Generate Button in Modal */
.modal-generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    margin-top: 20px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.modal-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-generate-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: var(--glow-cyan);
}

.generate-cost {
    font-family: 'Exo 2', sans-serif;
    font-weight: 700;
    background: rgba(0,0,0,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
}

/* Modal Status */
.modal-status {
    text-align: center;
    padding: 40px 20px;
}

.modal-status .loader {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
}

.modal-status-text {
    font-size: 14px;
    color: var(--text-secondary);
}

.status-progress-bar {
    width: 200px;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin: 16px auto 0;
    overflow: hidden;
}

.status-progress {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Modal Result */
.modal-result {
    text-align: center;
}

.modal-result img {
    width: 100%;
    max-height: 50vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.result-close-btn {
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

/* Modal Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-share-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-share-btn:hover {
    background: rgba(0, 245, 255, 0.2);
    color: var(--accent-cyan);
}

.modal-share-btn svg {
    width: 18px;
    height: 18px;
}

.modal-header .modal-close {
    position: static;
    width: 36px;
    height: 36px;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Upload Placeholder */
.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

/* Change Selfie Button — крупная заметная (для multi-upload) */
.change-selfie-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 14px 20px;
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.15), rgba(59, 130, 246, 0.15));
    border: 1.5px dashed rgba(34, 211, 238, 0.4);
    border-radius: 14px;
    color: var(--neon-cyan);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
}

.change-selfie-btn:active {
    transform: scale(0.98);
    background: linear-gradient(135deg, rgba(34, 211, 238, 0.25), rgba(59, 130, 246, 0.25));
}

/* Generate Button */
.generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-lg);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status Spinner */
.status-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--neon-cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

.status-text {
    display: block;
    text-align: center;
    color: var(--text-secondary);
}

/* Result Actions */
.result-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    z-index: 10;
    margin-top: 16px;
}

.result-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
}

.result-btn:first-child {
    background: var(--gradient-primary);
    border: none;
}

/* === Aspect Ratio Selector === */
.aspect-ratio-section {
    margin: 16px 0;
}

.aspect-ratio-label {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-weight: 500;
}

.aspect-ratio-grid {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.aspect-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 56px;
}

.aspect-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
}

.aspect-btn.active {
    background: linear-gradient(135deg, rgba(0, 245, 255, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.2);
}

.aspect-btn span {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 500;
}

.aspect-btn.active span {
    color: var(--neon-cyan);
}

/* Aspect ratio shapes */
.aspect-shape {
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    transition: all 0.2s ease;
}

.aspect-btn.active .aspect-shape {
    background: var(--gradient-primary);
}

.aspect-9-16 {
    width: 18px;
    height: 32px;
}

.aspect-3-4 {
    width: 21px;
    height: 28px;
}

.aspect-1-1 {
    width: 26px;
    height: 26px;
}

.aspect-4-3 {
    width: 28px;
    height: 21px;
}

.aspect-16-9 {
    width: 32px;
    height: 18px;
}

/* === User Input Fields === */
.user-inputs-section {
    margin: 16px 0;
}

.user-input-item {
    margin-bottom: 12px;
}

.user-input-label {
    display: block;
    font-size: 13px;
    color: var(--neon-cyan);
    margin-bottom: 6px;
    font-weight: 500;
}

.user-input-field {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

.user-input-field::placeholder {
    color: var(--text-muted);
}

.user-input-field:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.15);
}

/* === BALANCE ADD BUTTON === */
.balance-add-btn {
    position: relative;
    z-index: 1;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.balance-add-btn:active {
    transform: scale(0.9);
}

/* === PROFILE PAGE === */
.profile-hero {
    text-align: center;
    padding: 24px 16px;
}

.profile-avatar-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    padding: 3px;
    margin: 0 auto 16px;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
}

.profile-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(139, 92, 246, 0.15);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    color: var(--neon-purple);
    margin-bottom: 16px;
}

.profile-balance-showcase {
    margin: 16px 0;
}

.profile-balance-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.profile-balance-amount {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
}

.profile-balance-number {
    font-size: 36px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.profile-balance-unit {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-cta-button {
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-lg);
    padding: 12px 24px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-cta-button:active {
    transform: scale(0.97);
}

.profile-stats,
.profile-history,
.profile-referral {
    margin-top: 16px;
}

.profile-ref-stats {
    margin: 16px 0;
}

.profile-ref-stats .referral-stat-card {
    background: rgba(255,255,255,0.03);
    padding: 12px 8px;
}

.profile-ref-link {
    margin: 16px 0 12px;
}

.referral-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.referral-header .referral-icon {
    font-size: 24px;
}

.referral-header .referral-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.referral-share-btns {
    display: flex;
    gap: 8px;
}

.share-btn-sm {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    padding: 10px;
    color: var(--text-primary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.share-btn-sm:active {
    background: rgba(255,255,255,0.1);
}

/* === IDEAS PAGE === */
.ideas-intro {
    text-align: center;
    padding: 16px;
    margin-bottom: 16px;
}

.ideas-icon {
    font-size: 32px;
    display: block;
    margin-bottom: 8px;
}

.ideas-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

.ideas-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.ideas-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.idea-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
}

.idea-image {
    aspect-ratio: 1;
    width: 100%;
    object-fit: cover;
}

.idea-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
}

.idea-like-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 20px;
    padding: 6px 10px;
    color: white;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.idea-like-btn.liked {
    background: rgba(255, 59, 59, 0.28);
    color: var(--red);
}

.idea-like-btn:active {
    transform: scale(0.95);
}

.idea-prompt {
    font-size: 11px;
    color: rgba(255,255,255,0.7);
    margin-top: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#load-more-ideas {
    margin-top: 16px;
}

/* ===== TREND DESCRIPTION ===== */
.trend-description {
    background: rgba(255,255,255,0.06);
    border-left: 3px solid var(--neon-pink, #ff4dac);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    line-height: 1.5;
}

/* ===== MODEL SELECTOR ===== */
.model-selector-section {
    margin-bottom: 14px;
}
.model-selector-label {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 8px;
}
.model-selector-btns {
    display: flex;
    gap: 8px;
}
.model-btn {
    flex: 1;
    padding: 8px 4px;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}
.model-btn.active {
    border-color: var(--neon-pink, #ff4dac);
    background: rgba(255,77,172,0.15);
    color: #fff;
}

/* ===== CAROUSEL ===== */
.carousel-modal-content {
    position: relative;
    width: 92%;
    max-width: 420px;
    border-radius: 20px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}
.carousel-container {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 70vw;
    max-height: 70vh;
}
.carousel-track {
    display: flex;
    transition: transform 0.3s ease;
    height: 100%;
}
.carousel-slide {
    min-width: 100%;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    display: block;
}
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}
.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 10px 0 4px;
}
.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    cursor: pointer;
    transition: background 0.2s;
}
.carousel-dot.active {
    background: #fff;
}
.carousel-dots-indicator {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    pointer-events: none;
}

/* Кнопка «Галерея» в шапке (между лого и балансом) */
.header-gallery-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 14px;
    border: 1px solid rgba(0, 245, 255, 0.25);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary, #fff);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.2s ease;
}
.header-gallery-btn svg {
    width: 16px;
    height: 16px;
    stroke: #00f5ff;
}
.header-gallery-btn:active {
    transform: scale(0.95);
    border-color: rgba(191, 0, 255, 0.45);
}
/* На совсем узких экранах — только иконка */
@media (max-width: 360px) {
    .header-gallery-btn span { display: none; }
    .header-gallery-btn { padding: 7px 9px; }
}

/* ==========================================================================
   ПОДДЕРЖКА / ТИКЕТЫ (page-support)
   ========================================================================== */
#page-support .page-content { padding: 16px; padding-bottom: 40px; }

.support-loading {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 40px 20px; color: var(--text-muted);
}
.support-empty {
    text-align: center; padding: 40px 20px; color: var(--text-secondary);
}
.support-empty-icon { font-size: 44px; margin-bottom: 12px; }
.support-empty p { line-height: 1.5; }

.support-intro { padding: 16px; margin-bottom: 16px; }
.support-intro p { color: var(--text-secondary); line-height: 1.5; margin-bottom: 14px; font-size: 14px; }

.support-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    border: none; border-radius: var(--radius-md); padding: 12px 18px;
    font-size: 15px; font-weight: 600; cursor: pointer; color: var(--text-primary);
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.support-btn:active { transform: scale(0.97); }
.support-btn:disabled { opacity: 0.4; cursor: default; }
.support-btn-primary { background: var(--gradient-primary); color: #05050a; width: 100%; }
.support-btn-ghost {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
}

.support-banner {
    padding: 12px 14px; border-radius: var(--radius-md); margin: 12px 0;
    background: rgba(255,255,255,0.05); color: var(--text-secondary);
    font-size: 14px; line-height: 1.4; text-align: center;
}
.support-banner-warn { background: rgba(255,59,59,0.12); color: #ffb4b4; }

.support-ticket-list { display: flex; flex-direction: column; gap: 10px; }
.support-ticket-row {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    background: var(--bg-card); border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-md); padding: 14px; cursor: pointer;
    color: var(--text-primary); transition: border-color 0.15s ease;
}
.support-ticket-row:active { border-color: var(--neon-purple); }
.support-ticket-main { flex: 1; min-width: 0; }
.support-ticket-subject {
    font-weight: 600; font-size: 14px; margin-bottom: 6px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    display: flex; align-items: center; gap: 6px;
}
.support-ticket-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.support-ticket-date { font-size: 12px; color: var(--text-muted); }
.support-ticket-arrow { color: var(--text-muted); font-size: 18px; }

.support-status-pill {
    display: inline-block; font-size: 11px; font-weight: 600;
    padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,0.08);
}
.sup-st-open { background: rgba(255,193,7,0.18); color: #ffd66b; }
.sup-st-progress { background: rgba(59,130,246,0.18); color: #7fb2ff; }
.sup-st-await { background: rgba(139,92,246,0.2); color: #c4a8ff; }
.sup-st-closed { background: rgba(255,255,255,0.08); color: var(--text-muted); }

.support-unread-dot {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
}

/* Форма создания */
.support-form { padding: 16px; margin-bottom: 16px; }
.support-label {
    display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary);
    margin: 14px 0 8px;
}
.support-form .support-label:first-child { margin-top: 0; }
.support-textarea {
    width: 100%; background: rgba(255,255,255,0.05); color: var(--text-primary);
    border: 1px solid rgba(255,255,255,0.12); border-radius: var(--radius-md);
    padding: 12px; font-size: 15px; font-family: inherit; resize: vertical; line-height: 1.4;
}
.support-textarea:focus { outline: none; border-color: var(--neon-purple); }

.support-cat-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.support-cat-chip {
    background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px; padding: 8px 14px; font-size: 13px; color: var(--text-secondary);
    cursor: pointer; transition: all 0.15s ease;
}
.support-cat-chip.active {
    background: rgba(139,92,246,0.25); border-color: var(--neon-purple); color: #fff;
}

.support-attach-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.support-attach-empty { font-size: 13px; color: var(--text-muted); padding: 6px 0; }
.support-attach-item {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    background: rgba(255,255,255,0.05); border-radius: var(--radius-sm); padding: 8px 12px;
}
.support-attach-name {
    font-size: 13px; color: var(--text-secondary); overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
}
.support-attach-remove {
    background: none; border: none; color: var(--text-muted); font-size: 16px;
    cursor: pointer; padding: 0 4px;
}
.support-submit { margin-top: 18px; }

/* Тред */
.support-thread-header {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 12px 14px; margin-bottom: 12px;
}
.support-thread-cat { font-size: 13px; color: var(--text-secondary); }

.support-thread {
    display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px;
}
.support-msg {
    border-radius: var(--radius-md); padding: 10px 12px; max-width: 92%;
    background: rgba(255,255,255,0.05);
}
.sup-msg-user { align-self: flex-end; background: rgba(139,92,246,0.18); }
.sup-msg-admin { align-self: flex-start; background: rgba(0,245,255,0.1); }
.sup-msg-system {
    align-self: center; background: rgba(255,255,255,0.04);
    font-size: 12px; color: var(--text-muted); max-width: 100%;
}
.support-msg-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-bottom: 4px;
}
.support-msg-who { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.support-msg-time { font-size: 11px; color: var(--text-muted); }
.support-msg-body { font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.support-msg-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.support-att-thumb img {
    width: 84px; height: 84px; object-fit: cover; border-radius: var(--radius-sm);
}
.support-att-file {
    display: inline-block; background: rgba(255,255,255,0.08); border-radius: var(--radius-sm);
    padding: 6px 10px; font-size: 13px; color: var(--neon-cyan); text-decoration: none;
}

.support-reply { padding: 14px; margin-bottom: 16px; }
.support-reply-hint { font-size: 13px; color: var(--neon-purple); margin-bottom: 10px; }
.support-reply-actions { display: flex; gap: 10px; margin-top: 10px; }
.support-reply-actions .support-btn-primary { flex: 1; }
.support-reply-attach-btn { width: 48px; padding: 12px 0; }

.support-rating { padding: 16px; margin-bottom: 16px; text-align: center; }
.support-rating-title { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.support-rating-btns { display: flex; gap: 10px; }
.support-rating-btns .support-btn { flex: 1; }

.support-signature {
    text-align: center; font-size: 12px; color: var(--text-muted);
    font-style: italic; margin-top: 20px;
}

/* Бейдж непрочитанных на кнопке профиля */
.profile-support-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--red); color: #fff; font-size: 11px; font-weight: 700; margin-left: auto;
}
