/* ===== Стили ===== */
:root {
    --bg: #0a0e27;
    --bg2: #151b3d;
    --bg3: #1c2350;
    --card: rgba(255, 255, 255, 0.04);
    --card-hover: rgba(74, 158, 255, 0.10);
    --accent: #4a9eff;
    --accent2: #7c5cff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text: #ffffff;
    --text2: #aeb4d0;
    --text3: #7a82a5;
    --border: rgba(255, 255, 255, 0.09);
    --radius: 18px;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: "Rubik", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* фоновые орбы */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.45;
    z-index: 0;
    pointer-events: none;
}
.orb-a { width: 480px; height: 480px; background: var(--accent); top: -160px; left: -120px; animation: float 14s ease-in-out infinite; }
.orb-b { width: 380px; height: 380px; background: var(--accent2); bottom: -120px; right: -100px; animation: float 18s ease-in-out infinite reverse; }
.orb-c { width: 300px; height: 300px; background: var(--success); top: 40%; left: 60%; opacity: 0.2; animation: float 22s ease-in-out infinite; }

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    50% { transform: translateY(-40px) translateX(30px); }
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }

/* ===== Шапка ===== */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(10, 14, 39, 0.8);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.2rem; }
.brand-logo { font-size: 1.5rem; }
.brand-text b { color: var(--accent); }
.nav-links { display: flex; gap: 6px; }
.nav-link {
    padding: 9px 16px;
    border-radius: 12px;
    color: var(--text2);
    font-weight: 500;
    transition: all 0.2s;
}
.nav-link:hover { color: var(--text); background: var(--card); }
.nav-link.active { color: var(--text); background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: var(--shadow); }
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.6rem; }

/* ===== Главная / hero ===== */
.hero {
    padding: 56px 0 40px;
    text-align: center;
}
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(74, 158, 255, 0.12);
    border: 1px solid rgba(74, 158, 255, 0.35);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
}
.hero h1 {
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    font-weight: 800;
    line-height: 1.12;
    margin-bottom: 16px;
}
.gradient-text {
    background: linear-gradient(120deg, var(--accent), var(--accent2), var(--success));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.hero p { color: var(--text2); font-size: 1.1rem; max-width: 640px; margin: 0 auto 30px; }

.search-wrap { max-width: 560px; margin: 0 auto; position: relative; }
.search-wrap input {
    width: 100%;
    padding: 16px 20px 16px 52px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: all 0.2s;
}
.search-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.15); }
.search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text3); font-size: 1.2rem; }

.stats-row {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin: 34px 0 10px;
}
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 26px;
    min-width: 150px;
    backdrop-filter: blur(6px);
}
.stat .num { font-size: 1.7rem; font-weight: 800; color: var(--accent); }
.stat .label { color: var(--text3); font-size: 0.85rem; margin-top: 2px; }

.quick-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    margin: 34px 0 20px;
}
.quick-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    overflow: hidden;
    transition: all 0.25s;
    cursor: pointer;
}
.quick-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.15), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}
.quick-card:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: var(--shadow); }
.quick-card:hover::before { opacity: 1; }
.quick-card .qc-emoji { font-size: 2.4rem; display: block; margin-bottom: 14px; }
.quick-card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.quick-card p { color: var(--text2); font-size: 0.92rem; }
.quick-card .go { position: absolute; right: 20px; bottom: 20px; color: var(--accent); font-size: 1.3rem; }

/* ===== Разделы ===== */
.page { animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.page-title { padding: 34px 0 6px; }
.page-title h2 { font-size: 2rem; font-weight: 800; }
.page-title p { color: var(--text2); margin-top: 6px; }
.breadcrumb { color: var(--text3); font-size: 0.88rem; margin-bottom: 14px; }
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }

.tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 20px 0;
}
.tab-btn {
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text2);
    font-weight: 600;
    transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); border-color: var(--accent); }
.tab-btn.active { color: var(--text); background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 14px;
    margin: 16px 0 30px;
}
.card-btn {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 14px;
    text-align: center;
    transition: all 0.22s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 138px;
    gap: 4px;
}
.card-btn:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.card-btn .cb-emoji { font-size: 1.9rem; line-height: 1; margin-bottom: 2px; }
.card-btn .cb-name { font-weight: 600; line-height: 1.25; max-width: 100%; }
.card-btn .cb-sub { color: var(--text3); font-size: 0.78rem; margin-top: 2px; line-height: 1.2; }

.grade-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0 24px; }
.grade-btn {
    width: 52px; height: 52px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-weight: 700;
    font-size: 1.05rem;
    transition: all 0.2s;
}
.grade-btn:hover, .grade-btn.active { background: linear-gradient(135deg, var(--accent), var(--accent2)); border-color: transparent; transform: translateY(-2px); }

/* файлы */
.files-list { display: flex; flex-direction: column; gap: 12px; margin: 16px 0 30px; }
.file-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: all 0.2s;
}
.file-card:hover { border-color: var(--accent); background: var(--card-hover); }
.file-icon {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.3rem;
    background: rgba(239, 68, 68, 0.15);
    color: #ff7a7a;
    flex-shrink: 0;
}
.file-info { flex: 1; min-width: 0; }
.file-title { font-weight: 600; font-size: 0.98rem; word-break: break-word; }
.file-meta { color: var(--text3); font-size: 0.8rem; margin-top: 2px; }
.file-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn {
    padding: 9px 16px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    font-size: 0.86rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-primary:hover { box-shadow: 0 8px 22px rgba(74, 158, 255, 0.4); transform: translateY(-1px); }
.btn-ghost { background: var(--bg2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* результаты поиска */
.section-title { margin: 26px 0 12px; font-size: 1.25rem; font-weight: 700; }
.empty {
    text-align: center;
    color: var(--text3);
    padding: 40px 0;
}
.empty .e-emoji { font-size: 2.6rem; display: block; margin-bottom: 12px; }

/* ===== Подвал ===== */
.site-footer { margin-top: 60px; border-top: 1px solid var(--border); background: rgba(6, 9, 24, 0.6); }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; padding: 40px 20px 24px; }
.footer-desc { color: var(--text3); max-width: 340px; margin-top: 10px; font-size: 0.9rem; }
.footer-legal { color: var(--text3); max-width: 400px; margin-top: 12px; font-size: 0.78rem; line-height: 1.5; opacity: 0.85; }
.footer-cols { display: flex; gap: 48px; flex-wrap: wrap; }
.footer-col h4 { margin-bottom: 12px; color: var(--text2); font-size: 0.95rem; }
.footer-col a { display: block; color: var(--text3); font-size: 0.9rem; margin-bottom: 8px; transition: color 0.2s; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid var(--border); padding: 16px 20px; color: var(--text3); font-size: 0.82rem; text-align: center; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: var(--bg3);
    border: 1px solid var(--accent);
    color: var(--text);
    padding: 14px 22px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    font-weight: 500;
    z-index: 100;
    opacity: 0;
    transition: all 0.3s;
    pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ===== Loading ===== */
.loading { text-align: center; padding: 90px 0; color: var(--text3); }
.spinner {
    width: 44px; height: 44px;
    margin: 0 auto 14px;
    border: 4px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Доп. элементы ===== */
.nav-right { display: flex; align-items: center; gap: 10px; }
.icon-btn {
    width: 42px; height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    font-size: 1.15rem;
    transition: all 0.2s;
}
.icon-btn:hover { border-color: var(--accent); transform: translateY(-2px); }

/* Нижняя навигация — ВСЕГДА видима (важно для Android и мобильных вебвью) */
body { padding-bottom: 70px; }
.mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: rgba(10, 14, 39, 0.96);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.25);
    z-index: 90;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
    gap: 4px;
    width: 100%;
}
.mn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 6px;
    border-radius: 14px;
    color: var(--text3);
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    flex: 1 1 0;
    min-height: 48px;
    transition: color 0.25s, background 0.25s, transform 0.2s, box-shadow 0.25s;
    -webkit-tap-highlight-color: transparent;
}
.mn-item small { font-size: inherit; line-height: 1.15; }
.mn-item:hover { color: var(--text); }
.mn-item.active {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
@media (max-width: 720px) {
    .site-footer { margin-bottom: 72px; }
}

/* ===== Светлая тема ===== */
body.light {
    --bg: #eef1f8;
    --bg2: #ffffff;
    --bg3: #e4e9f5;
    --card: #ffffff;
    --card-hover: rgba(37, 99, 235, 0.06);
    --accent: #2563eb;
    --accent2: #7c3aed;
    --text: #151a2e;
    --text2: #4b5370;
    --text3: #8a93ad;
    --border: rgba(21, 26, 46, 0.10);
    --shadow: 0 18px 40px rgba(21, 26, 46, 0.10);
}
body.light .site-header, body.light .mobile-nav { background: rgba(255, 255, 255, 0.85); }
body.light .site-footer { background: rgba(228, 233, 245, 0.6); }
body.light .btn-ghost { background: #fff; }
body.light .file-icon { background: rgba(239, 68, 68, 0.12); }
body.light .bg-orb { opacity: 0.22; }

/* ===== Чипы, сервисы, викторина ===== */
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 26px; }
.chip {
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text2);
    font-size: 0.85rem;
}
.services { margin-top: 10px; }
.svc-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-top: 14px;
    animation: fadeIn 0.3s ease;
}
.svc-panel h3 { margin-bottom: 14px; }
.svc-panel textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    outline: none;
    margin-bottom: 12px;
}
.svc-panel textarea:focus { border-color: var(--accent); }
.svc-note { color: var(--text2); margin-top: 12px; line-height: 1.6; }
.svc-links {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}
.svc-links > span { color: var(--text2); margin-right: 2px; }
.svc-link { text-decoration: none; }
.quiz-q { margin-bottom: 16px; }
.quiz-qtext { font-weight: 600; margin-bottom: 8px; }
.quiz-opt { margin-right: 6px; margin-bottom: 6px; }
.quiz-opt:disabled { opacity: 0.55; cursor: not-allowed; }
.quiz-result { margin-top: 8px; font-weight: 600; font-size: 0.9rem; min-height: 18px; }
.plan-list { list-style: none; display: grid; gap: 10px; }
.plan-list li { color: var(--text2); line-height: 1.5; }

/* ===== Адаптив ===== */
@media (max-width: 720px) {
    /* На телефоне верхнее бургер-меню не нужно — навигация через нижнюю панель */
    .nav-toggle { display: none; }
    .nav-links { display: none; }
    .nav-link { display: none; }
    .nav { height: 60px; }
    .brand { font-size: 1.1rem; }
    .file-card { flex-wrap: wrap; }
    .file-actions { width: 100%; justify-content: flex-end; }
    .footer-inner { flex-direction: column; }
}

/* ===== Слайдер на главной ===== */
.slider {
    position: relative;
    margin: 26px 0 6px;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(74,158,255,0.12), rgba(124,92,255,0.10));
    box-shadow: var(--shadow);
}
/* Кроссфейд-слайдер: все слайды наложены друг на друга,
   виден только активный — работает на любом устройстве без смещений */
.slides {
    display: grid;
    grid-template-columns: 1fr;
}
.slide {
    grid-area: 1 / 1;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    padding: 30px 56px;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.7s ease, visibility 0.7s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}
.slide.active { opacity: 1; visibility: visible; }
.slide h3, .slide p { overflow-wrap: break-word; max-width: 100%; }
.slide-emoji { font-size: 2.6rem; margin-bottom: 10px; }
.slide h3 { font-size: 1.35rem; margin-bottom: 8px; }
.slide p { color: var(--text2); max-width: 520px; margin: 0 auto 16px; }
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(10,14,39,0.6);
    color: var(--text);
    font-size: 1.5rem;
    line-height: 1;
    z-index: 5;
    transition: all 0.2s;
}
.slider-btn:hover { background: var(--accent); border-color: transparent; }
.slider-btn.prev { left: 14px; }
.slider-btn.next { right: 14px; }
.slider-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 0 0 16px;
}
.dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    border: none;
    background: var(--border);
    padding: 0;
    transition: all 0.25s;
}
.dot.active { background: var(--accent); width: 24px; border-radius: 6px; }

/* ===== ФГОС-метка у учебников ===== */
.fgos-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--success), #0d9488);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 2px 7px;
    border-radius: 6px;
    margin-right: 6px;
    vertical-align: middle;
}

/* ===== Модальное окно документов ===== */
.modal { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.open { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(6, 9, 24, 0.72); backdrop-filter: blur(4px); }
.modal-body {
    position: relative;
    max-width: 640px;
    width: 100%;
    max-height: 82vh;
    overflow-y: auto;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 30px 30px 34px;
    box-shadow: var(--shadow);
    animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-close {
    position: absolute;
    top: 14px; right: 16px;
    width: 34px; height: 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text2);
    font-size: 1.3rem;
    line-height: 1;
    transition: all 0.2s;
}
.modal-close:hover { color: var(--text); border-color: var(--accent); }
.modal-content h3 { margin-bottom: 14px; font-size: 1.4rem; }
.modal-content p { color: var(--text2); margin-bottom: 12px; line-height: 1.65; }

/* ===== Анимации появления ===== */
.file-card, .card-btn, .quick-card {
    animation: fadeUp 0.4s ease both;
}
.file-card:nth-child(2) { animation-delay: 0.04s; }
.file-card:nth-child(3) { animation-delay: 0.08s; }
.file-card:nth-child(4) { animation-delay: 0.12s; }
.file-card:nth-child(5) { animation-delay: 0.16s; }
.file-card:nth-child(6) { animation-delay: 0.20s; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

/* ===== Адаптив слайдера ===== */
@media (max-width: 560px) {
    .slide { padding: 26px 20px; }
    .slide h3 { font-size: 1.15rem; }
    .slider-btn { width: 34px; height: 34px; font-size: 1.2rem; }
    .modal-body { padding: 24px 18px 28px; }
}

/* ============================================================
   МОБИЛЬНАЯ ОПТИМИЗАЦИЯ (Android + iOS) — устраняет "плывущую"
   вёрстку, гарантирует видимую нижнюю навигацию и аккуратный
   слайдер на любых экранах.
   ============================================================ */
html, body {
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Более компактная нижняя навигация — всегда видима на телефоне */
.mobile-nav {
    width: 100%;
    gap: 4px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom));
}
.mn-item {
    min-height: 46px;
    max-width: none;
    flex: 1 1 0;
    padding: 8px 6px;
    font-size: 0.72rem;
    white-space: normal;
    text-align: center;
    line-height: 1.2;
    -webkit-tap-highlight-color: transparent;
}

/* Планшет и телефон — компактнее контейнер и поля */
@media (max-width: 768px) {
    .container { padding: 0 14px; }
    .hero h1 { font-size: 1.65rem; line-height: 1.25; }
    .hero p { font-size: 0.98rem; margin-bottom: 22px; }
    .search-wrap input { font-size: 1rem; height: 48px; }
    .stats-row { gap: 10px; }
    .stat .num { font-size: 1.5rem; }
    .section-title { font-size: 1.35rem; }
    .quick-cards { gap: 12px; }
    .quick-card { padding: 18px; }
    .quick-card h3 { font-size: 1.05rem; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
    .file-card { gap: 12px; padding: 14px; }
    .file-title { font-size: 0.95rem; }
    .page-title h2 { font-size: 1.45rem; }
}

/* Узкие телефоны */
@media (max-width: 480px) {
    .brand-text { font-size: 1.05rem; }
    .hero h1 { font-size: 1.4rem; }
    .chips { gap: 6px; margin-top: 18px; }
    .chip { font-size: 0.78rem; padding: 6px 11px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
    .card-btn { padding: 16px 10px; }
    .cb-emoji { font-size: 1.7rem; }
    .cb-name { font-size: 0.95rem; }
    .cb-sub { font-size: 0.78rem; }
    .btn { padding: 10px 14px; font-size: 0.86rem; }
    .svc-panel { padding: 16px; }
    .modal-body { padding: 20px 14px 24px; border-radius: 16px; }
    .toast { bottom: 84px; }
}

/* Слайдер на телефоне — компактнее и без обрезаний */
@media (max-width: 480px) {
    .slider { border-radius: 16px; margin: 18px 0 4px; }
    .slide { padding: 22px 16px 26px; }
    .slide-emoji { font-size: 2rem; margin-bottom: 8px; }
    .slide h3 { font-size: 1.02rem; }
    .slide p { font-size: 0.88rem; line-height: 1.5; margin-bottom: 14px; }
    .slider-btn { width: 30px; height: 30px; font-size: 1.05rem; }
    .slider-btn.prev { left: 8px; }
    .slider-btn.next { right: 8px; }
    .slider-dots { padding: 0 0 12px; gap: 6px; }
}

/* Карточки файлов: кнопки в одну строку, ничего не обрезается */
@media (max-width: 560px) {
    body { padding-bottom: 84px; }
    .site-footer { margin-bottom: 78px; }
    .file-actions { justify-content: stretch; gap: 8px; }
    .file-actions .btn { flex: 1; min-width: 0; padding: 9px 6px; font-size: 0.82rem; text-align: center; }
    .file-icon { width: 40px; height: 40px; font-size: 1.3rem; }
    .grade-row { gap: 8px; }
    .grade-btn { padding: 9px 14px; font-size: 0.9rem; }
    .tab-btn { padding: 9px 12px; font-size: 0.85rem; white-space: nowrap; }
    .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
}

/* Убираем скачок при появлении нижней панели, тёмные зоны по краям */
.site-header, .mobile-nav {
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

/* ===== Планшет (до 960px) ===== */
@media (max-width: 960px) {
    .container { padding: 0 16px; }
    .hero h1 { font-size: 1.9rem; }
    .quick-cards { gap: 14px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
    .footer-cols { gap: 28px; }
}

/* ===== Большие экраны (от 1600px) ===== */
@media (min-width: 1600px) {
    .container { max-width: 1320px; }
    .hero h1 { font-size: 2.9rem; }
    .hero p { font-size: 1.2rem; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}

/* ===== Очень узкие телефоны (до 375px) ===== */
@media (max-width: 375px) {
    .brand-text { font-size: 1rem; }
    .hero h1 { font-size: 1.32rem; }
    .hero p { font-size: 0.92rem; }
    .slider { margin: 14px 0 4px; }
    .slide { padding: 20px 14px 24px; }
    .slide-emoji { font-size: 1.8rem; }
    .slide h3 { font-size: 0.98rem; }
    .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .cb-emoji { font-size: 1.5rem; }
    .mn-item { font-size: 0.66rem; min-height: 44px; }
    .file-actions { flex-direction: column; }
    .file-actions .btn { width: 100%; }
}

/* ============================================================
   ИНТЕРЕСНЫЕ ЭФФЕКТЫ — оживляют интерфейс
   ============================================================ */
/* Анимированный градиент в заголовке */
.gradient-text {
    background-size: 200% 200%;
    animation: gradientMove 6s ease infinite;
}
@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Пульсирующий бейдж */
.hero-badge {
    animation: badgePulse 2.4s ease-in-out infinite;
}
@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(74, 158, 255, 0.35); }
    50% { box-shadow: 0 0 0 9px rgba(74, 158, 255, 0); }
}

/* Парящие эмодзи в слайде */
.slide-emoji {
    display: inline-block;
    animation: emojiFloat 3s ease-in-out infinite;
}
@keyframes emojiFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Подъём и свечение карточек при наведении */
.quick-card, .file-card, .card-btn {
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.quick-card:hover, .card-btn:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 45px rgba(74, 158, 255, 0.20);
    border-color: rgba(74, 158, 255, 0.45);
}
.file-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

/* Свечение кнопки "Открыть бота" и главных кнопок */
.btn-primary {
    position: relative;
    overflow: hidden;
    z-index: 1;
}
.btn-primary::after {
    content: "";
    position: absolute;
    top: 0; left: -80%;
    width: 50%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    animation: shine 3.2s ease-in-out infinite;
    z-index: -1;
}
@keyframes shine {
    0% { left: -80%; }
    55% { left: 135%; }
    100% { left: 135%; }
}

/* Мягкое свечение контейнера слайдера */
.slider {
    box-shadow: 0 18px 45px rgba(74, 158, 255, 0.12);
}

/* Нав-ссылки: активная слегка покачивается при наведении */
.nav-link:hover { transform: translateY(-1px); }

/* Анимация счётчиков статистики */
.stat .num {
    font-variant-numeric: tabular-nums;
}

/* На сенсорных экранах убираем сдвиг кнопок/карточек при наведении,
   чтобы ничего не "съезжало" при касании на телефоне */
@media (hover: none), (pointer: coarse) {
    .quick-card:hover, .card-btn:hover, .file-card:hover,
    .nav-link:hover, .icon-btn:hover { transform: none !important; }
    .mn-item.active { transform: none !important; }
    .nav-link.active { transform: none; }
}

/* ===== Лента предметов (перетаскиваемая) ===== */
.ticker {
    position: relative;
    margin: 4px 0 6px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--card);
    padding: 8px 0 4px;
}
.ticker-track {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
}
.ticker-track::-webkit-scrollbar { display: none; }
.ticker-track.dragging {
    cursor: grabbing;
    user-select: none;
    -webkit-user-select: none;
}
.tk-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: none;
    scroll-snap-align: start;
    color: var(--text2);
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 14px;
    cursor: pointer;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}
.tk-item:hover {
    transform: translateY(-2px);
    border-color: var(--primary, #5b8def);
    background: var(--card);
    color: var(--text);
}
.tk-item:active { transform: scale(.96); }
.tk-emoji { font-size: 1.05rem; }
.tk-arrow {
    opacity: .55;
    font-size: .8rem;
    transition: transform .15s ease;
}
.tk-item:hover .tk-arrow { transform: translateX(3px); opacity: 1; }
.ticker-hint {
    display: block;
    text-align: center;
    font-size: .72rem;
    color: var(--text2);
    opacity: .75;
    padding: 0 8px 4px;
}

/* ===== Виджет "До экзамена" + "Совет дня" ===== */
.daily-widget {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 10px 0 30px;
}
.dw-left, .dw-right {
    flex: 1 1 250px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    transition: border-color 0.25s;
}
.dw-left:hover, .dw-right:hover { border-color: rgba(74, 158, 255, 0.4); }
.dw-label { font-weight: 700; margin-bottom: 10px; font-size: 1.05rem; }
.dw-count { font-size: 1.15rem; color: var(--accent); font-weight: 700; line-height: 1.4; }
.dw-count b { color: var(--text); }
.dw-note { color: var(--text3); font-size: 0.82rem; margin-top: 8px; line-height: 1.4; }
.dw-tip { color: var(--text2); line-height: 1.55; }

/* ============================================================
   ПРОФИЛИ, АВТОРИЗАЦИЯ, ИСТОРИЯ ПРОСМОТРОВ
   ============================================================ */
.auth-nav-btn {
    padding: 10px 18px;
    border-radius: 12px;
    border: 1px solid rgba(74, 158, 255, 0.45);
    background: rgba(74, 158, 255, 0.12);
    color: var(--accent);
    font-weight: 700;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.auth-nav-btn:hover {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(74, 158, 255, 0.35);
}
.auth-nav-btn.logged-in {
    color: var(--text);
    background: rgba(16, 185, 129, 0.14);
    border-color: rgba(16, 185, 129, 0.45);
}

/* --- Модальное окно входа --- */
.auth-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 18px;
}
.auth-modal.open { display: flex; }
.auth-overlay {
    position: absolute;
    inset: 0;
    background: rgba(4, 7, 22, 0.72);
    backdrop-filter: blur(8px);
}
.auth-card {
    position: relative;
    width: 100%;
    max-width: 430px;
    max-height: 92vh;
    overflow-y: auto;
    background: linear-gradient(160deg, #171e46, #0e1330);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 24px;
    padding: 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    animation: authIn 0.25s ease;
}
@keyframes authIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text2);
    font-size: 1.4rem;
    line-height: 1;
}
.auth-close:hover { color: var(--text); border-color: var(--accent); }
.auth-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    margin-bottom: 18px;
}
.auth-brand span { font-size: 1.6rem; }
.auth-brand b { color: var(--accent); }
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    margin-bottom: 20px;
}
.auth-tabs button {
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text2);
    font-weight: 600;
    font-size: 0.92rem;
    transition: all 0.2s;
}
.auth-tabs button.active {
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    box-shadow: 0 8px 20px rgba(74, 158, 255, 0.3);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label {
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text2);
}
.auth-form input:not([type="checkbox"]) {
    width: 100%;
    padding: 13px 15px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.045);
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-form input:not([type="checkbox"]):focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.16);
}
.auth-check {
    flex-direction: row !important;
    align-items: flex-start;
    gap: 10px !important;
    font-weight: 400 !important;
    font-size: 0.78rem !important;
    line-height: 1.4;
}
.auth-check input { margin-top: 3px; accent-color: var(--accent); }
.auth-submit { width: 100%; padding: 13px; font-size: 0.98rem; }
.auth-alt {
    text-align: center;
    margin-top: 16px;
    font-size: 0.84rem;
}
.auth-alt button {
    background: none;
    border: none;
    color: var(--accent);
    font-weight: 600;
}
.auth-alt button:hover { text-decoration: underline; }
.auth-hint { color: var(--text3); font-size: 0.82rem; line-height: 1.5; }
.auth-demo {
    display: inline-block;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--warning);
}
.auth-msg {
    margin-top: 14px;
    font-size: 0.85rem;
    line-height: 1.45;
    min-height: 0;
}
.auth-msg.error { color: var(--danger); }
.auth-msg.ok { color: var(--success); }

/* --- Профиль --- */
.profile-page { padding: 28px 0 40px; }
.profile-guest {
    max-width: 640px;
    margin: 30px auto;
    text-align: center;
    padding: 44px 28px;
    background: linear-gradient(160deg, rgba(74, 158, 255, 0.1), rgba(124, 92, 255, 0.06));
    border: 1px solid var(--border);
    border-radius: 26px;
}
.profile-guest-icon { font-size: 3.4rem; margin-bottom: 12px; }
.profile-guest h2 { font-size: 1.7rem; margin-bottom: 10px; }
.profile-guest > p { color: var(--text2); max-width: 460px; margin: 0 auto 24px; }
.profile-guest-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.profile-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 30px;
}
.profile-features > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text2);
}
.profile-features b { font-size: 1.4rem; }

.profile-hero {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 26px;
    border-radius: 24px;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.14), rgba(124, 92, 255, 0.1));
    border: 1px solid rgba(74, 158, 255, 0.3);
    box-shadow: var(--shadow);
}
.profile-avatar {
    width: 82px;
    height: 82px;
    flex: 0 0 82px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 2.1rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    box-shadow: 0 12px 30px rgba(74, 158, 255, 0.4);
}
.profile-id { flex: 1; min-width: 0; }
.profile-id h2 { font-size: 1.6rem; line-height: 1.2; word-break: break-word; }
.profile-id p { color: var(--text2); font-size: 0.9rem; margin: 3px 0 9px; word-break: break-all; }
.profile-badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: var(--success);
    font-size: 0.75rem;
    font-weight: 600;
}
.profile-logout { flex: 0 0 auto; }
.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 18px 0;
}
.pstat {
    padding: 18px;
    border-radius: 18px;
    background: var(--card);
    border: 1px solid var(--border);
    text-align: center;
}
.pstat b { display: block; font-size: 1.35rem; color: var(--accent); margin-bottom: 4px; }
.pstat span { color: var(--text3); font-size: 0.78rem; }
.profile-section {
    padding: 22px;
    border-radius: 22px;
    background: var(--card);
    border: 1px solid var(--border);
}
.profile-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}
.profile-section-head h3 { font-size: 1.12rem; }
.btn-sm { padding: 8px 14px !important; font-size: 0.8rem !important; }
.profile-history { display: flex; flex-direction: column; gap: 10px; }
.ph-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--border);
    transition: border-color 0.2s, transform 0.2s;
}
.ph-item:hover { border-color: rgba(74, 158, 255, 0.45); transform: translateX(3px); }
.ph-icon { font-size: 1.4rem; }
.ph-info { flex: 1; min-width: 0; }
.ph-title { font-weight: 600; font-size: 0.93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-meta { color: var(--text3); font-size: 0.76rem; margin-top: 2px; }
.history-empty-profile {
    text-align: center;
    padding: 34px 16px;
    color: var(--text2);
}
.history-empty-profile span { font-size: 2.4rem; display: block; margin-bottom: 8px; }

@media (max-width: 760px) {
    .profile-hero { flex-wrap: wrap; padding: 20px; }
    .profile-avatar { width: 64px; height: 64px; flex-basis: 64px; font-size: 1.6rem; }
    .profile-stats { grid-template-columns: 1fr; }
    .profile-features { grid-template-columns: 1fr; }
    .profile-logout { width: 100%; }
    .auth-nav-btn { padding: 9px 12px; font-size: 0.8rem; }
    .mobile-nav .mn-item { font-size: 0.6rem; }
    .ph-item { flex-wrap: wrap; }
}