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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #1a1a2e;
    color: #fff;
    overflow: hidden;
    height: 100vh;
}

#container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

#info {
    width: 220px;
    padding: 20px;
    background: linear-gradient(180deg, #16213e 0%, #0f3460 100%);
    border-right: 2px solid #e94560;
}

#info h1 {
    font-size: 1.2rem;
    color: #e94560;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#info p {
    font-size: 0.85rem;
    color: #94a3b8;
    margin-bottom: 20px;
}

#controls {
    margin-top: 20px;
}

#controls p {
    margin: 8px 0;
    font-size: 0.75rem;
}

#controls strong {
    color: #60a5fa;
}

kbd {
    display: inline-block;
    padding: 3px 8px;
    background: #2d3748;
    border: 1px solid #4a5568;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    color: #fff;
    box-shadow: 0 2px 0 #1a202c;
}

#canvas-container {
    flex: 1;
    position: relative;
    background: #0f0f23;
}

/* Game HUD Overlay */
#game-hud {
    position: fixed;
    top: 0;
    left: 220px;
    right: 0;
    pointer-events: none;
    z-index: 100;
}

.hud-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(22, 33, 62, 0.9);
    border: 2px solid #e94560;
    border-radius: 12px;
    padding: 15px 20px;
    min-width: 200px;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

.hud-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 6px 0;
}

.hud-label {
    font-size: 0.7rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hud-value {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1rem;
}

#hud-score {
    color: #4ade80;
    font-size: 1.3rem;
}

#hud-balls {
    font-size: 1rem;
    letter-spacing: 2px;
}

/* Rank colors */
.rank-cadet { color: #9ca3af; }
.rank-ensign { color: #60a5fa; }
.rank-lieutenant { color: #34d399; }
.rank-captain { color: #fbbf24; }
.rank-commander { color: #f97316; }
.rank-admiral { color: #a78bfa; }
.rank-fleet_admiral { 
    color: #f472b6;
    text-shadow: 0 0 10px #f472b6;
    animation: rank-pulse 1s ease-in-out infinite;
}

@keyframes rank-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.multiplier-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #374151;
}

#hud-multiplier {
    color: #fbbf24;
}

.multiplier-active {
    animation: mult-pulse 0.5s ease-in-out;
}

@keyframes mult-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Combo Display */
#combo-display {
    position: absolute;
    top: 80px;
    right: 30px;
    font-family: 'Impact', sans-serif;
    font-size: 2rem;
    color: #fbbf24;
    text-shadow: 0 0 20px #fbbf24, 2px 2px 0 #000;
    transition: all 0.3s ease;
}

.combo-hidden {
    opacity: 0;
    transform: scale(0.5);
}

.combo-2, .combo-3 { color: #60a5fa; font-size: 1.5rem; }
.combo-4, .combo-5 { color: #34d399; font-size: 1.8rem; }
.combo-6, .combo-7 { color: #fbbf24; font-size: 2rem; }
.combo-8, .combo-9, .combo-10 { 
    color: #ef4444; 
    font-size: 2.5rem;
    animation: combo-shake 0.1s ease-in-out infinite;
}

@keyframes combo-shake {
    0%, 100% { transform: rotate(-2deg); }
    50% { transform: rotate(2deg); }
}

/* Score Popups */
#score-popup-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.score-popup {
    position: absolute;
    font-family: 'Impact', sans-serif;
    font-size: 1.2rem;
    color: #4ade80;
    text-shadow: 2px 2px 0 #000;
    opacity: 0;
    transform: translateY(20px);
}

.popup-animate {
    animation: popup-rise 1s ease-out forwards;
}

@keyframes popup-rise {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translateY(0) scale(1.2);
    }
    80% {
        opacity: 1;
        transform: translateY(-30px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
}

/* Mission Display */
#mission-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(22, 33, 62, 0.95) 0%, rgba(15, 52, 96, 0.95) 100%);
    border: 3px solid #fbbf24;
    border-radius: 16px;
    padding: 25px 40px;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    min-width: 300px;
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.4);
}

#mission-display.mission-active {
    opacity: 1;
}

.mission-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: #fbbf24;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.mission-desc {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-bottom: 15px;
}

.mission-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

.progress-bar {
    width: 150px;
    height: 12px;
    background: #1e293b;
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #fff;
    min-width: 50px;
}

.mission-timer {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    color: #ef4444;
    margin-top: 10px;
}

/* Game Messages */
.game-message {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: linear-gradient(135deg, #e94560 0%, #be123c 100%);
    color: #fff;
    font-family: 'Impact', sans-serif;
    font-size: 2.5rem;
    padding: 20px 50px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 40px rgba(233, 69, 96, 0.6);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 200;
}

.message-show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* High Score Arcade Styling */
#highscore-overlay {
    font-family: 'Courier New', monospace;
}

.highscore-arcade {
    width: 600px;
    max-width: 90vw;
}

.arcade-header {
    text-align: center;
    margin-bottom: 30px;
}

.marquee-text {
    font-family: 'Impact', sans-serif;
    font-size: 1.5rem;
    color: #e94560;
    letter-spacing: 8px;
    text-shadow: 0 0 20px #e94560;
    animation: marquee-glow 2s ease-in-out infinite;
}

@keyframes marquee-glow {
    0%, 100% { opacity: 1; text-shadow: 0 0 20px #e94560; }
    50% { opacity: 0.7; text-shadow: 0 0 40px #e94560; }
}

.highscore-title {
    font-family: 'Impact', sans-serif;
    font-size: 2.5rem;
    color: #fbbf24;
    text-shadow: 0 0 30px #fbbf24;
    margin-top: 10px;
    letter-spacing: 4px;
}

.highscore-list {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid #374151;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
}

.highscore-entry {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    margin: 8px 0;
    background: rgba(22, 33, 62, 0.5);
    border-radius: 8px;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.highscore-entry:hover {
    background: rgba(22, 33, 62, 0.8);
    transform: translateX(5px);
}

.highscore-entry.top-three {
    background: linear-gradient(90deg, rgba(233, 69, 96, 0.2) 0%, rgba(22, 33, 62, 0.5) 100%);
    border-left: 3px solid #e94560;
}

.entry-rank {
    width: 40px;
    font-weight: bold;
    color: #94a3b8;
}

.highscore-entry.top-three .entry-rank {
    color: #fbbf24;
    font-size: 1.4rem;
}

.entry-name {
    flex: 1;
    text-align: center;
    font-weight: bold;
    font-size: 1.3rem;
    color: #fff;
    letter-spacing: 2px;
}

.entry-rank-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    margin: 0 15px;
}

.entry-score {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 1.3rem;
    color: #4ade80;
    letter-spacing: 2px;
}

.arcade-footer {
    text-align: center;
    margin-top: 30px;
}

.insert-coin {
    font-family: 'Impact', sans-serif;
    font-size: 1.2rem;
    color: #fbbf24;
    letter-spacing: 4px;
    animation: coin-flash 1s ease-in-out infinite;
}

@keyframes coin-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.press-start {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-top: 10px;
    letter-spacing: 2px;
}

/* Name Entry Modal */
.name-entry-modal {
    animation: modal-pop 0.3s ease-out;
}

@keyframes modal-pop {
    0% { transform: translate(-50%, -50%) scale(0.8); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.new-highscore-title {
    font-family: 'Impact', sans-serif;
    font-size: 2rem;
    color: #fbbf24;
    margin-bottom: 20px;
    text-shadow: 0 0 20px #fbbf24;
}

.final-score {
    font-family: 'Courier New', monospace;
    font-size: 2.5rem;
    color: #4ade80;
    margin: 20px 0;
    text-shadow: 0 0 10px #4ade80;
}

.rank-earned {
    font-size: 1.2rem;
    color: #a78bfa;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.name-input {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
}

.initial-slot {
    width: 60px;
    height: 80px;
    background: rgba(0, 0, 0, 0.5);
    border: 3px solid #4a5568;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: #94a3b8;
    transition: all 0.2s ease;
}

.initial-slot.filled {
    color: #4ade80;
    border-color: #4ade80;
    box-shadow: 0 0 20px rgba(74, 222, 128, 0.5);
    animation: slot-pop 0.2s ease-out;
}

@keyframes slot-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.enter-name {
    color: #94a3b8;
    font-size: 0.9rem;
    letter-spacing: 2px;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 900px) {
    #info {
        width: 180px;
    }
    
    #game-hud {
        left: 180px;
    }
}

@media (max-width: 700px) {
    #container {
        flex-direction: column;
    }
    
    #info {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 2px solid #e94560;
        padding: 10px 20px;
    }
    
    #info h1 {
        font-size: 1rem;
    }
    
    #controls {
        display: flex;
        gap: 15px;
        margin-top: 10px;
    }
    
    #controls p {
        margin: 0;
    }
    
    #game-hud {
        left: 0;
    }
    
    .hud-panel {
        top: 10px;
        left: 10px;
        padding: 10px 15px;
        min-width: 160px;
    }
    
    .hud-value {
        font-size: 0.85rem;
    }
    
    #hud-score {
        font-size: 1rem;
    }
}
