/* Python Quest - Space Game Styles */

/* Fonts */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Deep Space Theme */
    --background: hsl(240, 15%, 8%);
    --foreground: hsl(210, 100%, 95%);
    --card: hsl(240, 12%, 12%);
    --card-foreground: hsl(210, 100%, 95%);
    --border: hsl(240, 15%, 20%);

    /* Cosmic Primary - Bright Cyan */
    --primary: hsl(180, 100%, 50%);
    --primary-foreground: hsl(240, 15%, 8%);

    /* Nebula Secondary - Deep Purple */
    --secondary: hsl(260, 60%, 25%);
    --secondary-foreground: hsl(210, 100%, 95%);

    /* Asteroid Muted - Space Gray */
    --muted: hsl(240, 8%, 20%);
    --muted-foreground: hsl(210, 20%, 70%);

    /* Star Accent - Electric Blue */
    --accent: hsl(200, 100%, 60%);
    --accent-foreground: hsl(240, 15%, 8%);

    /* Laser Destructive - Hot Orange */
    --destructive: hsl(15, 100%, 60%);
    --destructive-foreground: hsl(0, 0%, 100%);

    /* Success - Plasma Green */
    --success: hsl(120, 100%, 50%);
    --success-foreground: hsl(240, 15%, 8%);

    /* Warning - Solar Yellow */
    --warning: hsl(45, 100%, 60%);
    --warning-foreground: hsl(240, 15%, 8%);

    /* Space Gradients */
    --gradient-cosmic: linear-gradient(135deg, hsl(260, 60%, 25%), hsl(240, 100%, 20%));
    --gradient-nebula: linear-gradient(45deg, hsl(180, 100%, 50%), hsl(200, 100%, 60%));
    --gradient-starfield: radial-gradient(ellipse at center, hsl(240, 20%, 15%), hsl(240, 15%, 8%));
    --gradient-explosion: radial-gradient(circle, hsl(15, 100%, 60%), hsl(30, 100%, 50%));

    /* Shadow Effects */
    --shadow-glow: 0 0 20px hsl(180, 100%, 50%, 0.5);
    --shadow-laser: 0 0 15px hsl(15, 100%, 60%, 0.7);

    /* Border Radius */
    --radius: 0.75rem;

    /* Transitions */
    --transition-cosmic: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-out;
}

body {
    font-family: 'Exo 2', sans-serif;
    background: var(--gradient-starfield);
    color: var(--foreground);
    overflow: hidden;
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-content {
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

.loading-title {
    font-family: 'Orbitron', monospace;
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 2rem;
    text-shadow: 0 0 20px var(--primary);
    animation: pulse-glow 2s ease-in-out infinite;
}

.loading-bar {
    width: 100%;
    height: 8px;
    background: var(--muted);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.loading-progress {
    height: 100%;
    background: var(--gradient-nebula);
    width: 0%;
    animation: loading-progress 3s ease-out forwards;
}

.loading-text {
    color: var(--muted-foreground);
    font-size: 1rem;
}

@keyframes loading-progress {
    to { width: 100%; }
}

/* Game Container */
.game-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Game HUD */
.game-hud {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 1rem;
    background: rgba(12, 12, 20, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.hud-content {
    max-width: 1536px;
    margin: 0 auto;
}

.stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stats-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.score-display {
    color: var(--primary);
    font-weight: bold;
    font-size: 1.25rem;
    text-shadow: 0 0 10px var(--primary);
}

.lives-display {
    color: var(--destructive);
    font-weight: bold;
    font-size: 1.25rem;
    text-shadow: 0 0 10px var(--destructive);
}

.level-display {
    color: var(--accent);
    font-weight: bold;
    font-size: 1.25rem;
    text-shadow: 0 0 10px var(--accent);
}

.stats-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-family: 'Orbitron', monospace;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.status-playing {
    background: var(--success);
    animation: pulse 2s ease-in-out infinite;
}

.status-paused {
    background: var(--warning);
}

.status-game-over {
    background: var(--destructive);
}

/* Question Panel */
.question-panel {
    background: rgba(12, 12, 20, 0.9);
    backdrop-filter: blur(16px);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid hsl(180, 100%, 50%, 0.3);
    box-shadow: var(--shadow-glow);
}

.question-content {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.question-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-foreground);
    font-weight: bold;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.question-details {
    flex: 1;
}

.question-text {
    font-size: 1.125rem;
    font-weight: bold;
    color: var(--foreground);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.option-item {
    background: rgba(60, 60, 80, 0.5);
    border-radius: var(--radius);
    padding: 0.75rem;
    border: 1px solid var(--border);
    text-align: center;
    font-family: 'Orbitron', monospace;
    font-size: 0.875rem;
}

.option-label {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-bottom: 0.25rem;
}

.option-text {
    color: var(--foreground);
    font-weight: 500;
}

.question-hint {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* Game Over Panel */
.game-over-panel {
    background: rgba(12, 12, 20, 0.9);
    backdrop-filter: blur(16px);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid hsl(15, 100%, 60%, 0.3);
    text-align: center;
}

.game-over-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--destructive);
    margin-bottom: 1rem;
}

.game-over-stats {
    space-y: 0.5rem;
}

.game-over-stats p {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.score-highlight {
    color: var(--primary);
    font-weight: bold;
    font-size: 1.25rem;
}

.level-highlight {
    color: var(--accent);
    font-weight: bold;
    font-size: 1.25rem;
}

.game-over-message {
    color: var(--muted-foreground);
    margin-top: 1rem;
}

/* Instructions */
.instructions {
    margin-top: 1rem;
    text-align: center;
}

.instructions > div {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    background: rgba(12, 12, 20, 0.5);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.instruction-item {
    white-space: nowrap;
}

.instruction-separator {
    color: var(--border);
}

/* Canvas Container */
.canvas-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    margin-top: 180px; /* Account for HUD height */
    position: relative;
}

#game-canvas {
    max-width: 100%;
    max-height: 100%;
    border: 1px solid hsl(180, 100%, 50%, 0.3);
    border-radius: var(--radius);
    box-shadow: var(--shadow-glow);
    background: var(--background);
}

/* Pause Overlay */
.pause-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.pause-content {
    text-align: center;
}

.pause-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 1rem;
}

.pause-text {
    color: var(--muted-foreground);
}

/* Controls Info */
.controls-info {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

/* Game Menu */
.game-menu {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.menu-content {
    text-align: center;
    max-width: 32rem;
    margin: 0 auto;
    padding: 2rem;
}

/* Game Title */
.game-title {
    margin-bottom: 2rem;
}

.title-main {
    font-family: 'Orbitron', monospace;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 1rem;
    animation: pulse-glow 3s ease-in-out infinite;
}

.title-subtitle {
    font-size: 1.125rem;
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
}

.title-line {
    width: 6rem;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--accent));
    margin: 0 auto;
    border-radius: 2px;
}

/* Mission Brief */
.mission-brief {
    margin-bottom: 2rem;
    space-y: 1rem;
}

.mission-card {
    background: rgba(12, 12, 20, 0.5);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid hsl(180, 100%, 50%, 0.3);
    margin-bottom: 1rem;
}

.mission-title {
    font-size: 1.25rem;
    font-weight: bold;
    color: var(--foreground);
    margin-bottom: 1rem;
}

.mission-text {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    line-height: 1.6;
}

.scoring-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    font-size: 0.875rem;
}

.scoring-item {
    background: rgba(60, 60, 80, 0.3);
    border-radius: var(--radius);
    padding: 0.75rem;
}

.scoring-label {
    font-weight: bold;
    margin-bottom: 0.25rem;
}

.scoring-correct .scoring-label {
    color: var(--success);
}

.scoring-incorrect .scoring-label {
    color: var(--destructive);
}

.scoring-points {
    color: var(--muted-foreground);
}

/* Pause Info */
.pause-info {
    margin-bottom: 2rem;
}

.pause-info-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--warning);
    margin-bottom: 1rem;
}

.pause-stats {
    background: rgba(12, 12, 20, 0.5);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid hsl(45, 100%, 60%, 0.3);
}

.pause-stats p {
    color: var(--muted-foreground);
    margin-bottom: 0.5rem;
}

/* Final Info */
.final-info {
    margin-bottom: 2rem;
}

.final-info-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--destructive);
    margin-bottom: 1rem;
}

.final-stats {
    background: rgba(12, 12, 20, 0.5);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid hsl(15, 100%, 60%, 0.3);
}

.final-stats p {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.final-line {
    width: 4rem;
    height: 2px;
    background: linear-gradient(to right, var(--destructive), var(--warning));
    margin: 1rem auto;
    border-radius: 1px;
}

.final-message {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Menu Buttons */
.menu-buttons {
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    border: none;
    font-weight: bold;
    font-size: 1.125rem;
    cursor: pointer;
    transition: var(--transition-cosmic);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-cosmic {
    background: var(--gradient-nebula);
    color: var(--primary-foreground);
    box-shadow: var(--shadow-glow);
}

.btn-cosmic:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px hsl(180, 100%, 50%, 0.8);
}

.btn-outline {
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: rgba(60, 60, 80, 0.5);
}

/* Controls Card */
.controls-card {
    background: rgba(60, 60, 80, 0.2);
    border-radius: var(--radius);
    padding: 1rem;
}

.controls-title {
    font-size: 0.875rem;
    font-weight: bold;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.controls-list {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    line-height: 1.4;
}

.controls-list div {
    margin-bottom: 0.25rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--card);
    color: var(--card-foreground);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    animation: toast-enter 0.3s ease-out;
}

.toast.toast-success {
    border-color: var(--success);
    background: rgba(0, 255, 0, 0.1);
}

.toast.toast-error {
    border-color: var(--destructive);
    background: rgba(255, 0, 0, 0.1);
}

.toast.toast-info {
    border-color: var(--accent);
    background: rgba(0, 200, 255, 0.1);
}

/* Footer */
.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(12, 12, 20, 0.5);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 0.5rem;
}

.footer-content {
    max-width: 1536px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* Animations */
@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.5; 
    }
}

@keyframes pulse-glow {
    0%, 100% { 
        text-shadow: 0 0 10px currentColor; 
    }
    50% { 
        text-shadow: 0 0 20px currentColor, 0 0 30px currentColor; 
    }
}

@keyframes toast-enter {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .stats-bar {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .stats-left {
        gap: 1rem;
    }

    .score-display,
    .lives-display,
    .level-display {
        font-size: 1rem;
    }

    .question-content {
        flex-direction: column;
        text-align: center;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .canvas-container {
        margin-top: 220px;
    }

    .scoring-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }
}

/* Explanation Overlay Styles */
.explanation-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease-in-out;
}

.explanation-content {
    background: var(--gradient-cosmic);
    border: 2px solid var(--primary);
    border-radius: 15px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    color: var(--foreground);
    box-shadow: 0 0 30px var(--primary);
    text-align: center;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: scale(0.8) translateY(-50px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.explanation-header {
    margin-bottom: 20px;
}

.explanation-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.explanation-icon.correct {
    color: var(--success);
}

.explanation-icon.incorrect {
    color: var(--destructive);
}

.explanation-header h3 {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.explanation-text {
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border-left: 4px solid var(--accent);
}

.explanation-text h4 {
    font-family: 'Orbitron', monospace;
    color: var(--accent);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.explanation-text p {
    font-size: 1.1rem;
    line-height: 1.6;
    text-align: left;
}

.explanation-footer {
    margin-top: 20px;
    color: var(--muted-foreground);
    font-style: italic;
}