/* ============================
   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: #1a1a2e;
    color: #fff;
    user-select: none;
    -webkit-user-select: none;
}

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

/* ===== 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, #5b7db5 0%, #3d5a8a 100%);
    border: 3px solid #7ba0d4;
    border-bottom: 5px solid #2c4570;
    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 3px 10px rgba(0,0,0,0.3);
    color: #fff;
}

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

.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 4px 12px rgba(0,0,0,0.3);
    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.3);
}

.next-btn {
    background: linear-gradient(180deg, #5eddbb 0%, #38b289 100%);
    border: 3px solid #80f0d0;
    border-bottom: 5px solid #1e5040;
}

.replay-btn {
    background: linear-gradient(180deg, #5b7db5 0%, #3d5a8a 100%);
    border: 3px solid #7ba0d4;
    border-bottom: 5px solid #2c4570;
}

.retry-btn {
    background: linear-gradient(180deg, #ffbe0b 0%, #fb8500 100%);
    border: 3px solid #ffd54f;
    border-bottom: 5px solid #b86e00;
}

.levels-btn {
    background: linear-gradient(180deg, #5b7db5 0%, #3d5a8a 100%);
    border: 3px solid #7ba0d4;
    border-bottom: 5px solid #2c4570;
}

/* ===== MAIN MENU ===== */
#menuScreen {
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    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, #3a4a6e 0%, #2a3a5e 100%);
    border: 2px solid #5a7aaa;
    border-bottom: 4px solid #1a2a40;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    z-index: 5;
}

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

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

/* ===== 3D LOGO ===== */
.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: #fff;
    text-shadow:
        0 4px 0 #2d6a4f,
        0 8px 0 #1b4332,
        0 12px 30px rgba(0,0,0,0.3),
        0 0 60px rgba(78, 204, 163, 0.3);
    animation: titleArrowFloat 3s ease-in-out infinite;
}

@keyframes titleArrowFloat {
    0%, 100% {
        transform: translateY(0) rotate(-0.5deg);
        text-shadow: 0 4px 0 #2d6a4f, 0 8px 0 #1b4332, 0 12px 30px rgba(0,0,0,0.3), 0 0 60px rgba(78,204,163,0.3);
    }
    50% {
        transform: translateY(-4px) rotate(0.5deg);
        text-shadow: 0 6px 0 #2d6a4f, 0 10px 0 #1b4332, 0 16px 40px rgba(0,0,0,0.3), 0 0 80px rgba(78,204,163,0.5);
    }
}

.title-escape {
    font-size: clamp(3rem, 12vw, 6.5rem);
    color: #ffbe0b;
    text-shadow:
        0 4px 0 #e08e00,
        0 8px 0 #b87300,
        0 12px 30px rgba(0,0,0,0.3),
        0 0 60px rgba(255, 190, 11, 0.3);
    margin-top: -0.15em;
    animation: titleEscapeFloat 3s ease-in-out infinite 0.3s;
}

@keyframes titleEscapeFloat {
    0%, 100% {
        transform: translateY(0) rotate(0.5deg) scale(1);
        text-shadow: 0 4px 0 #e08e00, 0 8px 0 #b87300, 0 12px 30px rgba(0,0,0,0.3), 0 0 60px rgba(255,190,11,0.3);
    }
    50% {
        transform: translateY(-3px) rotate(-0.5deg) scale(1.02);
        text-shadow: 0 6px 0 #e08e00, 0 12px 0 #b87300, 0 16px 40px rgba(0,0,0,0.3), 0 0 90px rgba(255,190,11,0.5);
    }
}

.game-title::after {
    content: '';
    display: block;
    width: 60%;
    height: 2px;
    margin: 6px auto 0;
    background: linear-gradient(90deg, transparent, rgba(78,204,163,0.5), rgba(255,190,11,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(255, 255, 255, 0.5);
    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, #5eddbb 0%, #38b289 100%);
    border: 3px solid #80f0d0;
    border-bottom: 6px solid #1e5040;
    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 4px 16px rgba(78, 204, 163, 0.4);
    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(78, 204, 163, 0.3);
}

@keyframes playBtnPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(78, 204, 163, 0.4); }
    50% { transform: scale(1.04); box-shadow: 0 6px 24px rgba(78, 204, 163, 0.6); }
}

.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: linear-gradient(180deg, #141e30 0%, #0a1018 100%);
    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(255,255,255,0.08); 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: #fff;
    letter-spacing: 0.12em;
}

.settings-section-label {
    font-family: 'Russo One', sans-serif;
    font-size: clamp(0.65rem, 1.8vw, 0.8rem);
    color: rgba(255, 255, 255, 0.4);
    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, #2e4a6e 0%, #1e3450 100%);
    border: 2px solid #4a7aaa;
    border-bottom: 4px solid #152540;
    cursor: pointer;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

.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: rgba(255, 255, 255, 0.8);
}

.toggle-switch {
    width: 50px;
    height: 28px;
    border-radius: 14px;
    background: linear-gradient(180deg, #3a2020 0%, #2a1515 100%);
    border: 2px solid #5a3030;
    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, #ff7070 0%, #cc4040 100%);
    border: 2px solid #ff9090;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: left 0.25s, background 0.25s, border-color 0.25s;
}

.settings-toggle-row.active .toggle-switch {
    background: linear-gradient(180deg, #1e5040 0%, #153830 100%);
    border-color: #3a8a6e;
}

.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, #253d5c 0%, #1a2e45 100%);
    border: 2px solid #3a6090;
    border-bottom: 3px solid #12202f;
    box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.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, #2a4060 0%, #3a5a80 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.35);
    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.35);
    cursor: pointer;
}

.slider-value {
    font-family: 'Poppins', sans-serif;
    font-size: clamp(0.75rem, 2vw, 0.9rem);
    font-weight: 700;
    color: #5eddbb;
    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(255,255,255,0.08); border-radius: 2px; }

.settings-lang-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    background: linear-gradient(180deg, #2e4a6e 0%, #1e3450 100%);
    border: 2px solid #4a7aaa;
    border-bottom: 4px solid #152540;
    cursor: pointer;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}

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

.settings-lang-item.active {
    background: linear-gradient(180deg, #3a8a6e 0%, #2a6a52 100%);
    border-color: #5cc8a0;
    border-bottom-color: #1e5040;
    box-shadow: 0 3px 12px rgba(78, 204, 163, 0.25);
}

.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: rgba(255, 255, 255, 0.8);
}

.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 #ff8080;
    border-bottom: 5px solid #8a2020;
    border-radius: 14px;
    background: linear-gradient(180deg, #e05555 0%, #c03030 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(0,0,0,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, #ff5555 0%, #dd2020 100%);
    border-color: #ffaaaa;
    animation: resetPulse 0.6s ease-in-out infinite alternate;
}

@keyframes resetPulse {
    from { box-shadow: 0 0 0 rgba(255, 71, 87, 0); }
    to { box-shadow: 0 0 16px rgba(255, 71, 87, 0.3); }
}

/* ===== LEVEL SELECT ===== */
#levelSelectScreen {
    padding: clamp(16px, 3vh, 24px) 16px;
    background: linear-gradient(180deg, #141e30 0%, #0a1018 100%);
}

.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: #fff;
    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(255,255,255,0.08); border-radius: 2px; }

/* ===== LEVEL CARD (Grid Tile) ===== */
.level-card {
    aspect-ratio: 1;
    border-radius: 16px;
    background: linear-gradient(180deg, #2e4a6e 0%, #1e3450 100%);
    border: 3px solid #4a7aaa;
    border-bottom: 5px solid #152540;
    cursor: pointer;
    transition: transform 0.1s, border-bottom-width 0.1s;
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
    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, #3a8a6e 0%, #2a6a52 100%);
    border-color: #5cc8a0;
    border-bottom-color: #1e5040;
    box-shadow: 0 3px 16px rgba(78, 204, 163, 0.35);
}

.level-card.completed {
    background: linear-gradient(180deg, #2e4a6e 0%, #1e3450 100%);
}

.level-card.locked {
    opacity: 0.4;
    cursor: not-allowed;
    background: linear-gradient(180deg, #222e3e 0%, #1a2230 100%);
    border-color: #3a4a5a;
    border-bottom-color: #111a24;
}

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

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

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

.level-card-check {
    color: #5eddbb;
    line-height: 1;
}

.level-card-lock {
    color: rgba(255,255,255,0.4);
    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(255, 255, 255, 0.15);
    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, #2e4a6e 0%, #1e3450 100%);
    border: 2px solid #4a7aaa;
    border-bottom: 3px solid #152540;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.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(255, 255, 255, 0.4);
    font-weight: 600;
}

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

/* ===== 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: #5eddbb;
    text-shadow: 0 2px 8px rgba(78, 204, 163, 0.5);
    pointer-events: none;
    white-space: nowrap;
}

.floating-text.negative {
    color: #ff6060;
    text-shadow: 0 2px 8px rgba(255, 96, 96, 0.5);
}

/* ===== OVERLAYS ===== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    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, #1e3450 0%, #152540 100%);
    border: 2px solid #4a7aaa;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.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: #ffbe0b;
    text-shadow: 0 2px 0 #b87300, 0 4px 12px rgba(255, 190, 11, 0.3);
}

.fail-title {
    color: #ff6060;
    text-shadow: 0 2px 0 #8a2020, 0 4px 12px rgba(255, 96, 96, 0.3);
}

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

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

.watch-ad-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
}

.watch-ad-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.watch-ad-close-btn:active {
    transform: scale(0.95);
}

.watch-ad-btn {
    background: linear-gradient(180deg, #4ecca3 0%, #2ba87f 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.watch-ad-btn:hover {
    background: linear-gradient(180deg, #5fd9b5 0%, #3cb896 100%);
    transform: translateY(-2px);
}

.watch-ad-btn:active {
    transform: translateY(0px);
}

/* ===== 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;
    }

    .settings-container {
        max-width: 460px;
    }
}
