:root {
    --bg-outside: #000000;
    --bg-app: #000000;
    --surface-color: #121214;
    --surface-hover: #1c1c1e;
    --text-primary: #ffffff;
    --text-secondary: #8e8e93;
    --accent-color: #ff453a;
    --accent-glow: rgba(255, 69, 58, 0.15);
    --border-radius: 20px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, sans-serif;
    background-color: var(--bg-outside);
    color: var(--text-primary);
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.mobile-wrapper {
    width: 100%;
    max-width: 480px;
    background-color: var(--bg-app);
    min-height: 100vh;
    position: relative;
    box-shadow: 0 0 60px rgba(0, 0, 0, 1);
    display: flex;
    flex-direction: column;
}

#loading-screen {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #1a1a1c 0%, #000000 100%);
    z-index: 9999;
    display: flex; 
    flex-direction: column; 
    justify-content: space-between;
    align-items: center;
    padding: 100px 0 60px 0;
    transition: opacity 0.5s ease;
}

.logo-container { margin: auto; text-align: center; }

.loader {
    width: 40px; height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.08); 
    border-top-color: var(--accent-color);
    border-radius: 50%; 
    animation: spin 0.8s linear infinite;
}

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

.app-container {
    padding: 16px; 
    padding-bottom: 120px; 
    flex: 1; 
    overflow-y: auto;
    scroll-behavior: smooth;
}

.app-container::-webkit-scrollbar { display: none; }

.page-title { 
    font-size: 32px; 
    font-weight: 800; 
    margin-bottom: 20px; 
    padding-top: 10px; 
    letter-spacing: -0.5px; 
}

.section-title { 
    font-size: 13px; 
    font-weight: 700; 
    color: var(--text-secondary); 
    margin: 28px 0 16px 0; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
}

.search-container { position: relative; width: 100%; margin-bottom: 24px; display: flex; align-items: center; }
.search-input { 
    width: 100%; 
    box-sizing: border-box; 
    background-color: var(--surface-color) !important; 
    border: 1px solid rgba(255, 255, 255, 0.05); 
    color: #ffffff !important; 
    padding: 16px 16px 16px 48px; 
    border-radius: 18px; 
    font-size: 16px; 
    outline: none; 
    -webkit-appearance: none; 
    transition: all 0.2s ease; 
}
.search-input:focus { 
    border-color: var(--accent-color); 
    background-color: #1a1a1c !important;
}
.search-input::placeholder { color: #636366; font-weight: 500; }
.search-icon-input { position: absolute; left: 16px; color: #636366; pointer-events: none; }
.search-input:focus + .search-icon-input { color: var(--accent-color); }

.tab-content { display: none; animation: slideUpFade 0.4s ease; }
.tab-content.active { display: block; }
@keyframes slideUpFade { 
    from { opacity: 0; transform: translateY(15px); } 
    to { opacity: 1; transform: translateY(0); } 
}

/* --- КАРТОЧКИ ИСТОРИЙ --- */
.story-card { 
    background-color: var(--surface-color) !important; 
    border: 1px solid rgba(255, 255, 255, 0.04) !important; 
    border-radius: 20px !important; 
    padding: 16px !important; 
    margin-bottom: 14px !important; 
    display: flex; 
    flex-direction: column; 
    transition: transform 0.2s ease, background-color 0.2s ease; 
}
.story-card:active { 
    transform: scale(0.97); 
    background-color: var(--surface-hover) !important; 
}

/* Премиальный VIP-бейдж */
.exclusive-badge { 
    background: linear-gradient(90deg, #FF9F0A 0%, #FFD60A 100%) !important; 
    color: #000 !important; 
    padding: 3px 8px !important; 
    font-size: 10px !important; 
    border-radius: 6px !important; 
    font-weight: 800 !important; 
    text-transform: uppercase !important; 
    display: inline-flex !important; 
    align-items: center !important;
    margin-left: 0 !important; 
    border: none !important;
    box-shadow: 0 2px 8px rgba(255, 159, 10, 0.25) !important; 
}

/* Аккуратный бейдж прослушивания */
.listened-badge { 
    background: rgba(48, 209, 88, 0.15) !important; 
    color: #30d158 !important; 
    padding: 3px 8px !important; 
    font-size: 10px !important; 
    border-radius: 6px !important; 
    font-weight: 800 !important; 
    text-transform: uppercase !important; 
    display: inline-flex !important; 
    align-items: center !important; 
    gap: 4px !important; 
    border: none !important; 
    box-shadow: none !important; 
}
.listened-badge svg { margin-top: -1px; width: 10px; height: 10px; }

/* Компактные кнопки лайков и закладок */
.like-btn, .fav-btn { 
    background: rgba(255, 255, 255, 0.05) !important; 
    border: none !important; 
    color: var(--text-secondary) !important; 
    border-radius: 12px !important; 
    padding: 8px 10px !important; 
    display: flex; 
    align-items: center; 
    justify-content: center;
    gap: 6px; 
    font-size: 13px !important; 
    font-weight: 700 !important; 
    cursor: pointer; 
    transition: all 0.2s ease; 
}
.like-btn.active, .fav-btn.active { 
    background: var(--accent-glow) !important; 
    color: var(--accent-color) !important; 
    box-shadow: none !important; 
}
.like-btn:active, .fav-btn:active { transform: scale(0.9); }

/* Чистая и сочная кнопка отправки */
.send-btn { 
    width: 100%; 
    background-color: var(--accent-glow) !important; 
    color: var(--accent-color) !important; 
    border: none !important; 
    padding: 12px !important; 
    border-radius: 12px !important; 
    font-size: 15px !important; 
    font-weight: 700 !important; 
    cursor: pointer; 
    text-align: center; 
    transition: all 0.2s ease; 
}
.send-btn:active { 
    background-color: rgba(255, 69, 58, 0.2) !important; 
    transform: scale(0.97); 
}

.delete-btn { background-color: transparent; color: var(--accent-color); border: 1px solid rgba(255, 69, 58, 0.2); padding: 8px 16px; border-radius: 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.delete-btn:active { background-color: rgba(255, 69, 58, 0.1); transform: scale(0.95); }

/* --- АВТОРЫ --- */
.author-card { background-color: var(--surface-color); border: 1px solid rgba(255, 255, 255, 0.03); border-radius: var(--border-radius); padding: 16px; margin-bottom: 12px; display: flex; align-items: center; gap: 14px; transition: transform 0.2s ease; }
.author-card:active { transform: scale(0.97); }
.author-avatar { width: 50px; height: 50px; flex-shrink: 0; background: linear-gradient(135deg, #2c2c2e 0%, #151515 100%); border: 1px solid rgba(255,255,255,0.06); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 20px; color: var(--text-primary); }
.author-info { flex-grow: 1; min-width: 0; }
.author-info h3 { font-size: 16px; margin-bottom: 2px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.author-info p { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.follow-btn { flex-shrink: 0; background-color: rgba(255,255,255,0.08); color: var(--text-primary); border: none; padding: 8px 14px; border-radius: 12px; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; }
.follow-btn:active { background-color: rgba(255,255,255,0.15); transform: scale(0.95); }

/* --- ПРОФИЛЬ --- */
.profile-header { display: flex; align-items: center; margin-bottom: 32px; background: var(--surface-color); padding: 20px; border-radius: var(--border-radius); border: 1px solid rgba(255,255,255,0.04); }
.profile-avatar { width: 70px; height: 70px; background: linear-gradient(135deg, var(--accent-color), #6b0000); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; margin-right: 16px; flex-shrink: 0; border: none; }
.profile-details { min-width: 0; }
.profile-details h2 { font-size: 22px; margin-bottom: 4px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-details p { color: var(--accent-color); font-size: 12px; font-weight: 700; background: var(--accent-glow); display: inline-block; padding: 4px 10px; border-radius: 8px; text-transform: uppercase; }

.settings-list { background-color: var(--surface-color); border-radius: var(--border-radius); overflow: hidden; border: 1px solid rgba(255,255,255,0.04); }
.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid rgba(255, 255, 255, 0.03); font-size: 16px; font-weight: 600; cursor: pointer; transition: background-color 0.2s; }
.settings-item:hover, .settings-item:active { background-color: rgba(255,255,255,0.04); }
.settings-item:last-child { border-bottom: none; }
.settings-item .arrow { color: #636366; display: flex; align-items: center; justify-content: center; transition: transform 0.2s ease; }
.settings-item:active .arrow { transform: translateX(6px); color: var(--text-primary); }

/* --- НИЖНЯЯ ПАНЕЛЬ --- */
.bottom-nav { 
    position: fixed; 
    bottom: 0; 
    left: 50%; 
    transform: translateX(-50%); 
    width: 100%; 
    max-width: 480px; 
    height: 90px; 
    background-color: rgba(12, 12, 14, 0.75); 
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px); 
    display: flex; 
    justify-content: space-around; 
    align-items: center; 
    padding-bottom: env(safe-area-inset-bottom, 15px); 
    border-top: 1px solid rgba(255, 255, 255, 0.05); 
    border-top-left-radius: 24px; 
    border-top-right-radius: 24px; 
    z-index: 1000; 
}
.nav-btn { background: none; border: none; color: #636366; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; cursor: pointer; transition: all 0.3s ease; gap: 4px; }
.nav-btn svg { width: 24px; height: 24px; stroke-width: 2.2; transition: all 0.3s ease; }
.nav-btn span { font-size: 11px; font-weight: 600; }
.nav-btn.active { color: var(--accent-color); }
.nav-btn.active svg { transform: translateY(-2px); color: var(--accent-color); }
.nav-btn.active span { color: var(--accent-color); }
.nav-btn:active { transform: scale(0.9); }

/* --- АДМИН ПАНЕЛЬ --- */
.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--surface-color);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 16px;
    padding: 16px 12px;
    text-align: center;
}
.stat-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 8px;
}
.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
}

.admin-section {
    background: var(--surface-color);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: 24px;
    padding: 20px;
    margin-bottom: 20px;
}

.add-btn {
    background: rgba(48,209,88,0.15); 
    color: #30d158; 
    border: none; 
    padding: 6px 12px; 
    border-radius: 10px; 
    font-weight: 700; 
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.add-btn:active { transform: scale(0.9); }

/* IOS Переключатель */
.ios-switch {
    appearance: none;
    width: 50px; height: 30px;
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    outline: none;
    transition: 0.3s;
}
.ios-switch::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 26px; height: 26px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.ios-switch:checked { background: #30d158; }
.ios-switch:checked::after { transform: translateX(20px); }

/* --- МОДАЛЬНЫЕ ОКНА --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8); z-index: 10000; display: flex; justify-content: center; align-items: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; animation: fadeInModal 0.3s forwards; }
@keyframes fadeInModal { to { opacity: 1; } }
.modal-content { background: var(--surface-color); padding: 24px; border-radius: 28px; width: 88%; max-width: 360px; border: 1px solid rgba(255,255,255,0.06); transform: translateY(20px); animation: popModal 0.3s forwards; }
@keyframes popModal { to { transform: translateY(0); } }

.input-group { margin-bottom: 20px; }
.input-group label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.modal-input { width: 100%; box-sizing: border-box; background-color: #000; border: 1px solid rgba(255, 255, 255, 0.05); color: var(--text-primary); padding: 14px; border-radius: 14px; font-size: 16px; outline: none; transition: all 0.2s ease; }
.modal-input:focus { border-color: var(--accent-color); }

/* --- ФИЛЬТРЫ --- */
.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip { padding: 10px 18px; background: rgba(255,255,255,0.06); border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; color: var(--text-secondary); transition: all 0.2s ease; }
.filter-chip.active { background: var(--text-primary); color: #000; }
.filter-chip:active { transform: scale(0.95); }

/* --- СПИСОК ЭПИЗОДОВ --- */
.episode-item { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.04); }
.episode-item:last-child { border-bottom: none; }
.episode-info { flex: 1; padding-right: 12px; }
.episode-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; color: var(--text-primary); }
.episode-duration { font-size: 13px; color: var(--text-secondary); font-weight: 500; }
.episode-send-btn { background: var(--accent-glow); color: var(--accent-color); border: none; padding: 10px 14px; border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
.episode-send-btn:active { background: rgba(255, 69, 58, 0.2); transform: scale(0.9); }