/* ═══════════════════════════════════════════════════════════════
   Space Shooter — Game-Based Assessment Styles
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: #030712;
    color: #fff;
    overflow-x: hidden;
}

/* Hide scrollbar for the body */
body::-webkit-scrollbar { display: none; }
body { -ms-overflow-style: none; scrollbar-width: none; }

/* ── Custom Scrollbar (Review Modal) ─────────────────────────── */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
    background: #111827;
    border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 3px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* ── Starfield Background ────────────────────────────────────── */
.starfield-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

/* Generate twinkling stars using pseudo-elements and box-shadows */
.starfield-bg::before,
.starfield-bg::after {
    content: '';
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    animation: twinkle 4s ease-in-out infinite alternate;
}

.starfield-bg::before {
    box-shadow:
        50px 80px #fff, 150px 200px #fff, 300px 50px rgba(255,255,255,0.8),
        450px 150px #fff, 600px 300px rgba(255,255,255,0.6), 100px 400px #fff,
        250px 350px rgba(255,255,255,0.7), 500px 100px #fff, 700px 250px rgba(255,255,255,0.5),
        80px 280px #fff, 320px 420px rgba(255,255,255,0.8), 550px 380px #fff,
        180px 120px rgba(255,255,255,0.6), 420px 280px #fff, 650px 180px rgba(255,255,255,0.7),
        30px 450px #fff, 370px 30px rgba(255,255,255,0.9), 520px 450px #fff,
        720px 400px rgba(255,255,255,0.5), 200px 500px #fff, 400px 500px rgba(255,255,255,0.6),
        600px 50px #fff, 750px 320px rgba(255,255,255,0.8), 130px 550px #fff,
        480px 580px rgba(255,255,255,0.7), 680px 520px #fff, 60px 180px rgba(255,255,255,0.5),
        340px 160px #fff, 560px 220px rgba(255,255,255,0.6), 770px 100px #fff;
    animation-delay: 0s;
}

.starfield-bg::after {
    box-shadow:
        120px 130px rgba(255,255,255,0.6), 280px 280px #fff, 430px 80px rgba(255,255,255,0.7),
        580px 230px #fff, 50px 350px rgba(255,255,255,0.5), 350px 500px #fff,
        630px 420px rgba(255,255,255,0.8), 170px 60px #fff, 490px 340px rgba(255,255,255,0.6),
        730px 150px #fff, 220px 450px rgba(255,255,255,0.9), 380px 390px #fff,
        540px 520px rgba(255,255,255,0.5), 90px 520px #fff, 680px 70px rgba(255,255,255,0.7),
        260px 210px #fff, 460px 460px rgba(255,255,255,0.6), 610px 560px #fff,
        140px 380px rgba(255,255,255,0.8), 780px 280px #fff, 310px 100px rgba(255,255,255,0.5),
        500px 190px #fff, 70px 600px rgba(255,255,255,0.7), 410px 620px #fff;
    animation-delay: 2s;
}

@keyframes twinkle {
    0%   { opacity: 0.3; }
    50%  { opacity: 1; }
    100% { opacity: 0.5; }
}

/* ── Float Animation ─────────────────────────────────────────── */
.animate-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

/* ── Mechanic Cards Hover ────────────────────────────────────── */
.mechanic-card {
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.mechanic-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 172, 237, 0.1);
}

/* ── Engine Flame Animation ──────────────────────────────────── */
.engine-flame {
    animation: flame-flicker 0.15s ease-in-out infinite alternate;
}

@keyframes flame-flicker {
    0%   { opacity: 0.6; transform: scaleY(0.9); }
    100% { opacity: 1; transform: scaleY(1.15); }
}

/* ── Spaceship ───────────────────────────────────────────────── */
#spaceship {
    transition: none;
    transform-origin: center center;
    will-change: transform;
    z-index: 10;
}

/* ── Asteroid Styling ────────────────────────────────────────── */
.asteroid {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    will-change: transform;
    z-index: 5;
    transition: none;
}

.asteroid-body {
    width: 90px;
    height: 80px;
    background: linear-gradient(135deg, #374151, #1f2937, #4b5563);
    border: 2px solid #6b7280;
    border-radius: 42% 58% 55% 45% / 50% 42% 58% 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset -4px -4px 8px rgba(0, 0, 0, 0.5),
        inset 2px 2px 4px rgba(255, 255, 255, 0.05),
        0 0 20px rgba(107, 114, 128, 0.2);
    position: relative;
    overflow: hidden;
}

/* Rocky texture spots */
.asteroid-body::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 10px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    top: 15px;
    left: 12px;
    box-shadow:
        30px 20px 0 4px rgba(0, 0, 0, 0.2),
        15px 40px 0 2px rgba(0, 0, 0, 0.25),
        45px 10px 0 3px rgba(0, 0, 0, 0.15);
}

.asteroid-letter {
    font-size: 1.1rem;
    font-weight: 800;
    color: #00ACED;
    line-height: 1;
    z-index: 1;
    text-shadow: 0 0 8px rgba(0, 172, 237, 0.5);
}

.asteroid-text {
    font-size: 0.55rem;
    font-weight: 600;
    color: #d1d5db;
    max-width: 72px;
    text-align: center;
    line-height: 1.2;
    z-index: 1;
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Hover label below asteroid */
.asteroid-label {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid #374151;
    border-radius: 6px;
    padding: 2px 8px;
    white-space: nowrap;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.65rem;
    font-weight: 500;
    color: #d1d5db;
}

/* ── Laser Beam ──────────────────────────────────────────────── */
.laser {
    position: absolute;
    width: 4px;
    height: 20px;
    background: linear-gradient(to top, transparent, #00ACED, #086FB2);
    border-radius: 2px;
    box-shadow:
        0 0 8px #00ACED,
        0 0 16px rgba(0, 172, 237, 0.5),
        0 0 30px rgba(8, 111, 178, 0.3);
    will-change: transform;
    z-index: 8;
    pointer-events: none;
}

/* ── Explosion Particle ──────────────────────────────────────── */
.explosion-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

@keyframes explode {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(0);
        opacity: 0;
    }
}

/* ── Asteroid Debris ─────────────────────────────────────────── */
.debris {
    position: absolute;
    pointer-events: none;
    will-change: transform, opacity;
}

@keyframes debris-fly {
    0% {
        transform: translate(0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0);
        opacity: 0;
    }
}

/* ── Space Dust ──────────────────────────────────────────────── */
.space-dust {
    position: absolute;
    width: 1px;
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
    animation: dust-drift linear infinite;
}

@keyframes dust-drift {
    0%   { transform: translateY(0) translateX(0); opacity: 0; }
    10%  { opacity: 0.4; }
    90%  { opacity: 0.4; }
    100% { transform: translateY(var(--drift-y)) translateX(var(--drift-x)); opacity: 0; }
}

/* ── Timer Bar Danger State ──────────────────────────────────── */
.timer-danger {
    background: linear-gradient(to right, #ef4444, #f97316) !important;
    animation: timer-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes timer-pulse {
    0%   { opacity: 0.8; }
    100% { opacity: 1; }
}

/* ── Review Card ─────────────────────────────────────────────── */
.review-card {
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 12px;
    padding: 1.25rem;
    transition: border-color 0.2s;
}

.review-card:hover {
    border-color: #374151;
}

.review-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 4px;
}

.review-option.correct {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.review-option.wrong {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.review-option.neutral {
    background: rgba(107, 114, 128, 0.1);
    border: 1px solid rgba(107, 114, 128, 0.2);
    color: #9ca3af;
}

/* ── Screen Transitions ──────────────────────────────────────── */
.screen-enter {
    animation: screen-fade-in 0.5s ease-out forwards;
}

@keyframes screen-fade-in {
    0%   { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* ── Crosshair Cursor ────────────────────────────────────────── */
#game-arena {
    cursor: crosshair;
}

/* ── Responsive Asteroid Sizing ──────────────────────────────── */
@media (max-width: 640px) {
    .asteroid-body {
        width: 72px;
        height: 64px;
    }
    .asteroid-letter {
        font-size: 0.95rem;
    }
    .asteroid-text {
        font-size: 0.5rem;
        max-width: 58px;
    }
    .asteroid-label {
        display: none;
    }
    #spaceship svg {
        width: 36px;
        height: 44px;
    }
}

/* ── Muzzle Flash ────────────────────────────────────────────── */
.muzzle-flash {
    position: absolute;
    width: 12px;
    height: 12px;
    background: radial-gradient(circle, #00ACED, transparent);
    border-radius: 50%;
    pointer-events: none;
    animation: muzzle-fade 0.2s ease-out forwards;
    z-index: 12;
}

@keyframes muzzle-fade {
    0%   { transform: scale(1); opacity: 1; }
    100% { transform: scale(2.5); opacity: 0; }
}
