/* Print-specific styles */
@media print {
    @page {
        size: A4;
        margin: 2cm;
    }
    
    .print-hide,
    .buttons,
    .settings,
    .back-button {
        display: none !important;
    }

    .instructions-wrapper {
        display: none !important;
    }

    .print-only {
        display: block !important;
    }
    
    body {
        font-size: 12pt;
    }

    .screen-only {
        display: none !important;
    }

    .score-blank {
        display: inline-block;
        min-width: 3em;
        border-bottom: 1px solid black;
        margin: 0 0.5em;
    }

    .footer-content {
        display: none !important;
    }
}

@media screen {
    .print-only {
        display: none !important;
    }

    .screen-only {
        display: inline !important;
    }

    /* Explicitly hide student info in screen mode */
    .student-info {
        display: none !important;
    }
}

/* Base styles */
body {
    font-family: Arial, sans-serif;
    max-width: 210mm;
    margin: 0 auto;
    padding: 20px;
}

.main-content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.back-button {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

.back-link {
    color: #4a90e2;
    text-decoration: none;
    font-size: 16px;
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.2s;
}

.back-link:hover {
    background-color: #f0f7ff;
}

.header h1 {
    color: #4a90e2;
    margin: 0;
    font-size: 28px;
}

.student-info {
    margin: 20px 0 30px;
    font-size: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.line {
    display: inline-block;
    border-bottom: 1px solid #999;
    margin: 0 10px;
}

.line-long {
    width: 300px;
}

.line-short {
    width: 150px;
}

.settings {
    background: #e8f4ff;
    border: 1px solid #4a90e2;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.settings-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.settings label {
    margin-right: 5px;
}

.settings input {
    width: 70px;
    padding: 5px;
    border: 1px solid #4a90e2;
    border-radius: 4px;
}

/* Problem container styles */
.problem-container {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.problem-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.fruit-group {
    font-size: 2em;
    min-width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.operator {
    font-size: 1.8em;
    color: #4a90e2;
    font-weight: bold;
}

.answer-box {
    width: 60px;
    height: 40px;
    font-size: 20px;
    text-align: center;
    border: 2px solid #4a90e2;
    border-radius: 4px;
}

.fruit-group-container {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.group-count {
    font-size: 1.5em;
    color: #4a90e2;
    font-weight: bold;
}

/* Problem states */
.problem-container.correct .answer-box {
    border-color: #4CAF50;
    background: #f0fff0;
}

.problem-container.incorrect .answer-box {
    border-color: #ff9800;
    background: #fff3e0;
}

/* Button styles */
.buttons {
    text-align: center;
    margin: 20px 0;
}

button {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    margin: 0 5px;
}

button:hover {
    background: #357abd;
}

button:disabled {
    background: #cccccc;
    cursor: not-allowed;
}

/* Score section */
.score-section {
    text-align: center;
    font-size: 18px;
    margin: 20px 0;
    color: #4a90e2;
}

/* Feedback styles */
.feedback {
    text-align: center;
    min-height: 24px;
    margin-top: 10px;
    font-weight: bold;
}

.feedback.correct {
    color: #4CAF50;
}

.feedback.incorrect {
    color: #ff9800;
}

/* Footer styles */
.footer {
    text-align: center;
    color: #666;
    margin-top: auto;
    padding: 20px 0;
}

/* Responsive styles */
@media (max-width: 600px) {
    .header {
        padding-top: 40px;
    }
    
    .back-button {
        top: 0;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .settings-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .info-row {
        flex-direction: column;
        gap: 10px;
    }

    .line-long,
    .line-short {
        width: 200px;
    }

    .fruit-group {
        font-size: 1.5em;
        min-width: 90px;
    }

    .group-count {
        font-size: 1.2em;
    }

    button {
        width: 100%;
        margin: 5px 0;
    }

    .settings button {
        width: auto;
    }
}
