/* Стили игры "Не пусти обезьян!" */
:root {
    --primary-color: #ffd166;
    --green-light: #06d6a0;
    --green-dark: #073b4c;
    --red-alert: #ef476f;
    --jungle-bg: #112211;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background: linear-gradient(135deg, #0f2010 0%, #061108 100%);
    color: #fff;
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    padding: 10px;
}

.game-container {
    width: 100%;
    max-width: 840px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

/* Кнопка возврата к порталу */
.back-link {
    position: absolute;
    top: -50px;
    left: 0;
    color: #a0aec0;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    padding: 6px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
}

.back-link:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* Шапка HUD */
.game-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
}

.hud-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 10px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.hud-label {
    font-size: 0.8rem;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    margin-bottom: 4px;
}

.hud-val {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(255, 209, 102, 0.3);
}

.hearts-container {
    display: flex;
    gap: 6px;
    font-size: 1.5rem;
    height: 38px;
    align-items: center;
}

/* Игровое поле и обертка холста */
.canvas-wrapper {
    width: 100%;
    aspect-ratio: 8/5;
    background-color: var(--jungle-bg);
    border: 6px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* Оверлеи (Старт и Конец игры) */
.overlay-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 20, 10, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    z-index: 10;
    text-align: center;
}

.overlay-panel.hidden {
    display: none !important;
}

.game-main-title {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--primary-color);
    text-shadow: 0 4px 15px rgba(255, 209, 102, 0.4);
    margin-bottom: 16px;
}

.game-over-title {
    font-family: var(--font-heading);
    font-size: 2.8rem;
    font-weight: 800;
    color: var(--red-alert);
    text-shadow: 0 4px 15px rgba(239, 71, 111, 0.4);
    margin-bottom: 16px;
}

.game-desc {
    color: #e2e8f0;
    font-size: 1rem;
    max-width: 500px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.tips-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    color: #cbd5e0;
    margin-bottom: 30px;
}

.tips-box span {
    color: var(--primary-color);
    font-weight: 700;
}

.stats-panel {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 36px;
    border-radius: 16px;
    font-size: 1.15rem;
    line-height: 1.8;
    margin-bottom: 30px;
    color: #cbd5e0;
}

.stats-panel span {
    font-weight: 800;
    color: #fff;
}

/* Кнопка играть */
.play-btn {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.35rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #0b1a0e;
    background: var(--green-light);
    border: none;
    padding: 14px 44px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(6, 214, 160, 0.4);
    transition: all 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.play-btn:hover {
    transform: scale(1.05);
    background: #15f0b5;
    box-shadow: 0 10px 25px rgba(6, 214, 160, 0.6);
}

.play-btn:active {
    transform: scale(0.95);
}

/* Нижняя панель */
.game-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    width: 100%;
}

.sound-toggle {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #cbd5e0;
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 700;
    transition: all 0.2s ease;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.tips-text {
    font-size: 0.85rem;
    color: #718096;
    text-align: right;
    max-width: 480px;
}

/* Адаптивность под мобильные */
@media (max-width: 680px) {
    .back-link {
        position: relative;
        top: 0;
        margin-bottom: 10px;
        align-self: flex-start;
    }

    .game-main-title,
    .game-over-title {
        font-size: 1.8rem;
    }

    .game-desc {
        font-size: 0.85rem;
        margin-bottom: 16px;
    }

    .hud-val {
        font-size: 1.3rem;
    }

    .hearts-container {
        font-size: 1.1rem;
        height: 28px;
    }

    .hud-item {
        padding: 6px 12px;
        border-radius: 12px;
    }

    .game-footer {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .tips-text {
        text-align: center;
    }
}
