/* 
  Froggy Jumps (Three.js)
  Mobile First CSS Architecture
*/

:root {
    --color-bg: #87ceeb; /* Небо по умолчанию */
    --color-primary: #4a7c23; /* Зеленый (Лягушка) */
    --color-secondary: #2d5016; /* Темно-зеленый */
    --color-accent: #fbbf24; /* Золото/Звезды */
    --color-danger: #ef4444; 
    --text-main: #ffffff;
    --font-heading: 'Fredoka One', cursive;
    --font-body: 'Nunito', sans-serif;
    --overlay-glass: rgba(255, 255, 255, 0.15);
    --overlay-glass-dark: rgba(0, 0, 0, 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none; /* Запрет выделения на тач */
    -webkit-touch-callout: none;
}

body, html {
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* Prevent default scroll! */
    background: #000;
    font-family: var(--font-body);
}

/* Three.js Canvas */
#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: block;
}

/* UI Задник (поверх 3D) */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none; /* Пропускаем клики сквозь слой UI по умолчанию */
}

/* Экраны состояний */
.screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--overlay-glass-dark);
    backdrop-filter: blur(10px);
    pointer-events: auto; /* Экраны меню перехватывают клики */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

.hidden {
    display: none !important;
}

/* Типографика */
h1.bounce-text {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--color-primary);
    text-transform: uppercase;
    text-shadow: 2px 4px 0px var(--color-secondary), 0px 8px 15px rgba(0,0,0,0.4);
    animation: floatingbounce 2s infinite ease-in-out;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    color: var(--color-accent);
    font-size: 1.2rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 1px;
    text-shadow: 1px 2px 0px rgba(0,0,0,0.5);
}

h2.title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 2px 3px 0px rgba(0,0,0,0.5);
    margin-bottom: 1rem;
    text-align: center;
}
.color-danger { color: var(--color-danger) !important; text-shadow: 2px 3px 0px #7f1d1d !important;}

/* Кнопки */
button {
    pointer-events: auto;
    cursor: pointer;
    border: none;
    outline: none;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    padding: 16px 32px;
    border-radius: 50px;
    transition: transform 0.1s, box-shadow 0.2s;
    text-transform: uppercase;
    color: white;
}

.btn-primary {
    background: linear-gradient(145deg, #60a5fa, #2563eb);
    box-shadow: 0 8px 0 #1e3a8a, 0 15px 20px rgba(0,0,0,0.4);
    margin-bottom: 24px;
}
.btn-primary:active {
    transform: translateY(8px);
    box-shadow: 0 0px 0 #1e3a8a, 0 5px 10px rgba(0,0,0,0.4);
}

.btn-secondary {
    background: linear-gradient(145deg, #9ca3af, #4b5563);
    box-shadow: 0 6px 0 #374151, 0 10px 15px rgba(0,0,0,0.4);
    font-size: 1.2rem;
    padding: 12px 24px;
}
.btn-secondary:active {
    transform: translateY(6px);
    box-shadow: 0 0px 0 #374151;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
}

/* Glass Panels */
.glass-panel {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Загрузка */
.progress-bar-container {
    width: 60%;
    height: 20px;
    background: rgba(0,0,0,0.5);
    border-radius: 10px;
    border: 2px solid white;
    margin: 20px 0;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: var(--color-primary);
    transition: width 0.2s;
}

.loading-text {
    color: white;
    font-weight: 700;
}

/* HUD */
#hud {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none; /* Пропускаем клики на ThreeJS canvas */
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #6a9c24; /* Educaplay Green */
    padding: 10px 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    color: white;
    font-family: var(--font-heading);
    pointer-events: auto;
}

.lives-display, .score-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
}

.level-title {
    font-size: 1.5rem;
    text-transform: uppercase;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Контейнер Вопроса */
.question-container {
    align-self: center;
    background: white;
    color: #333;
    border-radius: 15px;
    padding: 20px 40px;
    margin-top: 15px;
    box-shadow: 0 8px 15px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 800px;
    text-align: center;
    position: relative;
    pointer-events: auto;
}

.question-badge {
    position: absolute;
    top: -15px;
    left: 20px;
    background: #6a9c24;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.question-text {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
}

/* Лейблы ответов над 3D объектами */
.answers-layer {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; /* Лейблы кликабельны, но контейнер нет */
    overflow: hidden;
}

.answer-label {
    position: absolute;
    transform: translate(-50%, -50%); /* Центрирование точное */
    color: white;
    font-family: var(--font-heading);
    font-size: 1.4rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    pointer-events: auto;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s;
}

.answer-label:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.hud-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding: 20px;
    pointer-events: auto;
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.8);
    border-radius: 30px;
    padding: 5px 20px 5px 5px;
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: #333;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.timer-circle {
    background: #6a9c24;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    border: 3px solid white;
}

.icon-btn {
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    border-radius: 10px;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    transition: transform 0.1s;
}
.icon-btn:active { transform: scale(0.9); }

/* Тач Контролы для Mobile First */
#touch-controls {
    position: absolute;
    inset: 0;
    display: flex;
    pointer-events: auto; /* Блокируем для тапов */
    z-index: 5;
}

.touch-zone {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 20px;
    opacity: 0.3; /* Визуальная подсказка (исчезает в игре потом) */
    transition: opacity 0.2s, background 0.1s;
    -webkit-tap-highlight-color: transparent;
}
.touch-zone:active {
    background: rgba(255,255,255,0.1);
}
.hint {
    font-family: var(--font-heading);
    color: white;
    font-size: 2rem;
    text-shadow: 0 2px 4px #000;
}

/* Animations */
@keyframes floatingbounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

.mt-4 { margin-top: 2rem; }

/* Responsive Adjustments */
@media (max-width: 767px) {
    h1.bounce-text { font-size: 2.2rem; }
    h2.title { font-size: 2rem; }
    button { padding: 12px 24px; font-size: 1.2rem; }
    .glass-panel { padding: 25px; width: 90%; }
}
