:root {
    --primary: #00f2ff;
    --secondary: #7000ff;
    --background: #030816;
    --surface: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --text: #ffffff;
    --danger: #ff4d4d;
    --font-main: 'Outfit', sans-serif;
    --font-display: 'Orbit', sans-serif;
}

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

body {
    background-color: var(--background);
    color: var(--text);
    font-family: var(--font-main);
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

#game-container {
    position: relative;
    width: 600px;
    height: 800px;
    max-width: 100vw;
    max-height: 100vh;
    box-shadow: 0 0 50px rgba(0, 242, 255, 0.15);
    border: 1px solid var(--border);
    overflow: hidden;
}

canvas {
    display: block;
    background-color: #000;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    padding: 20px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    z-index: 10;
    pointer-events: none;
    gap: 15px;
}

.score-box,
.life-box,
.level-box,
.bomb-box {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.level-box #level-num {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: #ffaa00;
    text-shadow: 0 0 10px rgba(255, 170, 0, 0.5);
}

.bomb-box #bomb-icons {
    display: flex;
    gap: 4px;
    color: #ff4d4d;
    font-size: 1.2rem;
    text-shadow: 0 0 8px rgba(255, 77, 77, 0.6);
}

.label {
    display: block;
    font-size: 10px;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

#score {
    font-family: var(--font-display);
    font-size: 24px;
    text-shadow: 0 0 10px var(--primary);
}

.health-bar {
    width: 150px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 5px;
}

#health-fill {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    box-shadow: 0 0 10px var(--primary);
    transition: width 0.3s ease;
}

/* Overlays */
.overlay {
    position: absolute;
    inset: 0;
    background: rgba(3, 8, 22, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 10;
}

.hidden {
    display: none !important;
}

h1 {
    font-family: var(--font-display);
    font-size: 64px;
    color: var(--text);
    text-shadow: 0 0 20px var(--primary);
    margin-bottom: 10px;
}

/* Glitter & Sparkle Effect - High Visibility */
.glitter-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.glitter-container::before,
.glitter-container::after {
    content: '';
    position: absolute;
    inset: -200px;
    background-image:
        radial-gradient(2px 2px at 50px 50px, #fff, transparent),
        radial-gradient(2px 2px at 150px 150px, var(--primary), transparent),
        radial-gradient(2px 2px at 250px 100px, #fff, transparent),
        radial-gradient(3px 3px at 100px 300px, var(--secondary), transparent),
        radial-gradient(2px 2px at 300px 250px, #fff, transparent);
    background-size: 300px 300px;
    animation: glitter-flow 8s linear infinite;
    opacity: 0.6;
}

.glitter-container::after {
    animation-delay: -4s;
    animation-duration: 6s;
    opacity: 0.4;
}

@keyframes glitter-flow {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }

    100% {
        transform: translate(100px, 300px) rotate(15deg);
    }
}

.overlay h1,
.overlay p,
.action-buttons,
.ship-selection,
.controls-hint {
    position: relative;
    z-index: 5;
    /* Ensure content is above glitter */
}

.controls-hint {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 40px;
}

button {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
    padding: 15px 40px;
    font-family: var(--font-display);
    font-size: 18px;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

button:hover {
    background: var(--primary);
    color: var(--background);
    box-shadow: 0 0 30px var(--primary);
    transform: translateY(-2px);
}

.failed-text {
    font-family: var(--font-display);
    font-size: 48px;
    color: var(--danger);
    text-shadow: 0 0 20px var(--danger);
    margin-bottom: 20px;
}

.final-stats {
    margin-bottom: 40px;
    font-size: 24px;
}

#final-score {
    font-family: var(--font-display);
    color: var(--primary);
}

/* Ship Selection */
.ship-selection {
    display: flex;
    gap: 20px;
    margin-bottom: 40px;
    pointer-events: auto;
}

.ship-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    width: 140px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.ship-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    animation: rotate-card 4s linear infinite;
    pointer-events: none;
}

@keyframes rotate-card {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.ship-card.active {
    border-color: var(--primary);
    background: rgba(0, 242, 255, 0.05);
    box-shadow: 0 0 20px rgba(0, 242, 255, 0.2);
    transform: translateY(-5px);
}

.ship-preview {
    width: 100px;
    height: 80px;
    background-size: cover;
    background-position: center;
    border-radius: 8px;
    filter: grayscale(0.5) contrast(1.2) brightness(0.8);
    transition: all 0.4s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ship-card:hover .ship-preview {
    filter: grayscale(0) contrast(1.1) brightness(1.1);
    transform: scale(1.05);
}

#preview-standard {
    /* F-22 Raptor - High Quality Unsplash Photo */
    background-image: url('https://images.unsplash.com/photo-1517976487492-5750f3195933?auto=format&fit=crop&q=80&w=400');
    background-color: #1a1a1a;
}

#preview-plasma {
    /* F-117 Stealth - Dark Jet Silhouette */
    background-image: url('https://images.unsplash.com/photo-1567362241517-743a41c23862?auto=format&fit=crop&q=80&w=400');
    background-color: #1a1a1a;
}

#preview-gold {
    /* B-2 Bomber Style */
    background-image: url('https://images.unsplash.com/photo-1524331002391-4e76839d0623?auto=format&fit=crop&q=80&w=400');
    background-color: #1a1a1a;
}

.ship-name {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    margin-top: 5px;
}

/* Modal */
.modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    pointer-events: auto;
}

.modal-content {
    background: #0a1128;
    border: 1px solid var(--primary);
    padding: 30px;
    border-radius: 24px;
    text-align: center;
    width: 320px;
    box-shadow: 0 0 50px rgba(0, 242, 255, 0.3);
}

.modal h3 {
    margin-bottom: 15px;
    font-family: var(--font-display);
    color: var(--primary);
}

.payment-methods {
    display: flex;
    gap: 10px;
    margin: 25px 0;
}

.method {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 10px;
    background: rgba(255, 255, 255, 0.03);
}

#pay-confirm-btn {
    width: 100%;
    margin-bottom: 10px;
    padding: 12px;
    font-size: 14px;
}

button.secondary {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
    width: 100%;
    padding: 8px;
    font-size: 12px;
    box-shadow: none;
}

button.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}