/* ===== Tooltip оценки на ПК (дата + комментарий при наведении) ===== */
@media (min-width: 900px) {
    .grade-badge[data-tip]:not([data-tip=""]):hover::after {
        content: attr(data-tip);
        position: absolute;
        bottom: calc(100% + 8px);
        left: 50%;
        transform: translateX(-50%);
        background: #1c1c1e;
        color: #fff;
        font-size: 0.78rem;
        font-weight: 500;
        line-height: 1.3;
        padding: 0.5rem 0.7rem;
        border-radius: 8px;
        white-space: pre;
        max-width: 260px;
        width: max-content;
        white-space: normal;
        text-align: center;
        z-index: 200;
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
        pointer-events: none;
    }
    .grade-badge[data-tip]:not([data-tip=""]):hover::before {
        content: '';
        position: absolute;
        bottom: calc(100% + 2px);
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-top-color: #1c1c1e;
        z-index: 200;
        pointer-events: none;
    }
    /* На ПК показываем все оценки всегда */
    .subject-card .grades-extra { display: contents; }
    .subject-card .grades-expand { display: none !important; }
}

/* ===== Телефон: сворачиваем старые оценки, если есть сегодняшние ===== */
@media (max-width: 899px) {
    .subject-card.has-today .grades-extra { display: none; }
    .subject-card.has-today .grades-expand { display: flex; }
    .subject-card.has-today.expanded .grades-extra { display: contents; }
    .subject-card.has-today.expanded .grades-expand { display: none; }
}

/* ===== Инлайн-композер поста (только ПК) ===== */
.feed-composer { display: none; }

@media (min-width: 900px) {
    .feed-composer {
        display: block;
        background: #ffffff;
        border: 1px solid #eceef1;
        border-radius: 16px;
        padding: 1rem 1.1rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }
    .composer-top { display: flex; gap: 0.75rem; align-items: flex-start; }
    .composer-avatar {
        width: 40px; height: 40px;
        border-radius: 50%;
        background: var(--accent);
        color: #fff;
        display: flex; align-items: center; justify-content: center;
        font-weight: 700; font-size: 0.9rem;
        flex-shrink: 0;
    }
    .composer-input {
        flex: 1;
        border: none;
        background: transparent;
        font-family: inherit;
        font-size: 1.1rem;
        resize: none;
        outline: none;
        padding: 0.6rem 0;
        color: var(--text);
        min-height: 44px;
        line-height: 1.4;
    }
    .composer-actions {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-top: 0.7rem;
        padding-top: 0.7rem;
        border-top: 1px solid #f0f1f3;
    }
    .composer-tools { display: flex; align-items: center; gap: 0.4rem; }
    .composer-tool {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: var(--text-2);
        border-radius: 8px;
        padding: 0.4rem;
        transition: color 0.2s, background 0.2s;
    }
    .composer-tool:hover { color: var(--accent); background: var(--accent-soft); }
    .composer-tool svg { width: 20px; height: 20px; }
    .composer-tool-ico { display: inline-flex; }

    /* Пикер смайликов (появляется по наведению) */
    .composer-emoji-wrap .emoji-pop {
        position: absolute;
        bottom: calc(100% + 6px);
        left: 50%;
        transform: translateX(-50%) translateY(6px);
        background: #ffffff;
        border: 1px solid #eceef1;
        border-radius: 12px;
        box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
        padding: 0.5rem;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0.1rem;
        width: 220px;
        z-index: 150;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
    }
    .composer-emoji-wrap:hover .emoji-pop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateX(-50%) translateY(0);
    }
    .emoji-btn {
        border: none;
        background: transparent;
        font-size: 1.3rem;
        line-height: 1;
        padding: 0.35rem;
        border-radius: 8px;
        cursor: pointer;
        transition: background 0.15s, transform 0.15s;
    }
    .emoji-btn:hover { background: #f0f1f3; transform: scale(1.15); }

    /* Переключатель "Только класс" */
    .composer-switch {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        margin-left: 0.4rem;
        font-size: 0.85rem;
        color: var(--text-2);
        cursor: pointer;
        user-select: none;
        white-space: nowrap;
    }
    .composer-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
    .switch-track {
        position: relative;
        width: 38px;
        height: 22px;
        border-radius: 999px;
        background: #d1d5db;
        transition: background 0.2s;
        flex-shrink: 0;
    }
    .switch-thumb {
        position: absolute;
        top: 2px;
        left: 2px;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
        transition: transform 0.2s;
    }
    .composer-switch input:checked + .switch-track { background: var(--accent); }
    .composer-switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }

    .composer-submit {
        width: auto;
        flex: 0 0 auto;
        padding: 0.5rem 1.4rem;
        border-radius: 999px;
        font-size: 0.9rem;
        font-weight: 600;
        box-shadow: none;
    }
    .composer-file-preview:not(:empty) { margin-top: 0.6rem; }
    .composer-img-preview {
        position: relative;
        display: inline-block;
        border-radius: 10px;
        overflow: hidden;
        border: 1px solid #eceef1;
    }
    .composer-img-preview img {
        display: block;
        max-width: 90px;
        max-height: 90px;
        object-fit: cover;
    }
    .composer-img-remove {
        position: absolute;
        top: 4px;
        right: 4px;
        width: 20px;
        height: 20px;
        border: none;
        border-radius: 50%;
        background: rgba(0, 0, 0, 0.55);
        color: #fff;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        padding: 0;
        transition: background 0.15s;
    }
    .composer-img-remove:hover { background: rgba(0, 0, 0, 0.75); }
    .composer-img-remove svg { width: 12px; height: 12px; }
    .composer-file-preview .file-preview-name {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
    }
    .composer-file-preview .file-preview-name .composer-img-remove {
        position: static;
        background: #d1d5db;
        color: #fff;
    }

    /* На ПК плавающая кнопка не нужна — есть композер */
    .feed-fab { display: none !important; }
}

/* ===== Плавающая кнопка "+" для создания поста ===== */
.feed-fab {
    position: fixed;
    right: calc(50% - 240px + 14px);
    bottom: 92px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(10, 132, 255, 0.4);
    z-index: 120;
    transition: transform 0.2s, box-shadow 0.2s;
}
.feed-fab:hover { transform: scale(1.06); box-shadow: 0 8px 26px rgba(10, 132, 255, 0.5); }
.feed-fab:active { transform: scale(0.95); }
.feed-fab svg { width: 26px; height: 26px; }
.feed-fab.hidden { display: none; }

@media (max-width: 520px) {
    .feed-fab {
        right: 20px;
        bottom: calc(90px + env(safe-area-inset-bottom, 0));
    }
}

/* ===== Минималистичный график динамики оценок ===== */
.subject-chart {
    margin: 0.1rem 0 0.7rem;
}
.subject-chart .chart-svg {
    width: 100%;
    height: 36px;
    display: block;
    overflow: visible;
}

/* ===== Иконка внутри кнопки ===== */
.btn-ico { display: inline-flex; align-items: center; vertical-align: -3px; margin-right: 0.35rem; }
.btn-ico svg { width: 16px; height: 16px; }

/* Иконки лайков/просмотров в мини-статистике постов */
.sp-likes span, .sp-post-stats span { display: inline-flex; vertical-align: -2px; }
.sp-likes svg, .sp-post-stats svg { width: 14px; height: 14px; }
.sp-likes svg { color: #ff375f; }

/* ===== Сегменты-переключатели ===== */
.seg-toggle { display: flex; background: rgba(255,255,255,0.45); -webkit-backdrop-filter: blur(16px) saturate(180%); backdrop-filter: blur(16px) saturate(180%); border: 1px solid var(--glass-border); border-radius: 999px; padding: 0.3rem; }
.seg-btn { flex: 1; padding: 0.75rem 0.5rem; border: none; background: transparent; border-radius: 999px; font-size: 0.9rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all 0.25s; }
.seg-btn.active { background: #0a84ff; color: white; box-shadow: 0 4px 14px rgba(10,132,255,0.35); }

/* ===== ЛЕНТА: карточки по размеру контента ===== */
.feed-container { scroll-snap-type: none; }
.feed-item { height: auto !important; min-height: 0 !important; }
.feed-item.half { min-height: 0 !important; justify-content: flex-start; }

.feed-avatar { width: 52px; height: 52px; font-size: 1.15rem; }
.feed-meta h3 { font-size: 1.1rem; }
.feed-content h4 { font-size: 1.7rem; font-weight: 800; }
.feed-content p { font-size: 1.2rem; }

/* Крупная оценка */
.feed-grade-big { font-size: 6.5rem; font-weight: 800; line-height: 1; margin: 0.5rem 0; }
.gv-5 { color: #30d158; } .gv-4 { color: #0a84ff; } .gv-3 { color: #ff9f0a; } .gv-2 { color: #ff453a; } .gv-1 { color: #8e2323; }
.feed-grade-big.grade-double { background: linear-gradient(90deg, #30d158 0%, #30d158 50%, #ff9f0a 50%, #ff9f0a 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

/* Персональные карточки */
.personal-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.personal-head svg { width: 28px; height: 28px; color: #0a84ff; }
.personal-head h4 { font-size: 1.35rem; font-weight: 800; }
.personal-text { font-size: 1.25rem; line-height: 1.5; }
.personal-days { font-size: 3.5rem; font-weight: 800; color: #0a84ff; }
.personal-days span { font-size: 1rem; color: var(--text-2); margin-left: 0.4rem; }
.personal-list { display: flex; flex-direction: column; gap: 0.5rem; }
.personal-row { display: flex; justify-content: space-between; padding: 0.8rem 1rem; background: rgba(255,255,255,0.55); border-radius: 12px; font-size: 1.05rem; }

/* Сердечки */
.like-btn.liked { color: #ff375f; border-color: #ff375f; }
.like-btn.liked svg { fill: #ff375f; }

/* Карандашик на оценке */
.grade-badge { position: relative; }
.edit-pencil { position: absolute; top: -4px; right: -4px; font-size: 0.7rem; background: white; color: #0a84ff; border-radius: 50%; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 4px rgba(0,0,0,0.2); }

/* Большая галочка */
.big-check { display: flex !important; align-items: center; gap: 0.7rem; margin: 1rem 0; cursor: pointer; font-size: 1rem !important; font-weight: 600; color: var(--text) !important; }
.big-check input { display: none; }
.big-check-box { width: 24px; height: 24px; border: 2px solid var(--glass-border); background: rgba(255,255,255,0.5); border-radius: 7px; position: relative; flex-shrink: 0; transition: all 0.2s; }
.big-check input:checked + .big-check-box { background: #0a84ff; border-color: #0a84ff; }
.big-check input:checked + .big-check-box::after { content: '✓'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; }

/* Просмотр оценок */
.student-grades-card { background: rgba(255,255,255,0.55); border-radius: 16px; padding: 1rem; margin-bottom: 0.7rem; }
.student-grades-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }

/* Превью файла */
.file-preview { max-width: 100%; max-height: 180px; border-radius: 12px; margin: 0.5rem 0; display: block; object-fit: cover; }
.file-preview-name { padding: 0.6rem 0.9rem; background: rgba(255,255,255,0.5); border-radius: 10px; font-size: 0.9rem; margin: 0.5rem 0; display: inline-block; }



/* Превью файла с кнопкой удаления */
.file-preview-wrap {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin: 0.5rem 0;
}

.file-preview-wrap .file-preview { margin: 0; }

/* ===== Версия и меню ===== */
.version-badge {
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-2);
    white-space: nowrap;
}

.header-menu {
    position: absolute;
    top: 100%;
    right: 12px;
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    z-index: 200;
    min-width: 200px;
}

.header-menu-item {
    display: block;
    width: 100%;
    padding: 0.9rem 1.2rem;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text);
}

.header-menu-item:hover { background: rgba(10, 132, 255, 0.1); }
.header-menu-item.danger { color: #ff453a; }

.support-tg {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.9rem 1.4rem;
    background: #229ED9;
    color: white;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 700;
    margin-top: 0.5rem;
}

.support-tg svg { width: 22px; height: 22px; }

/* ===== Редактор профиля ===== */
.edit-profile-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(10, 132, 255, 0.12);
    color: #0a84ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.edit-profile-btn svg { width: 17px; height: 17px; }

.color-swatches { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.color-swatch {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s;
}

.color-swatch.active { border-color: var(--text); transform: scale(1.15); }

/* ===== Перетаскивание уроков ===== */
.drag-handle {
    cursor: grab;
    touch-action: none;
    color: var(--text-2);
    padding: 0.3rem;
}

.drag-handle svg { width: 18px; height: 18px; }

.drag-ghost {
    position: fixed;
    z-index: 2000;
    pointer-events: none;
    opacity: 0.9;
    transform: translate(-50%, -50%);
    width: 230px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
}

.day-edit.drag-over { outline: 2px dashed #0a84ff; border-radius: 12px; }

/* ===== Единый светлый дизайн (не переключаемся в тёмную тему) ===== */
/* Приложение всегда светлое — чистый минимализм в стиле итд.com.
   Это убирает конфликт «белый текст на белом фоне» при системном dark mode. */

/* ===== Размер иконок в карточках объявлений ===== */
.birthday-countdown svg {
    width: 18px;
    height: 18px;
    vertical-align: -3px;
}

/* ===== Карандаш справа ===== */
.edit-profile-btn {
    left: auto;
    right: 12px;
}

/* ===== Аватарки ===== */
.profile-avatar { overflow: hidden; }

.avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.avatar-preview {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    margin-top: 0.5rem;
    display: block;
}

/* ===== Кружочки дней недели (ДЗ ученика) ===== */
.week-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.day-circles {
    display: flex;
    gap: 0.35rem;
    flex: 1;
    justify-content: space-between;
    overflow-x: auto;
}

.day-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 38px;
    padding: 0.45rem 0.3rem;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s;
}

.day-circle.active {
    background: #0a84ff;
    border-color: #0a84ff;
    color: white;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.35);
}

.day-circle-label { font-size: 0.62rem; font-weight: 700; }
.day-circle-num { font-size: 0.9rem; font-weight: 700; }

.week-arrow {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--text);
}

/* ===== Кнопки перемещения уроков ===== */
.lesson-btns {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-mini {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(10, 132, 255, 0.12);
    color: #0a84ff;
    font-size: 0.85rem;
    cursor: pointer;
}

/* ===== Предосмотр аватарки ===== */
.avatar-full {
    width: 100%;
    border-radius: 20px;
    display: block;
}

/* ===== Тёмная тема для новых элементов ===== */


/* ===== Аватарки в ленте ===== */
.feed-avatar {
    overflow: hidden;
    flex-shrink: 0;
}

.feed-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ===== Админ панель ===== */
.admin-chart { width: 100%; height: 90px; display: block; }
.admin-chart-box { margin-top: 0.5rem; }
.admin-chart-label { font-size: 0.85rem; color: var(--text-2); margin-top: 0.3rem; }

.config-editor {
    width: 100%;
    min-height: 320px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    white-space: pre;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.75rem;
}



/* ===== Онлайн-огонёк ===== */
.online-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    background: #30d158;
    border-radius: 50%;
    margin-left: 7px;
    box-shadow: 0 0 8px #30d158;
    vertical-align: 1px;
}

/* ===== Тултип на графиках ===== */
.admin-chart-box { position: relative; }

.chart-tip {
    position: absolute;
    top: -6px;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.78);
    color: white;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 7px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
}

/* ===== СТРАХОВКА: показ активной вкладки ===== */
.view.active {
    display: block !important;
}

/* ===== Интро-видео ===== */
.intro-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
}

.intro-title {
    position: absolute;
    top: calc(24px + env(safe-area-inset-top, 0));
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    font-size: 1.5rem;
    font-weight: 800;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.7);
    z-index: 2;
    padding: 0 1rem;
}

.intro-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ===== Статистика в админке ===== */
.stats-row { display: flex; gap: 0.6rem; margin-top: 0.7rem; }

.stat-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 14px;
    padding: 0.9rem 0.5rem;
    text-align: center;
}

.stat-num { font-size: 1.7rem; font-weight: 800; color: #0a84ff; }



/* ===== Кастомное уведомление ===== */
.app-notice {
    position: fixed;
    top: -140px;
    left: 12px;
    right: 12px;
    max-width: 480px;
    margin: 0 auto;
    z-index: 4000;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.9rem 1rem;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
    transition: top 0.35s ease;
}

.app-notice.show { top: calc(12px + env(safe-area-inset-top, 0)); }
.app-notice.closing { top: -160px; }

.app-notice-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    object-fit: cover;
}

.app-notice-body { flex: 1; min-width: 0; }
.app-notice-title { font-size: 0.75rem; font-weight: 700; color: var(--text-2); }
.app-notice-text { font-size: 0.95rem; font-weight: 600; }
.app-notice-text a { color: #0a84ff; }

.app-notice-close {
    border: none;
    background: rgba(0, 0, 0, 0.08);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.8rem;
}



/* ===== Оценка "Н" ===== */
.grade-n { background: #8e8e93 !important; cursor: default; box-shadow: none; }
.gv-n { color: #8e8e93; }

/* ===== Колокольчик ===== */
.profile-card { position: relative; }

.bell-btn {
    position: absolute;
    top: 12px;
    right: 56px;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 159, 10, 0.15);
    color: #ff9f0a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bell-btn svg { width: 17px; height: 17px; }

.bell-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #ff453a;
    color: white;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}



/* ===== Пикер оценок ===== */
.grade-picker { display: flex; gap: 0.5rem; margin: 0.5rem 0; flex-wrap: wrap; }

.grade-pick {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.15s;
}

.grade-pick.active { opacity: 1; transform: scale(1.12); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25); }

.gp-5 { background: #30d158; } .gp-4 { background: #0a84ff; } .gp-3 { background: #ff9f0a; }
.gp-2 { background: #ff453a; } .gp-n { background: #8e8e93; }

/* Переключатель сдвоенной оценки (5/3) — левый верхний угол модалки */
.double-grade-toggle {
    position: absolute;
    top: 1rem;
    left: 1rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
    z-index: 2;
}
.double-grade-toggle .double-grade-example {
    font-size: 0.78rem;
    font-weight: 800;
    background: linear-gradient(90deg, #30d158 0%, #30d158 50%, #ff9f0a 50%, #ff9f0a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.double-grade-toggle.active {
    border-color: #0a84ff;
    background: rgba(10, 132, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

.quarter-picker { display: flex; gap: 0.4rem; }

.quarter-pick {
    padding: 0.4rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

.quarter-pick.active { background: #0a84ff; color: white; border-color: #0a84ff; }

/* ===== АКВАРИУМ в профиле ===== */
.aquarium { overflow: hidden; }

.aquarium > *:not(.aqua-water) { position: relative; z-index: 1; }

.aqua-water {
    position: absolute;
    left: -25%;
    right: -25%;
    top: 45%;
    bottom: -40%;
    background: linear-gradient(180deg, rgba(10, 132, 255, 0.28), rgba(10, 132, 255, 0.5));
    border-radius: 45% 45% 0 0 / 70px;
    transform: rotate(var(--tilt, 0deg));
    transition: transform 0.25s ease, top 0.25s ease;
    animation: aquaWave 7s ease-in-out infinite;
    pointer-events: none;
}

@keyframes aquaWave {
    0%, 100% { border-radius: 45% 45% 0 0 / 70px; }
    50% { border-radius: 50% 50% 0 0 / 95px; }
}

.aqua-fish { position: absolute; animation: swim 9s linear infinite; }
.aqua-fish .fish-svg { width: 30px; display: block; }
.f1 { top: 30%; }
.f2 { top: 55%; animation-duration: 13s; animation-delay: -5s; }
.f2 .fish-svg { width: 22px; }
.f3 { top: 75%; animation-duration: 16s; animation-delay: -9s; }
.f3 .fish-svg { width: 17px; }

@keyframes swim {
    0% { left: -15%; transform: scaleX(1); }
    49% { transform: scaleX(1); }
    50% { left: 105%; transform: scaleX(-1); }
    99% { transform: scaleX(-1); }
    100% { left: -15%; transform: scaleX(1); }
}

.aqua-bubble {
    position: absolute;
    bottom: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    animation: bubble 5s linear infinite;
}

.b1 { left: 20%; } .b2 { left: 50%; animation-delay: -2s; } .b3 { left: 75%; animation-delay: -3.5s; }

@keyframes bubble {
    0% { transform: translateY(0); opacity: 0; }
    20% { opacity: 0.8; }
    100% { transform: translateY(-150px); opacity: 0; }
}

/* ===== АКВАРИУМ v2: рыбки лежат на дне ===== */
/* Плавный наклон воды (без transition — сглаживание делает JS) */
.aqua-water {
    transform: translateX(var(--shiftX, 0px)) rotate(var(--tilt, 0deg));
    transition: none;
}

/* Рыбки тоже плавно (через переменную --rock) */
.aqua-fish {
    transition: none;
    transform: rotate(var(--rock, 0deg));
}

.aqua-fish {
    animation: none;
    bottom: 5%;
    top: auto;
    transform: rotate(var(--rock, 0deg));
    transform-origin: bottom center;
    transition: transform 0.2s ease;
    animation: idleRock 3.5s ease-in-out infinite;
}

.f1 { left: 12%; }
.f1 .fish-svg { width: 30px; }
.f2 { left: 45%; animation-delay: -1.2s; }
.f2 .fish-svg { width: 24px; transform: scaleX(-1); }
.f3 { left: 74%; animation-delay: -2.1s; }
.f3 .fish-svg { width: 19px; }

@keyframes idleRock {
    0%, 100% { transform: rotate(calc(var(--rock, 0deg) - 3deg)); }
    50% { transform: rotate(calc(var(--rock, 0deg) + 3deg)); }
}

/* ===== АКВАРИУМ FINAL + КОЛОКОЛЬЧИК FIX ===== */
.profile-card { position: relative; }

.bell-btn {
    position: absolute !important;
    top: 12px !important;
    right: 56px !important;
    left: auto !important;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 159, 10, 0.15);
    color: #ff9f0a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.bell-btn svg { width: 17px; height: 17px; }

.bell-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #ff453a;
    color: white;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Рыбки лежат на дне видимой части карточки */
.aqua-fish {
    position: absolute;
    top: auto !important;
    animation: idleRock 3.5s ease-in-out infinite !important;
    transform-origin: bottom center;
}

.f1 { left: 12% !important; bottom: 44% !important; }
.f2 { left: 45% !important; bottom: 42% !important; }
.f3 { left: 74% !important; bottom: 45% !important; }

.aqua-fish .fish-svg { display: block; }
.f1 .fish-svg { width: 30px; }
.f2 .fish-svg { width: 24px; transform: scaleX(-1); }
.f3 .fish-svg { width: 19px; }

@keyframes idleRock {
    0%, 100% { transform: rotate(calc(var(--rock, 0deg) - 3deg)); }
    50% { transform: rotate(calc(var(--rock, 0deg) + 3deg)); }
}

/* Брызги при касании воды */
.aqua-splash {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.85);
    pointer-events: none;
    z-index: 2;
    animation: splashUp 0.7s ease-out forwards;
}

@keyframes splashUp {
    0% { transform: translate(0, 0) scale(1); opacity: 0.9; }
    100% { transform: translate(var(--dx, 0px), -36px) scale(0.35); opacity: 0; }
}

/* ===== АКВАРИУМ FINAL v3 ===== */

/* Карандаш рядом с колокольчиком (справа) */
.edit-profile-btn {
    position: absolute !important;
    top: 12px !important;
    right: 56px !important;
    left: auto !important;
    z-index: 3;
}

.bell-btn {
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    left: auto !important;
    z-index: 3;
}

/* Брызги НЕ в потоке документа (убирает дёргание) */
.aquarium > *:not(.aqua-water):not(.aqua-splash) {
    position: relative;
    z-index: 1;
}

.aqua-splash {
    position: absolute !important;
    pointer-events: none;
    z-index: 2;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    animation: splashUp 0.7s ease-out forwards;
}

/* Рыбки: нормальный размер, лежат на дне, не плавают */
.aqua-fish {
    position: absolute !important;
    top: auto !important;
    animation: idleRock 3.5s ease-in-out infinite !important;
    transform-origin: bottom center;
}

.f1 { left: 10% !important; bottom: 44% !important; }
.f2 { left: 44% !important; bottom: 42% !important; }
.f3 { left: 72% !important; bottom: 45% !important; }

.f1 .fish-svg { width: 46px !important; }
.f2 .fish-svg { width: 36px !important; transform: scaleX(-1); }
.f3 .fish-svg { width: 28px !important; }

.fish-svg {
    display: block;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25));
}

@keyframes idleRock {
    0%, 100% { transform: rotate(calc(var(--rock, 0deg) - 3deg)); }
    50% { transform: rotate(calc(var(--rock, 0deg) + 3deg)); }
}

@keyframes splashUp {
    0% { transform: translate(0, 0) scale(1); opacity: 0.9; }
    100% { transform: translate(var(--dx, 0px), -36px) scale(0.35); opacity: 0; }
}



/* ===== АКВАРИУМ v4: плавный, инвертированный, без дёрганий ===== */
.aquarium { overflow: hidden; pointer-events: auto; }

.aqua-water {
    pointer-events: none;
    transition: none;
    z-index: 0;
}

.aqua-fishes {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 10px;
    height: 80px;
    z-index: 1;
    pointer-events: none;
    transform: rotate(var(--fish-tilt, 0deg));
    transform-origin: bottom center;
    transition: none;
}

.aqua-fish {
    position: absolute;
    bottom: 0;
    transform-origin: bottom center;
    animation: fishIdle 3.5s ease-in-out infinite;
    transition: none;
}

@keyframes fishIdle {
    0%, 100% { transform: rotate(-4deg); }
    50% { transform: rotate(4deg); }
}

.f1 { left: 10%; animation-delay: 0s; }
.f2 { left: 44%; animation-delay: -1.2s; }
.f3 { left: 72%; animation-delay: -2.1s; }

.f1 .fish-svg { width: 46px; }
.f2 .fish-svg { width: 36px; transform: scaleX(-1); }
.f3 .fish-svg { width: 28px; }

/* Кнопки карандаша и колокольчика всегда кликабельны */
.edit-profile-btn,
.bell-btn {
    pointer-events: auto !important;
    z-index: 5 !important;
}

/* Убираем индикатор угла (на всякий случай) */
.aqua-debug { display: none !important; }


/* ===== Мини/полный профиль ===== */
/* ===== Мини/полный профиль ===== */
.sp-head { 
    display: flex; 
    align-items: center; 
    gap: 1rem; 
    margin-bottom: 1rem;
    flex-wrap: nowrap;
}
.sp-head h2 { 
    font-size: 1.3rem; 
    display: flex; 
    align-items: center; 
    gap: 0.5rem;
    flex-wrap: wrap;
    line-height: 1.3;
}

.sp-avatar {
    width: 64px; 
    height: 64px; 
    border-radius: 50%;
    background: #0a84ff; 
    color: white;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-weight: 800; 
    font-size: 1.3rem;
    overflow: hidden; 
    cursor: pointer; 
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.3);
}
.sp-avatar.big { 
    width: 96px; 
    height: 96px; 
    font-size: 1.8rem; 
}
.sp-avatar img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

.sp-pins { 
    display: flex; 
    gap: 0.6rem; 
    flex-wrap: wrap; 
    margin-bottom: 1rem; 
    min-height: 10px;
}
.sp-empty { 
    display: block; 
    height: 10px; 
}

.sp-pin {
    width: 34px; 
    height: 34px; 
    border-radius: 50%;
    display: flex; 
    align-items: center; 
    justify-content: center;
    padding: 3px; 
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}
.sp-pin:hover {
    transform: scale(1.12);
}
.sp-pin img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    border-radius: 50%; 
}

.sp-likes { 
    font-size: 1rem; 
    font-weight: 600; 
    margin-bottom: 0.7rem; 
}
.sp-class { 
    font-size: 1.05rem; 
    font-weight: 700; 
    margin-bottom: 1.2rem;
    padding: 0.7rem 1rem;
    background: rgba(10, 132, 255, 0.08);
    border-radius: 10px;
    display: inline-block;
}

.verified-badge { 
    width: 22px; 
    height: 22px; 
    vertical-align: middle;
    flex-shrink: 0;
}
.verified-mini {
    width: 28px; 
    height: 28px; 
    border-radius: 50%;
    background: #0a84ff; 
    color: white;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-weight: 800; 
    flex-shrink: 0;
}
.pin-mini { 
    width: 32px; 
    height: 32px; 
    border-radius: 50%; 
    object-fit: cover; 
    flex-shrink: 0; 
}

/* Полный профиль - на ПК центрируется, на мобильных во весь экран */
.full-profile {
    position: fixed; 
    inset: 0; 
    z-index: 2500;
    background: var(--glass-bg, #eef1f6);
    overflow-y: auto;
    animation: fadeIn 0.25s ease;
    display: flex;
    flex-direction: column;
}

.fp-header {
    position: sticky; 
    top: 0; 
    z-index: 2;
    display: flex; 
    align-items: center; 
    gap: 1rem;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.85);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    backdrop-filter: blur(20px) saturate(180%);
    font-weight: 700;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    max-width: 100%;
    margin: 0 auto;
}

.fp-back {
    width: 40px; 
    height: 40px; 
    border: none; 
    border-radius: 50%;
    background: rgba(10, 132, 255, 0.12); 
    color: #0a84ff;
    font-size: 1.2rem; 
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}
.fp-back:hover {
    background: rgba(10, 132, 255, 0.2);
}

.fp-body { 
    padding: 1.5rem;
    max-width: 700px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Лайтбокс для фото */
.lightbox {
    position: fixed; 
    inset: 0; 
    z-index: 3000;
    background: rgba(0, 0, 0, 0.94);
    display: flex; 
    align-items: center; 
    justify-content: center;
    padding: 2rem; 
    cursor: zoom-out;
    animation: fadeIn 0.2s ease;
}
.lightbox img { 
    max-width: 100%; 
    max-height: 100%; 
    border-radius: 14px;
    box-shadow: 0 16px 60px rgba(0, 0, 0, 0.5);
}

/* Просмотры */
.views-btn { 
    cursor: default; 
    opacity: 0.75; 
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.views-btn svg {
    width: 16px;
    height: 16px;
}

/* Модалка описания пина */
.pin-info {
    text-align: center;
    padding: 1rem;
}
.pin-info img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.pin-info h3 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}
.pin-info p {
    color: var(--text-2);
    font-size: 0.95rem;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}



@media (max-width: 768px) {
    .fp-body {
        padding: 1rem;
    }
    .sp-avatar {
        width: 56px;
        height: 56px;
        font-size: 1.1rem;
    }
    .sp-avatar.big {
        width: 80px;
        height: 80px;
        font-size: 1.5rem;
    }
}

/* Лайтбокс для фото */
.lightbox {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,0.92);
    display: flex; align-items: center; justify-content: center;
    padding: 1rem; cursor: zoom-out;
}
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 12px; }

/* Просмотры */
.views-btn { cursor: default; opacity: 0.8; }





/* ===== Тост для пинов ===== */
.pin-toast {
    position: fixed;
    top: -90px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    background: rgba(28, 28, 30, 0.94);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
    transition: top 0.35s ease;
    max-width: 90vw;
    text-align: center;
    pointer-events: none;
}

.pin-toast.show {
    top: calc(16px + env(safe-area-inset-top, 0px));
}

.verified-wrap {
    display: inline-flex;
    cursor: pointer;
    vertical-align: middle;
}

/* ===== QR вход ===== */
.qr-box { margin-top: 1rem; padding: 1rem; text-align: center; }
.qr-box img, .qr-box canvas { margin: 0 auto; display: block; }

@media (min-width: 900px) {
    .qr-box {
        position: fixed;
        right: 8%;
        top: 50%;
        transform: translateY(-50%);
        background: rgba(255, 255, 255, 0.8);
        -webkit-backdrop-filter: blur(20px);
        backdrop-filter: blur(20px);
        border-radius: 20px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
        z-index: 5;
        padding: 1.2rem;
    }
}

/* ===== Сканер ===== */
.scanner-overlay { position: fixed; inset: 0; z-index: 5000; background: #000; }
.scanner-overlay video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
    position: absolute; inset: 22%;
    border: 3px solid #0a84ff;
    border-radius: 16px;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
}

/* ===== QR в стиле ликвид гласс ===== */
.qr-box {
    margin-top: 1rem;
    padding: 1.2rem;
    text-align: center;
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    position: relative;
    overflow: hidden;
}

.qr-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 40%);
    pointer-events: none;
}

.qr-box > * { position: relative; }

#qrCode {
    display: inline-block;
    padding: 10px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.10);
}

@media (min-width: 900px) {
    .qr-box {
        position: fixed;
        right: 8%;
        top: 50%;
        transform: translateY(-50%);
        z-index: 5;
    }
}



.grade-n { 
    background: #8e8e93 !important; 
    color: white;
    cursor: default; 
    box-shadow: none; 
}
.gv-n { 
    color: #8e8e93; 
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.8rem;
}
.stat-card h3 {
    font-size: 0.85rem;
    color: var(--text-2, #6b7280);
    margin-bottom: 0.4rem;
    font-weight: 600;
}
.stat-big {
    font-size: 2rem;
    font-weight: 800;
    color: #0a84ff;
}

/* ===== Старый дизайн админки ===== */
.ov-title { font-size: 1rem; font-weight: 700; margin-bottom: 0.8rem; }
.ov-reg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.7rem; }
.ov-reg-item { background: rgba(10, 132, 255, 0.07); border-radius: 14px; padding: 0.9rem 0.5rem; text-align: center; }
.ov-reg-num { font-size: 1.6rem; font-weight: 800; color: #0a84ff; }
.ov-reg-label { font-size: 0.8rem; color: var(--text-2, #6b7280); margin-top: 0.2rem; }
.ov-label { font-size: 0.85rem; color: var(--text-2, #6b7280); margin-top: 0.5rem; }
.ov-time-row { display: flex; justify-content: space-between; padding: 0.65rem 0.2rem; border-bottom: 1px solid rgba(120, 120, 128, 0.12); font-size: 0.95rem; }
.ov-time-row:last-child { border-bottom: none; }
.ov-time-row span { color: var(--text-2, #6b7280); }
.ov-grade-top { background: rgba(10, 132, 255, 0.07); border-radius: 14px; padding: 1rem; text-align: center; margin-bottom: 0.8rem; }
.ov-grade-big { font-size: 2.2rem; font-weight: 800; color: #0a84ff; }
.ov-grade-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.6rem; }
.ov-grade-item { background: rgba(10, 132, 255, 0.07); border-radius: 12px; padding: 0.7rem 0.3rem; text-align: center; }
.ov-grade-num { font-size: 1.2rem; font-weight: 800; color: #0a84ff; }

/* ===== Нормальные крестики удаления ===== */
.btn-danger-small {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    border: none;
    background: rgba(255, 55, 93, 0.12);
    color: #ff375f;
    border-radius: 10px;
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    width: auto !important;
    height: auto !important;
}

/* ===== Пины рядом с именем ===== */
.pins-inline {
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
    margin-left: 0.4rem;
    vertical-align: middle;
}
.pins-inline .verified-badge { width: 18px; height: 18px; }
.pins-inline .pin-mini { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }

/* ===== ПК-ВЕРСИЯ v3 (градиент везде, без пустот) ===== */
.pc-only { display: none; }
.pc-version { display: none; }

@media (min-width: 900px) {
    .pc-only { display: flex; }

    /* Версия справа снизу */
    .pc-version {
        display: block;
        position: fixed;
        right: 20px;
        bottom: 14px;
        font-size: 0.78rem;
        color: #7d8694;
        z-index: 50;
    }

    /* Верхняя шапка не нужна */
    header, .app-header, .header, .admin-header, .top-bar { display: none !important; }

    /* Градиент НЕ трогаем — он остаётся на всём экране */
    body { padding-left: 250px !important; padding-bottom: 0 !important; }

    /* Сайдбар ПРОЗРАЧНЫЙ — градиент виден под меню */
    #bottomNav, #teacherBottomNav, #adminBottomNav {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        right: auto !important;
        transform: none !important;
        width: 250px !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        gap: 2px !important;
        padding: 22px 12px !important;
        margin: 0 !important;
        border-radius: 0 !important;
        background: transparent !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        border: none !important;
        box-shadow: none !important;
        z-index: 400 !important;
        overflow-y: auto;
    }

    .pc-brand { align-items: baseline; gap: 8px; padding: 2px 14px 18px; }
    .pc-brand b { font-size: 1.25rem; font-weight: 800; color: #14181f; }
    .pc-brand span { font-size: 0.8rem; color: #7d8694; }

    /* Пункты меню */
    #bottomNav > *:not(.pc-only),
    #teacherBottomNav > *:not(.pc-only),
    #adminBottomNav > *:not(.pc-only) {
        flex-direction: row !important;
        justify-content: flex-start !important;
        align-items: center !important;
        gap: 14px !important;
        width: 100% !important;
        padding: 10px 14px !important;
        margin: 0 !important;
        border-radius: 12px !important;
        font-size: 0.92rem !important;
        font-weight: 500 !important;
        color: #4a5565 !important;
        background: transparent !important;
        box-shadow: none !important;
    }
    #bottomNav > *:not(.pc-only) svg, #bottomNav > *:not(.pc-only) img,
    #teacherBottomNav > *:not(.pc-only) svg, #teacherBottomNav > *:not(.pc-only) img,
    #adminBottomNav > *:not(.pc-only) svg, #adminBottomNav > *:not(.pc-only) img {
        width: 20px !important;
        height: 20px !important;
    }
    #bottomNav > *:not(.pc-only):hover,
    #teacherBottomNav > *:not(.pc-only):hover,
    #adminBottomNav > *:not(.pc-only):hover {
        background: rgba(255, 255, 255, 0.45) !important;
    }
    #bottomNav > .active, #teacherBottomNav > .active, #adminBottomNav > .active {
        background: #ffffff !important;
        color: #0a84ff !important;
        font-weight: 700 !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10) !important;
    }

    .pc-logout {
        margin-top: auto !important;
        flex-direction: row !important;
        align-items: center;
        gap: 14px !important;
        width: 100%;
        padding: 10px 14px !important;
        border: none;
        border-radius: 12px;
        background: transparent;
        color: #4a5565 !important;
        font-size: 0.92rem;
        font-weight: 500;
        cursor: pointer;
    }
    .pc-logout:hover { background: rgba(255, 55, 93, 0.10); color: #ff375f !important; }

    /* Карточки белые, чистые */
    .glass, .feed-item, .subject-card, .homework-card, .profile-card,
    .student-grades-card, .setup-card {
        background: #ffffff !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        border: 1px solid #e6ebf1 !important;
        box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05) !important;
        border-radius: 16px !important;
    }
    .glass:empty { display: none !important; }

    /* УБИРАЕМ ПУСТОТУ внутри карточек и сверху/снизу */
    .feed-item, .feed-item.half {
        min-height: 0 !important;
        height: auto !important;
        padding: 18px 20px !important;
        margin: 0 0 0.9rem !important;
        max-width: none !important;
    }
    .personal-head { margin-bottom: 0.4rem; }
    .personal-days { margin: 0.3rem 0 0; }

    #mainScreen {
        max-width: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 16px 24px 40px !important;
    }
    #feedContainer, #journalContainer, #homeworkContainer, #profileContainer,
    #teacherGradesContainer, #teacherHomeworkContainer, #teacherScheduleContainer,
    #teacherPlusContainer, #adminOverviewContainer, #adminStudentsContainer,
    #adminTeachersContainer, #adminPostsContainer, #adminEventsContainer,
    #adminStatsContainer, #adminConfigContainer {
        max-width: 700px !important;
        width: 100% !important;
        margin: 0 auto !important;
        padding-bottom: 0 !important;
    }
}

/* ===== ФИНАЛЬНАЯ ЗАЧИСТКА ПУСТОТ (только ПК) ===== */
@media (min-width: 900px) {
    html, body {
        height: auto !important;
        min-height: 0 !important;
    }

    #mainScreen {
        min-height: 0 !important;
        height: auto !important;
        padding-bottom: 12px !important;
        margin-bottom: 0 !important;
        overflow: visible !important;
    }

    /* Контейнеры и карточки — обычным потоком, без grid/flex-растягивания */
    #feedContainer, #journalContainer, #homeworkContainer, #profileContainer,
    #teacherGradesContainer, #teacherHomeworkContainer, #teacherScheduleContainer,
    #teacherPlusContainer, #adminOverviewContainer, #adminStudentsContainer,
    #adminTeachersContainer, #adminPostsContainer, #adminEventsContainer,
    #adminStatsContainer, #adminConfigContainer {
        display: block !important;
        min-height: 0 !important;
        height: auto !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }

    /* Карточки ленты — высота строго по содержимому (убирает дыры внутри) */
    .feed-item, .feed-item.half {
        display: block !important;
        min-height: 0 !important;
        height: auto !important;
    }
    .feed-content { min-height: 0 !important; flex: none !important; }
    .personal-head, .personal-text, .personal-days, .personal-list { min-height: 0 !important; }

    /* Пустые невидимые блоки-распорки в конце — скрыть */
    #mainScreen > *:empty,
    #feedContainer > *:empty,
    #journalContainer > *:empty,
    #homeworkContainer > *:empty,
    #profileContainer > *:empty {
        display: none !important;
    }
}

/* ===== ЦЕНТРИРОВАНИЕ ОТ ЭКРАНА (ПК) ===== */
@media (min-width: 900px) {
    body { padding-left: 0 !important; }

    /* Одинаковые отступы слева и справа → центр = центр экрана.
       260px слева защищают контент от наезда на сайдбар (250px). */
    #mainScreen {
        padding: 16px 260px 12px !important;
    }

    /* На не очень широких экранах чуть ужимаем бока, чтобы колонка не стала слишком узкой */
    @media (max-width: 1250px) {
        #mainScreen { padding: 16px 255px 12px !important; }
    }
}

/* ===== Глазик пароля (профессиональный) ===== */
.pass-wrap {
    position: relative;
    display: block;
    width: 100%;
}
.pass-wrap input {
    padding-right: 48px !important;
}
.pass-eye {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
    color: #8a8f98;
    border-radius: 8px;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
    -webkit-tap-highlight-color: transparent;
}
.pass-eye:hover {
    color: #0a84ff;
    background: rgba(10, 132, 255, 0.08);
}
.pass-eye:active {
    transform: translateY(-50%) scale(0.94);
}
.pass-eye.active {
    color: #0a84ff;
}
.pass-eye svg {
    display: block;
    pointer-events: none;
}

/* ===== OAuth кнопки ===== */
.btn-oauth {
    display: flex; align-items: center; gap: 0.7rem;
    width: 100%; margin-top: 0.6rem;
    padding: 0.75rem 1rem;
    border: 1px solid #e6ebf1; border-radius: 14px;
    background: #fff; font-size: 0.95rem; font-weight: 600;
    cursor: pointer; color: #14181f;
}
.btn-oauth .oauth-logo {
    width: 26px; height: 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 800; font-size: 0.85rem;
}
.oauth-google .oauth-logo { background: #4285f4; }
.oauth-yandex .oauth-logo { background: #fc3f1d; }
.oauth-steam .oauth-logo { background: #1b2838; }
.oauth-state { margin-left: auto; font-size: 0.8rem; color: #8a8f98; font-weight: 500; }
.oauth-login-row { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.oauth-login-row .btn-oauth { margin-top: 0; padding: 0.6rem 0.8rem; font-size: 0.85rem; }
.oauth-login-row .oauth-state { display: none; }

/* ===== Волна букв заголовка ===== */
.title-ch { display: inline-block; }
.title-ch.bounce { animation: chWave 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes chWave {
    0%   { transform: translateY(0); }
    35%  { transform: translateY(-7px) scale(1.18); }
    70%  { transform: translateY(2px) scale(0.97); }
    100% { transform: translateY(0); }
}
.title-ch.out { animation: chOut 0.13s ease forwards; }
@keyframes chOut { to { transform: translateY(-10px); opacity: 0; } }

/* ===== Квадратные ✓ / ✕ справа от окон (только ПК) ===== */
.pc-modal-actions { display: none; }
@media (min-width: 900px) {
    .pc-modal-actions.active {
        display: flex;
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        right: calc(50% - 330px);
        flex-direction: column;
        gap: 10px;
        z-index: 1200;
    }
    .pc-modal-actions button {
        width: 46px;
        height: 46px;
        border-radius: 10px;
        border: 1px solid #e6ebf1;
        background: #fff;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 2px 10px rgba(16, 24, 40, 0.10);
        transition: transform 0.12s ease;
    }
    .pc-modal-actions button:hover { transform: scale(1.07); }
    .pc-ma-ok { color: #0a84ff; }
    .pc-ma-cancel { color: #ff375f; }
    .pc-modal-actions svg { width: 20px; height: 20px; }
}

/* ===== Финальная доводка сайдбара и заголовков ===== */
.title-ch { color: inherit; }
header h1, .header h1, .app-header h1, .header-title { color: #000 !important; }

@media (min-width: 900px) {
    /* Меню прижато к верху, компактное, одинаковое во всех ролях */
    #bottomNav, #teacherBottomNav, #adminBottomNav {
        gap: 4px !important;
        padding: 18px 12px !important;
        justify-content: flex-start !important;
    }
    #bottomNav > *:not(.pc-only),
    #teacherBottomNav > *:not(.pc-only),
    #adminBottomNav > *:not(.pc-only) {
        min-height: 0 !important;
        height: auto !important;
        padding: 11px 16px !important;
        margin: 0 !important;
        font-size: 1rem !important;
        font-weight: 700 !important;
        color: #3c4552 !important;
    }
    .pc-brand { padding: 2px 16px 14px !important; }

    /* Прыгающий заголовок — чёрный */
    .pc-title, .pc-title .title-ch { color: #000 !important; }
}

/* ===== ФИКС размера кнопок сайдбара (ПК) ===== */
@media (min-width: 900px) {
    #bottomNav, #teacherBottomNav, #adminBottomNav {
        gap: 6px !important;
        padding: 18px 12px !important;
        justify-content: flex-start !important;
        align-content: flex-start !important;
    }
    /* Убираем мобильное растягивание flex:1 — кнопки сжимаются до контента
       и прижимаются к верху, как в админке */
    #bottomNav > *:not(.pc-only),
    #teacherBottomNav > *:not(.pc-only),
    #adminBottomNav > *:not(.pc-only) {
        flex: 0 0 auto !important;
        height: auto !important;
        min-height: 0 !important;
        width: 100% !important;
        padding: 12px 16px !important;
        margin: 0 !important;
        font-size: 1.05rem !important;
        font-weight: 700 !important;
        color: #3c4552 !important;
    }
}

/* ===== Таблица оценок (только ПК) ===== */
.grades-table-layout { display: none; }

@media (min-width: 900px) {
    .grades-table-layout {
        display: flex;
        flex-direction: column;
        gap: 1rem;
        margin-top: 1rem;
        width: 100%;
    }

    .grades-table-side {
        display: flex;
        gap: 1rem;
        align-items: flex-end;
    }

    .grades-table-side .form-group { flex: 1; margin: 0; max-width: 320px; }

    .grades-table-wrap {
        background: #fff;
        border: 1px solid #e3e6ea;
        border-radius: 16px;
        overflow: auto;
        max-height: 78vh;
        width: 100%;
    }

    .grades-table {
        width: 100%;
        table-layout: fixed;
        border-collapse: collapse;
        font-size: 1.1rem;
    }

    .grades-table th, .grades-table td {
        border-bottom: 1px solid #edeff2;
        border-right: 1px solid #edeff2;
        padding: 1.1rem 0.8rem;
        text-align: center;
        white-space: nowrap;
    }

    .grades-table th {
        background: #f6f7f9;
        font-weight: 700;
        font-size: 1.05rem;
        color: #5a6472;
        position: sticky;
        top: 0;
        z-index: 1;
    }

    .grades-table-name-col {
        text-align: left !important;
        position: sticky;
        left: 0;
        background: #fff;
        font-weight: 600;
        width: 260px;
        z-index: 1;
    }

    .grades-table th.grades-table-name-col { background: #f6f7f9; z-index: 2; }

    /* Только просмотр — без курсора-указателя и hover-эффекта */
    .grades-table-cell {
        font-weight: 800;
        font-size: 1.25rem;
        color: #1c1c1e;
        height: 64px;
    }

    .grades-table-cell.empty { color: #c7cbd1; }

    .grades-table-weeknav {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1rem;
        padding: 0.9rem 0;
        position: sticky;
        left: 0;
    }

    .grades-table-weekbtn {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: 1px solid #e3e6ea;
        background: #f6f7f9;
        font-size: 1.2rem;
        font-weight: 700;
        color: #5a6472;
        cursor: pointer;
        transition: background 0.15s;
    }

    .grades-table-weekbtn:hover { background: #e9ecef; }

    .grades-table-weeklabel {
        font-size: 1rem;
        font-weight: 700;
        color: #3c4552;
        min-width: 220px;
        text-align: center;
    }
}

/* Эта вкладка только для ПК — на телефоне скрыта полностью */
@media (max-width: 899px) {
    .grades-table-layout, .grades-table-wrap, .grades-table-side { display: none !important; }
}

/* ========== FULLSCREEN IMAGE VIEWER ========== */
.image-fullscreen {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.image-fullscreen-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}

.image-fullscreen img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.15s ease-out;
    user-select: none;
    -webkit-user-drag: none;
}

.image-fullscreen-close,
.image-fullscreen-save {
    position: absolute;
    top: 1.25rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.image-fullscreen-close { left: 1.25rem; }
.image-fullscreen-save { right: 1.25rem; }

.image-fullscreen-close svg,
.image-fullscreen-save svg {
    width: 20px;
    height: 20px;
}

.image-fullscreen-close:hover,
.image-fullscreen-save:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.image-fullscreen-controls {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    padding: 0.4rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.image-fullscreen-controls button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.image-fullscreen-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
}

.image-fullscreen-controls svg {
    width: 20px;
    height: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ========== HALLOWEEN EVENT BUTTON ========== */
.version-badge { display: none !important; }

.halloween-btn {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border: 2px solid #000;
    border-radius: 8px;
    background: #ff8a1f;
    color: #000;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.halloween-btn:hover  { background: #ff9c42; }
.halloween-btn:active { transform: scale(0.97); }

/* Белый блик, который иногда пробегает по «Ивент» и «Сад» */
.halloween-btn::after,
.garden-btn::after {
    content: '';
    position: absolute;
    top: -10%;
    bottom: -10%;
    left: -70%;
    width: 45%;
    background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.85) 50%, transparent 100%);
    transform: skewX(-20deg);
    pointer-events: none;
    z-index: -1;
    animation: btn-shine 5s ease-in-out infinite;
}
.garden-btn::after { animation-delay: 2.5s; }
@keyframes btn-shine {
    0%        { left: -70%; }
    22%, 100% { left: 130%; }
}
@media (prefers-reduced-motion: reduce) {
    .halloween-btn::after, .garden-btn::after { animation: none; display: none; }
}

/* Кнопка в сайдбаре ПК — на всю ширину */
.pc-event.halloween-btn {
    display: none;
    width: 100%;
    margin: 12px 0 6px !important;
    padding: 12px 16px !important;
    font-size: 1rem !important;
}
@media (min-width: 900px) {
    .header-actions .halloween-btn { display: none; }
    .pc-event.halloween-btn { display: inline-flex; }
}

/* ========== HALLOWEEN EVENT VIEW ========== */
.checker {
    background-color: #fff;
    background-image:
        linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%),
        linear-gradient(45deg, #e6e6e6 25%, transparent 25%, transparent 75%, #e6e6e6 75%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
}

.event-view {
    position: relative;
    min-height: 100vh;
    padding: 16px 16px 32px !important;
    background-color: #2f5041;
    color: #111;
    isolation: isolate;
}
/* Картинка-фон закреплена на экране, контент прокручивается поверх */
.event-view::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('/img/halloween/background.svg') center / cover no-repeat;
    z-index: -1;
    pointer-events: none;
}
.garden-view { background-color: #2a4430; }
.garden-view::before { background-image: url('/img/halloween/garden.svg'); }

.event-back {
    position: absolute;
    top: 16px; left: 16px;
    width: 42px; height: 42px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #111;
    color: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: transform 0.15s;
}
.event-back:active { transform: scale(0.92); }
.event-back svg { width: 22px; height: 22px; }

.event-title {
    margin: 4px 0 20px;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 800;
    color: #f3f0e6;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
}

.event-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.event-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    color: #111;
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s;
    animation: event-card-in 0.35s ease-out both;
    -webkit-tap-highlight-color: transparent;
}
.event-card:active { transform: translateY(2px) scale(0.98); }

/* Листок-карточка с предметом поверх */
.paper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    aspect-ratio: 4 / 3;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}
.paper.checker { background-size: 20px 20px; background-repeat: repeat; border-radius: 6px; }
.paper img {
    width: 44%;
    height: auto;
    margin-top: 5%;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.event-card-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 10px;
}
.event-card-title {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.price-tag {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px 8px;
    background: #111;
    color: #fff;
    border-radius: 999px;
    font-size: 0.8rem;
    white-space: nowrap;
}
.price-tag b { font-weight: 800; }

.event-grid-hint { grid-column: 1 / -1; text-align: center; padding: 20px 0; color: #f3f0e6 !important; }

@keyframes event-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (min-width: 900px) {
    .event-view { padding: 24px 32px 40px !important; }
    .event-back { top: 24px; left: 32px; }
    .event-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px; }
    .event-card:hover { transform: translateY(-3px); }
    .event-card-title { font-size: 0.92rem; }
    /* фон не заходит под боковое меню */
    .event-view::before { left: 250px; }
}

/* Кнопка «Ивент» — только у учеников и учителей */
body:not(.is-student):not(.is-teacher) .halloween-btn { display: none !important; }

/* ===== Конфеты ===== */
.candy-img { width: 1.25em; height: 1.25em; object-fit: contain; vertical-align: middle; }

.event-top-right {
    position: absolute;
    top: 16px; right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 20;
}
/* На телефоне кнопки сверху занимают всю строку — заголовок уходит под них */
#eventView .event-title,
#eventInventoryView .event-title {
    margin-top: 52px;
}

.backpack-btn {
    width: 42px; height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #fff;
    border: 2px solid #111;
    border-radius: 50%;
    color: #111;
    cursor: pointer;
    transition: transform 0.15s;
}
.backpack-btn:active { transform: scale(0.92); }
.backpack-btn svg { width: 22px; height: 22px; }

.candy-counter {
    height: 42px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 999px;
    font-size: 1.05rem;
    font-weight: 800;
    color: #111;
}

/* ===== Окно покупки ===== */
.shop-modal { display: flex; flex-direction: column; gap: 10px; }
.shop-modal-paper { width: 200px; max-width: 70%; margin: 0 auto 2px; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.2)); }
.shop-modal-title { margin: 0; font-size: 1.3rem; text-align: center; }
.shop-modal-desc { margin: 0; line-height: 1.45; }
.shop-modal-notes {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.shop-modal-notes li {
    padding: 4px 10px;
    border: 2px solid #111;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}
.shop-modal-price {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 2px dashed #ccc;
    font-weight: 700;
}
.shop-modal-price .price-tag { font-size: 1rem; padding: 5px 12px; }
.shop-buy-btn { width: 100%; }
.shop-buy-btn:disabled { opacity: 0.5; cursor: default; }

/* ===== Рюкзак ===== */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.inventory-empty {
    grid-column: 1 / -1;
    padding: 18px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 14px;
    text-align: center;
}
.inv-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px;
    animation: event-card-in 0.3s ease-out both;
}
.inv-item-paper img { width: 46%; }
.inv-item-title {
    padding: 4px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 7px;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
}
.inv-item-count {
    position: absolute;
    top: 2px; right: 2px;
    padding: 2px 7px;
    background: #111;
    color: #fff;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 800;
}

.candy-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    margin-bottom: 16px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 16px;
}
.candy-panel-label { font-size: 0.8rem; font-weight: 700; color: #555; }
.candy-chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 38px; align-items: center; }
.candy-chip {
    min-width: 44px;
    height: 38px;
    padding: 0 12px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: #111;
    cursor: pointer;
}
.candy-chip.active { background: #111; color: #fff; }
.candy-hint { margin: 0; font-size: 0.9rem; color: #666; }
.candy-students > .candy-hint {
    padding: 14px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 14px;
    text-align: center;
}

.candy-students { display: flex; flex-direction: column; gap: 8px; }
.candy-student {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 14px;
    box-shadow: 0 3px 0 #111;
    font: inherit;
    color: #111;
    text-align: left;
    cursor: pointer;
}
.candy-student:active { transform: translateY(2px); box-shadow: 0 1px 0 #111; }
.candy-avatar {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 2px solid #111;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    background: #f2f2f2;
}
.candy-avatar img { width: 100%; height: 100%; object-fit: cover; }
.candy-name { flex: 1; min-width: 0; font-weight: 700; overflow-wrap: anywhere; }
.candy-badge {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 2px solid #111;
    border-radius: 999px;
    font-size: 0.9rem;
}

.candy-give-title { margin: 0 0 4px; }
.candy-give-name { margin: 0 0 14px; font-weight: 700; }
.candy-amounts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 14px; }
.candy-amount {
    height: 46px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 800;
    color: #111;
    cursor: pointer;
}
.candy-amount.active { background: #111; color: #fff; }
.candy-give-btn { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; }
.candy-give-btn:disabled { opacity: 0.5; cursor: default; }

@media (min-width: 900px) {
    .event-top-right { top: 24px; right: 32px; }
    #eventView .event-title,
    #eventInventoryView .event-title { margin-top: 4px; }
    .inventory-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
    #teacherEventView .candy-panel,
    #teacherEventView .candy-students { max-width: 720px; margin-left: auto; margin-right: auto; }
    #teacherEventView .candy-panel { margin-bottom: 16px; }
}

/* Моб.: скрываем весь интерфейс при открытом ивенте */
@media (max-width: 899px) {
    body.event-open .app-header,
    body.event-open #bottomNav,
    body.event-open #teacherBottomNav,
    body.event-open #adminBottomNav,
    body.event-open #feedFab {
        display: none !important;
    }
    body.event-open .content-area {
        padding: 0 !important;
        margin: 0 !important;
    }
}

/* ПК: сайдбар остаётся как есть, снимаем только ограничение ширины */
@media (min-width: 900px) {
    body.event-open .content-area {
        max-width: none !important;
        width: auto !important;
    }
    body.event-open .pc-event.halloween-btn {
        background: #e86a00;
        color: #fff;
    }
}

/* ===== Приписка к имени (ивент) ===== */
.name-tag {
    display: inline-flex;
    align-items: center;
    margin-left: 0.4rem;
    padding: 1px 8px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 6px;
    color: #111;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1.3;
    white-space: nowrap;
    vertical-align: middle;
}

/* ===== Кнопка «Использовать» и статусы в рюкзаке ===== */
.inv-use-btn {
    width: 100%;
    padding: 6px 4px;
    background: #111;
    color: #fff;
    border: 2px solid #111;
    border-radius: 8px;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}
.inv-use-btn:active { transform: scale(0.96); }
.inv-use-btn:disabled { background: #fff; color: #666; border-color: #999; cursor: default; transform: none; }
.inv-item.rejected { cursor: pointer; }
.inv-item.rejected .inv-item-paper { outline: 3px solid #e5243b; outline-offset: 2px; border-radius: 8px; }
.inv-item.rejected .inv-item-title { border-color: #e5243b; }

/* ===== Окно использования предмета ===== */
.use-modal { display: flex; flex-direction: column; gap: 10px; }
.use-modal-title { margin: 0; text-align: center; }
.use-modal-text { margin: 0; line-height: 1.45; text-align: center; }
.use-modal-rejected {
    margin: 0;
    padding: 8px 10px;
    border: 2px solid #e5243b;
    border-radius: 10px;
    color: #e5243b;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
}
.use-modal-field { position: relative; }
.use-modal-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 56px 12px 14px;
    border: 2px solid #111;
    border-radius: 12px;
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
}
.use-modal-len {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    color: #888;
    font-size: 0.8rem;
    font-weight: 700;
}
.use-modal-btn { width: 100%; }
.use-modal-btn:disabled { opacity: 0.5; cursor: default; }

/* ===== Админка: заявки ивента ===== */
.ev-admin-title { margin: 0 0 12px; }
.ev-req-list { display: flex; flex-direction: column; gap: 8px; }
.ev-req {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e6ebf1;
    border-radius: 14px;
}
.ev-req-info { flex: 1; min-width: 0; }
.ev-req-name { font-weight: 700; overflow-wrap: anywhere; }
.ev-req-class { color: #7d8694; font-size: 0.8rem; font-weight: 600; }
.ev-req-item { margin-top: 2px; font-size: 0.85rem; color: #4a5565; }
.ev-req-item .name-tag { margin-left: 2px; }
.ev-req-btn {
    flex: 0 0 auto;
    width: 38px; height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
}
.ev-req-btn svg { width: 20px; height: 20px; }
.ev-req-btn.ok { background: #30c35a; }
.ev-req-btn.no { background: #e5243b; }
.ev-req-btn:active { transform: scale(0.92); }
.ev-req-btn:disabled { opacity: 0.5; cursor: default; }

/* ===== Выбор учителя для клички ===== */
.nick-teachers {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 40vh;
    overflow-y: auto;
    padding: 2px;
}
.nick-teacher {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 12px;
    font: inherit;
    color: #111;
    text-align: left;
    cursor: pointer;
}
.nick-teacher.active { background: #111; color: #fff; }
.nick-teacher-name { font-weight: 800; }
.nick-teacher-subj { font-size: 0.8rem; opacity: 0.75; }
.nick-teacher-badge {
    margin-top: 4px;
    padding: 2px 8px;
    border: 2px solid currentColor;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}

/* ===== «Балл +»: оценка на проверке (серый круг) ===== */
.grade-badge.boost-pending {
    box-shadow: 0 0 0 3px #fff, 0 0 0 6px #a8adb5, 0 3px 10px rgba(0, 0, 0, 0.15);
}

.use-modal-note { margin: 0; color: #666; font-size: 0.85rem; text-align: center; }

.boost-ask {
    width: 100%;
    margin-top: 12px;
    padding: 12px;
    background: #111;
    color: #fff;
    border: none;
    border-radius: 12px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.boost-ask:active { transform: scale(0.98); }
.boost-box {
    margin-top: 12px;
    padding: 12px;
    border: 2px solid #111;
    border-radius: 12px;
    text-align: center;
}
.boost-box.pending { border-color: #a8adb5; color: #555; font-weight: 700; }
.boost-confirm-text { margin-bottom: 10px; line-height: 1.45; }
.boost-confirm-btns { display: flex; gap: 8px; }
.boost-yes, .boost-no {
    flex: 1;
    padding: 10px;
    border: 2px solid #111;
    border-radius: 10px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.boost-yes { background: #111; color: #fff; }
.boost-no { background: #fff; color: #111; }
.boost-yes:disabled, .boost-no:disabled { opacity: 0.5; cursor: default; }

/* ===== «Балл +»: очередь учителя справа сверху ===== */
.boost-queue {
    position: fixed;
    top: 72px;
    right: 12px;
    z-index: 450;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px 5px 5px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 999px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
    font: inherit;
    color: #111;
    cursor: pointer;
    animation: boost-pop 0.35s ease-out;
}
.boost-queue.hidden { display: none; }
.boost-queue .grade-badge { width: 34px; height: 34px; font-size: 0.95rem; box-shadow: none; }
.boost-queue .grade-badge:hover { transform: none; }
.boost-queue-arrow { font-weight: 800; }
.boost-queue-count {
    position: absolute;
    top: -6px; right: -6px;
    min-width: 20px; height: 20px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e5243b;
    color: #fff;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 800;
}
@keyframes boost-pop {
    from { opacity: 0; transform: scale(0.8); }
    to   { opacity: 1; transform: scale(1); }
}
@media (min-width: 900px) {
    .boost-queue { top: 16px; right: 20px; }
}

.boost-q-title { margin: 0 0 12px; }
.boost-q-list { display: flex; flex-direction: column; gap: 12px; }
.boost-q-item { padding: 12px; border: 2px solid #111; border-radius: 14px; }
.boost-q-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.boost-q-name { font-weight: 800; overflow-wrap: anywhere; }
.boost-q-class { color: #7d8694; font-size: 0.8rem; font-weight: 600; }
.boost-q-change { display: flex; align-items: center; gap: 6px; font-weight: 800; flex: 0 0 auto; }
.boost-q-change .grade-badge { width: 32px; height: 32px; font-size: 0.9rem; box-shadow: none; cursor: default; }
.boost-q-change .grade-badge:hover { transform: none; }
.boost-q-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 0.88rem; }
.boost-q-rows div { display: flex; justify-content: space-between; gap: 10px; }
.boost-q-rows span { color: #7d8694; flex: 0 0 auto; }
.boost-q-rows b { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.boost-q-ask { margin-bottom: 8px; font-weight: 800; text-align: center; }

/* ===== Жидкость в аквариуме: кровь ===== */
.aquarium.blood .aqua-water {
    background: linear-gradient(180deg, rgba(190, 10, 25, 0.55), rgba(110, 0, 10, 0.88));
}
.aquarium.blood .aqua-bubble { background: rgba(255, 170, 170, 0.45); }
.aquarium.blood .aqua-splash { background: rgba(200, 15, 30, 0.9) !important; }

.aqua-preview {
    position: relative;
    height: 70px;
    border: 2px solid #111;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}
.aqua-preview span {
    position: absolute;
    left: -10%; right: -10%;
    top: 40%; bottom: -20%;
    background: linear-gradient(180deg, rgba(190, 10, 25, 0.55), rgba(110, 0, 10, 0.88));
    border-radius: 45% 45% 0 0 / 30px;
    animation: aquaWave 7s ease-in-out infinite;
}

/* Пока ивент выключен — кнопки «Ивент» нет */
body:not(.event-active) .halloween-btn { display: none !important; }

/* ===== Админка: старт / конец ивента ===== */
.ev-control {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    margin-bottom: 18px;
    background: #fff;
    border: 1px solid #e6ebf1;
    border-radius: 14px;
}
.ev-control-info { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.ev-control-dot { width: 10px; height: 10px; border-radius: 50%; background: #a8adb5; flex: 0 0 auto; }
.ev-control.on .ev-control-dot { background: #30c35a; box-shadow: 0 0 0 4px rgba(48, 195, 90, 0.2); }
.ev-control-btns { display: flex; gap: 8px; }
.ev-control-btn {
    flex: 1;
    padding: 11px 10px;
    border: none;
    border-radius: 10px;
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.ev-control-btn.start { background: #30c35a; }
.ev-control-btn.end { background: #e5243b; }
.ev-control-btn:disabled { background: #e6ebf1; color: #a8adb5; cursor: default; }

/* ===== Просьба о конфетах ===== */
.candy-plus-btn {
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #111;
    color: #fff;
    border: 2px solid #111;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s;
}
.candy-plus-btn:active { transform: scale(0.9); }
.candy-plus-btn svg { width: 18px; height: 18px; }

.ask-text {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 2px solid #111;
    border-radius: 12px;
    font: inherit;
    resize: vertical;
}
.ask-file-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ask-file-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 2px solid #111;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
}
.ask-file-btn svg { width: 18px; height: 18px; }
.ask-file-name { min-width: 0; font-size: 0.85rem; color: #555; overflow-wrap: anywhere; }
.ask-file-clear { margin-left: 4px; border: none; background: none; color: #e5243b; font-weight: 800; cursor: pointer; }
.ask-pending {
    margin: 0;
    padding: 10px;
    border: 2px solid #a8adb5;
    border-radius: 12px;
    color: #555;
    font-weight: 700;
    text-align: center;
}

/* Админка: просьбы */
.ev-asks-title { margin-top: 22px; }
.ev-ask {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: #fff;
    border: 1px solid #e6ebf1;
    border-radius: 14px;
}
.ev-ask-have { color: #7d8694; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.ev-ask-text { font-size: 0.9rem; color: #333; white-space: pre-wrap; overflow-wrap: anywhere; }
.ev-ask-img { max-width: 100%; max-height: 220px; align-self: flex-start; border-radius: 10px; border: 1px solid #e6ebf1; cursor: zoom-in; }
.ev-ask-file { align-self: flex-start; font-weight: 700; color: #0a84ff; }
.ev-ask-actions { display: flex; align-items: center; gap: 8px; }
.ev-ask-amount {
    width: 72px;
    padding: 9px 8px;
    border: 1px solid #d5dbe3;
    border-radius: 10px;
    font: inherit;
    font-weight: 700;
    text-align: center;
}
.ev-ask-give {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: #30c35a;
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.ev-ask-give:disabled { opacity: 0.5; cursor: default; }

/* ===== Подсказка «?» ===== */
.candy-help-btn {
    width: 34px; height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #fff;
    color: #111;
    border: 2px solid #111;
    border-radius: 50%;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s;
}
.candy-help-btn:active { transform: scale(0.9); }

.intro-modal { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.intro-img {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 4 / 3;
    border: 2px solid #111;
    border-radius: 16px;
    overflow: hidden;
}
.intro-img img { width: 100%; height: 100%; object-fit: contain; display: block; padding: 6%; box-sizing: border-box; background: #fff8e1; }
.intro-text {
    margin: 0;
    color: #111;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    white-space: pre-line;
    overflow-wrap: anywhere;
}
.intro-ok { width: 100%; }

/* ===== Сад ===== */
body:not(.is-student) .garden-btn { display: none !important; }

.garden-btn {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #34c759;
    color: #111;
    border: 2px solid #111;
    font: inherit;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.garden-btn:hover  { background: #4cd471; }
.garden-btn:active { transform: scale(0.97); }
.garden-btn svg { width: 20px; height: 20px; }

/* В рюкзаке (телефон), слева от счётчика конфет */
.garden-btn-mini {
    height: 42px;
    padding: 0 14px;
    border-radius: 999px;
    font-size: 1rem;
}

/* В боковом меню на ПК, под «Ивент» */
.pc-garden.garden-btn {
    display: none;
    width: 100%;
    margin: 0 0 6px !important;
    padding: 12px 16px !important;
    border-radius: 8px;
    font-size: 1rem !important;
}
body.garden-open .pc-garden.garden-btn { background: #1f9e45; color: #fff; }

@media (min-width: 900px) {
    .pc-garden.garden-btn { display: inline-flex; }
    .garden-btn-mini { display: none !important; }
    /* в саду подсвечен «Сад», а не «Ивент» */
    body.garden-open .pc-event.halloween-btn { background: #ff8a1f; color: #000; }
}

.garden-area { min-height: 50vh; }

/* ===== Бесконечная лента: подгрузка и конец ===== */
.feed-sentinel {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
}
.feed-sentinel.done { display: none !important; }
.feed-spinner {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--accent-soft);
    border-top-color: var(--accent);
    opacity: 0;
    transition: opacity .15s;
}
.feed-sentinel.loading .feed-spinner {
    opacity: 1;
    animation: spin .7s linear infinite;
}
.feed-end {
    padding: 1.4rem 1rem 1.6rem;
    text-align: center;
    color: var(--text-2);
}
.feed-end-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: .6rem;
}
.feed-end-line { flex: 1; height: 1px; background: #e3e6eb; }
.feed-end-ico { display: inline-flex; color: var(--accent); }
.feed-end-ico svg { width: 18px; height: 18px; }
.feed-end-title { font-weight: 700; color: var(--text); font-size: 1rem; }
.feed-end-sub { font-size: .88rem; margin-top: .2rem; }

/* ===== Заглушка регистрации модератора ===== */
.role-stub {
    text-align: center;
    padding: 1.6rem 1rem 1.2rem;
}
.role-stub-ico {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.9rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    color: var(--accent);
}
.role-stub-ico svg { width: 26px; height: 26px; }
.role-stub h3 { font-size: 1.05rem; color: var(--text); margin: 0 0 0.4rem; }
.role-stub p { font-size: 0.9rem; color: var(--text-2); margin: 0; line-height: 1.45; }

/* ===== Карточки, приколотые к доске ===== */
.board-card {
    transform: rotate(var(--tilt, 0deg));
    transform-origin: 50% 6%;
}
.board-card:active { transform: rotate(var(--tilt, 0deg)) scale(0.97); }
.board-card .event-card-paper {
    flex-direction: column;
    gap: 2px;
    padding: 9% 10% 6%;
    box-sizing: border-box;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
}
.board-card .event-card-paper img { width: 38%; margin-top: 0; }
.board-card-title {
    max-width: 100%;
    color: #2b2620;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1.15;
    text-align: center;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.board-card .price-tag {
    position: absolute;
    top: 9%;
    right: 5%;
    padding: 2px 7px;
    font-size: 0.72rem;
    transform: rotate(6deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.board-card .price-tag .candy-img { width: 1.1em; height: 1.1em; }
@media (min-width: 900px) {
    #eventGrid { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 780px; margin: 0 auto; gap: 26px 30px; }
    .board-card:hover { transform: rotate(0deg) translateY(-3px); }
    .board-card-title { font-size: 0.9rem; }
    .board-card .price-tag { font-size: 0.85rem; padding: 3px 9px; }
}
@media (max-width: 899px) {
    #eventGrid { gap: 18px 14px; }
}

/* ===== Админка: выбор карточек доски ===== */
.ev-board { padding: 14px; margin-bottom: 18px; background: #fff; border: 1px solid #e6ebf1; border-radius: 14px; }
.ev-board-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ev-board-head .ev-admin-title { margin: 0; }
.ev-board-count { font-weight: 800; color: #7d8694; }
.ev-board-count.full { color: #30c35a; }
.ev-board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.ev-board-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    background: #f6f7f9;
    border: 2px solid transparent;
    border-radius: 12px;
    font: inherit;
    color: #111;
    cursor: pointer;
}
.ev-board-item.on { border-color: #30c35a; background: #eefaf1; }
.ev-board-item:disabled { opacity: 0.4; cursor: default; }
.ev-board-paper { filter: none; }
.ev-board-paper img { width: 40%; }
.ev-board-name { font-size: 0.7rem; font-weight: 700; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.ev-board-num {
    position: absolute;
    top: 4px; left: 4px;
    width: 20px; height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #30c35a;
    color: #fff;
    border-radius: 50%;
    font-size: 0.72rem;
    font-weight: 800;
}
.ev-board-save {
    width: 100%;
    margin-top: 10px;
    padding: 11px;
    border: none;
    border-radius: 10px;
    background: #111;
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}
.ev-board-save:disabled { background: #e6ebf1; color: #a8adb5; cursor: default; }

/* ===== Доска не прокручивается: карточки «приколоты» к фону ===== */
body:has(#eventView.active) { overflow: hidden; }
#eventView {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    padding-bottom: 12px !important;
}
#eventView::before { position: absolute; inset: 0; }
/* Ширина карточки — чтобы 3 ряда (телефон) / 2 ряда (ПК) влезали по высоте экрана */
#eventGrid {
    grid-template-columns: repeat(2, min(calc((100vw - 60px) / 2), calc((100dvh - 236px) / 2.4)));
    justify-content: center;
    align-content: start;
    gap: 14px 18px;
}
@media (min-width: 900px) {
    body:has(#eventView.active) .content-area { padding: 0 !important; }
    #eventView::before { left: 0; }
    #eventGrid {
        grid-template-columns: repeat(3, min(250px, calc((100vw - 400px) / 3), calc((100dvh - 236px) / 1.75)));
        max-width: none;
        gap: 26px 34px;
    }
}

/* ===== Клякса на имени (ивент) ===== */
.name-widgets { display: contents; }
:has(> .name-widgets > .name-blots) { position: relative; }
.name-blots {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}
.name-blots { visibility: hidden; }
.name-blots.placed { visibility: visible; }
/* центр текста имени (--cx/--cy считает social.js) + небольшой случайный сдвиг */
.name-blots img {
    position: absolute;
    left: calc(var(--cx, 50%) + var(--nw, 0px) * var(--bx-k, 0));
    top: calc(var(--cy, 50%) + 0.3em * var(--by-k, 0));
    width: 2.4em;
    height: 2.4em;
    transform: translate(-50%, -50%) rotate(var(--br, 0deg));
    opacity: 0.92;
    animation: blot-drop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes blot-drop {
    from { transform: translate(-50%, -50%) rotate(var(--br, 0deg)) scale(0.2); opacity: 0; }
    to   { transform: translate(-50%, -50%) rotate(var(--br, 0deg)) scale(1); opacity: 0.92; }
}

.blot-modal .candy-panel-label { margin-top: 2px; }
.blot-students { display: flex; flex-direction: column; gap: 6px; max-height: 34vh; overflow-y: auto; }
.blot-student {
    width: 100%;
    padding: 10px 12px;
    background: #fff;
    border: 2px solid #111;
    border-radius: 12px;
    font: inherit;
    font-weight: 700;
    color: #111;
    text-align: left;
    cursor: pointer;
}
.blot-student.active { background: #111; color: #fff; }

/* ===== Стикер на аве (ивент) ===== */
.avatar-sticker-slot { display: contents; }
:has(> .avatar-sticker-slot > .avatar-sticker) { position: relative; overflow: visible !important; }
.sp-avatar img, .candy-avatar img { border-radius: 50%; }
.avatar-sticker {
    position: absolute;
    right: -10%;
    bottom: -8%;
    z-index: 3;
    min-width: 1.5em;
    padding: 0.12em 0.35em;
    background: #ffe873;
    color: #111;
    border: 2px solid #111;
    border-radius: 6px;
    font-size: max(10px, 0.55em);
    font-weight: 800;
    line-height: 1.25;
    text-align: center;
    white-space: nowrap;
    transform: rotate(-9deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

/* Окно стикера */
.sticker-box { text-align: left; }
.sticker-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sticker-preview-ava {
    position: relative;
    flex: 0 0 auto;
    width: 48px; height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #0a84ff;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
}
.sticker-field { position: relative; flex: 1; min-width: 0; }
.sticker-field input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 48px 10px 12px;
    border: 2px solid #111;
    border-radius: 12px;
    font: inherit;
    font-size: 1.05rem;
    font-weight: 700;
}

/* ===== Панель смайликов ===== */
.emoji-picker-wrap { position: relative; flex: 0 0 auto; }
.emoji-picker-toggle {
    width: 42px; height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: #f2f3f5;
    color: #333;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}
.emoji-picker-wrap.open .emoji-picker-toggle,
.emoji-picker-toggle:hover { background: #e4e6ea; }
.emoji-picker-toggle svg { width: 24px; height: 24px; }
.emoji-picker-pop {
    display: none;
    position: fixed;
    z-index: 4000;
    box-sizing: border-box;
    padding: 10px 10px 8px;
    background: #fff;
    border: 1px solid #e3e6eb;
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
body > .emoji-picker-pop { display: block; }
.emoji-picker-body { max-height: 240px; overflow-y: auto; overflow-x: hidden; padding-right: 4px; }
.emoji-picker-cat { margin: 6px 4px 4px; font-size: 0.78rem; font-weight: 700; color: #8a919c; }
.emoji-picker-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.emoji-picker-btn {
    aspect-ratio: 1 / 1;
    padding: 0;
    background: none;
    border: none;
    border-radius: 8px;
    min-width: 0;
    min-height: 0;
    width: 100%;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}
.emoji-picker-btn:hover { background: #f0f1f3; }
.emoji-picker-empty { padding: 16px; text-align: center; color: #8a919c; font-size: 0.85rem; }
.emoji-picker-search {
    width: 100%;
    box-sizing: border-box;
    margin-top: 8px;
    padding: 9px 12px;
    background: #fffdf3;
    border: 1px solid #ece6cf;
    border-radius: 10px;
    font: inherit;
    font-size: 0.9rem;
}

/* ===== Шляпка на аве ===== */
:has(> .avatar-sticker-slot > .avatar-hat) { position: relative; overflow: visible !important; }
.avatar-hat {
    position: absolute;
    left: 50%;
    top: -42%;
    width: 78%;
    height: auto;
    transform: translateX(-50%) rotate(-8deg);
    z-index: 3;
    pointer-events: none;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.25));
}

/* ===== Крутка шляпки ===== */
.hat-roll { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hat-reel {
    position: relative;
    width: 160px;
    height: 120px;
    overflow: hidden;
    border: 2px solid #111;
    border-radius: 16px;
    background: #fff8e1;
    -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
    mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}
.hat-strip { transition: transform 3.2s cubic-bezier(0.1, 0.75, 0.15, 1); }
.hat-cell { height: 120px; display: flex; align-items: center; justify-content: center; }
.hat-cell img { width: 92px; height: 92px; transition: transform 0.3s; }
.hat-cell.won img { transform: scale(1.15); }
.hat-result { margin: 0; font-size: 1.05rem; text-align: center; }

/* ===== Жидкость в аквариуме: кровь / кислота / зелье ===== */
.aquarium.liquid-blood .aqua-water  { background: linear-gradient(180deg, rgba(190, 10, 25, 0.55), rgba(110, 0, 10, 0.88)); }
.aquarium.liquid-acid .aqua-water   { background: linear-gradient(180deg, rgba(110, 230, 60, 0.55), rgba(30, 140, 40, 0.88)); }
.aquarium.liquid-potion .aqua-water { background: linear-gradient(180deg, rgba(160, 95, 235, 0.6), rgba(80, 30, 150, 0.9)); }
.aquarium.liquid-blood .aqua-bubble  { background: rgba(255, 170, 170, 0.45); }
.aquarium.liquid-acid .aqua-bubble   { background: rgba(220, 255, 170, 0.6); }
.aquarium.liquid-potion .aqua-bubble { background: rgba(255, 216, 74, 0.9); }
.aquarium.liquid-blood .aqua-splash  { background: rgba(200, 15, 30, 0.9) !important; }
.aquarium.liquid-acid .aqua-splash   { background: rgba(110, 220, 70, 0.9) !important; }
.aquarium.liquid-potion .aqua-splash { background: rgba(255, 216, 74, 0.95) !important; }

.aqua-preview span { background: linear-gradient(180deg, rgba(10, 132, 255, 0.28), rgba(10, 132, 255, 0.5)); transition: background 0.3s; }
.aqua-preview.liquid-blood span  { background: linear-gradient(180deg, rgba(190, 10, 25, 0.55), rgba(110, 0, 10, 0.88)); }
.aqua-preview.liquid-acid span   { background: linear-gradient(180deg, rgba(110, 230, 60, 0.55), rgba(30, 140, 40, 0.88)); }
.aqua-preview.liquid-potion span { background: radial-gradient(circle at 30% 70%, #ffd84a 0 4px, transparent 5px), radial-gradient(circle at 70% 55%, #ffd84a 0 3px, transparent 4px), linear-gradient(180deg, rgba(160, 95, 235, 0.6), rgba(80, 30, 150, 0.9)); }

.aqua-potions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.aqua-potion {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: #fff;
    border: 2px solid #e3e6eb;
    border-radius: 14px;
    font: inherit;
    font-weight: 700;
    color: #111;
    cursor: pointer;
}
.aqua-potion img { width: 64px; height: 64px; }
.aqua-potion.active { border-color: #111; background: #f6f6f6; }

/* ===== Мусор у учителя ===== */
.trash-kinds { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.trash-kind { aspect-ratio: 1 / 1; min-height: 0; padding: 4px; background: #fff; border: 2px solid #e3e6eb; border-radius: 12px; cursor: pointer; }
.trash-kind img { width: 100%; height: 100%; object-fit: contain; }
.trash-kind.active { border-color: #111; background: #f6f6f6; }

.teacher-trash {
    position: fixed;
    z-index: 900;
    width: 72px;
    height: 72px;
    min-height: 0;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    transform: translate(-50%, -50%) rotate(var(--r, 0deg));
    transition: left 0.4s cubic-bezier(0.3, 1.4, 0.5, 1), top 0.4s cubic-bezier(0.3, 1.4, 0.5, 1), transform 0.4s;
    filter: drop-shadow(0 4px 4px rgba(0, 0, 0, 0.3));
    -webkit-tap-highlight-color: transparent;
}
.teacher-trash img { width: 100%; height: 100%; pointer-events: none; }
.teacher-trash.gone { transition: left 0.8s ease-in, top 0.8s ease-in, transform 0.8s ease-in; }

/* ===== Салют ===== */
.fw-overlay { position: fixed; inset: 0; z-index: 5000; background: rgba(8, 6, 20, 0.55); cursor: pointer; animation: fadeIn 0.3s ease; transition: opacity 0.4s; }
.fw-overlay.out { opacity: 0; }
.fw-overlay canvas { position: absolute; inset: 0; }
.fw-banner {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    max-width: calc(100% - 32px);
    padding: 10px 18px;
    background: #fff;
    color: #111;
    border: 2px solid #111;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    animation: fw-banner-in 0.5s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.fw-skip { position: absolute; bottom: max(18px, env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; color: rgba(255, 255, 255, 0.55); font-size: 0.8rem; }
@keyframes fw-banner-in { from { transform: translate(-50%, -30px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ===== Таймер доски, кнопка «Задания», сад «скоро» ===== */
.board-timer {
    margin: -14px 0 16px;
    text-align: center;
    color: rgba(243, 240, 230, 0.85);
    font-size: 0.85rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.board-timer b { font-variant-numeric: tabular-nums; color: #f3f0e6; }

.tasks-btn {
    position: absolute;
    top: 20px;
    left: 66px;
    z-index: 20;
    height: 34px;
    min-height: 0;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.75);
    color: #555;
    border: 2px solid #777;
    border-radius: 999px;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: not-allowed;
}
.tasks-btn svg { width: 14px; height: 14px; }

/* на телефоне сжимаем правую группу, чтобы «Задания» помещались рядом со стрелкой */
@media (max-width: 899px) {
    #eventView .event-top-right { gap: 6px; }
    #eventView .candy-plus-btn, #eventView .candy-help-btn { width: 32px; height: 32px; }
    #eventView .candy-counter { padding: 0 10px; }
}
@media (min-width: 900px) {
    .tasks-btn { top: 28px; left: 84px; }
}

.garden-soon {
    margin: 30vh auto 0;
    max-width: 320px;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.92);
    border: 2px solid #111;
    border-radius: 14px;
    text-align: center;
    font-weight: 800;
    color: #111;
}

/* ===== Задания (кнопка разблокирована) ===== */
.tasks-btn { position: absolute; background: #fff; color: #111; border-color: #111; cursor: pointer; }
.tasks-btn:active { transform: scale(0.95); }
.tasks-dot { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: #e5243b; border: 2px solid #fff; }
.tasks-modal { display: flex; flex-direction: column; gap: 10px; }
.tasks-reset { margin: -4px 0 4px; text-align: center; color: #666; font-size: 0.85rem; }
.tasks-reset b { font-variant-numeric: tabular-nums; color: #111; }
.tasks-list { display: flex; flex-direction: column; gap: 8px; }
.task-card { display: flex; align-items: center; gap: 10px; padding: 12px; background: #fff; border: 2px solid #111; border-radius: 14px; }
.task-card.claimed { opacity: 0.55; }
.task-card.failed { border-color: #e5243b; }
.task-info { flex: 1; min-width: 0; }
.task-title { font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.task-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.task-progress { font-size: 0.8rem; font-weight: 700; color: #666; }
.task-btn { flex: 0 0 auto; min-height: 0; padding: 9px 12px; border: 2px solid #111; border-radius: 10px; font: inherit; font-size: 0.82rem; font-weight: 800; cursor: pointer; background: #fff; color: #111; }
.task-btn.claim { background: #30c35a; border-color: #30c35a; color: #fff; }
.task-btn.go { background: #111; color: #fff; }
.task-btn.wait, .task-btn.got { color: #888; border-color: #ccc; cursor: default; }
.task-btn.failed { color: #e5243b; border-color: #e5243b; cursor: default; }

.quiz-modal { max-height: 72vh; overflow-y: auto; }
.quiz-q { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 0.9rem; }

/* ===== Сад: тыква и лейка ===== */
.garden-area { min-height: 0; }
.garden-plot { position: relative; width: min(64vw, 260px); margin: 34vh auto 0; }
.garden-pumpkin { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45)); animation: pumpkin-sway 4s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes pumpkin-sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
.garden-stage { margin: 10px auto 0; width: fit-content; padding: 6px 12px; background: rgba(255, 255, 255, 0.9); border: 2px solid #111; border-radius: 999px; font-size: 0.82rem; font-weight: 800; }
.garden-drops { position: absolute; inset: 0; pointer-events: none; }
.garden-drops i { position: absolute; top: 5%; left: calc(50% + var(--dx)); width: 7px; height: 11px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: #7cc7ff; opacity: 0; animation: drop-fall 0.9s ease-in var(--d) 1 forwards; }
@keyframes drop-fall { 0% { transform: translateY(-40px); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(130px); opacity: 0; } }

.garden-can {
    position: fixed;
    right: 16px;
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 30;
    width: 96px;
    height: 104px;
    min-height: 0;
    padding: 0;
    background: none;
    border: none;
    cursor: pointer;
    transition: transform 0.4s, filter 0.3s;
    transform-origin: 30% 70%;
    filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45));
}
.garden-can img { width: 100%; height: 100%; object-fit: contain; }
.garden-can.locked { filter: grayscale(1) brightness(0.65) drop-shadow(0 6px 8px rgba(0, 0, 0, 0.45)); }
.garden-can-lock { display: none; position: absolute; right: 2px; top: 4px; width: 28px; height: 28px; border-radius: 50%; background: #fff; border: 2px solid #111; align-items: center; justify-content: center; }
.garden-can-lock svg { width: 15px; height: 15px; }
.garden-can.locked .garden-can-lock { display: flex; }
.garden-can.pouring { transform: rotate(-35deg) translate(-20px, -10px); }
body:not(.garden-open) .garden-can { display: none; }
@media (min-width: 900px) { .garden-can { right: 32px; bottom: 28px; width: 120px; height: 130px; } }

/* ===== Админка: задания дня ===== */
.ev-task-pick { display: flex; flex-direction: column; gap: 6px; }
.ev-task-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 0; padding: 10px 12px; background: #f6f7f9; border: 2px solid transparent; border-radius: 10px; font: inherit; font-size: 0.88rem; color: #111; text-align: left; cursor: pointer; }
.ev-task-item b { color: #30a14e; }
.ev-task-item.on { border-color: #30c35a; background: #eefaf1; font-weight: 700; }
.ev-task-item:disabled { opacity: 0.4; cursor: default; }
