@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Space+Grotesk:wght@700&display=swap');

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif; 
}

body {
    background: linear-gradient(-45deg, #ff9a9e, #fecfef, #a18cd1, #fbc2eb);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    color: #fff;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    overflow-y: auto; /* Разрешаем вертикальный скролл страницы на всякий случай */
    padding: 20px 0;
}

body.static-bg {
    animation: none;
    background-position: 0% 50%;
}

@keyframes gradientBG { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }

.glass-panel {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(25px) saturate(150%);
    -webkit-backdrop-filter: blur(25px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 32px;
    padding: 40px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.5);
    position: relative;
    transition: all 0.3s ease;
    
    /* Адаптация под размер экрана - внутренний скролл */
    max-height: 95vh;
    overflow-y: auto; 
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.5) transparent;
}

/* Красивый скроллбар для WebKit (Chrome, Safari, Edge) */
.glass-panel::-webkit-scrollbar { width: 6px; }
.glass-panel::-webkit-scrollbar-track { background: transparent; }
.glass-panel::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.5); border-radius: 10px; }

.hidden { display: none !important; }

h2, h3 { 
    margin-bottom: 25px; 
    text-align: center; 
    font-weight: 700; 
    letter-spacing: 0.5px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

input, select, button {
    width: 100%; padding: 16px; margin-bottom: 20px;
    border-radius: 20px; border: none; outline: none; font-size: 1.05rem;
}

input, select {
    background: rgba(255, 255, 255, 0.25); 
    color: #333;
    border: 2px solid rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    font-weight: 600;
    transition: all 0.3s ease;
}
input::placeholder { color: rgba(50,50,50,0.6); font-weight: 400; }
input:focus, select:focus { 
    border: 2px solid #fff; 
    background: rgba(255,255,255,0.4); 
    box-shadow: 0 0 15px rgba(255,255,255,0.3);
}

button {
    background: rgba(255, 255, 255, 0.85);
    border: none;
    color: #a18cd1; 
    cursor: pointer; font-weight: 700;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    letter-spacing: 0.5px;
}
button:hover { transform: translateY(-3px); box-shadow: 0 15px 25px rgba(0,0,0,0.15); }
button:active { transform: translateY(2px) scale(0.97); box-shadow: 0 5px 10px rgba(0,0,0,0.1); }

.option-btn { margin-bottom: 12px; text-align: left; background: rgba(255,255,255,0.6); color: #333; }
.option-btn:hover { background: #fff; }

/* ТАЙМЕР */
.timer-container { text-align: center; margin-bottom: 25px; }
.timer-block {
    display: inline-block;
    padding: 10px 25px;
    border-radius: 30px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: background 0.3s, color 0.3s, border-color 0.3s;
    backdrop-filter: blur(10px);
}
.timer-green { background: rgba(52, 199, 89, 0.2); color: #34c759; border: 2px solid #34c759; text-shadow: 0 0 10px rgba(52,199,89,0.4); }
.timer-yellow { background: rgba(255, 204, 0, 0.2); color: #ffcc00; border: 2px solid #ffcc00; text-shadow: 0 0 10px rgba(255,204,0,0.4); }
.timer-red { background: rgba(255, 59, 48, 0.2); color: #ff3b30; border: 2px solid #ff3b30; text-shadow: 0 0 10px rgba(255,59,48,0.4); }
.timer-panic { animation: crazyJump 0.3s infinite; }
@keyframes crazyJump {
    0% { transform: translate(0, 0) scale(1) rotate(0deg); }
    25% { transform: translate(-10px, -15px) scale(1.2) rotate(-8deg); }
    50% { transform: translate(10px, 5px) scale(0.8) rotate(8deg); }
    75% { transform: translate(-10px, 15px) scale(1.3) rotate(-8deg); }
    100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

.admin-btn { position: absolute; top: 20px; right: 20px; width: auto; padding: 10px 20px; border-radius: 20px; font-size: 0.85rem; background: rgba(255,255,255,0.3); color: #fff;}

/* Админка */
.admin-panel { max-width: 1000px; color: #333; }
.admin-panel h2, .admin-panel h3 { color: #fff; }
.admin-grid { display: flex; gap: 10px; flex-wrap: wrap; }
.admin-grid input { flex: 1; min-width: 150px; }
table { width: 100%; border-collapse: collapse; margin-top: 15px; font-size: 0.95rem; color: #fff; min-width: 600px; }
th, td { padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.2); text-align: left; }
.delete-btn { background: rgba(255, 59, 48, 0.8); color: #fff; padding: 6px 12px; margin: 0; width: auto; font-size: 0.8rem;}

/* Тумблер */
.bg-toggle-container {
    position: fixed; top: 20px; left: 20px;
    display: flex; align-items: center; gap: 10px;
    font-size: 0.9rem; font-weight: 600; z-index: 1000;
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.15); transition: .3s; border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.5); backdrop-filter: blur(5px);
}
.slider:before {
    position: absolute; content: ""; height: 16px; width: 16px;
    left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%;
}
input:checked + .slider { background-color: #ff3b30; border-color: #ff3b30; }
input:checked + .slider:before { transform: translateX(20px); }

/* Анимации загрузки */
.loader-circle {
    width: 80px; height: 80px; border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff; border-radius: 50%;
    animation: spin 1s linear infinite; margin: 0 auto 30px auto;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.suspense-phase-1 .loader-circle { animation: spin 0.5s linear infinite; border-top-color: #ffcc00; }
.suspense-phase-2 { animation: heartbeat 0.4s infinite; }
.suspense-phase-2 .loader-circle { border-top-color: #ff3b30; animation: spin 0.2s linear infinite; }
.suspense-phase-3 { animation: hardcoreShake 0.1s infinite; box-shadow: inset 0 0 100px rgba(255,0,0,0.5); }

@keyframes heartbeat { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes hardcoreShake {
    0% { transform: translate(2px, 2px) rotate(0deg); }
    25% { transform: translate(-2px, -1px) rotate(-1deg); }
    50% { transform: translate(-2px, 2px) rotate(1deg); }
    75% { transform: translate(2px, -2px) rotate(-1deg); }
    100% { transform: translate(2px, 2px) rotate(0deg); }
}

#grade-text { 
    font-family: 'Space Grotesk', sans-serif;
    font-size: 9rem; 
    font-weight: 700; 
    text-shadow: 0 20px 50px rgba(0,0,0,0.3); 
    margin: 10px 0; 
    line-height: 1;
}

.epic-reveal { animation: explodeIn 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
@keyframes explodeIn {
    0% { transform: scale(0); opacity: 0; filter: blur(20px); }
    50% { transform: scale(1.2); opacity: 1; filter: blur(0px); }
    100% { transform: scale(1); }
}
.white-flash {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: white; z-index: 9999; pointer-events: none;
    animation: flashFade 1s forwards;
}
@keyframes flashFade { 0% { opacity: 1; } 100% { opacity: 0; } }

/* АДАПТИВНОСТЬ ДЛЯ НОУТБУКОВ / МАЛЕНЬКИХ ЭКРАНОВ */
@media (max-height: 850px) {
    .glass-panel { padding: 25px; }
    h2, h3 { margin-bottom: 15px; }
    input, select, button { padding: 12px; margin-bottom: 15px; font-size: 1rem; }
    .timer-block { font-size: 1.6rem; padding: 5px 20px; }
}
