body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 20px;
    background-color: #f4f4f4;
    color: #333;
}

h1, h2, h3, h4 {
    color: #1a1a1a;
}

form {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

button {
    background-color: #007bff;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

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

button:hover:not(:disabled) {
    background-color: #0056b3;
}

#results-wrapper {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#results-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* This creates space between the result cards */
    margin-top: 10px;
}

.page-result {
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 15px;
    flex: 1 1 550px; /* Grow and shrink from a 550px base, allowing for responsive wrapping */
    box-sizing: border-box; /* Ensures padding and border are included in the width */
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 5px;
}

.page-result:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

pre {
    background-color: #e9e9e9;
    padding: 15px;
    border-radius: 5px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.error {
    color: #d8000c;
    background-color: #ffbaba;
    border: 1px solid #d8000c;
    padding: 10px;
    border-radius: 5px;
}

.answers-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    table-layout: fixed;
}

.answers-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: center;
    font-size: 0.9em;
    white-space: nowrap;
}

.answer-input {
    background-color: transparent;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: inherit;
    text-align: center;
    width: 30px;
    padding: 2px;
    border-radius: 3px;
}

.answer-input:focus {
    border: 1px solid #007bff;
    outline: none;
}

.debug-image {
    max-width: 100%;
    height: auto;
    border: 1px solid #ccc;
    margin-top: 10px;
    border-radius: 4px;
}

.correct-answer {
    background-color: #d4edda; /* Light green */
    color: #155724;
}

.incorrect-answer {
    background-color: #f8d7da; /* Light red */
    color: #721c24;
}

a.button {
    text-decoration: none;
    background-color: #6c757d;
}

a.button:hover {
    background-color: #5a6268;
}
/* --- Styles for Configure Page --- */

.config-section {
    margin-bottom: 20px;
    border: 1px solid #ccc;
    padding: 15px;
    border-radius: 8px;
    background-color: #fff;
}

.config-section h3 {
    margin-top: 0;
    color: #333;
}

.config-item {
    margin-bottom: 15px;
}

.config-item > label { /* The main label for the ROI group */
    font-weight: bold;
    display: block;
    margin-bottom: 2px; /* Even tighter spacing for a grouping effect */
}

.roi-grid {
    display: grid;
    grid-template-columns: repeat(4, auto); /* Size columns to content */
    gap: 2px 8px; /* Tighter row and column gap for a grouping effect */
    align-items: center;
    justify-content: start; /* Don't stretch columns */
}

.roi-grid label {
    font-size: 0.85em;
    font-weight: normal;
    text-align: left;
    color: #555;
}

.roi-grid input[type="number"] {
    width: 11ch;
    box-sizing: border-box;
}

#sensitivity-config-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

.sensitivity-column h3 {
    margin-top: 0;
    color: #333;
}

.image-preview-container {
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    background-color: #f9f9f9;
    /* Cap the width on large screens, but allow it to be smaller */
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.image-preview-container img {
    max-width: 100%; /* This makes the image responsive */
    height: auto;
    border: 1px solid #ddd;
}
