@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Noto+Sans+KR:wght@300;400;700&display=swap');

:root {
    --gold: #ffd700;
    --gold-dim: #b8860b;
    --red: #ff2244;
    --cyan: #00e5ff;
    --green: #00e676;
    --purple: #ce93d8;
    --bg: #050810;
    --panel: rgba(3,8,18,0.9);
    --border: rgba(0,229,255,0.3);
    --glow-gold: 0 0 16px rgba(255,215,0,0.7);
    --glow-red: 0 0 16px rgba(255,34,68,0.7);
    --glow-cyan: 0 0 16px rgba(0,229,255,0.6);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { 
    background: var(--bg); color: #e0e8ff; font-family: 'Noto Sans KR', sans-serif; 
    user-select: none; touch-action: none; overflow: hidden;
    width: 100vw; height: 100vh;
}

#game-wrapper {
    position: absolute; top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden; z-index: 1;
}

#canvas-container { position: absolute; inset: 0; z-index: 1; }

/* 스캔라인 효과 */
#scanlines {
    position: absolute; inset: 0; z-index: 2; pointer-events: none;
    background: repeating-linear-gradient(
        to bottom, transparent 0px, transparent 3px,
        rgba(0,0,0,0.04) 3px, rgba(0,0,0,0.04) 4px
    );
}

.overlay {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    justify-content: center; align-items: center;
    background: 
        radial-gradient(ellipse at 50% 20%, rgba(0,80,160,0.35) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 80%, rgba(80,0,120,0.2) 0%, transparent 50%),
        rgba(5,8,16,0.97);
    z-index: 50; transition: opacity 0.4s;
}
.hidden { display: none !important; }

/* 오버레이 배경 입자 */
.overlay::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background-image: 
        radial-gradient(1px 1px at 15% 25%, rgba(0,229,255,0.4) 0%, transparent 100%),
        radial-gradient(1px 1px at 35% 65%, rgba(0,229,255,0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 70% 20%, rgba(255,215,0,0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 85% 75%, rgba(0,229,255,0.3) 0%, transparent 100%);
}

/* 오버레이 하단 테크 선 */
.overlay::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    pointer-events: none;
}

.main-title {
    font-family: 'Orbitron', monospace; font-size: 80px; font-weight: 900; letter-spacing: 12px;
    background: linear-gradient(135deg, #fff8e0 0%, #ffd700 30%, #ff9100 60%, #ffd700 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 40px rgba(255,180,0,0.7));
    animation: titlePulse 3s ease-in-out infinite; text-align: center;
    position: relative;
}
@keyframes titlePulse { 
    0%,100% { filter: drop-shadow(0 0 25px rgba(255,180,0,0.5)); } 
    50% { filter: drop-shadow(0 0 60px rgba(255,180,0,1.0)); } 
}

.sub-title { 
    font-family: 'Orbitron', monospace; font-size: 11px; letter-spacing: 8px; 
    color: rgba(0,229,255,0.6); margin: 10px 0 35px; 
    text-transform: uppercase; text-align: center;
    text-shadow: 0 0 15px rgba(0,229,255,0.4);
}

.btn {
    padding: 13px 44px; margin: 7px; font-size: 13px; font-weight: 700; letter-spacing: 3px;
    font-family: 'Orbitron', monospace; color: #c0d8f0; text-transform: uppercase;
    background: linear-gradient(135deg, rgba(0,30,70,0.95), rgba(0,15,40,0.98));
    border: 1px solid rgba(0,229,255,0.35); border-radius: 2px; cursor: pointer;
    transition: all 0.2s; position: relative; overflow: hidden;
    box-shadow: 0 0 20px rgba(0,80,180,0.15), inset 0 1px 0 rgba(255,255,255,0.04);
    clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}
.btn::before {
    content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0,229,255,0.07), transparent);
    transition: left 0.4s;
}
.btn:hover::before { left: 100%; }
.btn:hover, .btn:active { 
    border-color: var(--cyan); color: var(--cyan); transform: translateY(-2px); 
    box-shadow: 0 0 25px rgba(0,229,255,0.2), inset 0 1px 0 rgba(0,229,255,0.1);
}
.btn-gold { border-color: rgba(255,215,0,0.4); }
.btn-gold:hover, .btn-gold:active { 
    border-color: var(--gold); color: var(--gold); 
    box-shadow: var(--glow-gold), inset 0 1px 0 rgba(255,215,0,0.1); 
}

.grid-container { 
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); 
    gap: 12px; width: 90%; max-width: 900px; margin-top: 16px; 
    max-height: 65vh; overflow-y: auto; padding: 10px; 
}
.card {
    background: linear-gradient(135deg, rgba(5,12,30,0.95), rgba(3,8,20,0.98));
    border: 1px solid rgba(0,229,255,0.18); border-radius: 4px;
    padding: 18px; text-align: center; cursor: pointer; transition: all 0.2s; 
    position: relative; overflow: hidden;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}
.card::before {
    content: ''; position: absolute; top: 0; right: 0;
    width: 0; height: 0;
    border-left: 12px solid transparent;
    border-top: 12px solid rgba(0,229,255,0.25);
    pointer-events: none;
}
.card:hover, .card:active { 
    border-color: var(--cyan); transform: translateY(-4px); 
    box-shadow: 0 12px 30px rgba(0,0,0,0.6), 0 0 25px rgba(0,229,255,0.15);
    background: linear-gradient(135deg, rgba(0,20,50,0.98), rgba(0,10,30,0.99));
}
.card-title { font-family: 'Orbitron', monospace; font-size: 16px; font-weight: 700; margin-bottom: 10px; letter-spacing: 1px; }
.card-desc { font-size: 12px; color: rgba(180,210,255,0.75); line-height: 1.6; margin-bottom: 10px; }
.skill-desc { font-size: 11px; color: rgba(140,180,255,0.9); text-align: left; background: rgba(0,10,30,0.5); padding: 10px; border-radius: 3px; border-left: 2px solid rgba(0,229,255,0.3); }
.synergy-text { font-size: 11px; color: var(--gold); font-weight: bold; margin-top: 10px; text-shadow: 0 0 8px var(--gold); }

/* ===== HUD ===== */
#game-ui { position: absolute; inset: 0; pointer-events: none; z-index: 10; display: flex; flex-direction: column; }

.hud-bottom-left { position: absolute; bottom: 28px; left: 28px; transition: all 0.3s; }
#player-name-disp { 
    font-family: 'Orbitron', monospace; font-size: 20px; font-weight: 700; letter-spacing: 3px; 
    margin-bottom: 4px; text-shadow: 0 0 20px currentColor;
}
#weapon-name { 
    font-family: 'Orbitron', monospace; font-size: 11px; font-weight: 700; letter-spacing: 3px; 
    color: var(--cyan); margin-bottom: 14px; text-shadow: 0 0 10px rgba(0,229,255,0.6); 
}
#hp-track { 
    width: 320px; max-width: 60vw; height: 6px; 
    background: rgba(255,255,255,0.06); border-radius: 0; overflow: visible; margin-bottom: 5px; 
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    clip-path: polygon(6px 0%, 100% 0%, calc(100% - 6px) 100%, 0% 100%);
}
#hp-bar { 
    height: 100%; width: 100%; 
    background: linear-gradient(90deg, #ff1744, #ff4500, #ff8800); 
    transition: width 0.15s ease-out; 
}
#hp-text { 
    font-family: 'Orbitron', monospace; font-size: 30px; font-weight: 900; color: #fff; 
    text-shadow: 0 0 25px rgba(255,120,0,0.8); 
}

.hud-bottom-right { position: absolute; bottom: 28px; right: 28px; text-align: right; transition: all 0.3s; }
#skill-log { 
    font-family: 'Orbitron', monospace; font-size: 13px; letter-spacing: 1px; 
    color: var(--cyan); margin-bottom: 14px; text-shadow: var(--glow-cyan); 
    min-height: 20px; font-weight: 700; 
}

.skill-icons { display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 12px; }
.skill-btn { 
    width: 54px; height: 54px; 
    background: linear-gradient(135deg, rgba(3,8,20,0.95), rgba(0,5,15,0.98)); 
    border: 1px solid rgba(0,229,255,0.3); border-radius: 3px; 
    display: flex; flex-direction: column; align-items: center; justify-content: center; 
    font-family: 'Orbitron', monospace; font-size: 10px; font-weight: 700; color: #fff; 
    position: relative;
    clip-path: polygon(5px 0%, 100% 0%, calc(100% - 5px) 100%, 0% 100%);
}
.skill-btn .key { font-size: 13px; font-weight: 900; }
.skill-btn .cd-overlay { 
    position: absolute; inset: 0; background: rgba(0,0,0,0.75); 
    display: flex; align-items: center; justify-content: center; 
    font-size: 18px; color: #ff5252; text-shadow: 0 0 12px #ff0000; 
}

#stats-panel { 
    background: var(--panel); border: 1px solid var(--border); border-radius: 3px; 
    padding: 10px 16px; font-size: 12px; line-height: 1.9; text-align: left; 
    border-left: 2px solid rgba(0,229,255,0.5);
}
#stats-panel span { font-family: 'Orbitron', monospace; font-weight: 700; color: var(--gold); }
#buff-status { margin-top: 6px; font-size: 11px; color: var(--green); letter-spacing: 1px; min-height: 14px; }

#minimap-container { 
    position: absolute; bottom: 28px; right: 192px; width: 130px; height: 130px; 
    border: 1px solid rgba(0,229,255,0.4); border-radius: 3px; 
    background: rgba(0,3,12,0.85); 
    box-shadow: 0 0 15px rgba(0,229,255,0.1), inset 0 0 20px rgba(0,0,0,0.5);
}
#minimap { width: 100%; height: 100%; }

.hud-top-center { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); text-align: center; }
#game-timer { 
    font-family: 'Orbitron', monospace; font-size: 30px; font-weight: 900; color: #fff; 
    letter-spacing: 5px; text-shadow: 0 0 25px rgba(0,229,255,0.6);
    background: var(--panel); border: 1px solid var(--border); 
    padding: 4px 20px; border-radius: 2px;
    clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}
#boss-hp-container { display: none; width: 280px; max-width: 70vw; height: 6px; background: rgba(255,255,255,0.06); margin: 8px auto; }
#boss-hp-bar { width: 100%; height: 100%; background: linear-gradient(90deg, #7b1fa2, #e91e63, #ff4081); }

.hud-top-right { position: absolute; top: 16px; right: 20px; text-align: right; display: flex; flex-direction: column; gap: 8px; }
.hud-badge { 
    background: var(--panel); border: 1px solid var(--border); border-radius: 2px; 
    padding: 6px 14px; font-family: 'Orbitron', monospace; font-size: 13px; font-weight: 700;
    border-left: 2px solid var(--cyan);
}

/* 십자선 */
#crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 10; pointer-events: none; }
.ch-line { position: absolute; background: rgba(255,255,255,0.85); box-shadow: 0 0 6px rgba(0,229,255,0.5); }
.ch-v { width: 2px; height: 14px; top: -7px; left: -1px; }
.ch-h { width: 14px; height: 2px; top: -1px; left: -7px; }
#crosshair::after { content: ''; position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--cyan); top: -1.5px; left: -1.5px; box-shadow: 0 0 6px var(--cyan); }

#kill-msg { 
    position: absolute; top: 55%; left: 50%; transform: translate(-50%, -50%); 
    font-family: 'Orbitron', monospace; font-size: 22px; font-weight: 900; letter-spacing: 6px; 
    color: var(--gold); text-shadow: 0 0 30px rgba(255,215,0,0.9); 
    opacity: 0; transition: opacity 0.15s; text-align: center; 
}

#blood-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 5; transition: background 0.15s, box-shadow 0.3s; }
.hit-flash { background: rgba(255,0,0,0.28) !important; box-shadow: inset 0 0 150px rgba(255,0,0,0.5) !important; }
.heal-flash { background: rgba(0,255,100,0.12) !important; }
.ult-active { box-shadow: inset 0 0 180px rgba(255,50,0,0.2) !important; }

#lock-screen { 
    position: absolute; inset: 0; background: rgba(0,3,12,0.75); 
    z-index: 20; display: flex; justify-content: center; align-items: center; cursor: pointer; 
}
.lock-inner { 
    padding: 24px 60px; border: 1px solid rgba(0,229,255,0.5); border-radius: 3px; 
    background: rgba(0,10,30,0.85); font-family: 'Orbitron', monospace; 
    font-size: 15px; color: var(--cyan); text-shadow: var(--glow-cyan); 
    animation: lockPulse 1.8s infinite; letter-spacing: 3px;
    clip-path: polygon(12px 0%, 100% 0%, calc(100% - 12px) 100%, 0% 100%);
}
@keyframes lockPulse { 
    0%,100% { box-shadow: 0 0 20px rgba(0,229,255,0.2); } 
    50% { box-shadow: 0 0 60px rgba(0,229,255,0.6); } 
}

#respawn-screen { 
    position: absolute; inset: 0; z-index: 30; 
    display: flex; flex-direction: column; justify-content: center; align-items: center; 
    background: radial-gradient(ellipse at center, rgba(180,0,0,0.45) 0%, rgba(30,0,0,0.88) 100%); 
}
#respawn-screen h1 { font-family: 'Orbitron', monospace; font-size: 52px; color: var(--red); margin-bottom: 18px; text-shadow: 0 0 40px var(--red); }

.dmg-num { 
    position: absolute; font-family: 'Orbitron', monospace; font-weight: 900; 
    pointer-events: none; z-index: 15; animation: floatUp 0.8s ease-out forwards; 
    text-shadow: 0 0 5px #000; 
}
.dmg-perfect { color: #ffeb3b !important; font-size: 38px !important; text-shadow: 0 0 25px #ff0000, 0 0 10px #000 !important; animation: perfectPop 1s ease-out forwards; z-index: 20; }
@keyframes floatUp { 0% { opacity: 1; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-55px) scale(0.8); } }
@keyframes perfectPop { 0% { opacity: 0; transform: translateY(0) scale(0.5); } 20% { opacity: 1; transform: translateY(-20px) scale(1.2); } 100% { opacity: 0; transform: translateY(-90px) scale(0.9); } }

#game-over-screen { z-index: 200; background: rgba(3,5,15,0.97); }
#go-title { font-family: 'Orbitron', monospace; font-size: 42px; font-weight: 900; letter-spacing: 5px; margin-bottom: 14px; text-align: center; }

/* ===== 모바일 ===== */
#mobile-controls { display: none; position: absolute; inset: 0; z-index: 150; touch-action: none; pointer-events: none; }
.touch-zone { position: absolute; inset: 0; pointer-events: auto; touch-action: none; }
#joystick-zone { 
    position: absolute; bottom: 30px; left: 30px; width: 150px; height: 150px; 
    background: rgba(0,229,255,0.06); border-radius: 50%; 
    pointer-events: auto; touch-action: none; border: 2px solid rgba(0,229,255,0.25); 
    box-shadow: 0 0 20px rgba(0,229,255,0.1);
}
#joystick-knob { 
    position: absolute; top: 50%; left: 50%; width: 50px; height: 50px; 
    background: radial-gradient(circle, rgba(0,229,255,0.6), rgba(0,100,180,0.4)); 
    border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; 
    border: 1px solid rgba(0,229,255,0.5);
}

#mobile-actions { position: absolute; bottom: 30px; right: 30px; width: 180px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; align-items: flex-end; pointer-events: auto; }
.m-btn { 
    width: 55px; height: 55px; border-radius: 50%; 
    background: rgba(3,8,20,0.85); border: 2px solid rgba(0,229,255,0.5); 
    color: #fff; font-size: 14px; display: flex; align-items: center; justify-content: center; 
    user-select: none; font-weight: bold; font-family: 'Orbitron'; 
    box-shadow: 0 0 15px rgba(0,0,0,0.6), 0 0 8px rgba(0,229,255,0.1);
}
.m-btn:active { background: rgba(0,229,255,0.4); transform: scale(0.88); }
.m-btn.shoot { 
    width: 82px; height: 82px; border-color: var(--red); 
    background: rgba(255,34,68,0.25); font-size: 22px; 
    box-shadow: 0 0 20px rgba(255,0,0,0.35); 
}
.m-btn.shoot:active { background: rgba(255,34,68,0.6); }

@media (max-width: 900px), (pointer: coarse) {
    body.is-mobile #controls-info { display: none !important; }
    body.is-mobile .hud-bottom-right { display: none !important; }
    body.is-mobile #minimap-container { right: auto !important; bottom: auto !important; left: 16px !important; top: 16px !important; width: 80px !important; height: 80px !important; border-radius: 50%; }
    body.is-mobile .hud-top-center { top: 16px !important; }
    body.is-mobile .hud-top-right { top: 16px !important; right: 16px !important; }
    body.is-mobile .hud-bottom-left { bottom: 200px !important; left: 16px !important; transform: scale(0.85); transform-origin: bottom left; }
    body.is-mobile #lock-screen { display: none !important; }
    body.is-mobile .main-title { font-size: 44px !important; letter-spacing: 6px !important; }
}
