/* ===== CSS VARIABLES ===== */
:root {
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    
    --primary: #6366f1;
    --primary-light: #818cf8;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    
    --radius: 24px;
    --radius-sm: 16px;
    --gap: 16px;
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    height: 100%;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    color: var(--text-primary);
}

/* ===== ANIMATED BACKGROUND ===== */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.gradient-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s infinite ease-in-out;
}

.sphere-1 {
    width: 400px;
    height: 400px;
    background: #ff6b9d;
    top: -10%;
    left: -10%;
    animation-delay: 0s;
}

.sphere-2 {
    width: 500px;
    height: 500px;
    background: #4ecdc4;
    bottom: -20%;
    right: -10%;
    animation-delay: -7s;
}

.sphere-3 {
    width: 300px;
    height: 300px;
    background: #ffe66d;
    top: 50%;
    left: 50%;
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(50px, -50px) scale(1.1); }
    66% { transform: translate(-30px, 30px) scale(0.9); }
}

/* Particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    animation: particle-float 15s infinite linear;
}

@keyframes particle-float {
    0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

/* ===== MAIN CONTAINER ===== */
.quiz-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ===== PROGRESS BAR ===== */
.progress-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-light), var(--primary));
    border-radius: 10px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: right;
}

/* ===== GLASS CARD ===== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    gap: 24px;
    animation: card-enter 0.6s ease-out;
}

@keyframes card-enter {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== HEADER ===== */
.quiz-header {
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.icon {
    font-size: 3rem;
    margin-bottom: 12px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.quiz-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 4px;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== QUESTION ===== */
.question-section {
    text-align: center;
}

.question-number {
    display: inline-block;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.question-text {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== ANSWERS GRID ===== */
.answers-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.answer-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
    text-align: left;
}

.answer-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s;
}

.answer-btn:hover:not(.disabled) {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(8px);
    border-color: rgba(255, 255, 255, 0.3);
}

.answer-btn:hover:not(.disabled)::before {
    transform: scaleY(1);
}

.answer-btn.selected {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
    transform: translateX(8px);
}

.answer-btn.selected::before {
    transform: scaleY(1);
}

.answer-btn.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    animation: correct-pulse 0.5s ease;
}

.answer-btn.correct::before {
    background: var(--success);
    transform: scaleY(1);
}

.answer-btn.wrong {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--error);
    animation: shake 0.5s ease;
}

.answer-btn.wrong::before {
    background: var(--error);
    transform: scaleY(1);
}

.answer-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@keyframes correct-pulse {
    0%, 100% { transform: translateX(8px) scale(1); }
    50% { transform: translateX(8px) scale(1.02); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* Option Letter Badge */
.option-letter {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.answer-btn:hover .option-letter,
.answer-btn.selected .option-letter {
    background: var(--primary);
    color: white;
}

.answer-btn.correct .option-letter {
    background: var(--success);
    color: white;
}

.answer-btn.wrong .option-letter {
    background: var(--error);
    color: white;
}

/* ===== FOOTER ===== */
.quiz-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.score-display {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.score-display span {
    color: var(--success);
    font-size: 1.25rem;
}

.btn-next {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.btn-next.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-next:active {
    transform: scale(0.95);
}

/* ===== RESULT MODAL ===== */
.result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
}

.result-modal.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(30px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.result-modal.show .modal-content {
    transform: scale(1);
}

.trophy {
    font-size: 4rem;
    margin-bottom: 16px;
    animation: trophy-bounce 1s ease infinite;
}

@keyframes trophy-bounce {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.1) rotate(-10deg); }
    75% { transform: scale(1.1) rotate(10deg); }
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.final-score {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--success), var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 16px 0;
}

.score-message {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 12px;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-restart {
    width: 100%;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* ===== SOUND TOGGLE ===== */
.sound-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.3s;
    z-index: 10;
}

.sound-toggle:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.2);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .glass-card {
        padding: 24px;
    }
    
    .question-text {
        font-size: 1.1rem;
    }
    
    .answer-btn {
        padding: 14px 16px;
    }
    
    .trophy {
        font-size: 3rem;
    }
    
    .final-score {
        font-size: 2.5rem;
    }
}

@media (max-height: 700px) {
    .glass-card {
        gap: 16px;
        padding: 20px;
    }
    
    .quiz-header {
        padding-bottom: 12px;
    }
    
    .icon {
        font-size: 2rem;
        margin-bottom: 8px;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .gradient-sphere, .particle, .icon, .trophy {
        animation: none;
    }
    
    .glass-card, .btn-next, .modal-content {
        transition: none;
    }
}