* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root { --bg-primary: #f5f7fa; --bg-secondary: #ffffff; --bg-header: #0d4cd3; --text-primary: #1a1a1a; --text-secondary: #6b7280; --accent: #0d4cd3; --border-radius: 16px; --spacing: 16px; --shadow: 0 4px 12px rgba(0,0,0,0.08); }
html, body { width: 100%; min-height: 100%; overflow-x: hidden; background-color: var(--bg-primary); font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: var(--text-primary); }
.hidden { display: none !important; }

/* ВСТУПИТЕЛЬНЫЙ ЭКРАН */
.welcome-screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, var(--bg-header) 0%, #0a3ba3 100%); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: var(--spacing); }
.welcome-content { text-align: center; max-width: 320px; color: white; }
.welcome-logo { width: 140px; height: 140px; margin: 0 auto 24px; border-radius: 50%; overflow: hidden; background: rgba(255,255,255,0.15); border: 3px solid rgba(255,255,255,0.3); display: flex; align-items: center; justify-content: center; box-shadow: 0 8px 24px rgba(0,0,0,0.2); }
.welcome-logo img { width: 100%; height: 100%; object-fit: cover; }
.welcome-title { font-size: 26px; font-weight: 700; margin-bottom: 12px; }
.welcome-subtitle { font-size: 15px; opacity: 0.9; margin-bottom: 32px; line-height: 1.5; }
.welcome-btn { background: white; color: var(--bg-header); border: none; padding: 18px 48px; font-size: 16px; font-weight: 700; border-radius: 14px; cursor: pointer; width: 100%; box-shadow: 0 4px 12px rgba(0,0,0,0.1); transition: all 0.2s; }
.welcome-btn:active { transform: scale(0.96); box-shadow: 0 2px 4px rgba(0,0,0,0.1); }

/* ОСНОВНОЙ ИНТЕРФЕЙС */
.header { background: var(--bg-header); color: white; padding: calc(var(--spacing) + env(safe-area-inset-top)) var(--spacing) var(--spacing); border-radius: 0 0 24px 24px; margin-bottom: 20px; box-shadow: var(--shadow); }
.header-content { display: flex; justify-content: space-between; align-items: center; }
.title { font-size: 20px; font-weight: 700; }
.icon-btn { background: rgba(255,255,255,0.2); border: none; color: white; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.icon-btn:active { background: rgba(255,255,255,0.3); transform: scale(0.95); }
.search-section { padding: 0 var(--spacing); margin-bottom: 20px; }
.search-box { display: flex; align-items: center; gap: 12px; background: var(--bg-secondary); border-radius: 14px; padding: 14px 18px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.05); }
.search-input { flex: 1; background: none; border: none; color: var(--text-primary); font-size: 16px; outline: none; }
.app { padding: 0 var(--spacing) 32px; max-width: 600px; margin: 0 auto; }
.section { margin-bottom: 24px; }
.section-title { font-size: 13px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; }

/* КАНАЛЫ И КАТЕГОРИИ */
.horizontal-scroll { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.channel-chip { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; width: 80px; transition: all 0.2s; }
.channel-chip:active { transform: scale(0.92); }
.channel-avatar-wrapper { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; background: var(--bg-secondary); border: 3px solid white; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 600; color: var(--bg-header); }
.channel-name { font-size: 12px; text-align: center; color: var(--text-primary); font-weight: 600; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.3; }
.categories-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.category-card { background: var(--bg-secondary); border-radius: var(--border-radius); padding: 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; cursor: pointer; min-height: 120px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.03); transition: all 0.2s; }
.category-card:active { transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); background: var(--accent-light); }
.category-card.large { grid-column: span 2; flex-direction: row; align-items: center; min-height: auto; }
.category-icon { width: 48px; height: 48px; border-radius: 14px; background: #eef2ff; color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.category-info { flex: 1; }
.category-title { font-size: 15px; font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.category-count { font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ЭКРАНЫ И СПИСКИ */
.screen { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--bg-primary); z-index: 100; display: flex; flex-direction: column; }
.screen-header { display: flex; align-items: center; gap: 16px; padding: calc(var(--spacing) + env(safe-area-inset-top)) var(--spacing) var(--spacing); background: var(--bg-secondary); border-bottom: 1px solid #e5e7eb; flex-shrink: 0; }
.back-btn { background: none; border: none; color: var(--text-primary); width: 40px; height: 40px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.back-btn:active { background: #eef2ff; transform: scale(0.95); }
.screen-title { font-size: 20px; font-weight: 700; }
.screen-content { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: var(--spacing); }
.organizations-list { display: flex; flex-direction: column; gap: 10px; }
.org-item { background: var(--bg-secondary); border-radius: 14px; padding: 16px; display: flex; align-items: center; gap: 14px; cursor: pointer; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border: 1px solid rgba(0,0,0,0.03); transition: all 0.2s; }
.org-item:active { transform: translateY(2px); box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); background: #eef2ff; }
.org-icon { width: 48px; height: 48px; border-radius: 12px; background: #eef2ff; color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.org-info { flex: 1; min-width: 0; }
.org-name { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.org-category { font-size: 12px; color: var(--text-secondary); }
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-secondary); }

/* ИСПРАВЛЕНИЕ АЛФАВИТА */
.alphabet-nav { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 4px; 
    margin-bottom: 16px; 
    padding: 8px 0; 
    border-bottom: 1px solid #e5e7eb; 
    position: sticky; 
    top: 0; 
    background: var(--bg-primary); 
    z-index: 10; 
}
.alphabet-item { 
    width: 28px; 
    height: 28px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-size: 13px; 
    font-weight: 600; 
    color: var(--text-primary); 
    border-radius: 6px; 
    cursor: pointer; 
    transition: all 0.15s; 
}
.alphabet-item:active { background: var(--accent); color: white; }
.alphabet-item.empty { opacity: 0.3; pointer-events: none; }

@media (max-width: 360px) { .categories-grid { grid-template-columns: 1fr; } .category-card.large { grid-column: span 1; } }
