/* Space Battle Quiz CSS with enhanced elemental theme support */

:root {
    /* Space theme colors */
    --space-black: #0a0e17;
    --space-blue: #1a2b47;
    --space-purple: #6b46c1;
    --neon-blue: #00b4d8;
    --neon-green: #00f5d4;
    --neon-pink: #ff0a78;
    --star-color: #ffffff;
    
    /* Elemental theme colors */
    --elemental-orange: #ff4500;
    --elemental-purple: #9932cc;
    --elemental-dark: #111111;
    --elemental-darker: #0a0a0a;
    --elemental-dark-purple: #3a1145;
    
    /* Elemental game colors */
    --fire-color: #ff5722;
    --water-color: #2196f3;
    --earth-color: #795548;
    --air-color: #90caf9;
    --boss-color: #9c27b0;
    --magic-gold: #ffd700;
    --magic-violet: #8a2be2;
    --convergence-color: #ff6f6f;
}

/* Main container */
.sbq-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 5;
}

/* Theme-specific container styles */
.sbq-theme-space {
    font-family: 'Orbitron', sans-serif;
}

.sbq-theme-elemental {
    font-family: 'Roboto', 'Segoe UI', sans-serif;
}

/* Star background */
.sbq-stars {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -999 !important; /* Pushed way back */
    pointer-events: none !important;
}

.sbq-star {
    position: absolute;
    background-color: var(--star-color);
    border-radius: 50%;
    animation: sbq-twinkle 4s infinite;
    pointer-events: none !important;
}

@keyframes sbq-twinkle {
    0% { opacity: 0.2; }
    50% { opacity: 1; }
    100% { opacity: 0.2; }
}

/* Elemental particles */
.sbq-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: -998; /* Behind content, above stars */
}

.sbq-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: sbq-particle-float 10s linear infinite;
}

@keyframes sbq-particle-float {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) translateX(var(--drift-x));
        opacity: 0;
    }
}

.sbq-particle-fire {
    background-color: var(--fire-color);
    box-shadow: 0 0 8px var(--fire-color);
}

.sbq-particle-water {
    background-color: var(--water-color);
    box-shadow: 0 0 8px var(--water-color);
}

.sbq-particle-earth {
    background-color: var(--earth-color);
    box-shadow: 0 0 8px var(--earth-color);
}

.sbq-particle-air {
    background-color: var(--air-color);
    box-shadow: 0 0 8px var(--air-color);
}

/* Header styling */
.sbq-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 10;
}

.sbq-title {
    font-size: 3rem;
    margin: 0;
    background: linear-gradient(to right, var(--neon-blue), var(--neon-green), var(--neon-pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(0, 245, 212, 0.5);
    animation: sbq-title-glow 4s infinite;
    pointer-events: none;
}

/* Elemental theme title */
.sbq-theme-elemental .sbq-title {
    background: linear-gradient(to right, var(--elemental-orange), var(--elemental-purple));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 10px rgba(255, 69, 0, 0.5);
    animation: sbq-elemental-title-glow 4s infinite;
}

@keyframes sbq-title-glow {
    0% { text-shadow: 0 0 10px rgba(0, 245, 212, 0.5); }
    50% { text-shadow: 0 0 20px rgba(0, 245, 212, 0.8); }
    100% { text-shadow: 0 0 10px rgba(0, 245, 212, 0.5); }
}

@keyframes sbq-elemental-title-glow {
    0% { text-shadow: 0 0 10px rgba(255, 69, 0, 0.5); }
    50% { text-shadow: 0 0 20px rgba(255, 69, 0, 0.8); }
    100% { text-shadow: 0 0 10px rgba(255, 69, 0, 0.5); }
}

/* Game switcher */
.sbq-game-switcher {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 15px;
    position: relative;
    z-index: 100 !important; /* Very high z-index for absolute priority */
}

.sbq-game-option {
    cursor: pointer !important;
    padding: 15px 25px;
    border-radius: 15px;
    text-align: center;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    background: var(--space-blue);
    color: white;
    position: relative;
    z-index: 100 !important; /* Very high z-index */
    pointer-events: auto !important;
}

/* Ensure child elements don't capture clicks */
.sbq-game-option *, .sbq-difficulty-option *, .sbq-quiz-option * {
    pointer-events: none !important;
}

/* Space theme active styles */
.sbq-game-option.active {
    border-color: var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green);
}

/* More specific selector for elemental theme */
.sbq-theme-elemental .sbq-game-option.sbq-game-space.active {
    border-color: var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green);
}

.sbq-theme-elemental .sbq-game-option.sbq-game-elemental.active {
    border-color: var(--elemental-orange);
    box-shadow: 0 0 15px var(--elemental-orange);
}

/* Elemental theme game options */
.sbq-theme-elemental .sbq-game-option {
    background: rgba(17, 17, 17, 0.8);
    border: 2px solid var(--elemental-dark-purple);
}

.sbq-game-icon {
    display: block;
    font-size: 1.8rem;
    margin-bottom: 5px;
    pointer-events: none;
}

/* Content area */
.sbq-content {
    background: rgba(26, 43, 71, 0.7);
    backdrop-filter: blur(5px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 0 20px rgba(0, 180, 216, 0.5);
    position: relative;
    overflow: visible;
    margin-bottom: 40px;
    color: #fff;
    z-index: 10;
}

/* Elemental theme content area */
.sbq-theme-elemental .sbq-content {
    background: rgba(17, 17, 17, 0.7);
    box-shadow: 0 0 20px rgba(255, 69, 0, 0.3);
}

.sbq-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, var(--neon-blue), var(--neon-green));
    animation: sbq-scan-line 2s linear infinite;
    pointer-events: none;
    z-index: 1;
}

/* Elemental theme scan line */
.sbq-theme-elemental .sbq-content::before {
    background: linear-gradient(to right, var(--elemental-orange), var(--elemental-purple));
}

@keyframes sbq-scan-line {
    0% { top: 0; }
    100% { top: 100%; }
}

.sbq-intro-text {
    margin-bottom: 30px;
    line-height: 1.6;
    position: relative;
    z-index: 5;
    pointer-events: none;
}

.sbq-intro-text p {
    pointer-events: none;
}

/* Difficulty selection */
.sbq-difficulty-selection {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    gap: 15px;
    position: relative;
    z-index: 90 !important; /* Very high z-index */
}

.sbq-difficulty-option {
    cursor: pointer !important;
    padding: 12px 20px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--space-blue);
    border: 2px solid var(--neon-blue);
    color: white;
    position: relative;
    z-index: 90 !important; /* Very high z-index */
    pointer-events: auto !important;
}

/* Space theme active difficulty */
.sbq-difficulty-option.active {
    border-color: var(--neon-green);
    box-shadow: 0 0 15px var(--neon-green);
}

/* Elemental theme difficulty options */
.sbq-theme-elemental .sbq-difficulty-option {
    background: rgba(17, 17, 17, 0.8);
    border: 2px solid var(--elemental-dark-purple);
}

/* Elemental theme active difficulty */
.sbq-theme-elemental .sbq-difficulty-option.active {
    border-color: var(--elemental-orange);
    box-shadow: 0 0 15px var(--elemental-orange);
}

.sbq-difficulty-label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--neon-green);
    pointer-events: none;
}

/* Elemental theme difficulty label */
.sbq-theme-elemental .sbq-difficulty-label {
    color: var(--elemental-orange);
}

/* Quiz selection grid */
.sbq-quiz-selection {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    position: relative;
    z-index: 80 !important; /* High z-index */
}

.sbq-quiz-option {
    background: var(--space-blue);
    border: 2px solid var(--neon-blue);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer !important;
    position: relative;
    overflow: hidden;
    z-index: 80 !important; /* High z-index */
    pointer-events: auto !important;
}

/* Elemental theme quiz options */
.sbq-theme-elemental .sbq-quiz-option {
    background: rgba(17, 17, 17, 0.8);
    border: 2px solid var(--elemental-dark-purple);
}

.sbq-quiz-option:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px var(--neon-blue);
}

.sbq-theme-elemental .sbq-quiz-option:hover {
    box-shadow: 0 0 20px var(--elemental-purple);
}

/* Space theme selected quiz option */
.sbq-quiz-option.selected {
    border-color: var(--neon-green);
    box-shadow: 0 0 20px var(--neon-green);
}

/* Elemental theme selected quiz option */
.sbq-theme-elemental .sbq-quiz-option.selected {
    border-color: var(--elemental-orange) !important;
    box-shadow: 0 0 20px var(--elemental-orange) !important;
}

.sbq-quiz-option h3 {
    margin-top: 0;
    color: var(--neon-green);
    position: relative;
    z-index: 2;
    pointer-events: none;
}

/* Elemental theme quiz option heading */
.sbq-theme-elemental .sbq-quiz-option h3 {
    color: var(--elemental-orange);
}

.sbq-quiz-option p {
    margin-bottom: 0;
    font-size: 0.9rem;
    position: relative;
    z-index: 2;
    pointer-events: none;
}

.sbq-quiz-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--neon-pink);
    position: relative;
    z-index: 2;
    pointer-events: none;
}

/* Elemental theme quiz icon */
.sbq-theme-elemental .sbq-quiz-icon {
    color: var(--elemental-purple);
}

/* Buttons */
.sbq-action-buttons {
    display: flex;
    justify-content: center;
    margin-top: 40px;
    gap: 20px;
    position: relative;
    z-index: 85 !important; /* High z-index */
}

.sbq-start-button, .sbq-clear-button {
    background: linear-gradient(to right, var(--neon-blue), var(--neon-green));
    border: none;
    color: var(--space-black);
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 50px;
    cursor: pointer !important;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    z-index: 85 !important; /* High z-index */
    text-decoration: none;
    display: inline-block;
    pointer-events: auto !important;
}

/* Elemental theme start button */
.sbq-theme-elemental .sbq-start-button {
    background: linear-gradient(to right, var(--elemental-orange), var(--elemental-purple));
    box-shadow: 0 0 15px rgba(255, 69, 0, 0.3);
}

.sbq-start-button::before, .sbq-clear-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, var(--neon-green), var(--neon-pink));
    transition: all 0.4s ease;
    z-index: -1;
    pointer-events: none;
}

/* Elemental theme button hover effect */
.sbq-theme-elemental .sbq-start-button::before {
    background: linear-gradient(to right, var(--elemental-purple), var(--elemental-orange));
}

.sbq-start-button:hover::before, .sbq-clear-button:hover::before {
    left: 0;
}

.sbq-start-button:hover, .sbq-clear-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.sbq-clear-button {
    background: linear-gradient(to right, var(--neon-pink), var(--space-purple));
}

/* Elemental theme clear button */
.sbq-theme-elemental .sbq-clear-button {
    background: linear-gradient(to right, var(--elemental-purple), var(--boss-color));
    box-shadow: 0 0 15px rgba(156, 39, 176, 0.3);
}

/* Aliens */
.sbq-aliens {
    position: absolute;
    width: 80px;
    height: auto;
    z-index: -10 !important; /* Far behind to prevent blocking clicks */
    animation: sbq-alien-float 10s infinite ease-in-out;
    pointer-events: none !important;
}

.sbq-alien1 {
    top: 70%;
    right: 5%;
    animation-delay: 0s;
}

.sbq-alien2 {
    bottom: 15%;
    left: 7%;
    animation-delay: 2s;
}

.sbq-alien3 {
    top: 40%;
    left: 5%;
    animation-delay: 4s;
}

/* Elemental orbs */
.sbq-elemental {
    position: absolute;
    width: 60px;
    height: auto;
    z-index: -10 !important;
    animation: sbq-elemental-float 8s infinite ease-in-out;
    pointer-events: none !important;
    display: none; /* Hidden by default */
}

.sbq-theme-elemental .sbq-elemental {
    display: block; /* Show in elemental theme */
}

.sbq-theme-elemental .sbq-aliens {
    display: none; /* Hide aliens in elemental theme */
}

.sbq-fire {
    top: 60%;
    right: 5%;
    animation-delay: 0s;
}

.sbq-water {
    bottom: 20%;
    left: 7%;
    animation-delay: 1s;
}

.sbq-earth {
    top: 30%;
    left: 5%;
    animation-delay: 2s;
}

.sbq-air {
    top: 50%;
    right: 15%;
    animation-delay: 3s;
}

@keyframes sbq-alien-float {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(20px) rotate(5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

@keyframes sbq-elemental-float {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(15px) scale(1.1); }
    100% { transform: translateY(0) scale(1); }
}

/* Laser effect */
.sbq-laser {
    position: absolute;
    height: 2px;
    background: var(--neon-green);
    transform-origin: 0 0;
    z-index: 50 !important; /* Above content but below interactive elements */
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none !important;
}

/* Elemental theme laser */
.sbq-theme-elemental .sbq-laser {
    background: linear-gradient(to right, var(--elemental-orange), var(--elemental-purple));
    height: 3px;
    box-shadow: 0 0 8px var(--elemental-orange);
}

/* Fix for absolutely positioned elements overlapping clickable elements */
p:not([class]), h1:not([class]), h2:not([class]), h3:not([class]), h4:not([class]), h5:not([class]), h6:not([class]) {
    position: relative;
    z-index: 3;
}

/* Fix all pointer events to ensure clickability */
.sbq-game-option,
.sbq-difficulty-option,
.sbq-quiz-option,
#sbq-start-button,
#sbq-clear-button {
    pointer-events: auto !important;
    cursor: pointer !important;
    z-index: 1000 !important; /* Extremely high z-index to ensure they're on top */
}

/* Important override to prevent any child elements from capturing clicks */
.sbq-game-option *,
.sbq-difficulty-option *,
.sbq-quiz-option * {
    pointer-events: none !important;
}

/* Special handling for body background in elemental theme */
body.sbq-theme-elemental {
    background-color: var(--elemental-dark) !important;
    background-image: linear-gradient(135deg, var(--elemental-dark) 0%, var(--elemental-darker) 100%) !important;
}

/* Responsive styles */
@media (max-width: 768px) {
    .sbq-title {
        font-size: 2rem;
    }
    
    .sbq-quiz-selection {
        grid-template-columns: 1fr;
    }
    
    .sbq-action-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .sbq-game-switcher, .sbq-difficulty-selection {
        flex-direction: column;
        align-items: center;
    }
}