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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-hover: #252525;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --text-secondary: #888;
  --accent: #6c63ff;
  --accent-hover: #5a52d5;
  --user-bubble: #6c63ff;
  --ai-bubble: #262626;
  --danger: #ff6b6b;
  --period: #ff6b9d;
}

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

/* ===== Layout ===== */
.app-container {
  display: flex;
  height: 100dvh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.3s ease;
}

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

.sidebar-header h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.sidebar-close { display: none; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 8px;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  text-align: left;
  font-family: inherit;
}

.nav-item { position: relative; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--accent); color: white; }

.unread-dot {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3b3b;
}

.unread-badge {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #ff3b3b;
  color: white;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Conversation list */
.convo-section {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
  border-top: 1px solid var(--border);
}

.convo-section.show { display: flex; }

.convo-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.convo-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
}

.convo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.convo-item:hover { background: var(--surface-hover); }
.convo-item.active { background: rgba(108,99,255,0.15); }

.convo-item-info {
  flex: 1;
  min-width: 0;
}

.convo-item-title {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.convo-item-preview {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.convo-item-more {
  opacity: 0;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  flex-shrink: 0;
}

.convo-item:hover .convo-item-more { opacity: 1; }
.convo-item-more:hover { color: var(--text); background: var(--border); }

.convo-archived-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-top: 1px solid var(--border);
}

.convo-archived-toggle:hover { color: var(--text); }

.convo-archived { display: none; padding-bottom: 8px; }
.convo-archived.show { display: block; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

/* ===== Main Content ===== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.topbar-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  gap: 4px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover { color: var(--text); background: var(--surface-hover); }

/* ===== Pages ===== */
.page {
  display: none;
  flex: 1;
  overflow: hidden;
}

.page.active { display: flex; flex-direction: column; }

/* ===== Home Page ===== */
.home-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  overflow-y: auto;
}

.home-clock {
  font-size: 72px;
  font-weight: 200;
  letter-spacing: 2px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.home-date {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.home-love-counter {
  font-size: 14px;
  color: var(--accent);
  margin-bottom: 8px;
  opacity: 0.85;
}

.home-weather {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text-secondary);
  padding: 8px 16px;
  background: var(--surface);
  border-radius: 12px;
  margin-bottom: 24px;
  max-width: 300px;
  overflow: hidden;
}

.weather-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weather-icon { font-size: 20px; }

.home-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  max-width: 500px;
  width: 100%;
  margin-bottom: 24px;
}

.shortcut-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  transition: all 0.2s;
}

.shortcut-card:hover { background: var(--surface-hover); border-color: var(--accent); transform: translateY(-2px); }
.shortcut-icon { font-size: 28px; }

.notif-btn {
  padding: 10px 20px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: var(--accent);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.notif-btn:hover { background: rgba(108,99,255,0.1); }
.notif-btn:disabled { opacity: 0.5; cursor: not-allowed; border-color: var(--border); color: var(--text-secondary); }

.home-moments-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 500px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 20px;
}

.home-moments-entry:hover { border-color: var(--accent); transform: translateY(-1px); }

.home-moments-icon { font-size: 24px; }

.home-moments-label {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.home-moments-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff3b3b;
  flex-shrink: 0;
}

.home-moments-arrow {
  color: var(--text-secondary);
  font-size: 14px;
}

.home-greeting {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  max-width: 400px;
}

/* ===== Chat Page ===== */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.search-bar.open { display: flex; }

.search-bar input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
}

.search-bar input:focus { border-color: var(--accent); }

.search-info {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.chat-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  scroll-behavior: smooth;
}

.welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-secondary);
}

.welcome-icon { font-size: 48px; }
.welcome h2 { font-size: 20px; color: var(--text); }
.welcome p { font-size: 14px; }

/* Message layout */
.message {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
  max-width: 75%;
}

.message.user { margin-left: auto; flex-direction: row-reverse; }
.message.assistant { margin-right: auto; }

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

.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  font-weight: 600;
  align-self: flex-end;
  cursor: pointer;
  overflow: hidden;
}

.message-avatar .avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.message.user .message-avatar { background: var(--accent); color: white; }
.message.assistant .message-avatar { background: #3a3a3a; color: var(--text); }

.message-body { min-width: 0; }

.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  padding: 0 4px;
}

.message.user .message-meta { flex-direction: row-reverse; }

.message-role { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.message-time { font-size: 11px; color: var(--text-secondary); }

.message-content {
  line-height: 1.6;
  font-size: 15px;
  padding: 10px 14px;
  border-radius: 18px;
  word-break: break-word;
}

.message.user .message-content {
  background: var(--user-bubble);
  color: white;
  border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
  background: var(--ai-bubble);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.message-content p { margin-bottom: 8px; }
.message-content p:last-child { margin-bottom: 0; }

.code-block { position: relative; margin: 8px 0; }

.code-copy-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #333;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 1;
}

.code-block:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { color: var(--text); background: #444; }

.message-content pre {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 0;
  font-size: 13px;
}

.message-content code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 13px;
}

.message.assistant .message-content :not(pre) > code {
  background: #333;
  padding: 2px 6px;
  border-radius: 4px;
}

.message.user .message-content :not(pre) > code {
  background: rgba(255,255,255,0.2);
  padding: 2px 6px;
  border-radius: 4px;
}

.message-content ul, .message-content ol { margin: 8px 0; padding-left: 20px; }
.message-content li { margin-bottom: 4px; }

.message-content blockquote {
  border-left: 3px solid rgba(255,255,255,0.3);
  padding-left: 12px;
  opacity: 0.8;
  margin: 8px 0;
}

.message-content h1, .message-content h2, .message-content h3 { margin: 12px 0 6px; }

.message-content table { border-collapse: collapse; margin: 8px 0; width: 100%; }
.message-content th, .message-content td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.message-content th { background: var(--surface-hover); }

/* Thinking block */
.thinking-block {
  margin-bottom: 6px;
  border-radius: 10px;
  background: rgba(108, 99, 255, 0.08);
  border: 1px solid rgba(108, 99, 255, 0.2);
  overflow: hidden;
}

.thinking-toggle {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.thinking-toggle::-webkit-details-marker { display: none; }

.thinking-toggle::before {
  content: "▶ ";
  font-size: 10px;
  transition: transform 0.2s;
  display: inline-block;
}

details[open] .thinking-toggle::before {
  transform: rotate(90deg);
}

.thinking-content {
  padding: 8px 12px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  border-top: 1px solid rgba(108, 99, 255, 0.15);
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

.typing-indicator span {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--text-secondary);
  border-radius: 50%;
  margin-right: 4px;
  animation: bounce 1.4s 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(-6px); }
}

/* Input area */
.input-area {
  padding: 12px 16px 20px;
  border-top: 1px solid var(--border);
}

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

.input-wrapper:focus-within { border-color: var(--accent); }

textarea {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 150px;
  line-height: 1.5;
  padding: 4px 0;
}

textarea::placeholder { color: var(--text-secondary); }

.btn-send {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-send:hover:not(:disabled) { background: var(--accent-hover); }
.btn-send:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-attach {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.2s;
}

.btn-attach:hover { color: var(--text); }

/* Attachment preview */
.attachment-preview {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px 8px;
}

.attachment-preview.has-files { display: flex; }

.attachment-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
}

.attachment-item img { width: 64px; height: 64px; object-fit: cover; display: block; }

.attachment-item .file-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
}

.file-icon-emoji { font-size: 24px; }

.file-icon-name {
  font-size: 9px;
  color: var(--text-secondary);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
  padding: 0 2px;
}

.attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Message images/files */
.message-images { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.message-images img { max-width: 240px; max-height: 240px; border-radius: 10px; cursor: pointer; object-fit: cover; }
.message-images img:hover { opacity: 0.9; }

.message-files { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }

.message-file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  width: fit-content;
}

.message-file-link:hover { background: rgba(255,255,255,0.12); }

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.lightbox.open { display: flex; }
.lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 8px; }

/* ===== Calendar Page ===== */
.calendar-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}

.calendar-header h2 { font-size: 18px; font-weight: 600; }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  padding: 8px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  position: relative;
  gap: 2px;
  background: var(--surface);
  border: 1px solid transparent;
}

.cal-day:hover { border-color: var(--accent); }
.cal-day.today { border-color: var(--accent); background: rgba(108,99,255,0.1); }
.cal-day.other-month { opacity: 0.3; }

.cal-day-num { font-size: 14px; font-weight: 500; }

.cal-day-indicators {
  display: flex;
  gap: 2px;
  height: 8px;
  align-items: center;
}

.cal-indicator {
  font-size: 8px;
  line-height: 1;
}

.cal-period-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--period);
}

.cal-memo-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* Day detail panel */
.day-detail {
  display: none;
  margin-top: 16px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.day-detail.open { display: block; }

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

.day-detail-header h3 { font-size: 15px; }

.day-detail-body { padding: 16px; }

.detail-section {
  margin-bottom: 16px;
}

.detail-section:last-child { margin-bottom: 0; }

.detail-section label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.mood-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mood-picker button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mood-picker button:hover { border-color: var(--accent); transform: scale(1.1); }
.mood-picker button.selected { border-color: var(--accent); background: rgba(108,99,255,0.15); }

.period-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
}

.period-btn:hover { border-color: var(--period); }
.period-btn.active { border-color: var(--period); background: rgba(255,107,157,0.1); }

.period-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s;
}

.period-btn.active .period-dot { background: var(--period); }

#memoInput {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
}

#memoInput:focus { border-color: var(--accent); }

.btn-save-memo {
  margin-top: 8px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.btn-save-memo:hover { background: var(--accent-hover); }

/* ===== Moments Page ===== */
.moments-container {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.moments-header-card {
  position: relative;
  margin-bottom: 40px;
}

.moments-cover {
  height: 180px;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 30%, #0f3460 60%, #533483 100%);
  position: relative;
  overflow: hidden;
}

.moments-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='200'%3E%3Ccircle cx='50' cy='30' r='1.5' fill='%23fff' opacity='0.6'/%3E%3Ccircle cx='120' cy='80' r='1' fill='%23fff' opacity='0.4'/%3E%3Ccircle cx='200' cy='20' r='2' fill='%23fff' opacity='0.7'/%3E%3Ccircle cx='280' cy='60' r='1' fill='%23fff' opacity='0.5'/%3E%3Ccircle cx='350' cy='40' r='1.5' fill='%23fff' opacity='0.6'/%3E%3Ccircle cx='80' cy='140' r='1' fill='%23fff' opacity='0.3'/%3E%3Ccircle cx='160' cy='120' r='2' fill='%23fff' opacity='0.5'/%3E%3Ccircle cx='300' cy='150' r='1' fill='%23fff' opacity='0.4'/%3E%3Ccircle cx='380' cy='100' r='1.5' fill='%23fff' opacity='0.6'/%3E%3C/svg%3E");
  opacity: 0.8;
}

.moments-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  position: absolute;
  bottom: -30px;
  right: 20px;
}

.moments-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  border: 3px solid var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.moments-name {
  font-size: 16px;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  position: relative;
  bottom: 30px;
}

.moments-feed {
  padding: 0 16px 20px;
}

.moments-empty {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

.moment-card {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.moment-card:last-child {
  border-bottom: none;
}

.moment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.moment-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}

.moment-meta {
  flex: 1;
}

.moment-author {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.moment-time {
  font-size: 12px;
  color: var(--text-secondary);
}

.moment-mood {
  font-size: 20px;
}

.moment-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  padding-left: 50px;
  white-space: pre-wrap;
  word-break: break-word;
}

.moment-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 50px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.moment-react-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
  font-family: inherit;
}

.moment-react-btn:hover {
  border-color: var(--accent);
  background: rgba(108,99,255,0.08);
}

.moment-reaction {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(108,99,255,0.1);
  border: 1px solid rgba(108,99,255,0.2);
  border-radius: 20px;
  padding: 3px 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.moment-reaction:hover {
  background: rgba(108,99,255,0.2);
}

.moment-comments {
  padding-left: 50px;
  margin-top: 8px;
}

.moment-comment {
  display: flex;
  gap: 8px;
  padding: 8px 0;
}

.moment-comment + .moment-comment {
  border-top: 1px solid rgba(255,255,255,0.04);
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}

.comment-avatar.user-avatar { background: var(--accent); color: white; }
.comment-avatar.ai-avatar { background: #3a3a3a; color: var(--text); }

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.comment-name.ai-name { color: var(--text-secondary); }

.comment-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  margin-top: 2px;
  white-space: pre-wrap;
  word-break: break-word;
}

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

.comment-input-row {
  display: flex;
  gap: 8px;
  padding-left: 50px;
  margin-top: 8px;
  align-items: center;
}

.comment-input-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.comment-input-row input:focus { border-color: var(--accent); }

.comment-input-row input::placeholder { color: var(--text-secondary); }

.comment-send-btn {
  background: var(--accent);
  border: none;
  color: white;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  transition: background 0.2s;
}

.comment-send-btn:hover { background: var(--accent-hover); }

/* ===== Memory Page ===== */
.memory-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: 20px;
}

.memory-list-page { flex: 1; }

.memory-page-item {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
}

.memory-page-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.memory-page-item-content {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.memory-page-item-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  opacity: 0;
  transition: opacity 0.2s;
}

.memory-page-item:hover .memory-page-item-delete { opacity: 1; }
.memory-page-item-delete:hover { color: var(--danger); }

.memory-add-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.memory-add-form input,
.memory-add-form textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  resize: none;
}

.memory-add-form input:focus,
.memory-add-form textarea:focus { border-color: var(--accent); }

.btn-save-memory {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.btn-save-memory:hover { background: var(--accent-hover); }

.memory-empty-page {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 14px;
}

/* Context menu */
.context-menu {
  display: none;
  position: fixed;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  z-index: 300;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  min-width: 120px;
}

.context-menu.open { display: block; }

.context-menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
}

.context-menu button:hover { background: var(--surface-hover); }

/* Scrollbars */
.chat-area::-webkit-scrollbar,
.convo-list::-webkit-scrollbar,
.calendar-container::-webkit-scrollbar,
.memory-container::-webkit-scrollbar { width: 6px; }

.chat-area::-webkit-scrollbar-track,
.convo-list::-webkit-scrollbar-track,
.calendar-container::-webkit-scrollbar-track,
.memory-container::-webkit-scrollbar-track { background: transparent; }

.chat-area::-webkit-scrollbar-thumb,
.convo-list::-webkit-scrollbar-thumb,
.calendar-container::-webkit-scrollbar-thumb,
.memory-container::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== Mobile ===== */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .sidebar-close { display: flex; }

  .home-clock { font-size: 48px; }

  .home-shortcuts {
    grid-template-columns: repeat(2, 1fr);
    max-width: 300px;
  }

  .message { max-width: 85%; }

  .cal-day { font-size: 12px; }
  .cal-day-num { font-size: 12px; }
}

/* Typing indicator */
.typing-indicator .message-body {
  padding: 8px 14px;
}
.typing-dots {
  display: flex;
  align-items: center;
  gap: 1px;
  color: var(--text-secondary);
  font-size: 13px;
}
.typing-dots .dot {
  animation: typingBounce 1.4s infinite;
  font-weight: bold;
  font-size: 18px;
  line-height: 1;
}
.typing-dots .dot:nth-child(3) { animation-delay: 0.2s; }
.typing-dots .dot:nth-child(4) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}
