/* UI Overlay Styles - End Level Screen */

.end-level-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.end-level-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.end-level-content {
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid rgba(78, 205, 196, 0.3);
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    position: relative;
}

.end-level-content::before,
.end-level-content::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #4ecdc4;
    opacity: 0.5;
}

.end-level-content::before {
    top: -2px;
    left: -2px;
    border-right: none;
    border-bottom: none;
}

.end-level-content::after {
    bottom: -2px;
    right: -2px;
    border-left: none;
    border-top: none;
}

.end-level-title {
    font-size: 32px;
    color: #4ecdc4;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Stats Section */
.end-level-stats {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    padding: 15px;
    margin: 20px 0;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row-highlight {
    font-size: 20px;
    font-weight: bold;
    color: #ffe66d;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    padding-top: 12px;
    margin-top: 8px;
}

.stat-label {
    color: #bbbbbb;
}

.stat-value {
    color: #ffffff;
    font-weight: bold;
}

/* Rewards Section */
.end-level-rewards {
    margin: 20px 0;
}

.rewards-title {
    font-size: 20px;
    color: #ffe66d;
    margin: 0 0 15px 0;
}

.reward-breakdown {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
}

.reward-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 14px;
    color: #bbbbbb;
}

.reward-total {
    font-size: 18px;
    font-weight: bold;
    border-top: 2px solid rgba(255, 255, 255, 0.2);
    padding-top: 12px;
    margin-top: 8px;
    color: #ffffff;
}

.reward-positive {
    color: #4ecdc4;
    font-weight: bold;
}

.reward-negative {
    color: #ff6b6b;
    font-weight: bold;
}

.reward-positive-big {
    color: #ffe66d;
    font-size: 24px;
    font-weight: bold;
}

.total-coins {
    font-size: 16px;
    color: #4ecdc4;
    font-weight: bold;
    padding: 10px;
    background: rgba(78, 205, 196, 0.1);
    border-radius: 5px;
}

/* Buttons */
.end-level-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.btn {
    flex: 1;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #4ecdc4 0%, #3aa99f 100%);
    color: #1a1a2e;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent,
        rgba(255, 255, 255, 0.1),
        transparent
    );
    transform: rotate(45deg);
    transition: all 0.3s;
    opacity: 0;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5fd8cf 0%, #4bb5ab 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:hover::before {
    left: 100%;
    opacity: 1;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3), inset 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background: linear-gradient(135deg, #666666 0%, #555555 100%);
    color: #ffffff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #777777 0%, #666666 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
    background: #666666;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

/* Main Menu Styles */
.main-menu-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.main-menu-container.visible {
    opacity: 1;
    pointer-events: auto;
}

.main-menu-content {
    text-align: center;
    max-width: 500px;
    width: 90%;
    padding: 30px;
}

.menu-title-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 0 10px 0;
}

.menu-title-art {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    image-rendering: -webkit-optimize-contrast;
}

.game-title {
    font-size: 48px;
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 4px;
    font-weight: bold;

    /* Gradient text */
    background: linear-gradient(135deg, #ffffff 0%, #4ecdc4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;

    /* Text shadow for depth */
    text-shadow:
        0 0 10px rgba(78, 205, 196, 0.5),
        0 0 20px rgba(78, 205, 196, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.5);

    /* Subtle pulse animation */
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        filter: drop-shadow(0 0 10px rgba(78, 205, 196, 0.5))
                drop-shadow(0 0 20px rgba(78, 205, 196, 0.3));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(78, 205, 196, 0.7))
                drop-shadow(0 0 30px rgba(78, 205, 196, 0.5));
    }
}

.game-subtitle {
    font-size: 16px;
    color: #bbbbbb;
    margin: 0 0 40px 0;
    letter-spacing: 2px;
}

.menu-coins-display {
    background: rgba(78, 205, 196, 0.1);
    border: 2px solid #4ecdc4;
    border-radius: 10px;
    padding: 15px 30px;
    margin: 0 auto 40px auto;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.coin-icon-large {
    font-size: 32px;
}

.coin-amount {
    font-size: 28px;
    font-weight: bold;
    color: #ffe66d;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.menu-btn {
    padding: 15px 30px;
    font-size: 18px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-btn-primary {
    background: #4ecdc4;
    color: #1a1a2e;
    font-size: 22px;
}

.menu-btn-primary:hover {
    background: #5fd9d0;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.5);
}

.menu-btn-secondary {
    background: #333;
    color: #ffffff;
}

.menu-btn-secondary:hover {
    background: #444;
    transform: translateY(-2px);
}

.menu-btn:active {
    transform: translateY(0);
}

.menu-footer {
    margin-top: 40px;
    color: #666;
    font-size: 12px;
}

.menu-footer p {
    margin: 5px 0;
}

.controls-hint {
    color: #888;
    font-size: 14px;
}

/* HUD Styles - Muskuerade version */
.hud-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.hud-world-flash {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Courier New', monospace;
    font-size: 22px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 15px rgba(78, 205, 196, 0.8), 0 0 30px rgba(78, 205, 196, 0.4);
    letter-spacing: 4px;
    text-transform: uppercase;
    animation: worldFlashIn 2.5s ease-out forwards;
    pointer-events: none;
    z-index: 10;
}

@keyframes worldFlashIn {
    0% { opacity: 0; transform: translateX(-50%) scale(1.3); }
    15% { opacity: 1; transform: translateX(-50%) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

.hud-layout {
    position: relative;
    width: 100%;
    height: 100px;
    pointer-events: none;
}

/* Top Left: Coins only */
.hud-coins {
    position: absolute;
    top: 15px;
    left: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: bold;
}

.coin-icon {
    font-size: 20px;
}

.coin-count {
    color: #ffe66d;
}

/* Center: Health Bar only - positioned exactly center */
.hud-center {
    position: absolute;
    top: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.hud-level-label {
    color: #4ecdc4;
    font-size: 14px;
    font-weight: bold;
}

.hud-health-bar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.hud-health-bar {
    width: 250px;
    height: 12px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.hud-health-fill {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.health-green {
    background: #4ecdc4;
}

.health-yellow {
    background: #ffe66d;
}

.health-red {
    background: #ff6b6b;
}

.hud-health-text {
    font-size: 12px;
    color: #ffffff;
    font-weight: bold;
}

/* Right Side: Chest + Icons (Settings & Achievement) */
.hud-right {
    position: absolute;
    top: 15px;
    right: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.hud-chest {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 15px;
    border-radius: 20px;
}

.hud-icons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hud-settings {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 12px;
    padding: 6px 10px;
    font-size: 16px;
    cursor: pointer;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
}

.hud-settings:hover {
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.hud-settings:active {
    transform: scale(0.95);
}

.hud-achievement {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff2b3;
    border-radius: 12px;
    padding: 6px 10px;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.hud-achievement.ready {
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 0 10px rgba(255, 214, 102, 0.8);
    animation: trophyPulse 1.2s ease-in-out infinite;
}

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

.hud-chest.ready {
    box-shadow: 0 0 12px rgba(255, 214, 102, 0.8);
    animation: chestReadyPulse 1.2s ease-in-out infinite;
}

@keyframes chestReadyPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 214, 102, 0.6); }
    50% { box-shadow: 0 0 18px rgba(255, 214, 102, 1); }
}

.chest-icon {
    font-size: 28px;
}

.chest-progress-bar {
    width: 12px;
    height: 40px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.chest-progress-fill {
    width: 100%;
    background: linear-gradient(180deg, #ffa500, #ffe66d);
    transition: height 0.3s ease;
}

.chest-percent {
    font-size: 12px;
    color: #ffe66d;
    font-weight: bold;
}

/* Level Select Styles */
.level-select-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.level-select-container.visible {
    opacity: 1;
    pointer-events: auto;
}

.level-select-content {
    max-width: 600px;
    width: 90%;
    padding: 20px;
}

.level-select-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.level-select-header h2 {
    font-size: 32px;
    color: #4ecdc4;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.back-btn {
    padding: 10px 20px;
    background: #333;
    color: #ffffff;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s ease;
}

.back-btn:hover {
    background: #444;
}

.header-spacer {
    width: 100px;
}

.levels-grid {
    display: grid;
    /* Grid columns defined by device classes - see responsive section */
}

.level-btn {
    aspect-ratio: 1;
    background: #1a1a2e;
    border: 2px solid #333;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    position: relative;
}

.level-btn.unlocked {
    border-color: #4ecdc4;
}

.level-btn.unlocked:hover {
    background: #252540;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(78, 205, 196, 0.3);
}

.level-btn.locked {
    background: #111;
    border-color: #222;
    cursor: not-allowed;
}

.level-number {
    font-size: 24px;
    font-weight: bold;
    color: #4ecdc4;
    margin-bottom: 5px;
}

.level-stars {
    font-size: 12px;
    margin-bottom: 3px;
}

.level-accuracy {
    font-size: 10px;
    color: #ffe66d;
}

.level-lock {
    font-size: 24px;
    color: #444;
}

/* ══════════════════════════════════════════
   SHOP — 16-BIT RETRO RPG STYLE
   ══════════════════════════════════════════ */

.shop-container {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: #0d0d1f;
    background-image: repeating-linear-gradient(
        0deg,
        transparent, transparent 3px,
        rgba(255, 255, 255, 0.012) 3px, rgba(255, 255, 255, 0.012) 4px
    );
    display: flex;
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    overflow-y: auto;
}

.shop-container.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ── Content wrapper ── */
.shop-content {
    max-width: 680px;
    width: 95%;
    padding: 0 0 48px;
}

/* ── Header bar ── */
.shop-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #12122a;
    border-bottom: 4px solid #4ecdc4;
    box-shadow: 0 4px 0 #000;
    margin-bottom: 22px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.shop-title {
    font-size: 20px;
    color: #4ecdc4;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-shadow: 0 0 14px rgba(78, 205, 196, 0.55);
}

.back-btn {
    background: #1a1a2e;
    color: #4ecdc4;
    border: 3px solid #4ecdc4;
    box-shadow: 3px 3px 0 #000;
    padding: 8px 14px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: transform 0.07s, box-shadow 0.07s;
}

.back-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #000;
}

.shop-coins {
    display: flex;
    align-items: center;
    gap: 7px;
    background: #1a1a2e;
    border: 3px solid #ffe66d;
    box-shadow: 3px 3px 0 #000;
    padding: 8px 14px;
}

.coin-gem {
    color: #ffe66d;
    font-size: 17px;
    line-height: 1;
}

.coin-amount {
    font-family: 'Courier New', monospace;
    font-size: 19px;
    font-weight: bold;
    color: #ffe66d;
    letter-spacing: 1px;
}

/* ── Grid ── */
.balls-grid {
    display: grid;
    gap: 16px;
    padding: 0 12px;
}

.mobile  .balls-grid { grid-template-columns: 1fr; }
.tablet  .balls-grid { grid-template-columns: repeat(2, 1fr); }
.desktop .balls-grid { grid-template-columns: repeat(2, 1fr); }

/* ── Card ── */
.ball-card {
    background: #1a1a2e;
    border: 3px solid #2a2a4a;
    box-shadow: 4px 4px 0 #000;
    overflow: hidden;
    transition: transform 0.07s, box-shadow 0.07s, border-color 0.12s;
}

.ball-card:not(.locked):hover {
    border-color: #4ecdc4;
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 #000;
}

.ball-card.equipped {
    border-color: #ffe66d;
    box-shadow: 4px 4px 0 #000, 0 0 18px rgba(255, 230, 109, 0.22);
}

.ball-card.locked {
    opacity: 0.52;
}

/* ── Sprite box (item icon area) ── */
.sprite-box {
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0a0a18;
    border-bottom: 3px solid #2a2a4a;
    position: relative;
    overflow: hidden;
}

.ball-card.equipped .sprite-box {
    border-bottom-color: #ffe66d;
}

.sprite-circle {
    border-radius: 50%;
    box-shadow:
        0 0 20px var(--card-color, #4ecdc4),
        inset -5px -5px 10px rgba(0, 0, 0, 0.45),
        inset 4px 4px 8px rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
}

.lock-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 3px;
    color: #556;
    text-transform: uppercase;
}

/* ── Info section ── */
.ball-info {
    padding: 12px 14px 10px;
    border-bottom: 2px solid #1f1f38;
}

.ball-name {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    color: #4ecdc4;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.ball-desc {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    color: #6a7a94;
    line-height: 1.45;
    margin-bottom: 10px;
}

/* ── Stat bars ── */
.ball-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
}

.stat-lbl {
    color: #3d4d6a;
    width: 28px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.stat-bar {
    color: #4ecdc4;
    letter-spacing: -1px;
    flex: 1;
    min-width: 0;
}

.stat-num {
    color: #ffffff;
    font-weight: bold;
    width: 38px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Actions ── */
.ball-actions {
    padding: 11px 14px;
    border-top: 2px solid #1f1f38;
}

.ball-card.equipped .ball-actions {
    border-top-color: rgba(255, 230, 109, 0.25);
}

.shop-btn {
    width: 100%;
    padding: 10px 0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 3px solid;
    cursor: pointer;
    box-shadow: 3px 3px 0 #000;
    transition: transform 0.07s, box-shadow 0.07s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.shop-btn:hover:not(.disabled) {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #000;
}

.purchase-btn {
    background: #4ecdc4;
    color: #0a0a18;
    border-color: #36b0a8;
}

.purchase-btn.disabled {
    background: #181830;
    color: #3a3a5a;
    border-color: #252540;
    box-shadow: none;
    cursor: not-allowed;
}

.cant-afford {
    font-size: 10px;
    opacity: 0.7;
    letter-spacing: 1px;
}

.equip-btn {
    background: #1a1a2e;
    color: #8899bb;
    border-color: #2e2e50;
}

.equip-btn:hover {
    background: #20203a;
    border-color: #4ecdc4;
    color: #ffffff;
}

.equipped-badge {
    text-align: center;
    padding: 9px 0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 4px;
    color: #ffe66d;
    text-shadow: 0 0 10px rgba(255, 230, 109, 0.5);
    text-transform: uppercase;
}

/* Settings Styles */
.settings-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.settings-container.visible {
    opacity: 1;
    pointer-events: auto;
}

.settings-content {
    max-width: 500px;
    width: 90%;
    padding: 20px;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.settings-header h2 {
    font-size: 32px;
    color: #4ecdc4;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.setting-item {
    background: #1a1a2e;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.setting-info h3 {
    font-size: 18px;
    color: #4ecdc4;
    margin: 0 0 5px 0;
}

.setting-info p {
    font-size: 12px;
    color: #888;
    margin: 0;
}

.toggle-btn {
    position: relative;
    width: 60px;
    height: 30px;
    background: #333;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.toggle-btn.active {
    background: #4ecdc4;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.toggle-btn.active .toggle-slider {
    transform: translateX(30px);
}

.settings-footer {
    margin-top: 40px;
    text-align: center;
    color: #666;
    font-size: 12px;
}

.settings-footer p {
    margin: 5px 0;
}

.version-info {
    font-size: 14px;
    color: #888;
}

.credits {
    color: #666;
}

/* Legacy mobile styles replaced by device-class system below */
/* See "DEVICE-SPECIFIC RESPONSIVE LAYOUTS" section at end of file */

/* Mobile-specific content padding */
.mobile .end-level-content {
    padding: 20px;
}

/* Hide header spacers on mobile */
.mobile .header-spacer {
    display: none;
}

/* =================================
   MUSKUERADE NEW UI COMPONENTS
   ================================= */

/* ── WEAPON SLOT GRID — SYNTHWAVE REDESIGN ───────── */
.weapon-slot-grid-container {
    position: fixed; top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: flex-start;
    z-index: 1000;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
    overflow-y: auto;
    background: #06061a;
}
.weapon-slot-grid-container.visible { opacity: 1; pointer-events: auto; }

.weapon-slot-grid-content {
    position: relative;
    max-width: 600px; width: 100%;
    min-height: 100vh;
    display: flex; flex-direction: column;
    padding-bottom: 24px;
    overflow: hidden;
}

/* ── BACKGROUND LAYERS ───────────────────────────── */
.shop-bg {
    position: absolute; inset: 0;
    pointer-events: none; z-index: 0;
    overflow: hidden;
}

.shop-stars {
    position: absolute; inset: 0;
    background: transparent;
}
.shop-stars::before {
    content: '';
    position: absolute;
    width: 2px; height: 2px;
    background: white;
    box-shadow:
        47px 38px #fff, 92px 15px #fff, 154px 63px rgba(255,255,255,0.7),
        211px 29px #fff, 268px 51px rgba(255,255,255,0.5), 323px 18px #fff,
        389px 44px rgba(255,255,255,0.8), 441px 7px #fff, 503px 33px rgba(255,255,255,0.6),
        558px 56px #fff, 23px 98px rgba(255,255,255,0.4), 77px 122px #fff,
        133px 144px rgba(255,255,255,0.9), 188px 107px #fff, 245px 131px rgba(255,255,255,0.5),
        302px 88px #fff, 357px 115px rgba(255,255,255,0.7), 413px 99px #fff,
        469px 137px rgba(255,255,255,0.4), 524px 112px #fff, 581px 84px rgba(255,255,255,0.6),
        15px 178px #fff, 64px 195px rgba(255,255,255,0.5), 119px 162px #fff,
        176px 188px rgba(255,255,255,0.8), 234px 171px #fff, 289px 199px rgba(255,255,255,0.3),
        345px 155px #fff, 401px 182px rgba(255,255,255,0.6), 457px 170px #fff,
        512px 193px rgba(255,255,255,0.7), 569px 158px rgba(255,255,255,0.4),
        8px 237px rgba(255,255,255,0.5), 55px 252px #fff, 110px 218px rgba(255,255,255,0.6),
        167px 244px #fff, 223px 229px rgba(255,255,255,0.4), 279px 258px #fff,
        336px 212px rgba(255,255,255,0.8), 391px 239px rgba(255,255,255,0.5),
        447px 225px #fff, 503px 247px rgba(255,255,255,0.3), 560px 231px #fff,
        30px 295px rgba(255,255,255,0.7), 86px 308px #fff, 142px 281px rgba(255,255,255,0.5),
        198px 319px #fff, 255px 287px rgba(255,255,255,0.6), 311px 303px rgba(255,255,255,0.4),
        367px 275px #fff, 424px 312px rgba(255,255,255,0.8), 479px 296px #fff,
        536px 284px rgba(255,255,255,0.5), 593px 307px rgba(255,255,255,0.6);
    animation: twinkle 4s ease-in-out infinite alternate;
}
@keyframes twinkle {
    0%  { opacity: 0.7; }
    100%{ opacity: 1.0; }
}

.shop-horizon {
    position: absolute;
    bottom: 38%; left: 50%;
    transform: translateX(-50%);
    width: 120%; height: 280px;
    background: radial-gradient(ellipse at center bottom,
        rgba(180, 60, 220, 0.55) 0%,
        rgba(255, 80, 160, 0.3) 30%,
        transparent 70%);
    pointer-events: none;
}

.shop-grid-floor {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 42%;
    background:
        linear-gradient(to bottom, rgba(78,205,196,0.12) 1px, transparent 1px),
        linear-gradient(to right,  rgba(78,205,196,0.12) 1px, transparent 1px);
    background-size: 40px 40px;
    transform: perspective(200px) rotateX(40deg);
    transform-origin: center top;
    pointer-events: none;
}
.shop-grid-floor::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, rgba(6,6,26,0.85) 0%, transparent 45%);
}

/* ── TOP BAR ──────────────────────────────────────── */
.shop-top-bar {
    position: relative; z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 14px 0;
    gap: 10px;
}

.shop-stats-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shop-stat-box {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.coins-box .stat-icon { color: #ffe66d; font-size: 20px; line-height: 1; display: flex; align-items: center; position: relative; top: -4px; }
.coins-box .stat-value { color: #ffe66d; font-size: 20px; letter-spacing: 1px; line-height: 1; }

.damage-box .stat-icon { font-size: 20px; line-height: 1; display: flex; align-items: center; margin-top: 4px; }
.damage-box { justify-content: flex-start; align-items: center; flex-wrap: wrap; }
.damage-box .stat-value { color: #a7a7b3; font-size: 20px; letter-spacing: 1px; line-height: 1; flex: 1; }
.damage-label { color: #a7a7b3; font-size: 9px; letter-spacing: 1px; text-transform: uppercase; opacity: 0.9; width: 100%; }

.shop-icon-btns {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.shop-icon-btn {
    background: #14141e;
    border: 3px solid #4ecdc4;
    box-shadow: 3px 3px 0 #000;
    width: 44px; height: 44px;
    font-size: 20px;
    position: relative;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.07s, box-shadow 0.07s;
    color: #fff;
}
.shop-icon-btn.gold { border-color: #ffe66d; }
.shop-icon-btn:hover {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 #000;
}

.icon-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 14px;
    height: 14px;
    padding: 0 3px;
    border-radius: 10px;
    border: 1px solid #fff;
    background: #ff4d4d;
    color: #fff;
    font-size: 9px;
    font-weight: bold;
    line-height: 12px;
    text-align: center;
    box-shadow: 1px 1px 0 #000;
    pointer-events: none;
}

/* ── LOGO AREA ────────────────────────────────────── */
.shop-logo-area {
    position: relative; z-index: 1;
    display: flex; justify-content: center; align-items: flex-end;
    height: 360px;
    margin: 0 0 16px;
    pointer-events: none;
}
.shop-logo-img {
    max-height: 360px;
    max-width: 90%;
    object-fit: contain;
}
.shop-logo-fallback {
    display: none;
}

/* ── WEAPON GRID FRAME ────────────────────────────── */
.weapon-grid-frame {
    position: relative; z-index: 1;
    margin: 0 12px 16px;
    border: 3px solid #4ecdc4;
    box-shadow:
        0 0 0 1px rgba(78,205,196,0.3),
        0 0 18px rgba(78,205,196,0.5),
        0 0 40px rgba(78,205,196,0.2),
        4px 4px 0 #000;
    background: rgba(0, 8, 20, 0.85);
    padding: 14px;
}

.weapon-slots-grid {
    display: grid;
    /* columns defined by device-class responsive rules */
}

/* ── SLOT TILES ───────────────────────────────────── */
.weapon-slot {
    aspect-ratio: 1;
    background: #0a0a18;
    border: 2px solid #1e1e38;
    display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    padding: 8px;
    transition: transform 0.07s, box-shadow 0.07s, border-color 0.1s;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
}

.weapon-slot.filled {
    border-color: #4ecdc4;
    background: #0c0c1e;
    cursor: grab;
}
.weapon-slot.filled:hover {
    transform: translate(-1px, -1px);
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 0 10px rgba(78,205,196,0.4);
    border-color: #6ef8f0;
}
.weapon-slot.dragging { opacity: 0.4; }

.weapon-slot.empty {
    border: 2px dashed #252540;
    cursor: pointer;
}
.weapon-slot.empty:hover {
    border-color: #4ecdc4;
    box-shadow: inset 0 0 10px rgba(78,205,196,0.1);
}

.weapon-slot.locked {
    background: #070710;
    border: 2px dashed #1a1a2c;
    cursor: pointer;
    opacity: 0.5;
}
.weapon-slot.locked:hover {
    border-color: #ffe66d;
    opacity: 0.7;
}

.weapon-slot.active {
    border-color: #ffe66d;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 0 12px rgba(255,230,109,0.3);
}

.empty-slot-icon { font-size: 20px; color: #252540; font-weight: bold; }

.slot-lock { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.lock-icon { font-size: 20px; }
.unlock-cost { font-size: 10px; color: #ffe66d; font-weight: bold; letter-spacing: 1px; font-family: 'Courier New', monospace; }

/* ── UPGRADE BUTTON ──────────────────────────────── */
.upgrade-btn {
    position: absolute; top: 3px; right: 3px;
    background: #0f0f1e;
    border: 2px solid #4ecdc4;
    box-shadow: 2px 2px 0 #000;
    width: 18px; height: 18px;
    font-size: 9px; cursor: pointer;
    transition: transform 0.07s, box-shadow 0.07s;
    display: flex; align-items: center; justify-content: center;
    color: #4ecdc4;
    padding: 0;
    line-height: 1;
}
.upgrade-btn-icon-img {
    width: 10px;
    height: 10px;
    display: block;
    image-rendering: pixelated;
    object-fit: contain;
}
.upgrade-btn:hover {
    background: #4ecdc4; color: #0d0d1f;
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #000;
}

/* ── WEAPON ICON / INFO ──────────────────────────── */
.weapon-icon { margin-bottom: 4px; }
.weapon-info { text-align: center; }
.weapon-name { font-size: 9px; color: #4ecdc4; font-weight: bold; letter-spacing: 1px; text-transform: uppercase; }
.weapon-level { font-size: 8px; color: #333355; letter-spacing: 1px; }
.weapon-damage { font-size: 9px; color: #ffe66d; font-weight: bold; }

/* ── FIGHT BUTTON ─────────────────────────────────── */
.fight-btn {
    position: relative; z-index: 1;
    overflow: hidden;
    display: block;
    width: calc(100% - 24px);
    margin: 0 12px;
    padding: 18px 24px;
    font-size: 24px; font-weight: bold;
    font-family: 'Courier New', monospace;
    letter-spacing: 4px; text-transform: uppercase;
    background: linear-gradient(180deg, #7f3cff 0%, #5a1ecf 52%, #3d0f8f 100%);
    color: #f7e9ff;
    border: 3px solid #d28bff;
    box-shadow:
        4px 4px 0 #000,
        0 0 18px rgba(188, 84, 255, 0.7),
        0 0 42px rgba(145, 51, 255, 0.45),
        inset 0 0 0 1px rgba(255, 255, 255, 0.15);
    cursor: pointer;
    text-shadow: 0 0 10px rgba(236, 184, 255, 0.85);
    transition: transform 0.07s, box-shadow 0.07s;
}
.fight-btn:hover {
    transform: translate(2px, 2px);
    box-shadow:
        2px 2px 0 #000,
        0 0 26px rgba(205, 118, 255, 0.85),
        0 0 50px rgba(157, 61, 255, 0.6);
}
.fight-btn::before {
    content: '';
    position: absolute;
    top: -140%;
    left: -55%;
    width: 24%;
    height: 320%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: rotate(24deg);
    animation: fightBtnShine 2.8s ease-in-out infinite;
    pointer-events: none;
}

@keyframes fightBtnShine {
    0%, 58% { left: -60%; opacity: 0; }
    63% { opacity: 0.95; }
    74% { left: 128%; opacity: 0.95; }
    100% { left: 128%; opacity: 0; }
}

/* Weapon Upgrade Popup */
.weapon-upgrade-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.weapon-upgrade-popup.visible {
    opacity: 1;
    pointer-events: auto;
}

.upgrade-popup-content {
    background: #1a1a2e;
    border: 3px solid #4ecdc4;
    border-radius: 15px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
}

.upgrade-caption {
    margin-bottom: 10px;
}

.upgrade-title {
    font-size: 24px;
    color: #ffffff;
    letter-spacing: 0.5px;
}

.upgrade-level-current {
    font-size: 14px;
    color: #9aa3b2;
    margin-top: 4px;
}

.weapon-description {
    font-size: 14px;
    color: #b7c0cc;
    margin: 10px 0 14px;
}

.upgrade-weapon-display {
    margin: 6px 0 12px;
}

.weapon-icon-large {
    font-size: 64px;
}

.upgrade-stats {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 12px 16px;
    margin: 10px 0 16px;
}

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stat-label {
    color: #8b93a1;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.upgrade-actions {
    margin-top: 8px;
}

.upgrade-action-btn {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 18px 16px;
    cursor: pointer;
    color: #0b0f17;
    background: linear-gradient(135deg, #ffe066 0%, #f9a826 45%, #ffcc4d 100%);
    box-shadow:
        0 10px 30px rgba(249, 168, 38, 0.35),
        inset 0 2px 0 rgba(255, 255, 255, 0.5);
    position: relative;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    display: grid;
    gap: 6px;
    text-align: center;
}

.upgrade-action-btn::before {
    content: '';
    position: absolute;
    top: -120%;
    left: -30%;
    width: 160%;
    height: 160%;
    background: linear-gradient(
        120deg,
        rgba(255, 255, 255, 0.05) 0%,
        rgba(255, 255, 255, 0.5) 45%,
        rgba(255, 255, 255, 0.05) 60%
    );
    transform: rotate(6deg);
    animation: upgradeShine 2.4s ease-in-out infinite;
}

@keyframes upgradeShine {
    0% { transform: translateX(-30%) rotate(6deg); }
    100% { transform: translateX(30%) rotate(6deg); }
}

.upgrade-action-btn:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow:
        0 16px 35px rgba(249, 168, 38, 0.45),
        inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

.upgrade-action-btn.disabled {
    background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
    color: #7a7a7a;
    box-shadow: none;
    cursor: not-allowed;
}

.upgrade-small {
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.85;
}

.upgrade-level {
    font-size: 20px;
    font-weight: 800;
}

.upgrade-cost {
    font-size: 14px;
    font-weight: 700;
}

.upgrade-damage {
    font-size: 16px;
    font-weight: 800;
    color: #0b0f17;
}

.upgrade-close {
    margin-top: 12px;
}

.popup-close-btn {
    background: #1a1a2e;
    border: 2px solid #555577;
    box-shadow: 2px 2px 0 #000;
    color: #888;
    font-size: 14px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    transition: transform 0.07s, box-shadow 0.07s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    flex-shrink: 0;
}

.popup-close-btn:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #000;
}

.upgrade-weapon-icon-large {
    font-size: 64px;
    margin: 20px 0;
}

.upgrade-weapon-title {
    font-size: 24px;
    color: #4ecdc4;
    margin-bottom: 10px;
}

.upgrade-weapon-level {
    font-size: 16px;
    color: #888;
    margin-bottom: 20px;
}

.upgrade-stats-container {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.upgrade-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.upgrade-stat-row:last-child {
    border-bottom: none;
}

.upgrade-stat-label {
    color: #888;
    font-size: 14px;
}

.upgrade-stat-value {
    font-size: 18px;
    font-weight: bold;
}

.upgrade-current {
    color: #ffffff;
}

.upgrade-arrow {
    color: #4ecdc4;
    margin: 0 10px;
}

.upgrade-next {
    color: #ffe66d;
}

.upgrade-cost {
    font-size: 20px;
    color: #ffe66d;
    font-weight: bold;
    margin: 20px 0;
}

.global-upgrade-notice {
    background: rgba(255, 215, 0, 0.15);
    border: 2px solid #ffd700;
    border-radius: 10px;
    padding: 12px 20px;
    margin: 15px 0;
    font-size: 15px;
    color: #ffd700;
    font-weight: bold;
    text-align: center;
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    }
}

.upgrade-btn-large {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    font-weight: bold;
    background: #4ecdc4;
    color: #1a1a2e;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.upgrade-btn-large:hover:not(.disabled) {
    background: #5fd9d0;
    transform: translateY(-2px);
}

.upgrade-btn-large.disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

/* ── WEAPON PURCHASE POPUP ───────────────────────── */
.weapon-purchase-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.weapon-purchase-popup.visible {
    opacity: 1;
    pointer-events: auto;
}

.purchase-popup-content {
    background: #0d0d1f;
    background-image: repeating-linear-gradient(
        0deg, transparent, transparent 3px,
        rgba(255,255,255,0.01) 3px, rgba(255,255,255,0.01) 4px
    );
    border: 4px solid #4ecdc4;
    box-shadow: 6px 6px 0 #000;
    padding: 0;
    max-width: 450px;
    width: 92%;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

.purchase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #12122a;
    border-bottom: 3px solid #4ecdc4;
    box-shadow: 0 3px 0 #000;
}

.purchase-header h2 {
    font-size: 17px;
    color: #4ecdc4;
    margin: 0;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(78,205,196,0.5);
}

.purchase-coins {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
    background: #1a1a2e;
    border: 3px solid #ffe66d;
    box-shadow: 3px 3px 0 #000;
    padding: 10px 18px;
    margin: 16px;
}

.purchase-coins .coins-icon {
    font-size: 16px;
    color: #ffe66d;
}

.purchase-coins .coins-amount {
    font-size: 20px;
    font-weight: bold;
    color: #ffe66d;
    letter-spacing: 1px;
}

.weapon-purchase-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 16px 16px;
}

.weapon-purchase-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #1a1a2e;
    border: 2px solid #2a2a4a;
    box-shadow: 3px 3px 0 #000;
    padding: 12px 14px;
    cursor: pointer;
    transition: transform 0.07s, box-shadow 0.07s, border-color 0.1s;
    margin-bottom: 8px;
}

.weapon-purchase-item:hover:not(.disabled) {
    border-color: #4ecdc4;
    transform: translate(-2px, -2px);
    box-shadow: 5px 5px 0 #000;
    background: #161630;
}

.weapon-purchase-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #222238;
    background: #0d0d1a;
    box-shadow: 2px 2px 0 #000;
}

.weapon-purchase-icon {
    min-width: 52px;
    text-align: center;
}

.weapon-purchase-info {
    flex: 1;
}

.weapon-purchase-name {
    font-size: 14px;
    font-weight: bold;
    color: #ffffff;
    margin-bottom: 4px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.weapon-purchase-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #444466;
    font-family: 'Courier New', monospace;
}

.weapon-purchase-price {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 18px;
    font-weight: bold;
    color: #ffe66d;
    white-space: nowrap;
}

.weapon-purchase-price .price-icon {
    font-size: 14px;
}

/* Try Again Screen */
.try-again-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.try-again-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.try-again-content {
    background: #1a1a2e;
    border: 3px solid #ff6b6b;
    border-radius: 15px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.try-again-title {
    font-size: 32px;
    color: #ff6b6b;
    margin-bottom: 10px;
    font-weight: bold;
}

.try-again-subtitle {
    font-size: 16px;
    color: #888;
    margin-bottom: 25px;
}

.try-again-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
}

.stat-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 18px;
    color: #ffffff;
    font-weight: bold;
    margin-bottom: 10px;
}

.coins-earned {
    color: #ffe66d !important;
}

.stat-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #ff5252);
    transition: width 0.3s ease;
}

.stat-percent {
    font-size: 12px;
    color: #ff6b6b;
}

.stat-info {
    font-size: 12px;
    color: #888;
}

.try-again-tip {
    background: rgba(78, 205, 196, 0.1);
    border-left: 3px solid #4ecdc4;
    padding: 15px;
    margin-bottom: 25px;
    text-align: left;
    font-size: 14px;
    color: #bbbbbb;
}

.try-again-buttons {
    display: flex;
    gap: 15px;
}

/* Chest Opening Screen */
.chest-opening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.chest-opening-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.chest-opening-content {
    text-align: center;
    max-width: 500px;
    width: 90%;
    pointer-events: auto;
}

.chest-title {
    font-size: 36px;
    color: #ffe66d;
    margin-bottom: 60px;
    text-shadow: 0 0 20px rgba(255, 230, 109, 0.5);
}

.chest-icon-container {
    position: relative;
    margin: 40px 0;
}

.chest-icon-large {
    font-size: 120px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    pointer-events: auto;
    user-select: none;
}

.chest-icon-large:hover {
    transform: scale(1.1);
}

.chest-icon-large.opened {
    animation: chestShake 0.5s ease;
}

/* Simple chest container */
.chest-container {
    position: relative;
    display: inline-block;
    cursor: pointer;
    user-select: none;
}

.chest-emoji {
    font-size: 120px;
    display: block;
    transition: transform 0.3s ease;
}

.chest-container:hover .chest-emoji {
    transform: scale(1.05);
}

.chest-container.opened .chest-emoji {
    animation: chestPulse 0.3s ease;
}

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

@keyframes chestShake {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-10deg); }
    75% { transform: rotate(10deg); }
}

.chest-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255, 230, 109, 0.3), transparent);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    pointer-events: none;
}

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
}

.chest-instruction {
    font-size: 18px;
    color: #4ecdc4;
    margin-top: 20px;
}

.chest-reward {
    margin-top: 40px;
}

.reward-burst {
    position: relative;
    height: 80px;
    margin-bottom: 20px;
}

.coin-burst {
    position: absolute;
    font-size: 32px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
}

@keyframes coinBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(0) scale(0.5);
    }
    30% {
        opacity: 1;
    }
    60% {
        transform: translate(-50%, -50%) translateY(-60px) scale(1.2);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0) scale(1);
    }
}

.reward-amount {
    font-size: 32px;
    color: #ffe66d;
    font-weight: bold;
    margin-bottom: 20px;
}

.weapon-reward {
    margin: 20px 0 30px 0;
    padding: 20px;
    background: rgba(78, 205, 196, 0.1);
    border: 2px solid #4ecdc4;
    border-radius: 10px;
}

.weapon-reward-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: weaponPop 0.5s ease;
}

@keyframes weaponPop {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
    50% {
        transform: translateY(-20px) scale(1.2);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.weapon-reward-text {
    font-size: 20px;
    color: #4ecdc4;
    font-weight: bold;
    text-transform: capitalize;
}

.weapon-reward.banned {
    background: rgba(255, 80, 80, 0.08);
    border-color: rgba(255, 80, 80, 0.6);
}

.weapon-reward.banned .weapon-reward-text {
    color: #ff6b6b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.weapon-reward-note {
    margin-top: 6px;
    font-size: 12px;
    color: #ffb3b3;
}

.cutscene-overlay {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: auto;
}

.cutscene-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(57, 255, 20, 0.06) 0px,
        rgba(57, 255, 20, 0.06) 2px,
        transparent 2px,
        transparent 4px
    );
    pointer-events: none;
}

.cutscene-frame {
    width: min(90vw, 760px);
    padding: 24px;
    border: 1px solid rgba(57, 255, 20, 0.45);
    background: rgba(0, 0, 0, 0.88);
    box-shadow: 0 0 28px rgba(57, 255, 20, 0.12);
    text-align: center;
    pointer-events: auto;
}

.cutscene-text {
    white-space: pre-line;
    color: #39ff14;
    font-family: "Courier New", monospace;
    font-size: clamp(18px, 2.6vw, 30px);
    line-height: 1.4;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.cutscene-prompt {
    margin-top: 14px;
    color: #39ff14;
    font-family: "Courier New", monospace;
    font-size: 12px;
    letter-spacing: 1px;
    opacity: 0.8;
}

.hidden {
    display: none !important;
}

/* Missing animation classes for chest opening screen */
.chest-opening-screen.animating-in {
    opacity: 0;
}

.chest-opening-screen.animating-in-active {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

.fade-in {
    animation: fadeIn 0.3s ease-in forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Achievements Screen */
.achievements-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Changed from center to allow scrolling from top */
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
    padding: 20px 0; /* Add padding for better mobile spacing */
}

.achievements-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.achievements-content {
    max-width: 700px;
    width: 90%;
    padding: 20px;
    margin: 40px 0;
}

.achievements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.achievements-title {
    font-size: 32px;
    color: #ffe66d;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.close-btn {
    background: none;
    border: 2px solid #666;
    color: #888;
    font-size: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.close-btn:hover {
    border-color: #4ecdc4;
    color: #ffffff;
}

.achievements-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 30px;
}

.achievement-card {
    background: #1a1a2e;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    transition: all 0.2s ease;
}

.achievement-card.achievement-achieved {
    border-color: #4ecdc4;
}

.achievement-card.achievement-collected {
    border-color: #ffe66d;
    opacity: 0.7;
}

.achievement-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
}

.achievement-icon-sprite {
    width: 48px;
    height: 48px;
    display: inline-block;
    background-image: url('../assets/sprites/ui/awards-icons-sheet.png');
    background-repeat: no-repeat;
    background-size: 192px 192px; /* 4x4 sheet scaled to 48px cells */
    image-rendering: pixelated;
}

.achievement-icon-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    image-rendering: pixelated;
}

.achievement-locked .achievement-icon-sprite {
    filter: grayscale(1) brightness(0.85);
}

.achievement-info {
    flex: 1;
}

.achievement-name {
    font-size: 18px;
    color: #4ecdc4;
    margin-bottom: 5px;
    font-weight: bold;
}

.achievement-description {
    font-size: 14px;
    color: #888;
    margin-bottom: 8px;
}

.achievement-progress {
    font-size: 12px;
    color: #ffe66d;
}

.achievement-status {
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    white-space: nowrap;
}

.achievement-locked .achievement-status {
    background: rgba(0, 0, 0, 0.3);
    color: #666;
}

.achievement-collected .achievement-status {
    background: rgba(255, 230, 109, 0.2);
    color: #ffe66d;
}

.collect-btn {
    background: #4ecdc4;
    color: #1a1a2e;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.collect-btn:hover {
    background: #5fd9d0;
    transform: translateY(-2px);
}

.achievements-summary {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
}

.summary-stats {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.summary-stat {
    text-align: center;
}

.summary-stat .stat-label {
    font-size: 14px;
    color: #888;
    margin-bottom: 5px;
}

.summary-stat .stat-value {
    font-size: 24px;
    color: #4ecdc4;
    font-weight: bold;
}

/* Updated End Level Screen for Muskuerade */
.end-level-summary {
    display: flex;
    gap: 15px;
    margin: 25px 0;
}

.summary-card {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.summary-label {
    font-size: 12px;
    color: #888;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 24px;
    color: #ffffff;
    font-weight: bold;
    margin-bottom: 10px;
}

.summary-icon {
    font-size: 32px;
}

.coins-earned {
    font-size: 16px;
    color: #ffe66d;
    margin-bottom: 10px;
}

.coins-label {
    font-size: 14px;
    color: #888;
    margin-right: 10px;
}

.coins-value {
    font-size: 24px;
    color: #ffe66d;
    font-weight: bold;
}

/* ========================================
   DEVICE-SPECIFIC RESPONSIVE LAYOUTS
   Using ResponsiveManager classes (.mobile, .tablet, .desktop)
   ======================================== */

/* Weapon Slots Grid */
.weapon-slots-grid {
    display: grid;
    gap: 15px;
}

.mobile .weapon-slots-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.tablet .weapon-slots-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.desktop .weapon-slots-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}


/* Try Again Screen Stats */
.mobile .try-again-stats {
    flex-direction: column;
}

/* End Level Summary */
.mobile .end-level-summary {
    flex-direction: column;
}

/* Achievements Grid */
.achievements-grid {
    display: grid;
    gap: 15px;
}

.mobile .achievements-grid {
    grid-template-columns: 1fr;
}

.tablet .achievements-grid,
.desktop .achievements-grid {
    grid-template-columns: 1fr;
}

/* Shop Header - Stack vertically on mobile */
.mobile .shop-header {
    flex-direction: column;
    gap: 15px;
    text-align: center;
}

/* Level Select Grid */
.levels-grid {
    display: grid;
    gap: 15px;
}

.mobile .levels-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.tablet .levels-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.desktop .levels-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 15px;
}

/* Buttons - Full width on mobile */
.mobile .end-level-buttons {
    flex-direction: column;
}

.mobile .btn {
    width: 100%;
}

/* Settings Header */
.mobile .settings-header {
    flex-direction: column;
    gap: 15px;
}

/* Weapon icon images (procedural art) */
.weapon-icon-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    image-rendering: auto;
    display: block;
    margin: 0 auto;
}

.weapon-icon-img-large {
    width: 80px;
    height: 80px;
    object-fit: contain;
    image-rendering: auto;
    display: block;
    margin: 0 auto;
}

.weapon-purchase-icon .weapon-icon-img {
    width: 40px;
    height: 40px;
}

.weapon-reward-icon .weapon-icon-img {
    width: 56px;
    height: 56px;
}

/* Font sizes - Smaller on mobile */
.mobile .game-title {
    font-size: 36px;
}

.mobile .end-level-title {
    font-size: 24px;
}

.mobile .level-number {
    font-size: 20px;
}

/* HUD adjustments for mobile */
.mobile .hud-top-bar {
    padding: 10px;
}

.mobile .hud-coins,
.mobile .hud-level,
.mobile .hud-ball {
    padding: 6px 10px;
    font-size: 14px;
}

/* ── REWARDED AD BUTTON ──────────────────────────── */
.ad-watch-btn {
    display: block;
    width: calc(100% - 24px);
    margin: 0 12px 10px;
    padding: 10px 16px;
    background: #14141e;
    color: #ffe66d;
    border: 2px solid #ffe66d;
    box-shadow: 2px 2px 0 #000;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.07s, box-shadow 0.07s, background 0.07s;
    text-align: center;
}
.ad-watch-btn:hover {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 #000;
    background: #ffe66d;
    color: #0d0d1f;
}
/* Slightly smaller in the try-again screen where space is tighter */
.try-again-content .ad-watch-btn {
    font-size: 11px;
    padding: 8px 12px;
    margin: 0 0 12px;
    width: 100%;
}
