*{ box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  margin: 0;
  background: #0b0f17;
  color: #e8eefc;
}
/* Page layout: sidebar | content | sidebar */
.page-layout {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px;
}
.wrap {
  flex: 1;
  min-width: 0;
  max-width: 900px;
  margin: 0 auto;
  padding: 0;
}
.sidebar {
  width: 160px;
  flex-shrink: 0;
  min-height: 600px;
  position: sticky;
  top: 24px;
}

/* Mobile ad: hidden by default */
.mobile-ad { display: none; }

/* Mobile/Tablet: hide sidebars, show mobile ad */
@media (max-width: 1023px) {
  .page-layout { flex-direction: column; padding: 16px; }
  .sidebar { display: none; }
  .mobile-ad { display: block; margin-bottom: 12px; }
  .wrap { padding: 0; }
}
header h1 {
  margin: 0 0 6px;
  font-size: 34px;
}
.sub {
  margin: 0 0 18px;
  color: #b7c4e8;
}
.card {
  background: #111827;
  border: 1px solid #22304d;
  border-radius: 16px;
  padding: 16px;
}
.row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
label { color: #b7c4e8; font-size: 14px; }
input, textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #2a3a5c;
  background: #0b1220;
  color: #e8eefc;
  padding: 10px 12px;
  outline: none;
}
textarea { resize: vertical; min-height: 70px; }
.chat {
  height: 360px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid #22304d;
  background: #0b1220;
  padding: 12px;
  margin-bottom: 12px;
}
.bubble {
  padding: 10px 12px;
  border-radius: 12px;
  margin: 8px 0;
  white-space: pre-wrap;
  line-height: 1.35;
}
.me { background: #1f2a44; border: 1px solid #2f3f67; }
.ai { background: #102a1c; border: 1px solid #1f4a33; }
.meta { font-size: 12px; color: #b7c4e8; margin-bottom: 4px; }

.buttons { display: flex; gap: 10px; margin-top: 10px; }
button {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
#sendBtn { background: #3b82f6; color: white; }
.secondary { background: #22304d; color: #e8eefc; }

.status { margin-top: 10px; color: #b7c4e8; font-size: 13px; min-height: 18px; }
.audio { width: 100%; margin-top: 10px; }

footer { margin-top: 14px; color: #51e0a4; }
code { background: #0b1220; padding: 2px 6px; border-radius: 6px; border: 1px solid #22304d; }

#attachBtn { background: #22304d; color: #e8eefc; }

.image-preview-area {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px;
  background: #0b1220;
  border: 1px solid #2a3a5c;
  border-radius: 8px;
}
.image-preview-area img {
  max-height: 80px;
  max-width: 120px;
  border-radius: 6px;
  object-fit: cover;
}
#removeImageBtn {
  background: #3a1a1a;
  color: #f87171;
  border: 1px solid #5a2a2a;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chat-image {
  max-width: 220px;
  max-height: 160px;
  border-radius: 8px;
  display: block;
  margin-bottom: 4px;
  border: 1px solid #2f3f67;
}