/* ===== ГЛОБАЛЬНЫЕ ПЕРЕМЕННЫЕ ===== */
:root {
    --bg: #0c0c0f;
    --surface: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --text: #e1e1e1;
    --text-secondary: #999;
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --radius: 16px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: 0.3s ease;
}

/* ===== СБРОС И БАЗА ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
.container {
    width: 100%;
    max-width: 1200px;
}

/* ===== КАСТОМНЫЙ СКРОЛЛБАР ===== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-hover); }

/* ===== ШАПКА ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 40px;
    position: relative;
}
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text);
    transition: transform var(--transition);
}
.brand:hover {
    transform: scale(1.02);
}

/* >>> ИЗМЕНЕНО: логотип теперь заполняет квадрат (object-fit: cover) и получает glow-эффект при наведении <<< */
.logo-img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.brand:hover .logo-img {
    transform: scale(1.08);
    filter: brightness(1.1);
    box-shadow: 0 0 14px rgba(167, 139, 250, 0.55), 0 0 4px rgba(167, 139, 250, 0.3);
}

.brand-text {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
}
.nav-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 20px;
    box-shadow: var(--shadow);
    display: inline-flex;
    margin-left: auto;
}
.nav {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}
.nav a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color var(--transition), transform var(--transition);
    position: relative;
}
.nav a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform var(--transition);
}
.nav a:hover,
.nav a.active {
    color: #fff;
}
.nav a:hover::after,
.nav a.active::after {
    transform: scaleX(1);
}
.nav .login-btn {
    padding: 8px 18px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: #0c0c0f;
    border-radius: 40px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.3);
}
.nav .login-btn:hover {
    background: linear-gradient(135deg, var(--accent-hover), #6366f1);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(167, 139, 250, 0.5);
}

/* ===== БУРГЕР-МЕНЮ ===== */
.burger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 100;
}
.burger span {
    width: 28px;
    height: 3px;
    background: var(--text);
    border-radius: 3px;
    transition: all var(--transition);
}
.burger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.burger.active span:nth-child(2) {
    opacity: 0;
}
.burger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== FLASH-СООБЩЕНИЯ ===== */
.flash {
    padding: 12px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-weight: 600;
    text-align: center;
    animation: fadeInDown 0.5s ease;
}
.flash.success {
    background: rgba(74, 222, 128, 0.2);
    border: 1px solid #4ade80;
    color: #4ade80;
}
.flash.error {
    background: rgba(248, 113, 113, 0.2);
    border: 1px solid #f87171;
    color: #f87171;
}
.flash.info {
    background: rgba(167, 139, 250, 0.2);
    border: 1px solid var(--accent);
    color: var(--accent);
}

/* ===== КАРТОЧКИ ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
}
.card-header {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.card-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: #fff;
}
.card-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 16px;
    flex: 1;
}
.btn {
    display: inline-block;
    padding: 8px 20px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 40px;
    color: var(--accent);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    transition: all var(--transition);
    align-self: flex-start;
}
.btn:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: #0c0c0f;
}
.donors-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.donors-list li {
    transition: color var(--transition);
}
.donors-list li:hover {
    color: #fff;
}
.donors-footer {
    margin-top: auto;
}

/* ===== СТРИМ И ПЛЕЕР ===== */
.stream-wrapper {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
}
.player {
    flex: 2;
    min-width: 300px;
    max-width: 900px;
    aspect-ratio: 16/9;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
    background: #000;
    border: 1px solid var(--border);
}
.preview {
    position: absolute;
    inset: 0;
}
.preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.preview-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.6);
    cursor: pointer;
    transition: background 0.3s;
}
.preview-overlay:hover {
    background: rgba(0, 0, 0, 0.8);
}
.play-btn {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 28px;
    box-shadow: 0 0 20px rgba(167, 139, 250, 0.4);
    transition: transform var(--transition), box-shadow var(--transition);
}
.preview-overlay:hover .play-btn {
    transform: scale(1.1);
    box-shadow: 0 0 40px rgba(167, 139, 250, 0.6);
}
.preview-text {
    margin-top: 16px;
    font-weight: 600;
    color: #fff;
}
.chat {
    flex: 1;
    min-width: 280px;
    max-width: 320px;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    background: #000;
    border: 1px solid var(--border);
}
.chat iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* ===== ГРИД ===== */
.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

/* ===== ЗАГОЛОВКИ ===== */
.section-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 30px;
}

/* ===== КНОПКИ ПОДЕЛИТЬСЯ ===== */
.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
}
.share-buttons span {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-right: 8px;
}
.share-btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    transition: all var(--transition);
}
.share-btn.vk {
    background: #4a76a8;
}
.share-btn.vk:hover {
    background: #3b6090;
    transform: translateY(-2px);
}
.share-btn.tg {
    background: #0088cc;
}
.share-btn.tg:hover {
    background: #006b9f;
    transform: translateY(-2px);
}
.share-btn.tw {
    background: #000;
}
.share-btn.tw:hover {
    background: #333;
    transform: translateY(-2px);
}

/* ===== ПОИСК ===== */
.search-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}
.search-form input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: 40px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}
.search-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}
.search-form button {
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border: none;
    border-radius: 40px;
    color: #0c0c0f;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.9rem;
}
.search-form button:hover {
    background: linear-gradient(135deg, var(--accent-hover), #6366f1);
    transform: translateY(-2px);
}

/* ===== КНОПКА НАВЕРХ ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--accent), #818cf8);
    color: #0c0c0f;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(167, 139, 250, 0.4);
    transition: all var(--transition);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    z-index: 999;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.back-to-top:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 6px 24px rgba(167, 139, 250, 0.6);
}

/* ===== АНИМАЦИЯ ПОЯВЛЕНИЯ ===== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== УЛУЧШЕННЫЕ ФОРМЫ ===== */
input, textarea {
    transition: border-color var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
}
button[type="submit"] {
    background: linear-gradient(135deg, var(--accent), #818cf8);
    border: none;
    color: #0c0c0f;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}
button[type="submit"]:hover {
    background: linear-gradient(135deg, var(--accent-hover), #6366f1);
    transform: translateY(-2px);
}

/* ===== АДАПТИВНОСТЬ ===== */
@media (max-width: 1024px) {
    .container { max-width: 100%; }
    .row { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

@media (max-width: 768px) {
    body { padding: 20px 10px; }
    .header { flex-direction: row; align-items: center; }
    .burger { display: flex; }
    .nav-block {
        display: none;
        width: 100%;
        margin-left: 0;
        order: 3;
        flex-basis: 100%;
        justify-content: center;
        background: var(--surface);
        backdrop-filter: blur(12px);
    }
    .nav-block.open {
        display: flex;
    }
    .nav {
        flex-direction: column;
        gap: 12px;
        width: 100%;
        align-items: center;
    }
    .nav a { font-size: 1rem; }
    .nav .login-btn { margin-left: 0; }
    .stream-wrapper { flex-direction: column; }
    .player { min-width: 100%; }
    .chat { max-width: 100%; min-width: 100%; height: 400px; }
    .search-form { flex-direction: column; max-width: 100%; }
    .search-form button { width: 100%; }
    .share-buttons { justify-content: center; }
    .back-to-top { width: 44px; height: 44px; font-size: 20px; bottom: 20px; right: 20px; }
}

@media (max-width: 480px) {
    body { padding: 10px 5px; }
    .container { padding: 0; }
    .header { gap: 10px; margin-bottom: 20px; }
    .brand-text { font-size: 1rem; }
    .nav-block { padding: 8px 12px; }
    .nav a { font-size: 0.9rem; }
    .nav .login-btn { padding: 6px 14px; font-size: 0.8rem; }
    .card { padding: 16px; }
    .section-title { font-size: 1.2rem; margin-bottom: 20px; }
    .flash { font-size: 0.9rem; padding: 10px 16px; }
}

/* === FALLBACK: если JS не работает, показываем элементы === */
.fade-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

/* === FALLBACK: навигация на десктопе всегда видна === */
@media (min-width: 769px) {
    .nav-block {
        display: inline-flex !important;
    }
}