* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    overflow: hidden;
    background: #0a0a0a;
    font-family: 'Space Grotesk', sans-serif;
    touch-action: none;
}

#canvas {
    display: block;
    width: 100vw;
    height: 100vh;
}

#hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 10;
}

#points-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

#points-icon {
    color: #F1C40F;
    font-size: 16px;
    animation: coin-pulse 2s infinite;
}

@keyframes coin-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

#combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 0 20px rgba(255,255,255,0.5);
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    pointer-events: none;
}

#combo-display.active {
    opacity: 1;
    animation: combo-pop 0.4s ease-out;
}

@keyframes combo-pop {
    0% { transform: translate(-50%, -50%) scale(1.5); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

#shop-btn {
    pointer-events: all;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.2s;
}

#shop-btn:hover {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

#equipped-bar {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    pointer-events: none;
    z-index: 10;
}

.equipped-slot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px dashed rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: rgba(255,255,255,0.4);
}

.equipped-slot.filled {
    border-style: solid;
    border-color: rgba(255,255,255,0.6);
    background: rgba(255,255,255,0.1);
}

#shop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

#shop-overlay.hidden {
    display: none;
}

#shop-modal {
    background: #111;
    border: 1px solid #333;
    border-radius: 16px;
    width: min(90vw, 600px);
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    padding: 24px;
}

#shop-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: #1a1a1a;
    color: #888;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 2px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: #222;
    color: #fff;
    box-shadow: 0 0 10px rgba(255,255,255,0.05);
}

#shop-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    z-index: 2;
}

#shop-close:hover {
    color: #fff;
}

#shop-content {
    display: grid;
    gap: 12px;
}

.lootbox-card {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s;
}

.lootbox-card:hover {
    border-color: #444;
}

.lootbox-info h3 {
    font-size: 15px;
    color: #fff;
    margin-bottom: 4px;
}

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

.lootbox-price {
    display: flex;
    align-items: center;
    gap: 4px;
    font-family: 'JetBrains Mono', monospace;
    color: #F1C40F;
    font-size: 14px;
    font-weight: 700;
}

.buy-btn {
    background: #4A90D9;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.buy-btn:hover {
    background: #5ba0e9;
    transform: scale(1.05);
}

.buy-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
}

.inventory-section {
    margin-bottom: 16px;
}

.inventory-section h3 {
    color: #fff;
    font-size: 14px;
    letter-spacing: 2px;
    margin-bottom: 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid #222;
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.inv-item {
    background: #1a1a1a;
    border: 2px solid #2a2a2a;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.inv-item:hover {
    border-color: #444;
}

.inv-item.equipped {
    border-color: #4A90D9;
    box-shadow: 0 0 12px rgba(74,144,217,0.3);
}

.inv-item canvas {
    border-radius: 50%;
    margin-bottom: 6px;
}

.inv-item .item-name {
    font-size: 11px;
    color: #ccc;
    font-weight: 500;
}

.inv-item .item-rarity {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-top: 2px;
}

.rarity-common { color: #888; }
.rarity-rare { color: #4A90D9; }
.rarity-epic { color: #9B59B6; }
.rarity-legendary { color: #F1C40F; }

#opening-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.95);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

#opening-overlay.hidden {
    display: none;
}

#opening-content {
    text-align: center;
    color: #fff;
}

.reveal-item-name {
    font-size: 28px;
    font-weight: 700;
    margin-top: 20px;
    animation: reveal-in 0.5s ease-out;
}

.reveal-item-rarity {
    font-size: 14px;
    letter-spacing: 3px;
    margin-top: 8px;
    animation: reveal-in 0.5s ease-out 0.2s both;
}

.reveal-category {
    font-size: 12px;
    color: #888;
    margin-top: 4px;
    animation: reveal-in 0.5s ease-out 0.3s both;
}

.reveal-duplicate {
    font-size: 12px;
    color: #F1C40F;
    margin-top: 12px;
}

.reveal-close {
    margin-top: 30px;
    padding: 10px 24px;
    background: #222;
    border: 1px solid #444;
    color: #fff;
    border-radius: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    cursor: pointer;
    animation: reveal-in 0.5s ease-out 0.4s both;
}

@keyframes reveal-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#footer-link {
    position: fixed;
    bottom: 12px;
    right: 16px;
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    text-decoration: none;
    z-index: 5;
    font-family: 'Space Grotesk', sans-serif;
}

#footer-link:hover {
    color: rgba(255,255,255,0.5);
}

@media (max-width: 480px) {
    #shop-modal {
        width: 95vw;
        max-height: 85vh;
        padding: 16px;
    }
    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
}