/* ============================================================
   💗 Живое Сердце — стили / Living Heart — styles
   Две карты: Зимний Лес, Древний Египет
   Two maps: Winter Forest, Ancient Egypt
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comfortaa', cursive;
    overflow: hidden;
    background: #1a1a2e;
    user-select: none;
    -webkit-user-select: none;
}

/* === Контейнер игры / Game container === */
.game-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* === Левая панель — живое сердце / Left panel — living heart === */
.heart-panel {
    width: 220px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #0d0d1a 0%, #1a0a0a 50%, #0d0d1a 100%);
    border-right: 2px solid #330000;
    position: relative;
    padding: 20px 10px;
    transition: background 0.8s;
}

/* Египетская тема боковой панели / Egypt theme sidebar */
.heart-panel.egypt {
    background: linear-gradient(180deg, #1a1400 0%, #2a1a00 50%, #1a1400 100%);
    border-right-color: #554400;
}

.heart-percent {
    font-size: 28px;
    font-weight: 700;
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
    margin-bottom: 10px;
    transition: color 0.5s, text-shadow 0.5s;
}

.heart-percent.glow {
    color: #ffdd44;
    text-shadow: 0 0 30px rgba(255, 221, 68, 0.8);
}

.heart-canvas-wrapper {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#heart-canvas {
    width: 180px;
    height: 180px;
}

.heart-stage {
    font-size: 14px;
    color: #999;
    margin-top: 8px;
    text-align: center;
    transition: color 0.5s;
}

.heart-stage.active {
    color: #ff6666;
}

.heart-stats {
    margin-top: 20px;
    text-align: center;
    color: #888;
    font-size: 13px;
    line-height: 1.8;
}

.heart-stats span {
    color: #ffaa44;
    font-weight: 700;
}

.heart-level {
    margin-top: 15px;
    font-size: 16px;
    color: #aaa;
    text-align: center;
}

.heart-level .level-name {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* === Центральная панель — игровое поле / Center panel — game field === */
.game-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

#game-canvas {
    border: 2px solid #333;
    border-radius: 8px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 700px;
    padding: 10px 20px;
    color: #ccc;
    font-size: 14px;
}

.top-bar .score {
    color: #ffaa44;
    font-weight: 700;
}

.top-bar .timer {
    color: #88ccff;
}

.bottom-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    max-width: 700px;
    padding: 8px 10px;
}

.pause-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    color: #fff;
    font-size: 22px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
    user-select: none;
    -webkit-user-select: none;
}

.pause-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.4);
    transform: scale(1.08);
}

.pause-btn:active {
    background: rgba(255, 68, 68, 0.3);
    transform: scale(0.95);
}

/* Оверлей паузы / Pause overlay */
.pause-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.7);
    z-index: 150;
    color: white;
    font-size: 24px;
    text-align: center;
}

.pause-overlay .pause-icon {
    font-size: 60px;
    margin-bottom: 10px;
}

.pause-overlay .pause-hint {
    font-size: 14px;
    color: #aaa;
    margin-top: 8px;
}

/* === Экран старта — выбор карты / Start screen — map selection === */
.start-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.92);
    z-index: 200;
    color: white;
    text-align: center;
}

.start-screen h1 {
    font-size: 36px;
    color: #ff4444;
    text-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
    margin-bottom: 10px;
}

.start-screen .subtitle {
    font-size: 16px;
    color: #aaa;
    margin-bottom: 30px;
}

.start-screen .heart-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: pulse 1.5s infinite ease-in-out;
}

/* === Выбор карты / Map selection === */
.map-select {
    width: 100%;
    max-width: 600px;
    margin-top: 10px;
}

.map-select-title {
    font-size: 20px;
    color: #ffaa44;
    margin-bottom: 18px;
    text-shadow: 0 0 10px rgba(255, 170, 68, 0.3);
}

.map-cards {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.map-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
    width: 240px;
    font-family: 'Comfortaa', cursive;
    color: white;
}

.map-card:hover {
    transform: translateY(-4px) scale(1.03);
    border-color: #ff4444;
    box-shadow: 0 8px 30px rgba(255, 0, 0, 0.3);
    background: rgba(255, 68, 68, 0.08);
}

.map-card:active {
    transform: scale(0.97);
}

/* Превью карты — Зимний Лес / Map preview — Winter Forest */
.map-preview {
    width: 200px;
    height: 120px;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: transform 0.3s;
}

.map-card:hover .map-preview {
    transform: scale(1.05);
}

.map-preview-winter {
    background:
        /* Снежинки / Snowflakes */
        radial-gradient(2px 2px at 20% 30%, #fff 50%, transparent 50%),
        radial-gradient(2px 2px at 60% 20%, #fff 50%, transparent 50%),
        radial-gradient(2px 2px at 80% 50%, #fff 50%, transparent 50%),
        radial-gradient(2px 2px at 40% 70%, #fff 50%, transparent 50%),
        radial-gradient(2px 2px at 15% 80%, #fff 50%, transparent 50%),
        radial-gradient(1.5px 1.5px at 70% 75%, #ddd 50%, transparent 50%),
        radial-gradient(1.5px 1.5px at 90% 15%, #ddd 50%, transparent 50%),
        /* Ёлки / Trees */
        linear-gradient(#2d5a1e 0%, #1a3a0e 100%),
        /* Земля-небо / Ground-sky */
        linear-gradient(180deg, #1a2a4a 0%, #2a3a5a 35%, #3a5a3a 65%, #2a4a2a 100%);
    background:
        radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.8) 50%, transparent 50%),
        radial-gradient(2px 2px at 60% 20%, rgba(255,255,255,0.8) 50%, transparent 50%),
        radial-gradient(2px 2px at 80% 50%, rgba(255,255,255,0.6) 50%, transparent 50%),
        radial-gradient(1px 1px at 45% 65%, rgba(255,255,255,0.5) 50%, transparent 50%),
        linear-gradient(180deg, #0f1a33 0%, #1a2a4a 30%, #1a3a0e 60%, #0d260a 100%);
}

.map-preview-egypt {
    background:
        /* Пирамида / Pyramid */
        linear-gradient(175deg, transparent 48%, #c4a44a 48%, #c4a44a 52%, transparent 52%),
        /* Солнце / Sun */
        radial-gradient(circle at 80% 25%, #f5d44a 0%, #f5d44a 8%, transparent 10%),
        /* Пески / Sands */
        linear-gradient(180deg, #4a6a8a 0%, #6a4a2a 30%, #c4a44a 55%, #b8943a 70%, #8a6a2a 100%);
}

.map-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.map-desc {
    font-size: 13px;
    color: #aaa;
}

/* Убрана старая кнопка Start — карта выбирается кликом / Old start button removed — map is chosen by click */
.start-btn {
    padding: 15px 50px;
    font-size: 20px;
    font-family: 'Comfortaa', cursive;
    background: linear-gradient(135deg, #ff4444, #cc0000);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.4);
}

.start-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 25px rgba(255, 0, 0, 0.6);
}

/* === Между уровнями / Between levels === */
.level-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.95);
    z-index: 200;
    color: white;
    text-align: center;
}

.level-screen .level-quote {
    font-size: 22px;
    color: #ffaa44;
    margin-bottom: 30px;
    font-style: italic;
    max-width: 400px;
    line-height: 1.6;
}

.level-screen .level-number {
    font-size: 48px;
    color: #ff4444;
    text-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
    margin-bottom: 10px;
}

/* === Экран Game Over / Game Over screen === */
.gameover-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.9);
    z-index: 200;
    color: white;
    text-align: center;
}

.gameover-screen h2 {
    font-size: 36px;
    color: #ff4444;
    margin-bottom: 20px;
}

.gameover-screen .final-score {
    font-size: 24px;
    color: #ffaa44;
    margin-bottom: 30px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* === Мобильная адаптация / Mobile adaptation === */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
    }

    .heart-panel {
        width: 100%;
        min-width: unset;
        flex-direction: row;
        height: 80px;
        border-right: none;
        border-bottom: 2px solid #330000;
        padding: 8px 15px;
    }

    .heart-panel.egypt {
        border-bottom-color: #554400;
    }

    .heart-canvas-wrapper {
        width: 60px;
        height: 60px;
    }

    #heart-canvas {
        width: 60px;
        height: 60px;
    }

    .heart-percent {
        font-size: 20px;
        margin-bottom: 0;
        margin-right: 10px;
    }

    .heart-stats {
        margin-top: 0;
        margin-left: 15px;
        font-size: 11px;
        text-align: left;
    }

    .heart-stage {
        display: none;
    }

    .heart-level {
        display: none;
    }

    /* Выбор карты на мобильном / Map selection on mobile */
    .map-cards {
        flex-direction: column;
        align-items: center;
    }

    .map-card {
        width: 90%;
        flex-direction: row;
        padding: 12px;
        gap: 12px;
    }

    .map-preview {
        width: 100px;
        height: 70px;
        margin-bottom: 0;
    }

    .map-name {
        font-size: 15px;
    }

    .map-desc {
        font-size: 11px;
    }

    .start-screen h1 {
        font-size: 28px;
    }

    .start-screen .subtitle {
        font-size: 13px;
    }

    .start-screen .heart-icon {
        font-size: 50px;
    }

    .map-select-title {
        font-size: 17px;
    }
}

@media (max-width: 480px) {
    .heart-percent {
        font-size: 16px;
    }

    .heart-canvas-wrapper {
        width: 50px;
        height: 50px;
    }

    #heart-canvas {
        width: 50px;
        height: 50px;
    }
}
