*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
    -webkit-user-drag: none !important;
    user-drag: none !important;
    -webkit-touch-callout: none !important;
}

#game-canvas {
    touch-action: none;
    -webkit-user-select: none !important;
    user-select: none !important;
    outline: none;
}

img {
    -webkit-user-drag: none !important;
    user-drag: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    pointer-events: none;
}

button, .btn, .action-btn, .icon-btn, .weapon-slot {
    touch-action: manipulation !important;
    pointer-events: auto !important;
    cursor: pointer;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #0b0c10;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #e0e6ed;
}

#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #08090d;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
}

/* TOP HUD */
#hud-top {
    position: absolute;
    top: 4px;
    top: max(2px, env(safe-area-inset-top));
    left: 8px;
    right: 8px;
    width: auto;
    max-width: calc(100vw - 16px);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
    gap: 8px;
}

.hud-card {
    background: rgba(16, 20, 30, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 8px 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
    flex-shrink: 0;
    white-space: nowrap;
}

.hud-left-group {
    display: flex;
    flex-direction: row;
    gap: 8px;
    align-items: flex-start;
    flex-shrink: 0;
    white-space: nowrap;
}

.hud-wave-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
    flex-shrink: 0;
}

.wave-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 130px;
    flex-shrink: 0;
}

.timer-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    padding: 8px 14px;
    flex-shrink: 0;
}

.timer-val {
    color: #00e5ff;
    font-size: 21px;
    font-family: 'Consolas', 'Courier New', monospace;
    letter-spacing: 1.5px;
    text-shadow: 0 0 12px rgba(0, 229, 255, 0.7);
}

.hud-label {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #8fa3bf;
    text-transform: uppercase;
}

.hud-val {
    font-size: 22px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 75, 75, 0.5);
}

.hud-sub {
    font-size: 11px;
    color: #00e5ff;
    white-space: nowrap;
}

.hud-center-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
    white-space: nowrap;
}

.hud-settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.center-card {
    width: 360px;
    min-width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
}

.hud-bars-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.hero-avatar-box {
    width: 52px;
    height: 52px;
    min-width: 52px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.3) 0%, rgba(15, 23, 42, 0.98) 100%);
    border: 2.5px solid #00e5ff;
    box-shadow: 0 0 14px rgba(0, 229, 255, 0.6), inset 0 0 10px rgba(0, 0, 0, 0.9);
    overflow: hidden;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    flex-shrink: 0;
}

.hero-avatar-img {
    width: 250px;
    height: 250px;
    object-fit: contain;
    object-position: top center;
    margin-top: -10px;
    filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.8));
    pointer-events: none;
}

.wall-hp-container, .player-hp-container {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wall-hp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #c5d1e0;
    white-space: nowrap !important;
    gap: 8px;
}

.bar-bg {
    width: 100%;
    height: 9px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.bar-fill {
    height: 100%;
    width: 100%;
    border-radius: 6px;
    transition: width 0.2s ease-out;
}

.hp-bar-walls {
    background: linear-gradient(90deg, #00b0ff, #00e5ff);
    box-shadow: 0 0 10px rgba(0, 229, 255, 0.6);
}

.hp-bar-player {
    background: linear-gradient(90deg, #ff3d00, #ff1744);
    box-shadow: 0 0 10px rgba(255, 23, 68, 0.6);
}

.hud-right-group {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.no-ads-btn {
    width: 53px;
    height: 53px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    pointer-events: auto;
    user-select: none;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    animation: noAdsPulse 1.8s infinite ease-in-out;
}

.no-ads-btn:hover {
    transform: scale(1.14);
}

.no-ads-btn.hidden {
    display: none !important;
}

.no-ads-icon {
    width: 53px;
    height: 53px;
    object-fit: contain;
    filter: drop-shadow(0 0 4px rgba(255, 23, 68, 0.5));
}

@keyframes noAdsPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 3px rgba(255, 23, 68, 0.35));
    }
    50% {
        transform: scale(1.09);
        filter: drop-shadow(0 0 10px rgba(255, 23, 68, 0.75)) drop-shadow(0 0 3px #ff1744);
    }
}

.hud-setting-btn {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: rgba(14, 20, 34, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(0, 229, 255, 0.4);
    font-size: 22px;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #ffffff;
    padding: 0;
    pointer-events: auto;
    user-select: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px rgba(0, 229, 255, 0.2);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    flex-shrink: 0;
}

.hud-setting-btn:hover {
    transform: translateY(-2px) scale(1.06);
    border-color: #00e5ff;
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.4);
    background: rgba(22, 32, 54, 0.95);
}

.hud-setting-btn:active {
    transform: translateY(1px) scale(0.95);
}

.music-toggle-btn {
    border-color: rgba(0, 229, 255, 0.5);
}

.music-mic-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.8));
    opacity: 1;
    transition: opacity 0.25s ease, filter 0.25s ease;
}

/* When Remix / No-Words mode is active, mic is dimmed and semi-transparent */
.music-toggle-btn.remix-mode {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    background: rgba(14, 20, 34, 0.75);
}

.music-toggle-btn.remix-mode .music-mic-icon {
    opacity: 0.38;
    filter: grayscale(0.6) drop-shadow(0 0 2px rgba(255, 255, 255, 0.2));
}

.coins-card {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 130px;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.coins-card:hover {
    border-color: rgba(255, 214, 0, 0.6);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), 0 0 14px rgba(255, 214, 0, 0.35);
    transform: translateY(-1px);
}

.coins-display {
    display: flex;
    align-items: center;
    gap: 6px;
}

.coins-display .hud-val {
    color: #ffd600;
    text-shadow: 0 0 10px rgba(255, 214, 0, 0.5);
}

.coin-plus-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-left: 4px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd600, #ff9100);
    color: #0b0c10;
    font-size: 19px;
    font-weight: 900;
    line-height: 1;
    border: 1.5px solid #ffffff;
    box-shadow: 0 0 10px rgba(255, 214, 0, 0.7);
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
    animation: plusBtnPulse 2s infinite ease-in-out;
}

.coin-plus-btn:hover {
    transform: scale(1.18);
    box-shadow: 0 0 16px rgba(255, 214, 0, 1), 0 0 6px #ffffff;
}

.coin-plus-btn:active {
    transform: scale(0.92);
}

@keyframes plusBtnPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 8px rgba(255, 214, 0, 0.6);
    }
    50% {
        transform: scale(1.09);
        box-shadow: 0 0 14px rgba(255, 214, 0, 0.95), 0 0 6px rgba(255, 255, 255, 0.8);
    }
}

.score-display {
    font-size: 11px;
    color: #a0aec0;
}

/* SIDE ACTIONS & UNIFIED COLLAPSIBLE SHOP CARD */
#side-actions {
    position: absolute;
    top: 86px;
    right: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    z-index: 25;
    pointer-events: none;
}

.side-shop-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    background: rgba(14, 20, 34, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-right: none;
    border-radius: 16px 0 0 16px;
    box-shadow: -6px 8px 28px rgba(0, 0, 0, 0.65), 0 0 16px rgba(0, 229, 255, 0.15);
    transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1);
    pointer-events: auto;
    overflow: hidden;
}

.shop-toggle-handle {
    background: rgba(20, 28, 48, 0.95);
    border: none;
    border-right: 1px solid rgba(0, 229, 255, 0.25);
    color: #00e5ff;
    width: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
    user-select: none;
}

.shop-toggle-handle:hover {
    background: rgba(0, 229, 255, 0.2);
    color: #ffffff;
}

.shop-toggle-handle .toggle-icon {
    font-size: 14px;
    font-weight: 900;
    display: inline-block;
}

#side-actions.shop-collapsed .action-btn {
    min-width: auto;
    padding: 6px 8px;
    gap: 8px;
    border-radius: 14px;
}

#side-actions.shop-collapsed .btn-info {
    display: none !important;
}

#side-actions.shop-collapsed .btn-price {
    font-size: 11px;
    padding: 3px 6px;
}

.shop-items-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px 10px 8px 8px;
    transition: all 0.25s ease;
}

.action-btn {
    background: rgba(22, 30, 50, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-width: 220px;
}

.action-btn:hover {
    transform: translateY(-2px);
    border-color: #00e5ff;
    background: rgba(30, 42, 70, 0.95);
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.3);
}

.action-btn:active {
    transform: translateY(1px);
}

.btn-icon {
    width: 36px;
    height: 36px;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 0 6px rgba(0, 230, 118, 0.6));
}

.action-icon-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.key-hint {
    position: absolute;
    bottom: -2px;
    right: -3px;
    background: linear-gradient(135deg, rgba(14, 22, 38, 0.96), rgba(8, 12, 22, 0.98));
    color: #00e5ff;
    font-size: 9.5px;
    font-weight: 900;
    font-family: 'Consolas', 'Courier New', monospace;
    line-height: 1;
    padding: 1.5px 3.5px;
    border-radius: 4px;
    border: 1px solid rgba(0, 229, 255, 0.65);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 0 6px rgba(0, 229, 255, 0.4);
    text-shadow: 0 0 4px rgba(0, 229, 255, 0.8);
    pointer-events: none;
    user-select: none;
    z-index: 5;
}

.btn-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1;
    gap: 1px;
}

.btn-title {
    font-size: 12px;
    font-weight: 800;
    color: #ffffff;
}

.btn-subtext {
    font-size: 10px;
    color: #8fa3bf;
}

.btn-badge {
    font-size: 10px;
    font-weight: 800;
    color: #00e676;
}

.btn-price {
    font-size: 11.5px;
    font-weight: 800;
    background: rgba(255, 214, 0, 0.15);
    color: #ffd600;
    padding: 4px 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 214, 0, 0.35);
    white-space: nowrap;
    flex-shrink: 0;
}



.icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(18, 24, 38, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    font-size: 20px;
    line-height: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #ffffff;
    pointer-events: auto;
    user-select: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.flag-icon {
    width: 26px;
    height: 18px;
    border-radius: 3px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    display: block;
    pointer-events: none;
    overflow: hidden;
}

/* ZOOM CONTROLS WIDGET (Directly under Wave Card) */
#zoom-controls {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(14, 20, 34, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 12px;
    padding: 3px 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6), 0 0 10px rgba(0, 229, 255, 0.15);
    z-index: 20;
    pointer-events: auto;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

.zoom-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 14px;
    padding: 2px 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #00e5ff;
    font-size: 11.5px;
    font-weight: 900;
    cursor: pointer;
    transition: all 0.15s ease;
}

.zoom-btn:hover {
    background: rgba(0, 229, 255, 0.25);
    border-color: #00e5ff;
    transform: scale(1.06);
}

.zoom-btn:active {
    transform: scale(0.94);
}

.zoom-indicator {
    color: #ffffff;
    font-size: 11px;
    font-weight: 800;
    font-family: 'Consolas', 'Courier New', monospace;
    padding: 0 3px;
    min-width: 28px;
    text-align: center;
    text-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
}

/* BOTTOM HOTBAR */
#hotbar-container {
    position: absolute;
    bottom: 8px;
    bottom: max(6px, env(safe-area-inset-bottom));
    left: 4px;
    right: 4px;
    z-index: 25;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}

#hotbar-container.hotbar-collapsed {
    transform: translateY(calc(100% - 22px));
}

.hotbar-toggle-btn {
    pointer-events: auto;
    background: rgba(10, 14, 24, 0.94);
    border: 1px solid rgba(0, 229, 255, 0.5);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    color: #00e5ff;
    font-size: 12px;
    font-weight: 900;
    padding: 2px 18px;
    cursor: pointer;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.6);
    transition: all 0.2s ease;
    margin-bottom: -1px;
}

.hotbar-toggle-btn:hover {
    background: rgba(0, 229, 255, 0.25);
    color: #ffffff;
}

.btn-subtext {
    font-size: 9.5px;
    color: #00e5ff;
    font-weight: 700;
    margin-top: -2px;
}

.hotbar-items {
    display: flex;
    gap: clamp(2px, 0.5vw, 6px);
    overflow: hidden;
    width: 100%;
    max-width: min(99vw, 1140px);
    padding: clamp(3px, 0.6vh, 6px) clamp(4px, 0.8vw, 10px);
    background: rgba(10, 14, 24, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0, 229, 255, 0.35);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 229, 255, 0.15);
    pointer-events: auto;
    justify-content: center;
    box-sizing: border-box;
}

.weapon-slot {
    flex: 1 1 0;
    min-width: 0;
    max-width: 105px;
    height: clamp(52px, 11.5vh, 94px);
    background: radial-gradient(circle at 50% 35%, rgba(30, 42, 68, 0.95) 0%, rgba(14, 18, 28, 0.98) 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    border-radius: clamp(6px, 1.2vw, 12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: clamp(1px, 0.3vh, 3px) clamp(1px, 0.3vw, 4px) clamp(2px, 0.5vh, 5px) clamp(1px, 0.3vw, 4px);
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease-out;
    box-sizing: border-box;
    overflow: hidden;
}

.weapon-slot:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 229, 255, 0.7);
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.3);
}

.weapon-slot.active {
    border-color: #00e5ff;
    background: radial-gradient(circle at 50% 35%, rgba(0, 229, 255, 0.28) 0%, rgba(14, 25, 42, 0.98) 100%);
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.6);
    transform: translateY(-3px);
}

.weapon-slot.locked {
    opacity: 0.7;
    filter: grayscale(0.3);
}

.weapon-slot.locked:hover {
    opacity: 0.95;
    filter: none;
}

.slot-num {
    position: absolute;
    top: 1px;
    left: 3px;
    font-size: clamp(7px, 1.1vw, 9.5px);
    font-weight: 800;
    color: #8fa3bf;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 2;
}

.slot-img-wrap {
    width: 100%;
    height: clamp(20px, 4.5vh, 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: radial-gradient(ellipse at center, rgba(0, 229, 255, 0.22) 0%, rgba(255, 255, 255, 0.08) 50%, transparent 75%);
    border-radius: 6px;
    margin-top: 1px;
    flex-shrink: 0;
    min-height: 0;
}

.weapon-slot.active .slot-img-wrap {
    background: radial-gradient(ellipse at center, rgba(0, 229, 255, 0.45) 0%, rgba(255, 255, 255, 0.18) 50%, transparent 80%);
}

.slot-icon {
    font-size: clamp(14px, 2.5vh, 24px);
}

.slot-img-icon {
    width: auto;
    height: auto;
    max-width: 96%;
    max-height: 95%;
    object-fit: contain;
    filter: drop-shadow(0 0 5px rgba(0, 229, 255, 0.8)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.9));
    transition: transform 0.15s ease;
}

.weapon-slot:hover .slot-img-icon {
    transform: scale(1.08);
}

.slot-name {
    font-size: clamp(6.5px, 0.9vw, 9.5px);
    font-weight: 700;
    text-align: center;
    line-height: 1.1;
    color: #ffffff;
    width: 100%;
    height: auto;
    max-height: 2.2em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    word-break: break-word;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    margin: 1px 0;
}

.slot-badge {
    font-size: clamp(6px, 0.85vw, 9.5px);
    font-weight: 800;
    padding: clamp(1px, 0.3vh, 2px) clamp(2px, 0.5vw, 6px);
    border-radius: 4px;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    line-height: 1.1;
}

.badge-equipped {
    background: #00e5ff;
    color: #08090d;
    font-weight: 900;
}

.badge-buy {
    background: rgba(255, 214, 0, 0.2);
    color: #ffd600;
    border: 1px solid rgba(255, 214, 0, 0.5);
    box-shadow: 0 0 6px rgba(255, 214, 0, 0.2);
}

.badge-ad {
    background: linear-gradient(90deg, #ff007f, #7928ca);
    color: #ffffff;
    border: 1px solid rgba(255, 0, 127, 0.6);
    box-shadow: 0 0 8px rgba(255, 0, 127, 0.5);
}

/* TOUCH CONTROLS HINT */
.touch-hint {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    color: #a0aec0;
    pointer-events: none;
    animation: fadePulse 3s infinite;
}

@keyframes fadePulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.3; }
}

/* AD WARNING BANNER (CENTERED ON SCREEN - ON TOP OF ALL MODALS) */
.ad-warning-banner {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    background: linear-gradient(135deg, rgba(255, 23, 68, 0.98), rgba(213, 0, 0, 0.98));
    border: 3px solid #ffd600;
    color: #ffffff;
    font-size: 26px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    padding: 20px 44px;
    border-radius: 40px;
    box-shadow: 0 0 50px rgba(255, 23, 68, 0.95), 0 0 30px rgba(255, 214, 0, 0.8), inset 0 0 20px rgba(255, 214, 0, 0.4);
    z-index: 999999 !important;
    pointer-events: none;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 10px #ffd600;
    animation: adPulse 0.5s infinite alternate ease-in-out;
    text-align: center;
    white-space: nowrap;
}

@keyframes adPulse {
    from { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 30px rgba(255, 23, 68, 0.8), 0 0 20px rgba(255, 214, 0, 0.6); }
    to { transform: translate(-50%, -50%) scale(1.06); box-shadow: 0 0 60px rgba(255, 23, 68, 1), 0 0 35px rgba(255, 214, 0, 0.95); }
}

/* WAVE BANNER */
.wave-banner {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(255, 23, 68, 0.95) 0%, rgba(15, 18, 28, 0.98) 90%);
    border: 3px solid #ff1744;
    border-radius: 20px;
    padding: 28px 64px;
    text-align: center;
    box-shadow: 0 0 50px rgba(255, 23, 68, 0.7);
    z-index: 50;
    pointer-events: none;
    animation: bannerPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.wave-banner h2 {
    font-size: 52px;
    font-weight: 900;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
    letter-spacing: 1px;
}

.wave-banner p {
    font-size: 26px;
    color: #ffd600;
    font-weight: 800;
    text-shadow: 0 0 12px rgba(255, 214, 0, 0.6);
}

@keyframes bannerPop {
    0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* MINIMALIST PAUSE (Button only, no background darkening or modal card) */
.pause-overlay-minimal {
    position: absolute;
    inset: 0;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 45; /* Sits underneath shop / perks / modals */
    pointer-events: none;
}

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

.btn-resume-floating {
    width: auto !important;
    max-width: fit-content !important;
    min-width: 0 !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
    background: linear-gradient(135deg, #00e5ff, #0091ea) !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    letter-spacing: 0.8px;
    padding: 8px 22px !important;
    border-radius: 24px !important;
    border: 1.5px solid #ffffff !important;
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.7), 0 4px 16px rgba(0, 0, 0, 0.7) !important;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
    animation: resumePulse 1.8s infinite ease-in-out;
}

.btn-resume-floating:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 0 28px rgba(0, 229, 255, 0.95), 0 6px 20px rgba(0, 0, 0, 0.8) !important;
}

.btn-resume-floating:active {
    transform: scale(0.95) !important;
}

@keyframes resumePulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 16px rgba(0, 229, 255, 0.6), 0 4px 12px rgba(0, 0, 0, 0.6);
    }
    50% {
        transform: scale(1.04);
        box-shadow: 0 0 26px rgba(0, 229, 255, 0.85), 0 6px 18px rgba(0, 0, 0, 0.75);
    }
}

/* OVERLAYS (Start / Game Over / Perks / No-Ads / Coins Shop) */
.overlay-screen {
    position: absolute;
    inset: 0;
    background: rgba(5, 7, 12, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 250; /* Always above pause screen */
    padding: clamp(6px, 1.5vh, 16px);
    box-sizing: border-box;
    overflow: hidden;
}

.overlay-card {
    background: linear-gradient(180deg, rgba(24, 30, 48, 0.96) 0%, rgba(12, 15, 24, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: clamp(14px, 2.5vh, 20px);
    padding: clamp(12px, 2.5vh, 28px) clamp(12px, 2.5vw, 28px);
    max-width: min(96vw, 480px);
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    text-align: center;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
    scrollbar-width: thin;
    box-sizing: border-box;
}

.infected-card {
    border-color: rgba(255, 23, 68, 0.4);
    box-shadow: 0 0 50px rgba(255, 23, 68, 0.25);
    max-width: min(96vw, 480px);
}

.no-ads-card {
    position: relative;
    border-color: rgba(255, 23, 68, 0.6);
    box-shadow: 0 0 60px rgba(255, 23, 68, 0.35);
    max-width: min(96vw, 420px);
    text-align: center;
    padding: clamp(16px, 3vh, 32px) clamp(14px, 3vw, 24px);
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 14px;
    background: transparent;
    border: none;
    color: #8fa3bf;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.15s ease;
}

.modal-close-btn:hover {
    color: #ffffff;
}

.no-ads-modal-icon-wrap {
    width: clamp(50px, 10vh, 84px);
    height: clamp(50px, 10vh, 84px);
    margin: 0 auto clamp(6px, 1.5vh, 16px) auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, rgba(255, 23, 68, 0.3) 0%, transparent 70%);
}

.no-ads-modal-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 16px rgba(255, 23, 68, 0.85));
}

.no-ads-modal-title {
    font-size: clamp(18px, 3.5vh, 24px);
    font-weight: 900;
    color: #ffffff;
    margin-bottom: clamp(4px, 1vh, 8px);
    letter-spacing: 1px;
    text-shadow: 0 0 15px rgba(255, 23, 68, 0.6);
}

.no-ads-modal-desc {
    font-size: clamp(11.5px, 2vh, 14px);
    color: #b0bec5;
    line-height: 1.35;
    margin-bottom: clamp(10px, 2vh, 18px);
}

.no-ads-price-box {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 214, 0, 0.3);
    border-radius: 12px;
    padding: clamp(6px, 1.2vh, 10px) 16px;
    margin-bottom: clamp(12px, 2.5vh, 22px);
}

.no-ads-price-label {
    font-size: clamp(11.5px, 2vh, 13px);
    color: #8fa3bf;
}

.no-ads-price-val {
    font-size: clamp(16px, 3vh, 20px);
    font-weight: 900;
    color: #ffd600;
    text-shadow: 0 0 10px rgba(255, 214, 0, 0.6);
}

.btn-buy-iap {
    background: linear-gradient(135deg, #ff1744, #d50000) !important;
    color: #ffffff !important;
    font-weight: 900 !important;
    font-size: clamp(13px, 2.2vh, 16px) !important;
    box-shadow: 0 4px 20px rgba(255, 23, 68, 0.5) !important;
    width: 100%;
    padding: clamp(10px, 1.8vh, 14px) 24px;
    border-radius: 12px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-buy-iap:hover {
    box-shadow: 0 6px 28px rgba(255, 23, 68, 0.8) !important;
    transform: translateY(-2px);
}

/* COINS SHOP MODAL (IN-APP PURCHASES) */
.coins-shop-card {
    position: relative;
    border: 2px solid rgba(255, 214, 0, 0.55);
    box-shadow: 0 0 70px rgba(255, 214, 0, 0.28), 0 20px 60px rgba(0, 0, 0, 0.9);
    max-width: min(96vw, 760px);
    text-align: center;
    padding: clamp(16px, 3vh, 32px) clamp(12px, 2.5vw, 28px);
    background: linear-gradient(180deg, rgba(22, 28, 44, 0.98) 0%, rgba(10, 13, 22, 0.99) 100%);
}

.coins-shop-title {
    font-size: clamp(20px, 4vh, 28px);
    font-weight: 900;
    color: #ffd600;
    margin-bottom: clamp(4px, 1vh, 8px);
    letter-spacing: 1.5px;
    text-shadow: 0 0 16px rgba(255, 214, 0, 0.6);
}

.coins-shop-sub {
    font-size: clamp(11.5px, 2vh, 14px);
    color: #a0aec0;
    line-height: 1.4;
    margin-bottom: clamp(14px, 3vh, 26px);
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
}

.coins-shop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 1.8vw, 20px);
    align-items: stretch;
}

.coins-shop-item {
    position: relative;
    background: radial-gradient(circle at 50% 30%, rgba(32, 42, 68, 0.85) 0%, rgba(14, 18, 30, 0.95) 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: clamp(12px, 2vw, 18px);
    padding: clamp(12px, 2.5vh, 22px) clamp(8px, 1.5vw, 16px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), border-color 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.coins-shop-item:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: #ffd600;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 214, 0, 0.35);
}

.coins-shop-item.popular {
    border-color: rgba(0, 229, 255, 0.6);
    background: radial-gradient(circle at 50% 30%, rgba(0, 229, 255, 0.15) 0%, rgba(14, 24, 40, 0.95) 100%);
}

.coins-shop-item.popular:hover {
    border-color: #00e5ff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.7), 0 0 25px rgba(0, 229, 255, 0.45);
}

.coins-shop-item.best-value {
    border-color: rgba(255, 214, 0, 0.85);
    background: radial-gradient(circle at 50% 30%, rgba(255, 214, 0, 0.18) 0%, rgba(22, 18, 30, 0.96) 100%);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 214, 0, 0.25);
}

.coins-shop-item.best-value:hover {
    border-color: #ffd600;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.8), 0 0 35px rgba(255, 214, 0, 0.6);
}

.item-badge {
    position: absolute;
    top: -11px;
    font-size: clamp(9px, 1.2vw, 11px);
    font-weight: 900;
    padding: 3px 10px;
    border-radius: 12px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    text-transform: uppercase;
}

.popular-badge {
    background: linear-gradient(90deg, #00b0ff, #00e5ff);
    color: #0b0c10;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.6);
}

.best-badge {
    background: linear-gradient(90deg, #ffd600, #ff9100);
    color: #0b0c10;
    box-shadow: 0 0 14px rgba(255, 214, 0, 0.75);
    animation: bestBadgePulse 1.8s infinite ease-in-out;
}

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

.coins-item-img-wrap {
    width: clamp(70px, 14vw, 130px);
    height: clamp(70px, 14vw, 130px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 4px 0;
    border-radius: 16px;
    background: radial-gradient(circle at center, rgba(255, 214, 0, 0.12) 0%, transparent 70%);
}

.coins-item-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 14px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6);
    transition: transform 0.25s ease;
}

.coins-shop-item:hover .coins-item-img {
    transform: scale(1.1);
}

.coins-item-amount {
    font-size: clamp(15px, 2.8vw, 22px);
    font-weight: 900;
    color: #ffd600;
    text-shadow: 0 0 12px rgba(255, 214, 0, 0.6);
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.coins-item-desc {
    font-size: clamp(10.5px, 1.6vw, 13px);
    font-weight: 700;
    color: #c5d1e0;
    margin-top: -6px;
    min-height: 18px;
}

.btn-buy-coins {
    width: 100%;
    padding: clamp(8px, 1.8vh, 12px) clamp(10px, 2vw, 18px);
    border-radius: 12px;
    background: linear-gradient(135deg, #ffd600, #ff9100);
    color: #0b0c10;
    font-size: clamp(13px, 2.2vw, 17px);
    font-weight: 900;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 214, 0, 0.4);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-buy-coins:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 22px rgba(255, 214, 0, 0.7);
    filter: brightness(1.08);
}

.btn-buy-coins:active {
    transform: translateY(1px);
}

.btn-buy-coins.btn-popular {
    background: linear-gradient(135deg, #00e5ff, #0091ea);
    color: #ffffff;
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.4);
}

.btn-buy-coins.btn-popular:hover {
    box-shadow: 0 6px 22px rgba(0, 229, 255, 0.75);
}

.btn-buy-coins.btn-best {
    background: linear-gradient(135deg, #ffd600, #ff3d00);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(255, 61, 0, 0.5);
}

.btn-buy-coins.btn-best:hover {
    box-shadow: 0 6px 28px rgba(255, 61, 0, 0.8);
}

.infected-title {
    font-size: clamp(22px, 4.5vh, 34px);
    font-weight: 900;
    color: #ff1744;
    text-shadow: 0 0 20px rgba(255, 23, 68, 0.7);
    margin-bottom: clamp(8px, 1.5vh, 16px);
    letter-spacing: 2px;
}

.run-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(4px, 1vw, 8px);
    background: rgba(0, 0, 0, 0.4);
    padding: clamp(6px, 1.2vh, 12px) 8px;
    border-radius: 12px;
    margin-bottom: clamp(8px, 1.8vh, 18px);
}

@media (max-width: 440px) {
    .run-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-lbl {
    font-size: clamp(9px, 1.5vh, 10.5px);
    color: #8fa3bf;
}

.stat-val {
    font-size: clamp(12px, 2.2vh, 15px);
    font-weight: 800;
    color: #ffffff;
    white-space: nowrap;
}

/* LEADERBOARD */
.leaderboard-box {
    background: rgba(16, 20, 32, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: clamp(8px, 1.5vh, 14px);
    margin-bottom: clamp(10px, 2vh, 18px);
    text-align: left;
}

.lb-title {
    font-size: clamp(11.5px, 2vh, 14px);
    font-weight: 800;
    color: #ffd600;
    margin-bottom: clamp(4px, 1vh, 8px);
}

.lb-list {
    display: flex;
    flex-direction: column;
    gap: clamp(3px, 0.8vh, 6px);
}

.lb-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: clamp(10.5px, 1.8vh, 12px);
    padding: clamp(4px, 0.8vh, 6px) clamp(6px, 1.2vw, 10px);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.lb-row.player-row {
    background: rgba(0, 229, 255, 0.15);
    border: 1px solid rgba(0, 229, 255, 0.4);
    font-weight: 800;
    color: #00e5ff;
}

.lb-rank {
    min-width: 40px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-right: 6px;
    flex-shrink: 0;
}

.lb-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-wave {
    font-weight: 800;
    color: #ffffff;
    margin-left: 8px;
    flex-shrink: 0;
}

.lb-dots {
    text-align: center;
    color: #64748b;
    font-weight: 800;
    padding: 1px 0;
}

/* BUTTONS */
.btn {
    width: 100%;
    padding: clamp(10px, 1.8vh, 14px) clamp(14px, 2vw, 20px);
    border: none;
    border-radius: 12px;
    font-size: clamp(13px, 2.2vh, 15px);
    font-weight: 800;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    background: linear-gradient(135deg, #00b0ff, #00e5ff);
    color: #08090d;
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 8px 25px rgba(0, 229, 255, 0.6);
}

.btn-ad {
    background: linear-gradient(135deg, #ff007f, #7928ca);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(255, 0, 127, 0.4);
}

.btn.disabled,
.btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
    filter: grayscale(0.7);
    pointer-events: none;
    box-shadow: none !important;
    transform: none !important;
}

.overlay-buttons {
    display: flex;
    flex-direction: column;
    gap: clamp(6px, 1.2vh, 10px);
}

/* START SCREEN */
.start-card {
    max-width: min(95vw, 540px);
    padding: clamp(14px, 3vh, 36px) clamp(16px, 3.5vw, 36px);
}

.hero-preview-box {
    width: clamp(90px, 18vh, 190px);
    height: clamp(100px, 22vh, 230px);
    margin: 4px auto clamp(8px, 1.8vh, 22px) auto;
    display: flex;
    justify-content: center;
    align-items: center;
    filter: drop-shadow(0 0 25px rgba(0, 229, 255, 0.45));
}

.hero-preview-img {
    height: 100%;
    width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(0, 229, 255, 0.6));
}

.game-title {
    font-size: clamp(22px, 5vh, 42px);
    font-weight: 900;
    letter-spacing: 1.5px;
    background: linear-gradient(90deg, #ff1744, #ff9100);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0px;
    line-height: 1.1;
}

.game-subtitle {
    font-size: clamp(14px, 2.8vh, 22px);
    font-weight: 900;
    color: #00e5ff;
    letter-spacing: 2px;
    margin-bottom: clamp(6px, 1.2vh, 12px);
    text-transform: uppercase;
    text-shadow: 0 0 16px rgba(0, 229, 255, 0.7);
}

.game-desc {
    font-size: clamp(11px, 1.8vh, 13px);
    color: #a0aec0;
    line-height: 1.4;
    margin-bottom: clamp(10px, 2vh, 18px);
}

.tips-box {
    margin-top: clamp(8px, 1.5vh, 14px);
    font-size: clamp(10px, 1.6vh, 11.5px);
    color: #ffd600;
    background: rgba(255, 214, 0, 0.1);
    padding: clamp(6px, 1.2vh, 10px);
    border-radius: 10px;
    border: 1px solid rgba(255, 214, 0, 0.2);
    text-align: left;
}

.hidden {
    display: none !important;
}

/* PAUSE SCREEN OVERLAY & CARD */
.pause-card {
    max-width: min(92vw, 420px);
    width: 90%;
    padding: clamp(18px, 3.5vh, 32px) clamp(16px, 3vw, 28px);
    background: radial-gradient(circle at 50% 20%, rgba(20, 26, 44, 0.98) 0%, rgba(10, 12, 20, 0.99) 100%);
    border: 2px solid rgba(0, 229, 255, 0.5);
    box-shadow: 0 0 45px rgba(0, 229, 255, 0.3), 0 20px 60px rgba(0, 0, 0, 0.85);
    text-align: center;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(8px, 1.5vh, 16px);
}

.pause-title {
    font-size: clamp(24px, 5vh, 36px);
    font-weight: 900;
    color: #ffffff;
    letter-spacing: 2px;
    text-shadow: 0 0 16px rgba(0, 229, 255, 0.8);
    margin: 0;
}

.pause-subtitle {
    font-size: clamp(12px, 2vh, 15px);
    color: #8fa3bf;
    margin: 0 0 clamp(6px, 1.2vh, 12px) 0;
}

.pause-actions {
    width: 100%;
    display: flex;
    justify-content: center;
}

.pause-toggle-btn {
    font-size: 14px;
    color: #00e5ff;
}

/* PERK UPGRADE MODAL */
.perk-card-modal {
    max-width: min(96vw, 840px);
    width: 95%;
    max-height: calc(100vh - 16px);
    padding: clamp(12px, 2vh, 26px) clamp(10px, 2vw, 22px);
    background: radial-gradient(circle at 50% 15%, rgba(20, 26, 44, 0.98) 0%, rgba(10, 12, 20, 0.99) 100%);
    border: 2px solid rgba(0, 229, 255, 0.4);
    box-shadow: 0 0 50px rgba(0, 229, 255, 0.25), 0 20px 60px rgba(0, 0, 0, 0.8);
    text-align: center;
}

.perk-modal-title {
    font-size: clamp(18px, 3.8vh, 30px);
    font-weight: 900;
    letter-spacing: 1.5px;
    background: linear-gradient(90deg, #ffd600, #ff9100);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 2px;
}

.perk-modal-sub {
    font-size: clamp(11px, 1.8vh, 13.5px);
    color: #00e5ff;
    font-weight: 700;
    margin-bottom: clamp(8px, 1.5vh, 18px);
}

.perk-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: clamp(8px, 1.5vw, 14px);
    margin-top: 4px;
}

@media (max-width: 600px) and (min-height: 550px) {
    .perk-cards-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

.perk-card-item {
    background: rgba(18, 24, 40, 0.95);
    border-radius: 14px;
    padding: clamp(8px, 1.5vh, 16px) clamp(6px, 1.2vw, 12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: clamp(110px, 22vh, 190px);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 2px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.perk-card-item:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px currentColor;
}

.perk-card-item:active {
    transform: translateY(-1px) scale(0.98);
}

.perk-rarity-common {
    border-color: #00e5ff;
    color: #00e5ff;
}
.perk-rarity-common:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 229, 255, 0.5);
}

.perk-rarity-rare {
    border-color: #ffd600;
    color: #ffd600;
}
.perk-rarity-rare:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(255, 214, 0, 0.6);
}

.perk-rarity-epic {
    border-color: #e040fb;
    color: #e040fb;
}
.perk-rarity-epic:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 20px rgba(224, 64, 251, 0.6);
}

.perk-rarity-legendary {
    border-color: #ff1744;
    color: #ff1744;
    background: radial-gradient(circle at 50% 20%, rgba(255, 23, 68, 0.15) 0%, rgba(18, 24, 40, 0.95) 80%);
}
.perk-rarity-legendary:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8), 0 0 25px rgba(255, 23, 68, 0.7);
}

.perk-card-icon {
    font-size: clamp(22px, 4vh, 34px);
    margin-bottom: clamp(3px, 0.6vh, 6px);
    filter: drop-shadow(0 0 8px currentColor);
}

.perk-card-title {
    font-size: clamp(11.5px, 1.8vh, 14px);
    font-weight: 900;
    color: #ffffff;
    margin-bottom: 3px;
    line-height: 1.15;
}

.perk-card-desc {
    font-size: clamp(9.5px, 1.5vh, 11.5px);
    color: #b0bec5;
    line-height: 1.3;
    flex: 1;
    display: flex;
    align-items: center;
}

.perk-card-btn {
    margin-top: clamp(4px, 1vh, 10px);
    padding: clamp(5px, 0.9vh, 8px) 12px;
    font-size: clamp(10px, 1.6vh, 12px);
    font-weight: 900;
    letter-spacing: 0.5px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.15s ease;
    width: 90%;
}

.perk-rarity-common .perk-card-btn {
    background: linear-gradient(135deg, #00e5ff, #00b0ff);
    color: #0a0e1a;
    box-shadow: 0 4px 15px rgba(0, 229, 255, 0.35);
}

.perk-rarity-rare .perk-card-btn {
    background: linear-gradient(135deg, #ffd600, #ff9100);
    color: #1a1200;
    box-shadow: 0 4px 15px rgba(255, 214, 0, 0.35);
}

.perk-rarity-epic .perk-card-btn {
    background: linear-gradient(135deg, #e040fb, #aa00ff);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(224, 64, 251, 0.35);
}

.perk-rarity-legendary .perk-card-btn {
    background: linear-gradient(135deg, #ff1744, #d50000);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(255, 23, 68, 0.4);
}

.perk-card-item.perk-ad-card {
    border-color: #ffd600 !important;
    background: radial-gradient(circle at 50% 20%, rgba(255, 214, 0, 0.2) 0%, rgba(18, 24, 40, 0.95) 80%) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 214, 0, 0.4) !important;
}

.perk-card-ad-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: linear-gradient(135deg, #ffd600, #ff9100);
    color: #000000;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    letter-spacing: 0.5px;
}

.perk-card-btn-ad {
    background: linear-gradient(135deg, #ffd600, #ff9100) !important;
    color: #000000 !important;
    font-weight: 900 !important;
    box-shadow: 0 4px 15px rgba(255, 214, 0, 0.4) !important;
}

.perk-card-item:hover .perk-card-btn {
    transform: scale(1.03);
    filter: brightness(1.15);
}

/* SHORT SCREENS (LANDSCAPE PHONES) ADAPTATION */
@media (max-height: 560px) {
    .start-card {
        display: flex;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
        max-width: min(90vw, 420px);
        padding: clamp(8px, 2vh, 16px) clamp(12px, 2.5vw, 24px);
    }
    .hero-preview-box {
        width: auto;
        height: clamp(60px, 22vh, 120px);
        margin: 2px auto clamp(4px, 1.2vh, 10px) auto;
        flex-shrink: 0;
    }
    .game-title {
        font-size: clamp(20px, 5.5vh, 32px);
        line-height: 1.05;
    }
    .game-subtitle {
        font-size: clamp(10px, 2.5vh, 15px);
        margin-bottom: clamp(2px, 0.8vh, 6px);
    }
    .start-actions {
        width: 100%;
        max-width: 260px;
    }
    .start-actions .btn {
        padding: clamp(6px, 1.8vh, 10px) 16px;
        font-size: clamp(12px, 2.4vh, 15px);
    }
    .perk-cards-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px;
    }
    .perk-card-item {
        min-height: 105px;
        padding: 6px 6px;
    }
    .perk-card-icon {
        font-size: 20px;
        margin-bottom: 2px;
    }
    .perk-card-title {
        font-size: 11px;
    }
    .perk-card-desc {
        font-size: 9px;
    }
    .perk-card-btn {
        margin-top: 4px;
        padding: 4px 8px;
        font-size: 9.5px;
    }
    .infected-card {
        padding: 10px 16px;
    }
    .leaderboard-box {
        margin-bottom: 6px;
        padding: 4px 8px;
    }
    .lb-row {
        padding: 2px 6px;
        font-size: 10px;
    }
    .run-stats {
        margin-bottom: 6px;
        padding: 4px 6px;
    }
}

/* RESPONSIVE MOBILE ADAPTATIONS - 40% REDUCED TOP HUD & FLUSH TO TOP */
@media (max-width: 900px), (max-height: 560px) {
    #hud-top {
        top: 2px;
        top: max(2px, env(safe-area-inset-top));
        left: 4px;
        right: 4px;
        gap: 4px;
        align-items: flex-start;
        justify-content: space-between;
        width: auto;
        min-width: 0;
        max-width: calc(100vw - 8px);
    }
    .hud-card {
        padding: 2px 5px;
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
    .hud-left-group {
        gap: 3px;
        flex-shrink: 0;
    }
    .wave-card {
        min-width: 0;
        padding: 2px 5px;
    }
    .timer-card {
        min-width: 0;
        padding: 2px 5px;
    }
    .hud-label {
        font-size: 6.5px;
        letter-spacing: 0.8px;
        line-height: 1;
    }
    .hud-val {
        font-size: 12px;
        line-height: 1.1;
    }
    .hud-sub {
        font-size: 7.5px;
        line-height: 1;
    }
    .timer-val {
        font-size: 12px;
    }
    .hud-center-group {
        gap: 3px;
        margin: 0 auto;
        flex-shrink: 0;
        min-width: 0;
    }
    .center-card {
        width: 170px;
        min-width: 0;
        max-width: 175px;
        gap: 4px;
        padding: 2px 4px;
        border-radius: 8px;
    }
    .hud-bars-column {
        gap: 2px;
    }
    .wall-hp-header {
        font-size: 6.5px;
        line-height: 1;
    }
    .bar-bg {
        height: 5px;
        border-radius: 3px;
    }
    .bar-fill {
        border-radius: 3px;
    }
    .hero-avatar-box {
        width: 28px;
        height: 28px;
        min-width: 28px;
        border-width: 1.5px;
        box-shadow: 0 0 8px rgba(0, 229, 255, 0.5);
    }
    .hero-avatar-img {
        width: 130px;
        height: 130px;
        margin-top: -5px;
    }
    .hud-settings-row {
        gap: 2px;
        flex-shrink: 0;
    }
    .hud-setting-btn {
        width: 26px;
        height: 26px;
        border-radius: 7px;
        font-size: 12px;
        border-width: 1px;
    }
    .music-toggle-btn {
        border-width: 1px;
    }
    .music-mic-icon {
        width: 18px;
        height: 18px;
    }
    .flag-icon {
        width: 15px;
        height: 10px;
    }
    .hud-right-group {
        gap: 5px;
        flex-shrink: 0;
        margin-left: 0;
    }
    .no-ads-btn {
        width: 37px;
        height: 37px;
    }
    .no-ads-icon {
        width: 37px;
        height: 37px;
    }
    .coins-card {
        min-width: 0;
        padding: 3px 8px;
        border-radius: 10px;
    }
    .coins-display {
        gap: 4px;
    }
    .coin-icon {
        font-size: 15px;
    }
    .coins-display .hud-val {
        font-size: 15px;
    }
    .coin-plus-btn {
        width: 22px;
        height: 22px;
        font-size: 16px;
        margin-left: 3px;
        border-width: 1px;
    }
    #side-actions {
        top: 36px;
        right: 0;
        gap: 3px;
    }
    .side-shop-card {
        border-radius: 10px 0 0 10px;
    }
    .shop-toggle-handle {
        width: 16px;
        font-size: 10px;
    }
    .shop-items-wrap {
        padding: 3px 4px;
        gap: 3px;
    }
    .action-btn {
        min-width: 130px;
        padding: 2px 4px;
        gap: 4px;
        border-radius: 8px;
    }
    #side-actions.shop-collapsed .action-btn {
        min-width: auto;
        padding: 2px 4px;
        gap: 3px;
    }
    .action-icon-wrap {
        width: 20px;
        height: 20px;
    }
    .key-hint {
        display: none !important;
    }
    .btn-icon {
        width: 20px;
        height: 20px;
        min-width: 20px;
    }
    .btn-title {
        font-size: 7.5px;
        font-weight: normal;
    }
    .btn-subtext {
        font-size: 6.5px;
    }
    .btn-badge {
        font-size: 6.5px;
    }
    .btn-price {
        font-size: 7.5px;
        padding: 2px 4px;
        border-radius: 5px;
    }
    .hud-wave-column {
        gap: 2px;
    }
    #zoom-controls {
        position: static;
        padding: 1px 4px;
        border-radius: 8px;
        gap: 2px;
    }
    .zoom-btn {
        font-size: 8px;
        padding: 1px 3px;
        border-radius: 6px;
        min-width: auto;
    }
    .zoom-indicator {
        font-size: 7.5px;
        min-width: 18px;
        padding: 0 2px;
    }
}

@media (hover: none) and (pointer: coarse) {
    .key-hint {
        display: none !important;
    }
}
