/* halcyon-home · 皮肤层
   所有视觉效果都在这里。
   换皮肤 = 改这一个文件（或者换图片）。 */

/* ================================================================
   变量集中管理 — 改这里就能换配色
   ================================================================ */
:root {
  /* 奶油青草配色 */
  --bg: #e8e6df;
  --text: #38342a;
  --text-light: #7a7060;
  --text-muted: #a09878;
  --accent: #6d9b6d;
  --accent-light: #c6d9c4;
  --accent-dark: #4f7a50;

  /* 卡片（毛玻璃） */
  --card-surface: rgba(255, 255, 255, 0.56);
  --card-border: rgba(255, 255, 255, 0.80);
  --card-blur: 16px;
  --card-shadow: 0 4px 20px rgba(45, 52, 35, 0.07), 0 1px 0 rgba(255,255,255,0.55) inset;

  /* 气泡 */
  --bubble-ai: rgba(255, 255, 255, 0.90);
  --bubble-user: rgba(170, 208, 168, 0.68);
  --bubble-think: rgba(190, 210, 188, 0.30);
  --bubble-radius: 18px;
  --bubble-radius-tail: 6px;

  /* 输入区 */
  --input-bg: rgba(255, 255, 255, 0.88);
  --input-border: rgba(170, 160, 142, 0.38);
  --bar-bg: rgba(232, 230, 223, 0.96);

  /* 字体 */
  --font-family: -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
  --font-display: -apple-system, "SF Pro Display", "PingFang SC", "Helvetica Neue", sans-serif;
  --font-size: 16px;
  --font-size-small: 14px;
  --font-size-tiny: 12px;

  /* 头像 */
  --avatar-size: 36px;
  --avatar-radius: 50%;
  --avatar-ai: url('/assets/images/avatar-ai.jpg');
  --avatar-user: url('/assets/images/avatar-user.jpg');

  /* 聊天背景 */
  --chat-bg: #e8e6df;
  --chat-bg-image: none;
  --chat-bg-opacity: 0;

  /* 主页（纯色底 + 动态光晕叠加） */
  --home-bg: none;

  /* 动画 */
  --bubble-anim-duration: 0.25s;
  --typing-dot-size: 8px;
}

/* ================================================================
   全局
   ================================================================ */
html, body {
  font-family: var(--font-family);
  font-size: var(--font-size);
  background: var(--bg);
  color: var(--text);
}

/* ================================================================
   Top bar
   ================================================================ */
.top-bar {
  background: var(--bar-bg);
  border-bottom: 0.5px solid rgba(170, 160, 142, 0.28);
  font-size: 17px;
  font-weight: 500;
}

.back-btn {
  font-size: 28px;
  color: var(--accent);
  font-weight: 300;
}

.clear-btn:active {
  opacity: 0.8;
}

/* ================================================================
   Chat area — background
   ================================================================ */
.chat {
  background-color: var(--chat-bg);
}

/* ================================================================
   Message bubbles
   ================================================================ */
.msg-row {
  animation: fadeUp var(--bubble-anim-duration) ease-out;
}

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

/* Avatar */
.msg-avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: var(--avatar-radius);
  background-color: #ddd;
  background-size: cover;
  background-position: center;
}

.msg-row:not(.user) .msg-avatar {
  background-image: var(--avatar-ai);
}

.msg-row.user .msg-avatar {
  background-image: var(--avatar-user);
}

/* Bubble skin */
.bubble {
  font-size: var(--font-size);
  border-radius: var(--bubble-radius);
}

.msg-row:not(.user) .bubble {
  background: var(--bubble-ai);
  border-top-left-radius: var(--bubble-radius-tail);
}

.msg-row.user .bubble {
  background: var(--bubble-user);
  border-top-right-radius: var(--bubble-radius-tail);
}

/* Thinking bubble */
.bubble.thinking {
  background: var(--bubble-think);
  border: 1px dashed rgba(120, 150, 180, 0.5);
  border-radius: 14px;
  font-size: var(--font-size-small);
  color: #666;
  cursor: pointer;
}

.bubble.thinking .think-label {
  font-size: var(--font-size-tiny);
  color: #999;
  margin-bottom: 2px;
}

/* ================================================================
   Tool call card
   ================================================================ */
.tool-card {
  background: none;
  border-radius: 12px;
}

.tool-tag {
  background: rgba(220, 218, 210, 0.7);
  color: var(--text-light);
  border-radius: 8px;
}

/* ================================================================
   Typing indicator
   ================================================================ */
.typing-indicator span {
  width: var(--typing-dot-size);
  height: var(--typing-dot-size);
  background: #ccc;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

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

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

/* ================================================================
   Input area
   ================================================================ */
.input-area {
  background: var(--bar-bg);
  border-top: 0.5px solid var(--input-border);
}

.input-composer {
  background: var(--input-bg);
  box-shadow: 0 1px 8px rgba(45, 52, 35, 0.07);
}

.input-composer textarea {
  font-size: var(--font-size);
  font-family: var(--font-family);
  color: var(--text);
  min-height: 24px;
}

.input-composer textarea::placeholder {
  color: var(--text-light);
}

.input-actions button {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 6px rgba(45, 52, 35, 0.18);
}

.input-actions button:disabled {
  background: #c5c3ba;
  box-shadow: none;
}

.plus-btn {
  background: rgba(220, 218, 210, 0.7) !important;
  color: var(--accent) !important;
  box-shadow: none !important;
}

.plus-btn:active {
  background: rgba(200, 198, 188, 0.9) !important;
}

/* ---- + 弹出菜单 ---- */
.plus-menu {
  background: var(--input-bg);
  box-shadow: 0 4px 16px rgba(45, 52, 35, 0.1);
}

.plus-menu-item {
  color: var(--text);
  font-family: var(--font-family);
}

.plus-menu-item:active {
  background: rgba(45, 52, 35, 0.06);
}

/* ================================================================
   Home page
   ================================================================ */
.home {
  background-image: var(--home-bg);
  background-size: 300px;
  background-repeat: repeat;
}

/* 时钟卡（毛玻璃悬浮） */
.clock-card {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 4px 24px rgba(45, 52, 35, 0.07), 0 1px 0 rgba(255,255,255,0.6) inset;
  border: 0.5px solid rgba(255, 255, 255, 0.7);
}

.home-clock {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 400;
  letter-spacing: 2px;
  color: var(--text);
  line-height: 1;
}

.home-date {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 8px;
  letter-spacing: 0.3px;
}

/* Days 计数器卡 */
.days-card {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(45, 52, 35, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.8);
  transition: transform 0.15s;
}

.days-card:active {
  transform: scale(0.97);
}

.days-num {
  font-family: var(--font-display);
  color: var(--accent);
}

/* 上次说到卡 */
.closeout-card {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(45, 52, 35, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.8);
  transition: transform 0.15s;
}

.closeout-card:active {
  transform: scale(0.97);
}

/* 快速入口 */
.menu-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 12px rgba(45, 52, 35, 0.07);
  border: 0.5px solid rgba(255, 255, 255, 0.7);
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
}

.menu-card:active {
  transform: scale(0.94);
  box-shadow: 0 1px 6px rgba(45, 52, 35, 0.08);
}

.menu-icon-svg {
  color: var(--accent);
}

.menu-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-light);
}

/* Modal 弹窗 */
.modal-overlay {
  background: rgba(30, 28, 22, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-card {
  background: var(--bg);
  box-shadow: 0 -4px 32px rgba(45, 52, 35, 0.12);
}

.modal-close {
  color: var(--text);
}

.days-add-btn {
  color: var(--accent);
}

/* ================================================================
   Settings page
   ================================================================ */
.setting-label {
  font-size: var(--font-size-small);
  font-weight: 500;
  color: #555;
}

.setting-input {
  font-size: var(--font-size);
  font-family: var(--font-family);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
}

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

select.setting-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.setting-hint {
  font-size: var(--font-size-tiny);
  color: #aaa;
  margin-top: 4px;
}

.key-toggle {
  font-size: 18px;
}

.btn {
  font-size: var(--font-size);
  font-family: var(--font-family);
  border-radius: 12px;
  font-weight: 500;
}

.btn:disabled { opacity: 0.5; }

.btn-outline {
  background: white;
  border: 1px solid var(--input-border);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  border: none;
  color: white;
}

.btn-primary:active {
  background: var(--accent-dark);
}

.status-msg { font-size: var(--font-size-small); }
.status-msg.success { color: var(--accent); }
.status-msg.error   { color: #e74c3c; }
.status-msg.info    { color: var(--text-light); }

/* Divider */
.setting-divider {
  border-top: 0.5px solid var(--input-border);
}

/* Toggle switch */
.toggle-desc {
  font-size: var(--font-size-small);
  color: #666;
}

.toggle-slider {
  background: #ccc;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
}

/* Textarea for prompts */
.setting-textarea {
  font-size: var(--font-size-small);
  font-family: var(--font-family);
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
}

.setting-textarea:focus {
  border-color: var(--accent);
}

/* ================================================================
   Merge suggestion card
   ================================================================ */
.merge-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px dashed rgba(109, 155, 109, 0.4);
  border-radius: 14px;
}

.merge-header {
  color: var(--accent);
  font-weight: 500;
}

.merge-preview {
  color: var(--text-light);
}

.merge-btn {
  border-radius: 8px;
  font-family: var(--font-family);
}

.merge-do {
  background: var(--accent);
  color: white;
}

.merge-do:active {
  background: var(--accent-dark);
}

.merge-keep {
  background: rgba(220, 218, 210, 0.6);
  color: var(--text);
}

/* ================================================================
   Data panel
   ================================================================ */
.data-body {
  background: var(--bg);
}

.data-section-title {
  font-weight: 500;
  color: #555;
}

.data-card {
  background: rgba(255, 255, 255, 0.88);
  border-radius: 14px;
  box-shadow: 0 1px 4px rgba(45, 52, 35, 0.06);
}

.data-row {
  color: var(--text);
}

.data-row-accent {
  border-top: 0.5px solid var(--input-border);
  font-weight: 500;
  color: var(--accent);
}

.history-card {
  transition: background 0.15s;
}

.history-title {
  font-weight: 500;
}

/* ================================================================
   Hamburger 菜单
   ================================================================ */
.hamburger-btn {
  color: var(--accent);
}

.hamburger-menu {
  background: var(--bg);
  box-shadow: 0 4px 24px rgba(45, 52, 35, 0.12);
  border: 0.5px solid rgba(170, 160, 142, 0.28);
}

.hamburger-item {
  color: var(--text);
  font-family: var(--font-family);
  border-bottom: 0.5px solid var(--input-border);
}

.hamburger-item:last-child {
  border-bottom: none;
}

.hamburger-item:active {
  background: rgba(45, 52, 35, 0.06);
}

.hamburger-item-danger {
  color: #c0392b;
}

/* ---- 换窗按钮 ---- */
.switch-btn {
  background: rgba(220, 218, 210, 0.6);
  color: var(--accent);
}

.switch-btn:active {
  background: rgba(200, 198, 188, 0.8);
}

/* ---- 换窗弹窗 ---- */
.modal-subtitle {
  color: var(--text-light);
}

.switch-stat-card {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 4px rgba(45, 52, 35, 0.06);
}

.switch-stat-num {
  color: var(--accent);
  font-family: var(--font-display);
}

.switch-stat-label {
  color: var(--text-light);
}

.switch-stat-stub .switch-stat-num {
  color: var(--text-light);
}

.switch-section-label {
  color: #888;
  font-weight: 500;
}

.switch-preview {
  background: rgba(255, 255, 255, 0.6);
}

.switch-preview-msg {
  background: rgba(255, 255, 255, 0.8);
}

.switch-preview-user {
  background: var(--bubble-user);
}

.switch-preview-loading,
.switch-preview-empty {
  color: var(--text-light);
}

.switch-pill {
  background: rgba(220, 218, 210, 0.6);
  color: var(--text);
}

.switch-pill-stub {
  opacity: 0.55;
}

.switch-note {
  color: var(--text-light);
}

/* ---- 跨窗接续面板 ---- */
.panel-overlay {
  background: rgba(30, 28, 22, 0.3);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.panel-card {
  background: var(--bg);
  box-shadow: 0 -4px 32px rgba(45, 52, 35, 0.12);
}

.panel-subtitle {
  color: var(--text-light);
}

.panel-toggles {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 4px rgba(45, 52, 35, 0.04);
}

.panel-toggle-row {
  border-bottom: 0.5px solid var(--input-border);
}

.panel-toggle-row:last-child {
  border-bottom: none;
}

.panel-toggle-hint {
  color: var(--text-light);
}

.panel-section-label {
  color: #888;
}

.panel-section-hint {
  color: var(--text-light);
}

.panel-tab {
  background: rgba(220, 218, 210, 0.5);
  color: var(--text-light);
  font-family: var(--font-family);
}

.panel-tab-active {
  background: var(--accent);
  color: white;
}

.panel-lifeline-card {
  background: rgba(255, 255, 255, 0.85);
  box-shadow: 0 1px 6px rgba(45, 52, 35, 0.05);
}

.panel-lifeline-date {
  color: var(--text-light);
}

.panel-lifeline-content {
  color: var(--text);
}

.panel-action-btn {
  color: var(--accent);
}

.panel-action-muted {
  color: var(--text-light);
}

.panel-pin-btn {
  font-size: 14px;
}

/* ================================================================
   深色模式（取消注释即可启用）
   ================================================================ */
/*
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --text: #e0e0e0;
    --text-light: #888;
    --bubble-ai: #2c2c2c;
    --bubble-user: #2d5016;
    --input-bg: #2c2c2c;
    --input-border: #444;
    --bar-bg: #222;
    --home-bg: linear-gradient(160deg, #1a1a2e 0%, #16213e 100%);
  }
  .menu-card { background: #2c2c2c; }
  .home-name { color: #e0e0e0; }
}
*/
