:root {
    /* Default (Dark / Spaceship Theme) */
    --bg-color: #1a1a1a;
    --surface-color: #2b2b36;
    --text-color: #b0b0b0;
    
    --primary-color: #00ffff; /* Cyan */
    --denner-color: #ff0000; /* Red */
    --runner-color: #2ED573; /* Green */
    
    --shadow: 0 0 15px rgba(0, 255, 255, 0.1);
    --card-radius: 12px;
    --transition-speed: 0.3s;
    --long-transition: 1s;
}

[data-theme="light"] {
    --bg-color: #f4f7f9;
    --surface-color: #ffffff;
    --text-color: #1a202c;
    --primary-color: #3b82f6;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Inter', monospace, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color var(--long-transition), color var(--long-transition);
    overflow: hidden;
}

/* --- THEME TOGGLER --- */
.header-actions {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
}

#theme-toggler {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    background: var(--surface-color);
    box-shadow: var(--shadow);
    border: none;
    transition: background-color var(--long-transition) ease;
}

#theme-toggler .icon, #theme-toggler .cloud {
    position: absolute;
    transition: all var(--long-transition) cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

#theme-toggler .icon { width: 24px; height: 24px; color: var(--text-color); }

/* Sun/Moon Animation */
[data-theme="light"] .sun-icon { opacity: 1; transform: scale(1) rotate(0deg); }
[data-theme="dark"] .sun-icon, #theme-toggler.is-changing[data-theme="light"] .sun-icon {
    opacity: 0; transform: scale(0.5) rotate(-180deg) translateX(-30px);
}
[data-theme="dark"] .moon-icon { opacity: 1; transform: scale(1) rotate(0deg); }
[data-theme="light"] .moon-icon, #theme-toggler.is-changing[data-theme="dark"] .moon-icon {
    opacity: 0; transform: scale(0.5) rotate(180deg) translateX(30px);
}

/* Clouds Logic */
#theme-toggler .cloud { background: white; border-radius: 50%; opacity: 0; filter: blur(3px); }
#theme-toggler.is-changing .cloud { opacity: 0.7; }
.cloud-1 { width: 45px; height: 45px; top: -15px; left: -15px; transform: translateX(-60px); }
.cloud-2 { width: 35px; height: 35px; bottom: -15px; right: -10px; transform: translateX(60px); transition-delay: 0.1s; }
.cloud-3 { width: 40px; height: 40px; bottom: 5px; left: -15px; transform: translateY(60px); transition-delay: 0.2s; }
#theme-toggler.is-changing .cloud-1,
#theme-toggler.is-changing .cloud-2,
#theme-toggler.is-changing .cloud-3 { transform: translateX(0) translateY(0); }

/* --- UI COMPONENTS --- */
.container { width: 100%; max-width: 900px; padding: 20px; text-align: center; }

.title-glow {
    font-size: 3rem;
    font-weight: 900;
    margin: 0;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(0, 255, 255, 0.4);
}
.subtitle { color: var(--text-color); opacity: 0.7; margin-bottom: 30px; }

.card {
    background: var(--surface-color);
    padding: 2rem;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow);
    max-width: 400px;
    margin: 0 auto;
    border: 1px solid rgba(255,255,255,0.05);
}

.join-form { display: flex; gap: 10px; margin-top: 20px; }
input {
    background: rgba(0,0,0,0.2);
    border: 1px solid #444;
    color: var(--primary-color);
    padding: 12px;
    border-radius: 8px;
    width: 100%;
    text-align: center;
    font-family: inherit;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 2px;
}
input:focus { outline: none; border-color: var(--primary-color); }

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
    transition: transform 0.1s, box-shadow 0.3s;
    text-transform: uppercase;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.btn-primary { background: var(--primary-color); color: #000; width: 100%; }
.btn-secondary { background: #444; color: #fff; }

/* --- UPDATED: BUTTONS SIDE BY SIDE --- */
.admin-controls {
    display: flex;
    flex-direction: row !important; /* Force row */
    gap: 10px;
}

.btn-small { 
    padding: 6px 12px; 
    font-size: 0.8rem; 
    background: #ff4444; 
    color: white; 
    border-radius: 4px; 
    border: none; 
    cursor: pointer; 
    /* Changed to accommodate side-by-side layout */
    width: auto; 
    white-space: nowrap;
}

.btn-warning {
    background: #e67e22; /* Orange for restart */
}

.divider { margin: 20px 0; font-size: 0.8rem; opacity: 0.5; }

/* --- GAME HUD & CANVAS --- */
.hidden { display: none; }
.game-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.hud-item { display: flex; flex-direction: column; text-align: left; }
.hud-item .label { font-size: 0.7rem; color: #666; font-weight: bold; letter-spacing: 1px; }
.hud-item .value { font-size: 1.2rem; font-weight: bold; color: var(--primary-color); font-family: monospace; }

canvas {
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    border: 1px solid #333;
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
    display: block;
    margin: 0 auto;
    max-width: 100%;
}
[data-theme="light"] canvas { background: #e0e5ec; border: 1px solid #ccc; }

.controls-hint { margin-top: 15px; font-family: monospace; opacity: 0.7; }

/* --- MODALS --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible { opacity: 1; pointer-events: auto; }

.modal-content {
    background: var(--surface-color);
    padding: 30px;
    border-radius: var(--card-radius);
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.2);
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-overlay.visible .modal-content { transform: scale(1); }

.modal-content h3 { margin-top: 0; color: var(--primary-color); font-size: 1.5rem; text-transform: uppercase; letter-spacing: 2px; }
.modal-content p { color: var(--text-color); font-size: 1.1rem; margin-bottom: 25px; }
