﻿/* ====== CHAT CONTAINER ====== */
#chat-container {
  display: none;
  flex-direction: column;
  height: 100vh;
  background: var(--deep);
  overflow-x: hidden;
}

/* Header */
#header {
  background: var(--mid);
  padding: 10px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 3;
}
[data-theme="deep"] #header { border-bottom: 1px solid var(--ridge); }
[data-theme="shallow"] #header {
  box-shadow: 0 2px 8px rgba(30,74,62,0.08);
}
/* Wave under header in shallow */
[data-theme="shallow"] #header::after {
  content: '';
  position: absolute;
  bottom: -5px; left: 0; right: 0;
  height: 5px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 5'%3E%3Cpath d='M0,2.5 Q150,0 300,2.5 T600,2.5 T900,2.5 T1200,2.5 L1200,5 L0,5 Z' fill='%235ec4a8' fill-opacity='0.15'/%3E%3C/svg%3E") repeat-x;
  background-size: 600px 5px;
  animation: wave-drift 8s linear infinite;
}
@keyframes wave-drift { 0% { background-position-x: 0; } 100% { background-position-x: 600px; } }

.header-left { display: flex; align-items: center; gap: 8px; }
.header-title {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.1em;
  color: var(--neil);
  letter-spacing: 0.5px;
}
.header-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 5px var(--teal);
  transition: background 0.5s, box-shadow 0.5s;
  animation: pulse-dot 3s ease-in-out infinite;
}
/* Real status-based dot colors */
.header-dot.status-active { background: #00ffc8; box-shadow: 0 0 8px #00ffc8; animation: pulse-dot 1.5s ease-in-out infinite; }
.header-dot.status-coding { background: #a070ff; box-shadow: 0 0 8px #a070ff; animation: pulse-dot 2s ease-in-out infinite; }
.header-dot.status-idle { background: var(--teal); box-shadow: 0 0 5px var(--teal); animation: pulse-dot 4s ease-in-out infinite; }
.header-dot.status-resting { background: #607080; box-shadow: 0 0 3px #607080; animation: pulse-dot 5s ease-in-out infinite; }
.header-dot.status-offline { background: #555; box-shadow: none; animation: none; }
/* Login page dots */
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: middle; transition: background 0.5s; }
.dot.status-active { background: #00ffc8; box-shadow: 0 0 6px #00ffc8; }
.dot.status-coding { background: #a070ff; box-shadow: 0 0 6px #a070ff; }
.dot.status-idle { background: var(--teal); }
.dot.status-resting { background: #607080; }
.dot.status-offline { background: #555; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.header-handle { color: var(--text-dim); font-size: 0.78em; font-family: var(--mono); }

/* Mood indicator in header */
.header-mood {
  font-size: 0.75em;
  color: var(--text-dim);
  font-style: italic;
  font-family: var(--handwritten);
  font-size: 0.95em;
}

/* ====== MESSAGES ====== */
#messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* scroll-behavior: smooth -- DISABLED: causes frozen scroll during streaming */
  position: relative;
}
#messages > * { position: relative; z-index: 1; }

/* Caustic light in shallow */
[data-theme="shallow"] #messages {
  background:
    radial-gradient(ellipse at 20% 50%, rgba(42,158,133,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(255,230,140,0.05) 0%, transparent 40%),
    var(--deep);
}
[data-theme="shallow"] #messages::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: repeating-conic-gradient(
    rgba(255,230,140,0.015) 0deg, transparent 50deg, rgba(160,210,180,0.01) 100deg, transparent 150deg
  );
  animation: caustic-shift 25s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}
@keyframes caustic-shift {
  0% { opacity: 0.5; transform: scale(1) rotate(0deg); }
  100% { opacity: 0.8; transform: scale(1.08) rotate(2deg); }
}

#messages::-webkit-scrollbar { width: 5px; }
#messages::-webkit-scrollbar-track { background: transparent; }
#messages::-webkit-scrollbar-thumb { background: var(--ridge); border-radius: 3px; }

/* Welcome / empty state */
.welcome-state {
  align-self: center;
  text-align: center;
  padding: 40px 20px;
  max-width: 380px;
  animation: msg-in 0.4s ease-out;
}
.welcome-art {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.1;
  color: var(--neil);
  opacity: 0.5;
  white-space: pre;
  margin-bottom: 16px;
}
.welcome-text {
  font-family: var(--handwritten);
  font-size: 1.6em;
  color: var(--text-soft);
  line-height: 1.4;
}
.welcome-notes { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; justify-content: center; }
.welcome-note { background: rgba(155,125,207,0.08); border: 1px solid rgba(155,125,207,0.12); padding: 2px 8px; border-radius: 12px; font-size: 0.8em; color: var(--text-dim); font-family: var(--mono); }
[data-theme="shallow"] .welcome-note { background: rgba(42,158,133,0.06); border-color: rgba(42,158,133,0.12); }
.welcome-hint {
  color: var(--text-dim);
  font-size: 0.8em;
  margin-top: 10px;
  font-style: italic;
}

/* Messages */
.msg {
  max-width: 85%;
  min-width: 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  line-height: 1.6;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: visible;
  animation: msg-in 0.2s ease-out;
  position: relative;
  font-size: 0.92em;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user {
  align-self: flex-end;
  background: var(--user-bg);
  border: 1px solid var(--user-border);
  color: var(--text);
  border-radius: 12px 4px 12px 12px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
[data-theme="shallow"] .msg.user {
  background: linear-gradient(135deg, #e8f0ed, #dfeae5);
  border-color: #b0d4c5;
  box-shadow: 0 1px 4px rgba(30,74,62,0.06);
}

.msg.neil {
  align-self: flex-start;
  background: var(--neil-bg);
  border: 1px solid var(--neil-border);
  border-left: 3px solid var(--neil-border-accent);
  color: var(--text);
  border-radius: 4px 12px 12px 12px;
}
[data-theme="shallow"] .msg.neil {
  background: linear-gradient(135deg, #ffffff, #f5faf8);
  border: 1px solid #b8d4c8;
  border-left: 3px solid var(--neil-border-accent);
  box-shadow: 0 1px 6px rgba(30,74,62,0.08);
}

/* Neil signature -- tiny handwritten tag at bottom of messages */
.neil-sig {
  display: block;
  text-align: right;
  font-family: var(--handwritten);
  font-size: 0.72em;
  color: var(--neil);
  opacity: 0.45;
  margin-top: 2px;
  user-select: none;
}

/* Message action buttons (copy, edit, regenerate) */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}
.msg-actions button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.70em;
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--text-soft);
  transition: all 0.15s;
  white-space: nowrap;
  opacity: 0;
}
.msg:hover .msg-actions button { opacity: 1; }
.msg-actions button:hover {
  background: var(--neil-faint);
  color: var(--neil);
}
.msg-actions .copied {
  color: #4caf50 !important;
  opacity: 1 !important;
}
.msg-time {
  font-size: 0.68em;
  color: var(--text-dim);
  margin-right: auto;
  opacity: 0.7;
  user-select: none;
  font-family: var(--mono);
}

/* Code block copy button */
.code-copy-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.6);
  font-size: 0.7em;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 5;
}
.code-copy-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
[data-theme="shallow"] .code-copy-btn {
  background: rgba(0,0,0,0.05);
  border-color: rgba(0,0,0,0.1);
  color: rgba(0,0,0,0.4);
}
[data-theme="shallow"] .code-copy-btn:hover {
  background: rgba(0,0,0,0.1);
  color: rgba(0,0,0,0.7);
}
pre { position: relative; }

/* Emoji button â€” triggers native OS emoji picker */
#emoji-btn {
  background: none;
  border: none;
  font-size: 1.15em;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0.5;
  transition: opacity 0.15s;
}
#emoji-btn:hover { opacity: 1; }

/* Edit mode for user messages */
.msg.user.editing {
  background: transparent;
  border: 2px solid var(--neil);
  padding: 0;
}
.msg.user.editing textarea {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: none;
  font: inherit;
  font-size: inherit;
  line-height: inherit;
  padding: 10px 14px;
  resize: vertical;
  min-height: 40px;
  outline: none;
}
.msg.user.editing .edit-actions {
  display: flex;
  gap: 6px;
  padding: 4px 10px 6px;
  justify-content: flex-end;
}
.msg.user.editing .edit-actions button {
  font-size: 0.78em;
  padding: 3px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.msg.user.editing .edit-actions button.save-edit {
  background: var(--neil-dim);
  color: var(--neil);
  border-color: var(--neil);
}

/* Markdown in neil messages */
.msg.neil p { margin: 0.4em 0; }
.msg.neil p:first-child { margin-top: 0; }
.msg.neil p:last-child, .msg.neil p:last-of-type { margin-bottom: 0; }
.msg.neil ul, .msg.neil ol { margin: 0.4em 0; padding-left: 1.5em; }
.msg.neil li { margin: 0.2em 0; }
.msg.neil h1, .msg.neil h2, .msg.neil h3 { color: var(--neil); margin: 0.6em 0 0.3em; font-size: 1.05em; }
.msg.neil strong { color: var(--neil); }
.msg.neil em { color: var(--text-soft); }
.msg.neil a { color: var(--teal); text-decoration: none; }
.msg.neil a:hover { text-decoration: underline; }
.msg.neil blockquote {
  border-left: 2px solid var(--neil-dim);
  padding: 4px 12px;
  color: var(--text-soft);
  margin: 0.4em 0;
  font-style: italic;
}
[data-theme="shallow"] .msg.neil blockquote {
  border-left-color: #7aad9a;
  background: rgba(42,158,133,0.06);
  border-radius: 0 4px 4px 0;
}
.msg.neil table { border-collapse: collapse; margin: 0.5em 0; font-size: 0.9em; }
.msg.neil th, .msg.neil td { border: 1px solid var(--ridge); padding: 4px 10px; }
.msg.neil th { background: var(--surface); color: var(--neil); }
[data-theme="shallow"] .msg.neil th { background: #d5ebe2; }
[data-theme="shallow"] .msg.neil th, [data-theme="shallow"] .msg.neil td { border-color: #b8d8cc; }

/* Code */
.msg.neil pre {
  background: #1a1d2a;
  border: 1px solid #2a2d3e;
  border-radius: var(--radius-sm);
  padding: 10px;
  margin: 0.5em 0;
  overflow-x: auto;
  position: relative;
}
.msg.neil pre code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: none;
  padding: 0;
  border: none;
  color: #d4d8e4;
}
.msg.neil code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--neil-faint);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--neil);
  border: 1px solid rgba(155, 125, 207, 0.1);
}
[data-theme="shallow"] .msg.neil code {
  background: rgba(123, 90, 166, 0.08);
  border-color: rgba(123, 90, 166, 0.12);
}
[data-theme="shallow"] .msg.neil pre {
  background: #f4f2f8;
  border-color: #d8d0e4;
}
[data-theme="shallow"] .msg.neil pre code {
  color: #3a3050;
}

.code-block-wrapper { position: relative; }
.copy-btn {
  position: absolute;
  top: 6px; right: 6px;
  background: #252840;
  border: 1px solid #353860;
  color: #6870a0;
  padding: 2px 7px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.72em;
  font-family: var(--mono);
  opacity: 0;
  transition: opacity 0.15s;
}
.code-block-wrapper:hover .copy-btn { opacity: 1; }
.copy-btn:hover { color: var(--neil); border-color: var(--neil-dim); }
.copy-btn.copied { color: var(--teal); }

/* Camera / inline images */
.msg.neil img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 6px 0;
  display: block;
}
.msg.neil.camera-msg {
  max-width: 90%;
}

.msg.neil .katex { font-size: 1em; color: var(--text); }
.msg.neil .katex-display { margin: 0.5em 0; overflow-x: auto; }

.msg.system {
  align-self: center;
  color: var(--text-dim);
  font-size: 0.78em;
  padding: 4px 10px;
  max-width: 90%;
}
[data-theme="shallow"] .msg.system { font-style: italic; }

.msg.file {
  align-self: flex-end;
  background: var(--neil-faint);
  color: var(--neil);
  border: 1px solid rgba(155, 125, 207, 0.12);
  font-size: 0.85em;
  font-family: var(--mono);
}

/* Thinking */
.thinking-container {
  align-self: flex-start;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  color: var(--text-dim);
  font-size: 0.85em;
  font-family: var(--handwritten);
  font-size: 1em;
}
.thinking-dots { display: flex; gap: 3px; }
.thinking-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--neil-dim);
  animation: think-pulse 1.4s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes think-pulse {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}
[data-theme="shallow"] .thinking-dots span { background: rgba(42,158,133,0.5); }

/* Thinking â€” progressive source links */
.thinking-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  padding-left: 20px;
}
.source-link {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(42,158,133,0.1);
  border: 1px solid rgba(42,158,133,0.25);
  color: var(--neil-accent, #2a9e85);
  font-size: 0.75em;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
a.source-link:hover {
  background: rgba(42,158,133,0.2);
  border-color: rgba(42,158,133,0.5);
}

/* ====== INPUT BAR ====== */
#input-bar {
  display: flex;
  padding: 10px 28px;
  background: var(--mid);
  border-top: 1px solid var(--ridge);
  gap: 6px;
  align-items: center;
  position: relative;
}
[data-theme="shallow"] #input-bar {
  border-top: none;
  box-shadow: 0 -2px 8px rgba(30,74,62,0.06);
  background: linear-gradient(to top, #ddf0e8, var(--mid));
}

#msg-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--ridge);
  color: var(--text);
  padding: 8px 14px;
  font-family: var(--sans);
  font-size: 0.92em;
  border-radius: 20px;
  outline: none;
  transition: all 0.2s;
  min-height: 36px;
}
#msg-input:focus {
  border-color: var(--neil-dim);
  box-shadow: 0 0 0 2px var(--neil-faint);
}
#msg-input::placeholder { color: var(--text-dim); }
[data-theme="shallow"] #msg-input {
  background: #f2f9f6;
  border-color: #b8d8cc;
  box-shadow: inset 0 1px 3px rgba(30,74,62,0.06);
}

.input-btn {
  background: none;
  border: 1px solid var(--ridge);
  color: var(--text-dim);
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.input-btn:hover { border-color: var(--neil-dim); color: var(--neil); background: var(--neil-faint); }
.input-btn:disabled { opacity: 0.25; cursor: not-allowed; }

#send-btn {
  background: var(--neil-dim);
  border: none;
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#send-btn:hover { background: var(--neil); box-shadow: 0 2px 8px var(--neil-glow); }
#send-btn:disabled { opacity: 0.25; cursor: not-allowed; box-shadow: none; }
#file-input { display: none; }

/* Feature drawer */
#feature-btn {
  background: none;
  border: 1px solid var(--ridge);
  color: var(--text-dim);
  width: 40px; height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#feature-btn:hover { border-color: var(--neil-dim); color: var(--neil); }
#feature-btn.active { background: var(--neil-faint); border-color: var(--neil-dim); color: var(--neil); }

.feature-drawer {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50px;
  margin-bottom: 6px;
  background: var(--surface);
  border: 1px solid var(--ridge);
  border-radius: var(--radius);
  padding: 6px;
  gap: 2px;
  flex-wrap: wrap;
  max-width: 260px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
  z-index: 50;
  animation: drawer-in 0.15s ease-out;
}
.feature-drawer.open { display: flex; }
@keyframes drawer-in { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: translateY(0); } }
[data-theme="shallow"] .feature-drawer { box-shadow: 0 -4px 16px rgba(30,74,62,0.1); }

.feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
  min-width: 56px;
  text-align: center;
}
.feature-item:hover { background: var(--neil-faint); }
.feature-item .feat-icon { font-size: 1.2em; }
.feature-item .feat-label { font-size: 0.72em; color: var(--text-soft); font-family: var(--mono); white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.feat-sub { font-size: 0.8em; opacity: 0.5; font-style: italic; }

/* ====== LIFE MAP PREVIEW (embedded mini-constellation in chat) ====== */
.lifemap-preview {
  margin-top: 12px;
  border: 1px solid rgba(0, 200, 180, 0.25);
  border-radius: 12px;
  background: #010408;
  overflow: hidden;
  animation: panelGrow 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.lifemap-preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--neil, #00c8b4);
  padding: 10px 14px 4px;
  font-size: 0.85em;
}
.lifemap-preview-count {
  margin-left: auto;
  font-size: 0.75em;
  opacity: 0.5;
  font-weight: 400;
}
.lifemap-mini-canvas {
  width: 100%;
  height: 220px;
  display: block;
  cursor: pointer;
  transition: border-color 0.3s;
}
.lifemap-mini-canvas:hover {
  filter: brightness(1.1);
}
.lifemap-preview-hint {
  text-align: center;
  font-size: 0.65em;
  color: rgba(0,200,180,0.4);
  padding: 4px 0 8px;
  font-family: var(--mono);
  letter-spacing: 0.05em;
}
@keyframes panelGrow {
  from { opacity:0; transform: scale(0.95); }
  to { opacity:1; transform: scale(1); }
}

/* ====== ATTACHMENT BAR ====== */
#attachment-bar {
  display: none;
  padding: 6px 28px;
  gap: 6px;
  flex-wrap: wrap;
  background: var(--mid);
  border-top: 1px solid var(--ridge);
}
#attachment-bar.has-files { display: flex; }
.attachment-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--ridge);
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 0.78em;
  font-family: var(--mono);
  color: var(--text-soft);
  animation: msg-in 0.15s ease-out;
}
.chip-name { color: var(--neil); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-size { color: var(--text-dim); font-size: 0.85em; }
.chip-remove {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 1.1em;
  line-height: 1;
  padding: 0 2px;
  transition: color 0.15s;
}
.chip-remove:hover { color: var(--danger); }

/* Drop overlay */
.drop-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 14, 0.85);
  z-index: 100;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--neil);
  font-family: var(--handwritten);
  font-size: 1.4em;
  border: 3px dashed var(--neil-dim);
  margin: 12px;
  border-radius: var(--radius);
}
.drop-overlay.visible { display: flex; }
.drop-overlay-text { opacity: 0.7; }
[data-theme="shallow"] .drop-overlay { background: rgba(250, 246, 238, 0.90); border-color: var(--neil); }

/* ====== MOBILE RESPONSIVE ====== */
@media (max-width: 600px) {
  #header { padding: 8px 14px; }
  .header-title { font-size: 1em; }
  .header-handle { display: none; }
  .header-mood { font-size: 0.8em; }
  .memory-toggle-label { display: none; }
  
  #messages { padding: 14px 12px; gap: 10px; }
  .msg { max-width: 92%; font-size: 0.88em; padding: 8px 12px; }
  .msg.neil pre { padding: 8px; }
  .msg.neil pre code { font-size: 0.8em; }
  .msg.neil table { font-size: 0.82em; }
  
  #input-bar { padding: 8px 10px; gap: 4px; }
  #msg-input { padding: 8px 12px; font-size: 0.88em; }
  .input-btn { width: 36px; height: 36px; }
  #send-btn { width: 36px; height: 36px; }
  #feature-btn { width: 34px; height: 34px; }
  
  .feature-drawer { left: 10px; right: 10px; max-width: none; }
  .feature-item { padding: 8px 6px; min-width: 48px; }
  .feature-item .feat-label { font-size: 0.65em; }
  
  .welcome-state { padding: 24px 12px; }
  .welcome-text { font-size: 1.1em; }
  .welcome-art { font-size: 7px; }
  
  /* Hide feedback button on small screens to save space */
  #feedback-btn { display: none; }
  
  .lifemap-mini-canvas { height: 160px; }
}

@media (max-width: 380px) {
  .msg { max-width: 95%; }
  .depth-toggle .depth-label { display: none; }
}

/* ====== SMOOTH SCROLL INDICATOR ====== */
.scroll-to-bottom {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid var(--ridge);
  color: var(--text-soft);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.75em;
  font-family: var(--mono);
  cursor: pointer;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.scroll-to-bottom.visible {
  opacity: 1;
  pointer-events: auto;
}
.scroll-to-bottom:hover {
  background: var(--neil-faint);
  border-color: var(--neil-dim);
  color: var(--neil);
}



/* ====== DRIVE SEARCH CARDS ====== */
.drive-search-card {
  margin-top: 12px;
  border: 1px solid rgba(79, 142, 247, 0.25);
  border-radius: 12px;
  background: rgba(79, 142, 247, 0.04);
  overflow: hidden;
  animation: panelGrow 0.4s cubic-bezier(0.34,1.56,0.64,1);
}
.drive-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #4f8ef7;
  padding: 10px 14px 6px;
  font-size: 0.85em;
}
.drive-icon { font-size: 1.1em; }
.drive-title { opacity: 0.9; }
.drive-results {
  padding: 4px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drive-loading {
  color: rgba(255,255,255,0.3);
  font-size: 1.2em;
  letter-spacing: 4px;
  padding: 8px 14px 12px;
}
.drive-file-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  text-decoration: none;
  color: #e2e6f0;
  font-size: 0.88em;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.drive-file-link:hover {
  background: rgba(79, 142, 247, 0.1);
  border-color: rgba(79, 142, 247, 0.2);
  color: #4f8ef7;
}
.drive-file-icon { font-size: 1em; flex-shrink: 0; }
.drive-file-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drive-file-date { font-size: 0.8em; opacity: 0.4; flex-shrink: 0; }
.drive-error, .drive-empty {
  color: rgba(255,255,255,0.35);
  font-size: 0.85em;
  padding: 4px 0;
  font-style: italic;
}
