@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;500;700;900&family=Roboto:wght@300;400;500;700&display=swap');

/* === GLOBAL VARIABLES === */
:root {
    --neon-pink: #ff00ff;
    --neon-cyan: #00ffff;
    --neon-yellow: #ffcc00;
    --neon-green: #00ff9d;
    --neon-red: #ff3366;
    --neon-purple: #9d00ff;
    --neon-orange: #ff6b35;
    --dark-bg: #0d0015;
    --dark-box: rgba(10, 5, 20, 0.85);
    --dark-card: rgba(18, 0, 58, 0.75);
}

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

body {
    font-family: 'Orbitron', 'Roboto', 'Arial', sans-serif;
    background: var(--dark-bg);
    color: var(--neon-cyan);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(255,0,255,0.1) 0%, transparent 25%),
        radial-gradient(circle at 90% 80%, rgba(0,255,255,0.1) 0%, transparent 30%),
        radial-gradient(circle at 50% 50%, rgba(157,0,255,0.05) 0%, transparent 50%);
    overflow-x: hidden;
}

/* === ANIMATIONS === */
@keyframes pulse-bg {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.1); }
}

@keyframes neon-glow {
    0%, 100% { 
        text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan), 
                     0 0 40px var(--neon-pink), 0 0 80px var(--neon-pink);
    }
    50% { 
        text-shadow: 0 0 20px var(--neon-cyan), 0 0 40px var(--neon-cyan), 
                     0 0 60px var(--neon-pink), 0 0 100px var(--neon-pink);
    }
}

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

@keyframes slide-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* === HEADER === */
#header {
    background: rgba(10, 5, 20, 0.95);
    border-bottom: 2px solid var(--neon-cyan);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 255, 255, 0.3);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.header-title {
    margin: 0;
    font-size: 1.8em;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px var(--neon-cyan), 0 0 40px var(--neon-pink);
    animation: neon-glow 3s infinite;
}

#header-stats {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.75em;
    color: var(--neon-yellow);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.2em;
    font-weight: bold;
    color: var(--neon-green);
    text-shadow: 0 0 10px var(--neon-green);
}

.progress-container {
    min-width: 150px;
    height: 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-cyan);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 10px rgba(0, 255, 255, 0.3);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
    transition: width 0.5s ease;
    box-shadow: 0 0 20px var(--neon-cyan);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75em;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 5px black;
    z-index: 1;
}

.btn-home {
    padding: 8px 16px;
    background: transparent;
    border: 2px solid var(--neon-yellow);
    border-radius: 8px;
    color: var(--neon-yellow);
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.4);
}

.btn-home:hover {
    background: var(--neon-yellow);
    color: #000;
    box-shadow: 0 0 20px var(--neon-yellow);
    transform: scale(1.05);
}

/* === MAIN CONTAINER === */
#main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.screen {
    display: none;
    animation: slide-in 0.5s ease;
}

.screen.active {
    display: block;
}

.content-box {
    background: var(--dark-box);
    padding: 35px;
    border-radius: 20px;
    border: 2px solid var(--neon-pink);
    box-shadow: 
        0 0 30px rgba(255, 0, 255, 0.4),
        0 0 60px rgba(0, 255, 255, 0.2),
        inset 0 0 40px rgba(255, 0, 255, 0.15);
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.content-box::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    right: -50%;
    bottom: -50%;
    background: radial-gradient(circle, rgba(0, 255, 255, 0.1) 10%, transparent 40%);
    animation: pulse-bg 12s infinite alternate;
    pointer-events: none;
    z-index: 0;
}

.content-box > * {
    position: relative;
    z-index: 1;
}

/* === TYPOGRAPHY === */
h1 {
    color: var(--neon-cyan);
    text-shadow: 
        0 0 15px var(--neon-cyan),
        0 0 30px var(--neon-cyan),
        0 0 50px var(--neon-pink);
    margin-bottom: 30px;
    font-size: 2.5em;
    letter-spacing: 3px;
    text-align: center;
    font-weight: 900;
}

h2 {
    color: var(--neon-yellow);
    text-shadow: 0 0 15px var(--neon-yellow);
    margin: 25px 0 20px;
    font-size: 1.8em;
    letter-spacing: 2px;
}

.subtitle {
    font-family: 'Roboto', sans-serif;
    font-size: 1.2em;
    color: var(--neon-cyan);
    margin-bottom: 30px;
    text-align: center;
    text-shadow: 0 0 10px var(--neon-cyan);
}

.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 3rem;
}

/* === DIFFICULTY SELECTOR === */
.difficulty-selector {
    margin: 30px 0;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.difficulty-btn {
    padding: 30px 20px;
    background: var(--dark-card);
    border: 3px solid var(--neon-cyan);
    border-radius: 20px;
    color: white;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
}

.difficulty-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s;
}

.difficulty-btn:hover::before {
    left: 100%;
}

.difficulty-btn:hover {
    transform: translateY(-8px) scale(1.03);
    box-shadow: 0 15px 40px rgba(0, 255, 255, 0.5);
    border-color: var(--neon-pink);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-cyan));
    box-shadow: 0 8px 30px rgba(255, 0, 255, 0.7);
    border-color: var(--neon-yellow);
}

.diff-icon {
    font-size: 3.5em;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px currentColor);
}

.diff-title {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 10px;
    font-family: 'Orbitron', sans-serif;
}

.diff-desc {
    font-size: 0.95em;
    opacity: 0.85;
    font-style: italic;
}

/* === MODULE GRID === */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 30px;
}

.module-card {
    background: var(--dark-card);
    padding: 30px 20px;
    border-radius: 20px;
    border: 2px solid var(--neon-cyan);
    cursor: pointer;
    transition: all 0.4s;
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
}

.module-card:hover {
    border-color: var(--neon-pink);
    box-shadow: 
        0 0 40px var(--neon-pink),
        0 0 80px rgba(255, 0, 255, 0.4),
        inset 0 0 30px rgba(255, 0, 255, 0.2);
    transform: translateY(-10px) scale(1.03);
}

.module-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 15px;
    filter: drop-shadow(0 0 10px var(--neon-yellow));
}

.module-title {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--neon-yellow);
    margin-bottom: 10px;
    text-shadow: 0 0 10px var(--neon-yellow);
}

.module-description {
    font-family: 'Roboto', sans-serif;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

/* === QUICK PLAY === */
.quick-play {
    margin-top: 50px;
}

.mode-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.mode-btn {
    padding: 25px 20px;
    background: var(--dark-card);
    border: 2px solid var(--neon-green);
    border-radius: 15px;
    color: white;
    font-family: 'Orbitron', sans-serif;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 20px rgba(0, 255, 157, 0.3);
}

.mode-btn:hover {
    background: linear-gradient(135deg, var(--neon-green), var(--neon-cyan));
    color: #000;
    border-color: var(--neon-yellow);
    box-shadow: 0 0 40px var(--neon-green);
    transform: translateY(-8px);
}

.mode-icon {
    font-size: 2.5em;
    display: block;
    margin-bottom: 10px;
}

.mode-btn div {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 5px;
}

.mode-btn small {
    font-family: 'Roboto', sans-serif;
    font-size: 0.85em;
    color: rgba(255, 255, 255, 0.7);
}

/* === BUTTONS === */
.btn-back {
    padding: 10px 20px;
    background: transparent;
    border: 2px solid var(--neon-red);
    border-radius: 10px;
    color: var(--neon-red);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 10px rgba(255, 51, 102, 0.4);
    font-family: 'Orbitron', sans-serif;
    margin-bottom: 20px;
}

.btn-back:hover {
    background: var(--neon-red);
    color: #000;
    box-shadow: 0 0 25px var(--neon-red);
    transform: scale(1.05);
}

.btn-submit {
    padding: 12px 30px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-pink));
    border: none;
    border-radius: 10px;
    color: #000;
    font-weight: bold;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 20px var(--neon-cyan);
    font-family: 'Orbitron', sans-serif;
}

.btn-submit:hover {
    box-shadow: 0 0 40px var(--neon-cyan), 0 0 60px var(--neon-pink);
    transform: scale(1.08);
}

.control-btn {
    padding: 10px 20px;
    background: var(--dark-card);
    border: 2px solid var(--neon-yellow);
    border-radius: 10px;
    color: var(--neon-yellow);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.3);
    font-family: 'Orbitron', sans-serif;
}

.control-btn:hover {
    background: var(--neon-yellow);
    color: #000;
    box-shadow: 0 0 25px var(--neon-yellow);
    transform: translateY(-3px);
}

/* === DASHBOARD === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat-card {
    background: var(--dark-card);
    padding: 25px;
    border-radius: 15px;
    border: 2px solid var(--neon-cyan);
    text-align: center;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
    transition: all 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.6);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: var(--neon-pink);
    text-shadow: 0 0 20px var(--neon-pink);
    margin-bottom: 10px;
}

.stat-label {
    font-family: 'Roboto', sans-serif;
    color: var(--neon-cyan);
    font-size: 1em;
}

/* === ACHIEVEMENTS === */
.achievements-showcase {
    margin-top: 40px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.achievement-item {
    background: var(--dark-card);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid var(--neon-purple);
    text-align: center;
    transition: all 0.3s;
    box-shadow: 0 0 15px rgba(157, 0, 255, 0.3);
}

.achievement-item:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px var(--neon-purple);
}

.achievement-item.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

/* === GAME SCREEN === */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.game-info {
    font-size: 1.2em;
    color: var(--neon-yellow);
}

.separator {
    margin: 0 10px;
    color: var(--neon-cyan);
}

.game-hud {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    border: 2px solid var(--neon-cyan);
}

.hud-item {
    text-align: center;
}

.hud-label {
    display: block;
    font-size: 0.85em;
    color: var(--neon-yellow);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hud-value {
    display: block;
    font-size: 1.5em;
    font-weight: bold;
    color: var(--neon-green);
    text-shadow: 0 0 15px var(--neon-green);
}

/* === QUESTION AREA === */
.question-container {
    margin: 30px 0;
    padding: 30px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    border: 2px solid var(--neon-pink);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.question-text {
    font-size: 1.8em;
    font-weight: bold;
    color: white;
    text-align: center;
    margin-bottom: 20px;
    text-shadow: 0 0 15px var(--neon-cyan);
}

.question-visual {
    margin-top: 20px;
    min-height: 100px;
}

/* === ANSWER SECTION === */
.answer-section {
    margin: 25px 0;
}

#answer-form {
    display: flex;
    gap: 15px;
    justify-content: center;
    align-items: center;
}

.answer-input {
    flex: 1;
    max-width: 400px;
    padding: 15px 20px;
    font-size: 1.2em;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-cyan);
    border-radius: 12px;
    color: white;
    font-family: 'Orbitron', sans-serif;
    box-shadow: inset 0 0 15px rgba(0, 255, 255, 0.2);
}

.answer-input:focus {
    outline: none;
    border-color: var(--neon-pink);
    box-shadow: 0 0 25px var(--neon-pink), inset 0 0 20px rgba(255, 0, 255, 0.3);
}

.choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.choice-btn {
    padding: 15px;
    background: var(--dark-card);
    border: 2px solid var(--neon-purple);
    border-radius: 12px;
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Orbitron', sans-serif;
}

.choice-btn:hover {
    background: var(--neon-purple);
    color: #000;
    box-shadow: 0 0 25px var(--neon-purple);
    transform: scale(1.05);
}

.choice-btn.correct {
    background: var(--neon-green);
    border-color: var(--neon-green);
    color: #000;
    box-shadow: 0 0 30px var(--neon-green);
}

.choice-btn.wrong {
    background: var(--neon-red);
    border-color: var(--neon-red);
    opacity: 0.5;
}

/* === FEEDBACK === */
.feedback-container {
    margin: 25px 0;
    padding: 20px;
    border-radius: 12px;
    min-height: 60px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

.feedback-container.correct {
    background: rgba(0, 255, 157, 0.2);
    border: 2px solid var(--neon-green);
    color: var(--neon-green);
}

.feedback-container.incorrect {
    background: rgba(255, 51, 102, 0.2);
    border: 2px solid var(--neon-red);
    color: var(--neon-red);
}

/* === PROGRESS BAR === */
.progress-bar-container {
    height: 12px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-cyan);
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
}

#question-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
    transition: width 0.5s ease;
    box-shadow: 0 0 15px var(--neon-cyan);
}

/* === GAME CONTROLS === */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 25px;
}

/* === SOLUTION EXPLANATION === */
.solution-explanation {
    margin-top: 30px;
    padding: 25px;
    background: rgba(157, 0, 255, 0.1);
    border: 2px solid var(--neon-purple);
    border-radius: 15px;
}

.solution-explanation h3 {
    color: var(--neon-purple);
    margin-bottom: 15px;
}

/* === POPUPS === */
.achievement-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: linear-gradient(135deg, var(--neon-purple), var(--neon-pink));
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 0 60px rgba(255, 0, 255, 0.8);
    z-index: 2000;
    opacity: 0;
    transition: all 0.5s;
}

.achievement-popup:not(.hidden) {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.achievement-content {
    text-align: center;
    color: #000;
}

.achievement-icon {
    font-size: 4em;
    margin-bottom: 15px;
}

.achievement-title {
    font-size: 1.8em;
    font-weight: bold;
    margin-bottom: 10px;
}

.achievement-desc {
    font-family: 'Roboto', sans-serif;
    font-size: 1.1em;
}

/* === LEVEL UP === */
.level-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.5s;
}

.level-up-overlay:not(.hidden) {
    opacity: 1;
}

.level-up-content {
    text-align: center;
    animation: float 2s ease-in-out infinite;
}

.level-up-content h2 {
    font-size: 3em;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink), var(--neon-yellow));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.new-level {
    font-size: 4em;
    font-weight: bold;
    color: var(--neon-green);
    text-shadow: 0 0 40px var(--neon-green);
    margin-bottom: 20px;
}

/* === UTILITY === */
.hidden {
    display: none !important;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .module-grid {
        grid-template-columns: 1fr;
    }
    
    .grade-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
    
    h1 {
        font-size: 2em;
    }
    
    .question-text {
        font-size: 1.4em;
    }
    
    .content-box {
        padding: 20px;
    }
}

/* === RESPONSIVE IMPROVEMENTS FOR ZOOM / SMALLER VIEWPORTS === */
/* Use a fluid root font-size so elements scale more gracefully with zoom */
html {
    font-size: clamp(14px, 1.2vw + 12px, 18px);
}

/* Make main container padding and content-box padding adapt */
#main-container {
    padding: clamp(12px, 2vw, 24px);
}

.content-box {
    padding: clamp(18px, 2.5vw, 35px);
}

/* Slightly reduce large headings when viewport is smaller */
h1 {
    font-size: clamp(1.6em, 3.2vw, 2.5em);
}

/* Reduce spacing/padding for dense displays */
.difficulty-btn, .mode-btn, .module-card {
    padding: clamp(12px, 1.2vw, 30px);
}

/* Ensure question container stays visible and scrolls if needed */
.question-container {
    min-height: 120px;
    max-height: 60vh;
    overflow: auto;
}

/* Very small screens or heavy zoom: make grids stack and compress gaps */
@media (max-width: 1100px) {
    .difficulty-grid, .module-grid, .mode-buttons {
        gap: 12px;
    }
    .header-title { font-size: 1.4em; }
}

