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

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: #ffffff;
    min-height: 100vh;
    overflow-x: hidden;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.game-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
}

.game-title {
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 20px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    animation: titleBounce 2s ease-in-out infinite;
}

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

.score-display {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.score, .accuracy {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* Screens */
.screen {
    display: block;
    animation: fadeIn 0.5s ease;
}

.screen.hidden {
    display: none;
}

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

/* Setup Panel */
.setup-panel, .results-panel {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.setup-panel h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 800;
}

.subtitle {
    font-size: 1.1rem;
    margin-bottom: 30px;
    opacity: 0.9;
}

/* Difficulty Selector */
.difficulty-selector {
    margin: 30px 0;
}

.difficulty-selector h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.difficulty-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid transparent;
    border-radius: 20px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
    color: white;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.difficulty-btn.selected {
    background: rgba(255, 255, 255, 0.4);
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    transform: scale(1.05);
}

.diff-emoji {
    font-size: 2.5rem;
}

.diff-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.diff-desc {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Input Group */
.input-group {
    margin: 25px 0;
}

.input-group label {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.input-group input {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 15px;
    padding: 12px 20px;
    font-size: 1.3rem;
    color: white;
    text-align: center;
    width: 120px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.input-group input:focus {
    outline: none;
    border-color: #FFD700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

/* Buttons */
.main-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 50px;
    padding: 18px 40px;
    font-size: 1.4rem;
    font-weight: 800;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    text-transform: uppercase;
    box-shadow: 0 6px 25px rgba(245, 87, 108, 0.4);
    margin: 10px;
}

.main-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(245, 87, 108, 0.6);
}

.main-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.secondary-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 50px;
    padding: 18px 40px;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 6px 25px rgba(79, 172, 254, 0.4);
    margin: 10px;
}

.secondary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(79, 172, 254, 0.6);
}

/* Progress Bar */
.progress-bar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    height: 50px;
    position: relative;
    margin-bottom: 30px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.progress-fill {
    background: linear-gradient(90deg, #f093fb 0%, #f5576c 100%);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 30px;
    box-shadow: 0 0 20px rgba(245, 87, 108, 0.5);
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Question Panel */
.question-panel {
    text-align: center;
    margin: 40px 0;
}

.question {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 25px;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    animation: questionPulse 2s ease-in-out infinite;
}

@keyframes questionPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.feedback {
    font-size: 1.5rem;
    font-weight: 700;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    border-radius: 20px;
    padding: 15px;
    transition: all 0.3s ease;
    white-space: pre-line;
    text-align: center;
}

.feedback.correct {
    background: rgba(52, 211, 153, 0.3);
    border: 3px solid #34D399;
    color: #D1FAE5;
    animation: correctBounce 0.6s ease;
}

.feedback.incorrect {
    background: rgba(248, 113, 113, 0.3);
    border: 3px solid #F87171;
    color: #FEE2E2;
    animation: incorrectShake 0.6s ease;
}

@keyframes correctBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Answer Mode Toggle */
.answer-mode-toggle {
    text-align: center;
    margin-bottom: 20px;
}

.mode-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 30px;
    padding: 10px 25px;
    font-size: 1rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

/* Answers Grid (Multiple Choice) */
.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 700px;
    margin: 0 auto;
}

.answer-btn {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 30px 20px;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.answer-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.answer-btn.correct {
    background: rgba(52, 211, 153, 0.4);
    border-color: #34D399;
    box-shadow: 0 0 30px rgba(52, 211, 153, 0.6);
}

.answer-btn.incorrect {
    background: rgba(248, 113, 113, 0.4);
    border-color: #F87171;
    animation: incorrectShake 0.6s ease;
}

/* Text Input Mode */
.text-input-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
    flex-wrap: wrap;
}

#answer-input {
    background: rgba(255, 255, 255, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 20px;
    padding: 20px 30px;
    font-size: 2rem;
    color: white;
    text-align: center;
    width: 250px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
}

#answer-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#answer-input:focus {
    outline: none;
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.submit-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 20px;
    padding: 20px 35px;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 4px 20px rgba(245, 87, 108, 0.4);
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(245, 87, 108, 0.6);
}

.next-btn {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    border: none;
    border-radius: 20px;
    padding: 20px 35px;
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 4px 20px rgba(79, 172, 254, 0.4);
}

.next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(79, 172, 254, 0.6);
}

.next-btn.hidden {
    display: none;
}

/* Results Panel */
.results-panel h2 {
    font-size: 2.2rem;
    margin-bottom: 30px;
    font-weight: 800;
}

.final-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.stat {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 1rem;
    margin-bottom: 10px;
    opacity: 0.9;
    font-weight: 600;
}

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* Missed Problems */
.missed-section {
    margin: 30px 0;
}

.missed-section h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    font-weight: 700;
}

#missed-list {
    background: rgba(0, 0, 0, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    max-height: 250px;
    overflow-y: auto;
    text-align: left;
}

.missed-problem {
    background: rgba(248, 113, 113, 0.3);
    border-left: 4px solid #F87171;
    padding: 12px;
    margin: 8px 0;
    border-radius: 8px;
    font-size: 1.1rem;
}

.results-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 1.8rem;
    }

    .question {
        font-size: 2.5rem;
    }

    .answers-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .difficulty-buttons {
        grid-template-columns: 1fr;
    }

    .text-input-wrapper {
        flex-direction: column;
        align-items: center;
    }

    #answer-input {
        width: 100%;
        max-width: 300px;
    }

    .main-btn, .secondary-btn {
        font-size: 1.1rem;
        padding: 15px 30px;
    }
}

/* Custom Scrollbar */
#missed-list::-webkit-scrollbar {
    width: 8px;
}

#missed-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

#missed-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

#missed-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}
