body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 20px;
    background-color: #f4f4f4;
    color: #333;
}

h1, h2 {
    text-align: center;
    color: #555;
}

.container {
    max-width: 1000px;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.input-section {
    margin-bottom: 30px;
    text-align: center;
    padding: 20px;
    border-bottom: 1px solid #eee;
}

label {
    display: block;
    margin-bottom: 10px;
    font-weight: bold;
}

input[type="file"] {
    margin-bottom: 15px;
}

button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

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

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

#status {
    margin-top: 15px;
    font-style: italic;
    color: #666;
}

#progressBarContainer {
    width: 100%;
    height: 25px;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-top: 15px;
    overflow: hidden; /* Keep the fill inside the container */
    position: relative; /* Allows absolute positioning of text */
}

#progressBarFill {
    height: 100%;
    width: 0%; /* Initial width */
    background-color: #4CAF50; /* Green color */
    border-radius: 5px;
    transition: width 0.3s ease; /* Smooth transition */
}

#progressBarText {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    text-align: center;
    line-height: 25px; /* Vertically center text */
    color: #333; /* Darker text for readability */
    font-weight: bold;
    font-size: 0.9em;
    text-shadow: 0 0 2px rgba(255,255,255,0.5); /* Little shadow for contrast */
}

.checkerboard-bg {
    background-color: #fff; /* Base color */
    background-image:
        linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee),
        linear-gradient(45deg, #eee 25%, transparent 25%, transparent 75%, #eee 75%, #eee);
    background-size: 20px 20px; /* Size of each square */
    background-position: 0 0, 10px 10px; /* Offset for alternating pattern */
}

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

.image-container {
    flex: 1;
    min-width: 300px; /* Minimum width for containers */
    text-align: center;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9; /* Default background */
    display: flex; /* Use flexbox for internal layout */
    flex-direction: column; /* Stack children vertically */
    align-items: center; /* Center children horizontally */
}

.image-container h2 {
    margin-bottom: 15px;
    font-size: 1.1em;
    color: #444;
}

.image-container img,
.image-container canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto 10px; /* Add margin-bottom */
    /* Remove border and background from canvas/img itself,
       as container provides context and checkerboard */
    border: none;
    background-color: transparent;
}

#resultCanvas {
    margin-bottom: 10px; /* Space below canvas */
}

#originalImage {
    margin-bottom: 10px; /* Space below image */
}

#originalPlaceholder, #resultPlaceholder {
    color: #888;
    font-style: italic;
    min-height: 50px; /* Reserve some space */
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1; /* Allow placeholder to take up space */
}

#downloadResultBtn {
    margin-top: 15px;
}