* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a0a;
    overflow: hidden;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    color: #e8d5b7;
    font-size: 14px;
}

#hud-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#level-info {
    display: flex;
    gap: 16px;
    align-items: center;
}

#level-name {
    font-weight: bold;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #c0392b;
    text-shadow: 0 0 10px rgba(192, 57, 43, 0.5);
}

#timer {
    font-family: monospace;
    font-size: 15px;
    background: rgba(0,0,0,0.5);
    padding: 2px 8px;
    border-radius: 4px;
}

#score-display {
    font-size: 18px;
    font-weight: bold;
    text-shadow: 0 0 8px rgba(255,215,0,0.6);
    color: #ffd700;
}

#hud-bottom {
    display: flex;
    gap: 10px;
    max-width: 600px;
}

#xp-bar-container, #hp-bar-container {
    flex: 1;
    height: 22px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 11px;
    position: relative;
    overflow: hidden;
}

#xp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #8e44ad, #3498db);
    border-radius: 11px;
    transition: width 0.3s;
    width: 0%;
}

#hp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    border-radius: 11px;
    transition: width 0.3s;
    width: 100%;
}

#xp-text, #hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: bold;
    text-shadow: 0 1px 2px rgba(0,0,0,0.8);
    color: #fff;
}

#active-effects {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.effect-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    animation: pulse 1.5s ease-in-out infinite;
}

.effect-icon.buff { border-color: #2ecc71; background: rgba(46,204,113,0.3); }
.effect-icon.debuff { border-color: #e74c3c; background: rgba(231,76,60,0.3); }

/* Upgrade Overlay */
#upgrade-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

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

#upgrade-panel {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 2px solid #c0392b;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    min-width: 500px;
    max-width: 700px;
    box-shadow: 0 0 40px rgba(192,57,43,0.3);
}

#upgrade-panel h2 {
    color: #e8d5b7;
    font-size: 24px;
    margin-bottom: 20px;
    text-shadow: 0 0 15px rgba(192,57,43,0.5);
}

#upgrade-choices {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.upgrade-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    padding: 20px;
    width: 180px;
    cursor: pointer;
    transition: all 0.2s;
    color: #ccc;
}

.upgrade-card:hover {
    background: rgba(192,57,43,0.2);
    border-color: #c0392b;
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(192,57,43,0.3);
}

.upgrade-card .icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.upgrade-card .name {
    font-weight: bold;
    font-size: 14px;
    color: #fff;
    margin-bottom: 6px;
}

.upgrade-card .description {
    font-size: 11px;
    color: #aaa;
    line-height: 1.4;
}

.upgrade-card .rarity {
    font-size: 10px;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rarity-common { color: #aaa; }
.rarity-rare { color: #3498db; }
.rarity-epic { color: #9b59b6; }
.rarity-legendary { color: #f39c12; }
.rarity-mythic { color: #e74c3c; }

/* Combo Indicator */
#combo-indicator {
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 50;
}

#combo-indicator.hidden {
    display: none;
}

#combo-text {
    font-size: 28px;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 0 0 20px rgba(255,215,0,0.7);
    animation: comboPopIn 0.3s ease-out;
}

#combo-timer-bar {
    height: 4px;
    background: rgba(255,215,0,0.5);
    border-radius: 2px;
    margin-top: 4px;
    transition: width 0.1s linear;
}

@keyframes comboPopIn {
    from { transform: scale(0.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

/* Inventory Tray */
#inventory-tray {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

#consumable-slots {
    display: flex;
    gap: 8px;
}

.consumable-slot {
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.6);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.consumable-slot:hover {
    border-color: #ffd700;
    box-shadow: 0 0 15px rgba(255,215,0,0.3);
}

.consumable-slot .key-hint {
    position: absolute;
    bottom: -18px;
    font-size: 10px;
    color: #888;
}

.consumable-slot.empty {
    opacity: 0.4;
}

/* Game Over */
#game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

#game-over-overlay.hidden {
    display: none;
}

#game-over-panel {
    background: linear-gradient(135deg, #1a0a0a, #2a0a0a);
    border: 2px solid #c0392b;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    color: #e8d5b7;
    min-width: 350px;
}

#game-over-panel h2 {
    font-size: 36px;
    color: #c0392b;
    margin-bottom: 20px;
    text-shadow: 0 0 25px rgba(192,57,43,0.6);
}

#game-over-panel p {
    font-size: 16px;
    margin-bottom: 10px;
    color: #ccc;
}

#restart-btn {
    margin-top: 20px;
    padding: 12px 40px;
    font-size: 18px;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

#restart-btn:hover {
    background: #e74c3c;
    box-shadow: 0 0 20px rgba(231,76,60,0.5);
}

/* Pause Overlay */
#pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
}

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

#pause-panel {
    background: rgba(20,20,40,0.95);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    min-width: 250px;
}

#pause-panel h2 {
    color: #e8d5b7;
    margin-bottom: 20px;
}

#resume-btn, #quit-btn {
    display: block;
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

#resume-btn {
    background: #27ae60;
    color: #fff;
}

#resume-btn:hover { background: #2ecc71; }

#quit-btn {
    background: #7f8c8d;
    color: #fff;
}

#quit-btn:hover { background: #95a5a6; }
