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

body {
    font-family: 'Courier New', monospace;
    background-color: #f8f9fa;
    color: #2c3e50;

    min-height: 100vh;
    font-size: 1.3rem;
    line-height: 1.5;
    overflow: hidden;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    margin-bottom: 2rem;
}

.user-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    font-weight: 500;
    color: #666;
}

.elo-rating, .streak {
    font-size: 0.9rem;
}

.elo-rating span {
    transition: color 0.3s ease;
}

.question-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.question-card {
    background: white;
    border-radius: 12px;
    padding: 3rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
    width: 100%;
    max-width: 600px;
    position: relative;
    transition: transform 0.8s ease-in, opacity 0.8s ease-in;
}

.question-card.falling {
    transform-origin: top left;
    animation: fall-rotate 0.8s ease-in forwards;
    z-index: 10;
}

@keyframes fall-rotate {
    0% {
        transform: rotate(0deg) translateY(0);
    }
    30% {
        transform: rotate(30deg) translateY(0);
    }
    40% {
        transform: rotate(32deg) translateY(0);
        opacity: 1;
    }
    100% {
        transform: rotate(0deg) translateY(100vh);
        opacity: 0;
    }
}

.question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 2rem;
    font-size: 0.85rem;
    color: #666;
    font-weight: 500;
}

.question-content {
    margin-bottom: 2rem;
}

#question-text, #duplicate_question-text {
    text-align: center;
    white-space: pre-line;
}

#question-text .equation, #duplicate_question-text .equation {
    display: inline-block;
    text-align: center;
    min-width: 400px;
}

#question-text .equation-left, #duplicate_question-text .equation-left {
    display: inline-block;
    text-align: right;
    min-width: 180px;
}

#question-text .equation-right, #duplicate_question-text .equation-right {
    display: inline-block;
    text-align: left;
    min-width: 180px;
}

#question-intro, #duplicate_question-intro {
    margin-bottom: 1rem;
    text-align: left;
}

.expanding-line {
    line-height: 1.5;
    font-size: 1.3rem;
}

.answer-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.answer-input-group {
    display: flex;
    align-items: center;
    justify-content: center;

}

#answer-pretext, #duplicate_answer-pretext {
    text-align: right;
    min-width: 180px;
}



#answer-input, #duplicate_answer-input {
    padding: 0rem;
    border: 0;
    border-bottom: 2px dotted #2c3e50;
    width: 180px;
    text-align: left;
    height: 1.5em;
    line-height: 1.5;
    font-size: 1.3rem;
    font-family: 'Courier New', monospace;
    color: #2c3e50;
    background: transparent;
    transform: translateY(2px);
}

#answer-input:focus, #duplicate_answer-input:focus {
    outline: none;
    border-bottom: 2px dotted #2c3e50;
    box-shadow: none;
}



.button-group {
    display: flex;
    gap: 10rem;
    justify-content: center;
    margin-top: 1rem;
}

.primary-btn, .secondary-btn {
    border: none;
    background: none;
    font-size: 1.3rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0.5rem 1rem;
}

.primary-btn {
    color: #2c3e50;
    border-bottom: 2px solid #2c3e50;
    font-weight: bold;
}

.primary-btn:hover {
    background-color: #2c3e50;
    color: #f8f9fa;
}

.primary-btn:disabled {
    color: #bdc3c7;
    border-bottom-color: #bdc3c7;
    cursor: not-allowed;
}

.secondary-btn {
    color: #666;
    border-bottom: 1px dotted #666;
}

.secondary-btn:hover {
    color: #2c3e50;
    border-bottom-color: #2c3e50;
}

.feedback, #duplicate_feedback {
    position: absolute;
    top: -80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 1rem;
    border-radius: 6px;
    text-align: center;
    font-weight: 500;
    font-size: 1.3rem;
    font-family: 'Courier New', monospace;
    z-index: 10;
}

.feedback.correct, #duplicate_feedback.correct {
    background-color: #d5f4e6;
    color: #27ae60;
}

.feedback.incorrect, #duplicate_feedback.incorrect {
    background-color: #fbeaea;
    color: #e74c3c;
}

.hidden {
    display: none !important;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header h3 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    text-align: center;
}

.breakdown-steps {
    margin-bottom: 2rem;
}

.breakdown-step {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 6px;
}

.breakdown-step h4 {
    margin-bottom: 0.5rem;
    color: #3498db;
}

.breakdown-step p {
    color: #666;
    margin-bottom: 0.5rem;
}

.breakdown-answer {
    font-weight: 500;
    color: #2c3e50;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .question-card {
        padding: 2rem 1.5rem;
        max-width: 95vw;
    }
    
    .user-stats {
        gap: 1rem;
        font-size: 0.9rem;
    }
    
    .button-group {
        gap: 5rem;
        margin-top: 1.5rem;
    }
    
    #question-text .equation {
        min-width: 300px;
    }
    
    #question-text .equation-left,
    #question-text .equation-right {
        min-width: 140px;
    }
    
    .answer-input-group {
        margin-left: -30px;
    }
    
    #answer-input {
        width: 140px;
        min-height: 36px;
        font-size: 1.1rem;
    }
    
    #answer-pretext {
        min-width: 140px;
    }
    
    .primary-btn, .secondary-btn {
        font-size: 1.1rem;
        padding: 0.6rem 1rem;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .feedback {
        font-size: 1.1rem;
        top: -60px;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 1.1rem;
    }
    
    .question-card {
        padding: 1.5rem 1rem;
    }
    
    #question-text .equation {
        min-width: 250px;
    }
    
    #question-text .equation-left,
    #question-text .equation-right {
        min-width: 110px;
    }
    
    .answer-input-group {
        margin-left: -20px;
    }
    
    #answer-input {
        width: 110px;
        min-height: 36px;
        font-size: 1rem;
    }
    
    #answer-pretext {
        min-width: 110px;
    }
    
    .button-group {
        gap: 3rem;
    }
    
    .primary-btn, .secondary-btn {
        font-size: 1rem;
        padding: 0.6rem 1rem;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .feedback {
        font-size: 1rem;
        top: -50px;
        padding: 0.8rem;
    }
    
    .user-stats {
        font-size: 0.8rem;
    }
}