/* Dots Survivor Styles */
:root {
    --bg-dark: #0a0a0f;
    --bg-card: #151520;
    --text-primary: #ffffff;
    --text-secondary: #8888aa;
    --accent-primary: #00ffaa;
    --accent-secondary: #ff00aa;
    --xp-color: #4ade80;
    --danger: #ff4466;

    /* Rarity Colors */
    --common: #b8b8b8;
    --rare: #4da6ff;
    --epic: #a855f7;
    --legendary: #fbbf24;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    user-select: none;
}

body {
    background: var(--bg-dark);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0f 100%);
}

/* Menu Overlays */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 15, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
}

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

.menu-content {
    text-align: center;
    padding: 3rem;
}

.game-title {
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 30px rgba(0, 255, 170, 0.5);
}

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

.game-subtitle {
    color: var(--text-secondary);
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

.menu-btn {
    display: block;
    width: 100%;
    max-width: 280px;
    margin: 1rem auto;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    text-align: center;
}

.menu-btn.primary {
    background: linear-gradient(135deg, var(--accent-primary) 0%, #00cc88 100%);
    color: #000;
}

.menu-btn.primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 255, 170, 0.5);
}

.menu-btn.secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--text-secondary);
}

.menu-btn.secondary:hover {
    border-color: var(--accent-primary);
}

.controls-info {
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.controls-info p {
    margin: 0.5rem 0;
}

/* Class Selection */
.class-selection {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin: 1.5rem 0;
}

.class-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 1.2rem;
    width: 150px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.class-card:hover {
    transform: scale(1.08);
    box-shadow: 0 0 25px currentColor;
}

/* Game HUD */
#game-hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 50;
}

#game-hud.hidden {
    display: none;
}

.hud-top {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 2rem;
    align-items: center;
}

.timer-display {
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    border: 2px solid var(--accent-primary);
}

.wave-display {
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 1rem;
    color: var(--text-secondary);
}

.wave-display span {
    color: var(--danger);
    font-weight: 700;
}

.hud-bottom {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.xp-bar-container {
    width: 300px;
    height: 24px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    border: 2px solid var(--xp-color);
}

.xp-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--xp-color) 0%, #22c55e 100%);
    transition: width 0.3s ease;
}

#level-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    color: white;
    text-shadow: 0 0 5px black;
}

.stats-display {
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Level Up Menu */
.levelup-content {
    text-align: center;
    padding: 2rem;
}

.levelup-content h2 {
    font-size: 2.5rem;
    color: var(--xp-color);
    margin-bottom: 0.5rem;
    animation: pulse 1s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.choose-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.upgrade-choices {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.upgrade-card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    width: 220px;
    cursor: pointer;
    transition: all 0.2s;
    border: 3px solid transparent;
    pointer-events: auto;
}

.upgrade-card:hover {
    transform: translateY(-5px);
}

.upgrade-card.common {
    border-color: var(--common);
}

.upgrade-card.rare {
    border-color: var(--rare);
}

.upgrade-card.epic {
    border-color: var(--epic);
}

.upgrade-card.legendary {
    border-color: var(--legendary);
}

.upgrade-card.common:hover {
    box-shadow: 0 0 20px var(--common);
}

.upgrade-card.rare:hover {
    box-shadow: 0 0 20px var(--rare);
}

.upgrade-card.epic:hover {
    box-shadow: 0 0 20px var(--epic);
}

.upgrade-card.legendary:hover {
    box-shadow: 0 0 20px var(--legendary);
}

.upgrade-rarity {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.common .upgrade-rarity {
    color: var(--common);
}

.rare .upgrade-rarity {
    color: var(--rare);
}

.epic .upgrade-rarity {
    color: var(--epic);
}

.legendary .upgrade-rarity {
    color: var(--legendary);
}

.upgrade-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.upgrade-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.upgrade-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Game Over */
.gameover h1 {
    font-size: 3rem;
    color: var(--danger);
    margin-bottom: 1.5rem;
}

.final-stats {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem 3rem;
    margin-bottom: 2rem;
}

.final-stats p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
}

.final-stats span {
    color: var(--text-primary);
    font-weight: 700;
}

/* Mobile */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }

    .upgrade-choices {
        flex-direction: column;
        align-items: center;
    }

    .upgrade-card {
        width: 90%;
        max-width: 280px;
    }

    .xp-bar-container {
        width: 250px;
    }
}

/* Auth Styles */
.auth-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 2px solid #333;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab:first-child {
    border-radius: 8px 0 0 8px;
}

.auth-tab:last-child {
    border-radius: 0 8px 8px 0;
}

.auth-tab.active {
    background: var(--accent-primary);
    color: var(--bg-dark);
    border-color: var(--accent-primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.auth-form input {
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 2px solid #333;
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.auth-form input::placeholder {
    color: var(--text-secondary);
}

.auth-error {
    color: var(--danger);
    font-size: 0.875rem;
    min-height: 1.25rem;
}

/* Leaderboard Styles */
.lb-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 2px solid #333;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lb-tab:first-child {
    border-radius: 8px 0 0 8px;
}

.lb-tab:last-child {
    border-radius: 0 8px 8px 0;
}

.lb-tab.active {
    background: var(--legendary);
    color: var(--bg-dark);
    border-color: var(--legendary);
}

.lb-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lb-entry {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 2px solid #333;
    border-radius: 8px;
    gap: 1rem;
}

.lb-entry.lb-me {
    border-color: var(--accent-primary);
    background: rgba(0, 255, 170, 0.1);
}

.lb-rank {
    font-size: 1.25rem;
    min-width: 3rem;
    text-align: center;
}

.lb-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: 600;
}

.lb-value {
    color: var(--legendary);
    font-weight: 700;
    font-size: 1.1rem;
}

.lb-loading,
.lb-empty,
.lb-error {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.lb-error {
    color: var(--danger);
}