/* ============================
   Arrow Escape - Mobile Game UI
   ============================ */

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    background:
        var(--app-bg-image) center center / cover no-repeat fixed;
    color: #1a1a2e;
    user-select: none;
    -webkit-user-select: none;
}

/* Button palette (light → dark): #ccdfff, #609CFF, #0C71DB, #133666 */
/* Next / win CTA (original green): #bff5d4, #3dd66f, #1fa855, #0f5c30 */
:root {
    /* Same folder as style.css: e.g. GAME/background.jpg or GAME/assets/background.png */
    --app-bg-image: url("assets/background.png");
    /* Wide screens (min-width: 768px): overridden from config.js (GameConfig.appBgDesktop*) */
    --app-bg-desktop-size: auto 100%;
    --app-bg-desktop-repeat: repeat;
    --btn-light: #ccdfff;
    --btn-mid-light: #609cff;
    --btn-mid-dark: #0c71db;
    --btn-dark: #133666;
    --next-btn-light: #bff5d4;
    --next-btn-mid-light: #3dd66f;
    --next-btn-mid-dark: #1fa855;
    --next-btn-dark: #0f5c30;
    /* Logo: chunky 3D blue — bright face + stacked down-right extrusion (minimal blur) */
    --logo-3d-face: #3f8dff;
    --logo-3d-e2: #1455c4;
    --logo-3d-e3: #0f459e;
    --logo-3d-e4: #0a336f;
    --logo-escape-face: #1a1a1a;
    --logo-escape-e2: #636363;
    --logo-escape-e3: #858585;
    --logo-escape-e4: #9e9e9e;
    --logo-escape-glow: rgb(255 255 255 / 28%);
    --logo-escape-glow-active: rgb(255 255 255 / 34%);
}

@media (min-width: 768px) {
    html,
    body,
    #menuScreen,
    #levelSelectScreen,
    #settingsScreen {
        background: var(--app-bg-image) 0 0 / var(--app-bg-desktop-size) var(--app-bg-desktop-repeat) fixed;
    }
}

/* ===== CANVAS ===== */
#gameCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    outline: none;
    touch-action: none;
    background: transparent;
}

/* ===== UI OVERLAY ===== */
#uiOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
}

#uiOverlay > * {
    pointer-events: auto;
}

/* ===== SCREENS ===== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
}

.screen.active {
    display: flex;
}

.hidden {
    display: none !important;
}

/* ===== COMMON BUTTONS ===== */
.back-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--btn-mid-light) 0%, var(--btn-mid-dark) 100%);
    border: 3px solid var(--btn-light);
    border-bottom: 5px solid var(--btn-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, border-bottom-width 0.1s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(12, 113, 219, 0.35);
    color: #fff;
}

.back-btn:active {
    transform: translateY(3px);
    border-bottom-width: 2px;
    box-shadow: 0 1px 4px rgba(12, 113, 219, 0.28);
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: clamp(12px, 2.5vh, 16px) clamp(24px, 6vw, 40px);
    border-radius: 14px;
    cursor: pointer;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    color: #fff;
    letter-spacing: 0.08em;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 3px 10px rgba(12, 113, 219, 0.22);
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 280px;
}

.menu-btn:active {
    transform: translateY(3px);
    border-bottom-width: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.next-btn {
    background: linear-gradient(180deg, var(--next-btn-mid-light) 0%, var(--next-btn-mid-dark) 100%);
    border: 3px solid var(--next-btn-light);
    border-bottom: 5px solid var(--next-btn-dark);
    box-shadow: 0 3px 10px rgba(31, 168, 85, 0.28);
}

.replay-btn {
    background: linear-gradient(180deg, var(--btn-mid-light) 0%, var(--btn-mid-dark) 100%);
    border: 3px solid var(--btn-light);
    border-bottom: 5px solid var(--btn-dark);
}

.retry-btn {
    background: linear-gradient(180deg, var(--btn-mid-light) 0%, var(--btn-mid-dark) 100%);
    border: 3px solid var(--btn-light);
    border-bottom: 5px solid var(--btn-dark);
}

.get-lives-btn {
    background: linear-gradient(180deg, var(--next-btn-mid-light) 0%, var(--next-btn-mid-dark) 100%);
    border: 3px solid var(--next-btn-light);
    border-bottom: 5px solid var(--next-btn-dark);
    box-shadow: 0 3px 10px rgba(31, 168, 85, 0.28);
    gap: 10px;
    align-items: center;
}

.get-lives-icon-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.get-lives-icon.hidden,
.get-lives-timer.hidden {
    display: none;
}

.get-lives-timer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.get-lives-loader {
    width: 100%;
    height: 100%;
    display: block;
}

.get-lives-loader-track,
.get-lives-loader-ring {
    fill: none;
    stroke-width: 2;
}

.get-lives-loader-track {
    stroke: rgba(255, 255, 255, 0.35);
}

.get-lives-loader-spin {
    transform-origin: 12px 12px;
    animation: getLivesLoaderSpin 0.9s linear infinite;
}

.get-lives-loader-ring {
    stroke: #fff;
    stroke-linecap: round;
    stroke-dasharray: 16 40.5;
}

.get-lives-timer-num {
    fill: #fff;
    font-family: 'Russo One', sans-serif;
    font-size: 7px;
    font-weight: 400;
    letter-spacing: 0;
    pointer-events: none;
}

@keyframes getLivesLoaderSpin {
    to {
        transform: rotate(360deg);
    }
}

.get-lives-btn.is-countdown {
    opacity: 0.9;
    cursor: wait;
}

.levels-btn {
    background: linear-gradient(180deg, var(--btn-mid-light) 0%, var(--btn-mid-dark) 100%);
    border: 3px solid var(--btn-light);
    border-bottom: 5px solid var(--btn-dark);
}

/* ===== MAIN MENU ===== */
#menuScreen {
    justify-content: flex-start;
    /* Wallpaper comes from html/body (+ 768px media); keeps config-driven bg in sync */
    background: transparent;
    overflow: hidden;
}

.menu-settings-btn {
    position: absolute;
    top: clamp(12px, 3vh, 24px);
    right: clamp(12px, 3vw, 24px);
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--btn-light) 0%, var(--btn-mid-light) 100%);
    border: 2px solid var(--btn-light);
    border-bottom: 4px solid var(--btn-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 2px 8px rgba(19, 54, 102, 0.22);
    z-index: 5;
    color: var(--btn-dark);
}

.menu-settings-btn svg path {
    fill: currentColor;
}

.menu-settings-btn:active {
    transform: translateY(3px);
    border-bottom-width: 2px;
}

.menu-logo-wrap {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-shrink: 0;
    z-index: 1;
}

.menu-logo-img {
    width: 45%;
    height: auto;
    aspect-ratio: 1/1;
    object-fit: contain;
    display: block;
    margin-bottom: 20px;
    border-radius: 20px;
    filter: drop-shadow(0 10px 24px rgba(6, 40, 100, 0.18));
}

.menu-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 0;
    gap: clamp(1rem, 3vh, 2rem);
    position: relative;
    z-index: 1;
}

/* ===== 3D LOGO (text) ===== */
.game-title {
    line-height: 1;
    position: relative;
}

.title-line {
    font-family: 'Russo One', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.title-arrow {
    font-size: clamp(2.5rem, 10vw, 5.5rem);
    color: var(--logo-3d-face);
    text-shadow:
        1px 1px 0 var(--logo-3d-e2),
        2px 2px 0 var(--logo-3d-e2),
        3px 3px 0 var(--logo-3d-e3),
        4px 4px 0 var(--logo-3d-e3),
        5px 5px 0 var(--logo-3d-e4),
        6px 6px 0 var(--logo-3d-e4),
        6px 10px 22px rgba(6, 40, 100, 0.32);
    animation: titleArrowFloat 3s ease-in-out infinite;
}

@keyframes titleArrowFloat {
    0%, 100% {
        transform: translateY(0) rotate(-0.5deg);
        text-shadow:
            1px 1px 0 var(--logo-3d-e2),
            2px 2px 0 var(--logo-3d-e2),
            3px 3px 0 var(--logo-3d-e3),
            4px 4px 0 var(--logo-3d-e3),
            5px 5px 0 var(--logo-3d-e4),
            6px 6px 0 var(--logo-3d-e4),
            6px 10px 22px rgba(6, 40, 100, 0.32);
    }
    50% {
        transform: translateY(-4px) rotate(0.5deg);
        text-shadow:
            2px 2px 0 var(--logo-3d-e2),
            3px 3px 0 var(--logo-3d-e2),
            4px 4px 0 var(--logo-3d-e3),
            5px 5px 0 var(--logo-3d-e3),
            6px 6px 0 var(--logo-3d-e4),
            7px 7px 0 var(--logo-3d-e4),
            7px 12px 26px rgba(6, 40, 100, 0.36);
    }
}

.title-escape {
    font-size: clamp(3rem, 12vw, 6.5rem);
    color: var(--logo-escape-face);
    text-shadow:
        1px 1px 0 var(--logo-escape-e2),
        2px 2px 0 var(--logo-escape-e2),
        3px 3px 0 var(--logo-escape-e3),
        4px 4px 0 var(--logo-escape-e3),
        5px 5px 0 var(--logo-escape-e4),
        6px 6px 0 var(--logo-escape-e4),
        6px 10px 22px var(--logo-escape-glow);
    margin-top: -0.15em;
    animation: titleEscapeFloat 3s ease-in-out infinite 0.3s;
}

.title-game {
    font-size: clamp(1.6rem, 6vw, 3.4rem);
    color: var(--logo-3d-face);
    text-shadow:
        1px 1px 0 var(--logo-3d-e2),
        2px 2px 0 var(--logo-3d-e2),
        3px 3px 0 var(--logo-3d-e3),
        4px 4px 0 var(--logo-3d-e3),
        5px 5px 0 var(--logo-3d-e4),
        6px 6px 0 var(--logo-3d-e4),
        6px 10px 22px rgba(6, 40, 100, 0.32);
    margin-top: -0.05em;
    animation: titleGameFloat 3s ease-in-out infinite 0.45s;
}

@keyframes titleEscapeFloat {
    0%, 100% {
        transform: translateY(0) rotate(0.5deg) scale(1);
        text-shadow:
            1px 1px 0 var(--logo-escape-e2),
            2px 2px 0 var(--logo-escape-e2),
            3px 3px 0 var(--logo-escape-e3),
            4px 4px 0 var(--logo-escape-e3),
            5px 5px 0 var(--logo-escape-e4),
            6px 6px 0 var(--logo-escape-e4),
            6px 10px 22px var(--logo-escape-glow);
    }
    50% {
        transform: translateY(-3px) rotate(-0.5deg) scale(1.02);
        text-shadow:
            2px 2px 0 var(--logo-escape-e2),
            3px 3px 0 var(--logo-escape-e2),
            4px 4px 0 var(--logo-escape-e3),
            5px 5px 0 var(--logo-escape-e3),
            6px 6px 0 var(--logo-escape-e4),
            7px 7px 0 var(--logo-escape-e4),
            7px 12px 26px var(--logo-escape-glow-active);
    }
}

@keyframes titleGameFloat {
    0%, 100% {
        transform: translateY(0) rotate(-0.25deg) scale(1);
        text-shadow:
            1px 1px 0 var(--logo-3d-e2),
            2px 2px 0 var(--logo-3d-e2),
            3px 3px 0 var(--logo-3d-e3),
            4px 4px 0 var(--logo-3d-e3),
            5px 5px 0 var(--logo-3d-e4),
            6px 6px 0 var(--logo-3d-e4),
            6px 10px 22px rgba(6, 40, 100, 0.32);
    }
    50% {
        transform: translateY(-2px) rotate(0.25deg) scale(1.01);
        text-shadow:
            2px 2px 0 var(--logo-3d-e2),
            3px 3px 0 var(--logo-3d-e2),
            4px 4px 0 var(--logo-3d-e3),
            5px 5px 0 var(--logo-3d-e3),
            6px 6px 0 var(--logo-3d-e4),
            7px 7px 0 var(--logo-3d-e4),
            7px 12px 26px rgba(6, 40, 100, 0.36);
    }
}

.game-title::after {
    content: '';
    display: block;
    width: 60%;
    height: 2px;
    margin: 6px auto 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(63, 141, 255, 0.55),
        rgba(15, 69, 158, 0.5),
        transparent
    );
    border-radius: 2px;
    animation: titleUnderGlow 2.5s ease-in-out infinite;
}

@keyframes titleUnderGlow {
    0%, 100% { opacity: 0.3; width: 50%; }
    50% { opacity: 0.8; width: 70%; }
}

.menu-subtitle {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    color: rgba(30, 41, 59, 0.55);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

/* ===== PLAY BUTTON ===== */
.play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: clamp(14px, 3vh, 18px) clamp(36px, 10vw, 60px);
    border-radius: 16px;
    background: linear-gradient(180deg, var(--next-btn-mid-light) 0%, var(--next-btn-mid-dark) 100%);
    border: 3px solid var(--next-btn-light);
    border-bottom: 5px solid var(--next-btn-dark);
    cursor: pointer;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    color: #fff;
    letter-spacing: 0.12em;
    box-shadow: 0 3px 10px rgba(31, 168, 85, 0.28);
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.1s, border-bottom-width 0.1s;
    position: relative;
    overflow: hidden;
    animation: playBtnPulse 2s ease-in-out infinite;
}

.play-btn:active {
    transform: translateY(4px);
    border-bottom-width: 2px;
    animation: none;
    box-shadow: 0 1px 6px rgba(31, 168, 85, 0.35);
}

@keyframes playBtnPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 3px 10px rgba(31, 168, 85, 0.28); }
    50% { transform: scale(1.04); box-shadow: 0 6px 20px rgba(61, 214, 111, 0.45); }
}

.play-btn-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    animation: btnShine 3s ease-in-out infinite;
    pointer-events: none;
}

@keyframes btnShine {
    0%, 70%, 100% { left: -100%; }
    30% { left: 150%; }
}

.play-icon {
    flex-shrink: 0;
}

/* ===== SETTINGS SCREEN ===== */
#settingsScreen {
    display: flex;
    background: var(--app-bg-image) center center / cover no-repeat fixed;
    z-index: 150;
    flex-direction: column;
}

.settings-container {
    width: 90%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: clamp(12px, 2vh, 20px);
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.settings-container::-webkit-scrollbar { width: 3px; }
.settings-container::-webkit-scrollbar-track { background: transparent; }
.settings-container::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 2px; }

.settings-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-title {
    flex: 1;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    color: #1e293b;
    letter-spacing: 0.12em;
}

.settings-section-label {
    font-family: 'Russo One', sans-serif;
    font-size: clamp(0.65rem, 1.8vw, 0.8rem);
    color: rgba(30, 41, 59, 0.45);
    letter-spacing: 0.2em;
}

/* ===== TOGGLE SWITCHES ===== */
.settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border: 2px solid #cbd5e1;
    border-bottom: 4px solid #94a3b8;
    cursor: pointer;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.settings-toggle-row:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.toggle-icon {
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.toggle-label {
    flex: 1;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 600;
    color: #1e293b;
}

.toggle-switch {
    width: 50px;
    height: 28px;
    border-radius: 14px;
    background: linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
    border: 2px solid #94a3b8;
    position: relative;
    flex-shrink: 0;
    transition: background 0.25s, border-color 0.25s;
}

.toggle-switch .toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    background: linear-gradient(180deg, #f87171 0%, #dc2626 100%);
    border: 2px solid #fecaca;
    box-shadow: 0 2px 4px rgba(0,0,0,0.12);
    transition: left 0.25s, background 0.25s, border-color 0.25s;
}

.settings-toggle-row.active .toggle-switch {
    background: linear-gradient(180deg, #d1fae5 0%, #a7f3d0 100%);
    border-color: #34d399;
}

.settings-toggle-row.active .toggle-switch .toggle-knob {
    left: 24px;
    background: linear-gradient(180deg, #5eddbb 0%, #38b289 100%);
    border-color: #80f0d0;
}

/* ===== VOLUME SLIDER ===== */
.settings-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border: 2px solid #cbd5e1;
    border-bottom: 3px solid #94a3b8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.slider-icon {
    flex-shrink: 0;
    width: 22px;
    text-align: center;
}

.volume-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e2e8f0 0%, #cbd5e1 100%);
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(180deg, #5eddbb 0%, #38b289 100%);
    border: 2px solid #80f0d0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(180deg, #5eddbb 0%, #38b289 100%);
    border: 2px solid #80f0d0;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    cursor: pointer;
}

.slider-value {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    font-weight: 700;
    color: #0f766e;
    min-width: 36px;
    text-align: right;
}

/* ===== LANGUAGE LIST ===== */
.settings-lang-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 40vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
}

.settings-lang-list::-webkit-scrollbar { width: 3px; }
.settings-lang-list::-webkit-scrollbar-track { background: transparent; }
.settings-lang-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 2px; }

.settings-lang-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border: 2px solid #cbd5e1;
    border-bottom: 4px solid #94a3b8;
    cursor: pointer;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.settings-lang-item:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.settings-lang-item.active {
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #34d399;
    border-bottom-color: #059669;
    box-shadow: 0 3px 12px rgba(16, 185, 129, 0.2);
}

.settings-lang-flag {
    font-size: 1.4rem;
    line-height: 1;
    flex-shrink: 0;
}

.settings-lang-name {
    flex: 1;
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 600;
    color: #1e293b;
}

.settings-lang-check {
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
    line-height: 1;
}

.settings-lang-item.active .settings-lang-check {
    opacity: 1;
}

/* ===== RESET BUTTON ===== */
.settings-reset-btn {
    width: 100%;
    padding: 14px 20px;
    border: 3px solid var(--btn-light);
    border-bottom: 5px solid var(--btn-dark);
    border-radius: 14px;
    background: linear-gradient(180deg, var(--btn-mid-light) 0%, var(--btn-mid-dark) 100%);
    cursor: pointer;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(0.8rem, 2.2vw, 0.95rem);
    color: #fff;
    letter-spacing: 0.08em;
    transition: transform 0.1s, border-bottom-width 0.1s;
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(12, 113, 219, 0.3);
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.settings-reset-btn:active {
    transform: translateY(3px);
    border-bottom-width: 2px;
}

.settings-reset-btn.confirming {
    background: linear-gradient(180deg, var(--btn-mid-light) 0%, var(--btn-mid-dark) 100%);
    border-color: var(--btn-light);
    animation: resetPulse 0.6s ease-in-out infinite alternate;
}

@keyframes resetPulse {
    from { box-shadow: 0 0 0 rgba(12, 113, 219, 0); }
    to { box-shadow: 0 0 16px rgba(12, 113, 219, 0.45); }
}

/* ===== LEVEL SELECT ===== */
#levelSelectScreen {
    padding: clamp(16px, 3vh, 24px) 16px;
    background: transparent;
}

.ls-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 420px;
    margin-bottom: clamp(12px, 2vh, 20px);
}

.ls-title {
    flex: 1;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(1.1rem, 3.5vw, 1.5rem);
    color: #1e293b;
    letter-spacing: 0.1em;
}

.ls-spacer {
    width: 48px;
}

.ls-scroller {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    max-width: 420px;
    padding: 0 4px 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    align-content: start;
}

.ls-scroller::-webkit-scrollbar { width: 3px; }
.ls-scroller::-webkit-scrollbar-track { background: transparent; }
.ls-scroller::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 2px; }

/* ===== LEVEL CARD (Grid Tile) ===== */
.level-card {
    aspect-ratio: 1;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border: 3px solid #cbd5e1;
    border-bottom: 5px solid #94a3b8;
    cursor: pointer;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
}

.level-card:active {
    transform: translateY(3px);
    border-bottom-width: 2px;
}

.level-card.current {
    background: linear-gradient(180deg, #ecfdf5 0%, #d1fae5 100%);
    border-color: #34d399;
    border-bottom-color: #059669;
    box-shadow: 0 3px 16px rgba(16, 185, 129, 0.2);
}

.level-card.completed {
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
}

.level-card.locked {
    opacity: 0.45;
    cursor: not-allowed;
    background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
    border-color: #cbd5e1;
    border-bottom-color: #94a3b8;
}

.level-card.locked:active {
    transform: none;
}

.level-card-number {
    font-family: 'Russo One', sans-serif;
    font-size: clamp(1.2rem, 4vw, 1.6rem);
    color: #1e293b;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
    line-height: 1;
}

.level-card.current .level-card-number {
    color: #065f46;
}

.level-card-check {
    color: #0d9488;
    line-height: 1;
}

.level-card-lock {
    color: rgba(30, 41, 59, 0.35);
    line-height: 1;
}

/* ===== GAME HUD ===== */
#gameHUD {
    pointer-events: none;
    padding: clamp(12px, 2vh, 20px) 16px;
}

#gameHUD > * {
    pointer-events: auto;
}

.hud-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.hud-btn {
    pointer-events: auto;
}

/* Level Badge */
.level-badge {
    background: linear-gradient(180deg, #ffbe0b 0%, #fb8500 100%);
    padding: 6px 20px;
    border-radius: 30px;
    border: 2px solid #ffd54f;
    border-bottom: 3px solid #b86e00;
    box-shadow: 0 3px 10px rgba(255, 190, 11, 0.3);
}

.level-badge-text {
    font-family: 'Russo One', sans-serif;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    color: #5a3000;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.3);
    letter-spacing: 0.05em;
}

/* Hearts */
.hearts-container {
    display: flex;
    gap: 4px;
}

.heart {
    color: #ff4d6d;
    filter: drop-shadow(0 2px 4px rgba(255, 77, 109, 0.4));
    transition: transform 0.2s;
    display: inline-flex;
    align-items: center;
}

.heart.pulse {
    animation: heartPulse 0.8s ease-in-out infinite;
}

.heart.empty {
    color: rgba(30, 41, 59, 0.2);
    filter: none;
}

.heart.breaking {
    animation: heartBreak 0.5s ease-out forwards;
}

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

@keyframes heartBreak {
    0% { transform: scale(1); opacity: 1; }
    30% { transform: scale(1.4); opacity: 1; color: #ff0000; }
    100% { transform: scale(0) rotate(20deg); opacity: 0; }
}

/* HUD Bottom */
.hud-bottom {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    align-items: center;
}

.hud-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 16px;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border: 2px solid #cbd5e1;
    border-bottom: 3px solid #94a3b8;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.hud-stat-label {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.55rem, 1.5vw, 0.65rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(30, 41, 59, 0.5);
    font-weight: 600;
}

.hud-stat-value {
    font-family: 'Russo One', sans-serif;
    font-size: clamp(1rem, 3vw, 1.3rem);
    color: #1e293b;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ===== FLOATING TEXT ===== */
#floatingTextContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.floating-text {
    position: absolute;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    color: #0f766e;
    text-shadow: 0 1px 0 rgba(255,255,255,0.9), 0 2px 6px rgba(15, 118, 110, 0.25);
    pointer-events: none;
    white-space: nowrap;
}

.floating-text.negative {
    color: #dc2626;
    text-shadow: 0 1px 0 rgba(255,255,255,0.9), 0 2px 6px rgba(220, 38, 38, 0.25);
}

/* ===== OVERLAYS ===== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.35);
    z-index: 20;
}

.overlay.active {
    display: flex;
}

.overlay-panel {
    width: 90%;
    max-width: 380px;
    padding: clamp(28px, 5vh, 40px) clamp(20px, 4vw, 32px);
    text-align: center;
    position: relative;
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 2px solid #e2e8f0;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
}

.overlay-title {
    font-family: 'Russo One', sans-serif;
    font-size: clamp(1.3rem, 4.5vw, 1.8rem);
    margin-bottom: 16px;
    letter-spacing: 0.08em;
}

.victory-title {
    color: #b45309;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8), 0 2px 8px rgba(180, 83, 9, 0.2);
}

.fail-title {
    color: #dc2626;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8), 0 2px 8px rgba(220, 38, 38, 0.2);
}

.overlay-subtitle {
    color: rgba(30, 41, 59, 0.6);
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    font-weight: 600;
    margin-bottom: 24px;
}

#levelFailedOverlay .overlay-subtitle {
    margin-bottom: 14px;
}

.fail-reward-heart {
    display: flex;
    justify-content: center;
    margin-bottom: 22px;
}

.fail-reward-heart-circle {
    position: relative;
    width: clamp(92px, 24vw, 108px);
    height: clamp(92px, 24vw, 108px);
    border-radius: 50%;
    background: #eceff4;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fail-reward-heart-circle .heart.fail-reward-heart-icon {
    color: #ff4d6d;
    filter: drop-shadow(0 2px 4px rgba(255, 77, 109, 0.4));
}

.fail-reward-heart-circle .heart.fail-reward-heart-icon svg {
    width: clamp(44px, 12vw, 52px);
    height: clamp(44px, 12vw, 52px);
}

.fail-reward-heart-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(180deg, #4da6ff 0%, #1a84e8 100%);
    border: 3px solid #fff;
    color: #fff;
    font-family: 'Russo One', sans-serif;
    font-size: 12px;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.overlay-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

/* ===== CONFETTI ===== */
#confettiContainer, #confettiContainer2 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    top: -10px;
}

/* ===== TUTORIAL ===== */
.tutorial-tooltip {
    position: absolute;
    bottom: 30%;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffbe0b 0%, #fb8500 100%);
    border: 2px solid #ffd54f;
    border-bottom: 3px solid #b86e00;
    color: #5a3000;
    font-family: 'Russo One', sans-serif;
    font-size: clamp(0.75rem, 2.5vw, 0.9rem);
    display: none;
    box-shadow: 0 4px 16px rgba(255, 190, 11, 0.4);
    z-index: 15;
    white-space: nowrap;
    text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}

.tutorial-tooltip.active {
    display: block;
}

.tooltip-arrow-indicator {
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #fb8500;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 360px) {
    .level-card-number {
        width: 38px;
        height: 38px;
    }

    .heart svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 320px) {
    .ls-scroller {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 500px) {
    .ls-scroller {
        grid-template-columns: repeat(5, 1fr);
        max-width: 500px;
    }
}

@media (min-width: 768px) {
    .ls-scroller {
        max-width: 500px;
    }
    .menu-logo-img{
        margin-bottom: 40px;
    }
    .settings-container {
        max-width: 460px;
    }
}
