* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Outfit', 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #07090e;
    color: #f0f6fc;
}

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

canvas {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #080a10;
}

/* Screen Shake Effect */
.screen-shake {
    animation: shake 0.18s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-3px, 1px, 0); }
    20%, 80% { transform: translate3d(4px, -2px, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 3px, 0); }
    40%, 60% { transform: translate3d(6px, -1px, 0); }
}

/* HUD Layers */
.hud-layer {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

.hud-top-left {
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: auto;
}

.player-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(13, 17, 28, 0.85);
    padding: 10px 16px;
    border-radius: 14px;
    border: 1px solid rgba(0, 240, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), inset 0 0 15px rgba(0, 240, 255, 0.1);
    backdrop-filter: blur(12px);
}

.avatar-box {
    font-size: 28px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle, rgba(0,240,255,0.2), rgba(0,0,0,0.6));
    border-radius: 10px;
    border: 1px solid #00f0ff;
}

.stat-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 180px;
}

.bar-container {
    position: relative;
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.bar-fill {
    height: 100%;
    transition: width 0.15s ease-out;
}

.hp-fill {
    background: linear-gradient(90deg, #ff0055, #ff4500);
    box-shadow: 0 0 10px #ff0055;
}

.exp-fill {
    background: linear-gradient(90deg, #00f0ff, #7000ff);
    box-shadow: 0 0 10px #00f0ff;
}

.boss-fill {
    background: linear-gradient(90deg, #ff0055, #ff00a0);
    box-shadow: 0 0 15px #ff0055;
}

.bar-text {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

/* Top Center Boss & Wave */
.hud-top-center {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

.wave-badge {
    background: rgba(15, 20, 35, 0.85);
    border: 1px solid rgba(0, 240, 255, 0.4);
    padding: 6px 20px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.2);
}

.wave-label {
    font-size: 12px;
    font-weight: 800;
    color: #88a0c0;
    letter-spacing: 2px;
}

.wave-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 20px;
    font-weight: 900;
    color: #00f0ff;
    text-shadow: 0 0 8px #00f0ff;
}

.boss-bar-box {
    width: 360px;
    background: rgba(20, 5, 10, 0.9);
    border: 1px solid #ff0055;
    padding: 8px 14px;
    border-radius: 10px;
    box-shadow: 0 0 25px rgba(255, 0, 85, 0.4);
}

.boss-name {
    font-size: 12px;
    font-weight: 800;
    color: #ff3377;
    margin-bottom: 4px;
    text-align: center;
    letter-spacing: 1px;
}

/* Top Right Currency & Kills */
.hud-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 14px;
    pointer-events: auto;
}

.currency-box, .kills-box {
    background: rgba(13, 17, 28, 0.85);
    border: 1px solid rgba(255, 200, 0, 0.4);
    padding: 8px 16px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.kills-box {
    border-color: rgba(255, 0, 85, 0.4);
}

.souls-val, .kills-val {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: #ffcc00;
}

.kills-val {
    color: #ff3366;
}

/* Combo badge */
.combo-container {
    position: absolute;
    right: 40px;
    top: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: comboPulse 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
    z-index: 12;
}

@keyframes comboPulse {
    0% { transform: scale(0.6) rotate(-5deg); opacity: 0; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.combo-num {
    font-family: 'Orbitron', sans-serif;
    font-size: 48px;
    font-weight: 900;
    color: #ff0055;
    text-shadow: 0 0 20px #ff0055, 0 0 40px #ff0000;
    font-style: italic;
}

.combo-label {
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 3px;
    color: #ffcc00;
    text-shadow: 0 0 10px #ffcc00;
}

/* Bottom Skill Bar */
#skill-bar {
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    pointer-events: auto;
}

.skill-btn {
    position: relative;
    width: 60px;
    height: 60px;
    background: rgba(15, 20, 35, 0.85);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.6);
    transition: all 0.15s ease;
    overflow: hidden;
}

.skill-btn:hover {
    transform: translateY(-4px);
    border-color: #00f0ff;
    box-shadow: 0 10px 25px rgba(0, 240, 255, 0.3);
}

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

.skill-icon {
    font-size: 22px;
}

.skill-key {
    font-size: 10px;
    font-weight: 800;
    color: #88a0c0;
    margin-top: 2px;
}

.cd-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: rgba(0, 0, 0, 0.75);
    pointer-events: none;
    transition: height 0.1s linear;
}

.shop-trigger-btn {
    border-color: rgba(255, 200, 0, 0.5);
}

.shop-trigger-btn:hover {
    border-color: #ffcc00;
    box-shadow: 0 10px 25px rgba(255, 200, 0, 0.4);
}

/* Mobile HUD Controls */
.mobile-hud {
    display: none;
    position: absolute;
    bottom: 20px;
    width: 100%;
    height: 180px;
    pointer-events: none;
    z-index: 15;
}

@media (max-width: 900px) {
    .mobile-hud {
        display: flex;
        justify-content: space-between;
        padding: 0 20px;
    }
    #skill-bar {
        bottom: 190px;
        scale: 0.85;
    }
}

#dpad-zone {
    position: relative;
    width: 130px;
    height: 130px;
    background: rgba(255, 255, 255, 0.06);
    border: 2px dashed rgba(0, 240, 255, 0.3);
    border-radius: 50%;
    pointer-events: auto;
    touch-action: none;
}

#dpad-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin-left: -25px;
    margin-top: -25px;
    background: radial-gradient(circle, #00f0ff, #0088cc);
    border-radius: 50%;
    box-shadow: 0 0 15px #00f0ff;
    transition: transform 0.05s ease;
}

#action-zone {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    pointer-events: auto;
}

.mobile-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(15, 20, 35, 0.9);
    border: 2px solid #00f0ff;
    color: white;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 240, 255, 0.3);
}

.mobile-btn.m-attack {
    width: 75px;
    height: 75px;
    border-color: #ff0055;
    background: radial-gradient(circle, rgba(255,0,85,0.4), rgba(15,20,35,0.9));
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.5);
}

/* Modals & Overlays */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 12, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.modal-overlay.active, .modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.hidden {
    display: none !important;
}

.modal-card {
    background: rgba(13, 17, 28, 0.95);
    border: 1px solid rgba(0, 240, 255, 0.4);
    border-radius: 20px;
    padding: 36px 40px;
    width: 90%;
    max-width: 520px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 240, 255, 0.15);
    text-align: center;
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 38px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.15;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.game-title .highlight {
    color: #00f0ff;
    text-shadow: 0 0 20px #00f0ff;
}

.danger-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 36px;
    color: #ff0055;
    text-shadow: 0 0 20px #ff0055;
}

.subtitle {
    font-size: 11px;
    font-weight: 800;
    color: #788ca8;
    letter-spacing: 3px;
    margin-bottom: 24px;
}

.menu-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.4);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    margin-bottom: 24px;
    text-align: left;
}

.control-tip {
    font-size: 13px;
    color: #c0d0e8;
    line-height: 1.5;
}

.control-tip span {
    color: #00f0ff;
    font-weight: 700;
}

.audio-toggle-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
    font-size: 13px;
    color: #a0b5d0;
}

.btn-primary {
    background: linear-gradient(135deg, #00f0ff, #0066ff);
    color: #050810;
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    font-weight: 900;
    padding: 14px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 240, 255, 0.4);
    transition: all 0.2s ease;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 240, 255, 0.6);
}

/* Shop Modal Design */
.shop-menu {
    max-width: 620px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    font-size: 20px;
    color: #00f0ff;
}

.shop-souls {
    font-size: 14px;
    color: #ffcc00;
}

.close-btn {
    background: none;
    border: none;
    color: #a0b5d0;
    font-size: 20px;
    cursor: pointer;
}

.shop-items-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 380px;
    overflow-y: auto;
    padding-right: 6px;
    margin-bottom: 20px;
}

.shop-item {
    display: flex;
    align-items: center;
    background: rgba(18, 24, 40, 0.8);
    border: 1px solid rgba(0, 240, 255, 0.2);
    padding: 12px 16px;
    border-radius: 12px;
    gap: 14px;
}

.item-icon {
    font-size: 28px;
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.item-details {
    flex: 1;
    text-align: left;
}

.item-name {
    font-size: 14px;
    font-weight: 700;
    color: #e0ecff;
}

.item-level {
    font-size: 11px;
    color: #00f0ff;
    margin-top: 2px;
}

.buy-btn {
    background: rgba(255, 200, 0, 0.15);
    border: 1px solid #ffcc00;
    color: #ffcc00;
    font-weight: 800;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.buy-btn:hover {
    background: #ffcc00;
    color: #050810;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
}

.buy-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: #666;
    color: #888;
    background: none;
}

/* Result Stats */
.result-stats {
    background: rgba(0, 0, 0, 0.4);
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.res-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: #a0b5d0;
}

.res-row b {
    color: #ffffff;
    font-family: 'Orbitron', sans-serif;
}

.highlight-row {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 8px;
    font-size: 16px;
    color: #00f0ff;
}

.highlight-row b {
    color: #00f0ff;
    font-size: 20px;
    text-shadow: 0 0 10px #00f0ff;
}
