/* Modern theme styling for Pygar - Fullscreen game */

:root {
    /* Light theme (default) */
    --bg-gradient-1: #f5f7fa;
    --bg-gradient-2: #c3cfe2;
    --canvas-bg-1: #ffffff;
    --canvas-bg-2: #f0f0f0;
    --overlay-bg: rgba(255, 255, 255, 0.95);
    --text-color: #333;
    --text-shadow: rgba(255, 255, 255, 0.8);
    --border-color: rgba(0, 0, 0, 0.2);
    --grid-color: rgba(0, 0, 0, 0.08);
    --obstacle-color: #d0d0d0;
}

[data-theme="dark"] {
    /* Dark theme */
    --bg-gradient-1: #667eea;
    --bg-gradient-2: #764ba2;
    --canvas-bg-1: #1e3c72;
    --canvas-bg-2: #2a5298;
    --overlay-bg: rgba(0, 0, 0, 0.85);
    --text-color: white;
    --text-shadow: rgba(0, 0, 0, 0.8);
    --border-color: rgba(255, 255, 255, 0.2);
    --grid-color: rgba(255, 255, 255, 0.1);
    --obstacle-color: #4a4a4a;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-1) 0%, var(--bg-gradient-2) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--canvas-bg-1) 0%, var(--canvas-bg-2) 100%);
    cursor: crosshair;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: var(--text-color);
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.overlay-content h1 {
    font-size: 3em;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

.overlay-content p {
    font-size: 1.2em;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* Input group */
.input-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* Input field */
input[type="text"] {
    flex: 1;
    padding: 15px 20px;
    font-size: 1.1em;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-color);
    outline: none;
    transition: all 0.3s ease;
    /* Remove margin-bottom as it's handled by input-group */
}

input[type="text"]::placeholder {
    color: rgba(100, 100, 100, 0.6);
}

[data-theme="dark"] input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

input[type="text"]:focus {
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.5);
}

/* Random button */
#randomNameBtn {
    padding: 15px;
    font-size: 1.2em;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-color);
}

#randomNameBtn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: rotate(15deg);
}

/* Buttons */
.btn-primary {
    padding: 15px 40px;
    font-size: 1.2em;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6);
}

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

/* Leaderboard */
#leaderboard {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    min-width: 200px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#leaderboard.hidden {
    display: none;
}

#leaderboard h3 {
    margin-bottom: 10px;
    font-size: 1.2em;
    border-bottom: 2px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 8px;
}

#leaderboardList {
    list-style-position: inside;
    padding: 0;
}

#leaderboardList li {
    padding: 5px 0;
    font-size: 0.95em;
    opacity: 0.9;
}

/* Player stats */
#playerStats {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 10px;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#playerStats.hidden {
    display: none;
}

#playerStats div {
    margin-bottom: 5px;
    font-size: 1.1em;
}

#playerStats span {
    font-weight: bold;
    color: #667eea;
}

/* Connection status */
#connectionStatus {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 20px;
    color: white;
    font-size: 0.9em;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Death screen specific */
#finalStats {
    font-size: 1.5em;
    margin-bottom: 30px;
}

#finalMass {
    color: #667eea;
    font-weight: bold;
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--overlay-bg);
    cursor: pointer;
    font-size: 1.5em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.theme-toggle:active {
    transform: scale(0.95);
}