:root {
  /* Backgrounds */
  /* --bg-base:     #212121;
  --bg-sidebar:  #171717;
  --bg-surface:  #2a2a2a;
  --bg-elevated: #2f2f2f; */

  /* Beefy backgrounds */
  --bg-base:     #311d11;
  --bg-sidebar:  #20130b;
  --bg-surface:  #311d11;
  --bg-elevated: #FC5517;

  /* Borders */
  --border:      #3f3f3f;
  --border-card: #3a3a3a;

  /* Text */
  --text-primary:   #ececec;
  --text-secondary: #ccc;
  --text-faint:     #bbb;
  --text-muted:     #666;
  --text-dim:       #555;
  --text-white:     #fff;

  /* Misc */
  --scrollbar:   #444;
  --hover-surface: #333;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  height: 100vh;
  display: flex;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────── */
#sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  margin: 8px 0 8px 8px;
  border-radius: 12px;
  overflow: hidden;
}

#sidebar-header {
  padding: 16px 12px 12px;
  border-bottom: 1px solid var(--bg-surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#sidebar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 0 4px;
  letter-spacing: -0.01em;
}

#new-chat-btn {
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--text-dim);
  padding: 7px 10px;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s, color 0.15s;
}

#new-chat-btn:hover {
  background: var(--bg-surface);
  color: var(--text-secondary);
}

#new-chat-btn svg {
  flex-shrink: 0;
  opacity: 0.6;
}

#conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

#conv-list::-webkit-scrollbar { width: 4px; }
#conv-list::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 2px; }

.conv-item {
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.conv-item:hover { background: var(--bg-surface); }
.conv-item.active { background: var(--bg-elevated); }

.conv-title {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-item.active .conv-title { color: var(--text-white); }

.conv-time {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

#conv-empty {
  padding: 16px 12px;
  font-size: 13px;
  color: var(--text-dim);
}

/* ── Main ────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#messages {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

#messages::-webkit-scrollbar { width: 6px; }
#messages::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }

#messages-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  padding-bottom: 60px;
}

#empty-state h1 {
  font-size: 26px;
  font-weight: 600;
  color: var(--text-primary);
}

#empty-state > p { font-size: 15px; margin-bottom: 8px; }

#prompt-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 500px;
  margin-top: 16px;
}

.prompt-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-card);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text-faint);
  cursor: pointer;
  text-align: left;
  line-height: 1.5;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.prompt-card:hover {
  background: var(--hover-surface);
  border-color: var(--text-dim);
  color: var(--text-primary);
}

.message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeUp 0.2s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message.user  { align-items: flex-end; }
.message.assistant { align-items: flex-start; }

.bubble {
  padding: 11px 16px;
  border-radius: 18px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 85%;
  font-size: 15px;
}

.user .bubble {
  background: var(--bg-elevated);
  border-bottom-right-radius: 4px;
}

.assistant .bubble {
  background: transparent;
  padding: 0;
  max-width: 100%;
}

.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 8px 0;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%            { transform: translateY(-5px); }
}

/* ── Input ───────────────────────────────── */
#input-area {
  padding: 12px 16px 20px;
}

#input-inner {
  max-width: 720px;
  margin: 0 auto;
}

#input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-sidebar);
  border-radius: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

#input-wrapper:focus-within { border-color: var(--text-muted); }

#user-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  max-height: 200px;
  overflow-y: auto;
  font-family: inherit;
}

#user-input::placeholder { color: var(--text-dim); }

#send-btn {
  background: var(--text-primary);
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, opacity 0.15s;
}

#send-btn:hover:not(:disabled) { background: var(--text-white); }

#send-btn:disabled { opacity: 0.25; cursor: default; }

#send-btn svg { width: 16px; height: 16px; fill: var(--bg-base); }

/* ── Media gallery ───────────────────────── */
.media-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.media-gallery img {
  max-width: 220px;
  max-height: 160px;
  border-radius: 10px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: opacity 0.15s;
}

.media-gallery img:hover { opacity: 0.85; }

.media-gallery video {
  max-width: 320px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.media-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}
