/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Sans MS', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(45deg, #ff6b6b, #feca57);
    padding: 30px;
    text-align: center;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    animation: bounce 2s infinite;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Game area */
.game-area {
    padding: 40px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
    align-items: start;
}

.question-section {
    text-align: center;
    padding: 30px;
    background: #f8f9ff;
    border-radius: 15px;
    border: 3px solid #e1e5fe;
    height: fit-content;
}

.question-section h2 {
    font-size: 1.8em;
    color: #5c6bc0;
    margin-bottom: 20px;
}

.fraction-display {
    display: inline-block;
    font-size: 3em;
    font-weight: bold;
    color: #3f51b5;
    margin: 20px;
    position: relative;
}

.fraction-display .numerator {
    display: block;
    text-align: center;
    line-height: 1;
}

.fraction-line {
    display: block;
    height: 4px;
    background: #3f51b5;
    margin: 5px 0;
    border-radius: 2px;
}

.fraction-display .denominator {
    display: block;
    text-align: center;
    line-height: 1;
}

.hint {
    margin-top: 15px;
    font-size: 1.1em;
    color: #666;
    font-style: italic;
}

/* Answer section */
.answer-section {
    text-align: center;
    padding: 30px;
    background: #f0f8f0;
    border-radius: 15px;
    border: 3px solid #c8e6c9;
    height: fit-content;
}

.answer-section h3 {
    font-size: 1.6em;
    color: #4caf50;
    margin-bottom: 20px;
}

.answer-input {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.whole-number-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.whole-number-input input {
    width: 80px;
    height: 60px;
    font-size: 2em;
    text-align: center;
    border: 3px solid #4caf50;
    border-radius: 10px;
    background: #e8f5e8;
    color: #2e7d32;
    font-weight: bold;
}

.whole-number-input label {
    font-size: 1.1em;
    color: #4caf50;
    font-weight: bold;
}

.fraction-input {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.fraction-input input {
    width: 70px;
    height: 50px;
    font-size: 1.8em;
    text-align: center;
    border: 3px solid #ff9800;
    border-radius: 8px;
    background: #fff3e0;
    color: #f57c00;
    font-weight: bold;
}

.fraction-line-small {
    height: 3px;
    width: 80px;
    background: #ff9800;
    border-radius: 2px;
    margin: 2px 0;
}

.fraction-labels {
    position: absolute;
    right: -120px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 30px;
    font-size: 0.9em;
    color: #666;
    white-space: nowrap;
}

.check-button {
    background: linear-gradient(45deg, #4caf50, #8bc34a);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.3em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.check-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.check-button:active {
    transform: translateY(0);
}

.check-button.checking {
    background: linear-gradient(45deg, #ff9800, #ffb74d);
    animation: pulse 0.5s ease-in-out;
}

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

/* Feedback section */
.feedback-section {
    text-align: center;
    min-height: 80px;
    margin-bottom: 20px;
}

.feedback {
    padding: 20px;
    border-radius: 15px;
    font-size: 1.3em;
    font-weight: bold;
    margin: 10px 0;
    animation: fadeIn 0.5s ease;
}

.feedback.correct {
    background: linear-gradient(45deg, #4caf50, #8bc34a);
    color: white;
    border: 3px solid #2e7d32;
}

.feedback.incorrect {
    background: linear-gradient(45deg, #f44336, #ff7043);
    color: white;
    border: 3px solid #c62828;
}

.feedback.explanation {
    background: #e3f2fd;
    color: #1976d2;
    border: 3px solid #42a5f5;
    font-size: 1.1em;
    margin-top: 15px;
}

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

/* Controls */
.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e0e0e0;
    flex-wrap: wrap;
    gap: 20px;
}

.new-problem-button {
    background: linear-gradient(45deg, #2196f3, #64b5f6);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
    transition: all 0.3s ease;
}

.new-problem-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.4);
}

.score {
    font-size: 1.2em;
    color: #666;
    font-weight: bold;
    background: #f5f5f5;
    padding: 10px 20px;
    border-radius: 15px;
    border: 2px solid #ddd;
}

/* Help section */
.help-section {
    background: #f8f9fa;
    padding: 20px 40px;
    border-top: 3px solid #e9ecef;
}

.help-section details {
    cursor: pointer;
}

.help-section summary {
    font-size: 1.2em;
    font-weight: bold;
    color: #495057;
    padding: 10px 0;
    list-style: none;
}

.help-section summary::-webkit-details-marker {
    display: none;
}

.help-content {
    padding: 20px 0;
    border-top: 1px solid #dee2e6;
    margin-top: 10px;
}

.help-content ol {
    margin: 15px 0 15px 20px;
}

.help-content li {
    margin: 8px 0;
    font-size: 1.1em;
}

.help-content p {
    margin: 10px 0;
    font-size: 1.1em;
    color: #495057;
}

/* Input focus styles */
input:focus {
    outline: none;
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
}

/* Responsive design */
@media (max-width: 768px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .container {
        margin: 10px;
        border-radius: 15px;
    }
    
    .game-area {
        padding: 20px;
    }
    
    header {
        padding: 20px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .fraction-display {
        font-size: 2.5em;
    }
    
    .answer-input {
        flex-direction: column;
        gap: 15px;
    }
    
    .fraction-labels {
        position: static;
        transform: none;
        flex-direction: row;
        justify-content: space-between;
        width: 80px;
        margin-top: 10px;
    }
    
    .controls {
        flex-direction: column;
        text-align: center;
    }
}
