* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #DC143C;
    --primary-dark: #B01030;
    --secondary-color: #FF4500;
    --background-dark: #1a0e0e;
    --background-darker: #0d0505;
    --card-bg: rgba(20, 10, 10, 0.95);
    --text-white: #ffffff;
    --text-gray: #b8b8b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --success-color: #00ff00;
    --gold-color: #FFD700;
    /* Safe area for fullscreen mode */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(180deg, var(--background-darker) 0%, var(--background-dark) 100%);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ========== HEADER ========== */
.header {
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* Spacer for Telegram's native UI (close button, menu) */
.tg-ui-spacer {
    height: calc(44px + var(--safe-area-top));
    /* This creates space for Telegram's X button and status bar */
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 12px 16px;
}

.header-content-compact {
    padding: 8px 16px 12px 16px;
}

.header-actions-full {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-right {
    display: flex;
    gap: 4px;
    align-items: center;
}

.logo-center {
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.logo-center span {
    color: var(--gold-color);
}

.header-actions-full {
    position: relative;
}

.menu-btn, .icon-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.menu-btn:active, .icon-btn:active {
    transform: scale(0.95);
}

.icon-btn.active path {
    fill: #FFD700 !important;
}

.logo {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.logo span {
    color: var(--gold-color);
}

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

.btn-free-credits {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%) !important;
    color: #1a0e0e !important;
    border: none !important;
    padding: 10px 16px !important;
    border-radius: 20px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
    text-decoration: none;
}

.btn-free-credits:active {
    transform: scale(0.95);
    box-shadow: 0 1px 4px rgba(255, 215, 0, 0.3);
}

.category-tabs {
    display: flex;
    gap: 8px;
    padding: 0 16px 12px 16px;
    overflow-x: hidden;
    scrollbar-width: none;
    flex-wrap: nowrap;
}

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

.tab-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-btn-icon {
    padding: 8px;
    min-width: 36px;
}

.tab-btn-icon svg {
    display: block;
}

.tab-btn-icon.active path {
    fill: #FFD700 !important;
}
    transition: all 0.3s;
}

.tab-btn.active {
    background: white;
    color: var(--primary-color);
}

/* ========== CHALLENGE BANNER ========== */
/* ========== FILTERS PANEL ========== */
.filters-panel {
    background: rgba(30, 15, 15, 0.98);
    padding: 16px;
    margin: 0 16px 16px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-color);
}

.filter-group {
    margin-bottom: 12px;
}

.filter-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-gray);
}

.filter-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-white);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.filter-group select:focus {
    border-color: var(--primary-color);
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.filter-reset-btn, .filter-apply-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-reset-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-white);
}

.filter-reset-btn:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.15);
}

.filter-apply-btn {
    background: var(--primary-color);
    color: var(--text-white);
}

.filter-apply-btn:active {
    transform: scale(0.98);
    background: var(--primary-dark);
}

.challenge-banner {
    background: linear-gradient(135deg, #ff6b00 0%, #ff3d00 100%);
    padding: 16px;
    margin: 16px 16px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(255, 69, 0, 0.4);
    position: relative;
    overflow: hidden;
}

.challenge-banner-sticky {
    position: sticky;
    top: 116px; /* Высота header (header-content ~64px + category-tabs ~52px) */
    z-index: 150;
    margin-top: 16px;
    margin-bottom: 16px;
}

.challenge-slider {
    position: relative;
    min-height: 60px;
}

.challenge-slide {
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.challenge-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 60px;
}

.challenge-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-right: 12px;
}

.challenge-amount {
    font-size: 20px;
    font-weight: 900;
    display: block;
    margin-bottom: 4px;
    line-height: 1.2;
}

.challenge-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 8px;
}

.challenge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: all 0.3s;
}

.challenge-dot.active {
    background: white;
    width: 24px;
    border-radius: 4px;
}

.challenge-text p {
    font-size: 13px;
    opacity: 0.9;
    margin: 0;
    line-height: 1.4;
}

.challenge-btn {
    background: white;
    color: var(--secondary-color);
    border: none;
    padding: 10px 24px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: transform 0.2s;
}

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

/* ========== MODELS GRID ========== */
.models-container {
    padding: 16px;
}

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

.model-card {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

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

.model-image {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}

.model-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom, transparent 40%, rgba(0, 0, 0, 0.8) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 12px;
}

.model-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-color);
    box-shadow: 0 0 8px var(--success-color);
    animation: pulse 2s infinite;
}

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

.model-name {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.model-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.badge.vip {
    background: var(--gold-color);
    color: #000;
}

.badge.promo {
    background: var(--secondary-color);
    color: white;
}

.model-features {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.feature-icon {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.discount-badge {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--secondary-color);
    color: white;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    transform: rotate(-5deg);
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.video-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #e91e63 0%, #9c27b0 100%);
    color: white;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 900;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.5);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: pulse-video 2s ease-in-out infinite;
}

@keyframes pulse-video {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(233, 30, 99, 0.5);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 2px 12px rgba(233, 30, 99, 0.8);
    }
}

.like-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

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

.like-btn svg {
    fill: white;
}

/* ========== CHAT PAGE ========== */
.chat-page {
    background: var(--background-darker);
}

.chat-header {
    background: rgba(13, 5, 5, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 4px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s ease;
    min-height: 44px;
    max-height: 44px;
}

.back-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
    opacity: 0.95;
}

.header-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header-text h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    color: rgba(255, 255, 255, 0.95);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

.live-badge {
    font-size: 9px;
    color: var(--success-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    opacity: 0.9;
    text-shadow: 0 0 6px rgba(0, 255, 0, 0.5);
    line-height: 1;
}

.chat-layout {
    position: relative;
    height: calc(100vh - 44px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-top: 44px;
}

/* Desktop: чат справа, видео слева */
@media (min-width: 768px) {
    .chat-layout {
        flex-direction: row;
    }
}

.video-section-fullscreen {
    position: relative;
    flex: 1;
    min-height: 0; /* КРИТИЧНО: Позволяет flex элементу сжиматься */
    width: 100%;
    background: #000;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Desktop: видео занимает оставшееся пространство */
@media (min-width: 768px) {
    .video-section-fullscreen {
        flex: 1;
        min-width: 0;
    }
}

.video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    position: relative;
}

/* КРИТИЧНО: Видео должно влезать полностью на экран */
.video-placeholder video {
    width: 100%;
    height: 100%;
    object-fit: contain; /* Видео влезает полностью, не обрезается */
    background: #000;
}

.video-loading {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

.video-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
}

.control-btn {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.control-btn:active {
    transform: scale(0.95);
    background: rgba(0, 0, 0, 0.8);
}

/* Room Info Overlay */
.room-info-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 70%, transparent 100%);
    backdrop-filter: blur(10px);
    z-index: 10;
    pointer-events: none; /* Не блокирует клики на видео */
}

/* Desktop: room-info только на видео, не на чате */
@media (min-width: 768px) {
    .room-info-overlay {
        right: 400px; /* Не перекрывает чат справа */
    }
}

.room-topic {
    font-size: 13px;
    margin-bottom: 4px;
    color: white;
    font-weight: 600;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.room-topic span {
    color: var(--gold-color);
}

.room-status {
    font-size: 11px;
    color: var(--success-color);
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* Commands Pills Container */
.commands-pills-container {
    padding: 12px 0 16px 0;
    margin-bottom: 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.3) 100%);
    border-radius: 16px 16px 0 0;
}

/* Mobile: убираем границу */
@media (max-width: 767px) {
    .commands-pills-container {
        border-bottom: none;
    }
}

.commands-pills-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scroll-snap-type: x proximity;
}

.commands-pills-scroll::-webkit-scrollbar {
    display: none;
}

.command-btn {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.4) 0%, rgba(255, 20, 147, 0.4) 100%);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 14px 28px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    flex-shrink: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    scroll-snap-align: start;
    box-shadow: 0 4px 15px rgba(138, 43, 226, 0.3);
}

/* Mobile: убираем blur и делаем кнопки более прозрачными */
@media (max-width: 767px) {
    .command-btn {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: none; /* Убираем размытие */
        border: 1px solid rgba(255, 255, 255, 0.3);
        text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9); /* Усиливаем тень для читаемости */
    }
    
    .command-btn.hot {
        background: rgba(255, 107, 0, 0.2);
        border-color: rgba(255, 107, 0, 0.5);
    }
    
    .command-btn.premium {
        background: rgba(156, 39, 176, 0.2);
        border-color: rgba(156, 39, 176, 0.5);
    }
    
    .command-btn.exclusive {
        background: rgba(233, 30, 99, 0.2);
        border-color: rgba(233, 30, 99, 0.5);
    }
}

.command-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(138, 43, 226, 0.5);
}

.command-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(138, 43, 226, 0.5);
}

.command-btn.hot {
    background: linear-gradient(135deg, rgba(255, 107, 0, 0.5) 0%, rgba(255, 69, 0, 0.5) 100%);
    border-color: rgba(255, 107, 0, 0.6);
    box-shadow: 0 4px 15px rgba(255, 107, 0, 0.4);
}

.command-btn.premium {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.5) 0%, rgba(103, 58, 183, 0.5) 100%);
    border-color: rgba(156, 39, 176, 0.6);
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.4);
}

.command-btn.exclusive {
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.5) 0%, rgba(255, 64, 129, 0.5) 100%);
    border-color: rgba(233, 30, 99, 0.4);
}

.command-btn.demo {
    background: rgba(255, 215, 0, 0.25);
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.command-btn.demo-command {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.3) 0%, rgba(255, 165, 0, 0.3) 100%);
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    font-weight: 700;
}

/* Chat Overlay */
.chat-overlay {
    position: relative;
    width: 100%;
    max-height: 40vh;
    min-height: 200px;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.9) 100%);
    backdrop-filter: blur(20px);
    z-index: 15;
    display: flex;
    flex-direction: column;
    padding-top: 12px;
    flex-shrink: 0; /* Не сжимается */
}

/* Mobile: прозрачный фон поверх видео БЕЗ размытия */
@media (max-width: 767px) {
    .chat-overlay {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        background: transparent; /* Полностью прозрачный фон */
        backdrop-filter: none; /* Убираем размытие */
        max-height: 50vh;
    }
}

/* Desktop: чат справа с непрозрачным фоном */
@media (min-width: 768px) {
    .chat-overlay {
        position: relative;
        width: 400px;
        max-width: 400px;
        min-width: 350px;
        max-height: 100%;
        min-height: 100%;
        background: linear-gradient(180deg, rgba(20, 10, 10, 0.98) 0%, rgba(13, 5, 5, 0.98) 100%);
        border-left: 1px solid var(--border-color);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    }
}

.chat-messages-overlay {
    flex: 1;
    overflow-y: auto;
    padding: 6px 16px;
    display: flex;
    flex-direction: column;
    max-height: 100px;
    gap: 8px;
    max-height: 120px;
}

/* Desktop: больше места для сообщений */
@media (min-width: 768px) {
    .chat-messages-overlay {
        max-height: calc(100vh - 300px);
        min-height: 200px;
    }
}

.chat-messages-overlay::-webkit-scrollbar {
    width: 4px;
}

.chat-messages-overlay::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
}

.chat-message {
    font-size: 13px;
    line-height: 1.4;
    background: transparent;
    padding: 4px 0;
    color: white;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Mobile: усиливаем тень для лучшей читаемости на видео */
@media (max-width: 767px) {
    .chat-message {
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.8);
    }
}

.chat-message .username {
    font-weight: 700;
    margin-right: 6px;
    color: white;
}

.chat-message.user .username {
    color: white;
}

.chat-message.model .username {
    color: white;
}

.system-message {
    background: transparent;
    padding: 6px 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Mobile: усиливаем тень для системных сообщений */
@media (max-width: 767px) {
    .system-message {
        text-shadow: 0 2px 8px rgba(0, 0, 0, 0.95), 0 0 4px rgba(0, 0, 0, 0.8);
    }
}

/* NSFW Switch Button */
.nsfw-switch-container {
    padding: 8px 16px;
    background: rgba(220, 20, 60, 0.2);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(220, 20, 60, 0.3);
}

.nsfw-switch-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #DC143C 0%, #B01030 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.4);
}

.nsfw-switch-btn:hover {
    background: linear-gradient(135deg, #FF1F4C 0%, #DC143C 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 20, 60, 0.6);
}

.nsfw-switch-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(220, 20, 60, 0.4);
}

/* Скрыть поле ввода - используем только команды */
.chat-input-overlay {
    display: none !important;
    visibility: hidden !important;
}

/* Mobile: убираем blur с инпута */
@media (max-width: 767px) {
    .chat-input-overlay {
        background: transparent;
        backdrop-filter: none;
    }
}

.chat-input-transparent {
    flex: 1;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 10px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    backdrop-filter: blur(10px);
}

/* Mobile: убираем blur с инпута, делаем более прозрачным */
@media (max-width: 767px) {
    .chat-input-transparent {
        background: rgba(255, 255, 255, 0.1);
        backdrop-filter: none;
        border: 1px solid rgba(255, 255, 255, 0.3);
    }
}

.chat-input-transparent::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.chat-input-transparent:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--primary-color);
}

.send-btn-overlay {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(220, 20, 60, 0.4);
}

.send-btn-overlay:active {
    transform: scale(0.95);
    box-shadow: 0 2px 6px rgba(220, 20, 60, 0.6);
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

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

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== NEW CHAT DESIGN (Candy.ai Style) ========== */
.chat-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    overflow: hidden;
}

/* Full screen media */
.chat-media {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0; /* FULLSCREEN - никуда не двигается */
    z-index: 1;
    background: #000;
    overflow: hidden;
}

.model-fullscreen-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

.model-fullscreen-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center 40%; /* Видео чуть выше центра */
    background: #000;
}

/* Два video слоя для seamless переходов */
.video-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    z-index: 1;
    /* Без transition - мгновенное переключение через inline styles */
}

.video-layer.active {
    opacity: 1;
    z-index: 2;
}

.media-gradient-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
    pointer-events: none;
    z-index: 2;
}

.media-gradient-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 350px;
    background: linear-gradient(0deg, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.7) 40%, rgba(0,0,0,0.3) 70%, transparent 100%);
    pointer-events: none;
    z-index: 2;
}

/* ========================================
   Close Chat - OVERLAY кнопка
   Адаптивная позиция: safe-area + 14vh
   ======================================== */
.video-close-btn {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 16vh);
    right: 8px;
    z-index: 200;
    height: 40px;
    padding: 0 20px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(255,255,255,0.3), rgba(255,255,255,0.15));
    border: 1px solid rgba(255,255,255,0.5);
    color: white;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
}

.video-close-btn:active {
    background: rgba(255, 255, 255, 0.5);
    transform: scale(0.96);
}

/* Model Badge - centered below Telegram UI */
.chat-model-badge {
    position: absolute;
    top: env(safe-area-inset-top, 44px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    padding: 6px 14px 6px 6px;
    border-radius: 24px;
    margin-top: 8px;
}

.chat-badge-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #00ff00;
}

.chat-badge-name {
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.chat-badge-live {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    color: #00ff00;
    text-transform: uppercase;
}

.live-dot {
    width: 6px;
    height: 6px;
    background: #00ff00;
    border-radius: 50%;
    animation: live-pulse 1.5s ease-in-out infinite;
}

@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Legacy support */
.chat-model-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.chat-model-name {
    font-size: 17px;
    font-weight: 600;
    color: white;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.chat-status-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(0,0,0,0.5);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: #00ff00;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

.chat-top-actions {
    display: flex;
    gap: 8px;
}

.chat-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(60, 60, 70, 0.7);
    backdrop-filter: blur(10px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-action-btn:active {
    transform: scale(0.9);
    background: rgba(80, 80, 90, 0.8);
}

.chat-action-btn.close-btn {
    background: rgba(80, 80, 90, 0.7);
}

/* Messages Container - над панелью команд */
.chat-messages-container {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 180px; /* Прямо над bottom panel */
    max-height: 80px; /* Меньше высота чтобы не залезать на видео */
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
}

.chat-messages-container::-webkit-scrollbar {
    display: none;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-msg {
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 14px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-msg.model {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    align-self: flex-start;
    color: white;
}

.chat-msg.user {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    align-self: flex-end;
    color: white;
}

.chat-msg.system {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    align-self: center;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    padding: 8px 16px;
}

/* Bottom Panel - Expandable Commands */
.chat-bottom-panel {
    /* OVERLAY поверх видео - не сдвигает видео */
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(20, 20, 25, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    transition: all 0.3s ease;
}

/* Commands Header */
.commands-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.commands-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.commands-title {
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.commands-badge {
    background: rgba(255,255,255,0.15);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    color: rgba(255,255,255,0.7);
}

.commands-chevron {
    transition: transform 0.3s ease;
}

.commands-chevron.expanded {
    transform: rotate(180deg);
}

/* Commands List */
.commands-list {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.commands-list.expanded {
    max-height: 400px;
    overflow-y: auto;
}

/* Command Item */
.command-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    transition: background 0.2s;
}

.command-item:active {
    background: rgba(255,255,255,0.1);
}

.command-item:last-child {
    border-bottom: none;
}

.command-name {
    font-size: 15px;
    color: white;
    font-weight: 500;
    flex: 1;
}

.command-cost {
    font-size: 12px;
    color: #FFD700;
    font-weight: 600;
    background: rgba(255, 215, 0, 0.15);
    padding: 4px 10px;
    border-radius: 12px;
    margin-right: 12px;
}

.command-play-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

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

.command-play-btn svg {
    margin-left: 2px;
}

/* NSFW Button in panel - compact */
.chat-bottom-panel .nsfw-switch-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 12px 20px;
    padding: 10px 16px;
    border-radius: 20px;
    background: linear-gradient(135deg, #DC143C 0%, #FF4500 100%);
    border: none;
    color: white;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    width: auto;
}

/* Hide old chat elements on new design */
.chat-page .chat-header,
.chat-page .chat-layout,
.chat-page .video-section-fullscreen,
.chat-page .room-info-overlay,
.chat-page .chat-overlay,
.chat-page .commands-pills-container {
    display: none !important;
}

