/* ================================================================
   Mini · Tortoise Chat — ocean theme
   ================================================================ */

:root {
  --abyss:        #02111f;
  --deep:         #06223b;
  --sea:          #0c3b66;
  --sea-2:        #114c80;
  --tide:         #1f6fb2;
  --surf:         #3aa1d8;
  --foam:         #b8e3f4;
  --mist:         #e7f4fb;
  --kelp:         #2dd4bf;
  --coral:        #ff8a6b;
  --coral-soft:   #ffb59c;
  --sand:         #f3e4c5;
  --shell:        #fffaf2;
  --sun:          #ffd166;
  --danger:       #ff6b6b;

  --bg-app:       linear-gradient(180deg, #021a2f 0%, #043257 50%, #064b7d 100%);
  --bg-panel:     rgba(8, 36, 64, 0.72);
  --bg-side:      rgba(3, 22, 42, 0.78);
  --bg-input:     rgba(255, 255, 255, 0.06);
  --border:       rgba(184, 227, 244, 0.12);
  --border-soft:  rgba(184, 227, 244, 0.07);
  --fg:           #eaf6fc;
  --fg-strong:    #ffffff;
  --muted:        #8db3cb;
  --muted-2:      #6791ad;

  --bubble-user:        linear-gradient(135deg, #1f6fb2 0%, #3aa1d8 100%);
  --bubble-user-fg:     #ffffff;
  --bubble-assistant:   rgba(255, 255, 255, 0.06);
  --bubble-assistant-b: rgba(184, 227, 244, 0.14);
  --bubble-tool:        rgba(45, 212, 191, 0.10);
  --bubble-tool-b:      rgba(45, 212, 191, 0.30);
  --bubble-tool-fg:     #b6f1e3;
  --bubble-think:       rgba(255, 209, 102, 0.07);
  --bubble-think-b:     rgba(255, 209, 102, 0.25);
  --bubble-think-fg:    #f4d790;

  --code-bg:      #001828;
  --code-fg:      #e0f2ff;

  --radius:       14px;
  --radius-sm:    10px;
  --shadow-card:  0 10px 30px rgba(2, 17, 31, 0.45);
  --shadow-glow:  0 0 0 1px rgba(58, 161, 216, 0.35), 0 0 24px rgba(58, 161, 216, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100vh;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-app);
  color: var(--fg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  height: 100vh;
  position: relative;
}

/* --- Animated ocean backdrop --- */

.ocean-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ocean-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(58, 161, 216, 0.18), transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(45, 212, 191, 0.14), transparent 55%);
}

.wave {
  position: absolute;
  left: -10%;
  right: -10%;
  height: 220px;
  background: radial-gradient(ellipse at center, rgba(58, 161, 216, 0.18), transparent 60%);
  border-radius: 50%;
  filter: blur(40px);
  animation: drift 22s ease-in-out infinite alternate;
}
.wave-1 { top:  10%; animation-duration: 26s; }
.wave-2 { top:  45%; animation-duration: 32s; opacity: .8; background: radial-gradient(ellipse at center, rgba(45, 212, 191, 0.18), transparent 60%); }
.wave-3 { top:  78%; animation-duration: 38s; opacity: .6; }

@keyframes drift {
  0%   { transform: translate3d(-4%, 0, 0) scale(1); }
  100% { transform: translate3d(4%, -2%, 0) scale(1.06); }
}

/* Light caustics shimmering across the ocean */
.caustics {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 25%, rgba(184, 227, 244, 0.10), transparent 12%),
    radial-gradient(circle at 70% 18%, rgba(184, 227, 244, 0.08), transparent 14%),
    radial-gradient(circle at 35% 65%, rgba(184, 227, 244, 0.07), transparent 14%),
    radial-gradient(circle at 85% 75%, rgba(184, 227, 244, 0.09), transparent 12%);
  mix-blend-mode: screen;
  animation: caustic 14s ease-in-out infinite alternate;
  opacity: 0.6;
}
@keyframes caustic {
  0%   { transform: translate3d(0, 0, 0); filter: blur(0px); }
  100% { transform: translate3d(20px, -10px, 0); filter: blur(2px); }
}

/* Reefs (coral on left, seaweed on right) */
.reef {
  position: absolute;
  bottom: 0;
  filter: drop-shadow(0 4px 12px rgba(2, 17, 31, 0.5));
  pointer-events: none;
}
.reef-left  { left: 8px;  width: 200px; height: 220px; opacity: 0.85; }
.reef-right { right: 8px; width: 220px; height: 260px; opacity: 0.75; }

.weed { transform-origin: bottom center; animation: sway 5s ease-in-out infinite alternate; }
.weed-b { animation-duration: 6.5s; animation-delay: -1s; }
.weed-c { animation-duration: 7s;   animation-delay: -2s; }
.weed-d { animation-duration: 5.5s; animation-delay: -0.5s; }
@keyframes sway {
  0%   { transform: rotate(-2deg); }
  100% { transform: rotate(3deg); }
}

/* Starfish scattered */
.starfish {
  position: absolute;
  filter: drop-shadow(0 4px 10px rgba(2, 17, 31, 0.4));
  pointer-events: none;
  animation: spin-slow 30s linear infinite;
}
.star-1 { width: 56px; height: 56px; top: 14%; right: 18%; animation-duration: 40s; }
.star-2 { width: 38px; height: 38px; top: 62%; right: 8%;  animation-duration: 55s; transform: rotate(20deg); opacity: 0.85; }
.star-3 { width: 44px; height: 44px; bottom: 12%; left: 28%; animation-duration: 48s; animation-direction: reverse; opacity: 0.8; }
@keyframes spin-slow {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Drifting bubbles */
.bubble {
  position: absolute;
  bottom: -40px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.8), rgba(184,227,244,0.15) 70%, transparent 75%);
  border: 1px solid rgba(184, 227, 244, 0.3);
  pointer-events: none;
  animation: float-up linear infinite;
}
.bubble.b1 { left: 12%; width: 8px;  height: 8px;  animation-duration: 14s; animation-delay: -2s; }
.bubble.b2 { left: 24%; width: 14px; height: 14px; animation-duration: 18s; animation-delay: -6s; }
.bubble.b3 { left: 48%; width: 6px;  height: 6px;  animation-duration: 12s; animation-delay: -1s; }
.bubble.b4 { left: 64%; width: 12px; height: 12px; animation-duration: 20s; animation-delay: -8s; }
.bubble.b5 { left: 78%; width: 9px;  height: 9px;  animation-duration: 16s; animation-delay: -4s; }
.bubble.b6 { left: 90%; width: 16px; height: 16px; animation-duration: 22s; animation-delay: -10s; }
@keyframes float-up {
  0%   { transform: translate3d(0, 0, 0) scale(0.8); opacity: 0; }
  10%  { opacity: 0.7; }
  50%  { transform: translate3d(20px, -50vh, 0) scale(1); opacity: 0.9; }
  90%  { opacity: 0.5; }
  100% { transform: translate3d(-10px, -110vh, 0) scale(1.1); opacity: 0; }
}

/* --- Sidebar --- */

#sidebar {
  position: relative;
  z-index: 1;
  width: 280px;
  background: var(--bg-side);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 16px 14px;
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  font-size: 26px;
  filter: drop-shadow(0 2px 6px rgba(45, 212, 191, 0.4));
  animation: bob 6s ease-in-out infinite;
  display: inline-block;
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-3px) rotate(2deg); }
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 700; font-size: 16px; color: var(--fg-strong); letter-spacing: 0.2px; }
.brand-sub  { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 1.2px; }

#new-chat {
  background: linear-gradient(135deg, var(--surf), var(--kelp));
  color: var(--abyss);
  border: 0;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(58, 161, 216, 0.5);
  transition: transform .15s ease, box-shadow .15s ease;
}
#new-chat:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(58, 161, 216, 0.6); }
#new-chat:active { transform: translateY(0); }

#conversation-list {
  list-style: none;
  margin: 0;
  padding: 8px 8px 12px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#conversation-list li {
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--fg);
  position: relative;
  transition: background .15s ease;
}
#conversation-list li:hover { background: rgba(58, 161, 216, 0.10); }
#conversation-list li.active {
  background: linear-gradient(90deg, rgba(58, 161, 216, 0.22), rgba(45, 212, 191, 0.10));
  box-shadow: inset 2px 0 0 var(--surf);
}
#conversation-list .meta {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.sidebar-footer {
  border-top: 1px solid var(--border-soft);
  padding: 10px 14px;
  font-size: 11px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-footer .user-badge {
  color: var(--fg);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-footer .user-badge::before {
  content: "🐢 ";
  margin-right: 4px;
}

.sidebar-footer #logout-btn {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.sidebar-footer #logout-btn:hover {
  color: var(--fg);
  border-color: var(--surf);
}

/* --- Main --- */

#main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(2, 26, 47, 0.35) 0%, rgba(6, 75, 125, 0.20) 100%);
}

#chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#chat-header h1 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--fg-strong);
}

.actions { display: flex; gap: 8px; }
.actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all .15s ease;
}
.actions button:hover { color: var(--fg-strong); border-color: var(--surf); background: rgba(58, 161, 216, 0.08); }

/* --- Messages --- */

#messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.msg {
  max-width: 760px;
  border-radius: var(--radius);
  padding: 12px 16px;
  line-height: 1.55;
  font-size: 14.2px;
  word-wrap: break-word;
  animation: surface 0.35s cubic-bezier(.2, .9, .25, 1);
}
@keyframes surface {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg.user {
  background: var(--bubble-user);
  color: var(--bubble-user-fg);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 20px rgba(31, 111, 178, 0.35);
}

.msg.assistant {
  background: var(--bubble-assistant);
  border: 1px solid var(--bubble-assistant-b);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.msg.tool-pane {
  background: rgba(45, 212, 191, 0.04);
  border: 1px dashed var(--bubble-tool-b);
  color: var(--bubble-tool-fg);
  align-self: flex-start;
  font-size: 12.5px;
  border-radius: 8px;
  max-width: 520px;
  padding: 6px 12px;
}
.msg.tool-pane[open] {
  background: var(--bubble-tool);
  padding: 10px 14px;
}
.msg.tool-pane summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--kelp);
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  outline: none;
  user-select: none;
}
.msg.tool-pane summary::-webkit-details-marker { display: none; }
.msg.tool-pane summary::before {
  content: "▸";
  font-size: 10px;
  color: var(--kelp);
  transition: transform .15s ease;
}
.msg.tool-pane[open] summary::before { transform: rotate(90deg); }
.msg.tool-pane .tool-label { letter-spacing: 0.2px; }
.msg.tool-pane .tool-count {
  font-size: 10.5px;
  color: var(--muted);
  margin-left: auto;
  font-weight: 400;
}
.msg.tool-pane .tool-body {
  margin: 10px 0 0;
  padding-left: 20px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--foam);
  max-height: 320px;
  overflow-y: auto;
}
.msg.tool-pane .tool-body li {
  padding: 3px 0;
  border-bottom: 1px solid rgba(45, 212, 191, 0.08);
  word-break: break-all;
}
.msg.tool-pane .tool-body li:last-child { border-bottom: 0; }

.msg.thinking {
  background: rgba(255, 209, 102, 0.05);
  border: 1px dashed var(--bubble-think-b);
  color: var(--bubble-think-fg);
  align-self: flex-start;
  font-size: 12.5px;
  border-radius: 8px;
  max-width: 520px;
  padding: 6px 12px;
}
.msg.thinking[open] {
  background: var(--bubble-think);
  padding: 10px 14px;
}
.msg.thinking summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--sun);
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  outline: none;
  user-select: none;
}
.msg.thinking summary::-webkit-details-marker { display: none; }
.msg.thinking summary::before {
  content: "▸";
  font-size: 10px;
  color: var(--sun);
  transition: transform .15s ease;
}
.msg.thinking[open] summary::before { transform: rotate(90deg); }
.msg.thinking .think-label { letter-spacing: 0.2px; }
.msg.thinking .think-count {
  font-size: 10.5px;
  color: var(--muted);
  margin-left: auto;
  font-weight: 400;
  letter-spacing: 0.3px;
}
.msg.thinking .think-body {
  margin-top: 10px;
  white-space: pre-wrap;
  line-height: 1.55;
  color: var(--foam);
  font-style: italic;
  border-left: 2px solid rgba(255, 209, 102, 0.4);
  padding-left: 12px;
  max-height: 360px;
  overflow-y: auto;
}

.msg.error {
  background: rgba(255, 107, 107, 0.10);
  border: 1px solid rgba(255, 107, 107, 0.35);
  color: var(--coral-soft);
}

.msg .msg-body { white-space: pre-wrap; }
.msg .msg-body p { margin: 0; }

.msg pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12.5px;
  margin: 10px 0;
  border: 1px solid rgba(58, 161, 216, 0.2);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.msg code {
  background: rgba(58, 161, 216, 0.18);
  color: var(--foam);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
.msg pre code { background: transparent; padding: 0; color: inherit; }

.msg-images {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.msg-images img {
  max-height: 180px;
  max-width: 240px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  object-fit: cover;
  background: rgba(0, 0, 0, 0.25);
}

.attachments {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.attachment-link {
  background: rgba(45, 212, 191, 0.10);
  border: 1px solid rgba(45, 212, 191, 0.30);
  color: var(--kelp);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  text-decoration: none;
  transition: all .15s ease;
}
.attachment-link:hover {
  background: rgba(45, 212, 191, 0.18);
  color: var(--mist);
}

.msg-meta {
  color: var(--muted);
  font-size: 11px;
  margin-top: 8px;
  letter-spacing: 0.3px;
}

.msg-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(184, 227, 244, 0.08);
  color: var(--muted);
  font-size: 11.5px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.2px;
}
.msg-status.standalone {
  align-self: flex-start;
  max-width: 80%;
  margin: 4px 0 12px;
  padding: 10px 14px;
  border-top: none;
  border: 1px dashed rgba(184, 227, 244, 0.18);
  border-radius: 14px;
  background: rgba(45, 212, 191, 0.06);
  font-size: 12.5px;
}
.msg-status .status-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--foam);
}
.msg-status .typing { gap: 3px; }
.msg-status .typing span {
  width: 5px;
  height: 5px;
  background: var(--kelp);
}
.msg-status .status-elapsed {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
}

/* --- Empty state --- */

#empty-state {
  color: var(--muted);
  font-size: 14px;
  align-self: center;
  margin-top: 80px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
#empty-state .empty-emoji {
  font-size: 64px;
  filter: drop-shadow(0 6px 24px rgba(45, 212, 191, 0.35));
  animation: bob 6s ease-in-out infinite;
}
#empty-state .empty-title { color: var(--fg-strong); font-size: 18px; font-weight: 600; }
#empty-state .empty-hint  { font-size: 13px; color: var(--muted); max-width: 360px; line-height: 1.5; }

/* --- Composer --- */

#composer {
  border-top: 1px solid var(--border);
  padding: 14px 20px 18px;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#attachment-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 4px;
}
.tray-thumb {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}
.tray-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tray-thumb.uploading::after {
  content: "";
  position: absolute; inset: 0;
  background: rgba(2, 17, 31, 0.55);
  background-image: linear-gradient(90deg, transparent, rgba(58, 161, 216, 0.4), transparent);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.tray-thumb .remove {
  position: absolute;
  top: 2px; right: 2px;
  background: rgba(2, 17, 31, 0.75);
  color: var(--fg-strong);
  border: 0;
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
}
.tray-thumb .remove:hover { background: var(--coral); }

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer-row:focus-within {
  border-color: var(--surf);
  box-shadow: var(--shadow-glow);
}

#attach-btn {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  transition: all .15s ease;
  flex-shrink: 0;
}
#attach-btn:hover { color: var(--surf); background: rgba(58, 161, 216, 0.10); }

#input {
  flex: 1;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--fg-strong);
  padding: 8px 4px;
  font: inherit;
  font-size: 14.2px;
  outline: none;
  max-height: 200px;
  min-height: 24px;
  line-height: 1.5;
}
#input::placeholder { color: var(--muted-2); }
#input:disabled { opacity: 0.5; cursor: not-allowed; }

#send {
  background: linear-gradient(135deg, var(--surf), var(--kelp));
  color: var(--abyss);
  border: 0;
  border-radius: 10px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: 0 4px 14px rgba(58, 161, 216, 0.4);
}
#send:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(58, 161, 216, 0.55); }
#send:active:not(:disabled) { transform: translateY(0); }
#send:disabled { background: rgba(255,255,255,0.05); color: var(--muted-2); cursor: not-allowed; box-shadow: none; }

.composer-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted-2);
  padding: 0 4px;
}
.hint-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--kelp);
  box-shadow: 0 0 8px var(--kelp);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

/* --- Drag-active composer --- */

#composer.drag-active .composer-row {
  border-color: var(--surf);
  box-shadow: var(--shadow-glow);
  background: rgba(58, 161, 216, 0.10);
}

/* --- Streaming dots --- */

.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
}
.typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--surf);
  opacity: 0.4;
  animation: typing 1.2s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-3px); }
}

/* --- Scrollbar --- */

#messages::-webkit-scrollbar,
#conversation-list::-webkit-scrollbar { width: 10px; }
#messages::-webkit-scrollbar-track,
#conversation-list::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb,
#conversation-list::-webkit-scrollbar-thumb {
  background: rgba(58, 161, 216, 0.2);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
#messages::-webkit-scrollbar-thumb:hover,
#conversation-list::-webkit-scrollbar-thumb:hover { background: rgba(58, 161, 216, 0.4); background-clip: content-box; }

/* --- Responsive --- */

@media (max-width: 720px) {
  #sidebar { width: 220px; }
  .msg { max-width: 92vw; }
  #messages { padding: 16px 14px 8px; }
}
