/* ===== OPTIMIZED HYPERSPACE RUSH STYLES ===== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --cyan: #00ffff;
    --magenta: #ff00ff;
    --yellow: #ffff00;
    --orange: #ff6600;
    --green: #00ff00;
    --red: #ff0000;
    --bg-dark: #0a0a12;
    --purple: #8b00ff;
    --font-display: 'Orbitron', monospace;
    --font-body: 'Rajdhani', sans-serif;
}

body {
    margin: 0;
    overflow: hidden;
    background: #000;
    font-family: var(--font-body);
    color: #fff;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    width: 100vw;
    height: 100vh;
    position: fixed;
}

canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
}

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0a0a12 0%, #1a0a3e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.loading-content {
    text-align: center;
}

.loading-title {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    background: linear-gradient(135deg, var(--cyan), var(--magenta));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 30px;
}

.loading-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto 15px;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--cyan), var(--magenta));
    width: 0%;
    transition: width 0.3s;
    box-shadow: 0 0 15px var(--cyan);
}

.loading-text {
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    color: rgba(255, 255, 255, 0.6);
}

/* ===== REDESIGNED INSTRUCTIONS SCREEN ===== */
.instructions-screen {
    position: fixed;
    inset: 0;
    background: #0a0a12;
    display: none;
    z-index: 9500;
    opacity: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.instructions-bg-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(rgba(0, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 255, 0.05) 1px, transparent 1px),
        radial-gradient(circle at 20% 50%, rgba(0, 255, 255, 0.1), transparent 50%),
        radial-gradient(circle at 80% 50%, rgba(255, 0, 255, 0.1), transparent 50%);
    background-size: 50px 50px, 50px 50px, 100% 100%, 100% 100%;
    animation: gridFloat 20s linear infinite;
}

@keyframes gridFloat {
    0% { background-position: 0 0, 0 0, 0% 0%, 0% 0%; }
    100% { background-position: 50px 50px, 50px 50px, 100% 100%, 100% 100%; }
}

.instructions-content {
    position: relative;
    z-index: 2;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 40px 60px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.instructions-main-title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 7vw, 5rem);
    font-weight: 900;
    letter-spacing: 0.3em;
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.title-word {
    display: inline-block;
    background: linear-gradient(135deg, var(--cyan) 0%, var(--magenta) 50%, var(--purple) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: titleFloat 3s ease-in-out infinite;
    position: relative;
    filter: drop-shadow(0 0 30px rgba(0, 255, 255, 0.6));
}

.title-word:nth-child(1) { animation-delay: 0s; }
.title-word:nth-child(2) { animation-delay: 0.2s; }
.title-word:nth-child(3) { animation-delay: 0.4s; }

@keyframes titleFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.instructions-subtitle {
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    margin-bottom: 60px;
    letter-spacing: 0.1em;
    animation: subtitleFade 2s ease-in-out infinite;
}

@keyframes subtitleFade {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.instructions-cards-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    width: 100%;
    max-width: 1200px;
    margin-bottom: 60px;
}

/* Card Base Styles */
.instruction-card {
    background: linear-gradient(135deg, rgba(10, 10, 30, 0.9) 0%, rgba(20, 10, 50, 0.9) 100%);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 25px;
    padding: 40px 30px;
    backdrop-filter: blur(20px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    animation: cardFloat 6s ease-in-out infinite;
}

.instruction-card:nth-child(1) { animation-delay: 0s; }
.instruction-card:nth-child(2) { animation-delay: 1s; }
.instruction-card:nth-child(3) { animation-delay: 2s; }
.instruction-card:nth-child(4) { animation-delay: 3s; }

@keyframes cardFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

.card-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(135deg, var(--cyan), var(--magenta));
    border-radius: 25px;
    opacity: 0;
    filter: blur(20px);
    transition: opacity 0.5s;
    z-index: -1;
}

.card-glow.glow-green {
    background: linear-gradient(135deg, var(--green), var(--cyan));
}

.card-glow.glow-red {
    background: linear-gradient(135deg, var(--red), var(--orange));
}

.instruction-card:hover {
    transform: translateY(-20px) scale(1.05);
    border-color: var(--cyan);
    box-shadow: 0 30px 60px rgba(0, 255, 255, 0.4);
}

.instruction-card:hover .card-glow {
    opacity: 0.6;
}

/* Icon Styles */
.instruction-icon-wrapper {
    width: 80px;
    height: 80px;
    margin: 0 auto 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), rgba(255, 0, 255, 0.2));
    border: 3px solid var(--cyan);
    border-radius: 50%;
    font-size: 2.5rem;
    color: var(--cyan);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
    animation: iconPulse 3s ease-in-out infinite;
}

.instruction-icon-wrapper.green {
    background: linear-gradient(135deg, rgba(0, 255, 0, 0.2), rgba(0, 255, 255, 0.2));
    border-color: var(--green);
    color: var(--green);
    box-shadow: 0 0 30px rgba(0, 255, 0, 0.5);
}

.instruction-icon-wrapper.red {
    background: linear-gradient(135deg, rgba(255, 0, 0, 0.2), rgba(255, 102, 0, 0.2));
    border-color: var(--red);
    color: var(--red);
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

@keyframes iconPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 30px currentColor;
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 50px currentColor;
    }
}

.instruction-card h3 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    letter-spacing: 0.2em;
    color: var(--cyan);
    margin-bottom: 25px;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 0 0 20px currentColor;
}

.instruction-card h3.title-green {
    color: var(--green);
}

.instruction-card h3.title-red {
    color: var(--red);
}

/* Controls Card Specific */
.instruction-details {
    text-align: center;
}

.control-section {
    margin-bottom: 25px;
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 15px;
    letter-spacing: 0.1em;
}

.key-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 12px 0;
}

.key-group.single {
    margin: 15px 0;
}

.instruction-details kbd {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.3), rgba(0, 255, 255, 0.1));
    border: 2px solid var(--cyan);
    border-radius: 10px;
    padding: 12px 18px;
    font-family: var(--font-display);
    color: var(--cyan);
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: 
        0 0 20px rgba(0, 255, 255, 0.4),
        inset 0 0 10px rgba(0, 255, 255, 0.2);
    display: inline-block;
    min-width: 50px;
    text-align: center;
    transition: all 0.3s;
}

.instruction-details kbd:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 30px rgba(0, 255, 255, 0.6);
}

.instruction-details kbd.key-boost {
    padding: 12px 30px;
    background: linear-gradient(135deg, rgba(255, 255, 0, 0.3), rgba(255, 102, 0, 0.2));
    border-color: var(--yellow);
    color: var(--yellow);
    box-shadow: 
        0 0 20px rgba(255, 255, 0, 0.4),
        inset 0 0 10px rgba(255, 255, 0, 0.2);
}

.control-desc {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin: 8px 0;
    letter-spacing: 0.05em;
}

.control-desc i {
    margin-right: 8px;
    color: var(--cyan);
}

.control-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--cyan), transparent);
    margin: 25px 0;
    opacity: 0.3;
}

/* Objective Card Specific */
.objective-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    margin-bottom: 12px;
    background: rgba(0, 255, 255, 0.05);
    border-left: 3px solid var(--cyan);
    border-radius: 10px;
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    transition: all 0.3s;
}

.objective-item:hover {
    background: rgba(0, 255, 255, 0.15);
    transform: translateX(10px);
}

.objective-item i {
    font-size: 1.3rem;
    color: var(--cyan);
}

.objective-item.highlight {
    border-left-color: var(--yellow);
    background: rgba(255, 255, 0, 0.1);
}

.objective-item.highlight i {
    color: var(--yellow);
    animation: trophySpin 3s linear infinite;
}

@keyframes trophySpin {
    0%, 90% { transform: rotate(0deg); }
    95%, 100% { transform: rotate(360deg); }
}

/* Collect Card Specific */
.collect-item {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 20px;
    background: rgba(0, 255, 0, 0.05);
    border: 2px solid rgba(0, 255, 0, 0.3);
    border-radius: 15px;
}

.particle-visual {
    width: 80px;
    height: 80px;
    position: relative;
    flex-shrink: 0;
}

.green-particle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.particle-core {
    width: 40px;
    height: 40px;
    background: var(--green);
    border-radius: 50%;
    box-shadow: 0 0 30px var(--green);
    animation: particleBounce 2s ease-in-out infinite;
}

.particle-ring {
    position: absolute;
    inset: 0;
    border: 3px solid var(--green);
    border-radius: 50%;
    animation: ringExpand 2s ease-out infinite;
}

@keyframes particleBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

@keyframes ringExpand {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.collect-text {
    flex: 1;
    text-align: left;
}

.collect-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.collect-desc {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.collect-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--green);
    text-shadow: 0 0 15px var(--green);
}

/* Avoid Card Specific */
.avoid-item {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 20px;
    background: rgba(255, 0, 0, 0.05);
    border: 2px solid rgba(255, 0, 0, 0.3);
    border-radius: 15px;
}

.red-particle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.red-particle .particle-core {
    background: var(--red);
    box-shadow: 0 0 30px var(--red);
    animation: dangerPulse 1.5s ease-in-out infinite;
}

.particle-danger {
    position: absolute;
    inset: -10px;
    border: 3px solid var(--red);
    border-radius: 10px;
    animation: dangerRotate 3s linear infinite;
}

@keyframes dangerPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 0 30px var(--red);
    }
    50% { 
        transform: scale(1.15);
        box-shadow: 0 0 50px var(--red);
    }
}

@keyframes dangerRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.avoid-text {
    flex: 1;
    text-align: left;
}

.avoid-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--red);
    margin-bottom: 8px;
    letter-spacing: 0.05em;
}

.avoid-desc {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.avoid-value {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--red);
    text-shadow: 0 0 15px var(--red);
    animation: warningBlink 2s ease-in-out infinite;
}

@keyframes warningBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Start Button - Enhanced */
.instructions-start-btn {
    background: linear-gradient(135deg, 
        rgba(0, 255, 255, 0.4) 0%, 
        rgba(138, 0, 255, 0.4) 50%, 
        rgba(255, 0, 255, 0.4) 100%);
    border: 4px solid transparent;
    background-clip: padding-box;
    color: #fff;
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 0.3em;
    padding: 30px 100px;
    cursor: pointer;
    border-radius: 60px;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
    order: -1;
    box-shadow: 
        0 0 40px rgba(0, 255, 255, 0.5),
        0 0 80px rgba(255, 0, 255, 0.3),
        inset 0 0 20px rgba(0, 255, 255, 0.2);
    animation: buttonPulse 3s ease-in-out infinite, buttonFloat 4s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animated border gradient */
.instructions-start-btn::before {
    content: '';
    position: absolute;
    inset: -4px;
    background: linear-gradient(45deg, 
        var(--cyan), 
        var(--magenta), 
        var(--purple),
        var(--yellow),
        var(--cyan));
    background-size: 300% 300%;
    border-radius: 60px;
    z-index: -1;
    animation: gradientRotate 4s ease infinite;
}

/* Inner glow */
.instructions-start-btn::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: linear-gradient(135deg, 
        rgba(10, 10, 30, 0.95) 0%, 
        rgba(20, 10, 50, 0.95) 100%);
    border-radius: 56px;
    z-index: 1;
}

.btn-text {
    position: relative;
    z-index: 2;
    text-shadow: 
        0 0 10px currentColor,
        0 0 20px currentColor,
        0 0 40px rgba(0, 255, 255, 0.8);
    display: inline-block;
}

.btn-shine {
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(90deg, 
        transparent, 
        rgba(255, 255, 255, 0.8), 
        transparent);
    transform: skewX(-25deg);
    z-index: 3;
    animation: shineMove 3s ease-in-out infinite;
}

@keyframes buttonPulse {
    0%, 100% { 
        box-shadow: 
            0 0 40px rgba(0, 255, 255, 0.5),
            0 0 80px rgba(255, 0, 255, 0.3),
            inset 0 0 20px rgba(0, 255, 255, 0.2);
    }
    50% { 
        box-shadow: 
            0 0 60px rgba(0, 255, 255, 0.8),
            0 0 120px rgba(255, 0, 255, 0.5),
            inset 0 0 30px rgba(0, 255, 255, 0.4);
    }
}

@keyframes buttonFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes gradientRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes shineMove {
    0% { left: -150%; }
    20% { left: 150%; }
    100% { left: 150%; }
}

.instructions-start-btn:hover {
    transform: scale(1.15) translateY(-5px);
    box-shadow: 
        0 0 80px rgba(0, 255, 255, 0.9),
        0 0 160px rgba(255, 0, 255, 0.6),
        inset 0 0 40px rgba(0, 255, 255, 0.4);
    animation: none;
}

.instructions-start-btn:hover::before {
    animation: gradientRotate 1s ease infinite;
}

.instructions-start-btn:hover .btn-text {
    animation: textGlow 0.5s ease-in-out infinite alternate;
}

@keyframes textGlow {
    from {
        text-shadow: 
            0 0 10px currentColor,
            0 0 20px currentColor,
            0 0 40px rgba(0, 255, 255, 0.8);
    }
    to {
        text-shadow: 
            0 0 20px currentColor,
            0 0 40px currentColor,
            0 0 80px rgba(0, 255, 255, 1),
            0 0 120px rgba(255, 0, 255, 0.8);
    }
}

.instructions-start-btn:active {
    transform: scale(1.05) translateY(0px);
    box-shadow: 
        0 0 40px rgba(0, 255, 255, 0.7),
        0 0 80px rgba(255, 0, 255, 0.4),
        inset 0 0 30px rgba(0, 255, 255, 0.5);
}

/* ===== START SCREEN ===== */
.start-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #0a0a12 0%, #1a0a3e 100%);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9000;
    opacity: 0;
}

.cosmic-bg {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 30% 50%, rgba(0, 255, 255, 0.1), transparent 50%),
        radial-gradient(ellipse at 70% 50%, rgba(255, 0, 255, 0.1), transparent 50%);
    animation: cosmicPulse 5s ease-in-out infinite;
}

@keyframes cosmicPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.start-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.game-title {
    font-family: var(--font-display);
    font-size: 4.5rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    background: linear-gradient(135deg, var(--cyan), var(--magenta), var(--yellow));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 40px;
    line-height: 1.1;
    text-shadow: 0 0 40px rgba(0, 255, 255, 0.5);
    animation: titleGlow 2s ease-in-out infinite;
}

@keyframes titleGlow {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.5)); }
    50% { filter: drop-shadow(0 0 40px rgba(0, 255, 255, 0.8)); }
}

.stats-row {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 40px;
}

.stat-card {
    background: rgba(10, 10, 20, 0.8);
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-radius: 15px;
    padding: 20px 30px;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    min-width: 150px;
}

.stat-card:hover {
    transform: translateY(-5px);
    border-color: var(--cyan);
    box-shadow: 0 10px 30px rgba(0, 255, 255, 0.3);
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 5px;
    text-shadow: 0 0 15px var(--cyan);
}

.stat-label {
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
}

.start-btn {
    background: linear-gradient(135deg, rgba(0, 255, 255, 0.2), rgba(255, 0, 255, 0.2));
    border: 3px solid var(--cyan);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    padding: 20px 60px;
    cursor: pointer;
    border-radius: 50px;
    transition: all 0.3s;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.start-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s;
}

.start-btn:hover::before {
    transform: translateX(100%);
}

.start-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 40px var(--cyan);
}

.start-btn:active {
    transform: scale(1.05);
}

.start-btn.pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px var(--cyan);
    }
    50% {
        box-shadow: 0 0 40px var(--cyan);
    }
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--magenta);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 15px 40px;
    cursor: pointer;
    border-radius: 40px;
    transition: all 0.3s;
    margin-bottom: 30px;
}

.secondary-btn:hover {
    background: rgba(255, 0, 255, 0.2);
    box-shadow: 0 0 30px var(--magenta);
    transform: translateY(-3px);
}

.controls-guide {
    display: flex;
    flex-direction: column;
    gap: 15px;
    font-size: 1rem;
}

.control-item {
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.control-item kbd {
    background: rgba(0, 255, 255, 0.2);
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-radius: 5px;
    padding: 5px 12px;
    font-family: var(--font-display);
    color: var(--cyan);
    font-size: 0.9rem;
}

/* ===== HUD ===== */
.hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 8000;
    display: none;
    opacity: 0;
}

.hud.active {
    display: block;
    animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.hud-top {
    display: flex;
    justify-content: space-between;
    padding: 20px;
    gap: 20px;
}

.hud-item {
    background: rgba(10, 10, 20, 0.9);
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-radius: 12px;
    padding: 15px 25px;
    backdrop-filter: blur(10px);
    min-width: 120px;
}

.hud-item.center {
    flex: 1;
    text-align: center;
    max-width: 200px;
}

.hud-label {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    margin-bottom: 5px;
}

.hud-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    color: var(--cyan);
    text-shadow: 0 0 15px var(--cyan);
}

.health-display {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.health-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    transition: all 0.3s;
}

.health-bar.active {
    background: linear-gradient(90deg, var(--orange), var(--yellow));
    box-shadow: 0 0 10px var(--orange);
}

.hud-bottom {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
}

.boost-container {
    background: rgba(10, 10, 20, 0.9);
    border: 2px solid rgba(255, 255, 0, 0.4);
    border-radius: 12px;
    padding: 12px 30px;
    backdrop-filter: blur(10px);
    min-width: 250px;
}

.boost-label {
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    margin-bottom: 8px;
    text-align: center;
}

.boost-bar-bg {
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    overflow: hidden;
}

.boost-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--yellow), var(--orange));
    width: 100%;
    transition: width 0.2s;
    box-shadow: 0 0 15px var(--yellow);
}

/* ===== SCORE POPUP ===== */
#scorePopupContainer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 8500;
}

.score-popup {
    position: absolute;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 900;
    text-shadow: 0 0 20px currentColor;
    pointer-events: none;
    animation: scoreFloat 1s ease-out forwards;
}

.score-popup.positive {
    color: var(--green);
}

.score-popup.negative {
    color: var(--red);
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1.5);
    }
}

/* ===== MOBILE CONTROLS ===== */
.mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: none;
    justify-content: space-between;
    padding: 30px;
    pointer-events: auto;
    z-index: 8500;
}

.joystick-area {
    position: relative;
    width: 150px;
    height: 150px;
    background: rgba(10, 10, 20, 0.8);
    border: 2px solid rgba(0, 255, 255, 0.4);
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.joystick {
    position: absolute;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--cyan), var(--magenta));
    border: 2px solid var(--cyan);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--cyan);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.boost-btn {
    background: rgba(10, 10, 20, 0.9);
    border: 3px solid var(--yellow);
    border-radius: 20px;
    padding: 20px 35px;
    color: var(--yellow);
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    cursor: pointer;
    backdrop-filter: blur(10px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    transition: all 0.2s;
}

.boost-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 0, 0.3);
    box-shadow: 0 0 30px var(--yellow);
}

/* ===== GAME OVER ===== */
.game-over-screen {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 18, 0.98);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9500;
    backdrop-filter: blur(20px);
    opacity: 0;
}

.game-over-screen.active {
    display: flex;
    animation: fadeIn 0.4s forwards;
}

.game-over-content {
    text-align: center;
    max-width: 700px;
    padding: 40px;
}

.game-over-title {
    font-family: var(--font-display);
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 0.2em;
    color: var(--cyan);
    text-shadow: 0 0 30px var(--cyan);
    margin-bottom: 50px;
}

.final-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 40px;
}

.final-stat {
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(0, 255, 255, 0.3);
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s;
}

.final-stat:hover {
    transform: translateY(-5px);
    border-color: var(--cyan);
    box-shadow: 0 10px 30px rgba(0, 255, 255, 0.3);
}

.final-stat.main {
    border-color: var(--yellow);
    box-shadow: 0 0 20px rgba(255, 255, 0, 0.2);
}

.final-label {
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    margin-bottom: 10px;
}

.final-value {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cyan);
    text-shadow: 0 0 15px var(--cyan);
}

.game-over-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.game-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 3px solid var(--cyan);
    color: #fff;
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 18px 45px;
    cursor: pointer;
    border-radius: 40px;
    transition: all 0.3s;
}

.game-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 255, 255, 0.4);
}

.game-btn.primary {
    border-color: var(--cyan);
}

.game-btn.primary:hover {
    background: rgba(0, 255, 255, 0.2);
}

.game-btn.secondary {
    border-color: var(--magenta);
}

.game-btn.secondary:hover {
    background: rgba(255, 0, 255, 0.2);
    box-shadow: 0 15px 40px rgba(255, 0, 255, 0.4);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
    
    .instructions-content {
        padding: 30px 20px;
    }
    
    .instructions-main-title {
        font-size: clamp(2rem, 8vw, 3rem);
        gap: 15px;
        margin-bottom: 15px;
    }
    
    .instructions-subtitle {
        font-size: clamp(0.85rem, 3vw, 1rem);
        margin-bottom: 30px;
    }
    
    .instructions-cards-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 40px;
    }
    
    .instruction-card {
        padding: 25px 20px;
    }
    
    .instruction-icon-wrapper {
        width: 60px;
        height: 60px;
        font-size: 2rem;
        margin-bottom: 20px;
    }
    
    .instruction-card h3 {
        font-size: 1.4rem;
        margin-bottom: 20px;
    }
    
    .instruction-details kbd {
        padding: 10px 15px;
        font-size: 0.95rem;
        min-width: 45px;
    }
    
    .control-title {
        font-size: 1rem;
    }
    
    .control-desc {
        font-size: 0.9rem;
    }
    
    .objective-item {
        font-size: 1rem;
        padding: 10px 15px;
    }
    
    .collect-item,
    .avoid-item {
        flex-direction: column;
        text-align: center;
        padding: 20px 15px;
    }
    
    .collect-text,
    .avoid-text {
        text-align: center;
    }
    
    .particle-visual {
        width: 60px;
        height: 60px;
    }
    
    .particle-core {
        width: 30px;
        height: 30px;
    }
    
    .collect-name,
    .avoid-name {
        font-size: 1.1rem;
    }
    
    .collect-value,
    .avoid-value {
        font-size: 1.2rem;
    }
    
    .instructions-start-btn {
        font-size: 1.5rem;
        padding: 22px 60px;
        width: 100%;
        max-width: 380px;
        letter-spacing: 0.25em;
    }
    
    .game-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .start-content {
        padding: 20px;
        width: 100%;
    }
    
    .stats-row {
        flex-direction: row;
        gap: 15px;
        justify-content: center;
    }
    
    .stat-card {
        min-width: auto;
        padding: 15px 20px;
        flex: 1;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .stat-label {
        font-size: 0.7rem;
    }
    
    .start-btn {
        font-size: 1.1rem;
        padding: 15px 40px;
        width: 100%;
        max-width: 300px;
    }
    
    .secondary-btn {
        font-size: 1rem;
        padding: 12px 30px;
        width: 100%;
        max-width: 300px;
    }
    
    .controls-guide {
        font-size: 0.85rem;
    }
    
    .control-item kbd {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    .hud-top {
        padding: 10px;
        gap: 8px;
        flex-wrap: nowrap;
    }
    
    .hud-item {
        padding: 8px 12px;
        min-width: 80px;
        flex: 1;
    }
    
    .hud-item.center {
        max-width: none;
    }
    
    .hud-label {
        font-size: 0.6rem;
        margin-bottom: 3px;
    }
    
    .hud-value {
        font-size: 1.3rem;
    }
    
    .health-display {
        gap: 5px;
    }
    
    .health-bar {
        height: 6px;
    }
    
    .hud-bottom {
        bottom: 200px;
        width: calc(100% - 40px);
        left: 20px;
        transform: none;
    }
    
    .boost-container {
        min-width: auto;
        width: 100%;
        padding: 10px 20px;
    }
    
    .boost-bar-bg {
        height: 10px;
    }
    
    .game-over-title {
        font-size: 2.2rem;
        margin-bottom: 30px;
    }
    
    .game-over-content {
        padding: 20px;
        width: 100%;
    }
    
    .final-stats {
        grid-template-columns: 1fr;
        gap: 15px;
        margin-bottom: 30px;
    }
    
    .final-stat {
        padding: 20px;
    }
    
    .final-value {
        font-size: 2rem;
    }
    
    .game-over-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-btn {
        width: 100%;
        font-size: 1rem;
        padding: 15px 30px;
    }
    
    .joystick-area {
        width: 130px;
        height: 130px;
    }
    
    .joystick {
        width: 55px;
        height: 55px;
    }
    
    .boost-btn {
        padding: 18px 30px;
        font-size: 1rem;
    }
    
    .score-popup {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .instructions-content {
        padding: 20px 15px;
    }
    
    .instructions-main-title {
        font-size: 1.8rem;
        gap: 10px;
    }
    
    .instructions-subtitle {
        font-size: 0.8rem;
        margin-bottom: 25px;
    }
    
    .instructions-cards-wrapper {
        gap: 15px;
    }
    
    .instruction-card {
        padding: 20px 15px;
    }
    
    .instruction-icon-wrapper {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
    }
    
    .instruction-card h3 {
        font-size: 1.2rem;
    }
    
    .instruction-details kbd {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    
    .instructions-start-btn {
        font-size: 1.3rem;
        padding: 20px 50px;
        letter-spacing: 0.2em;
    }
    
    .hud-top {
        padding: 8px;
        gap: 5px;
    }
    
    .hud-item {
        padding: 6px 10px;
        min-width: 70px;
        border-width: 1px;
    }
    
    .hud-label {
        font-size: 0.55rem;
    }
    
    .hud-value {
        font-size: 1.1rem;
    }
    
    .health-bar {
        height: 5px;
    }
    
    .boost-container {
        padding: 8px 15px;
        border-width: 1px;
    }
    
    .boost-label {
        font-size: 0.6rem;
        margin-bottom: 6px;
    }
    
    .boost-bar-bg {
        height: 8px;
    }
    
    .game-over-title {
        font-size: 1.8rem;
    }
    
    .final-label {
        font-size: 0.75rem;
    }
    
    .final-value {
        font-size: 1.8rem;
    }
    
    .joystick-area {
        width: 110px;
        height: 110px;
    }
    
    .joystick {
        width: 50px;
        height: 50px;
    }
    
    .boost-btn {
        padding: 15px 25px;
        font-size: 0.9rem;
    }
    
    .mobile-controls {
        padding: 20px;
    }
    
    .score-popup {
        font-size: 1.2rem;
    }
}

/* Tablet landscape */
@media (min-width: 769px) and (max-width: 1024px) {
    .instructions-cards-wrapper {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
}

/* Large screens */
@media (min-width: 1400px) {
    .instructions-content {
        max-width: 1600px;
    }
    
    .instructions-cards-wrapper {
        max-width: 1400px;
    }
}

/* Small height screens (landscape mobile) */
@media (max-height: 600px) and (orientation: landscape) {
    .instructions-content {
        padding: 20px 15px;
        min-height: auto;
    }
    
    .instructions-main-title {
        font-size: 2rem;
        margin-bottom: 10px;
    }
    
    .instructions-subtitle {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }
    
    .instructions-cards-wrapper {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .instruction-card {
        padding: 15px 12px;
    }
    
    .instruction-icon-wrapper {
        width: 45px;
        height: 45px;
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .instruction-card h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    .instructions-start-btn {
        font-size: 1.2rem;
        padding: 15px 40px;
    }
}
