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

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

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

/* Instructions styles */
.instructions {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
}

.instructions-header {
    padding: 15px 20px;
    cursor: pointer;
    user-select: none;
}

    .instructions-header h3 {
        margin: 0;
        color: #333;
        display: flex;
        align-items: center;
        gap: 10px;
    }

.toggle-icon {
    font-size: 12px;
    transition: transform 0.3s;
}

.instructions.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.preview-text {
    color: #666;
    margin-top: 5px;
    font-size: 14px;
}

.instructions-content {
    padding: 0 20px 20px;
    overflow: hidden;
    transition: height 0.3s ease-out;
}

.instructions.collapsed .instructions-content {
    height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.key-hint {
    background: #eee;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
}

/* 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 input {
    width: 70px;
    padding: 5px;
    border: 1px solid #4a90e2;
    border-radius: 4px;
}

/* Problems container */
.problems-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

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

    .problem input {
        width: 40px;
        height: 30px;
        font-size: 16px;
        text-align: center;
        border: 2px solid #4a90e2;
        border-radius: 4px;
    }

    .problem.correct input {
        border-color: #4CAF50;
        background: #f0fff0;
    }

    .problem.incorrect input {
        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-content {
    margin-top: 40px;
    padding: 20px;
    border-top: 1px solid #ddd;
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

    .footer-section h3 {
        color: #4a90e2;
        margin-bottom: 15px;
    }

    .footer-section p {
        color: #666;
        line-height: 1.6;
        margin-bottom: 15px;
    }

    .footer-section ul {
        list-style: none;
        padding: 0;
        margin: 0 0 15px 0;
    }

        .footer-section ul li {
            color: #666;
            margin-bottom: 8px;
            padding-left: 15px;
            position: relative;
        }

.contact-link {
    color: #4a90e2;
    text-decoration: none;
    transition: color 0.2s;
}

    .contact-link:hover {
        color: #357abd;
    }

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

    .footer-content {
        flex-direction: column;
        gap: 30px;
    }
}
