body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    color: #333;
    display: flex;
    /* Changed to column to stack footer below */
    flex-direction: column; 
    align-items: center;
    margin: 0;
    padding: 40px 20px;
    box-sizing: border-box;
}

#main-container {
    background-color: #ffffff;
    padding: 2rem 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 700px;
    text-align: center;
}

header h1 {
    font-family: 'Bangers', cursive;
    font-size: 3.5rem;
    color: #e53935;
    margin: 0;
    letter-spacing: 2px;
}

header p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 1.5rem;
}

/* --- AI Generator Section --- */
#ai-generator {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #e9ecef;
    border-radius: 10px;
}
#ai-generator p {
    margin: 0 0 10px 0;
    font-weight: bold;
    font-size: 1.1rem;
}
#prompt-container {
    display: flex;
    gap: 10px;
}
#promptInput {
    flex-grow: 1;
    padding: 10px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
}
#generateBtn {
    padding: 10px 20px;
    font-size: 0.9rem;
    background-color: #007bff;
    color: white;
}
#generateBtn:hover {
    background-color: #0069d9;
}

.divider-text {
    font-family: 'Bangers', cursive;
    font-size: 1.5rem;
    color: #6c757d;
    margin: 1rem 0;
}

#controls {
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

#controls label {
    font-weight: bold;
}

input[type="color"] {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    width: 40px; height: 40px; background-color: transparent;
    border: none; cursor: pointer;
}
input[type="color"]::-webkit-color-swatch { border-radius: 50%; border: 2px solid #ddd; }
input[type="color"]::-moz-color-swatch { border-radius: 50%; border: 2px solid #ddd; }

#color-palette { display: flex; gap: 6px; align-items: center; }

.color-swatch {
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
    border: 2px solid transparent; transition: all 0.2s ease; flex-shrink: 0;
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.active { border-color: #333; transform: scale(1.15); }
.color-swatch[style*="#ffffff"] { border: 2px solid #ddd; }
.color-swatch[style*="#ffffff"].active { border-color: #333; }

#canvas-container {
    position: relative; /* For loading overlay */
}

#drawingCanvas {
    border: 3px dashed #ccc;
    border-radius: 10px;
    cursor: crosshair;
    touch-action: none;
    max-width: 100%;
}

#canvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    font-family: 'Bangers', cursive;
    font-size: 2.5rem;
    color: #333;
    border-radius: 10px;
    pointer-events: none; /* Allow clicks to pass through */
}

#fillBtn { background-color: #f8f9fa; border: 2px solid #6c757d; color: #6c757d; font-size: 0.9rem; padding: 8px 16px; }
#fillBtn.active { background-color: #6c757d; color: white; border-color: #6c757d; }

/* --- Tone Selector Styles --- */
#tone-selector-container {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
#tone-selector-container label {
    font-weight: bold;
    font-size: 1rem;
}
#critiqueTone {
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #ced4da;
    font-size: 0.9rem;
    background-color: #fff;
    cursor: pointer;
}


#action-buttons { margin-top: 1rem; display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap; }

button {
    font-family: 'Inter', sans-serif; font-weight: bold; font-size: 1rem;
    padding: 12px 24px; border: none; border-radius: 8px; cursor: pointer; transition: all 0.3s ease;
}

#submitBtn { background-color: #e53935; color: white; }
#submitBtn:hover { background-color: #c62828; transform: translateY(-2px); }
#submitBtn:disabled { background-color: #9e9e9e; cursor: not-allowed; }

#clearBtn { background-color: #6c757d; color: white; }
#clearBtn:hover { background-color: #5a6268; }

#downloadBtn { background-color: #28a745; color: white; }
#downloadBtn:hover { background-color: #218838; }

#roast-container { margin-top: 2rem; text-align: left; padding: 1.5rem; background-color: #f8f9fa; border: 1px solid #e9ecef; border-radius: 10px; }
#roast-container h2 { font-family: 'Bangers', cursive; font-size: 2rem; color: #333; margin-top: 0; text-align: center; }

#roast-output {
    font-size: 1.1rem; line-height: 1.6; min-height: 50px; display: flex;
    justify-content: center; align-items: center; flex-direction: column; gap: 1rem;
}
#roast-output p { margin: 0; width: 100%; text-align: center; color: #555; transition: opacity 0.5s ease; }
.loading-text { font-style: italic; color: #e53935 !important; }

.replay-button { background-color: #17a2b8; color: white; font-size: 0.9rem; padding: 8px 16px; align-self: center; }
.replay-button:hover { background-color: #138496; }
.replay-button:disabled { background-color: #9e9e9e; cursor: not-allowed; }

/* --- Footer Styles --- */
#page-footer {
    margin-top: 2rem;
    text-align: center;
    font-size: 0.85rem;
    color: #888;
    width: 100%;
    max-width: 700px;
}