/* Sewer Surge - Professional Pipeline Inspector */
/* Advanced CSS with modern techniques and accessibility */

:root {
    /* Color Palette */
    --primary-color: #00d4ff;
    --secondary-color: #ff6b35;
    --accent-color: #4ecdc4;
    --background-dark: #1a1a1a;
    --background-medium: #2d2d2d;
    --background-light: #404040;
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --success-color: #00ff88;
    --warning-color: #ffaa00;
    --danger-color: #ff4757;
    
    /* Typography */
    --font-primary: 'Orbitron', monospace;
    --font-secondary: 'Exo 2', sans-serif;
    
    /* Animations */
    --transition-fast: 0.15s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.6s ease;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Shadows */
    --shadow-small: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-large: 0 8px 32px rgba(0, 0, 0, 0.6);
    --glow-primary: 0 0 20px rgba(0, 212, 255, 0.5);
    --glow-accent: 0 0 15px rgba(78, 205, 196, 0.4);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-secondary);
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: var(--text-primary);
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-medium);
    z-index: 1;
}

.screen.active {
    opacity: 1;
    visibility: visible;
}

.overlay-screen {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 100;
}

/* Loading Screen */
#loadingScreen {
    background: radial-gradient(circle, #2d2d2d 0%, #1a1a1a 100%);
    flex-direction: column;
    z-index: 1000;
}

.logo h1 {
    font-family: var(--font-primary);
    font-size: 4rem;
    font-weight: 900;
    color: var(--primary-color);
    text-shadow: var(--glow-primary);
    margin-bottom: var(--spacing-md);
    letter-spacing: 0.2em;
}

.logo .subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: var(--spacing-xl);
    letter-spacing: 0.1em;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: var(--background-light);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--spacing-lg);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.loading-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: var(--glow-primary);
}

#loadingText {
    font-size: 0.9rem;
    color: var(--text-secondary);
    animation: pulse 2s infinite;
}

/* Main Menu */
#mainMenu {
    background: 
        radial-gradient(circle at 20% 50%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(78, 205, 196, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

.menu-content {
    text-align: center;
    z-index: 2;
}

.game-title {
    font-family: var(--font-primary);
    font-size: 5rem;
    font-weight: 900;
    color: var(--primary-color);
    text-shadow: var(--glow-primary);
    margin-bottom: var(--spacing-xl);
    letter-spacing: 0.2em;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.menu-btn {
    padding: var(--spacing-md) var(--spacing-xl);
    font-family: var(--font-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    border: 2px solid var(--primary-color);
    background: rgba(0, 212, 255, 0.1);
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--transition-medium);
    position: relative;
    overflow: hidden;
    min-width: 250px;
}

.menu-btn:hover {
    background: rgba(0, 212, 255, 0.2);
    box-shadow: var(--glow-primary);
    transform: translateY(-2px);
}

.menu-btn.primary {
    background: var(--primary-color);
    color: var(--background-dark);
    border-color: var(--primary-color);
}

.menu-btn.primary:hover {
    background: #00b8e6;
    box-shadow: var(--glow-primary);
}

.menu-btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.menu-btn:hover:before {
    left: 100%;
}

.player-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--background-light);
}

.stat {
    text-align: center;
}

.stat .label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.stat .value {
    font-family: var(--font-primary);
    font-size: 1.2rem;
    color: var(--primary-color);
    font-weight: 700;
}

/* Game Screen */
#gameScreen {
    z-index: 5;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* Game UI Overlay */
.ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.ui-overlay > * {
    pointer-events: auto;
}

/* Top HUD */
.top-hud {
    position: absolute;
    top: var(--spacing-md);
    left: var(--spacing-md);
    right: var(--spacing-md);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.score-panel {
    display: flex;
    gap: var(--spacing-lg);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md);
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.score-panel > div {
    text-align: center;
    min-width: 80px;
}

.score-panel .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.score-panel .value {
    font-family: var(--font-primary);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
}

.system-status {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md);
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.3);
}

.power-meter, .health-meter {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.power-meter .label, .health-meter .label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    width: 40px;
}

.meter {
    width: 100px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.meter-fill {
    height: 100%;
    width: 100%;
    transition: width var(--transition-medium);
    border-radius: 4px;
}

#powerFill {
    background: linear-gradient(90deg, var(--accent-color) 0%, var(--primary-color) 100%);
    box-shadow: var(--glow-accent);
}

#healthFill {
    background: linear-gradient(90deg, var(--success-color) 0%, var(--warning-color) 50%, var(--danger-color) 100%);
}

/* Tool Wheel */
.tool-wheel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 100%);
    backdrop-filter: blur(15px);
    border: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-medium);
    box-shadow: var(--glow-primary);
}

.tool-wheel.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.5);
    visibility: hidden;
}

.tool-option {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.2);
    border: 2px solid var(--primary-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.7rem;
    text-align: center;
}

.tool-option:nth-child(1) { transform: translate(-50%, -120px); }
.tool-option:nth-child(2) { transform: translate(70px, -60px); }
.tool-option:nth-child(3) { transform: translate(70px, 60px); }
.tool-option:nth-child(4) { transform: translate(-120px, -60px); }

.tool-option:hover {
    background: var(--primary-color);
    color: var(--background-dark);
    transform: scale(1.1);
    box-shadow: var(--glow-primary);
}

.tool-icon {
    width: 20px;
    height: 20px;
    margin-bottom: var(--spacing-xs);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Lane Indicators */
.lane-indicators {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--spacing-sm);
}

.lane-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
    transition: all var(--transition-fast);
}

.lane-marker.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: var(--glow-primary);
    transform: scale(1.3);
}

/* Speed Indicator */
.speed-indicator {
    position: absolute;
    bottom: var(--spacing-lg);
    right: var(--spacing-lg);
    text-align: center;
}

.speed-gauge {
    width: 80px;
    height: 40px;
    border: 2px solid var(--primary-color);
    border-bottom: none;
    border-radius: 40px 40px 0 0;
    position: relative;
    background: rgba(0, 0, 0, 0.7);
    margin-bottom: var(--spacing-sm);
}

.speed-needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 2px;
    height: 35px;
    background: var(--accent-color);
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(-90deg);
    transition: transform var(--transition-fast);
    border-radius: 1px;
    box-shadow: 0 0 10px var(--accent-color);
}

.speed-value {
    font-family: var(--font-primary);
    font-size: 0.9rem;
    color: var(--primary-color);
}

/* Pause Menu */
.pause-content {
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    padding: var(--spacing-xl);
    border-radius: 16px;
    border: 2px solid var(--primary-color);
    box-shadow: var(--glow-primary);
    backdrop-filter: blur(15px);
}

.pause-content h2 {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-xl);
    letter-spacing: 0.1em;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* Game Over Screen */
.game-over-content {
    text-align: center;
    background: rgba(0, 0, 0, 0.95);
    padding: var(--spacing-xl);
    border-radius: 16px;
    border: 2px solid var(--primary-color);
    box-shadow: var(--glow-primary);
    backdrop-filter: blur(15px);
    min-width: 400px;
}

.game-over-content h2 {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: var(--spacing-lg);
    letter-spacing: 0.1em;
}

.final-stats {
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.stat-row .label {
    color: var(--text-secondary);
}

.stat-row .value {
    font-family: var(--font-primary);
    color: var(--primary-color);
    font-weight: 700;
}

.game-over-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

/* Settings Panel */
.settings-content {
    background: rgba(0, 0, 0, 0.95);
    padding: var(--spacing-xl);
    border-radius: 16px;
    border: 2px solid var(--primary-color);
    box-shadow: var(--glow-primary);
    backdrop-filter: blur(15px);
    max-width: 800px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

.settings-content h2 {
    font-family: var(--font-primary);
    font-size: 2.5rem;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: var(--spacing-xl);
    letter-spacing: 0.1em;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.setting-group h3 {
    font-family: var(--font-primary);
    color: var(--accent-color);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--accent-color);
    padding-bottom: var(--spacing-xs);
}

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.setting label {
    color: var(--text-primary);
    font-weight: 500;
}

.setting select, .setting input[type="range"] {
    background: var(--background-medium);
    border: 1px solid var(--primary-color);
    color: var(--text-primary);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: 4px;
    min-width: 100px;
}

.setting input[type="range"] {
    min-width: 120px;
}

.checkbox-setting input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

.volume-value {
    margin-left: var(--spacing-sm);
    font-family: var(--font-primary);
    color: var(--primary-color);
    font-size: 0.9rem;
    min-width: 40px;
}

.settings-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--background-light);
}

/* Animations */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes glow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
        text-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    }
    50% { 
        box-shadow: 0 0 30px rgba(0, 212, 255, 0.6);
        text-shadow: 0 0 30px rgba(0, 212, 255, 0.8);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 3rem;
    }
    
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .menu-btn {
        min-width: 200px;
        font-size: 1rem;
    }
    
    .top-hud {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .score-panel {
        gap: var(--spacing-md);
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .game-title {
        font-size: 2rem;
    }
    
    .score-panel {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    
    .score-panel > div {
        min-width: auto;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #ffffff;
        --background-dark: #000000;
        --text-primary: #ffffff;
        --text-secondary: #ffffff;
    }
}

/* Focus indicators for keyboard navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .screen:not(.active) {
        display: none !important;
    }
}