/* 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;
    }
    
    .problem {
        break-inside: avoid;
    }

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

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

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

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

    .number-track-container {
        margin: 1cm 0;
        padding: 0;
        background: none;
    }

    .number-cell {
        border: 1px solid #000;
    }
}

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

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

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

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

/* Student info styles */
.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 styles */
.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;
}

/* Number track styles */
.number-track-container {
    margin: 20px 0;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
    overflow-x: auto;
}

.number-track-container h3 {
    margin: 0 0 15px 0;
    color: #4a90e2;
    text-align: center;
}

/* Number track styles */
.number-track {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.number-track-row {
    display: flex;
    gap: 2px;
    min-width: min-content;
    justify-content: center;
}

/* Example track styles */
.example-track {
    display: flex;
    gap: 2px;
    min-width: min-content;
    justify-content: center;
    flex-wrap: nowrap;
    flex-direction: row;
}

.example-track .number-cell {
    width: 35px;
    height: 35px;
    font-size: 16px;
}

.number-cell {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #4a90e2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    color: #4a90e2;
}

/* Problem styles */
.problems-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 20px 0;
}

.problem {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.problem-text {
    font-size: 18px;
}

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

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

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

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

/* 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;
    }

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

    .settings button {
        width: auto;
    }

    .number-cell {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}