/* ===================================
   Dino Lab - Cosmic Survival Styles
   =================================== */

:root {
    /* Dino Lab Color Palette */
    --dino-primary: #ff6b35;
    --dino-secondary: #f7931e;
    --dino-accent: #00d9ff;
    --dino-purple: #9d4edd;
    --dino-dark: #1a0b2e;
    --dino-darker: #0d0619;

    /* UI Colors */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.8);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--dino-primary), var(--dino-secondary));
    --gradient-cosmic: linear-gradient(135deg, var(--dino-purple), var(--dino-accent));
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Exo 2', sans-serif;
    background: var(--dino-darker);
    color: var(--text-primary);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* ===================================
   Language Selector
   =================================== */

.language-selector {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
}

#languageSelector {
    font-family: 'Exo 2', sans-serif;
    padding: 0.5rem 1rem;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#languageSelector:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--dino-accent);
}

#languageSelector:focus {
    outline: none;
    border-color: var(--dino-accent);
}

#languageSelector option {
    background: var(--dino-darker);
    color: var(--text-primary);
}

/* ===================================
   Canvas
   =================================== */

#gameCanvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ===================================
   Menu Screens
   =================================== */

.menu-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 6, 25, 0.95);
    backdrop-filter: blur(10px);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.menu-screen.active {
    opacity: 1;
    pointer-events: all;
}

.menu-content {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(255, 107, 53, 0.2);
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===================================
   Typography
   =================================== */

.game-title {
    font-family: 'Orbitron', sans-serif;
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.title-dino {
    font-size: 2.5rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 4px;
    text-shadow: 0 0 30px rgba(255, 107, 53, 0.5);
}

.title-cosmic {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-cosmic);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 3px;
}

.screen-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-over-title {
    background: linear-gradient(135deg, #ff0844, #ffb199);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===================================
   Buttons
   =================================== */

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.btn {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(255, 107, 53, 0.6);
}

.btn-secondary {
    background: var(--gradient-cosmic);
    color: white;
    box-shadow: 0 4px 15px rgba(157, 78, 221, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(157, 78, 221, 0.6);
}

.btn-tertiary {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}

.btn-tertiary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ===================================
   Controls Info
   =================================== */

.controls-info {
    text-align: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-info p {
    margin: 0.5rem 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* ===================================
   Instructions
   =================================== */

.instructions-content {
    margin-bottom: 2rem;
}

.instruction-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border-left: 4px solid var(--dino-primary);
}

.instruction-section h3 {
    font-family: 'Orbitron', sans-serif;
    color: var(--dino-accent);
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

.instruction-section p {
    color: var(--text-secondary);
    line-height: 1.6;
}

.instruction-section ul {
    list-style: none;
    padding-left: 0;
}

.instruction-section li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

.ast-small {
    color: #ffffff;
    font-size: 0.8rem;
}

.ast-normal {
    color: #888888;
    font-size: 1rem;
}

.ast-big {
    color: #555555;
    font-size: 1.3rem;
}

.ast-explosive {
    color: #ff4444;
    font-size: 1rem;
}

.ast-homing {
    color: #ff00ff;
    font-size: 1rem;
}

/* ===================================
   HUD
   =================================== */

.hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    z-index: 50;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

.hud.hidden {
    display: none;
}

.hud-timer {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 16px;
    padding: 1rem 1.5rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.timer-label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    color: var(--dino-accent);
    margin-bottom: 0.25rem;
    letter-spacing: 1px;
}

.timer-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 2rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hud-powerups {
    display: flex;
    gap: 0.75rem;
}

.active-powerup {
    min-width: 60px;
    min-height: 60px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* ===================================
   Game Over Stats
   =================================== */

.game-over-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 2rem;
    gap: 1rem;
}

.stat-item {
    flex: 1;
    text-align: center;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    border: 2px solid var(--glass-border);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===================================
   New Record Section
   =================================== */

.new-record-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 16px;
}

.new-record-section.hidden {
    display: none;
}

.new-record-badge {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.name-input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: 'Exo 2', sans-serif;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    margin-bottom: 1rem;
    transition: border-color 0.3s;
}

.name-input:focus {
    outline: none;
    border-color: var(--dino-accent);
}

.name-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

/* ===================================
   Leaderboard
   =================================== */

.leaderboard-container {
    margin-bottom: 2rem;
    max-height: 400px;
    overflow-y: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.leaderboard-table th {
    font-family: 'Orbitron', sans-serif;
    background: var(--gradient-primary);
    padding: 1rem;
    text-align: center;
    font-weight: 700;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--dino-primary);
}

.leaderboard-table tbody tr {
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.3s;
}

.leaderboard-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.leaderboard-table tbody tr:nth-child(1) {
    background: rgba(255, 215, 0, 0.1);
}

.leaderboard-table tbody tr:nth-child(2) {
    background: rgba(192, 192, 192, 0.1);
}

.leaderboard-table tbody tr:nth-child(3) {
    background: rgba(205, 127, 50, 0.1);
}

.leaderboard-table td {
    padding: 1rem;
    text-align: center;
}

.leaderboard-table td:first-child {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--dino-accent);
}

.leaderboard-table td:nth-child(2) {
    font-weight: 600;
}

.leaderboard-table td:last-child {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    color: var(--dino-secondary);
}

/* Scrollbar Styling */
.leaderboard-container::-webkit-scrollbar,
.menu-content::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-container::-webkit-scrollbar-track,
.menu-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.leaderboard-container::-webkit-scrollbar-thumb,
.menu-content::-webkit-scrollbar-thumb {
    background: var(--dino-primary);
    border-radius: 4px;
}

/* ===================================
   Responsive Design
   =================================== */

@media (max-width: 768px) {
    .menu-content {
        padding: 2rem 1.5rem;
        max-width: 95%;
    }

    .title-dino {
        font-size: 2rem;
    }

    .title-cosmic {
        font-size: 1.2rem;
    }

    .screen-title {
        font-size: 1.5rem;
    }

    .btn {
        font-size: 1rem;
        padding: 0.875rem 1.5rem;
    }

    .timer-value {
        font-size: 1.5rem;
    }

    .hud {
        padding: 1rem;
    }

    .hud-timer {
        padding: 0.75rem 1rem;
    }

    .active-powerup {
        min-width: 50px;
        min-height: 50px;
        font-size: 1.5rem;
    }

    .game-over-stats {
        flex-direction: column;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .controls-info p {
        font-size: 0.85rem;
    }

    .leaderboard-table th,
    .leaderboard-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .title-dino {
        font-size: 1.5rem;
        letter-spacing: 2px;
    }

    .title-cosmic {
        font-size: 1rem;
        letter-spacing: 2px;
    }

    .btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.25rem;
        letter-spacing: 1px;
    }

    .instruction-section {
        padding: 0.75rem;
    }

    .instruction-section h3 {
        font-size: 1rem;
    }

    .instruction-section li {
        font-size: 0.85rem;
    }
}

/* ===================================
   Utility Classes
   =================================== */

.hidden {
    display: none !important;
}