﻿:root {
    --bg: #0a0a0f;
    --bg-elevated: #12121c;
    --bg-card: #101018;
    --accent: #8b5cf6;
    --accent-secondary: #3b82f6;
    --accent-soft: rgba(139, 92, 246, 0.15);
    --accent-glow: rgba(139, 92, 246, 0.35);
    --text: #ededee;
    --text-muted: #9ca3af;
    --card-radius: 24px;
    --transition-fast: 0.2s ease-out;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-card: 0 18px 35px rgba(0, 0, 0, 0.65);
    --shadow-card-hover: 0 26px 40px rgba(0, 0, 0, 0.85);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-accent: rgba(139, 92, 246, 0.5);
}


*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1e1e2a;
}

::-webkit-scrollbar-thumb {
    background: #4b4b6e;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5b5b7e;
}

::selection {
    background: var(--accent-soft);
    color: #c084fc;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, sans-serif;
    background: #0a0a0f;
    color: var(--text);
    display: flex;
    flex-direction: column;
    padding-bottom: 90px;
}

.app-shell {
    max-width: 100%;
    margin: 0;
    padding: 26px 20px 100px;
}

/* ===== HEADER ===== */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 52px;
    flex-wrap: wrap;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-mark {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
}

.logo-text {
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, #fff, #c084fc);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}

.logo-text span {
    font-size: 16px;
    font-weight: 500;
    background: none;
    color: #8b8ca8;
    margin-left: 8px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.header-pages-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 14px;
}
.header-pages-btn span:first-child {
    font-size: 16px;
}

.pill {
    background: #1e1e2e;
    padding: 9px 18px;
    border-radius: 50px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(4px);
}

.pill-dot {
    width: 10px;
    height: 10px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 8px #4ade80;
}

/* Buy + Credits in Header */
.header-buy-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, rgba(109, 40, 217, 0.22), rgba(37, 99, 235, 0.22));
    border: 1px solid rgba(167, 139, 250, 0.45);
    padding: 8px 14px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    color: #ede9fe;
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.header-buy-btn:hover {
    border-color: rgba(196, 181, 253, 0.8);
    box-shadow: 0 6px 16px rgba(109, 40, 217, 0.28);
}

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

.header-buy-label {
    font-size: 13px;
    font-weight: 700;
    color: #f5f3ff;
}

.header-buy-credits {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(12, 14, 24, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 4px 9px;
}

.credits-badge-icon {
    font-size: 16px;
}

.credits-badge-amount {
    font-variant-numeric: tabular-nums;
    min-width: 2ch;
}

.auth-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #12121a;
    padding: 7px 20px 7px 26px;
    border-radius: 70px;
}

html.has-auth-token .auth-buttons,
html.mini-app-boot .auth-buttons {
    visibility: hidden;
}

.secondary-button {
    background: #2a2a3a;
    border: none;
    color: white;
    padding: 9px 20px;
    border-radius: 40px;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    transition: 0.2s;
}

.secondary-button:hover {
    background: #3a3a4e;
}

.primary-button {
    background: linear-gradient(105deg, #8b5cf6, #3b82f6);
    border: none;
    color: white;
    padding: 11px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 17px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.4);
}

.primary-button:active {
    transform: translateY(0);
}

.primary-button-pill {
    background: rgba(255, 255, 255, 0.2);
    padding: 3px 13px;
    border-radius: 40px;
    font-size: 14px;
    font-weight: 500;
}

/* ===== GENERATION TABS ===== */
.generation-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin: 42px 0 32px;
    border-bottom: 1px solid #23232e;
    padding-bottom: 16px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-weight: 600;
    font-size: 20px;
    padding: 11px 26px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #2d2d3e;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.tab-btn:hover:not(.active) {
    color: white;
    background: #23232e;
}

/* ===== SLIDER ARROWS ===== */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
}
.slider-arrow.visible {
    opacity: 0.7;
    pointer-events: auto;
}
.slider-arrow:hover {
    background: rgba(139, 92, 246, 0.95);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}
.slider-arrow:active {
    transform: translateY(-50%) scale(0.95);
}
.slider-arrow-left {
    left: 8px;
}
.slider-arrow-right {
    right: 8px;
}
.slider-arrow svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Add padding to slider grids so arrows don't overlap content */
.hero-slider-wrapper .hero-grid,
.trends-slider-wrapper .trends-grid,
.models-slider-wrapper .models-grid,
.catalog-slider-wrapper .catalog-grid,
.lead-magnet-slider-wrapper .lead-magnet-grid {
    padding: 0 52px;
}

/* ===== HERO GRID ===== */
.hero-grid {
    display: flex;
    overflow-x: auto;
    gap: 32px;
    margin-bottom: 72px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.hero-grid::-webkit-scrollbar {
    display: none;
}

.hero-card {
    position: relative;
    border-radius: 36px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #111118;
    flex: 0 0 390px;
    scroll-snap-align: start;
}

.hero-card:hover {
    transform: translateY(-7px);
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.5);
}

.hero-thumb {
    position: absolute;
    inset: 0;
    filter: saturate(1.05);
    z-index: 0;
    background: #0b0b0f;
}

.hero-thumb img,
.hero-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.2) 70%);
    z-index: 1;
}

.hero-card > * {
    position: relative;
    z-index: 2;
}

.hero-trend-pill {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding: 7px 16px;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-trend-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
}

.hero-label {
    position: absolute;
    bottom: 90px;
    left: 26px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(4px);
    padding: 6px 16px;
    border-radius: 60px;
}

.hero-title {
    position: absolute;
    bottom: 40px;
    left: 26px;
    font-size: 26px;
    font-weight: 700;
    max-width: 80%;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.hero-sub {
    position: absolute;
    bottom: 14px;
    left: 26px;
    font-size: 16px;
    color: #cbd5e1;
}

.hero-sub code {
    background: rgba(0, 0, 0, 0.4);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 14px;
    color: #c084fc;
    border: 1px solid rgba(139, 92, 246, 0.2);
}

/* ===== SECTION TITLES ===== */
.section-title {
    margin: 32px 0 24px 0;
}

.section-title:first-child {
    margin-top: 0;
}

.section-title h2 {
    font-size: 26px;
    font-weight: 700;
}

.section-title span {
    font-size: 15px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* ===== PRICING ===== */
.pricing-section {
    margin: 0 0 24px;
}

.pricing-once {
    background: #12121c;
    border-radius: 20px;
    padding: 20px;
    transition: 0.2s;
    margin-bottom: 16px;
    width: 100%;
    box-sizing: border-box;
}

.pricing-once-title {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.pricing-once-main {
    font-size: 24px;
    font-weight: 700;
    color: #c084fc;
}

.pricing-once-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 6px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.pricing-card {
    background: #12121c;
    border-radius: 20px;
    padding: 20px;
    transition: 0.2s;
    border: 1px solid transparent;
    width: 100%;
    box-sizing: border-box;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
}

.pricing-card.featured {
    border: 1px solid #8b5cf6;
    background: #1a1a2a;
}

.pricing-name {
    font-weight: 600;
    font-size: 18px;
}

.pricing-rub {
    font-size: 22px;
    font-weight: 700;
    color: #f5f5f5;
}

.pricing-rub span {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-muted);
}

.pricing-credits {
    font-size: 16px;
    color: rgba(139, 92, 246, 0.95);
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.08);
    display: inline-block;
    width: fit-content;
    margin-top: 8px;
}

.pricing-features {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
    color: var(--text-muted);
}

.pricing-btn {
    margin-top: 16px;
    display: block;
    text-align: center;
    text-decoration: none;
    width: 100%;
    padding: 14px;
    border-radius: 50px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: transparent;
    color: #c084fc;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.pricing-btn:hover {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8b5cf6;
}

.pricing-btn.featured {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    border: none;
    color: white;
}

.pricing-btn.featured:hover {
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.4);
}

.pricing-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.pricing-card {
    position: relative;
}

.promo-redeem-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    gap: 18px;
    align-items: end;
    background: #12121c;
    border: 1px solid rgba(139, 92, 246, 0.24);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 16px;
}

.promo-redeem-title {
    font-size: 18px;
    font-weight: 700;
    color: #f5f5f5;
}

.promo-redeem-sub {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.45;
}

.promo-redeem-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 10px;
    align-items: center;
}

.promo-code-input {
    width: 100%;
    min-width: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: #0c0c14;
    color: #fff;
    padding: 14px 16px;
    font-size: 15px;
    letter-spacing: 0;
    text-transform: uppercase;
}

.promo-code-input:focus {
    outline: none;
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.promo-redeem-btn {
    margin-top: 0;
    white-space: nowrap;
}

.promo-code-message {
    grid-column: 1 / -1;
    min-height: 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.promo-code-message.success {
    color: #34d399;
}

.promo-code-message.error {
    color: #f87171;
}

@media (max-width: 720px) {
    .promo-redeem-card {
        grid-template-columns: 1fr;
    }

    .promo-redeem-controls {
        grid-template-columns: 1fr;
    }
}

/* ===== TRENDS ===== */
.trends-grid {
    display: flex;
    overflow-x: auto;
    gap: 26px;
    margin-bottom: 62px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.trends-grid::-webkit-scrollbar {
    display: none;
}

.trend-card {
    border-radius: 32px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 1 / 1;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    flex: 0 0 234px;
    scroll-snap-align: start;
}

.trend-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 30px -12px rgba(0, 0, 0, 0.5);
}

.trend-thumb {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: saturate(1.1);
    opacity: 0.92;
}

.trend-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.82), transparent 55%);
}

.trend-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 3;
}

.trend-badge-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
}

.trend-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px;
    background: linear-gradient(to top, #000000cc, transparent);
    z-index: 2;
}

.trend-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.trend-counter {
    font-size: 14px;
    color: #cbd5e1;
}

/* ===== MODELS ===== */
.models-grid {
    display: flex;
    overflow-x: auto;
    gap: 32px;
    margin-bottom: 52px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.models-grid::-webkit-scrollbar {
    display: none;
}

.model-card {
    background: #101018;
    border-radius: 32px;
    padding: 24px;
    transition: 0.2s;
    border: 1px solid #23232e;
    cursor: pointer;
    flex: 0 0 364px;
    scroll-snap-align: start;
}

.model-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
    border-color: rgba(139, 92, 246, 0.3);
}

.model-card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.model-title {
    font-weight: 700;
    font-size: 24px;
}

.model-type-pill {
    font-size: 16px;
    background: #252540;
    display: inline-block;
    padding: 4px 16px;
    border-radius: 26px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 6px;
}

.model-badge {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: #c084fc;
    font-size: 14px;
    font-weight: 500;
}

.model-description {
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 8px;
}

.model-price {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-price-current {
    font-size: 16px;
    font-weight: 600;
    color: #c084fc;
    background: rgba(139, 92, 246, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
}

.model-price-old {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: line-through;
}

.model-media {
    margin-top: 16px;
    border-radius: 20px;
    overflow: hidden;
    position: relative;
    background: #000;
    aspect-ratio: 16 / 9;
}

.model-media img,
.model-media video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-smooth);
}

.model-card:hover .model-media img,
.model-card:hover .model-media video {
    transform: scale(1.03);
}

/* ===== SIDEBAR ===== */
.sidebar-card {
    background: #0e0e16;
    border-radius: 36px;
    padding: 26px;
    margin-top: 52px;
    border: 1px solid #26263a;
}

.sidebar-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.sidebar-title {
    font-size: 22px;
    font-weight: 700;
}

.sidebar-sub {
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 6px;
}

.status-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1c1c28;
    padding: 7px 16px;
    border-radius: 40px;
    font-size: 14px;
}

.status-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #4ade80;
    animation: pulse 1.3s infinite;
}

.status-dot.idle {
    animation: none;
    background: #4ade80;
}

@keyframes pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(0.9); opacity: 0.7; }
}

.generation-preview {
    margin-top: 20px;
}

.generation-media {
    width: 112px;
    height: 112px;
    border-radius: 16px;
    overflow: hidden;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.generation-media img,
.generation-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.generation-status {
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ===== BOTTOM NAV ===== */
nav.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(8, 8, 16, 0.88);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    max-width: 600px;
    margin: 0 auto;
    padding: 8px 4px 10px;
    gap: 2px;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: #52596b;
    cursor: pointer;
    padding: 9px 8px;
    border-radius: 16px;
    transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.14s ease;
    flex: 1 1 0;
    text-decoration: none;
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.bottom-nav-item.active {
    color: #c4b5fd;
    background: rgba(167, 139, 250, 0.12);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.18), inset 0 1px 0 rgba(167, 139, 250, 0.12);
}

.bottom-nav-item:hover:not(.active) {
    color: #8b92a5;
    background: rgba(255, 255, 255, 0.04);
}

.bottom-nav-item:active {
    transform: scale(0.91);
}

/* SVG nav icons */
.bottom-nav-item .nav-icon {
    width: 23px;
    height: 23px;
    flex-shrink: 0;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.18s ease;
    overflow: visible;
}

.bottom-nav-item .nav-icon path,
.bottom-nav-item .nav-icon circle,
.bottom-nav-item .nav-icon polygon,
.bottom-nav-item .nav-icon polyline,
.bottom-nav-item .nav-icon line {
    stroke: currentColor;
    fill: none;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: fill 0.18s ease, stroke 0.18s ease;
}

.bottom-nav-item.active .nav-icon {
    transform: scale(1.12);
    filter: drop-shadow(0 0 7px rgba(167, 139, 250, 0.55));
}

.bottom-nav-item.active .nav-icon path,
.bottom-nav-item.active .nav-icon polygon,
.bottom-nav-item.active .nav-icon circle {
    fill: rgba(167, 139, 250, 0.14);
}

.bottom-nav-item .nav-label {
    line-height: 1;
}

/* ===== PAGES DROPDOWN ===== */
.pages-dropdown {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: none;
    pointer-events: none;
}
.pages-dropdown.open {
    display: block;
    pointer-events: auto;
}
.pages-dropdown-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
}
.pages-dropdown-content {
    position: fixed;
    top: 64px;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 64px);
    background: #16162a;
    border: none;
    border-bottom: 1px solid #2a2a38;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    animation: slideDown 0.25s ease-out;
}
@keyframes slideDown {
    from { transform: translateY(-16px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.pages-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    border-bottom: 1px solid #2a2a38;
    background: linear-gradient(180deg, rgba(99,102,241,0.06) 0%, transparent 100%);
}
.pages-dropdown-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.01em;
}
.pages-dropdown-close {
    background: rgba(255,255,255,0.06);
    border: none;
    color: #9ca3af;
    font-size: 18px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.pages-dropdown-close:hover {
    color: #fff;
    background: rgba(255,255,255,0.12);
}
.pages-dropdown-list {
    max-height: calc(100dvh - 140px);
    overflow-y: auto;
    padding: 8px 12px 14px;
}
.pages-dropdown-list::-webkit-scrollbar {
    width: 6px;
}
.pages-dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}
.pages-dropdown-list::-webkit-scrollbar-thumb {
    background: #3a3a4a;
    border-radius: 3px;
}
.pages-dropdown-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    text-decoration: none;
    color: #e5e7eb;
    border-radius: 10px;
    margin: 0;
    transition: background 0.15s;
}
.pages-dropdown-item:hover {
    background: rgba(167, 139, 250, 0.1);
}
.pages-dropdown-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: #a78bfa;
}
.pages-dropdown-icon {
    font-size: 18px;
    flex-shrink: 0;
}
.pages-dropdown-title {
    font-size: 15px;
    font-weight: 500;
    min-width: 0;
    flex: 1 1 auto;
}
.pages-dropdown-desc {
    font-size: 12px;
    color: #6b7280;
    margin-left: 30px;
    flex: 1 1 100%;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
}

/* ===== MODAL ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 0px;
}


.modal-backdrop.visible {
    display: flex !important;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}


.modal {
    background: #12121c;
    max-width: 1040px;
    width: 100%;
    border-radius: 48px;
    padding: 36px;
    box-shadow: 0 30px 50px rgba(0, 0, 0, 0.6);
    border: 1px solid #2d2d44;
    max-height: calc(100dvh - 52px);
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: modalIn 0.3s ease-out forwards;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 16px;
}

.modal-title {
    font-size: 22px;
    font-weight: 600;
}

.modal-sub {
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 4px;
}

.modal-close {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.card-preview-backdrop {
    z-index: 1200;
    padding: 18px;
}

.card-preview-modal {
    width: min(960px, 100%);
    max-height: calc(100dvh - 36px);
    background: #12121c;
    border: 1px solid #2d2d44;
    border-radius: 34px;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.68);
    overflow: hidden;
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    animation: modalIn 0.24s ease-out forwards;
}

.card-preview-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: rgba(10, 10, 18, 0.72);
    color: #fff;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(10px);
}

.card-preview-media {
    min-height: 520px;
    background: radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.18), transparent 42%), #07070c;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.card-preview-media img,
.card-preview-media video {
    width: 100%;
    height: 100%;
    max-height: calc(100dvh - 36px);
    object-fit: contain;
    display: block;
    background: #07070c;
}

.card-preview-body {
    padding: 34px 28px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 12px;
    background: linear-gradient(180deg, rgba(25, 20, 45, 0.96), rgba(15, 15, 24, 0.98));
}

.card-preview-kicker {
    color: #a78bfa;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.card-preview-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.2;
}

.card-preview-sub {
    margin: 0;
    color: #a1a1aa;
    font-size: 14px;
    line-height: 1.55;
}

.card-preview-repeat {
    margin-top: 12px;
    border: none;
    border-radius: 18px;
    padding: 15px 18px;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 14px 30px rgba(79, 70, 229, 0.35);
}

.card-preview-repeat strong {
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.32);
}

.card-preview-empty {
    color: #a1a1aa;
    font-size: 15px;
}

.card-preview-ba {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 520px;
    align-self: stretch;
}

.card-preview-ba .ba-container {
    border-radius: 0;
}

.card-preview-ba .ba-before,
.card-preview-ba .ba-after {
    background-size: contain;
    background-repeat: no-repeat;
    background-color: #07070c;
}

@media (max-width: 760px) {
    .card-preview-backdrop {
        padding: 0;
    }
    .card-preview-modal {
        width: 100%;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(0, 1fr) auto;
    }
    .card-preview-media {
        min-height: 0;
    }
    .card-preview-ba {
        min-height: 0;
    }
    .card-preview-media img,
    .card-preview-media video {
        max-height: none;
    }
    .card-preview-body {
        padding: 22px 18px 24px;
    }
    .card-preview-title {
        font-size: 20px;
    }
}

.modal-grid {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.modal-left {
    border-radius: 24px;
    background: rgba(0, 0, 0, 0.38);
    border: 1px solid rgba(255, 255, 255, 0.07);
    padding: 16px;
}

.modal-left-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.modal-left-title {
    font-weight: 700;
    font-size: 18px;
}

.modal-left-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.tool-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
}

.tool-tile {
    background: #1e1e2c;
    border: none;
    border-radius: 26px;
    padding: 16px 20px;
    flex: 1 0 180px;
    text-align: left;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tool-tile:hover {
    background: #2a2a3c;
    transform: translateY(-2px);
}

.tool-tile.active {
    background: #3b3b58;
    border: 1px solid #a78bfa;
}

.tool-title {
    color: rgba(255, 255, 255, 0.96);
    font-weight: 600;
    font-size: 16px;
}

.tool-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #a855f7, #3b82f6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
}

.tool-sub {
    font-size: 14px;
    color: var(--text-muted);
}

.tool-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 4px;
}

.token-pill {
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.35);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(139, 92, 246, 0.95);
    font-size: 14px;
    white-space: nowrap;
}

.token-pill strong {
    color: #fff;
    font-weight: 700;
}

.form-card {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 16px;
}

.form-label {
    color: var(--text-muted);
    font-size: 16px;
}

.select, .textarea, .input {
    background: #0a0a12;
    border: 1px solid #2c2c3a;
    border-radius: 26px;
    padding: 18px 24px;
    color: white;
    font-size: 18px;
    width: 100%;
    font-family: inherit;
    transition: border-color 0.2s;
}

.select {
    height: 56px;
    padding: 0 24px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%239ca3af' d='M7 10L2 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 42px;
}

.textarea {
    min-height: 130px;
    line-height: 1.5;
    resize: vertical;
}

#prompt-input {
    resize: none;
}

.input {
    height: 56px;
}

.input::placeholder,
.textarea::placeholder {
    color: rgba(156, 163, 175, 0.6);
}

.select:focus, .textarea:focus, .input:focus {
    border-color: rgba(139, 92, 246, 0.7);
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.generate-button {
    background: linear-gradient(95deg, #8b5cf6, #3b82f6);
    border: none;
    padding: 18px;
    border-radius: 50px;
    font-weight: bold;
    color: white;
    font-size: 20px;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.generate-button-price {
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.35);
    font-size: 0.84em;
    white-space: nowrap;
}

.generate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(139, 92, 246, 0.4);
}

.generate-button:active {
    transform: translateY(0);
}

.generate-button[disabled] {
    opacity: 0.6;
    cursor: default;
    box-shadow: none;
    transform: none;
}

.generate-button.loading {
    position: relative;
    pointer-events: none;
}

.generate-button.loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
    margin-left: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== FORM ERROR & FOOTER ===== */
.form-error {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 79, 79, 0.1);
    border: 1px solid rgba(255, 79, 79, 0.3);
    color: #ff6b6b;
    font-size: 16px;
    line-height: 1.4;
}

.form-error.success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.auth-extra-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -4px;
}

.auth-extra-row a {
    color: #c084fc;
    font-size: 14px;
    text-decoration: none;
}

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

.auth-divider {
    align-items: center;
    color: var(--text-muted);
    display: flex;
    font-size: 14px;
    gap: 12px;
    margin: 2px 0;
}

.auth-divider::before,
.auth-divider::after {
    background: var(--border-subtle);
    content: '';
    flex: 1;
    height: 1px;
}

.vk-auth-button {
    align-items: center;
    background: #0077ff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50px;
    color: #fff;
    display: flex;
    font-size: 17px;
    font-weight: 700;
    justify-content: center;
    min-height: 54px;
    padding: 0 18px;
    text-decoration: none;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.vk-auth-button:hover {
    background: #0a6fe8;
    box-shadow: 0 6px 18px rgba(0, 119, 255, 0.32);
    transform: translateY(-2px);
}

.vk-auth-widget {
    min-height: 44px;
}

.vk-auth-widget:empty {
    display: none;
}

.form-footer {
    text-align: center;
    font-size: 16px;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-footer a {
    color: #c084fc;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.form-footer a:hover {
    color: #a855f7;
    text-decoration: underline;
}

.form-hint {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== HISTORY ===== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 10px;
}

.history-item {
    background: #12121c;
    border-radius: 26px;
    padding: 20px;
    transition: background 0.2s;
}

.history-item:hover {
    background: #1a1a2a;
}

.history-thumb {
    width: 84px;
    height: 84px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    background: #000;
}

.history-thumb img, .history-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-meta-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 6px;
}

.history-meta-sub {
    color: var(--text-muted);
    font-size: 14px;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.text-glow {
    color: #c084fc;
}

/* ===== PROFILE ===== */
.profile-card {
    background: #12121c;
    border-radius: 24px;
    padding: 24px;
    border: 1px solid #26263a;
    width: 100%;
    box-sizing: border-box;
}

.profile-header {
    display: flex;
    gap: 20px;
    align-items: center;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #a855f7, #3b82f6);
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    font-weight: 700;
}

.profile-name {
    font-weight: 600;
    font-size: 20px;
}

.profile-sub {
    font-size: 16px;
    color: var(--text-muted);
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-top: 24px;
}

.profile-stat {
    padding: 16px;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.4);
    text-align: center;
    min-width: 0;
}

.profile-stat-value {
    font-size: 16px;
    font-weight: 700;
    color: #c084fc;
    line-height: 1.25;
    overflow-wrap: anywhere;
}


.profile-stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.profile-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.profile-actions .primary-button,
.profile-actions .secondary-button {
    flex: 1;
    justify-content: center;
    min-width: 140px;
}

/* Profile Details */
.profile-details {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
}

.profile-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.profile-detail-label {
    color: var(--text-muted);
    font-size: 14px;
}

.profile-detail-value {
    font-weight: 500;
    font-size: 14px;
}

/* Profile Recent Generations */
.profile-quick-stats {
    margin-top: 30px;
}

.profile-recent-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.profile-recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #12121c;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
}

.profile-recent-status {
    font-size: 16px;
}

.profile-recent-model {
    flex: 1;
    font-weight: 500;
}

.profile-recent-date {
    color: var(--text-muted);
    font-size: 13px;
}

.profile-recent-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 14px;
}

/* Profile Tabs */
.profile-tabs {
    display: flex;
    gap: 8px;
    margin: 24px 0 20px;
    border-bottom: 1px solid #23232e;
    padding-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.profile-tab-btn {
    background: transparent;
    border: none;
    color: #9ca3af;
    font-weight: 600;
    font-size: 15px;
    padding: 8px 18px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.profile-tab-btn.active {
    background: #2d2d3e;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.profile-tab-btn:hover:not(.active) {
    color: white;
    background: #23232e;
}

.profile-tab-content {
    animation: fadeIn 0.3s ease;
}

.growth-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.growth-panel,
.contest-head,
.contest-item {
    background: #12121c;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 18px;
}

.growth-panel.is-loading {
    opacity: 0.65;
    pointer-events: none;
}

.growth-panel-head,
.contest-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.growth-panel-head h3,
.contest-head h3 {
    font-size: 18px;
    margin: 0 0 4px;
}

.growth-panel-head span,
.contest-head span,
.reward-item span,
.referral-stats {
    color: var(--text-muted);
    font-size: 13px;
}

.reward-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.reward-note {
    padding: 12px 14px;
    border: 1px solid rgba(139, 92, 246, 0.28);
    background: rgba(139, 92, 246, 0.08);
    border-radius: 14px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
}

.reward-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    background: #171722;
    border: 1px solid #252535;
    border-radius: 14px;
}

.reward-item--stacked {
    align-items: stretch;
    flex-direction: column;
}

.reward-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.reward-item strong {
    display: block;
    font-size: 15px;
    margin-bottom: 4px;
}

.community-options {
    display: grid;
    gap: 10px;
}

.community-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    background: #11111b;
    border: 1px solid #28283a;
    border-radius: 12px;
}

.reward-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.reward-action,
.reward-link {
    min-height: 40px;
    white-space: nowrap;
}

.referral-copy-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.referral-copy-row .input {
    min-width: 0;
}

.referral-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.referral-stats strong {
    color: #fff;
}

.franchise-panel {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
}

.franchise-link {
    align-self: flex-start;
}

.growth-error {
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.08);
    color: #fecaca;
    border-radius: 12px;
}

.contest-head {
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.contest-periods {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.contest-period-btn {
    border: 1px solid #2f3040;
    background: #171722;
    color: var(--text-muted);
    border-radius: 999px;
    padding: 8px 14px;
    font-weight: 700;
    cursor: pointer;
}

.contest-period-btn.active {
    background: #2563eb;
    border-color: #3b82f6;
    color: #fff;
}

.contest-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.contest-item {
    display: grid;
    grid-template-columns: auto 84px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
}

.contest-rank {
    width: 42px;
    color: #fbbf24;
    font-weight: 800;
    font-size: 18px;
}

.contest-media {
    width: 84px;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #080812;
}

.contest-media img,
.contest-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.contest-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contest-info strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contest-info span,
.contest-info small {
    color: var(--text-muted);
}

.contest-like-btn,
.media-publish-btn {
    border: 1px solid #2f3040;
    background: #191926;
    color: #fff;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.contest-like-btn.liked {
    border-color: rgba(244, 63, 94, 0.7);
    color: #fb7185;
}

.feed-section {
    max-width: 1180px;
    margin: 0 auto;
}

.feed-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.feed-card {
    overflow: hidden;
    background: #12121c;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
}

.feed-card-media {
    aspect-ratio: 4 / 5;
    background: #080812;
    overflow: hidden;
}

.feed-card-media img,
.feed-card-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.feed-card-media video {
    background: #05050b;
}

.feed-card-body {
    padding: 14px;
}

.feed-card-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--text-muted);
    font-size: 12px;
    margin-bottom: 8px;
}

.feed-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    line-height: 1.3;
}

.feed-card-prompt {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.45;
    margin: 0 0 12px;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.feed-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.feed-card-actions .secondary-button,
.feed-card-actions .contest-like-btn {
    min-height: 40px;
}

.feed-load-controls {
    justify-content: center;
    margin-top: 18px;
}

.feed-share-backdrop {
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.feed-share-sheet {
    width: min(460px, 100%);
    position: relative;
    background: #12121c;
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 22px 80px rgba(0, 0, 0, 0.48);
}

.feed-share-close {
    position: absolute;
    right: 12px;
    top: 12px;
}

.feed-share-head {
    padding-right: 42px;
    margin-bottom: 16px;
}

.feed-share-head h3 {
    margin: 0 0 6px;
    font-size: 20px;
}

.feed-share-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.feed-share-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.feed-share-target,
.feed-share-copy {
    border: 1px solid #2f3040;
    background: #191926;
    color: #fff;
    border-radius: 12px;
    min-height: 46px;
    padding: 0 14px;
    font-weight: 800;
    cursor: pointer;
}

.feed-share-target:hover,
.feed-share-copy:hover {
    border-color: rgba(139, 92, 246, 0.65);
    background: #202033;
}

.feed-share-target--vk { color: #7db6ff; }
.feed-share-target--telegram { color: #7dd3fc; }
.feed-share-target--whatsapp { color: #86efac; }
.feed-share-target--max { color: #93c5fd; }
.feed-share-target--ok { color: #fdba74; }
.feed-share-target--native { color: #c4b5fd; }

.feed-share-copy {
    width: 100%;
    margin-top: 10px;
    color: #c4b5fd;
}

.contest-like-btn:disabled,
.media-publish-btn:disabled {
    cursor: default;
    opacity: 0.72;
}

.media-publish-btn {
    display: inline-flex;
    margin-top: 10px;
}

.media-publish-btn.published {
    border-color: rgba(34, 197, 94, 0.5);
    color: #86efac;
}

@media (max-width: 640px) {
    .reward-item,
    .referral-copy-row,
    .community-option,
    .reward-main {
        align-items: stretch;
        flex-direction: column;
    }

    .reward-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        justify-content: stretch;
    }

    .reward-action,
    .reward-link {
        width: 100%;
        justify-content: center;
    }

    .contest-item {
        grid-template-columns: auto 72px minmax(0, 1fr);
    }

    .contest-like-btn {
        grid-column: 2 / -1;
        justify-self: start;
    }

    .contest-media {
        width: 72px;
    }

    .feed-grid {
        grid-template-columns: 1fr;
    }

    .feed-card-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

/* Pricing Balance Card */
.pricing-balance-card {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    margin-bottom: 24px;
    width: 100%;
    box-sizing: border-box;
}

.pricing-balance-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.pricing-balance-amount {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pricing-balance-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Pricing Info Card */
.pricing-info-card {
    background: #12121c;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 20px;
    margin-top: 24px;
    width: 100%;
    box-sizing: border-box;
}

.pricing-info-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 16px;
}

.pricing-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pricing-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.pricing-info-cost {
    color: #fbbf24;
    font-weight: 600;
}

/* First-payment Starter Bonus Card */
.pricing-starter-card {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.12), rgba(245, 158, 11, 0.08));
    border: 1px solid rgba(251, 191, 36, 0.4);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

.pricing-starter-card::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.pricing-starter-badge {
    display: inline-block;
    background: rgba(251, 191, 36, 0.18);
    color: #fbbf24;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: 0.02em;
}

.pricing-starter-headline {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.pricing-starter-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 18px;
}

.pricing-starter-btn {
    background: linear-gradient(135deg, #f59e0b, #fbbf24) !important;
    color: #1a1200 !important;
    font-weight: 700 !important;
    border: none !important;
    box-shadow: 0 4px 16px rgba(251, 191, 36, 0.35);
}

.pricing-starter-btn:hover {
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
    transform: translateY(-1px);
}

/* Active Subscription Card */
.pricing-subscription-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(59, 130, 246, 0.08));
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 20px;
    padding: 20px 24px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.pricing-subscription-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #10b981;
    margin-bottom: 4px;
}

.pricing-subscription-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
}

.pricing-subscription-next {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.pricing-cancel-btn {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.5);
    color: #ef4444;
    border-radius: 12px;
    padding: 10px 18px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.pricing-cancel-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.pricing-cancel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ===== SAVED CARDS LIST ===== */
.cards-loading,
.cards-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.cards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 0;
}

.card-item {
    background: #12121c;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.card-item-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.card-icon {
    font-size: 28px;
    flex-shrink: 0;
}

.card-details {
    min-width: 0;
}

.card-number {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.03em;
}

.card-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.card-next-billing {
    font-size: 12px;
    color: #10b981;
    margin-top: 4px;
}

.card-status-active {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.card-status-inactive {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}

.card-delete-btn {
    background: transparent;
    border: 1px solid rgba(239, 68, 68, 0.45);
    color: #ef4444;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}

.card-delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

.card-delete-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.card-delete-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

.card-delete-confirm {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary, #8a8a9a);
    cursor: pointer;
    white-space: nowrap;
}

.card-delete-confirm input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #ef4444;
}

/* VK mobile payment stub */
.pricing-unavailable-notice {
    background: #12121c;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 15px;
    margin-top: 8px;
    width: 100%;
    box-sizing: border-box;
}

/* History Loading */
.history-loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 16px;
}

/* History Date Group */
.history-date-group h3 {
    font-size: 14px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

/* History Item Enhanced */
.history-item {
    background: #12121c;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 12px;
    transition: all var(--transition-smooth);
}

.history-item:hover {
    background: #1a1a2a;
    border-color: rgba(139, 92, 246, 0.2);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-type {
    font-weight: 600;
    font-size: 15px;
}

.history-item-prompt {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-item-media {
    margin-top: 16px;
    border-radius: 16px;
    overflow: hidden;
}

.history-item-media img,
.history-item-media video {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 16px;
    display: block;
}

/* Download button in history items */
.media-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 8px 16px;
    background: #2d2d3e;
    color: white;
    text-decoration: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.media-download-btn:hover {
    background: #3d3d5e;
    color: white;
    text-decoration: none;
}

/* User input media display */
.history-item-input-media {
    margin-top: 12px;
    padding: 12px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.input-media-label {
    width: 100%;
    font-size: 13px;
    color: #9ca3af;
    font-weight: 500;
}

.input-media-preview {
    max-width: 120px;
    max-height: 80px;
    border-radius: 8px;
    object-fit: cover;
}

.input-media-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: #23232e;
    border-radius: 8px;
    text-decoration: none;
    font-size: 16px;
    transition: background 0.2s;
}

.input-media-download:hover {
    background: #2d2d3e;
    text-decoration: none;
}

.history-item-time {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* History Status Pills */
.history-status {
    font-size: 13px;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 500;
}

.status-completed {
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
}

.status-processing {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
}

.status-failed {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-queued {
    background: rgba(96, 165, 250, 0.1);
    color: #60a5fa;
}

/* History Empty State */
.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.history-empty-icon {
    font-size: 72px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.history-empty-text {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.history-empty-sub {
    font-size: 16px;
    color: var(--text-muted);
    margin-bottom: 24px;
    max-width: 400px;
}

/* Model Info in Modal */
.model-info {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.2);
    border-radius: 16px;
    padding: 14px 18px;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.model-info strong {
    color: #c084fc;
}

/* ===== VIEW MANAGEMENT ===== */
.view {
    display: none;
}

.view-active {
    display: block;
}

main {
    min-height: 300px;
    width: 100%;
}

.view section {
    min-height: 200px;
    width: 100%;
    padding: 0;
}

.view {
    width: 100%;
}



/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .app-shell {
        padding: 20px 12px 90px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 32px;
    }

    .header-actions {
        width: 100%;
        /* justify-content: space-between; */
    }

    .hero-grid {
        gap: 24px;
    }

    .models-grid {
        gap: 24px;
    }

    .trends-grid {
        gap: 20px;
    }

    .pricing-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

@media (max-width: 640px) {
    .app-shell {
        padding: 16px 8px 80px;
    }

    .hero-grid {
        gap: 20px;
    }

    .hero-title {
        font-size: 20px;
    }

    .generation-tabs {
        gap: 10px;
        margin: 28px 0 20px;
    }

    .tab-btn {
        font-size: 16px;
        padding: 8px 18px;
    }

    .modal {
        padding: 24px;
        border-radius: 36px;
    }

    .pages-dropdown-content {
        top: 0;
        max-height: 100dvh;
        min-height: 100dvh;
    }

    .pages-dropdown-header {
        padding: 16px 18px;
    }

    .pages-dropdown-list {
        max-height: calc(100dvh - 72px);
        padding: 8px 10px 18px;
    }

    .pages-dropdown-item {
        align-items: flex-start;
        border-radius: 12px;
    }

    .pages-dropdown-desc {
        margin-left: 30px;
    }

    .tool-grid {
        flex-direction: column;
    }

    .tool-tile {
        flex: 1 0 auto;
    }
}

/* ===== FADE IN ANIMATION ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* ===== HELPER TIP ===== */
.helper-tip {
    font-size: 14px;
    color: var(--text-muted);
}

/* ===== CATALOG GRID (Holidays & Trends) ===== */
.catalog-grid {
    display: flex;
    overflow-x: auto;
    gap: 22px;
    margin-bottom: 52px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.catalog-grid::-webkit-scrollbar {
    display: none;
}

.catalog-card {
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    aspect-ratio: 3 / 4;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #111118;
    flex: 0 0 220px;
    scroll-snap-align: start;
}

.catalog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 28px -10px rgba(0, 0, 0, 0.5);
}

.catalog-thumb {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: saturate(1.05);
}
/* Fallback shimmer when no image is loaded (no data-bg or failed load) */
.catalog-thumb[data-bg] {
    background-color: #1a1a2e;
    animation: catalogThumbShimmer 1.5s ease-in-out infinite alternate;
}
@keyframes catalogThumbShimmer {
    from { opacity: 0.6; }
    to   { opacity: 1; }
}

.catalog-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(8px);
    padding: 5px 14px;
    border-radius: 40px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 3;
}

.catalog-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px #4ade80;
}

.catalog-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    z-index: 2;
}

.catalog-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
}

.catalog-subtitle {
    font-size: 13px;
    color: #cbd5e1;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* ===== LEAD MAGNET SECTION ===== */
.lead-magnet-grid {
    display: flex;
    overflow-x: auto;
    gap: 24px;
    margin-bottom: 52px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    scrollbar-width: none;
}

.lead-magnet-grid::-webkit-scrollbar {
    display: none;
}

.lead-magnet-grid::-webkit-scrollbar {
    display: none;
}

.lead-magnet-card {
    background: #12121c;
    border: 1px solid var(--border-subtle);
    border-radius: 24px;
    padding: 28px;
    transition: all var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    flex: 0 0 280px;
    scroll-snap-align: start;
}

.lead-magnet-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
    border-color: rgba(139, 92, 246, 0.3);
}

.lead-magnet-icon {
    font-size: 36px;
    width: 56px;
    height: 56px;
    background: rgba(139, 92, 246, 0.12);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lead-magnet-title {
    font-size: 18px;
    font-weight: 700;
}

.lead-magnet-subtitle {
    font-size: 14px;
    color: #c084fc;
    font-weight: 500;
}

.lead-magnet-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}

.lead-magnet-badge-inline {
    font-size: 12px;
    font-weight: 600;
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
    padding: 4px 12px;
    border-radius: 20px;
}

.lead-magnet-btn {
    width: 100%;
    padding: 14px;
    border-radius: 50px;
    border: 1px solid rgba(139, 92, 246, 0.4);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(59, 130, 246, 0.1));
    color: #c084fc;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.lead-magnet-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, #3b82f6);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

/* ===== FORM SUCCESS ===== */
.form-success {
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(74, 222, 128, 0.1);
    border: 1px solid rgba(74, 222, 128, 0.3);
    color: #4ade80;
    font-size: 16px;
    line-height: 1.4;
}

/* ===== RESPONSIVE CATALOG ===== */
@media (max-width: 900px) {
    .catalog-grid {
        gap: 16px;
    }

    .lead-magnet-grid {
        gap: 20px;
    }
}

/* ===== SITE SEARCH ===== */
.search-container {
    display: flex;
    align-items: center;
}

.search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.search-trigger:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.search-shortcut {
    font-size: 11px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.4);
}

.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 120px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.search-modal {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 20px;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    transform: translateY(-10px);
    transition: transform 0.2s ease;
}

.search-overlay.active .search-modal {
    transform: translateY(0);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.search-icon {
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font-size: 16px;
    padding: 8px 12px;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.search-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.15s ease;
}

.search-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.search-placeholder,
.search-no-results,
.search-loading {
    padding: 40px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.35);
    font-size: 14px;
}

.search-loading {
    color: #818cf8;
}

.search-group {
    margin-bottom: 8px;
}

.search-group-title {
    padding: 8px 12px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.35);
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    color: #fff;
    transition: background 0.15s ease;
}

.search-result-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.search-result-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.search-result-info {
    flex: 1;
    min-width: 0;
}

.search-result-title {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-result-subtitle {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 640px) {
    .search-shortcut {
        display: none;
    }
    
    .search-overlay {
        padding-top: 60px;
    }
    
    .search-modal {
        margin: 0 12px;
        max-width: none;
    }
}

@media (max-width: 640px) {
    .catalog-grid {
        gap: 12px;
    }

    .catalog-title {
        font-size: 14px;
    }

    .catalog-subtitle {
        font-size: 11px;
    }

    .lead-magnet-grid {
        gap: 16px;
    }

    .lead-magnet-card {
        padding: 20px;
    }
}

/* ===== AI CHAT WIDGET ===== */
.ai-chat-widget {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* FAB button with animated pulse ring */
.ai-chat-fab {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 60%, #a855f7 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 28px rgba(99, 102, 241, 0.5), 0 2px 8px rgba(99, 102, 241, 0.2);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
    position: relative;
}

.ai-chat-fab::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.22) 0%, transparent 55%);
    border-radius: inherit;
    pointer-events: none;
}

.ai-chat-fab::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 24px;
    border: 2px solid rgba(139, 92, 246, 0.35);
    animation: fabRing 2.5s ease-in-out infinite;
    pointer-events: none;
}

@keyframes fabRing {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 0; transform: scale(1.18); }
}

.ai-chat-fab:hover {
    transform: scale(1.07) translateY(-2px);
    box-shadow: 0 14px 36px rgba(99, 102, 241, 0.6), 0 4px 12px rgba(99, 102, 241, 0.25);
}

.ai-chat-fab:active {
    transform: scale(0.95);
}

/* Chat window */
.ai-chat-window {
    position: absolute;
    bottom: 74px;
    right: 0;
    width: 400px;
    max-width: calc(100vw - 48px);
    height: 580px;
    max-height: calc(100vh - 130px);
    background: #141424;
    border-radius: 22px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatSlideUp 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.ai-chat-window.open {
    display: flex;
}

@keyframes chatSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.95); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* Unified header (Telegram-style: avatar+name left, actions right) */
.ai-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 14px 14px 18px;
    background: linear-gradient(135deg, #5b5ef4 0%, #7c3aed 55%, #9333ea 100%);
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.ai-chat-header::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 65%);
    border-radius: 50%;
    pointer-events: none;
}

.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.ai-chat-header-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ai-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    border: 1.5px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-chat-title {
    font-size: 14.5px;
    font-weight: 600;
    color: white;
    letter-spacing: -0.01em;
    line-height: 1.2;
}

.ai-chat-status {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    gap: 5px;
}

.ai-chat-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.7);
    animation: pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.65; transform: scale(0.85); }
}

.ai-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.ai-chat-action-btn,
.ai-chat-close-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    transition: background 0.18s ease, transform 0.14s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

.ai-chat-action-btn:hover,
.ai-chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.07);
}

.ai-chat-action-btn:active,
.ai-chat-close-btn:active {
    transform: scale(0.93);
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #111120;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    transition: background 0.2s;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.ai-chat-welcome {
    text-align: center;
    padding: 32px 16px 24px;
}

.ai-chat-welcome-icon {
    margin-bottom: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(139, 92, 246, 0.14));
    border-radius: 22px;
    border: 1px solid rgba(139, 92, 246, 0.22);
    color: #a78bfa;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.12);
}

.ai-chat-welcome h3 {
    font-size: 19px;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0 0 10px;
    letter-spacing: -0.02em;
}

.ai-chat-welcome p {
    font-size: 13px;
    color: #94a3b8;
    margin: 0 0 24px;
    line-height: 1.6;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.ai-chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.ai-chat-suggestion {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.12));
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: #c7d2fe;
    padding: 9px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.ai-chat-suggestion:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(139, 92, 246, 0.22));
    border-color: rgba(99, 102, 241, 0.45);
    color: #e0e7ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Chat messages */
.ai-chat-message,
.ai-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 88%;
    animation: fadeIn 0.3s ease-out;
}

.ai-chat-message.user,
.ai-chat-msg.user {
    align-self: flex-end;
    align-items: flex-end;
}

.ai-chat-message.assistant,
.ai-chat-msg.assistant {
    align-self: flex-start;
    align-items: flex-start;
}

/* Message row (avatar + bubble) */
.ai-chat-msg-row {
    display: flex;
    gap: 10px;
}

.ai-chat-message.user .ai-chat-msg-row,
.ai-chat-msg.user .ai-chat-msg-row {
    flex-direction: row-reverse;
}

.ai-chat-msg-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ai-chat-message.user .ai-chat-msg-avatar,
.ai-chat-msg.user .ai-chat-msg-avatar {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-message.assistant .ai-chat-msg-avatar,
.ai-chat-msg.assistant .ai-chat-msg-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-chat-msg-bubble {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-chat-message.user .ai-chat-msg-bubble,
.ai-chat-msg.user .ai-chat-msg-bubble {
    background: linear-gradient(135deg, #5b5ef4 0%, #7c3aed 100%);
    color: white;
    border-bottom-right-radius: 5px;
    border: none;
    box-shadow: 0 2px 10px rgba(91, 94, 244, 0.3);
}

.ai-chat-message.assistant .ai-chat-msg-bubble,
.ai-chat-msg.assistant .ai-chat-msg-bubble {
    background: #1e1e30;
    color: #dde4f0;
    border-bottom-left-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-chat-msg-bubble p {
    margin: 0 0 8px;
}

.ai-chat-msg-bubble p:last-child {
    margin-bottom: 0;
}

.ai-chat-msg-bubble code {
    background: rgba(0, 0, 0, 0.35);
    padding: 3px 7px;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-chat-msg-bubble pre {
    background: rgba(0, 0, 0, 0.4);
    padding: 14px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-chat-msg-bubble pre code {
    background: none;
    padding: 0;
    border: none;
}

.ai-chat-msg-bubble ul, .ai-chat-msg-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-chat-msg-bubble li {
    margin-bottom: 4px;
}

.ai-chat-msg-bubble a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    margin: 4px 0;
    background: rgba(99, 102, 241, 0.25);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    word-break: break-all;
    transition: background 0.2s, color 0.2s;
}

.ai-chat-msg-bubble a::before {
    content: '↗';
    font-size: 11px;
    opacity: 0.8;
}

.ai-chat-msg-bubble a:hover {
    background: rgba(99, 102, 241, 0.4);
    color: #c7d2fe;
}

/* Typing indicator */
.ai-chat-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: flex-start;
}

.ai-chat-typing-dots {
    display: flex;
    gap: 5px;
    padding: 14px 18px;
    background: linear-gradient(135deg, #252542, #1e1e36);
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-chat-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    animation: typingBounce 1.4s infinite;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

.ai-chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* Chat input — Telegram-style pill */
.ai-chat-input {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: #141424;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.ai-chat-input input {
    flex: 1;
    background: #1e1e32;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    padding: 11px 18px;
    color: #f1f5f9;
    font-size: 14px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
    font-family: inherit;
}

.ai-chat-input input:focus {
    border-color: rgba(99, 102, 241, 0.55);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.ai-chat-input input::placeholder {
    color: #4a5068;
}

/* Circular send button like Telegram */
.ai-chat-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    -webkit-tap-highlight-color: transparent;
}

.ai-chat-send:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.5);
}

.ai-chat-send:active {
    transform: scale(0.9);
}

.ai-chat-send:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Chat history sidebar */
.ai-chat-history {
    position: absolute;
    top: 0;
    left: -300px;
    width: 280px;
    height: 100%;
    background: linear-gradient(180deg, #1e1e36 0%, #1a1a2e 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    z-index: 10;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
}

.ai-chat-history.open {
    left: 0;
}

.ai-chat-history-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-history-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
}

.ai-chat-history-close {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-history-close:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

.ai-chat-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.ai-chat-history-list::-webkit-scrollbar {
    width: 4px;
}

.ai-chat-history-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.ai-chat-history-item {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.ai-chat-history-item:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
    transform: translateX(2px);
}

.ai-chat-history-item-title {
    font-size: 13px;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    font-weight: 500;
}

.ai-chat-history-item-date {
    font-size: 11px;
    color: #64748b;
    flex-shrink: 0;
}

.ai-chat-history-item-delete {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    opacity: 0;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-history-item:hover .ai-chat-history-item-delete {
    opacity: 0.7;
}

.ai-chat-history-item-delete:hover {
    opacity: 1 !important;
    background: rgba(239, 68, 68, 0.15);
}

/* Mobile responsive */
@media (max-width: 480px) {
    .ai-chat-widget {
        bottom: 7rem;
        right: 16px;
        left: 16px;
    }

    .ai-chat-fab {
        width: 52px;
        height: 52px;
        border-radius: 16px;
    }

    .ai-chat-fab::after {
        inset: -5px;
        border-radius: 21px;
    }

    .ai-chat-window {
        position: fixed !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
    }

    .ai-chat-window.open {
        display: flex !important;
    }

    .ai-chat-suggestions {
        flex-direction: column;
    }

    .ai-chat-suggestion {
        white-space: normal;
    }

    .ai-chat-mode-selector {
        display: none;
    }
    
    .ai-chat-input-action {
        display: none;
    }

    /* Ensure messages area takes full width */
    .ai-chat-messages {
        padding: 16px 12px;
    }

    /* Full-width message bubbles on mobile */
    .ai-chat-message {
        max-width: 95%;
    }

    /* Full-width input area */
    .ai-chat-input {
        padding: 12px 12px;
    }

    .ai-chat-input input {
        padding: 12px 14px;
    }

    /* History sidebar full-width on mobile */
    .ai-chat-history {
        width: 100%;
        left: -100%;
    }

    .ai-chat-history.open {
        left: 0;
    }
}

/* ===== AI CHAT WIDGET — ENHANCED ===== */

/* Mode Selector */
.ai-chat-mode-selector {
    display: flex;
    gap: 2px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ai-chat-mode-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease, transform 0.14s ease;
    -webkit-tap-highlight-color: transparent;
}

.ai-chat-mode-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.85);
}

.ai-chat-mode-btn:active {
    transform: scale(0.9);
}

.ai-chat-mode-btn.active {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
}

/* Message Actions */
.ai-chat-msg-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ai-chat-message.assistant:hover .ai-chat-msg-actions,
.ai-chat-msg.assistant:hover .ai-chat-msg-actions {
    opacity: 1;
}

.ai-chat-msg-action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 12px;
    gap: 4px;
}

.ai-chat-msg-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
    transform: translateY(-1px);
}

/* Follow-up Suggestions */
.ai-chat-follow-up {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.ai-chat-follow-up-title {
    width: 100%;
    font-size: 11px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.ai-chat-follow-up-chip {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
    border: 1px solid rgba(99, 102, 241, 0.22);
    color: #a5b4fc;
    padding: 7px 14px;
    border-radius: 18px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.ai-chat-follow-up-chip:hover {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(139, 92, 246, 0.18));
    border-color: rgba(99, 102, 241, 0.4);
    color: #c7d2fe;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

/* Input Actions */
.ai-chat-input-action {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ai-chat-input-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

/* History Panel Enhancements */
.ai-chat-history-loading,
.ai-chat-history-empty {
    padding: 24px;
    text-align: center;
    color: #64748b;
    font-size: 13px;
}

.ai-chat-history-item {
    position: relative;
}

.ai-chat-history-item-title {
    cursor: pointer;
}

.ai-chat-history-item-date {
    cursor: pointer;
}

/* Markdown Enhancements */
.ai-chat-msg-bubble h2,
.ai-chat-msg-bubble h3,
.ai-chat-msg-bubble h4 {
    margin: 14px 0 8px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: -0.01em;
}

.ai-chat-msg-bubble h2 { font-size: 17px; }
.ai-chat-msg-bubble h3 { font-size: 15px; }
.ai-chat-msg-bubble h4 { font-size: 14px; }

.ai-chat-msg-bubble ul,
.ai-chat-msg-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-chat-msg-bubble li {
    margin-bottom: 4px;
}

.ai-chat-msg-bubble a {
    color: #818cf8;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ai-chat-msg-bubble a:hover {
    color: #a5b4fc;
}

/* Error message styling */
.ai-chat-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(220, 38, 38, 0.12));
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 13px;
    text-align: center;
    margin: 8px 0;
}

/* Success toast for copy */
.ai-chat-toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 100;
    pointer-events: none;
}

.ai-chat-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Profile History Section (shown on all screens) */
.profile-history-section {
    display: block;
    margin-top: 24px;
}

@media (max-width: 640px) {
    .profile-history-section .section-title h3 {
        font-size: 18px;
    }

    .profile-history-section .section-title span {
        font-size: 13px;
    }
}

/* Media Upload Area in Generate Modal */
.media-upload-area {
    position: relative;
    border: 2px dashed var(--border-subtle);
    border-radius: 16px;
    padding: 20px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    background: rgba(255, 255, 255, 0.02);
}

.media-upload-area:hover {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.05);
}

.media-upload-area.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.media-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-align: center;
    pointer-events: none;
}

.media-upload-placeholder span:first-child {
    font-size: 14px;
    font-weight: 500;
}

.media-upload-hint {
    font-size: 12px;
    opacity: 0.7;
}

#media-preview-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

#media-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: 12px;
    overflow: hidden;
}

#media-preview img,
#media-preview video {
    max-width: 100%;
    max-height: 200px;
    border-radius: 12px;
    object-fit: contain;
}

.media-reference-badge {
    position: absolute;
    left: 8px;
    top: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(18, 18, 28, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    backdrop-filter: blur(6px);
}

.media-preview-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.media-add-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px dashed rgba(139, 92, 246, 0.6);
    border-radius: 10px;
    background: rgba(139, 92, 246, 0.08);
    color: var(--accent);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.media-add-more-btn:hover {
    background: rgba(139, 92, 246, 0.16);
    border-color: var(--accent);
}

.media-remove-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 10px;
    background: transparent;
    color: #ef4444;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.media-remove-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
}

/* History item input media preview */
.history-item-input-media {
    margin-top: 8px;
    border-radius: 10px;
    overflow: hidden;
    max-height: 120px;
}

/* Credit transaction history */
.credit-tx-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.credit-tx-type {
    flex: 1 1 auto;
    font-size: 14px;
    color: var(--text);
    min-width: 120px;
}

.credit-tx-amount {
    font-weight: 600;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 8px;
}

.credit-positive {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.1);
}

.credit-negative {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

.credit-tx-date {
    font-size: 12px;
    color: var(--text-muted);
    min-width: 140px;
}

.credit-tx-desc {
    width: 100%;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: -4px;
}

.history-item-input-media img,
.history-item-input-media video {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
    border-radius: 10px;
    opacity: 0.7;
}

.history-item-input-media-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== GENERATE MODAL — compact layout ===== */
#generate-backdrop .modal {
    padding: 26px 30px;
}

#generate-backdrop .modal-header {
    margin-bottom: 10px;
}

#generate-backdrop .modal-title {
    font-size: 19px;
}

#generate-backdrop .modal-sub {
    font-size: 13px;
    margin-top: 2px;
}

#generate-backdrop .modal-grid {
    gap: 14px;
}

#generate-backdrop .form-field {
    gap: 5px;
    font-size: 15px;
}

#generate-backdrop .form-label {
    font-size: 13px;
}

#generate-backdrop .select {
    height: 46px;
    font-size: 15px;
    padding: 0 18px;
    border-radius: 16px;
}

#generate-backdrop .textarea {
    min-height: 84px;
    font-size: 15px;
    padding: 12px 18px;
    border-radius: 16px;
}

#generate-backdrop .media-upload-area {
    min-height: 72px;
    padding: 12px 18px;
    border-radius: 14px;
}

#generate-backdrop .media-upload-placeholder {
    gap: 4px;
}

#generate-backdrop .media-upload-placeholder span:first-child {
    font-size: 13px;
}

#generate-backdrop .generate-button {
    padding: 13px;
    font-size: 16px;
    border-radius: 16px;
}

#generate-backdrop .model-info {
    font-size: 13px;
    padding: 10px 14px;
}

.site-footer {
    text-align: center;
    padding: 24px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 40px;
    font-size: 13px;
    color: var(--text-muted);
}

.site-footer a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.site-footer a:hover {
    color: var(--accent);
}

.site-footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    flex-wrap: wrap;
}

/* ===== MINI APP (Telegram / VK) ===== */
.mini-app .auth-buttons,
.mini-app #profile-logout-btn {
    display: none !important;
}

/* ===== CREATE MENU ===== */
#create-menu-backdrop {
    align-items: flex-end;
    justify-content: center;
}

@keyframes slideUp {
    from { transform: translateY(60px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.create-menu-sheet {
    background: var(--bg-elevated);
    width: 100%;
    max-width: 500px;
    border-radius: 24px 24px 0 0;
    padding: 10px 14px 32px;
    max-height: 92vh;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: slideUp 0.28s cubic-bezier(0.34, 1.2, 0.64, 1) forwards;
    border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.55);
}

.create-menu-drag-handle {
    width: 38px;
    height: 4px;
    background: rgba(255,255,255,0.18);
    border-radius: 2px;
    margin: 2px auto 14px;
    flex-shrink: 0;
}

.create-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 0 2px;
    gap: 10px;
}

.create-menu-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
    text-align: center;
}

.create-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.07);
    border: none;
    color: var(--text);
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.create-back-btn:hover { background: rgba(255,255,255,0.13); }

/* 4-column grid — Screen 1 */
.create-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 9px;
}

.create-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 7px;
    padding: 13px 5px 11px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.18s ease, box-shadow 0.18s ease,
                background 0.18s ease, border-color 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.create-type-btn:hover,
.create-type-btn:active {
    transform: scale(1.03);
    background: rgba(139,92,246,0.1);
    border-color: rgba(139,92,246,0.4);
    box-shadow: 0 0 18px rgba(139,92,246,0.22), inset 0 0 12px rgba(139,92,246,0.07);
}

.create-type-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    color: #c4b5fd;
    flex-shrink: 0;
    transition: box-shadow 0.18s ease;
}

.create-type-label {
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    max-width: 100%;
}

/* Banana Pro — warm yellow accent */
.create-type-btn--accent .create-type-icon {
    background: rgba(234,179,8,0.14);
    color: #fbbf24;
}
.create-type-btn--accent:hover .create-type-icon,
.create-type-btn--accent:active .create-type-icon {
    box-shadow: 0 0 14px rgba(251,191,36,0.3);
}

/* Coming soon — muted, no hover scale */
.create-type-btn--soon {
    opacity: 0.48;
    cursor: default;
    position: relative;
}
.create-type-btn--soon:hover,
.create-type-btn--soon:active {
    transform: none;
    box-shadow: none;
    border-color: rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
}
.create-type-btn--soon::after {
    content: 'Скоро';
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #a78bfa;
    background: rgba(139,92,246,0.18);
    border: 1px solid rgba(139,92,246,0.3);
    border-radius: 4px;
    padding: 1px 5px;
    line-height: 16px;
}

/* Инструменты — gold border */
.create-type-btn--tools {
    border-color: rgba(251,191,36,0.38);
    background: rgba(251,191,36,0.05);
}
.create-type-btn--tools .create-type-icon {
    background: rgba(251,191,36,0.12);
    color: #fbbf24;
}
.create-type-btn--tools:hover,
.create-type-btn--tools:active {
    border-color: rgba(251,191,36,0.72);
    box-shadow: 0 0 18px rgba(251,191,36,0.22), inset 0 0 10px rgba(251,191,36,0.06);
    background: rgba(251,191,36,0.1);
}

/* ===== BEFORE / AFTER SLIDER ===== */
.ba-container {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    overflow: hidden;
    cursor: ew-resize;
    touch-action: none;
    user-select: none;
    z-index: 0;
}

.ba-before,
.ba-after {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
}

/* after starts showing right half */
.ba-after {
    clip-path: inset(0 0 0 50%);
}

/* quality tool: before looks degraded */
.ba-before.ba-degraded {
    filter: blur(2.5px) contrast(0.72) saturate(0.45) brightness(0.88);
}

.ba-handle-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.9);
    z-index: 4;
    pointer-events: none;
    box-shadow: 0 0 6px rgba(0,0,0,0.5);
}

.ba-handle-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
    box-shadow: 0 2px 10px rgba(0,0,0,0.55);
    z-index: 5;
    pointer-events: none;
    flex-shrink: 0;
}

.ba-label {
    position: absolute;
    top: 8px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: rgba(0,0,0,0.48);
    padding: 3px 7px;
    border-radius: 20px;
    z-index: 5;
    pointer-events: none;
    backdrop-filter: blur(4px);
    line-height: 1;
}
.ba-label-before { left: 8px; }
.ba-label-after  { right: 8px; }

/* 2×2 tool cards — Screen 2 */
.tools-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.tool-card {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    min-height: 170px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.tool-card:hover,
.tool-card:active {
    transform: scale(1.03);
    box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}

.tool-card-bg {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    background-size: cover;
    background-position: center top;
    background-color: #1a1040;
}

.tool-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top,
        rgba(0,0,0,0.82) 0%,
        rgba(0,0,0,0.18) 38%,
        transparent 62%);
    z-index: 1;
    pointer-events: none;
}

.tool-card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.18);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    z-index: 6;
    backdrop-filter: blur(6px);
    flex-shrink: 0;
    pointer-events: none;
}

.tool-card-text {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: #fff;
    line-height: 1.4;
    z-index: 6;
    letter-spacing: 0.04em;
    pointer-events: none;
}

@media (max-width: 380px) {
    .create-type-grid { gap: 7px; }
    .create-type-icon { width: 38px; height: 38px; font-size: 20px; }
    .tool-card { min-height: 148px; }
    .tool-card-text { font-size: 11px; }
}

/* ===== TOAST ===== */
#app-toast {
    position: fixed;
    bottom: 88px;
    left: 50%;
    transform: translateX(-50%) translateY(12px);
    background: rgba(30,20,60,0.96);
    color: #e0d6ff;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 24px;
    border: 1px solid rgba(139,92,246,0.35);
    backdrop-filter: blur(12px);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    z-index: 9999;
    transition: opacity 0.22s ease, transform 0.22s ease;
}
#app-toast.app-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== TOOLS GRID ===== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 8px;
}
.tool-card {
    background: #101018;
    border-radius: 20px;
    padding: 20px 18px;
    border: 1px solid #23232e;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}
.tool-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124,58,237,0.5);
    box-shadow: 0 12px 28px rgba(124,58,237,0.15);
}
.tool-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, rgba(124,58,237,0.25), rgba(79,70,229,0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(124,58,237,0.25);
    color: #a78bfa;
}
.tool-card-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}
.tool-card-desc {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    flex: 1;
}
.tool-card-cta {
    font-size: 12px;
    font-weight: 600;
    color: #7c3aed;
    display: flex;
    align-items: center;
    gap: 4px;
}
@media (max-width: 900px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .tool-card {
        padding: 16px 14px;
    }
    .tool-card-icon {
        width: 38px;
        height: 38px;
    }
    .tool-card-title {
        font-size: 13px;
    }
}

/* ===== VIDEO TREND CARDS ===== */
.trend-card .trend-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.88;
}

/* ===== GENERATED EFFECTS SECTION ===== */
.effects-page-section {
    max-width: 1180px;
    margin: 0 auto;
}
.effects-page-section > .section-title {
    display: none;
}
.effects-page-head {
    text-align: center;
    margin: 4px auto 28px;
    max-width: 720px;
}
.effects-page-head h2 {
    margin: 0 0 8px;
    font-size: 40px;
    line-height: 1.15;
    font-weight: 800;
    color: #f8fafc;
}
.effects-page-head p {
    margin: 0;
    color: #9ca3af;
    font-size: 17px;
    line-height: 1.55;
}
.effects-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin: 0 0 28px;
}
.effects-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #374151;
    background: #1f2937;
    color: #cbd5e1;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.1;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, background 0.2s, color 0.2s;
}
.effects-tag:hover {
    transform: translateY(-1px);
    border-color: rgba(139, 92, 246, 0.75);
    color: #ffffff;
}
.effects-tag.active {
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    border-color: transparent;
    color: #fff;
}
.effects-tag span {
    opacity: 0.72;
    font-size: 12px;
}
.effects-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 20px;
}
.effects-grid.is-loading {
    opacity: 0.58;
    pointer-events: none;
}
.effect-card {
    display: block;
    border: 1px solid #252b38;
    background: #111827;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.effect-card:hover {
    transform: translateY(-4px);
    border-color: #8b5cf6;
    box-shadow: 0 16px 40px rgba(139, 92, 246, 0.18);
}
.effect-card-media {
    position: relative;
    aspect-ratio: 3 / 4;
    background: #151826;
    overflow: hidden;
}
.effect-card-media::after {
    content: "lavastyle.ru";
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 3px 7px;
    border-radius: 7px;
    background: rgba(0, 0, 0, 0.62);
    color: rgba(255, 255, 255, 0.76);
    font-size: 10px;
    line-height: 1;
    backdrop-filter: blur(5px);
}
.effect-card-media img,
.effect-card-media video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s;
}
.effect-card:hover .effect-card-media img,
.effect-card:hover .effect-card-media video {
    transform: scale(1.045);
}
.effect-card-footer {
    padding: 15px;
}
.effect-card-title {
    margin: 0 0 5px;
    font-size: 15px;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.effect-card-desc {
    color: #9ca3af;
    font-size: 13px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.effect-card-chip {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    padding: 5px 9px;
    border-radius: 999px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    background: rgba(139, 92, 246, 0.15);
    color: #c4b5fd;
    font-size: 12px;
    font-weight: 600;
}
.effects-empty {
    margin-top: 16px;
    color: #9ca3af;
    font-size: 13px;
    text-align: center;
}
.effects-load-controls {
    margin-top: 34px;
    display: flex;
    justify-content: center;
}
.effects-load-more {
    border: 0;
    background: linear-gradient(135deg, #8b5cf6, #ec4899);
    color: #fff;
    border-radius: 12px;
    padding: 13px 20px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.effects-load-more span {
    opacity: 0.72;
    font-size: 14px;
    font-weight: 600;
}
.effects-load-more:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(139, 92, 246, 0.28);
}
.effects-load-more:disabled {
    cursor: wait;
    opacity: 0.65;
    transform: none;
}
.shown-count {
    margin: 14px 0 0;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}
.effects-load-sentinel {
    height: 1px;
}
@media (max-width: 1000px) {
    .effects-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 640px) {
    .effects-page-head {
        margin-top: 0;
        text-align: left;
    }
    .effects-page-head h2 {
        font-size: 29px;
    }
    .effects-page-head p {
        font-size: 15px;
    }
    .effects-tags {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin-left: -20px;
        margin-right: -20px;
        padding: 0 20px 4px;
        scrollbar-width: none;
    }
    .effects-tags::-webkit-scrollbar {
        display: none;
    }
    .effects-tag {
        flex: 0 0 auto;
    }
    .effects-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 13px;
    }
    .effect-card-footer {
        padding: 12px;
    }
    .effect-card-title {
        font-size: 14px;
    }
    .effect-card-desc {
        font-size: 12px;
    }
}

/* ===== TEMPLATE CATEGORY SECTION ===== */
.template-category {
    margin-top: 32px;
}
.template-category-label {
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    margin-bottom: 12px;
    padding-left: 2px;
}
.template-grid {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 6px 0 10px;
}
.template-grid::-webkit-scrollbar { display: none; }
.template-card {
    flex: 0 0 140px;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 3 / 4;
    position: relative;
    cursor: pointer;
    scroll-snap-align: start;
    transition: transform 0.2s, box-shadow 0.2s;
    background: #101018;
    border: 1px solid #23232e;
}
.template-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.5);
}
.template-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
@media (max-width: 480px) {
    .template-card { flex: 0 0 110px; border-radius: 12px; }
}
