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

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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #FF6B6B 0%, #FFE66D 25%, #4ECDC4 50%, #556270 75%, #FF6B6B 100%);
    background-size: 400% 400%;
    animation: gradientFlow 20s ease infinite;
    color: #2C3E50;
    min-height: 100vh;
    overflow-x: hidden;
}

@keyframes gradientFlow {
    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;
    color: white;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4);
    animation: titleFloat 3s ease-in-out infinite;
}

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

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

.score, .accuracy {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.5);
}

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

.screen.hidden {
    display: none;
}

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

/* Setup Panel */
.setup-panel, .results-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 40px 30px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.8);
}

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

.subtitle {
    font-size: 1.1rem;
    margin-bottom: 30px;
    color: #556270;
}

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

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

.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.8);
    border: 3px solid #E0E0E0;
    border-radius: 20px;
    padding: 20px 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-family: 'Nunito', sans-serif;
    color: #2C3E50;
}

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

.difficulty-btn.selected {
    background: linear-gradient(135deg, #FF6B6B 0%, #FFE66D 100%);
    border-color: #FF6B6B;
    color: white;
    box-shadow: 0 0 25px rgba(255, 107, 107, 0.6);
    transform: scale(1.05);
}

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

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

.diff-desc {
    font-size: 0.85rem;
    opacity: 0.9;
    line-height: 1.3;
}

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

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

.input-group input {
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid #E0E0E0;
    border-radius: 15px;
    padding: 12px 20px;
    font-size: 1.3rem;
    color: #2C3E50;
    text-align: center;
    width: 120px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
}

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

/* Buttons */
.main-btn {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 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: 'Nunito', sans-serif;
    text-transform: uppercase;
    box-shadow: 0 6px 25px rgba(255, 107, 107, 0.5);
    margin: 10px;
}

.main-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(255, 107, 107, 0.7);
}

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

.secondary-btn {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 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: 'Nunito', sans-serif;
    box-shadow: 0 6px 25px rgba(78, 205, 196, 0.5);
    margin: 10px;
}

.secondary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 35px rgba(78, 205, 196, 0.7);
}

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

.progress-fill {
    background: linear-gradient(90deg, #FF6B6B 0%, #FFE66D 100%);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 30px;
    box-shadow: 0 0 20px rgba(255, 107, 107, 0.6);
}

.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.6);
}

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

.question {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 25px;
    color: white;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.4);
    animation: questionBob 2.5s ease-in-out infinite;
}

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

.hint-text {
    font-size: 1.1rem;
    color: white;
    background: rgba(78, 205, 196, 0.7);
    border: 2px solid rgba(78, 205, 196, 1);
    border-radius: 15px;
    padding: 15px;
    margin: 15px auto;
    max-width: 600px;
    font-weight: 600;
    display: none;
}

.hint-text.show {
    display: block;
    animation: hintSlide 0.4s ease;
}

@keyframes hintSlide {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

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

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

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

/* Answer Input */
.answers-container {
    text-align: center;
}

.text-input-wrapper {
    display: flex;
    justify-content: center;
    gap: 15px;
    max-width: 600px;
    margin: 0 auto 20px;
    flex-wrap: wrap;
}

#answer-input {
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    padding: 20px 30px;
    font-size: 2rem;
    color: #2C3E50;
    text-align: center;
    width: 280px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
}

#answer-input::placeholder {
    color: rgba(44, 62, 80, 0.4);
}

#answer-input:focus {
    outline: none;
    border-color: #FF6B6B;
    box-shadow: 0 0 25px rgba(255, 107, 107, 0.5);
}

#answer-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.submit-btn {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E53 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: 'Nunito', sans-serif;
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.5);
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(255, 107, 107, 0.7);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.next-btn {
    background: linear-gradient(135deg, #4ECDC4 0%, #44A08D 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: 'Nunito', sans-serif;
    box-shadow: 0 4px 20px rgba(78, 205, 196, 0.5);
}

.next-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 30px rgba(78, 205, 196, 0.7);
}

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

/* Help Section */
.help-section {
    margin-top: 15px;
}

.hint-btn {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 25px;
    padding: 12px 25px;
    font-size: 1rem;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
}

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

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

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

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

.stat {
    background: rgba(255, 107, 107, 0.2);
    border: 3px solid #FF6B6B;
    border-radius: 20px;
    padding: 20px;
    text-align: center;
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 900;
    color: #FF6B6B;
}

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

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

#missed-list {
    background: rgba(248, 113, 113, 0.15);
    border: 2px solid #F87171;
    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;
    color: #2C3E50;
}

.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;
    }

    .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(248, 113, 113, 0.1);
    border-radius: 10px;
}

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

#missed-list::-webkit-scrollbar-thumb:hover {
    background: rgba(248, 113, 113, 0.7);
}
