/* ===== ПЕРЕМЕННЫЕ И БАЗА ===== */
:root {
    --bg-color: #141414;
    --bg-card: #1f1f1f;
    --bg-surface: #2a2a2a;
    --accent-color: #e50914;
    --text-color: #ffffff;
    --text-muted: #aaa;
    --border-color: #333;
    --header-height: 70px;
    --sidebar-width: 250px;
}

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

html, body {
    max-width: 100%;
    width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    position: relative !important;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Inter', sans-serif;
}

button, input, select, textarea { font-family: 'Inter', sans-serif; }
h1, h2, h3, h4, .header-logo, .section-title { font-family: 'Poppins', sans-serif; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ===== HEADER ===== */
.top-header {
    height: var(--header-height);
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    padding: 0 40px;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1100;
    border-bottom: 1px solid var(--border-color);
    gap: 25px;
}

.mobile-menu-btn { display: none; background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; }
.header-logo { font-size: 24px; font-weight: 800; color: var(--accent-color); cursor: pointer; white-space: nowrap; letter-spacing: -0.5px; }

.header-search { position: relative; flex: 1; max-width: 500px; min-width: 0; }
.header-search input {
    width: 100%; background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 20px; padding: 10px 40px 10px 15px; color: #fff; outline: none; font-size: 14px;
    -webkit-appearance: none; appearance: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.header-search input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 2px rgba(229,9,20,0.2); }
.clear-search-btn {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,0.1); border: none; color: #aaa; cursor: pointer;
    font-size: 14px; padding: 4px 6px; border-radius: 50%; line-height: 1; display: none; transition: 0.2s;
}
.clear-search-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

.header-controls { display: flex; align-items: center; gap: 15px; }
.media-toggle { display: flex; background: var(--bg-card); border-radius: 20px; padding: 3px; }
.media-toggle button { background: transparent; border: none; color: var(--text-muted); padding: 8px 15px; border-radius: 15px; cursor: pointer; font-size: 13px; font-weight: 600; transition: 0.2s; }
.media-toggle button.active { background: var(--accent-color); color: #fff; }

.lang-switch button { background: var(--bg-card); border: 1px solid var(--border-color); color: #fff; padding: 8px 12px; cursor: pointer; border-radius: 4px; font-weight: 600; font-size: 12px; transition: 0.2s; }
.lang-switch button.active { background: var(--text-color); color: var(--bg-color); }

.adult-toggle { display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-muted); user-select: none; }
.sort-select { background: var(--bg-card); border: 1px solid var(--border-color); color: #fff; padding: 8px 10px; border-radius: 4px; cursor: pointer; outline: none; -webkit-appearance: none; appearance: none; }

/* ===== LAYOUT ===== */
.layout-wrapper { display: flex; padding-top: var(--header-height); }
.sidebar { 
    width: var(--sidebar-width); height: calc(100vh - var(--header-height)); background: var(--bg-color); 
    position: fixed; top: var(--header-height); left: 0; overflow-y: auto; padding: 20px; 
    border-right: 1px solid var(--border-color); transition: transform 0.3s ease; z-index: 1150;
}
.main-content { margin-left: var(--sidebar-width); width: calc(100% - var(--sidebar-width)); padding: 30px; }

.menu-title { margin-top: 20px; margin-bottom: 10px; font-size: 12px; text-transform: uppercase; color: #666; font-weight: 700; letter-spacing: 1px; }
.menu-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.menu-list li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; cursor: pointer; color: var(--text-color); transition: background 0.2s, transform 0.1s; font-size: 14px; font-weight: 500; }
.menu-list li:hover { background: var(--bg-card); transform: translateX(5px); }
.menu-list li a.nav-link { color: inherit; text-decoration: none; display: flex; align-items: center; width: 100%; }
.live-indicator { width: 8px; height: 8px; background: #555; border-radius: 50%; margin-left: auto; }
.live-indicator.live { background: #ff0000; box-shadow: 0 0 8px #ff0000; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }

.page { display: none; animation: fadeIn 0.3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.section-title { font-size: 24px; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.back-btn { background: var(--bg-card); color: #fff; border: none; padding: 10px 20px; border-radius: 20px; cursor: pointer; margin-bottom: 20px; font-weight: 600; transition: 0.2s; }
.back-btn:hover { background: var(--bg-surface); }

.ticker-container { background: var(--bg-card); border-radius: 8px; padding: 10px 15px; margin-bottom: 20px; display: flex; align-items: center; gap: 15px; }
.ticker-label { font-weight: 700; font-size: 14px; white-space: nowrap; color: var(--accent-color); }
.ticker-wrapper { overflow: hidden; flex: 1; }
.ticker-track { display: flex; gap: 30px; animation: scroll 30s linear infinite; }
.ticker-item { font-size: 14px; color: var(--text-muted); cursor: pointer; white-space: nowrap; transition: color 0.2s; }
.ticker-item:hover { color: #fff; }
@keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

.hero-banner { height: 400px; border-radius: 12px; overflow: hidden; position: relative; margin-bottom: 30px; background: var(--bg-card); }
.hero-bg { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; z-index: 1; }
.hero-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(90deg, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 50%, transparent 100%); z-index: 2; }
.hero-content { position: relative; z-index: 3; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; padding: 40px; }
.hero-title { font-size: 48px; margin-bottom: 15px; line-height: 1.1; }
.hero-desc { max-width: 500px; color: var(--text-muted); margin-bottom: 20px; font-size: 15px; }
.hero-btn { padding: 12px 24px; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; transition: transform 0.2s, background 0.2s; }
.hero-btn.primary { background: #fff; color: #000; }
.hero-btn.primary:hover { transform: scale(1.05); }

.movies-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px; }
.movie-card { cursor: pointer; position: relative; border-radius: 8px; overflow: hidden; transition: transform 0.3s ease, box-shadow 0.3s ease; background: var(--bg-card); }
.movie-card:hover { transform: scale(1.05); z-index: 5; box-shadow: 0 10px 30px rgba(0,0,0,0.7); }
.movie-card img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: #222; }
.card-info { padding: 10px; }
.card-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.rating { color: #46d369; }

.scroll-row { display: flex; gap: 15px; overflow-x: auto; padding-bottom: 10px; scroll-behavior: smooth; }
.progress-bar { width: 100%; height: 4px; background: #333; position: absolute; bottom: 0; left: 0; }
.progress-fill { height: 100%; background: var(--accent-color); }
.badge-new { position:absolute; top:8px; right:8px; background:#e50914; color:white; padding:3px 8px; border-radius:4px; font-size:10px; font-weight:bold; z-index:10; box-shadow:0 2px 5px rgba(0,0,0,0.5); }
.remove-fav-btn { position: absolute; top: 5px; right: 5px; background: rgba(0,0,0,0.7); color: #fff; border: none; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; z-index: 10; opacity: 0; transition: 0.2s; }
.movie-card:hover .remove-fav-btn { opacity: 1; }

.details-backdrop { position: absolute; top: 0; left: 0; width: 100%; height: 400px; background-size: cover; background-position: center; opacity: 0.2; z-index: -1; mask-image: linear-gradient(to bottom, black, transparent); -webkit-mask-image: linear-gradient(to bottom, black, transparent); }
.movie-details { display: flex; gap: 30px; margin-top: 20px; flex-wrap: wrap; }
.movie-details img { border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); max-width: 100%; }
.details-info { flex: 1; min-width: 300px; }
.details-info h1 { font-size: 36px; margin-bottom: 15px; }
.meta-row { display: flex; gap: 15px; align-items: center; margin-bottom: 10px; color: var(--text-muted); font-size: 14px; flex-wrap: wrap; }
.overview { line-height: 1.6; margin: 20px 0; color: #ddd; }
.season-selector { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.season-selector select { background: var(--bg-card); border: 1px solid var(--border-color); color: #fff; padding: 10px; border-radius: 4px; cursor: pointer; }
.btn-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.watch-btn { background: var(--accent-color); color: #fff; border: none; padding: 12px 24px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 14px; transition: background 0.2s, transform 0.1s; }
.watch-btn:hover { background: #f6121d; transform: translateY(-2px); }
.fav-btn { background: #333; }
.fav-btn.active { background: #444; color: #fff; }

.share-container { display: flex; align-items: center; gap: 12px; margin-top: 20px; flex-wrap: wrap; }
.share-container span { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.share-btn { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; text-decoration: none; color: #fff; font-weight: bold; font-size: 14px; border: none; cursor: pointer; transition: transform 0.2s, opacity 0.2s; opacity: 0.9; }
.share-btn:hover { transform: scale(1.1); opacity: 1; }
.share-btn.fb { background: #1877F2; }
.share-btn.tg { background: #0088cc; }
.share-btn.x { background: #000; }
.share-btn.wa { background: #25D366; }
.share-btn.rd { background: #FF4500; }
.share-btn.copy { background: #333; }

.player-layout { display: flex; gap: 20px; }
.player-main { flex: 1; min-width: 0; }
.player-sidebar { width: 300px; flex-shrink: 0; }
.player-container { width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 8px; overflow: hidden; position: relative; }
.player-container iframe, .player-container video { width: 100%; height: 100%; border: none; min-width: 0; }
#streamOfflineOverlay { position:absolute; top:0; left:0; width:100%; height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; background:#000; z-index:10; }
#streamOfflineOverlay h1 { font-family:'Poppins'; color:#444; }
.fs-btn { background: #333; color: #fff; border: none; padding: 8px 15px; border-radius: 4px; cursor: pointer; margin-bottom: 10px; transition: 0.2s; }
.fs-btn:hover { background: #444; }
.stats-panel { display: none; gap: 20px; margin-top: 15px; background: var(--bg-card); padding: 15px; border-radius: 8px; flex-wrap: wrap; }
.stat-item { font-size: 14px; color: var(--text-muted); }
.sidebar-section { background: var(--bg-card); padding: 15px; border-radius: 8px; margin-bottom: 20px; display: flex; flex-direction: column; max-height: 500px; }
.sidebar-section h3 { margin-bottom: 10px; font-size: 16px; flex-shrink: 0; }
.sidebar-section select { width: 100%; background: #222; color: #fff; border: 1px solid #444; padding: 10px; border-radius: 5px; margin-bottom: 10px; }
.quality-btn { display: block; width: 100%; background: #333; color: #fff; border: none; padding: 10px; border-radius: 5px; cursor: pointer; margin-bottom: 5px; text-align: left; transition: 0.2s; }
.quality-btn:hover { background: #444; }
.quality-btn.active { background: var(--accent-color); }

#torrentList { flex: 1; overflow-y: auto; padding-right: 8px; margin-top: 10px; }
#torrentList::-webkit-scrollbar { width: 6px; }
#torrentList::-webkit-scrollbar-track { background: #222; border-radius: 3px; }
#torrentList::-webkit-scrollbar-thumb { background: #555; border-radius: 3px; }

.ts-buttons { display: flex; gap: 8px; }
.stream-btn { flex: 1; background: #46d369; color: #fff; border: none; padding: 10px 12px; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.stream-btn:hover { background: #4cc86f; transform: translateY(-1px); }
.download-btn { flex: 1; background: #333; color: #fff; padding: 10px 12px; border-radius: 6px; cursor: pointer; text-decoration: none; text-align: center; font-weight: 600; font-size: 13px; border: 1px solid #444; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
.download-btn:hover { background: #444; transform: translateY(-1px); }

.torrent-source { background: #222; border-radius: 8px; padding: 12px; margin-bottom: 10px; border: 1px solid transparent; transition: 0.2s; }
.torrent-source:hover { border-color: #444; background: #262626; }
.torrent-source.active { border-color: var(--accent-color); box-shadow: 0 0 10px rgba(229,9,20,0.3); }
.ts-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.ts-source-badge { color: #fff; font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 3px 8px; border-radius: 4px; letter-spacing: 0.5px; }
.ts-quality { font-weight: 600; font-size: 14px; color: #ddd; }
.ts-info { display: flex; justify-content: space-between; font-size: 12px; color: #aaa; margin-bottom: 10px; }

.stream-layout { display: flex; gap: 20px; }
.stream-main { flex: 1; min-width: 0; }
.stream-sidebar { width: 350px; flex-shrink: 0; background: var(--bg-card); border-radius: 8px; padding: 15px; display: flex; flex-direction: column; height: 80vh; }
.live-badge { background: #555; color: #fff; padding: 3px 8px; border-radius: 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; }
.live-badge.offline { background: #333; }
.live-badge:not(.offline) { background: #ff0000; animation: pulse 1.5s infinite; }
.stream-chat-messages { flex: 1; overflow-y: auto; margin-bottom: 15px; display: flex; flex-direction: column; gap: 8px; padding-right: 5px; }
.chat-msg { background: rgba(255,255,255,0.05); padding: 8px 12px; border-radius: 8px; font-size: 14px; display: flex; justify-content: space-between; }
.chat-msg .username { font-weight: 700; color: var(--accent-color); margin-right: 5px; }
.stream-chat-input-wrapper { position: relative; }
.chat-input-area { display: flex; gap: 10px; align-items: flex-end; }
.chat-input-area textarea { flex: 1; background: #222; border: 1px solid #444; border-radius: 20px; padding: 10px 15px; color: #fff; outline: none; resize: none; height: 40px; max-height: 100px; overflow-y: auto; line-height: 1.4; }
.chat-input-area button { background: #222; color: #fff; border: 1px solid #444; border-radius: 50%; width: 40px; height: 40px; cursor: pointer; font-size: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.chat-input-area button:last-child { background: var(--accent-color); border: none; }

.toast-container { position: fixed; top: 80px; right: 20px; z-index: 10001; display: flex; flex-direction: column; gap: 10px; }
.toast-message { background: #e50914; color: white; padding: 15px 25px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); opacity: 0; transform: translateX(100px); transition: all 0.3s ease; font-size: 14px; max-width: 300px; }
.toast-message.show { opacity: 1; transform: translateX(0); }

.chat-toggle { position: fixed; bottom: 20px; right: 20px; width: 60px; height: 60px; background: var(--accent-color); border: none; border-radius: 50%; cursor: pointer; font-size: 30px; box-shadow: 0 4px 15px rgba(0,0,0,0.5); z-index: 9999; display: flex; align-items: center; justify-content: center; transition: 0.2s; touch-action: none; }
.chat-toggle:hover { transform: scale(1.1); }
.chat-window { position: fixed; bottom: 20px; right: 20px; width: 350px; height: 500px; background: #141414; border: 1px solid var(--border-color); border-radius: 12px; display: none; flex-direction: column; overflow: hidden; z-index: 10000; box-shadow: 0 10px 30px rgba(0,0,0,0.8); }
.chat-window.active { display: flex; }
.chat-header { padding: 15px; background: #1a1a1a; border-bottom: 1px solid var(--border-color); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.chat-close-btn { background: transparent; border: none; color: #888; font-size: 20px; cursor: pointer; transition: 0.2s; }
.chat-close-btn:hover { color: #fff; transform: rotate(90deg); }
.chat-messages { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg-pm { padding: 10px 15px; border-radius: 15px; max-width: 80%; font-size: 14px; line-height: 1.4; }
.chat-msg-pm.bot { background: var(--bg-card); align-self: flex-start; border-bottom-left-radius: 2px; }
.chat-msg-pm.user { background: var(--accent-color); color: #fff; align-self: flex-end; border-bottom-right-radius: 2px; }
.typing-indicator { padding: 10px 15px; font-size: 12px; color: var(--text-muted); font-style: italic; }

.modal-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(0,0,0,0.8); z-index: 20000; display: flex; 
    justify-content: center; align-items: center; opacity: 0; 
    transition: 0.3s; 
    pointer-events: none; 
} 
.modal-overlay.active { 
    opacity: 1; 
    pointer-events: auto; 
}
.modal-box { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: 12px; padding: 30px; width: 90%; max-width: 450px; position: relative; transform: scale(0.9); transition: 0.3s; }
.modal-overlay.active .modal-box { transform: scale(1); }
.modal-close-btn { position: absolute; top: 10px; right: 15px; background: transparent; border: none; color: #888; font-size: 20px; cursor: pointer; }
.modal-title { font-size: 20px; margin-bottom: 15px; }
.modal-text { color: var(--text-muted); margin-bottom: 20px; line-height: 1.5; }
.modal-code { font-size: 32px; font-weight: 800; text-align: center; letter-spacing: 2px; background: #000; padding: 15px; border-radius: 8px; margin-bottom: 15px; color: var(--accent-color); }
.modal-input { width: 100%; background: #222; border: 1px solid #444; border-radius: 5px; padding: 10px; color: #fff; margin-bottom: 15px; font-size: 18px; text-align: center; box-sizing: border-box; }
.modal-btn { background: var(--accent-color); color: #fff; border: none; padding: 10px 20px; border-radius: 5px; cursor: pointer; font-weight: 600; margin-right: 10px; }
.modal-btn.secondary { background: #333; }

.admin-input { width: 100%; margin-bottom: 15px; background: #222; border: 1px solid #444; border-radius: 5px; padding: 10px; color: #fff; box-sizing: border-box; }
.site-footer { margin-top: 50px; padding: 30px; text-align: center; color: #555; border-top: 1px solid var(--border-color); margin-left: var(--sidebar-width); }
.scroll-top-btn { position: fixed; bottom: 90px; right: 20px; background: var(--accent-color); color: #fff; border: none; width: 45px; height: 45px; border-radius: 50%; cursor: pointer; font-size: 20px; z-index: 999; opacity: 0; pointer-events: none; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.scroll-top-btn.visible { opacity: 1; pointer-events: auto; }
.loader { border: 4px solid #333; border-top: 4px solid var(--accent-color); border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 50px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.torrent-search-bar { position: relative; display: flex; gap: 10px; margin-bottom: 20px; width: 100%; max-width: 100%; }
.torrent-search-input {
    width: 100%; background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: 20px; padding: 10px 40px 10px 15px; color: #fff; outline: none;
    font-size: 14px; margin: 0; text-align: left; box-sizing: border-box;
    -webkit-appearance: none; appearance: none;
}
.torrent-search-input:focus { border-color: var(--accent-color); box-shadow: 0 0 0 2px rgba(229,9,20,0.2); }
.torrent-search-bar .clear-search-btn { position: absolute; right: 110px; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.1); border: none; color: #aaa; cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 50%; line-height: 1; display: none; transition: 0.2s; }
.torrent-search-bar .clear-search-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }

.torrent-table { display: flex; flex-direction: column; gap: 2px; width: 100%; }
.torrent-row { display: grid; grid-template-columns: 120px 1fr 100px 90px 100px 160px; gap: 15px; align-items: center; background: var(--bg-card); padding: 12px 15px; border-radius: 6px; border-left: 4px solid transparent; transition: 0.2s; }
.torrent-row.header { background: #111; color: #888; font-weight: 600; font-size: 12px; text-transform: uppercase; border-left: none; }
.torrent-row:not(.header):hover { background: #252525; border-left-color: var(--accent-color); transform: translateX(5px); }
.t-cat { font-size: 11px; font-weight: 700; padding: 5px 8px; border-radius: 4px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-name { color: #fff; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-size, .t-date, .t-sl { font-size: 13px; color: #aaa; text-align: center; }
.t-seeds { color: #46d369; font-weight: 600; }
.t-actions { display: flex; gap: 8px; justify-content: flex-end; }
.t-btn { background: #333; color: #fff; border: none; padding: 6px 12px; border-radius: 4px; font-size: 12px; cursor: pointer; text-decoration: none; display: flex; align-items: center; gap: 5px; transition: 0.2s; }
.t-btn:hover { background: #444; }
.t-btn.watch { background: #46d369; }
.t-btn.watch:hover { background: #4cc86f; }
.t-btn.download { background: #0088cc; }
.t-btn.download:hover { background: #0099e6; }

.audio-player-bar {
    position: fixed; bottom: 0; left: 0; width: 100%; background: #181818; 
    border-top: 1px solid #282828; padding: 12px 20px; display: none; 
    align-items: center; justify-content: space-between; z-index: 9998; 
    box-shadow: 0 -4px 20px rgba(0,0,0,0.5); box-sizing: border-box;
}
.audio-player-bar.active { display: flex; }

.ap-left { display: flex; align-items: center; gap: 15px; flex: 1; min-width: 0; max-width: 30%; }
.ap-vinyl { width: 50px; height: 50px; border-radius: 50%; background: #333; display: flex; align-items: center; justify-content: center; font-size: 20px; animation: spin 5s linear infinite; animation-play-state: paused; }
.audio-player-bar.playing .ap-vinyl { animation-play-state: running; }
.ap-track-info { display: flex; flex-direction: column; min-width: 0; }
.ap-title { color: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap-subtitle { color: #888; font-size: 12px; margin-top: 2px; }

.ap-center { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; max-width: 40%; }
.ap-controls { display: flex; align-items: center; gap: 16px; }
.ap-btn-icon { background: transparent; border: none; color: #b3b3b3; font-size: 16px; cursor: pointer; transition: color 0.2s; padding: 5px; }
.ap-btn-icon:hover { color: #fff; }
.ap-btn-main { width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #000; border: none; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: transform 0.2s; }
.ap-btn-main:hover { transform: scale(1.1); }
.ap-progress-container { display: flex; align-items: center; gap: 10px; width: 100%; max-width: 450px; }
.ap-time { font-size: 11px; color: #aaa; min-width: 40px; text-align: center; }
.ap-progress-bar { flex: 1; height: 5px; background: #444; border-radius: 2px; cursor: pointer; position: relative; }
.ap-progress-fill { height: 100%; background: #e50914; border-radius: 2px; width: 0%; position: relative; }
.ap-progress-bar:hover .ap-progress-fill { background: #1DB954; }
.ap-progress-fill::after { content: ''; position: absolute; right: -6px; top: -3.5px; width: 12px; height: 12px; background: #fff; border-radius: 50%; opacity: 0; transition: opacity 0.2s; }
.ap-progress-bar:hover .ap-progress-fill::after { opacity: 1; }

.ap-right { display: flex; align-items: center; gap: 15px; justify-content: flex-end; flex: 1; max-width: 30%; }

.ap-volume-container { display: flex; align-items: center; gap: 10px; touch-action: none; }
.ap-volume-icon { cursor: pointer; font-size: 16px; color: #b3b3b3; flex-shrink: 0; transition: color 0.2s; }
.ap-volume-icon:hover { color: #fff; }

.ap-volume-bar { 
    width: 80px; height: 30px; 
    background: transparent; 
    cursor: pointer; position: relative; 
    touch-action: none !important; 
    display: flex; align-items: center;
}
.ap-volume-bar::before {
    content: ''; width: 100%; height: 5px; background: #444; border-radius: 2px; position: absolute; left: 0;
}
.ap-volume-fill { 
    height: 5px; background: #fff; border-radius: 2px; width: 100%; position: relative; z-index: 2; 
}
.ap-volume-fill::after { 
    content: ''; position: absolute; right: -6px; top: -3.5px; width: 12px; height: 12px; 
    background: #fff; border-radius: 50%; opacity: 0; transition: opacity 0.2s; 
}
.ap-volume-bar:hover .ap-volume-fill::after, .ap-volume-bar:active .ap-volume-fill::after { opacity: 1; }

.ap-close-btn { background: transparent; border: none; color: #888; font-size: 18px; cursor: pointer; transition: 0.2s; padding: 5px; margin-left: 10px; }
.ap-close-btn:hover { color: #e50914; transform: rotate(90deg); }

.tracklist-panel { position: fixed; bottom: 110px; right: 20px; width: 350px; max-height: 400px; background: #181818; border-radius: 12px; border: 1px solid #333; box-shadow: 0 10px 30px rgba(0,0,0,0.5); display: none; flex-direction: column; z-index: 9999; overflow: hidden; }
.tracklist-panel.active { display: flex; }
.tracklist-header { padding: 15px 20px; border-bottom: 1px solid #333; font-weight: 600; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.tracklist-header button { background: none; border: none; color: #888; font-size: 18px; cursor: pointer; }
.tracklist-content { overflow-y: auto; padding: 10px; }
.track-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px; cursor: pointer; transition: background 0.2s; font-size: 14px; color: #ccc; }
.track-item:hover { background: #282828; color: #fff; }
.track-item.active { background: #333; color: #1DB954; font-weight: 600; }
.track-num { min-width: 20px; text-align: right; color: #666; }
.track-item.active .track-num { color: #1DB954; }

.reader-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 100000; display: none; align-items: center; justify-content: center; flex-direction: column; }
.reader-modal.active { display: flex; }
.reader-close-btn { position: absolute; top: 20px; right: 30px; background: #e50914; color: #fff; border: none; font-size: 24px; cursor: pointer; padding: 10px 15px; border-radius: 50%; z-index: 100001; }
.reader-close-btn:hover { transform: rotate(90deg); transition: 0.2s; }
#bookReaderFrame { width: 80%; height: 90%; border: 1px solid #333; border-radius: 8px; background: #fff; }

.blog-post-content img, .blog-post-content video, .blog-card img, .blog-card video {
    max-width: 100% !important; width: 100% !important; height: auto !important;
    border-radius: 8px; display: block; margin: 15px 0;
}

.blog-card {
    background: var(--bg-card); border-radius: 12px; overflow: hidden; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s; display: flex; flex-direction: column; height: 100%;
}
.blog-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); }
.blog-card-media { width: 100%; aspect-ratio: 16/9; overflow: hidden; background: #111; }
.blog-card-media img, .blog-card-media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.blog-card-info { padding: 15px; display: flex; flex-direction: column; flex-grow: 1; }
.blog-card-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 12px; }
.blog-cat-badge { background: var(--accent-color); color: #fff; padding: 3px 8px; border-radius: 4px; font-weight: 700; text-transform: uppercase; font-size: 10px; }
.blog-date { color: #666; }
.blog-card-title { font-size: 16px; font-weight: 700; color: #fff; margin-bottom: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; min-height: 44px; }
.blog-card-desc { font-size: 13px; color: #aaa; line-height: 1.5; margin-bottom: 15px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; flex-grow: 1; }
.blog-read-more { margin-top: auto; color: var(--accent-color); font-weight: 600; font-size: 13px; text-align: right; align-self: flex-end; }
.play-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; font-size: 40px; color: #fff; opacity: 0.8; }

#blogGrid.movies-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important; gap: 25px !important; }

.blog-card-tags { margin-top: 15px; margin-bottom: 15px; display: flex; flex-wrap: wrap; gap: 8px; }
.blog-card-tags a { color: #46d369; font-size: 12px; font-weight: 600; text-decoration: none; background: rgba(70, 211, 105, 0.1); padding: 4px 10px; border-radius: 12px; transition: background 0.2s, color 0.2s; cursor: pointer; }
.blog-card-tags a:hover { background: #46d369; color: #fff; }

.blog-category-tag { padding: 8px 16px; border-radius: 20px; background: #333; color: #aaa; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; border: 1px solid #444; }
.blog-category-tag:hover { background: #444; color: #fff; border-color: #555; }
.blog-category-tag.active { background: var(--accent-color); color: #fff; border-color: var(--accent-color); }

.blog-post-tags { margin-top: 30px; padding-top: 20px; border-top: 1px solid #333; display: flex; flex-wrap: wrap; gap: 10px; }
.blog-post-tags a { background: #333; color: #46d369; padding: 8px 16px; border-radius: 20px; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; transition: all 0.2s; border: 1px solid #444; display: inline-block; }
.blog-post-tags a:hover { background: #46d369; color: #141414; transform: translateY(-2px); box-shadow: 0 4px 10px rgba(70, 211, 105, 0.3); }

/* ========================================== */
/* ЖЕСТКАЯ АДАПТАЦИЯ ДЛЯ iOS (Safari Hacks) */
/* ========================================== */
.modal-overlay:not(.active), .reader-modal:not(.active) {
    display: none !important;
    pointer-events: none !important;
}

@media (max-width: 1024px) {
    .player-layout, .stream-layout { flex-direction: column; }
    .player-sidebar, .stream-sidebar { width: 100%; height: 500px; }
    .hero-title { font-size: 32px; }
}

@media (max-width: 768px) {
    html, body { overflow-x: hidden !important; width: 100% !important; max-width: 100% !important; }
    
    .top-header { padding: 0 10px !important; gap: 5px !important; height: 55px !important; flex-wrap: nowrap !important; overflow: hidden !important; justify-content: space-between !important; }
    .mobile-menu-btn { display: block !important; }
    .header-logo { font-size: 16px !important; margin-right: 5px !important; }
    .header-search { flex: 1 !important; max-width: 100% !important; min-width: 0 !important; }
    .header-search input { padding: 8px 30px 8px 12px !important; font-size: 13px !important; background: var(--bg-card) !important; -webkit-appearance: none !important; appearance: none !important; }
    .clear-search-btn { right: 5px !important; padding: 2px 5px !important; }
    .sort-select, .adult-toggle { display: none !important; } 
    .media-toggle button { padding: 5px 8px !important; font-size: 11px !important; }
    .lang-switch button { padding: 5px 6px !important; font-size: 10px !important; }

    .sidebar { transform: translateX(-100%) !important; width: 85% !important; max-width: 300px !important; z-index: 1150 !important; }
    .sidebar.active { transform: translateX(0) !important; box-shadow: 5px 0 15px rgba(0,0,0,0.8) !important; }
    .main-content { padding: 15px !important; margin-left: 0 !important; width: 100% !important; box-sizing: border-box !important; }
    .hero-banner { height: 220px !important; }
    .hero-title { font-size: 24px !important; }
    .hero-desc { font-size: 13px !important; }

    .audio-player-bar {
        flex-direction: column !important; align-items: center !important;
        padding: 10px 15px !important;
        padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px)) !important;
        gap: 8px !important; width: 100% !important; box-sizing: border-box !important;
        z-index: 10000 !important; max-height: none !important; overflow: visible !important;
        position: fixed !important; bottom: 0 !important; left: 0 !important; right: 0 !important;
    }
    .ap-left, .ap-center, .ap-right { max-width: 100% !important; width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; flex: 0 0 auto !important; }
    .ap-left { justify-content: center !important; text-align: center !important; margin-bottom: 5px !important; }
    .ap-vinyl { width: 35px !important; height: 35px !important; font-size: 16px !important; }
    .ap-title { font-size: 14px !important; }
    .ap-center { align-items: center !important; gap: 10px !important; }
    .ap-controls { gap: 30px !important; display: flex !important; justify-content: center !important; }
    .ap-btn-main { width: 45px !important; height: 45px !important; font-size: 18px !important; }
    .ap-btn-icon { font-size: 22px !important; display: block !important; visibility: visible !important; opacity: 1 !important; }
    .ap-progress-container { width: 100% !important; max-width: 100% !important; min-width: 0 !important; }
    .ap-right { justify-content: center !important; gap: 20px !important; margin-top: 5px !important; display: flex !important; }
    .ap-volume-slider { width: 80px !important; min-width: 0 !important; }

    .tracklist-panel { bottom: 270px !important; right: 5px !important; left: 5px !important; width: auto !important; max-height: 300px !important; }
    .chat-toggle { bottom: 280px !important; right: 15px !important; width: 50px !important; height: 50px !important; font-size: 24px !important; }
    .chat-window { width: 100% !important; height: 100% !important; bottom: 0 !important; right: 0 !important; border-radius: 0 !important; }
    
    .torrent-search-input { background: var(--bg-card) !important; -webkit-appearance: none !important; appearance: none !important; color: #fff !important; width: 100% !important; }
    .torrent-table { width: 100% !important; overflow-x: hidden !important; box-sizing: border-box !important; }
    .torrent-row { grid-template-columns: 1fr !important; gap: 8px !important; padding: 15px !important; width: 100% !important; box-sizing: border-box !important; }
    .torrent-row.header { display: none !important; }
    .t-name { white-space: normal !important; font-size: 15px !important; font-weight: 600 !important; word-break: break-word !important; }
    .t-cat { width: fit-content !important; }
    .t-actions { width: 100% !important; justify-content: space-between !important; gap: 5px !important; }
    .t-btn { flex: 1 !important; justify-content: center !important; padding: 8px 2px !important; font-size: 11px !important; overflow: hidden !important; }

    .movies-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .movie-card img { aspect-ratio: 2/3 !important; object-fit: cover !important; width: 100% !important; height: auto !important; }
    .card-title { font-size: 13px !important; }

    #bookReaderFrame { width: 95% !important; height: 85% !important; }

    .blog-post-content { padding: 15px !important; font-size: 15px !important; line-height: 1.6 !important; word-wrap: break-word !important; overflow-wrap: break-word !important; }
    .blog-post-content iframe { max-width: 100% !important; }
}




/* === СТИЛИ ДЛЯ СЧЕТЧИКА ЗРИТЕЛЕЙ (TWITCH STYLE) === */
.viewer-counter {
    margin-left: auto; /* Прижимает счетчик к правому краю */
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid var(--accent-color);
    color: #fff;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

.viewer-pulse {
    width: 8px;
    height: 8px;
    background-color: var(--accent-color);
    border-radius: 50%;
    display: inline-block;
    animation: viewer-pulse-anim 1.5s infinite;
}

@keyframes viewer-pulse-anim {
    0% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(229, 9, 20, 0.7); }
    70% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(229, 9, 20, 0); }
    100% { transform: scale(0.9); box-shadow: 0 0 0 0 rgba(229, 9, 20, 0); }
}

/* На мобильных устройствах немного меньше */
@media (max-width: 768px) {
    .viewer-counter {
        padding: 4px 10px;
        font-size: 12px;
    }
}