/**
 * NEON HORIZON - Styles
 * All CSS for UI overlays, HUD, and animations
 */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* === START SCREEN === */
#start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #0a0014 0%, #1a0030 100%);
    z-index: 2000;
    transition: opacity 0.8s ease-out;
}

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

.neon-title {
    font-family: 'Monoton', cursive;
    font-size: clamp(3rem, 12vw, 6rem);
    color: #fff;
    text-transform: uppercase;
    animation: flicker 4s infinite alternate;
    text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 40px #ff00de, 0 0 80px #ff00de;
    margin-bottom: 1rem;
    text-align: center;
    line-height: 1.1;
}

.neon-subtitle {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    color: #00ffff;
    letter-spacing: 0.3rem;
    margin-bottom: 3rem;
    text-shadow: 0 0 10px #00ffff;
}

@keyframes flicker {

    0%,
    18%,
    22%,
    25%,
    53%,
    57%,
    100% {
        text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 40px #ff00de, 0 0 80px #ff00de;
        opacity: 1;
    }

    20%,
    24%,
    55% {
        text-shadow: none;
        opacity: 0.4;
    }
}

#start-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.2rem, 4vw, 2rem);
    padding: 15px 40px;
    background: transparent;
    border: 3px solid #00ffff;
    color: #00ffff;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 3px;
    box-shadow: 0 0 20px #00ffff, inset 0 0 20px rgba(0, 255, 255, 0.3);
    text-shadow: 0 0 10px #00ffff;
    font-weight: 700;
    transition: all 0.2s;
}

#start-btn:hover,
#start-btn:active {
    background: #00ffff;
    color: #000;
}

/* === START SCREEN SHIP SELECTION === */
.start-ship-selection {
    display: flex;
    gap: 25px;
    justify-content: center;
    margin-bottom: 2rem;
}

.start-ship-choice {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s ease;
    min-width: 100px;
    background: rgba(20, 20, 40, 0.6);
}

.start-ship-choice:hover {
    border-color: rgba(0, 255, 255, 0.5);
    transform: translateY(-3px);
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.start-ship-choice.selected {
    border-color: #00ffff;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.5), inset 0 0 15px rgba(0, 255, 255, 0.1);
}

.start-ship-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 10px;
}

.striker-icon {
    background: linear-gradient(180deg, #1a1a2e 0%, #00ffff 100%);
    clip-path: polygon(50% 0%, 15% 100%, 85% 100%);
    box-shadow: 0 0 15px #00ffff;
}

.pegasus-icon {
    background: linear-gradient(180deg, #ffffff 0%, #aa88ff 100%);
    clip-path: ellipse(40% 45% at 50% 50%);
    box-shadow: 0 0 15px #aa88ff;
    position: relative;
}

.pegasus-icon::after {
    content: '';
    position: absolute;
    top: 35%;
    left: -25%;
    width: 150%;
    height: 30%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    clip-path: polygon(0% 50%, 30% 0%, 50% 50%, 70% 0%, 100% 50%, 70% 100%, 50% 50%, 30% 100%);
    animation: wingFlap 0.8s ease-in-out infinite;
}

.start-ship-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 1px;
}

/* === LEVEL ANNOUNCEMENT === */
#level-announcement {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.9);
    z-index: 400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#level-announcement.visible {
    opacity: 1;
}

#level-announcement .act-label {
    font-family: 'Rajdhani', sans-serif;
    font-size: 1rem;
    font-weight: 400;
    letter-spacing: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUp 0.4s ease-out 0.1s forwards;
}

#level-announcement .level-number {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(4rem, 15vw, 8rem);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 0.3rem;
    opacity: 0;
    transform: scale(2);
    animation: zoomIn 0.5s ease-out 0.3s forwards;
}

#level-announcement .level-name {
    font-family: 'Monoton', cursive;
    font-size: clamp(1.5rem, 6vw, 3rem);
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(-20px);
    animation: slideDown 0.4s ease-out 0.6s forwards;
}

#level-announcement .level-desc {
    font-family: 'Rajdhani', sans-serif;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: 400;
    letter-spacing: 0.2rem;
    color: #888;
    max-width: 80%;
    text-align: center;
    opacity: 0;
    animation: fadeIn 0.4s ease-out 0.8s forwards;
}

#level-announcement .divider {
    width: 150px;
    height: 2px;
    margin: 1rem 0;
    opacity: 0;
    animation: expandWidth 0.4s ease-out 0.7s forwards;
}

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

@keyframes slideDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes expandWidth {
    from {
        opacity: 1;
        width: 0;
    }

    to {
        opacity: 1;
        width: 150px;
    }
}

/* === SURGE ZONE === */
#surge-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
}

#surge-warning.visible {
    opacity: 1;
    animation: surgeFlash 0.5s ease-out;
}

#surge-warning .surge-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.5rem, 5vw, 3rem);
    font-weight: 900;
    letter-spacing: 0.3rem;
    color: #dddddd;
    /* Light Gray */
    text-shadow: 0 0 20px #ffffff, 0 0 40px #888888;
    animation: surgePulse 0.3s ease-in-out infinite alternate;
}

@keyframes surgeFlash {
    0% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes surgePulse {
    from {
        text-shadow: 0 0 20px #ff0066, 0 0 40px #ff0066;
    }

    to {
        text-shadow: 0 0 30px #ff0066, 0 0 60px #ff0066, 0 0 100px #ff0066;
    }
}

#surge-indicator {
    position: fixed;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: min(300px, 80%);
    height: 5px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

#surge-indicator.visible {
    opacity: 1;
}

#surge-indicator .surge-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ffff, #ff00ff);
    border-radius: 3px;
    transition: width 0.1s linear;
}

#surge-indicator.surge-active .surge-fill {
    background: linear-gradient(90deg, #ff0066, #ff00ff, #ff0066);
    animation: surgeBarPulse 0.5s ease-in-out infinite alternate;
}

@keyframes surgeBarPulse {
    from {
        box-shadow: 0 0 5px #ff0066;
    }

    to {
        box-shadow: 0 0 15px #ff0066;
    }
}

/* === HUD === */
#hud {
    position: fixed;
    top: 10px;
    left: 0;
    width: 100%;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 100;
    font-family: 'Rajdhani', sans-serif;
}

#score-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

#score {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 0px #ff00de, 0 0 15px #ff00de;
    line-height: 1;
}

#score-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 2px;
    color: #ff00de;
}

#high-score {
    font-size: 0.8rem;
    color: #666;
    margin-top: 3px;
}

#lives-container {
    display: flex;
    gap: 8px;
}

.life-icon {
    width: 20px;
    height: 20px;
    background: #00ffff;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    box-shadow: 0 0 8px #00ffff;
}

#level-display {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

#level-value {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: 700;
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00;
}

#level-name {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 2px;
    color: #888;
}

#multiplier-display {
    position: fixed;
    top: 70px;
    left: 15px;
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #ffcc00;
    text-shadow: 0 0 10px #ffcc00;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}

#multiplier-display.visible {
    opacity: 1;
}

/* === GAME OVER & VICTORY === */
#game-over,
#mission-complete {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(10, 10, 26, 0.95);
    z-index: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s;
}

#game-over.visible,
#mission-complete.visible {
    opacity: 1;
    pointer-events: auto;
}

#game-over h1,
#mission-complete h1 {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(2rem, 8vw, 4rem);
    color: #ff0066;
    text-shadow: 0 0 30px #ff0066;
    margin-bottom: 15px;
    animation: pulse 1.5s ease-in-out infinite;
    text-align: center;
}

#mission-complete h1 {
    color: #00ff66;
    text-shadow: 0 0 30px #00ff66;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.final-score {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.2rem, 4vw, 2rem);
    color: #00ffff;
    margin-bottom: 30px;
}

.mission-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 30px;
    text-align: center;
}

#restart-btn,
#phase2-btn {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    padding: 12px 40px;
    background: linear-gradient(135deg, #ff00ff, #00ffff);
    border: none;
    border-radius: 50px;
    color: #000;
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.5);
}

#phase2-btn {
    background: linear-gradient(135deg, #00ff66, #00ffff);
}

#restart-btn:hover,
#restart-btn:active,
#phase2-btn:hover,
#phase2-btn:active {
    transform: scale(1.05);
}

/* === GAME+ SHIP SELECTION === */
.gameplus-text {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    color: #ffcc00;
    text-shadow: 0 0 15px #ffcc00;
    margin-bottom: 2rem;
    letter-spacing: 2px;
    animation: pulse 2s ease-in-out infinite;
}

.ship-selection {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.ship-option {
    background: linear-gradient(145deg, rgba(20, 20, 40, 0.9), rgba(40, 40, 80, 0.6));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    min-width: 150px;
}

.ship-option:hover,
.ship-option:active {
    border-color: #00ffff;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.4), inset 0 0 20px rgba(0, 255, 255, 0.1);
    transform: translateY(-5px) scale(1.05);
}

.ship-preview {
    width: 80px;
    height: 80px;
    margin: 0 auto 15px;
    position: relative;
}

.ship-solar {
    background: linear-gradient(135deg, #ffcc00 0%, #ff8800 50%, #ffcc00 100%);
    clip-path: polygon(50% 0%, 85% 30%, 100% 50%, 85% 100%, 15% 100%, 0% 50%, 15% 30%);
    box-shadow: 0 0 20px #ffcc00, 0 0 40px rgba(255, 136, 0, 0.5);
    animation: solarGlow 2s ease-in-out infinite alternate;
}

.ship-solar::before {
    content: '';
    position: absolute;
    top: 20%;
    left: 30%;
    width: 40%;
    height: 30%;
    background: linear-gradient(180deg, rgba(255, 255, 200, 0.8), transparent);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.ship-solar::after {
    content: '';
    position: absolute;
    bottom: 5px;
    left: 25%;
    width: 50%;
    height: 20%;
    background: linear-gradient(180deg, #ff4400, #ff8800);
    filter: blur(3px);
    animation: engineFlare 0.3s ease-in-out infinite alternate;
}

@keyframes solarGlow {
    from {
        box-shadow: 0 0 20px #ffcc00, 0 0 40px rgba(255, 136, 0, 0.5);
    }

    to {
        box-shadow: 0 0 30px #ffcc00, 0 0 60px rgba(255, 136, 0, 0.8);
    }
}

@keyframes engineFlare {
    from {
        opacity: 0.7;
        transform: scaleY(1);
    }

    to {
        opacity: 1;
        transform: scaleY(1.3);
    }
}

.ship-pegasus {
    position: relative;
    background: linear-gradient(180deg, #ffffff 0%, #ddddff 40%, #aa88ff 100%);
    clip-path: ellipse(35% 45% at 50% 55%);
    box-shadow: 0 0 20px #aa88ff, 0 0 40px rgba(170, 136, 255, 0.5);
    animation: pegasusGlow 2s ease-in-out infinite alternate;
}

.ship-pegasus::after {
    content: '';
    position: absolute;
    top: 30%;
    left: -30%;
    width: 160%;
    height: 40%;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.9) 15%, rgba(200, 180, 255, 0.8) 30%, transparent 50%, rgba(200, 180, 255, 0.8) 70%, rgba(255, 255, 255, 0.9) 85%, transparent 100%);
    clip-path: polygon(0% 50%, 20% 0%, 35% 50%, 50% 30%, 65% 50%, 80% 0%, 100% 50%, 80% 100%, 50% 70%, 20% 100%);
    animation: wingFlap 0.8s ease-in-out infinite;
}

@keyframes pegasusGlow {
    from {
        box-shadow: 0 0 20px #aa88ff, 0 0 40px rgba(170, 136, 255, 0.5);
    }

    to {
        box-shadow: 0 0 35px #cc99ff, 0 0 60px rgba(200, 150, 255, 0.8);
    }
}

@keyframes wingFlap {

    0%,
    100% {
        transform: scaleY(1) rotate(0deg);
    }

    50% {
        transform: scaleY(0.8) rotate(5deg);
    }
}

.ship-name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 5px;
    text-shadow: 0 0 10px currentColor;
}

.ship-option:first-child .ship-name {
    color: #ffcc00;
}

.ship-option:last-child .ship-name {
    color: #cc99ff;
}

.ship-desc {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.8rem;
    color: #888;
    letter-spacing: 1px;
}

.gameplus-score {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    color: #00ffff;
    text-shadow: 0 0 15px #00ffff;
    margin-top: 1rem;
}

/* === TOUCH ZONE === */
#touch-zone {
    position: fixed;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
    pointer-events: none;
    z-index: 50;
    display: none;
}

@media (pointer: coarse) {
    #touch-zone {
        display: block;
    }
}

/* === ERROR OVERLAY === */
#error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    color: #ff0066;
    z-index: 10000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    padding: 20px;
}

#error-overlay.visible {
    display: flex;
}

#error-overlay h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    text-shadow: 0 0 20px #ff0066;
}

#error-overlay p {
    font-size: 1.2rem;
    color: #fff;
    margin-bottom: 2rem;
    max-width: 600px;
    line-height: 1.5;
    font-family: 'Rajdhani', sans-serif;
}

#error-overlay .btn {
    padding: 10px 30px;
    border: 2px solid #00ffff;
    color: #00ffff;
    text-decoration: none;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    background: transparent;
    transition: all 0.2s;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
}

#error-overlay .btn:hover {
    background: #00ffff;
    color: #000;
}