/* Plane Battle - Polished Styles */

/* CSS Variables for cohesive color scheme */
:root {
    /* Primary palette - Deep space blues */
    --bg-dark: #050510;
    --bg-mid: #0a0a2e;
    --bg-light: #1a1a4e;
    
    /* Accent colors */
    --accent-cyan: #00d4ff;
    --accent-blue: #4488ff;
    --accent-purple: #aa44ff;
    --accent-pink: #ff44aa;
    --accent-orange: #ff8844;
    --accent-yellow: #ffdd44;
    --accent-green: #44ff88;
    --accent-red: #ff4444;
    
    /* UI colors */
    --ui-glow: rgba(0, 212, 255, 0.5);
    --ui-text: #ffffff;
    --ui-text-dim: rgba(255, 255, 255, 0.7);
    --ui-panel-bg: rgba(10, 10, 30, 0.9);
    
    /* Typography */
    --font-display: 'Orbitron', 'Segoe UI', sans-serif;
    --font-body: 'Exo 2', 'Segoe UI', sans-serif;
}

/* Reset and base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background: var(--bg-dark);
    overflow: hidden;
    font-family: var(--font-body);
}

/* Canvas styling */
#gameCanvas {
    display: block;
    background: linear-gradient(180deg, 
        var(--bg-dark) 0%, 
        var(--bg-mid) 30%, 
        var(--bg-light) 70%, 
        var(--bg-mid) 100%);
}

/* UI Container - Hidden by default, shown when game starts */
#ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#ui.visible {
    opacity: 1;
}

/* HUD Elements */
.hud-panel {
    position: absolute;
    background: var(--ui-panel-bg);
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: 12px;
    padding: 12px 18px;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.5),
        0 0 30px rgba(0, 212, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.hud-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--ui-text-dim);
    margin-bottom: 4px;
}

.hud-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--ui-text);
    text-shadow: 0 0 20px var(--ui-glow);
}

/* Score - Top left */
#scorePanel {
    top: 20px;
    left: 20px;
}

#scoreValue {
    color: var(--accent-yellow);
    text-shadow: 0 0 20px rgba(255, 221, 68, 0.5);
}

/* Health - Top right */
#healthPanel {
    top: 20px;
    right: 20px;
    text-align: right;
}

#healthValue {
    color: var(--accent-red);
    font-size: 28px;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
}

/* Wave - Below score */
#wavePanel {
    top: 90px;
    left: 20px;
}

#waveValue {
    color: var(--accent-green);
    text-shadow: 0 0 20px rgba(68, 255, 136, 0.5);
}

/* Powerup - Below wave */
#powerupPanel {
    top: 155px;
    left: 20px;
    min-width: 180px;
}

#powerupValue {
    font-size: 14px;
    color: var(--accent-purple);
    text-shadow: 0 0 15px rgba(170, 68, 255, 0.5);
}

#powerupTimer {
    font-size: 12px;
    color: var(--ui-text-dim);
    margin-top: 2px;
}

/* Screens (Start & Game Over) */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: 
        radial-gradient(ellipse at center, rgba(10, 10, 46, 0.95) 0%, rgba(5, 5, 16, 0.98) 100%);
    pointer-events: auto;
    opacity: 1;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Screen content container */
.screen-content {
    text-align: center;
    padding: 40px;
    background: var(--ui-panel-bg);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 24px;
    backdrop-filter: blur(20px);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 100px rgba(0, 212, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    max-width: 500px;
    width: 90%;
}

/* Title styling */
.game-title {
    font-family: var(--font-display);
    font-size: 52px;
    font-weight: 900;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 30px rgba(0, 212, 255, 0.5));
    letter-spacing: 2px;
}

.game-title .emoji {
    -webkit-text-fill-color: initial;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.5));
}

.game-subtitle {
    font-size: 14px;
    color: var(--ui-text-dim);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 30px;
}

/* Instructions */
.instructions {
    margin: 30px 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    border-left: 3px solid var(--accent-cyan);
}

.instruction-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 10px 0;
    font-size: 15px;
    color: var(--ui-text-dim);
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 10px;
    background: linear-gradient(180deg, #3a3a5a, #2a2a4a);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: var(--ui-text);
    box-shadow: 
        0 2px 0 rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.key-wide {
    min-width: 80px;
}

/* Buttons */
.btn {
    padding: 16px 48px;
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 20px;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 20px rgba(0, 212, 255, 0.4),
        0 0 40px rgba(0, 212, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

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

.btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 
        0 6px 30px rgba(0, 212, 255, 0.5),
        0 0 60px rgba(0, 212, 255, 0.3);
}

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

.btn:active {
    transform: translateY(1px) scale(0.98);
}

/* Game Over specific */
.game-over-title {
    font-family: var(--font-display);
    font-size: 42px;
    font-weight: 900;
    color: var(--accent-red);
    text-shadow: 0 0 40px rgba(255, 68, 68, 0.6);
    margin-bottom: 30px;
}

.score-display {
    margin: 20px 0;
}

.score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    margin: 8px 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.score-label {
    font-size: 14px;
    color: var(--ui-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--ui-text);
}

.score-value.highlight {
    color: var(--accent-yellow);
    text-shadow: 0 0 20px rgba(255, 221, 68, 0.5);
}

/* New high score badge */
.new-high-score {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, var(--accent-yellow), var(--accent-orange));
    color: var(--bg-dark);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 20px;
    margin-left: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Touch Controls */
#touchControls {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 140px;
    height: 140px;
    display: none;
}

#dPad {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    border: 2px solid rgba(0, 212, 255, 0.3);
    box-shadow: 
        0 0 30px rgba(0, 212, 255, 0.2),
        inset 0 0 20px rgba(0, 212, 255, 0.1);
}

#dPad::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 212, 255, 0.2);
    border-radius: 50%;
    border: 2px solid rgba(0, 212, 255, 0.4);
}

#fireBtn {
    position: absolute;
    bottom: 30px;
    right: 30px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 68, 68, 0.2) 0%, transparent 70%);
    border: 2px solid rgba(255, 68, 68, 0.4);
    border-radius: 50%;
    display: none;
    pointer-events: auto;
    box-shadow: 
        0 0 30px rgba(255, 68, 68, 0.2),
        inset 0 0 20px rgba(255, 68, 68, 0.1);
}

#fireBtn::before {
    content: '🔥';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    opacity: 0.8;
}

#fireBtn:active {
    background: radial-gradient(circle, rgba(255, 68, 68, 0.4) 0%, transparent 70%);
    transform: scale(0.95);
}

/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;600;700;800;900&family=Exo+2:wght@300;400;500;600;700&display=swap');
