/* --- СТИЛИ АДМИНКИ --- */
.admin-tab {
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    padding-bottom: 8px;
    color: #94a3b8;
}

.admin-tab.active {
    border-bottom-color: #0F172A;
    color: #0F172A;
    font-weight: 700;
}

/* Стили переключателя (Toggle) */
.toggle-checkbox:checked {
    right: 0;
    border-color: #0F172A;
}

.toggle-checkbox:checked+.toggle-label {
    background-color: #0F172A;
}

/* Сетка уроков в админке */
.admin-lesson-grid-item {
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
}

.admin-lesson-grid-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    border-color: #CBD5E1;
}

.admin-lesson-grid-item.active {
    border-color: #0F172A;
    background-color: #F8FAFC;
    box-shadow: 0 0 0 1px #0F172A;
}

.admin-lesson-grid-item.drag-mode {
    cursor: move;
    border-style: dashed;
    border-color: #cbd5e1;
}

/* Стили Библиотеки Тестов */
.test-slot-card {
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
}

.test-slot-card:hover {
    border-color: #94A3B8;
    background-color: #FFFFFF;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.test-slot-card.active {
    border-color: #0F172A;
    background-color: #F8FAFC;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.02);
}

.test-slot-card.empty {
    border-style: dashed;
    color: #CBD5E1;
}

.hw-variant-tab {
    padding: 8px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: #64748B;
    transition: all 0.2s;
    letter-spacing: 0.05em;
}

.hw-variant-tab:hover {
    background-color: #F1F5F9;
    color: #0F172A;
}

.hw-variant-tab.active {
    background-color: #0F172A;
    color: white;
    box-shadow: 0 4px 10px -2px rgba(15, 23, 42, 0.2);
}

.lesson-node {
    height: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    position: relative;
    border-radius: 16px;
}

.lesson-node.locked {
    opacity: 0.5;
    filter: grayscale(100%);
    pointer-events: none;
    background-color: #F1F5F9;
}

.lesson-node:active {
    transform: scale(0.96);
}

/* Скроллбары */
.custom-scroll::-webkit-scrollbar {
    width: 4px;
}

.custom-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scroll::-webkit-scrollbar-thumb {
    background-color: #E2E8F0;
    border-radius: 20px;
}

.gradebook-scroll::-webkit-scrollbar {
    height: 6px;
}

.gradebook-scroll::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}

.gradebook-scroll::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.sortable-ghost {
    opacity: 0.4;
    background: #e2e8f0;
}

.sortable-drag {
    cursor: grabbing;
}

/* --- ПРЕМИУМ СТИЛИ (BENTO MINIMAL) --- */

.slider-container {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    scrollbar-width: none;
    padding-bottom: 20px;
}

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

.slide-page {
    min-width: 100%;
    scroll-snap-align: center;
    padding: 4px;
}

/* --- GRADIENT BACKGROUNDS --- */
.hero-gradient {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 40%, #1e1b4b 100%);
}

.game-gradient {
    background: linear-gradient(145deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
}

.card-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F8FAFC;
    color: #64748B;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s;
}

.falling-item {
    position: absolute;
    cursor: pointer;
    user-select: none;
    touch-action: none;
    z-index: 50;
    background: #0F172A;
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: 700;
    padding: 12px;
    font-size: 11px;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.3);
    font-family: 'Inter', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.1);
}



.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

/* Исправление Z-index для модалок */
#admin-modal {
    z-index: 110;
}

#lesson-modal {
    z-index: 200;
}

/* Урок теперь ВЫШЕ админки */
#preview-controls {
    z-index: 210;
}

#mistakes-modal {
    z-index: 140;
}

#json-paste-modal {
    z-index: 150;
}

#student-card-modal {
    z-index: 145;
}

#heatmap-modal {
    z-index: 145;
}

/* MARKDOWN STYLES RESTORED */
.prose p {
    margin-bottom: 1em;
    line-height: 1.6;
}

.prose h1,
.prose h2,
.prose h3 {
    font-family: 'Lora', serif;
    font-weight: 700;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    color: #1e293b;
}

.prose ul {
    list-style-type: disc;
    padding-left: 1.5em;
    margin-bottom: 1em;
}

.prose ol {
    list-style-type: decimal;
    padding-left: 1.5em;
    margin-bottom: 1em;
}

.prose strong {
    color: #0f172a;
    font-weight: 700;
}

.prose em {
    font-style: italic;
}

/* FIX FOR HOMEWORK CLICK */
.radio-box input:checked+div {
    border-color: #0F172A;
    background-color: #F8FAFC;
    box-shadow: 0 0 0 1px #0F172A;
}

.radio-box input:checked+div .radio-circle {
    background-color: #0F172A;
    border-color: #0F172A;
}

.radio-box:hover div {
    border-color: #94a3b8;
}

/* --- ФИНАЛЬНАЯ ПРАВКА СКРОЛЛА АДМИНКИ --- */
@media (max-width: 768px) {

    /* 1. Разрешаем основному контейнеру админки расти вниз */
    #admin-modal .bg-white.w-full.max-w-6xl {
        overflow-y: auto !important;
        display: block !important;
    }

    #admin-dashboard-view {
        height: auto !important;
        display: flex !important;
        /* Оставляем flex для работы JS, но разрешаем рост */
        overflow: visible !important;
    }

    /* 2. УРОКИ: Делаем список и редактор идущими друг за другом */
    #content-lesson:not(.hidden) {
        display: block !important;
        height: auto !important;
    }

    #admin-lessons-list {
        max-height: 400px !important;
        /* Окошко для выбора урока */
        overflow-y: auto !important;
        border-bottom: 2px solid #f1f5f9;
        margin-bottom: 20px;
    }

    .admin-lesson-grid-item {
        width: 100% !important;
        margin: 4px 0 !important;
    }

    /* 3. ТЕСТЫ: Полный скролл страницы */
    #content-hw:not(.hidden) {
        display: block !important;
        height: auto !important;
    }

    /* Убираем фиксированную ширину и высоту у колонок */
    #content-hw .md\:w-1\/3,
    #content-hw .md\:w-2\/3 {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
    }

    #assignments-list-container,
    #hw-questions-list,
    #hw-editor-area {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }

    /* 4. ВАРИАНТЫ: Крупнее для пальцев */
    .hw-variant-tab {
        padding: 15px 5px !important;
        margin-bottom: 5px !important;
        background: #f8fafc;
        border: 1px solid #e2e8f0;
    }

    /* 5. ЖУРНАЛ: Оставляем скролл только внутри таблицы */
    #content-gradebook:not(.hidden) {
        display: flex !important;
        height: 70vh !important;
        /* Чтобы шапка админки не уезжала */
    }

    /* Липкая кнопка сохранения в самом низу экрана телефона */
    .h-20.bg-white.border-t {
        position: sticky !important;
        bottom: 0 !important;
        z-index: 999 !important;
        box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1) !important;
    }
}

/* --- СВОЯ ИГРА (JEOPARDY) --- */

.jeopardy-cell {
    animation: jeopardy-pulse 2s ease-in-out infinite;
}

.jeopardy-cell:hover {
    animation: none;
    box-shadow: 0 0 20px rgba(129, 140, 248, 0.5);
}

@keyframes jeopardy-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.85;
    }
}

/* Таймер Своей Игры */
#jeopardy-timer {
    transition: all 0.3s ease;
}

#jeopardy-timer.bg-red-100 {
    animation: timer-shake 0.5s ease-in-out;
}

@keyframes timer-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

/* =========================================================
   2026 REDESIGN OVERRIDES
   ========================================================= */
:root {
    --tone-ink: #0f1f2d;
    --tone-muted: #5a687b;
    --tone-teal: #0f958f;
    --tone-teal-strong: #0a6d69;
    --tone-orange: #f18a2a;
    --tone-orange-soft: #ffd2a2;
    --tone-shell: rgba(255, 255, 255, 0.72);
    --tone-stroke: rgba(13, 52, 72, 0.14);
    --tone-shadow: 0 16px 40px rgba(13, 31, 48, 0.12);
}

body {
    font-family: var(--font-ui);
    -webkit-tap-highlight-color: transparent;
    background:
        radial-gradient(circle at 12% 10%, rgba(15, 149, 143, 0.24), transparent 34%),
        radial-gradient(circle at 90% 12%, rgba(241, 138, 42, 0.2), transparent 34%),
        linear-gradient(150deg, #fffdf8 0%, #f5fbff 46%, #fff4e8 100%);
    color: var(--tone-ink);
}

body::before,
body::after {
    content: "";
    position: fixed;
    border-radius: 999px;
    filter: blur(26px);
    z-index: -2;
    pointer-events: none;
}

body::before {
    width: 260px;
    height: 260px;
    left: -100px;
    top: -100px;
    background: rgba(15, 149, 143, 0.35);
}

body::after {
    width: 320px;
    height: 320px;
    right: -130px;
    bottom: -130px;
    background: rgba(241, 138, 42, 0.3);
}

.app-wrapper {
    position: relative;
    isolation: isolate;
}

.app-main {
    padding-bottom: 180px;
}

.bg-noise {
    opacity: 0.03;
    mix-blend-mode: soft-light;
}

.orb {
    display: block;
    position: fixed;
    border-radius: 999px;
    z-index: -1;
    filter: blur(15px);
    pointer-events: none;
}

.orb-1 {
    width: 220px;
    height: 220px;
    top: 18%;
    left: -120px;
    background: rgba(15, 149, 143, 0.28);
}

.orb-2 {
    width: 260px;
    height: 260px;
    right: -140px;
    bottom: 20%;
    background: rgba(241, 138, 42, 0.24);
}

/* Top Bar */
#main-header,
.app-topbar {
    top: 12px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(96%, 1060px);
    height: 72px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.62);
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0.55));
    box-shadow: var(--tone-shadow);
    padding: 0 16px;
}

#main-header .brand-badge {
    background: linear-gradient(145deg, #0f958f, #0a6d69 65%, #f18a2a 130%);
    box-shadow: 0 10px 20px rgba(10, 109, 105, 0.35);
}

#main-header .brand-sub {
    color: #6b7a8f;
}

#main-header .app-actions {
    border-color: rgba(15, 53, 68, 0.12);
    background: rgba(255, 255, 255, 0.7);
}

#main-header .shop-pill {
    color: #8a4706;
    background: linear-gradient(180deg, #ffe7c8, #ffd5a8);
    border: 1px solid rgba(241, 138, 42, 0.36);
}

#main-header .shop-pill:hover {
    background: #ffd19a;
}



#main-header button[onclick="window.openAdminLogin()"] {
    color: #6b7a8f;
}

#main-header button[onclick="window.openAdminLogin()"]:hover {
    color: #0f1f2d;
    background: rgba(15, 53, 68, 0.08);
    border-color: rgba(15, 53, 68, 0.12);
}

/* Section shell */
.section-shell {
    padding: 20px;
    border: 1px solid var(--tone-stroke);
    border-radius: 30px;
    background: var(--tone-shell);
    backdrop-filter: blur(10px);
    box-shadow: var(--tone-shadow);
}

.section-shell>div.bg-white,
.section-shell .game-shell,
.section-shell #hw-login-screen,
.section-shell #hw-result-screen {
    border-color: rgba(15, 53, 68, 0.1) !important;
    box-shadow: 0 12px 30px rgba(16, 37, 58, 0.08) !important;
}

/* Hero */
.hero-panel {
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 24px 52px rgba(4, 16, 29, 0.3);
}

.hero-gradient {
    background:
        radial-gradient(circle at 12% 12%, rgba(255, 255, 255, 0.18), transparent 38%),
        radial-gradient(circle at 86% 14%, rgba(255, 210, 162, 0.26), transparent 40%),
        linear-gradient(136deg, #083438 0%, #0f6f70 36%, #0f958f 62%, #f18a2a 110%);
}

.chart-path {
    animation: chartPulse 4s ease-in-out infinite;
}

@keyframes chartPulse {

    0%,
    100% {
        opacity: 0.75;
    }

    50% {
        opacity: 1;
    }
}

/* Course map */
#course-map h3,
#homework h2,
#jeopardy h3,
#centralbank h3 {
    letter-spacing: -0.02em;
}

#slider-dots>div {
    background: rgba(82, 96, 112, 0.3);
}

#slider-dots>div.bg-slate-900 {
    background: linear-gradient(90deg, var(--tone-teal), var(--tone-orange));
    width: 18px !important;
}

.slider-container {
    padding-bottom: 14px;
}

.lesson-card {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.95), rgba(248, 253, 255, 0.88));
    border: 1px solid rgba(15, 53, 68, 0.1);
    border-radius: 22px !important;
    box-shadow: 0 10px 24px rgba(18, 37, 59, 0.08);
}

.lesson-card:hover {
    transform: translateY(-3px) scale(1.01);
    border-color: rgba(15, 149, 143, 0.35);
    box-shadow: 0 16px 32px rgba(10, 42, 63, 0.13);
}

.lesson-card .line-clamp-2 {
    color: #223548;
}

/* Game / Jeopardy / Centralbank shells */
#game .game-gradient {
    background: linear-gradient(140deg, #0f1f2d 0%, #0f3b4f 44%, #0f6f70 100%);
}

#game .bg-emerald-500 {
    background: linear-gradient(130deg, #0f958f, #16b3ac) !important;
}

#jeopardy-score {
    background: linear-gradient(130deg, #0f958f, #0a6d69) !important;
    box-shadow: 0 10px 24px rgba(10, 109, 105, 0.3);
}

#jeopardy-categories>div {
    background: linear-gradient(140deg, #0f1f2d, #1d3448) !important;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

#jeopardy-board .jeopardy-cell {
    background: linear-gradient(140deg, #0f958f, #16a79f) !important;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 12px 22px rgba(13, 72, 88, 0.2);
}

#jeopardy-board .jeopardy-cell:hover {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4) inset, 0 16px 28px rgba(16, 65, 80, 0.24);
}

#centralbank .bg-gradient-to-r.from-indigo-600.to-violet-600 {
    background: linear-gradient(130deg, #f18a2a, #d46a0a) !important;
    box-shadow: 0 10px 22px rgba(212, 106, 10, 0.35);
}

#homework #hw-login-screen,
#homework #hw-result-screen {
    background: rgba(255, 255, 255, 0.9);
}

#homework #hw-start-btn,
#homework #hw-test-screen button {
    background: linear-gradient(130deg, #0f958f, #0a6d69);
}

#homework #hw-start-btn:hover,
#homework #hw-test-screen button:hover {
    background: linear-gradient(130deg, #0a6d69, #085653);
}

/* Games modal */
#games-menu .games-panel {
    border: 1px solid rgba(255, 255, 255, 0.55);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.72));
    box-shadow: 0 24px 44px rgba(12, 28, 45, 0.25);
}

#games-menu .games-panel .border-b {
    border-bottom-color: rgba(15, 53, 68, 0.12) !important;
}

#games-menu .games-panel h3 {
    font-family: var(--font-display);
    font-size: 1rem;
}

/* Dock */
#dock-nav,
.dock-nav {
    background: rgba(14, 31, 47, 0.84);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 16px 34px rgba(6, 16, 29, 0.36);
    backdrop-filter: blur(16px);
}

#dock-nav .dock-divider {
    background: rgba(255, 255, 255, 0.16);
}

#dock-nav .dock-btn {
    color: rgba(235, 245, 255, 0.72);
}

#dock-nav .dock-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

#dock-nav .dock-btn-main {
    background: linear-gradient(140deg, #f18a2a, #e27007);
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 12px 24px rgba(212, 106, 10, 0.4);
}

#dock-nav .dock-btn-main:hover {
    transform: scale(1.08);
}

/* Form controls */
input,
select,
textarea {
    border-radius: 12px;
}

button,
input,
select,
textarea {
    font-family: var(--font-ui);
}

/* Secondary pages */
.space-y-8.animate-fade-in {
    max-width: 960px;
    margin: 110px auto 120px;
    padding: 0 14px;
}

/* Responsive */
@media (max-width: 900px) {
    #main-header {
        width: calc(100% - 12px);
        border-radius: 18px;
        padding: 0 10px;
        height: 66px;
    }

    #main-header .app-brand {
        gap: 10px;
    }

    #main-header .brand-badge {
        width: 34px;
        height: 34px;
        border-radius: 11px;
    }

    #main-header .brand-sub {
        letter-spacing: 0.08em;
    }

    .app-main {
        padding-left: 10px;
        padding-right: 10px;
    }

    .section-shell {
        padding: 14px;
        border-radius: 24px;
    }
}

@media (max-width: 640px) {
    .hero-panel {
        min-height: 290px;
        padding: 20px;
    }

    .hero-panel h2 {
        font-size: 1.95rem;
    }

    #dock-nav {
        height: 60px;
        max-width: 340px;
    }

    #dock-nav .dock-btn-main {
        width: 50px;
        height: 50px;
    }
}