* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

html { scrollbar-gutter: stable; }

:root {
    --bg-primary: #0a0a1a;
    --bg-secondary: #12122a;
    --bg-tertiary: #1a1a2e;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --accent: #a855f7;
    --accent-glow: rgba(168, 85, 247, 0.4);
    --accent-gold: #ffd700;
    --accent-cyan: #00d4ff;
    --accent-pink: #ff6b9d;
    --accent-orange: #ff8c00;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background: var(--bg-primary);
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text-primary);
    overflow: hidden;
}

.bg-effects {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.3;
    animation: float 15s ease-in-out infinite;
}

.bg-orb:nth-child(1) {
    width: 400px; height: 400px;
    background: var(--accent);
    top: -100px; left: -100px;
}

.bg-orb:nth-child(2) {
    width: 350px; height: 350px;
    background: var(--accent-red);
    bottom: -50px; right: -100px;
    animation-delay: -7s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

.container {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

header {
    width: 100%;
    text-align: center;
    padding: 10px 20px;
}

.header-top {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 5px;
}

.back-btn {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    text-decoration: none;
    font-family: 'Jua', sans-serif;
    font-size: 0.9rem;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s;
    min-width: 44px;
    min-height: 44px;
}

.back-btn:hover {
    color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.1);
}

.back-btn svg { width: 20px; height: 20px; }

h1 {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    background: linear-gradient(135deg, var(--accent-red), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Game Container */
.game-container {
    width: 100%;
    display: flex;
    justify-content: center;
}

#gameWrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.05), 0 20px 40px rgba(0,0,0,0.4);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* HUD */
.hud {
    position: absolute;
    top: 0; left: 0; right: 0;
    padding: 8px 12px;
    pointer-events: none;
    z-index: 10;
}

.hud.hidden { display: none; }

.hud-top {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-hp { flex: 1; }

.hp-bar, .xp-bar {
    height: 10px;
    background: rgba(0,0,0,0.6);
    border-radius: 5px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
}

.hp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-red), var(--accent-green));
    border-radius: 5px;
    transition: width 0.2s;
    width: 100%;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent));
    border-radius: 5px;
    transition: width 0.15s;
    width: 0%;
}

.hud-timer {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.75rem;
    color: var(--accent-gold);
    text-shadow: 0 0 8px rgba(255,215,0,0.5);
    white-space: nowrap;
}

.hud-kills {
    font-family: 'Jua', sans-serif;
    font-size: 0.8rem;
    color: var(--accent-red);
    white-space: nowrap;
}

.hud-xp {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.hud-xp .xp-bar { flex: 1; height: 6px; }

.xp-level {
    font-family: 'Jua', sans-serif;
    font-size: 0.7rem;
    color: var(--accent-cyan);
    white-space: nowrap;
}

.hud-weapons {
    display: flex;
    gap: 4px;
    margin-top: 6px;
}

.weapon-icon {
    min-width: 28px; height: 28px;
    padding: 0 4px;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 14px;
}
.weapon-lv {
    font-size: 9px;
    font-weight: 700;
    color: rgba(255,255,255,0.8);
    line-height: 1;
}

/* Overlay Screens */
.overlay-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(4px);
    z-index: 20;
}

.overlay-screen.hidden { display: none; }

/* Start Screen */
.start-content {
    text-align: center;
    padding: 30px;
}

.game-logo {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2.5rem;
    line-height: 1.1;
    background: linear-gradient(135deg, var(--accent-red), var(--accent-orange), var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255,100,50,0.3));
}

.start-sub {
    font-family: 'Jua', sans-serif;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 20px;
}

.start-info {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.start-btn {
    font-family: 'Jua', sans-serif;
    padding: 14px 40px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #000;
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-orange));
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(255,215,0,0.4);
    min-height: 44px;
    pointer-events: all;
}

.start-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255,215,0,0.5);
}

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

/* Level Up Modal */
.levelup-content {
    text-align: center;
    padding: 20px;
    width: 90%;
    max-width: 420px;
}

.levelup-title {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    color: var(--accent-gold);
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(255,215,0,0.4);
}

.levelup-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: all;
}

.levelup-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
}

.levelup-card:hover {
    border-color: var(--accent-gold);
    background: var(--bg-tertiary);
    transform: translateX(4px);
    box-shadow: 0 0 15px var(--accent-glow);
}

.levelup-card:active {
    transform: translateX(2px) scale(0.98);
}

.card-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}

.card-info { flex: 1; }

.card-name {
    font-family: 'Jua', sans-serif;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.card-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Game Over / Victory */
.gameover-content {
    text-align: center;
    padding: 30px;
    background: var(--bg-secondary);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    width: 85%;
    max-width: 360px;
}

.gameover-content.victory {
    border-color: rgba(255,215,0,0.3);
    box-shadow: 0 0 30px rgba(255,215,0,0.15), 0 20px 60px rgba(0,0,0,0.5);
}

.gameover-title {
    font-family: 'Black Han Sans', sans-serif;
    font-size: 2rem;
    color: var(--accent-red);
    margin-bottom: 16px;
}

.victory-title {
    color: var(--accent-gold);
    text-shadow: 0 0 20px rgba(255,215,0,0.4);
}

.gameover-stats {
    margin-bottom: 16px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-family: 'Jua', sans-serif;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.stat-row span:last-child {
    color: var(--text-primary);
}

.gameover-score {
    margin: 16px 0;
    font-family: 'Black Han Sans', sans-serif;
}

.gameover-score span:first-child {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.gameover-score span:last-child {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--accent), var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Game Content Article */
.game-content {
    width: 100%;
    margin-top: 20px;
    padding: 25px 20px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
}

.game-content h2 {
    font-family: 'Jua', sans-serif;
    font-size: 1.2rem;
    color: var(--accent-gold);
    margin-bottom: 15px;
}

.game-content p {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.tip-box {
    background: rgba(168, 85, 247, 0.1);
    border-left: 3px solid var(--accent);
    padding: 15px;
    border-radius: 0 8px 8px 0;
}

.tip-box p { margin-bottom: 10px; }
.tip-box p:last-child { margin-bottom: 0; }

footer {
    width: 100%;
    text-align: center;
    padding: 20px;
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

footer a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: color 0.3s;
}

footer a:hover { color: var(--accent-gold); }

/* Responsive */
@media (max-width: 600px) {
    body { overflow: auto; }
    header { padding: 8px 12px; }
    h1 { font-size: 1.5rem; }
    .back-btn span { display: none; }
    .game-logo { font-size: 2rem; }

    #gameWrapper {
        border-radius: 0;
        aspect-ratio: 3 / 4;
        max-height: 80vh;
    }

    .hud-timer { font-size: 0.65rem; }
    .levelup-card { padding: 10px 12px; }
    .card-icon { font-size: 1.2rem; width: 32px; }
    .card-name { font-size: 0.85rem; }
    .card-desc { font-size: 0.7rem; }
}

@media (max-width: 400px) {
    #gameWrapper { aspect-ratio: 9 / 16; max-height: 85vh; }
    .game-logo { font-size: 1.6rem; }
}

/* Fullscreen */
body.fullscreen-active .container { max-width: none; }
body.fullscreen-active header,
body.fullscreen-active .game-content,
body.fullscreen-active footer { display: none; }
body.fullscreen-active #gameWrapper {
    max-width: none;
    border-radius: 0;
    aspect-ratio: auto;
    width: 100vw;
    height: 100vh;
}
