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

.btn-loading {
    background: #555 !important;
    color: #ccc !important;
    cursor: not-allowed !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spinner-rotate 0.7s linear infinite;
}
@keyframes btn-spinner-rotate {
    to { transform: rotate(360deg); }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #fff;
    overflow-x: hidden;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: #1a1a2e; }
::-webkit-scrollbar-thumb { background: #ff0000; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #cc0000; }

/* ===== КРАСИВЫЕ ДИАЛОГИ ===== */
.voy-dialog-overlay {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.88); z-index: 99999;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(8px); animation: fadeIn 0.2s ease;
}
.voy-dialog {
    background: #1a1a2e; border-radius: 22px; padding: 30px 24px;
    width: 90%; max-width: 370px; border: 1px solid #2a2a3e;
    box-shadow: 0 24px 60px rgba(0,0,0,0.7);
    animation: slideUp 0.25s ease;
}
.voy-dialog-icon { font-size: 42px; text-align: center; margin-bottom: 12px; }
.voy-dialog-title { font-size: 18px; font-weight: bold; color: #fff; text-align: center; margin-bottom: 6px; }
.voy-dialog-msg { font-size: 14px; color: #aaa; text-align: center; margin-bottom: 22px; line-height: 1.5; }
.voy-dialog-input {
    width: 100%; padding: 13px 14px; background: #2a2a3e;
    border: 1px solid #3a3a4e; border-radius: 12px; color: #fff;
    font-size: 15px; margin-bottom: 18px; box-sizing: border-box;
    outline: none; transition: border-color 0.2s; font-family: inherit;
}
.voy-dialog-input:focus { border-color: #ff0000; box-shadow: 0 0 0 2px rgba(255,0,0,0.2); }
.voy-dialog-btns { display: flex; gap: 10px; }
.voy-dialog-btn {
    flex: 1; padding: 13px; border: none; border-radius: 12px;
    font-size: 15px; font-weight: bold; cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}
.voy-dialog-btn-primary { background: linear-gradient(135deg,#ff0000,#cc0000); color: #fff; }
.voy-dialog-btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(255,0,0,0.4); }
.voy-dialog-btn-secondary { background: #2a2a3e; color: #aaa; border: 1px solid #3a3a4e; }
.voy-dialog-btn-secondary:hover { background: #3a3a4e; color: #fff; }
.voy-dialog-btn-danger { background: linear-gradient(135deg,#ff3333,#cc0000); color: #fff; }
.voy-dialog-btn-danger:hover { transform: translateY(-1px); box-shadow: 0 4px 15px rgba(255,0,0,0.4); }

.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.96); z-index: 1000; display: none;
    align-items: center; justify-content: center; backdrop-filter: blur(5px);
}
.modal.active { display: flex; animation: fadeIn 0.3s ease; }
#authModal.active { align-items: flex-start; overflow-y: auto; padding: 20px 0; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity:0; transform:translateY(20px); } to { opacity:1; transform:translateY(0); } }

.how-to-post-modal { max-width: 550px; width: 90%; border-radius: 20px; overflow: hidden; background: #1a1a2e; }
.how-to-post-modal .modal-header { background: linear-gradient(135deg, #1a1a2e, #2a2a3e); padding: 20px; border-bottom: 2px solid #ff0000; }
.how-to-post-modal .modal-header h2 { color: #ffd700; display: flex; align-items: center; gap: 10px; font-size: 20px; }
.how-to-post-steps { padding: 10px 0; }
.step { display: flex; gap: 15px; padding: 15px; border-bottom: 1px solid #2a2a3e; transition: all 0.3s; }
.step:hover { background: #2a2a3e; transform: translateX(5px); }
.step-number { width: 36px; height: 36px; background: #ff0000; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 18px; flex-shrink: 0; }
.step-content h3 { color: #ffd700; margin-bottom: 8px; font-size: 16px; }
.step-content p { color: #aaa; font-size: 13px; line-height: 1.4; }
.telegram-btn { display: inline-block; margin-top: 10px; background: #0088cc; color: white; padding: 8px 16px; border-radius: 30px; text-decoration: none; font-size: 13px; transition: all 0.3s; }
.telegram-btn:hover { background: #00aaff; }
.status-check { background: #2a2a3e; margin: 15px; padding: 20px; border-radius: 16px; text-align: center; }
.close-how-to-btn { background: #ff0000; border: none; color: white; padding: 10px 20px; border-radius: 30px; cursor: pointer; font-size: 14px; transition: all 0.3s; }
.close-how-to-btn:hover { background: #cc0000; }

.auth-card {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 28px; padding: 40px 32px; width: 92%; max-width: 460px;
    text-align: center; border: 1px solid rgba(255,0,0,0.3);
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    margin: 0 auto;
    box-sizing: border-box;
}
.auth-header { margin-bottom: 10px; }
.auth-header i { font-size: 56px; color: #ff0000; margin-bottom: 14px; }
.auth-header h2 { font-size: 30px; margin-bottom: 8px; background: linear-gradient(135deg, #fff, #ff0000); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.auth-header p { color: #888; font-size: 15px; }
.auth-card input { width: 100%; padding: 16px 18px; margin: 10px 0; background: #2a2a3e; border: 1px solid #3a3a4e; border-radius: 14px; color: white; font-size: 17px; transition: all 0.3s; box-sizing: border-box; }
.auth-card input:focus { outline: none; border-color: #ff0000; box-shadow: 0 0 0 2px rgba(255,0,0,0.2); }
.auth-card button { width: 100%; padding: 17px; background: linear-gradient(135deg, #ff0000, #cc0000); border: none; border-radius: 14px; color: white; font-size: 17px; font-weight: bold; cursor: pointer; margin-top: 10px; transition: all 0.3s; }
.auth-card button:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(255,0,0,0.4); }
.auth-card button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.auth-link { margin-top: 20px; color: #888; font-size: 15px; }
.auth-link a { color: #ff0000; text-decoration: none; }
.auth-link a:hover { text-decoration: underline; }
.auth-method-switch { display: flex; gap: 8px; background: #22222e; border-radius: 14px; padding: 5px; margin-bottom: 16px; margin-top: 0; }
.auth-card .auth-method-switch .auth-method-btn { width: auto; flex: 1 1 0; padding: 12px 6px; background: transparent; border: none; border-radius: 10px; color: #888; font-size: 14px; font-weight: bold; cursor: pointer; transition: all 0.25s; margin: 0; box-shadow: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auth-card .auth-method-switch .auth-method-btn.active { background: linear-gradient(135deg, #ff0000, #cc0000); color: #fff; box-shadow: none; }
.auth-card .auth-method-switch .auth-method-btn:hover { transform: none; box-shadow: none; }
.auth-card .auth-method-switch .auth-method-btn:hover:not(.active) { color: #ccc; }

.top-bar {
    position: fixed; top: 0; left: 0; right: 0; background: #1a1a2e;
    padding: 12px 20px; display: flex; justify-content: space-between;
    align-items: center; z-index: 100; border-bottom: 1px solid #2a2a3e;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}
.logo { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: bold; color: #ff0000; }
.logo i { font-size: 24px; }
.search-box { display: flex; align-items: center; background: #2a2a3e; border-radius: 30px; padding: 10px 18px; width: 40%; max-width: 400px; transition: all 0.3s; }
.search-box:focus-within { box-shadow: 0 0 0 2px rgba(255,0,0,0.3); }
.search-box i { color: #888; margin-right: 12px; }
.search-box input { background: none; border: none; color: white; width: 100%; outline: none; font-size: 14px; }
.user-info { display: flex; align-items: center; gap: 20px; }
.user-name { color: #fff; font-size: 14px; }
.user-avatar { cursor: pointer; width: 34px; height: 34px; border-radius: 50%; overflow: visible; display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; }
.user-avatar i { font-size: 32px; color: #ff0000; cursor: pointer; }
.user-avatar img.user-avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.user-avatar-frame-img { position: absolute; top: 50%; left: 50%; width: 150%; height: 150%; transform: translate(-50%,-50%); pointer-events: none; z-index: 2; }
video.user-avatar-frame-img { transform: translate(-50%,-50%) scale(1.2); }

.content-area {
    margin-top: 70px; margin-bottom: 70px; padding: 20px;
    max-width: 1400px; margin-left: auto; margin-right: auto;
    min-height: calc(100vh - 140px);
}
.page { display: none; animation: pageFade 0.3s ease; }
.page.active { display: block; }
@keyframes pageFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.videos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }
.video-card { background: #1a1a2e; border-radius: 16px; overflow: hidden; cursor: pointer; transition: all 0.3s; }
.video-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.3); }
.video-thumbnail { position: relative; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.video-thumbnail img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.video-card:hover .video-thumbnail img { transform: scale(1.05); }
.video-tag { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,0.8); padding: 4px 10px; border-radius: 20px; font-size: 11px; color: #ffd700; z-index: 2; }
.series-badge { position: absolute; top: 10px; right: 10px; background: rgba(255,0,0,0.9); padding: 4px 10px; border-radius: 20px; font-size: 11px; color: white; font-weight: bold; z-index: 2; }
.book-badge { position: absolute; top: 10px; right: 10px; background: rgba(0,100,255,0.9); padding: 4px 10px; border-radius: 20px; font-size: 11px; color: white; font-weight: bold; z-index: 2; }
.video-info { padding: 12px; }
.video-title { font-size: 14px; font-weight: 500; margin-bottom: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.video-stats { font-size: 12px; color: #aaa; display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== ЛЕНТА ПОСТОВ (premium) — карточки в 2 раза меньше видео-карточек ===== */
.posts-feed { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 24px; }
.posts-feed:empty { display: none; margin-bottom: 0; }
.post-card { background: #1a1a2e; border-radius: 8px; overflow: hidden; cursor: pointer; transition: all 0.3s; }
.post-card:hover { transform: translateY(-3px); box-shadow: 0 6px 14px rgba(0,0,0,0.3); }
.post-card-img { position: relative; aspect-ratio: 16/9; background: #000; overflow: hidden; }
.post-card-img img { width: 100%; height: 100%; object-fit: cover; }
.post-card-badge { position: absolute; top: 5px; left: 5px; background: rgba(123,47,247,0.92); padding: 2px 6px; border-radius: 10px; font-size: 8px; color: #fff; font-weight: bold; z-index: 2; display: flex; align-items: center; gap: 3px; }
.post-card-info { padding: 7px 8px; }
.post-card-author { font-size: 10px; font-weight: 600; margin-bottom: 3px; display: flex; align-items: center; gap: 3px; cursor: pointer; }
.post-card-text { font-size: 11px; color: #ccc; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.35; margin-bottom: 4px; }
.post-card-stats { font-size: 9px; color: #888; display: flex; gap: 8px; }
body.light .post-card { background: #fff; }
body.light .post-card-text { color: #444; }

@media (max-width: 768px) {
    .posts-feed { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

.shorts-container { position: fixed; top: 70px; right: 0; bottom: 70px; width: 400px; overflow-y: scroll; scroll-snap-type: y mandatory; background: #000; z-index: 50; height: calc(100vh - 140px); height: calc(100dvh - 140px); }
@media (max-width: 768px) { .shorts-container { width: 100%; left: 0; } }
.short-video { height: calc(100vh - 140px); height: calc(100dvh - 140px); scroll-snap-align: start; position: relative; background: #000; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.short-video video { width: 100%; height: 100%; max-width: 100%; object-fit: contain; cursor: pointer; }

/* Тонкий прогресс-бар снизу, как в сторис */
.short-progress-track { position: absolute; left: 8px; right: 8px; bottom: 6px; height: 3px; border-radius: 3px; background: rgba(255,255,255,0.25); overflow: hidden; z-index: 6; }
.short-progress-fill { height: 100%; width: 0%; background: #fff; border-radius: 3px; transition: width .1s linear; }

/* Своя кнопка мьюта вместо нативных controls */
.short-mute-btn { position: absolute; top: 14px; right: 16px; width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,0.45); backdrop-filter: blur(4px); border: none; color: #fff; font-size: 16px; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 7; }
.short-mute-btn:active { transform: scale(0.9); }

/* Анимация сердечка при двойном тапе */
.short-heart-anim { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0); color: #fff; font-size: 90px; text-shadow: 0 2px 12px rgba(0,0,0,0.5); pointer-events: none; z-index: 8; opacity: 0; }
.short-heart-anim.pulse { animation: shortHeartPulse .8s ease; }
@keyframes shortHeartPulse {
    0% { transform: translate(-50%,-50%) scale(0); opacity: 0; }
    15% { transform: translate(-50%,-50%) scale(1.15); opacity: 1; }
    30% { transform: translate(-50%,-50%) scale(0.95); opacity: 1; }
    75% { transform: translate(-50%,-50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%,-50%) scale(1); opacity: 0; }
}
.short-info { position: absolute; right: 20px; bottom: 100px; width: 80px; display: flex; flex-direction: column; gap: 20px; }
.short-stats { display: flex; flex-direction: column; gap: 20px; align-items: center; }
.short-stats button { background: rgba(0,0,0,0.6); border: none; color: white; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 12px; border-radius: 50%; font-size: 12px; transition: all 0.3s; width: 50px; height: 50px; }
.short-stats button i { font-size: 24px; }
.short-stats button:hover { background: #ff0000; }
.short-title { position: absolute; bottom: 110px; left: 20px; right: 100px; max-height: 30%; overflow-y: auto; background: linear-gradient(transparent, rgba(0,0,0,0.8)); padding: 15px; border-radius: 12px; font-size: 14px; font-weight: bold; box-sizing: border-box; }
.short-action-btn { background: rgba(255,255,255,0.12); backdrop-filter: blur(4px); border: none; color: #fff; width: 52px; height: 52px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 20px; cursor: pointer; transition: background .15s, transform .15s; }
.short-action-btn:active { transform: scale(0.92); }
.short-action-btn span { font-size: 11px; font-weight: 600; }
.short-action-btn.active { background: #ff0000; color: #fff; }
.short-action-btn.active i { color: #fff; }
.short-comments-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 199; display: none; }
.short-comments-backdrop.active { display: block; }
.short-comments-sheet { position: fixed; left: 0; right: 0; bottom: -70%; height: 65%; background: #14141f; border-radius: 18px 18px 0 0; z-index: 200; display: flex; flex-direction: column; transition: bottom .25s ease; box-shadow: 0 -4px 20px rgba(0,0,0,0.4); }
.short-comments-sheet.active { bottom: 0; }
.short-comments-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #2a2a3e; }
.short-comments-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; }
.short-comments-sheet .comments-list { flex: 1; overflow-y: auto; padding: 10px 16px; }
.short-comments-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #2a2a3e; }
.short-comments-input textarea { flex: 1; resize: none; height: 40px; border-radius: 10px; border: 1px solid #2a2a3e; background: #1a1a2e; color: #fff; padding: 8px 10px; }
@media (max-width: 768px) { .short-comments-sheet { left: 0; right: 0; } }

.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: #1a1a2e; display: flex; justify-content: space-around; padding: 10px 0; border-top: 1px solid #2a2a3e; z-index: 100; }
.nav-btn { background: none; border: none; color: #aaa; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 20px; border-radius: 12px; cursor: pointer; transition: all 0.3s; font-size: 12px; }
.nav-btn i { font-size: 22px; }
.nav-btn.active { color: #ff0000; background: rgba(255,0,0,0.1); }
.nav-btn:hover:not(.active) { color: white; background: #2a2a3e; }

.admin-panel { max-width: 900px; margin: 0 auto; }
.admin-header { text-align: center; margin-bottom: 30px; }
.admin-header h2 { font-size: 28px; color: #ffd700; }
.admin-header p { color: #aaa; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 30px; background: #1a1a2e; padding: 15px; border-radius: 16px; }
.admin-tab { background: #2a2a3e; border: none; color: white; padding: 10px 20px; border-radius: 30px; cursor: pointer; transition: all 0.3s; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.admin-tab.active { background: #ff0000; color: white; }
.admin-tab:hover:not(.active) { background: #3a3a4e; }
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; animation: fadeIn 0.3s ease; }
.admin-card { background: #1a1a2e; border-radius: 20px; padding: 25px; margin-bottom: 25px; border: 1px solid #2a2a3e; }
.admin-card h3 { color: #ffd700; margin-bottom: 20px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 8px; color: #aaa; font-size: 13px; }
.form-group input, .form-group textarea, .form-group select { width: 100%; padding: 12px 14px; background: #2a2a3e; border: 1px solid #3a3a4e; border-radius: 10px; color: white; font-size: 14px; transition: all 0.3s; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: none; border-color: #ff0000; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.preview-area { background: #2a2a3e; border-radius: 12px; padding: 15px; margin: 15px 0; }
.preview-header { color: #ffd700; margin-bottom: 10px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.preview-placeholder { text-align: center; padding: 30px; color: #aaa; }
.preview-placeholder i { font-size: 40px; margin-bottom: 10px; display: block; }
.submit-btn { width: 100%; padding: 14px; background: linear-gradient(135deg, #ff0000, #cc0000); border: none; border-radius: 12px; color: white; font-size: 16px; font-weight: bold; cursor: pointer; margin-top: 15px; transition: all 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px; }
.submit-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 20px rgba(255,0,0,0.4); }

.profile-card { background: #1a1a2e; border-radius: 24px; padding: 30px; max-width: 800px; margin: 0 auto; text-align: center; border: 1px solid #2a2a3e; }
.profile-avatar { width: 100px; height: 100px; background: linear-gradient(135deg, #ff0000, #cc0000); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.profile-avatar i { font-size: 50px; color: white; }
.profile-stats { display: flex; justify-content: center; gap: 40px; margin: 20px 0; }
.profile-stats .stat { text-align: center; }
.profile-stats .stat-value { font-size: 28px; font-weight: bold; color: #ffd700; }
.profile-stats .stat-label { font-size: 12px; color: #aaa; }
.how-to-post-btn { background: linear-gradient(135deg, #0088cc, #006699); color: white; border: none; padding: 12px 24px; border-radius: 40px; cursor: pointer; font-size: 16px; font-weight: bold; margin: 20px 0; display: inline-flex; align-items: center; gap: 10px; transition: all 0.3s; }
.how-to-post-btn:hover { transform: translateY(-3px); box-shadow: 0 5px 20px rgba(0,136,204,0.4); }
.favorites-list { margin-top: 25px; text-align: left; }
.favorites-list h3 { margin-bottom: 15px; color: #ffd700; }
.favorite-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; background: #2a2a3e; border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: all 0.3s; }
.favorite-item:hover { background: #3a3a4e; transform: translateX(5px); }
.logout-btn { background: #2a2a3e; border: none; color: #ff0000; padding: 12px 30px; border-radius: 14px; cursor: pointer; font-size: 16px; transition: all 0.3s; }
.logout-btn:hover { background: #ff0000; color: white; }

.book-reader-modal { max-width: 800px; width: 90vw; height: 85vh; background: #1a1a2e; border-radius: 20px; overflow: hidden; display: flex; flex-direction: column; }
.book-page-container { flex: 1; overflow-y: auto; padding: 30px; background: #2a2a3e; }
.book-page-content { background: #1a1a2e; border-radius: 12px; padding: 30px; min-height: 400px; }
.book-page-text { font-size: 18px; line-height: 1.8; color: #ddd; white-space: pre-wrap; }
.book-page-image { max-width: 100%; max-height: 500px; object-fit: contain; display: block; margin: 0 auto; }
.book-nav { display: flex; justify-content: space-between; align-items: center; padding: 15px 20px; background: #1a1a2e; border-top: 1px solid #2a2a3e; }
.book-nav-btn { background: #ff0000; border: none; color: white; padding: 10px 20px; border-radius: 30px; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; gap: 8px; }
.book-nav-btn:disabled { background: #444; cursor: not-allowed; }
.book-nav-btn:hover:not(:disabled) { background: #cc0000; }
.book-page-counter { color: #aaa; font-size: 14px; }

.video-modal-content, .series-modal-content { width: 90vw; max-width: 1000px; height: 85vh; background: #0f0f0f; border-radius: 20px; position: relative; display: flex; flex-direction: column; overflow: hidden; }

.post-modal-content { width: 92vw; max-width: 520px; max-height: 85vh; background: #0f0f0f; border-radius: 20px; position: relative; overflow-y: auto; padding: 24px; box-sizing: border-box; }
.post-modal-content .post-modal-img-wrap { width: calc(100% + 48px); margin: -24px -24px 16px; max-height: 260px; overflow: hidden; }
.post-modal-content .post-modal-img-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-modal-delete-btn { position: absolute; top: 14px; left: 14px; background: rgba(200,40,40,0.55); border: none; color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; z-index: 5; transition: all 0.2s; }
.post-modal-delete-btn:hover { background: #cc0000; }

.comment-input-row { display: flex; align-items: flex-end; gap: 8px; background: #1a1a2e; border: 1px solid #2a2a3e; border-radius: 14px; padding: 8px 8px 8px 14px; }
.comment-input-row:focus-within { border-color: #ff0000; }
.comment-input-row textarea { flex: 1; background: transparent !important; border: none !important; outline: none; resize: none; color: #fff; font-size: 13px; line-height: 1.4; max-height: 120px; font-family: inherit; padding: 6px 0 !important; margin: 0 !important; min-height: 0 !important; box-shadow: none !important; }
.comment-input-row textarea::placeholder { color: #888; }
.comment-send-btn { flex: none; width: 38px; height: 38px; border-radius: 50%; border: none; background: linear-gradient(135deg,#ff0000,#cc0000); color: #fff; font-size: 14px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: transform 0.15s; padding: 0 !important; }
.comment-send-btn:hover { transform: scale(1.08); }
.comment-send-btn:active { transform: scale(0.94); }
.close-modal { position: fixed; top: 70px; right: 15px; background: rgba(0,0,0,0.8); border: none; color: white; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; z-index: 10000; transition: all 0.3s; font-size: 18px; display:flex; align-items:center; justify-content:center; }
.close-modal:hover { background: #ff0000; transform: rotate(90deg); }
#episodePlayer { width: 100%; max-height: 55vh; flex: 0 0 auto; background: #000; object-fit: contain; }

/* ===== Кастомный YouTube-подобный плеер (только основной videoModal) ===== */
.vp-player { position: relative; width: 100%; max-height: 55vh; flex: 0 0 auto; background: #000; overflow: hidden; user-select: none; }
.vp-player video { width: 100%; height: 100%; max-height: 55vh; display: block; background: #000; object-fit: contain; }
.vp-player:fullscreen { max-height: none; height: 100%; }
.vp-player:fullscreen video { max-height: none; }

.vp-gesture-layer { position: absolute; inset: 0; z-index: 2; cursor: pointer; }

.vp-back-normal { position: absolute; top: 10px; left: 10px; z-index: 5; background: rgba(0,0,0,0.55); border: none; color: #fff; width: 38px; height: 38px; border-radius: 50%; font-size: 16px; display: none; align-items: center; justify-content: center; cursor: pointer; transition: background 0.15s, opacity 0.22s, transform 0.22s; }
.vp-back-normal:hover { background: rgba(0,0,0,0.8); }
.vp-player:fullscreen .vp-back-normal { display: flex; }
.vp-player.vp-idle .vp-back-normal { opacity: 0; pointer-events: none; }

.vp-spinner { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 34px; color: #fff; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 3; text-shadow: 0 2px 10px rgba(0,0,0,0.6); }
.vp-spinner.show { opacity: 1; }

.vp-center-btn { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) scale(0.7); width: 64px; height: 64px; border-radius: 50%; background: rgba(0,0,0,0.55); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 24px; opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 3; }
.vp-center-btn.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }

.vp-controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; padding: 26px 10px 8px; background: linear-gradient(to top, rgba(0,0,0,0.82) 0%, rgba(0,0,0,0.5) 55%, transparent 100%); opacity: 0; transform: translateY(6px); transition: opacity 0.22s, transform 0.22s; }
.vp-controls.show { opacity: 1; transform: translateY(0); }
.vp-player.vp-idle .vp-controls { opacity: 0; transform: translateY(6px); pointer-events: none; }
.vp-player.vp-idle { cursor: none; }
.vp-player.vp-scrubbing .vp-controls { opacity: 1 !important; transform: translateY(0) !important; pointer-events: auto !important; }

.vp-progress-row { padding: 0 4px; }
.vp-progress { position: relative; width: 100%; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.28); cursor: pointer; transition: height 0.12s; }
.vp-progress:hover, .vp-player.vp-scrubbing .vp-progress { height: 6px; }
.vp-progress-buffered { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: rgba(255,255,255,0.4); border-radius: 2px; }
.vp-progress-played { position: absolute; left: 0; top: 0; bottom: 0; width: 0%; background: #ff0000; border-radius: 2px; }
.vp-progress-handle { position: absolute; top: 50%; left: 0%; width: 13px; height: 13px; background: #ff0000; border-radius: 50%; transform: translate(-50%,-50%) scale(0); transition: transform 0.12s; box-shadow: 0 0 0 3px rgba(255,0,0,0.25); }
.vp-progress:hover .vp-progress-handle, .vp-player.vp-scrubbing .vp-progress-handle { transform: translate(-50%,-50%) scale(1); }

.vp-controls-row { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.vp-btn { background: transparent; border: none; color: #fff; width: 34px; height: 34px; border-radius: 50%; font-size: 15px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.15s; flex: none; }
.vp-btn:hover { background: rgba(255,255,255,0.15); }
.vp-time { color: #fff; font-size: 12.5px; font-variant-numeric: tabular-nums; opacity: 0.9; white-space: nowrap; margin-left: 4px; }
.vp-spacer { flex: 1 1 auto; }

.vp-volume { display: flex; align-items: center; gap: 2px; }
.vp-volume-slider { position: relative; width: 60px; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.28); cursor: pointer; margin-left: 2px; }
.vp-volume-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; background: #fff; border-radius: 2px; }
.vp-volume-handle { position: absolute; top: 50%; left: 100%; width: 11px; height: 11px; background: #fff; border-radius: 50%; transform: translate(-50%,-50%); }

@media (max-width: 640px) {
    .vp-volume-slider { width: 40px; }
    .vp-time { font-size: 11px; }
    .vp-btn { width: 30px; height: 30px; font-size: 13px; }
}
.video-info-panel, .series-info-panel { padding: 20px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.video-info-panel::-webkit-scrollbar { width: 3px; }
.video-info-panel::-webkit-scrollbar-thumb { background: #ff0000; border-radius: 2px; }
/* Длинное описание не должно выталкивать/сжимать видео сверху — текст сворачивается,
   а сам видео-плеер всегда сохраняет свою высоту (flex-shrink: 0 выше). */
#videoModalDesc, #iframeModalDesc, #seriesModalDesc {
    white-space: pre-line;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}
#videoModalDesc.desc-expanded, #iframeModalDesc.desc-expanded, #seriesModalDesc.desc-expanded {
    -webkit-line-clamp: unset;
    overflow: visible;
}
.desc-toggle-btn { display: inline-block; margin-top: 4px; color: #ff4d4d; font-size: 13px; font-weight: 600; cursor: pointer; user-select: none; }
.video-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px; margin: 15px 0; padding-bottom: 15px; border-bottom: 1px solid #2a2a3e; }
.action-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.action-btn { background: #2a2a3e; border: none; color: white; padding: 8px 16px; border-radius: 30px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: all 0.3s; font-size: 13px; }
.action-btn:hover { background: #3a3a4e; }
.action-btn.active { background: #ff0000; color: white; }
#favoriteBtn.active, #iframeFavoriteBtn.active { background: #ff4757; }
#likeBtn.active, #iframeLikeBtn.active { background: #ff0000 !important; color: white !important; }
#dislikeBtn.active, #iframeDislikeBtn.active { background: #ff0000 !important; color: white !important; }

.episodes-section h4 { margin-bottom: 15px; color: #ffd700; }
.episodes-list { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow-y: auto; }
.episode-item { display: flex; align-items: center; padding: 12px 15px; background: #2a2a3e; border-radius: 10px; margin-bottom: 8px; transition: all 0.3s; }
.episode-item:hover { background: #3a3a4e; }
.episode-number { font-weight: bold; color: #ffd700; min-width: 100px; }
.episode-title { flex: 1; margin-left: 15px; }
.episode-duration { color: #aaa; font-size: 12px; margin-right: 15px; }
.episode-actions { display: flex; gap: 8px; }
.play-episode { background: #ff0000; border: none; color: white; padding: 6px 12px; border-radius: 6px; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; gap: 5px; }
.play-episode:hover { background: #cc0000; }
.delete-episode { background: #2a2a3e; border: none; color: #ff3333; padding: 6px 10px; border-radius: 6px; cursor: pointer; transition: all 0.3s; }
.delete-episode:hover { background: #ff3333; color: white; }

.comments-section { margin-top: 15px; }
.comments-section h4 { margin-bottom: 15px; color: #ffd700; }
.comments-list { max-height: 200px; overflow-y: auto; margin-bottom: 15px; }
.comment { background: #1a1a2e; padding: 12px; border-radius: 12px; margin-bottom: 10px; }
.comment-header { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 12px; color: #aaa; }
.comment-author { color: #ff0000; font-weight: bold; }
.comment-text { font-size: 14px; line-height: 1.4; }
#commentText, #iframeCommentText { width: 100%; padding: 12px; background: #2a2a3e; border: 1px solid #3a3a4e; border-radius: 12px; color: white; margin: 10px 0; resize: none; font-family: inherit; min-height: 70px; box-sizing: border-box; transition: all 0.3s; }
#commentText:focus, #iframeCommentText:focus { outline: none; border-color: #ff0000; box-shadow: 0 0 0 2px rgba(255,0,0,0.2); }
.comment-btn { background: #ff0000; border: none; color: white; padding: 10px 20px; border-radius: 30px; cursor: pointer; transition: all 0.3s; }
.comment-btn:hover { background: #cc0000; }

.pages-list { max-height: 300px; overflow-y: auto; margin: 15px 0; }
.page-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 15px; background: #2a2a3e; border-radius: 8px; margin-bottom: 8px; }
.page-item-info { display: flex; gap: 15px; align-items: center; flex-wrap: wrap; }
.page-number { font-weight: bold; color: #ffd700; min-width: 60px; }
.page-type { font-size: 12px; padding: 2px 8px; border-radius: 12px; }
.page-type-text { background: #00cc66; color: white; }
.page-type-image { background: #ffd700; color: #000; }
.page-preview { font-size: 12px; color: #aaa; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.delete-page-btn { background: #ff0000; border: none; color: white; padding: 5px 10px; border-radius: 6px; cursor: pointer; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.stat-card { background: #2a2a3e; padding: 20px; border-radius: 16px; text-align: center; transition: all 0.3s; }
.stat-card:hover { transform: translateY(-3px); }
.stat-icon { font-size: 32px; margin-bottom: 10px; }
.stat-value { font-size: 32px; font-weight: bold; color: #ffd700; }
.stat-label { font-size: 12px; color: #aaa; margin-top: 5px; }

.items-list { max-height: 400px; overflow-y: auto; }
.admin-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; background: #2a2a3e; border-radius: 10px; margin-bottom: 8px; transition: all 0.3s; }
.admin-item:hover { background: #3a3a4e; }
.admin-item-info { flex: 1; }
.admin-item-title { font-weight: bold; margin-bottom: 4px; }
.admin-item-meta { font-size: 11px; color: #aaa; }
.admin-item-actions { display: flex; gap: 8px; }
.delete-btn { background: #ff0000; border: none; color: white; padding: 8px 15px; border-radius: 8px; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; gap: 5px; }
.delete-btn:hover { background: #cc0000; }
.edit-btn { background: #ffd700; border: none; color: #000; padding: 8px 15px; border-radius: 8px; cursor: pointer; transition: all 0.3s; display: flex; align-items: center; gap: 5px; }
.edit-btn:hover { background: #ffaa00; }

.notification { position: fixed; top: 80px; right: 20px; z-index: 9999; min-width: 280px; max-width: 400px; background: #1a1a2e; border-radius: 12px; overflow: hidden; transform: translateX(400px); transition: transform 0.3s ease; box-shadow: 0 5px 20px rgba(0,0,0,0.3); border-left: 4px solid; }
.notification.show { transform: translateX(0); }
.notification-success { border-left-color: #00cc66; }
.notification-error { border-left-color: #ff3333; }
.notification-info { border-left-color: #ffd700; }
.notification-content { padding: 15px; display: flex; align-items: center; gap: 12px; }
.notification-content i { font-size: 20px; }
.notification-success .notification-content i { color: #00cc66; }
.notification-error .notification-content i { color: #ff3333; }
.notification-info .notification-content i { color: #ffd700; }
.notification-progress { height: 3px; background: rgba(255,255,255,0.1); animation: progress 3s linear forwards; }
@keyframes progress { from { width: 100%; } to { width: 0%; } }

.progress-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); z-index: 10000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(5px); }
.progress-container { background: #1a1a2e; border-radius: 20px; padding: 30px; text-align: center; min-width: 300px; border: 1px solid #ff0000; }
.progress-icon { font-size: 48px; color: #ffd700; margin-bottom: 15px; }
.progress-message { color: white; font-size: 16px; margin-bottom: 20px; }
.progress-bar-bg { width: 100%; height: 8px; background: #2a2a3e; border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #ff0000, #ffd700); width: 0%; transition: width 0.3s ease; border-radius: 4px; }
.progress-percent { color: #ffd700; font-size: 14px; font-weight: bold; }

.empty-state { text-align: center; padding: 50px; color: #aaa; }
.empty-state i { font-size: 48px; margin-bottom: 15px; display: block; }
.loading { text-align: center; padding: 50px; color: #aaa; }
.loading i { font-size: 40px; margin-bottom: 15px; display: block; animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

#iframeModal .video-info-panel { height: 45%; overflow-y: auto; overflow-x: hidden; padding: 20px; }
#iframeModal .comments-list { max-height: none !important; overflow-y: visible !important; overflow: visible !important; margin-bottom: 12px; }

/* STREAMS */
.stream-card { background: #1a1a2e; border-radius: 16px; overflow: hidden; cursor: pointer; transition: all 0.3s; }
.stream-card:hover { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(255,0,0,0.2); }
.pending-badge { background: #ff0000; color: #fff; border-radius: 50%; font-size: 10px; font-weight: bold; min-width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; margin-left: 4px; padding: 0 4px; }

@media (max-width: 768px) {
    .top-bar { padding: 10px 15px; }
    .logo span { display: none; }
    .search-box { width: 50%; padding: 8px 12px; }
    .user-name { display: none; }
    .content-area { padding: 15px; margin-top: 65px; }
    .videos-grid { grid-template-columns: 1fr; gap: 15px; }
    .form-row { grid-template-columns: 1fr; }
    .admin-tabs { flex-direction: column; }
    .video-modal-content, .series-modal-content { width: 100vw; height: 100vh; border-radius: 0; }
    #episodePlayer { max-height: none; width: 100%; aspect-ratio: 16/9; flex: 0 0 auto; }
    .vp-player, .vp-player video { max-height: none; width: 100%; aspect-ratio: 16/9; flex: 0 0 auto; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .episode-number { min-width: 70px; font-size: 12px; }
}
@media (max-width: 480px) {
    .nav-btn span { display: none; }
    .nav-btn i { font-size: 24px; }
    .nav-btn { padding: 8px 16px; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* ===== СВЕТЛАЯ ТЕМА ===== */
body.light { background: #f0f0f0; color: #111; }
body.light .top-bar { background: #fff; border-bottom-color: #ddd; }
body.light .bottom-nav { background: #fff; border-top-color: #ddd; }
body.light .video-card { background: #fff; }
body.light .search-box { background: #eee; }
body.light .search-box input { color: #111; }
body.light .video-stats { color: #555; }
body.light .admin-card { background: #fff; border-color: #ddd; }
body.light .admin-tabs { background: #fff; }
body.light .admin-tab { background: #eee; color: #111; }
body.light .form-group input, body.light .form-group textarea, body.light .form-group select { background: #eee; border-color: #ccc; color: #111; }
body.light .voy-dialog { background: #fff; border-color: #ddd; }
body.light .voy-dialog-title { color: #111; }
body.light .voy-dialog-input { background: #eee; border-color: #ccc; color: #111; }
body.light .profile-card { background: #fff; border-color: #ddd; }
body.light .stat-card { background: #e8e8e8; }
body.light .comment { background: #f5f5f5; }
body.light .nav-btn { color: #555; }
body.light .nav-btn.active { color: #ff0000; }
body.light .action-btn { background: #eee; color: #111; }
body.light .action-btn:hover { background: #ddd; }

/* Кнопка темы */
.theme-toggle-btn {
    background: none; border: none; cursor: pointer;
    font-size: 20px; color: #aaa; padding: 4px 8px;
    border-radius: 8px; transition: all 0.2s;
}
.theme-toggle-btn:hover { color: #fff; background: #2a2a3e; }
body.light .theme-toggle-btn:hover { background: #eee; color: #111; }

/* ===== СВЕТЛАЯ ТЕМА ===== */
body.light { background: #f0f0f0; color: #111; }
body.light .top-bar { background: #fff; border-bottom-color: #ddd; }
body.light .bottom-nav { background: #fff; border-top-color: #ddd; }
body.light .video-card { background: #fff; }
body.light .search-box { background: #eee; }
body.light .search-box input { color: #111; }
body.light .video-stats { color: #555; }
body.light .admin-card { background: #fff; border-color: #ddd; }
body.light .admin-tabs { background: #fff; }
body.light .admin-tab { background: #eee; color: #111; }
body.light .form-group input, body.light .form-group textarea, body.light .form-group select { background: #eee; border-color: #ccc; color: #111; }
body.light .voy-dialog { background: #fff; border-color: #ddd; }
body.light .voy-dialog-title { color: #111; }
body.light .voy-dialog-input { background: #eee; border-color: #ccc; color: #111; }
body.light .profile-card { background: #fff; border-color: #ddd; }
body.light .stat-card { background: #e8e8e8; }
body.light .comment { background: #f5f5f5; }
body.light .nav-btn { color: #555; }
body.light .nav-btn.active { color: #ff0000; }
body.light .action-btn { background: #eee; color: #111; }
body.light .action-btn:hover { background: #ddd; }

/* Кнопка темы */
.theme-toggle-btn {
    background: none; border: none; cursor: pointer;
    font-size: 20px; color: #aaa; padding: 4px 8px;
    border-radius: 8px; transition: all 0.2s;
}
.theme-toggle-btn:hover { color: #fff; background: #2a2a3e; }
body.light .theme-toggle-btn:hover { background: #eee; color: #111; }

.short-actions { position: absolute; right: 10px; bottom: 100px; display: flex; flex-direction: column; align-items: center; gap: 16px; z-index: 5; }
.short-views { background: rgba(255,255,255,0.12); backdrop-filter: blur(4px); color: #fff; width: 52px; height: 52px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 20px; }
.short-views span { font-size: 11px; font-weight: 600; color: #fff; }
