body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
}

.container {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

h1 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 20px;
}

.controls-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    padding: 20px;
    border: 1px solid #eee;
    border-radius: 8px;
    background-color: #f9f9f9;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-weight: bold;
    color: #555;
}

.input-group input[type="file"],
.input-group textarea,
.input-group select,
.input-group input[type="number"],
.input-group input[type="color"] {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
    width: 100%;
    box-sizing: border-box; /* Include padding in width */
}

.input-group textarea {
    resize: vertical;
    min-height: 100px;
}

.input-group button {
    padding: 10px 15px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

.input-group button:hover:not(:disabled) {
    background-color: #2980b9;
}

button#startRecognitionBtn,
button#stopRecognitionBtn {
    padding: 12px 20px;
    background-color: #27ae60;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background-color 0.3s ease;
    margin-top: 15px;
    width: auto;
}

button#stopRecognitionBtn {
    background-color: #e74c3c;
    margin-left: 10px;
}

button#startRecognitionBtn:hover:not(:disabled) {
    background-color: #229954;
}

button#stopRecognitionBtn:hover:not(:disabled) {
    background-color: #c0392b;
}

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

#recognitionStatus {
    margin-top: 10px;
    font-style: italic;
    color: #666;
    text-align: center;
}

.content-section {
    display: flex;
    gap: 20px;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.image-display, .text-display {
    flex: 1;
    min-width: 300px; /* Minimum width before wrapping */
    background-color: #fefefe;
    padding: 20px;
    border-radius: 8px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.image-display h2, .text-display h2 {
    text-align: center;
    color: #34495e;
    margin-bottom: 15px;
}

#hymnCanvas {
    border: 1px solid #ccc;
    background-color: #e9e9e9;
    display: block; /* Remove extra space below canvas */
    max-width: 100%;
    height: auto; /* Maintain aspect ratio */
}

#hymnTextDisplay {
    border: 1px solid #ccc;
    padding: 15px;
    min-height: 200px;
    background-color: #fff;
    line-height: 1.8;
    font-size: 1.1rem;
    white-space: pre-wrap; /* Preserve whitespace and wrap text */
}

#hymnTextDisplay span {
    transition: all 0.1s ease-out; /* Smooth transition for scaling/bolding */
    display: inline-block; /* Allows transform to work */
    padding: 2px 0; /* Small padding for better highlight visibility */
}

/* Dynamic Text Highlighting Classes */
.highlighted {
    background-color: rgba(255, 255, 0, 0.7); /* Yellow highlight */
    font-weight: bold;
    transform: scale(1.2); /* Magnify */
    color: #000; /* Ensure text is visible */
}

.half-highlighted {
    background-color: rgba(255, 255, 0, 0.3); /* Lighter yellow highlight */
    font-weight: 600; /* Half bold */
    transform: scale(1.1); /* Half magnify */
    color: #000;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .controls-section {
        grid-template-columns: 1fr;
    }
    .content-section {
        flex-direction: column;
    }
    .container {
        padding: 15px;
    }
}