* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  background: #343541;
  color: #ececf1;
  height: 100vh;
  display: flex;
  flex-direction: column;
}
header { background: #202123; padding: 16px 24px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #444654; box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
header img { height: 40px; width: 40px; border-radius: 8px; object-fit: cover; }
header h1 { font-size: 20px; font-weight: 600; color: #ececf1; }
#chat { flex: 1; overflow-y: auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; max-width: 800px; margin: 0 auto; width: 100%; }
#chat::-webkit-scrollbar { width: 8px; }
#chat::-webkit-scrollbar-thumb { background: #565869; border-radius: 4px; }
.message { padding: 16px 20px; border-radius: 12px; word-wrap: break-word; white-space: pre-wrap; line-height: 1.6; font-size: 15px; animation: fadeIn 0.4s ease-out; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.user { align-self: flex-end; background: #10a37f; color: #fff; max-width: 80%; border-bottom-right-radius: 4px; }
.ai {
    align-self: flex-start;
    background: linear-gradient(135deg, #3a3c4a, #2c2e3a); /* Refined gradient for depth */
    color: #ececf1;
    max-width: 85%;
    border-bottom-left-radius: 4px;
    position: relative;
    border: 1px solid rgba(70, 72, 84, 0.5); /* Subtle border */
    box-shadow: 0 0 15px rgba(16,163,127,0.4), /* Outer glow effect */
                0 2px 8px rgba(0,0,0,0.3); /* Deeper shadow for lift */
    transition: all 0.3s ease; /* Smooth transitions for future interactions */
}
{{ edit_1 }}
header h1 {
    font-size: 20px;
    font-weight: 600;
    color: #ececf1;
    text-shadow: 0 0 8px rgba(236,236,241,0.3); /* Subtle glow for the title text */
}
#chat { flex: 1; overflow-y: auto; padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; max-width: 800px; margin: 0 auto; width: 100%; }
#chat::-webkit-scrollbar { width: 8px; }
#chat::-webkit-scrollbar-thumb { background: #565869; border-radius: 4px; }
.loader { border: 3px solid #2d2e3a; /* Darker border for contrast */
    border-top: 3px solid #10a37f;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 0.8s linear infinite;
    margin: 8px auto;
    box-shadow: 0 0 10px rgba(16,163,127,0.6); /* More prominent glow for loader */
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px);} to {opacity:1; transform: translateY(0);} }
#inputArea { display: flex; padding: 16px 24px 24px; gap: 12px; background: #343541; border-top: 1px solid #444654; max-width: 800px; margin: 0 auto; width: 100%; }
#prompt { flex: 1; padding: 14px 18px; border-radius: 12px; border: 1px solid #565869; background: #40414f; color: #ececf1; font-size: 15px; outline: none; }
#prompt:focus { border-color: #10a37f; box-shadow: 0 0 0 2px rgba(16,163,127,0.2); }
button { padding: 12px 20px; border: none; border-radius: 10px; background: #10a37f; color: #fff; cursor: pointer; font-size: 14px; font-weight: 600; }
button:hover { background: #0d8f6f; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
img.generated { width: 100%; max-width: 512px; border-radius: 12px; display: block; animation: fadeIn 0.5s; box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.img-wrapper { display: flex; flex-direction: column; gap: 10px; }
.download-btn { padding: 8px 16px; font-size: 13px; border-radius: 8px; background: #10a37f; font-weight: 600; }
.download-btn:hover { background: #0d8f6f; }
#micBtn, #ttsBtn { position: fixed; top: 20px; width: 52px; height: 52px; border-radius: 50%; background: #40414f; color: #ececf1; border: 2px solid #565869; display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 1000; font-size: 22px; }
#micBtn { left: 20px; }
#ttsBtn { right: 20px; }
#micBtn.recording { background: #ef4444; border-color: #dc2626; }
#ttsBtn.active { background: #10a37f; border-color: #0d8f6f; }
@media (max-width: 768px) { #chat { padding: 16px 12px; } #inputArea { padding: 12px 16px 16px; } .message { font-size: 14px; padding: 12px 16px; } #micBtn, #ttsBtn { width: 44px; height: 44px; font-size: 18px; } }