/* ============================================================
 * style-custom.css — 专属小手机·近白单色 iOS 仿真主题
 * 覆盖在原有 style.css / app.css / chat.css 之后，仅做视觉换肤，
 * 不改动任何功能逻辑。
 * 设计语言：近白单色底 / 实白圆角卡 / 轻投影 / 圆润 /
 *           单一低饱和主色 / 克制暖金点缀 / 线性描边图标。
 * ============================================================ */

/* 1. 主题变量（覆盖 style.css 的 :root，CSS 同特异性后定义者胜） */
:root {
  --bg-main: #eef0ee;
  --surface: #ffffff;
  --surface-2: #f6f7f5;
  --surface-hover: #f0f1ef;
  --primary: #5c6b7e;
  --primary-soft: #eef1f5;
  --accent: #c2a06a;
  --text-primary: #2b2f36;
  --text-secondary: #868d97;
  --border: #e7e9e6;
  --danger: #d58a82;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 2px 8px rgba(30,40,50,0.05);
  --shadow-md: 0 8px 28px rgba(30,40,50,0.07);
  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Segoe UI", Roboto, sans-serif;
}

/* 1.5 主题预设（单一换肤层的扩展，仅覆盖变量；data-theme 由设置页/启动脚本写入 <html>） */
:root[data-theme="warm"] {
  --bg-main: #faf3ea; --surface: #fffdf9; --surface-2: #f6ede0; --surface-hover: #f3e8d8;
  --primary: #b07a4e; --primary-soft: #f3e6d8; --accent: #d98c4a;
  --text-primary: #3a2f28; --text-secondary: #a08a78; --border: #f0e3d4; --danger: #d07f72;
}
:root[data-theme="forest"] {
  --bg-main: #eef2ec; --surface: #f7faf6; --surface-2: #e9f0e6; --surface-hover: #e2ebe0;
  --primary: #5c7a5e; --primary-soft: #e3ecdf; --accent: #8aa05c;
  --text-primary: #2c352c; --text-secondary: #7d8a78; --border: #dfe7da; --danger: #c08a82;
}
:root[data-theme="night"] {
  --bg-main: #191c22; --surface: #23272f; --surface-2: #2b303a; --surface-hover: #2f3540;
  --primary: #8b9bb4; --primary-soft: #2b3340; --accent: #cda968;
  --text-primary: #e7ebf2; --text-secondary: #9aa3b2; --border: #333a45; --danger: #d98b82;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3); --shadow-md: 0 8px 28px rgba(0,0,0,0.42);
}
:root[data-theme="night"] .icon-wrapper { background: linear-gradient(160deg,#2e333d,#262a33) !important; border-color: #3a404c !important; color: var(--primary) !important; }
:root[data-theme="night"] .app-icon span { color: #dfe3ea !important; }
:root[data-theme="night"] .settings-group { background: transparent !important; }
:root[data-theme="night"] .today-widget .tw-row { color: #cdd3dc !important; }
:root[data-theme="night"] ::-webkit-scrollbar-thumb { background: #3a404c !important; }

/* 1.6 主题配色面板（设置页二级） */
.theme-swatch-row { cursor: pointer; align-items: center; }
.theme-dot { width: 26px; height: 26px; border-radius: 50%; flex: 0 0 auto; border: 1px solid rgba(0,0,0,0.08); box-shadow: var(--shadow-sm); }
.theme-default { background: linear-gradient(135deg,#eef0ee,#5c6b7e); }
.theme-warm { background: linear-gradient(135deg,#faf3ea,#d98c4a); }
.theme-forest { background: linear-gradient(135deg,#eef2ec,#5c7a5e); }
.theme-night { background: linear-gradient(135deg,#191c22,#8b9bb4); }
.sc-sub { display: block; font-size: 11px; color: var(--text-secondary); font-weight: 400; margin-top: 1px; }
.theme-check { width: 18px; height: 18px; }
.settings-hint { font-size: 12px; color: var(--text-secondary); padding: 10px 16px 0; line-height: 1.5; margin: 0; }

/* 2. 全局底（移除雪地小猫图，近白单色） */
#phone-container {
  background-color: var(--bg-main) !important;
  background-image: none !important;
}

/* 3. 桌面 App 图标：近白圆角卡片（iOS 风） */
.icon-wrapper {
  width: 58px !important;
  height: 58px !important;
  border-radius: 17px !important;
  background: linear-gradient(160deg, #ffffff, #f2f4f1) !important;
  border: 1px solid #e6e8e5 !important;
  box-shadow: 0 3px 10px rgba(30,40,50,0.06) !important;
  color: var(--primary) !important;
}
.icon-wrapper svg { width: 30px !important; height: 30px !important; }
.app-icon span {
  color: #3a4048 !important;
  font-weight: 500 !important;
  font-size: 12px !important;
  text-shadow: none !important;
}
.app-icon.dragging .icon-wrapper {
  box-shadow: 0 10px 26px rgba(30,40,50,0.16) !important;
}
.widget-add-badge { background-color: var(--primary) !important; }
.widget-delete-badge { background-color: var(--danger) !important; }

/* 4. Dock 栏：近白半透明细边 */
.dock-container {
  background-color: rgba(255,255,255,0.72) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid #e6e8e5 !important;
  box-shadow: 0 8px 30px rgba(30,40,50,0.08) !important;
}

/* 5. 应用窗口 / 顶栏 */
.app-window { background-color: var(--bg-main) !important; }
.win-header {
  background-color: var(--surface) !important;
  border-bottom: 1px solid var(--border) !important;
}
.win-header h3 { color: var(--text-primary) !important; font-weight: 600 !important; }
.win-body { background: transparent !important; }

/* 6. 通用卡片 / 菜单行（iOS 白卡） */
.menu-item,
.sb-card {
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
  color: var(--text-primary) !important;
  border-radius: 14px !important;
}

/* 7. 通用按钮 / 开关 / chevron */
.btn-primary { background-color: var(--primary) !important; border-color: var(--primary) !important; }
.btn-primary:hover { background-color: #4f5d6e !important; }
.chevron { color: var(--text-secondary) !important; }
.switch .slider { background-color: #d6d9d6 !important; }
.switch input:checked + .slider { background-color: var(--primary) !important; }

/* 8. 今日一览小组件（白卡） */
.today-widget {
  background-color: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 18px !important;
  box-shadow: var(--shadow-sm) !important;
  padding: 14px 16px !important;
  margin-bottom: 12px !important;
}
.today-widget h4 {
  margin: 0 0 8px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}
.today-widget .tw-row {
  font-size: 12.5px !important;
  color: #2a3744 !important;
  padding: 4px 0 !important;
  border-bottom: 1px solid var(--border) !important;
  display: flex !important;
  justify-content: space-between !important;
  gap: 8px !important;
}
.today-widget .tw-row:last-child { border-bottom: none !important; }
.today-widget .tw-prog {
  height: 7px !important;
  border-radius: 6px !important;
  background: var(--surface-2) !important;
  overflow: hidden !important;
  margin-top: 6px !important;
}
.today-widget .tw-prog > i {
  display: block !important;
  height: 100% !important;
  background: linear-gradient(90deg, var(--primary), #8a98a8) !important;
}
.today-jump button {
  flex: 1 !important;
  padding: 9px 0 !important;
  border-radius: 14px !important;
  border: 1px solid var(--border) !important;
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  cursor: pointer !important;
}

/* 9. 桌面仿真 iOS 状态栏（DOM 由 index.html 新增，可经设置开关显隐） */
.phone-status-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  padding: 7px 20px 3px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--text-primary) !important;
  letter-spacing: .2px !important;
  font-family: var(--font-family) !important;
}
.phone-status-bar .sb-side { display: flex !important; align-items: center !important; gap: 7px !important; }
.phone-status-bar .sb-signal { display: flex !important; align-items: flex-end !important; gap: 2px !important; height: 11px !important; }
.phone-status-bar .sb-signal i { width: 3px !important; background: var(--text-primary) !important; border-radius: 1px !important; }
.phone-status-bar .sb-battery {
  width: 24px !important; height: 12px !important;
  border: 1.5px solid var(--text-primary) !important;
  border-radius: 3px !important; position: relative !important; padding: 1.5px !important;
  box-sizing: border-box !important;
}
.phone-status-bar .sb-battery::after {
  content: "" !important; position: absolute !important; right: -3.5px !important; top: 3px !important;
  width: 2px !important; height: 4px !important; background: var(--text-primary) !important;
  border-radius: 0 1px 1px 0 !important;
}
.phone-status-bar .sb-battery i {
  display: block !important; height: 100% !important; background: var(--text-primary) !important;
  border-radius: 1px !important;
}
.phone-status-bar .sb-net { font-size: 12px !important; }

/* 10. 通用细节 */
* { -webkit-tap-highlight-color: transparent !important; }
::-webkit-scrollbar { width: 6px !important; height: 6px !important; }
::-webkit-scrollbar-thumb { background: #d4d8d4 !important; border-radius: 3px !important; }
input, textarea, select { font-family: var(--font-family) !important; }

/* 11. 桌面大字时钟组件（DOM 由 index.html 新增，参考小猫鱼桌面） */
.desktop-clock {
  text-align: left !important;
  padding: 18px 20px 6px !important;
  font-family: var(--font-family) !important;
}
.desktop-clock .dc-time {
  font-size: 52px !important;
  font-weight: 200 !important;
  letter-spacing: 1px !important;
  color: var(--text-primary) !important;
  line-height: 1 !important;
}
.desktop-clock .dc-date {
  font-size: 14px !important;
  font-weight: 500 !important;
  color: var(--text-secondary) !important;
  margin-top: 6px !important;
}


/* 12. 设置页 iOS 分组列表 */
.settings-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin: 0 14px 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.settings-group-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 11px 16px 6px;
  letter-spacing: .3px;
}
.settings-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color .15s ease;
}
.settings-cell:last-child { border-bottom: none; }
.settings-cell:active { background: var(--surface-hover); }
.sc-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; flex: 0 0 24px; }
.sc-icon svg { width: 22px; height: 22px; }
.sc-label { flex: 1; font-size: 14px; color: var(--text-primary); font-weight: 500; min-width: 0; }
.sc-state { font-size: 13px; color: var(--primary); font-weight: 600; }
.settings-cell .chevron { width: 18px; height: 18px; color: var(--text-secondary); flex: 0 0 18px; }


/* 13. 桌面布局：状态栏 + 大字时钟 + 图标网格 纵向排列 */
#desktop { display: flex !important; flex-direction: column !important; overflow-y: auto !important; }
#desktop-grid { flex: 1 1 auto !important; align-content: start !important; }


/* 14. 今日一览小组件内的线性小图标（替代 emoji） */
.today-widget h4 .tw-ico {
  width: 16px !important;
  height: 16px !important;
  color: var(--primary) !important;
  flex: 0 0 16px !important;
}


/* 15. 主聊天气泡：平角非对称圆角 + char 书脊线（不靠大色块区分角色） */
.msg-bubble { max-width: 78% !important; }
.msg-text {
  padding: 10px 14px !important;
  font-size: 14px !important;
  line-height: 1.55 !important;
  word-break: break-word !important;
  box-shadow: var(--shadow-sm) !important;
}
.msg-bubble.other .msg-text {
  background-color: var(--surface) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border) !important;
  border-left: 2.5px solid var(--primary) !important;
  border-radius: 16px 16px 16px 5px !important;
}
.msg-bubble.self .msg-text {
  background-color: var(--primary-soft) !important;
  color: var(--text-primary) !important;
  border: 1px solid #dfe3ea !important;
  border-radius: 16px 16px 5px 16px !important;
}
/* 学习对话 char 气泡书脊线 */
.sb-bubble.ta { border-left: 2.5px solid var(--primary) !important; }
/* 复盘自动日记小钢笔图标 */
.sb-diary-d .sb-pen { width: 13px !important; height: 13px !important; color: var(--primary) !important; vertical-align: -2px !important; margin-right: 3px !important; }

/* 动态 feed：TA 主动发的生活碎片 */
.sb-feed-top { padding: 12px 14px 2px; }
.sb-list { padding: 4px 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.sb-moment { padding: 14px !important; }
.sb-moment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sb-moment-av { width: 30px !important; height: 30px !important; border-radius: 50% !important; object-fit: cover; flex: 0 0 30px; border: 1px solid var(--border); background: var(--surface-2); }
.sb-moment-av--ph { display: inline-flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 14px; }
.sb-moment-name { font-weight: 600; color: var(--text-primary); font-size: 14px; }
.sb-moment-time { margin-left: auto; color: var(--text-secondary); font-size: 12px; }
.sb-moment-text { color: var(--text-primary); font-size: 14px; line-height: 1.6; white-space: pre-wrap; }
.sb-moment-react { display: flex; gap: 8px; margin-top: 10px; }
.sb-react { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-secondary); border-radius: 999px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.sb-react i { font-style: normal; color: var(--primary); margin-left: 2px; }
.sb-react:active { background: var(--primary-soft); }


/* 16. 设置-个人资料（改我自己的昵称+头像） */
.settings-profile-row .sc-avatar {
  width: 40px !important; height: 40px !important; border-radius: 50% !important;
  flex: 0 0 40px !important; background: var(--surface-2) center/cover no-repeat !important;
  border: 1px solid var(--border) !important;
}
.profile-editor { padding: 16px; }
.profile-avatar-box { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 20px; }
.profile-avatar-img {
  width: 88px; height: 88px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--border); background: var(--surface-2); box-shadow: var(--shadow-sm);
}
.profile-avatar-btns { display: flex; gap: 10px; }
.profile-editor .form-group { margin-bottom: 14px; }
.profile-editor label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; }
.profile-editor .form-actions { margin-top: 8px; }
