/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

:root {
    --bg-dark: #05070a;
    --accent-primary: #00d2ff;
    --accent-secondary: #3a86ff;
    --accent-xp: #4ade80;
    --accent-danger: #ff4d4d;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --transition-med: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2000;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.back-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(3px);
    border-color: var(--accent-primary);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    position: fixed;
}

/* ==================== SCREENS ==================== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* ==================== MENU ==================== */
#menu-screen {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 50% 50%, #0f172a 0%, #02040a 100%);
}

.menu-container {
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.game-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 3rem;
    font-weight: 900;
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(0, 210, 255, 0.4);
}

.title-rogue {
    color: #fff;
}

.title-tower {
    color: var(--accent-primary);
}

.menu-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-primary);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-primary));
    border: none;
    color: white;
    padding: 1.2rem;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 800;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 210, 255, 0.2);
}

.menu-footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ==================== HUD ==================== */
.xp-bar-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 30px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.xp-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

.xp-text {
    position: absolute;
    width: 100%;
    text-align: center;
    line-height: 30px;
    font-size: 0.8rem;
    font-weight: 800;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.hud-top {
    position: absolute;
    top: 40px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

.hud-item {
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ==================== GAMEPLAY ==================== */
.canvas-container {
    width: 100%;
    height: 100%;
}

#game-canvas {
    width: 100%;
    height: 100%;
    background: #0a0b10;
}

/* ==================== OVERLAYS ==================== */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    background: #111827;
    padding: 2.5rem;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 360px;
    text-align: center;
}

.game-over-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    color: var(--accent-danger);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 1rem;
    border-radius: 12px;
    width: 100%;
    margin-top: 1rem;
    font-weight: 700;
}