/* Nyari theme components consume semantic tokens only. appearance.js is
   the resolver for Classic text, accents and wallpaper. These Classic values
   are first-paint fallbacks before the saved state is applied. */
:root {
  --page-top-gap: 2px;
  --theme-background: #F1F4F8;
  --theme-user-bubble-color: #CFE0F1;
  --theme-assistant-bubble-color: #FFFFFF;
  --theme-primary-text-color: #292929;
  --theme-secondary-text-color: #646464;
  --theme-accent-color: #7596B8;
  --bg: #F1F4F8;
  --bg-2: #F8FAFC;
  --panel: #F8FAFC;
  --surface: #F8FAFC;
  --surface-2: #F8FAFC;
  --card: #F8FAFC;
  --card-strong: #FFFFFF;
  --assistant-bubble: #FFFFFF;
  --user-bubble: #CFE0F1;
  --bubble: #CFE0F1;
  --text: #292929;
  --subtext: #646464;
  --muted: #646464;
  --dim: #646464;
  --line: #D7DFE8;
  --line-strong: #D7DFE8;
  --line-soft: #D7DFE8;
  --accent: #7596B8;
  --cache-accent: #7596B8;
  --accent-ink: #FFFFFF;
  --danger: #7A575E;
  --home-ring-1: #8BA7C4;
  --home-ring-2: #646464;
  --home-ring-3: #292929;
  --home-dot: #7596B8;
  --strong-muted: #292929;
  --dark-button: #292929;
  --settings-bg: #F1F4F8;
  --settings-card: #F8FAFC;
  --settings-ink: #292929;
  --settings-soft: #646464;
  --settings-faint: #9A9B9C;
  --settings-line: #D7DFE8;
  --settings-accent: #7596B8;
  --settings-accent-bg: #E0E7EF;
  --settings-green: #7596B8;
  --settings-red: #7A575E;
  /* Whole-app page palette. These are the only tokens chrome, navigation,
     settings and menus consume; appearance.js resolves them for every theme. */
  --page-bg: #F1F4F8;
  --page-card: #F8FAFC;
  --page-text: #292929;
  --page-subtext: #646464;
  --page-line: #D7DFE8;
  --page-accent: #7596B8;
  --page-accent-soft: #E0E7EF;
  --thought-card-bg: #FFFFFF;
  --app-wallpaper: none;
  --home-wallpaper: var(--app-wallpaper);
  --background-blur: 0px;
  --home-background-blur: 0px;
  --veil-overlay: rgba(247,239,239,.20);
  --home-veil-overlay: var(--veil-overlay);  --content-max: 760px;
  --message-font-scale: 1;
  --message-line-height: 1.65;
  --message-spacing: 4px;
  --shell-dock-reserve: calc(58px + env(safe-area-inset-bottom));
  --keyboard-height: 0px;
  --keyboard-translate-y: 0px;
  --visual-viewport-offset-top: 0px;
}

/* 聊天页语义 token。组件只依赖这些名字，不再猜某个通用 surface 应该扮演
   用户气泡还是思考卡。Pink 日间会精确落到用户给出的色卡。 */
:root {
  --page-background: var(--bg);
  --surface-primary: var(--surface);
  --bubble-user: var(--user-bubble, var(--bubble));
  --bubble-assistant: var(--assistant-bubble, var(--surface));
  --bubble-thought: var(--panel, var(--surface-2));
  --text-primary: var(--text);
  --text-secondary: var(--muted);
  --icon-strong: var(--strong-muted, var(--muted));
  --chat-accent: var(--accent);
  --border-divider: var(--line-soft);

  /* 393px 移动端聊天几何：左右头像各占一条固定通道，中间留一字宽。 */
  --side: 11px;
  --avatar: 34px;
  --avatar-gap: 8px;
  --lane-gap: 14px;
  --bubble-max: calc(
    100% - var(--avatar) - var(--avatar)
    - var(--avatar-gap) - var(--avatar-gap)
    - var(--lane-gap)
  );
}

/* 这一行不能删，删了整个 app 就废了。
   `hidden` 属性靠浏览器默认样式的 display:none 生效，而**作者写的 CSS
   永远压过浏览器默认样式**——下面 .gate 有 display:grid、#app 有 display:flex、
   .view 有 display:flex，于是 element.hidden = true 完全失效：
   代码执行了、属性也设上了，东西还是铺满屏幕。
   媛媛因此卡在登录页一整个上午，其实她每次都登录成功了，只是那扇门关不掉。 */
[hidden] { display: none !important; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* 输入框的字号**必须 ≥16px**，一个都不能漏。
   iOS 的规矩：只要点中的输入框字号小于 16，Safari 就自动把整页放大凑够 16 ——
   媛媛每打一个字页面就窜一下，编辑记忆、改 profile、聊天全中招。
   这不是"缩放没关掉"，是字号太小逼出来的。所以别在下面任何地方
   给 input / textarea / select 写小于 16px 的字号。 */
input, textarea, select { font-size: 16px; }

/* 长按 iOS 先蹦出来的是自己那套"拷贝 / 查询 / 翻译"，我们的小卡片被压在下面。
   上一版只给那几个元素关了选择，结果更糟：iOS 找不到能选的东西就一路往上找，
   把整个页面全选中了 —— 媛媛看到的是满屏发蓝。
   所以得反过来：**整页默认不许选**，只在她真要复制的地方开口子。 */
body {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
/* 开口子的地方：详情面板里的消息原文、所有输入框。
   聊天气泡本身留给长按菜单；需要逐字选择时，从菜单打开 Select text。 */
.sheet-body, .message-selectable, .modal-body p, input, textarea, [contenteditable] {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

html, body {
  margin: 0;
  /* 整页不许滚、不许橡皮筋。
     所有该滚的地方（聊天流、列表、面板正文）自己是滚动容器，
     文档本身一动不动 —— 不然拖面板的时候后面的聊天跟着一起动 */
  overflow: hidden; overscroll-behavior: none;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  /* 15px 是界面骨架的字号；聊天正文另外压到 14px。
     媛媛数过：官方一行 24 个汉字，原来 16px 只能排 21 个，看着别扭。
     375 屏宽减掉两边 16px 内边距 = 343，343÷24 ≈ 14。 */
  font-size: 15px; line-height: 1.62;
  /* 不要 -webkit-font-smoothing: antialiased。
     它会把笔画磨细，中文尤其明显 —— 字号明明比官方还大一点点，
     看着却更小更瘦。去掉之后走系统默认（次像素），笔画就实了。 */
}
html.standalone-shell,
html.standalone-shell body { height: 100vh; }
html { background: var(--page-bg); }
body { background: var(--page-bg); isolation: isolate; }
body::before, body::after {
  display: none;
}
#app-wallpaper-layer {
  position: fixed; z-index: 0; top: 0; left: 0; right: 0; height: 100dvh;
  overflow: hidden; pointer-events: none;
  background: var(--page-bg);
}
html.standalone-shell #app-wallpaper-layer { height: 100vh; }
#app-wallpaper-layer::before,
#app-wallpaper-layer::after {
  content: ""; position: absolute; pointer-events: none;
}
#app-wallpaper-layer::before {
  z-index: 0; inset: -24px;
  background-color: var(--page-bg); background-image: var(--app-wallpaper);
  background-position: center; background-size: cover; background-repeat: no-repeat;
  filter: blur(var(--background-blur));
}
#app-wallpaper-layer::after { z-index: 1; inset: 0; background: var(--veil-overlay); }
html[data-app-view="home"] #app-wallpaper-layer::before {
  background-image: var(--home-wallpaper); filter: blur(var(--home-background-blur));
}
html[data-app-view="home"] #app-wallpaper-layer::after { background: var(--home-veil-overlay); }
/* Settings is a real full-screen route too. Its pixels come from the same
   fixed layer as every other page, so the iOS status bar never exposes a
   second white/pink strip above it. */
html[data-app-view="settings"] #app-wallpaper-layer::before {
  background-color: var(--settings-bg,var(--bg)); background-image: none; filter: none;
}
html[data-app-view="settings"] #app-wallpaper-layer::after { background: transparent; }

/* Full-screen routes no longer repaint their own wallpaper. One fixed layer is
   the sole source of pixels behind the iOS status bar and the bottom safe area. */
.gate::before, .gate::after,
.view::before, .view::after,
.conversation-panel::before, .conversation-panel::after,
.appearance-screen::before, .appearance-screen::after { display: none; }

/* Each route owns its wallpaper and readability veil; controls use opaque
   Classic surfaces while layout wrappers remain transparent. */
.gate, .view, .conversation-panel, .sheet, .model-picker, .modal, .popover, .confirm,
.appearance-screen { isolation: isolate; }
.gate::before, .view::before, .conversation-panel::before, .sheet::before,
.model-picker::before, .modal::before, .popover::before, .confirm::before,
.appearance-screen::before,
.gate::after, .view::after, .conversation-panel::after, .sheet::after,
.model-picker::after, .modal::after, .popover::after, .confirm::after,
.appearance-screen::after {
  content: ""; position: absolute; pointer-events: none;
}
.gate::before, .view::before, .conversation-panel::before, .sheet::before,
.model-picker::before, .modal::before, .popover::before, .confirm::before,
.appearance-screen::before {
  z-index: -2; inset: -24px;
  background-color: var(--page-bg); background-image: var(--app-wallpaper);
  background-position: center; background-size: cover; background-repeat: no-repeat;
  filter: blur(var(--background-blur));
}
.gate::after, .view::after, .conversation-panel::after, .sheet::after,
.model-picker::after, .modal::after, .popover::after, .confirm::after,
.appearance-screen::after {
  z-index: -1; inset: 0; background: var(--veil-overlay);
}
#view-home::before { background-image: var(--home-wallpaper); filter: blur(var(--home-background-blur)); }
#view-home::after { background: var(--home-veil-overlay); }

/* Claude 的字标是衬线。这里用系统自带的衬线拼一套气质相近的，
   不下载字体文件 —— 中文字体动辄好几兆，手机上加载会卡 */
.brand, h2, h3, .sheet-head h3 {
  font-family: Georgia, "Times New Roman", "Songti SC", "Noto Serif SC", serif;
  font-weight: 500; letter-spacing: .01em;
}

.sprite { position: absolute; width: 0; height: 0; }
.ke-glint { fill: var(--bg); }
/* 1.8 的笔画比官方粗，看着"生硬"。收到 1.6，转角一律圆的 */
.i { width: 20px; height: 20px; fill: none; stroke: currentColor;
     stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i .solid-dot { fill: currentColor; stroke: none; }
.spacer { width: 34px; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-size: 14px; }

/* ─────────────────────────────────────────────── Gate */
.gate { position: fixed; top: 0; left: 0; right: 0; height: 100dvh; display: grid; place-items: center;
        background: transparent; padding: 24px; z-index: 60; }
html.standalone-shell .gate { height: 100vh; }
.gate-inner { width: 100%; max-width: 320px; text-align: center; }
.gate-ke { width: 76px; height: 60px; color: var(--accent); margin-bottom: 18px; }
.gate .brand { font-size: 30px; margin: 0 0 4px; }
.gate .muted { font-size: 14px; margin: 0 0 28px; }
.gate input {
  width: 100%; padding: 13px 15px; margin-bottom: 10px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; font-size: 16px;
}
.gate input:focus { outline: none; border-color: var(--accent); }

.primary-btn {
  width: 100%; padding: 13px; border: none; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 16px; font-weight: 600; cursor: pointer;
}
.primary-btn:active { opacity: .82; }

/* ─────────────────────────────────────────────── Shell */
/* 防 iOS 主屏幕底部 59px 白边：无论以后怎么改布局都不要删除或改回 inset/dvh/innerHeight。
   不要把 standalone 改回 inset:0 / bottom:0 / 100dvh / innerHeight。
   这台 iPhone 的主屏幕模式会把它们都算成「屏幕高 - 状态栏」(793px)，
   只有 100vh 是完整屏幕 852px。浏览器模式才使用动态的 100dvh。 */
#app {
  position: fixed; z-index: 1; top: 0; left: 0; right: 0; height: 100dvh;
  display: flex; overflow: hidden; background: transparent;
}
html.standalone-shell #app { height: 100vh; }
html.keyboard-open #app {
  transform: translate3d(0,var(--visual-viewport-offset-top),0);
}
/* Native iOS caret shares layout coordinates: chat uses real insets, not a
   composited keyboard transform. Other pages retain their existing behavior. */
html.keyboard-open[data-app-view="chat"] #app {
  top:var(--visual-viewport-offset-top); transform:none;
}

/* 主屏幕模式的 iOS 边缘返回。Safari 自己有原生手势，所以 JS 只会在
   standalone 下加这些状态类；普通浏览器永远不会接管横向触摸。 */
.edge-back-underlay, .conversation-panel.is-open.edge-back-underlay {
  position: absolute !important; z-index: 70 !important; inset: 0 !important;
  overflow: hidden; visibility: visible !important; pointer-events: none !important;
  background: var(--page-bg); color: var(--page-text); transition: none;
  transform: translate3d(var(--edge-preview-x,-30vw),0,0);
  will-change: transform;
}
.edge-back-underlay-shade {
  position: absolute; z-index: 70; inset: 0; pointer-events: none;
  background: rgb(0 0 0 / var(--edge-underlay-dim,.18));
  transform: translate3d(var(--edge-preview-x,-30vw),0,0);
  will-change: transform, background;
}
/* One existing dock belongs to the one real Chats underlay, never a clone.
   Do not reserve dock height on the moving chat/composer. */
body.edge-back-active .conversation-panel.edge-back-underlay { bottom:var(--shell-dock-reserve) !important; }
body.edge-back-active .bottom-nav-dock {
  z-index:70; pointer-events:none; transform:translate3d(var(--edge-preview-x,-30vw),0,0);
  transition:none; will-change:transform;
}
.edge-back-moving {
  position: absolute !important; z-index: 71 !important; inset: 0 !important;
  transform: translate3d(var(--edge-back-x,0),0,0);
  opacity: 1; background-color: var(--edge-current-bg,var(--page-bg));
  background-image:
    linear-gradient(var(--edge-current-veil,transparent),var(--edge-current-veil,transparent)),
    var(--edge-current-wallpaper,none);
  background-position: center; background-size: cover; background-repeat: no-repeat;
  box-shadow: -18px 0 34px rgba(0,0,0,var(--edge-shadow,.22));
  will-change: transform;
}
body.edge-back-active.edge-back-settling .edge-back-moving,
body.edge-back-active.edge-back-settling .edge-back-underlay,
body.edge-back-active.edge-back-settling .edge-back-underlay-shade {
  transition: transform var(--edge-transition,.3s cubic-bezier(.2,.8,.2,1)),
              box-shadow var(--edge-transition,.3s cubic-bezier(.2,.8,.2,1)),
              background var(--edge-transition,.3s cubic-bezier(.2,.8,.2,1));
}
body.edge-back-active.edge-back-settling .bottom-nav-dock { transition:transform var(--edge-transition,.3s cubic-bezier(.2,.8,.2,1)); }

.scrim { position: absolute; inset: 0; background: rgba(0,0,0,.42); z-index: 47; }

.conversation-panel {
  position: absolute; inset: 0; z-index: 48;
  display: flex; flex-direction: column; overflow: hidden;
  padding-top: 0;
  padding-bottom: 0;
  background: transparent;
  transform: translateX(-102%); transition: transform .24s cubic-bezier(.32,.72,0,1);
  visibility: hidden; pointer-events: none;
  box-shadow: none;
}
.conversation-panel.is-open { transform: none; visibility: visible; pointer-events: auto; }
.conversation-panel.is-tab-root { transform:none; transition:none; }
.conversation-panel-head {
  flex: none; min-height: 0; padding: calc(env(safe-area-inset-top) + var(--page-top-gap)) 18px 8px;
  display: flex; flex-direction: column; align-items: stretch; gap: 10px;
  background:var(--page-bg);
}
.conversation-panel-tools {
  min-height: 46px; display: flex; align-items: center; justify-content: space-between;
}
.conversation-panel-head h2 {
  margin: 0; font-size: 32px; line-height: 1.08; letter-spacing: -.035em;
}
.chat-list-actions {
  min-width: 104px; height: 46px; padding: 3px 5px;
  display: grid; grid-template-columns: 43px 1px 43px; align-items: center;
  border: 1px solid var(--page-line); border-radius: 23px;
  background: var(--page-accent-soft); color: var(--page-text);
  box-shadow: 0 8px 28px rgba(0,0,0,.07);
}
.chat-list-action {
  width: 43px; height: 40px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 20px; background: transparent; color: inherit; cursor: pointer;
}
.chat-list-action:active { background: var(--page-card); }
.chat-list-action .i { width: 22px; height: 22px; stroke-width: 1.9; }
.chat-list-action-divider { width: 1px; height: 23px; background: var(--page-line); }
.chat-list-search {
  min-height: 42px; display: grid; grid-template-columns: minmax(0,1fr) auto;
  align-items: center; gap: 10px; animation: chat-search-in .2s ease both;
}
.chat-list-search[hidden] { display: none; }
.chat-list-search-field {
  height: 42px; padding: 0 13px; display: flex; align-items: center; gap: 8px;
  border-radius: 15px; background: var(--page-accent-soft); color: var(--page-subtext);
}
.chat-list-search-field .i { width: 18px; height: 18px; flex: none; stroke-width: 1.8; }
.chat-list-search-field input {
  min-width: 0; width: 100%; padding: 0; border: 0; outline: 0;
  background: transparent; color: var(--page-text); font: inherit; font-size: 16px;
}
.chat-list-search-field input::-webkit-search-cancel-button { display: none; }
#chat-list-search-cancel {
  padding: 8px 0; border: 0; background: transparent; color: var(--page-accent);
  font: inherit; font-size: 15px; cursor: pointer;
}
@keyframes chat-search-in {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
.conversation-recents {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 4px 12px 16px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}

.recent {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 0; padding: 12px 6px; border: none; border-radius: 18px; background: none;
  color: var(--page-text); font-size: 15px; cursor: pointer; text-align: left;
  font-family: inherit;
  overflow: hidden;
}
.recent:active, .recent.is-on { background: var(--page-accent-soft); }
.recent-copy { flex: 1; min-width: 0; display: block; }
.recent-title-row { display: flex; min-width: 0; align-items: center; gap: 7px; }
.recent-title { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; font-weight: 600; }
.recent-unread {
  width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; background: var(--accent);
}
.recent-snippet { display: block; margin-top: 4px; overflow: hidden; color: var(--dim); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.recent-time { align-self: flex-start; margin-top: 5px; color: var(--dim); font-size: 11.5px; white-space: nowrap; }
.recent-search-empty {
  margin: 22px 12px; color: var(--dim); font-size: 14px; text-align: center;
}


/* ─────────────────────────────────────────────── Main */
.main {
  position: relative; flex: 1; display: flex; flex-direction: column; min-width: 0;
  padding-bottom: 0;
}
#app.is-chat-immersive .main { padding-bottom: 0; }
#app.has-bottom-nav .main { padding-bottom: var(--shell-dock-reserve); }
#app.has-bottom-nav .conversation-panel,
#app.has-bottom-nav #settings { bottom: var(--shell-dock-reserve); }

/* 不是标题栏：只有两个各自悬浮的必要入口，中间整段保持空白。 */
.floating-controls {
  position: absolute; z-index: 12; pointer-events: none;
  top: calc(var(--page-top-gap) + env(safe-area-inset-top)); left: 12px; right: 12px;
  display: flex; align-items: center;
}
.floating-controls > * { pointer-events: auto; }
.floating-spacer { flex: 1; pointer-events: none; }
.chat-shell-title {
  position: absolute; left: 58px; right: 58px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text); font-size: 14px; font-weight: 550; text-align: center;
  line-height: 44px; pointer-events: none;
}

.bottom-nav-dock {
  position: absolute; z-index: 58; left: 0; right: 0; bottom: 0;
  height: var(--shell-dock-reserve); padding: 0 16px env(safe-area-inset-bottom);
  display: flex; align-items: flex-start; justify-content: center;
  background: var(--page-bg);
}
.bottom-nav {
  position: relative; width: min(100%, 398px); min-height: 58px;
  display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 4px;
  padding: 6px;
  border: 1px solid var(--page-line); border-radius: 999px;
  background: var(--page-bg);
  box-shadow: 0 14px 38px rgba(0,0,0,.15);
  }
.bottom-nav-item {
  appearance: none; min-width: 0; min-height: 46px; padding: 8px 4px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px; background: transparent; color: var(--page-subtext);
  font: inherit; cursor: pointer;
}
.bottom-nav-item .i { display: none; }
.bottom-nav-item span { font-size: 13px; line-height: 1.2; }
.bottom-nav-item.is-on { background: var(--page-accent-soft); color: var(--page-text); }
.bottom-nav-item:active { transform: scale(.97); }

.icon-btn {
  width: 44px; height: 44px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--border-divider); border-radius: 50%;
  background: var(--bubble-assistant); color: var(--icon-strong); cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }
.round-btn {
  width: 34px; height: 34px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); border-radius: 50%;
  background: none; color: var(--text); cursor: pointer;
}

.view { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: clip; }
.page { padding-top: calc(56px + var(--page-top-gap) + env(safe-area-inset-top)); }

/* ─────────────────────────────────────────────── Thread */
.thread {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: calc(60px + var(--page-top-gap) + env(safe-area-inset-top)) var(--side) 14px;
  display: flex; flex-direction: column; gap: 0;
  overscroll-behavior: contain;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "SF Pro Text",
               "Helvetica Neue", Arial, sans-serif;
}

.empty {
  margin: auto; text-align: center; color: var(--muted);
  display: flex; flex-direction: column; align-items: center;
  transform: translateY(-3dvh);
}
.empty h2 {
  margin: 0; color: var(--text); font-size: 22px; font-weight: 500;
  font-family: ui-serif, "New York", "New York Small", "New York Medium",
               "Iowan Old Style", Georgia, "Times New Roman", serif;
  letter-spacing: -.04em;
}

/* 两个人各站一侧：头像留在气泡外，最长气泡之间仍保留约一个中文字。 */
.msg { width: 100%; flex: none; transition: transform .18s ease; }
.message-row {
  width: 100%; display: flex; align-items: flex-start; gap: var(--avatar-gap);
}
.message-stack {
  min-width: 0; max-width: var(--bubble-max);
  display: flex; flex-direction: column;
}
.message-avatar {
  width: var(--avatar); height: var(--avatar); flex: 0 0 var(--avatar);
  margin-top: 1px; display: grid; place-items: center;
  border: 1px solid var(--border-divider); border-radius: 50%;
  font-size: 12px; font-weight: 650; line-height: 1;
  position: relative; overflow: hidden;
}
.avatar-image {
  position: absolute; inset: 0; width: 100%; height: 100%;
  min-width: 0; min-height: 0; max-width: 100%; max-height: 100%;
  display: block; object-fit: cover; object-position: center; border-radius: inherit;
}
.message-avatar.user {
  background: var(--bubble-user); color: var(--text-primary);
}
.message-avatar.assistant {
  background: var(--text-primary); color: var(--surface-primary);
}
.chat-bubble:not(.bub) {
  width: fit-content; max-width: 100%;
  padding: 7px 12px; border-radius: 19px;
  font-size: calc(14.7px * var(--message-font-scale)); line-height: var(--message-line-height); font-weight: 400;
  letter-spacing: -.012em; word-break: break-word; overflow-wrap: anywhere;
}
.msg-user {
  display: flex; justify-content: flex-end; align-items: flex-start;
  gap: var(--avatar-gap); margin-bottom: var(--message-spacing);
}
.msg-user .message-stack { align-items: flex-end; }
.msg-user .chat-bubble:not(.bub) {
  background: var(--bubble-user); color: var(--text-primary);
  border: 1px solid var(--page-line);
  white-space: pre-wrap;
}
.msg-ai { margin-bottom: var(--message-spacing); }
.assistant-reply { justify-content: flex-start; }
.msg-ai .body:not(.bub) {
  background: var(--bubble-assistant); color: var(--text-primary);
  border: 1px solid var(--border-divider);
  white-space: pre-wrap;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.msg-ai .body:empty { display: none; }
.msg-ai .body.error-message { color: var(--danger); }
.msg-ai .body p { margin: 0 0 .85em; }
.msg-ai .body p:last-child { margin-bottom: 0; }
.msg-ai .body strong { font-weight: 650; }
.msg-ai .body code { background: var(--page-background); border-radius: 5px;
                     padding: 1px 5px; font-size: .92em; }
.msg-ai .body pre { background: var(--page-background); border: 1px solid var(--line-soft);
                    border-radius: 10px; padding: 12px; overflow-x: auto; }
.msg-ai .body pre code { background: none; padding: 0; }
.message-meta {
  margin-top: 3px; padding: 0 4px;
  color: var(--dim); font-size: 10.5px; line-height: 14px;
  font-variant-numeric: tabular-nums;
}
.message-model-name {
  display: none; margin-top: 3px; padding: 0 4px; color: var(--dim);
  font-size: 10.5px; line-height: 14px; overflow-wrap: anywhere;
}
html[data-model-name-messages="true"] .message-model-name { display: block; }

/* 操作与账单不常驻聊天流。以下按钮只在长按后的 popover / 详情面板中使用。 */
.msg-actions { display: none; }
.act { width: 24px; height: 30px; display: grid; place-items: center;
       border: none; border-radius: 8px; background: none;
       color: var(--dim); cursor: pointer; }
.act:active { background: var(--surface); color: var(--text); }
.act .i { width: 19px; height: 19px; stroke-width: 1.8; }
.act.is-decorative { cursor: default; }
.act.is-decorative:active { background: none; color: var(--dim); }
.act .copy-front { fill: var(--bg); }
.act .retry-head { fill: currentColor; stroke: none; }

/* Reasoning stays a single, calm entry in the transcript. The full trace opens
   in the shared half-height sheet and can be pulled to full screen. */
.reasoning-wrap {
  margin: 0 0 8px calc(var(--avatar) + var(--avatar-gap));
  max-width: var(--bubble-max);
}
.reasoning-section, .message-segment { touch-action: pan-y; }
.reasoning-section {
  -webkit-user-select: none;
  user-select: none;
}
.assistant-turn .message-segment + .message-segment { margin-top: 4px; }
.assistant-turn .message-segment.segment-prose + .message-segment,
.assistant-turn .message-segment + .message-segment.segment-prose { margin-top: 8px; }
.msg-ai .body.segment-prose:not(.bub) {
  width: 100%; padding: 5px 2px; border: 0; border-radius: 0;
  background: transparent; white-space: normal;
}
html[data-user-message="prose"] .msg-user .chat-bubble:not(.bub) {
  padding: 5px 2px; border: 0; border-radius: 0; background: transparent;
}
html[data-assistant-message="bubble"] .msg-ai .body.segment-prose:not(.bub) {
  width: fit-content; padding: 7px 12px; border: 1px solid var(--border-divider);
  border-radius: 19px; background: var(--bubble-assistant); white-space: pre-wrap;
}
html[data-assistant-message="prose"] .msg-ai .body.segment-bubble:not(.bub) {
  width: 100%; padding: 5px 2px; border: 0; border-radius: 0;
  background: transparent; white-space: normal;
}
html[data-assistant-whole-bubble="true"]:not([data-layout-preset="classic"]) .assistant-message-column {
  padding: 7px 12px; border: 1px solid var(--border-divider); border-radius: 19px;
  background: var(--bubble-assistant);
}
html[data-assistant-whole-bubble="true"]:not([data-layout-preset="classic"]) .assistant-message-column .body {
  width: 100%; padding: 0; border: 0; border-radius: 0; background: transparent;
}
html[data-show-avatars="false"] { --avatar: 0px; --avatar-gap: 0px; }
html[data-show-avatars="false"] .message-avatar { display: none; }
html[data-show-timestamps="false"] .message-meta { display: none; }
html[data-show-reasoning="false"] .reasoning-wrap { display: none; }
html[data-show-tokens="false"] .tokens { display: none; }
html[data-show-tokens="false"] .message-detail-section[data-section="usage"] { display: none; }
html[data-model-name-composer="false"] #composer-model { display: none; }
html[data-model-name-details="false"] .message-detail-row[data-detail="model"] { display: none; }
.reasoning-toggle {
  appearance: none; width: 100%; max-width: 100%; min-height: 38px; margin: 0; padding: 7px 0; border: 0;
  display: flex; align-items: center; gap: 5px;
  background: transparent; color: var(--text-secondary);
  opacity: .72; font: inherit; text-align: left; cursor: pointer;
}
.reasoning-clock { width: 18px; height: 18px; flex: none; }
.reasoning-summary {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px; line-height: 17px;
}
.reasoning-toggle .chev {
  width: 14px; height: 14px; flex: none; opacity: .7;
}
.reasoning-toggle:focus-visible,
.process-event-main:focus-visible,
.model-picker-nav:focus-visible {
  outline: 1px solid var(--line-strong, var(--line)); outline-offset: 2px;
}

/* Phase 3 process timeline: an inline document-flow region, never an overlay. */
.process-wrap { margin-bottom: 5px; }
.process-head { width: 100%; min-height: 24px; }
.process-head .reasoning-summary { flex: 1; }
.process-timeline { position: relative; padding: 2px 0 2px 1px; }
.process-timeline::before {
  content: ""; position: absolute; left: 10px; top: 13px; bottom: 13px;
  width: 1px; background: var(--border-divider);
}
.process-event { position: relative; display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 7px; }
.process-event + .process-event { margin-top: 5px; }
.process-event-icon {
  z-index: 1; width: 22px; height: 22px; display: grid; place-items: center;
  border: 1px solid var(--border-divider); border-radius: 50%;
  background: var(--page-background); color: var(--text-secondary);
}
.process-event-icon .i { width: 12px; height: 12px; stroke-width: 1.8; }
.process-event.is-running .process-event-icon { animation: think-pulse 1.4s ease-in-out infinite; }
.process-event.is-failed .process-event-icon { color: var(--danger); }
.process-event-main {
  min-width: 0; min-height: 22px; padding: 1px 0; border: 0; background: transparent;
  color: var(--text-secondary); text-align: left; font: inherit; touch-action: pan-y;
}
button.process-event-main { cursor: pointer; }
.process-event-line { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.process-event-label {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-primary); font-size: 12.8px; line-height: 19px;
}
.process-event-state { flex: none; color: var(--dim); font-size: 10.8px; }

/* The model chooser is a compact, fixed mobile sheet with no scaling transform. */
.model-picker { position: absolute; inset: 0; z-index: 62; }
.model-picker-scrim {
  position: absolute; inset: 0; width: 100%; border: 0; padding: 0;
  background: rgba(48,41,44,.28);
}
.model-picker-card {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: min(78dvh, 650px);
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line-strong, var(--line)); border-bottom: 0;
  border-radius: 24px 24px 0 0; background: var(--bg-2, var(--surface));
  padding-bottom: env(safe-area-inset-bottom);
}
html.standalone-shell .model-picker-card { max-height: min(78vh, 650px); }
.model-picker-grab {
  width: 38px; height: 4px; flex: none; margin: 9px auto 2px;
  border-radius: 999px; background: var(--line-strong, var(--line));
}
.model-picker-head {
  min-height: 46px; display: grid; grid-template-columns: 36px minmax(0,1fr) 36px;
  align-items: center; gap: 7px; padding: 3px 16px 7px;
}
.model-picker-head h3 { margin: 0; text-align: center; font-size: 16.5px; font-weight: 650; }
.model-picker-nav {
  width: 34px; height: 34px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text); cursor: pointer;
}
.model-picker-nav .i { width: 18px; height: 18px; }
#model-picker-back[hidden] { display: grid !important; visibility: hidden; pointer-events: none; }
.model-picker-body {
  min-height: 0; overflow-y: auto; padding: 4px 16px 22px;
  overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
}

/* 工具留痕只会在长按后的 Details 中出现；保留这条样式给详情行使用。 */
   /* 连着好几行留痕时别撑太开 */

.nyari-loading { min-height: 36px; display: flex; align-items: center; padding: 1px 0; }
.nyari-glyph { width: 40px; height: 40px; display: block; overflow: visible;
                   flex: none; color: var(--accent); }
.nyari-glyph circle { stroke: currentColor; stroke-linecap: round;
                          transform-box: fill-box; transform-origin: center; }
.nyari-glyph .dot { fill: currentColor; stroke: none; }
/* 静态落款是动画自然收尾后的朝向，不是随手截一帧。 */
.nyari-glyph:not(.is-loading) .r1 { transform: rotate(-47deg); }
.nyari-glyph:not(.is-loading) .r2 { transform: rotate(-53.3deg); }
.nyari-glyph:not(.is-loading) .r3 { transform: rotate(-43.8deg); }


/* ─────────────────────────────────────────────── Composer */
.composer-wrap {
  padding: 8px 10px 14px;
  background: color-mix(in srgb, var(--bg) 24%, transparent);
  }
.pending { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.chip { display: flex; align-items: center; gap: 6px; font-size: 12.5px;
        background: var(--surface); border: 1px solid var(--line);
        border-radius: 8px; padding: 5px 9px; color: var(--muted); }
.chip button { border: none; background: none; color: var(--dim); cursor: pointer;
               font-size: 15px; line-height: 1; padding: 0; }

.composer {
  min-height: 44px; display: flex; align-items: flex-start; gap: 8px;
}
.composer-main {
  flex: 1; min-width: 0; min-height: 44px; max-height: 108px;
  display: flex; align-items: flex-start;
  padding: 0 14px;
  background: var(--bubble-assistant); border: 1px solid var(--border-divider);
  border-radius: 22px;
}
.composer textarea {
  width: 100%; min-height: 42px; max-height: 106px; border: none; resize: none;
  overflow-y: auto;
  background: none; color: var(--text-primary); font: inherit;
  padding: 11px 0 9px; line-height: 20px;
  /* font:inherit 是简写，会把上面那条 16px 一起冲掉（继承来的是 body 的 15px）。
     所以必须写在它后面再补一次 —— 少这一行，一点输入框整页就窜 */
  font-size: 16px;
}
.composer textarea:focus { outline: none; }
.composer-button {
  appearance: none; width: 44px; height: 44px; flex: 0 0 auto;
  padding: 0; display: grid; place-items: center;
  border: 1px solid var(--border-divider); border-radius: 50%;
  background: var(--bubble-assistant); color: var(--text-primary); cursor: pointer;
}
.composer-button:active { transform: scale(.97); }
.composer-model .i {
  width: 25px; height: 25px; stroke-width: 1.72;
}
.composer-add .i {
  width: 22px; height: 22px; stroke-width: 1.62;
  transform: scaleY(.88); transform-origin: center;
}
.composer-send .i {
  width: 25px; height: 25px; stroke-width: 1.78;
}
.send { background: var(--bubble-assistant); color: var(--text-primary); }
.send:disabled { opacity: .4; }

/* ─────────────────────────────────────────────── Pages */
.page { flex: 1; min-height: 0; overflow-y: auto;
        padding: calc(60px + var(--page-top-gap) + env(safe-area-inset-top)) 18px
          16px; }
.page-head { display: flex; align-items: center; justify-content: space-between;
             margin-bottom: 12px; }
.page-head h2 { font-size: 25px; margin: 0; }
.ghost-btn { border: 1px solid var(--line); border-radius: 999px;
             background: none; color: var(--text); padding: 7px 15px;
             font-size: 14px; cursor: pointer; font-family: inherit; }
.search { width: 100%; padding: 11px 14px; margin-bottom: 14px;
          background: var(--surface); border: 1px solid var(--line);
          border-radius: 12px; color: var(--text); font: inherit;
          font-size: 16px; }   /* 同上：font:inherit 会冲掉 16px，得补回来 */
.search:focus { outline: none; border-color: var(--accent); }

.list { display: flex; flex-direction: column; gap: 9px; }
.card { background: var(--surface); border: 1px solid var(--line-soft);
        border-radius: 14px; padding: 13px 15px; cursor: pointer; }
.card:active { background: var(--surface-2); }
.card h4 { margin: 0 0 5px; font-size: 15.5px; font-weight: 600; }
.card .peek { margin: 0; color: var(--muted); font-size: 14px;
              display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
              overflow: hidden; }
.card .meta { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px;
              align-items: center; color: var(--dim); font-size: 12px; }
.tag { border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.card.unread { border-color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

.empty-note { color: var(--dim); text-align: center; padding: 40px 0; }

/* ─────────────────────────────────────────────── Home hub / Diary / Notes */
.hub-page { padding-bottom: 16px; }
.home-dashboard-page { width: min(100%, 760px); }
.hub-subhead p {
  margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45;
}
.home-widget-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.home-date-card {
  appearance: none; min-height: 176px; padding: 16px; display: flex; flex-direction: column;
  align-items: flex-start; border: 1px solid var(--line-soft); border-radius: 24px;
  background: linear-gradient(145deg,color-mix(in srgb,var(--surface) 90%,transparent),color-mix(in srgb,var(--bubble-assistant) 66%,transparent));
  color: var(--text); font: inherit; text-align: left; cursor: pointer; overflow: hidden;
  box-shadow: 0 10px 28px color-mix(in srgb,#000 9%,transparent);
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  transition: transform .16s cubic-bezier(.2,.8,.2,1);
}
.home-date-card.is-pressing { transform: scale(.975); }
.home-date-month { color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.home-date-card > strong { margin: 9px 0 -2px; font-size: clamp(50px,14vw,68px); line-height: .95; font-weight: 400; letter-spacing: -.07em; }
.home-date-weekday { color: var(--text); font-size: 11px; font-weight: 650; letter-spacing: .13em; }

/* Retained Home image/calendar dashboard: a fixed four-column square grid. */
.home-dashboard-page {
  --home-gap: 14px;
  --home-unit: calc((min(100vw, 430px) - 32px - (3 * var(--home-gap))) / 4);
  width: min(100%, 430px); margin: 0 auto;
  padding: calc(var(--page-top-gap) + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.home-quote { padding: 0 4px 18px; }
.home-quote p {
  margin: 0; color: #3a3936;
  font-family: "Snell Roundhand", "Great Vibes", "Segoe Script", "Brush Script MT", cursive;
  font-size: min(25px, 5.4vw); font-weight: 400; line-height: 1.45;
  letter-spacing: -.035em; white-space: nowrap;
}
.home-quote-signature {
  display: block; margin-top: 2px; color: #8b8a85; text-align: right;
  font-family: "Snell Roundhand", "Great Vibes", "Segoe Script", "Brush Script MT", cursive; font-size: 17px;
}
.home-widget-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr));
  grid-auto-rows: var(--home-unit); gap: var(--home-gap); align-items: stretch;
}
.home-grid-card {
  min-width: 0; min-height: 0; position: relative; overflow: hidden;
  border: 0; border-radius: 26px; background: var(--surface); color: var(--text);
  box-shadow: 0 1px 0 var(--line-soft); font: inherit; text-align: left;
}
button.home-grid-card { appearance: none; cursor: pointer; }
button.home-grid-card:active { transform: scale(.985); }
.home-date-card {
  grid-column: 1 / 3; grid-row: 1 / span 2; min-height: 0; padding: 16px 18px;
  display: flex; flex-direction: column; align-items: flex-start;
  border: 0; border-radius: 26px; color: #fff;
  background-color: #c9c7c1; background-position: center; background-size: cover;
  box-shadow: 0 1px 0 var(--line-soft); cursor: pointer; touch-action: manipulation;
}
.home-date-card::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(180deg,rgba(0,0,0,.04),rgba(0,0,0,.3));
}
.home-date-card > * { position: relative; z-index: 1; }
.home-date-day { font-size: 54px; font-weight: 300; line-height: .95; letter-spacing: -.03em; }
.home-date-weekday { margin-top: 6px; color: inherit; font-size: 14px; font-weight: 650; letter-spacing: .12em; }
.home-date-month { margin-top: 3px; color: inherit; font-size: 12px; font-weight: 500; letter-spacing: 0; opacity: .86; }
.home-memory-card {
  grid-column: 3; grid-row: 1 / span 2; padding: 16px 10px;
  border-radius: 999px; background: #1c1c1a; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center;
}
.home-memory-icon {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(255,255,255,.12); font-size: 18px;
}
.home-memory-copy strong, .home-memory-copy small { display: block; }
.home-memory-copy strong { font-size: 13px; }
.home-memory-copy small { margin-top: 3px; color: rgba(255,255,255,.64); font-size: 11px; }
.home-memory-arrow { color: rgba(255,255,255,.64); font-size: 16px; }
.home-deco-card {
  background-color: var(--surface-2); background-position: center; background-size: cover;
  cursor: pointer; touch-action: manipulation;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none;
  transition: transform .16s cubic-bezier(.2,.8,.2,1);
}
.home-deco-card.is-pressing { transform: scale(.975); }
.home-deco-small { grid-column: 4; grid-row: 1; }
.home-deco-large { grid-column: 3 / 5; grid-row: 3 / span 2; }
.home-image-placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 8px;
  color: var(--dim); font-size: 11px; line-height: 1.4; text-align: center;
}
.home-grid-card.has-local-image .home-image-placeholder { display: none; }
.home-diary-card {
  grid-column: 4; grid-row: 2; padding: 12px;
  display: flex; flex-direction: column; justify-content: space-between;
  border-radius: 22px;
}
.home-diary-icon, .home-letter-icon {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface-2); font-size: 14px;
}
.home-diary-card strong { font-size: 13px; }
.home-letter-card {
  grid-column: 1 / 3; grid-row: 3; padding: 0 16px;
  display: flex; align-items: center; gap: 12px; border-radius: 999px;
}
.home-letter-icon { width: 40px; height: 40px; flex: 0 0 40px; font-size: 17px; }
.home-letter-card strong, .home-letter-card small { display: block; }
.home-letter-card strong { font-size: 15px; }
.home-letter-card small { margin-top: 2px; color: var(--dim); font-size: 11px; }
.home-empty-slot {
  display: grid; place-items: center; border: 2px dashed var(--line-soft);
  background: transparent; box-shadow: none; color: var(--dim); text-align: center;
}
.home-empty-slot-a { grid-column: 1; grid-row: 4; border-radius: 22px; }
.home-empty-slot-b { grid-column: 2; grid-row: 4; border-radius: 999px; }
.home-empty-slot span, .home-empty-slot small { display: block; }
.home-empty-slot span { color: color-mix(in srgb,var(--dim) 62%,transparent); font-size: 18px; line-height: 1; }
.home-empty-slot small { margin-top: 3px; font-size: 11px; }

.hub-subhead {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px; min-height: 44px; align-items: center;
}
.hub-subhead > h2 { text-align: center; }
.hub-subhead > div { min-width: 0; }
.hub-subhead > div h2 { margin: 0; font-size: 25px; line-height: 1.2; }
.hub-back { width: 44px; height: 44px; }

/* Home 的二级页跟 Settings 子页共用同一套固定感顶栏：安全区只在这里
   计算一次，下面只有内容滚动，返回键永远不会钻进状态栏。 */
#view-diary .page, #view-notes .page, #view-memories .page,
#view-letters .page {
  padding: 0 18px calc(16px + env(safe-area-inset-bottom));
}
#view-diary .hub-subhead, #view-notes .hub-subhead, #view-memories .hub-subhead,
#view-letters .hub-subhead {
  position: sticky; z-index: 10; top: 0;
  min-height: calc(env(safe-area-inset-top) + var(--page-top-gap) + 54px);
  margin: 0 -18px 14px;
  padding: calc(env(safe-area-inset-top) + var(--page-top-gap)) 18px 10px;
  background: var(--bg); color: var(--text);
  align-items:flex-start;
}
#view-diary .hub-subhead .round-btn, #view-notes .hub-subhead .round-btn,
#view-memories .hub-subhead .round-btn,
#view-letters .hub-subhead .round-btn { width: 44px; height: 44px; }

.diary-calendar {
  padding: 14px; border: 1px solid var(--line-soft); border-radius: 20px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  }
.calendar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 13px; }
.calendar-head > strong { font-size: 16px; }
.calendar-nav { display: flex; gap: 6px; }
.calendar-nav .round-btn { width: 34px; height: 34px; font-size: 22px; line-height: 1; }
.calendar-week, .calendar-days {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px;
}
.calendar-week span { padding: 0 0 5px; color: var(--muted); font-size: 9.5px; text-align: center; }
.calendar-day {
  appearance: none; aspect-ratio: 1; min-width: 0; padding: 0;
  display: grid; place-items: center; position: relative;
  border: 1px solid transparent; border-radius: 12px;
  background: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer;
}
.calendar-day.has-entries {
  background: color-mix(in srgb, var(--bubble-assistant) 74%, transparent);
  border-color: var(--page-line);
}
.calendar-day.is-selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.calendar-day em {
  position: absolute; top: 1px; right: 3px; color: var(--muted);
  font-size: 8px; font-style: normal;
}
.calendar-spacer { aspect-ratio: 1; }
.diary-day-entries { margin-top: 16px; }
.diary-day-title { margin: 0 0 9px; font-size: 15px; }
.diary-entry, .note-card {
  position: relative; padding: 13px 42px 13px 14px; margin-bottom: 9px;
  border: 1px solid var(--line-soft); border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  }
.diary-entry-meta, .note-card-meta {
  display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 6px;
  color: var(--muted); font-size: 10.5px;
}
.diary-entry-text, .note-card-text {
  margin: 0; color: var(--text); font-size: 14px; line-height: 1.68;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.entry-more {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  background: none; color: var(--muted); font-size: 18px; cursor: pointer;
}
.entry-more:active { background: var(--surface-2); }
.entry-source { margin-top: 7px; color: var(--dim); font-size: 10.5px; }

.note-list { display: flex; flex-direction: column; }
.note-card.is-pinned {
  background: color-mix(in srgb, var(--bubble-assistant) 64%, var(--surface));
}
.note-pin { color: var(--icon-strong); }
.editor-check {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 48px; padding: 10px 14px; color: var(--text); font-size: 14px;
}
.editor-check input { width: 20px; height: 20px; }

@media (max-width: 350px) {
  .home-widget-grid { gap: 8px; }
  .home-date-card { min-height: 164px; padding: 13px; }
}

/* ─────────────────────────────────────────────── Sheet / Modal */
/* 浏览器模式用 dvh；standalone 的 dvh 少 59px，所以由 vh 规则覆盖。 */
.sheet { position: absolute; inset: 0; z-index: 61; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
/* 半屏是一张浮在上面的圆角卡片（四周留白、四角都圆），
   全屏才贴死屏幕边缘、只剩上面两个圆角。
   中间不是两档切换 —— 留白和圆角跟高度用**同一个进度**算，所以是连续长大的。
   这四个变量由 JS 按进度写，见 app.js 的 setSheetGeom() */
.sheet-card {
  position: absolute;
  left: var(--gap, 10px); right: var(--gap, 10px); bottom: var(--gap-b, 10px);
  /* 半屏高度**写死**。试过让它跟内容走，媛媛说不对：她要的就是固定那么高，
     内容只有一行也撑着。她说的"空隙太大"指的是卡片底边离屏幕底边那一段
     （下面的 --gap-b），不是卡片内部 */
  height: 56dvh;
  background: var(--surface);
  border-radius: var(--rt, 26px) var(--rt, 26px) var(--rb, 26px) var(--rb, 26px);
  display: flex; flex-direction: column;
  overflow: hidden;          /* 圆角要能裁住里面的滚动区 */
  }
html.standalone-shell .sheet-card { height: 56vh; }
/* 44px 的兜底删掉了。那是当初 black-translucent 时代防灵动岛用的；
   现在窗口本来就从状态栏下面开始（她读数上 Safe area ↑0），
   再留 44 就是白白空掉一截 —— Settings 顶不满就是这么来的 */
.sheet-card.is-full { height: calc(100dvh - env(safe-area-inset-top)); }
html.standalone-shell .sheet-card.is-full { height: calc(100vh - env(safe-area-inset-top)); }

/* 手指拖的时候不要补间，高度和留白直接跟手；松手才做那一次过渡。
   补间只发生一次，而且是在松手之后 —— 拖的过程 1:1 跟手，才有"我在拉它"的感觉 */
.sheet-card.is-settling {
  transition: height .3s cubic-bezier(.32,.72,0,1),
              left .3s cubic-bezier(.32,.72,0,1),
              right .3s cubic-bezier(.32,.72,0,1),
              bottom .3s cubic-bezier(.32,.72,0,1),
              border-radius .3s cubic-bezier(.32,.72,0,1);
}

.sheet-grab { width: 38px; height: 4px; border-radius: 2px; background: var(--line);
              margin: 9px auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 8px 14px 10px;
              flex: none; }
/* 面板标题跟官方一样是无衬线粗体。衬线只留给字标和页面大标题 */
.sheet-head h3, .modal-card .sheet-head h3 {
  flex: 1; text-align: center; margin: 0;
  font-family: inherit; font-weight: 600; font-size: 16.5px; letter-spacing: 0;
}
/* min-height:0 不能省。flex 子项默认 min-height:auto，会拒绝缩到比内容小，
   反过来把整张卡片撑到顶格 —— 半屏和全屏就变成一样高了。
   下面所有 flex:1 + overflow 的地方同理。 */
/* contain 只挡"把滚动传给后面的聊天流"，元素自己的橡皮筋回弹还留着。
   （媛媛要那个回弹；要是 iOS 上 contain 把回弹也一起吃了，就改用别的办法挡背景。） */
.sheet-body { flex: 1; min-height: 0; overflow-y: auto;
              padding: 4px 20px calc(26px + env(safe-area-inset-bottom));
              overscroll-behavior: contain;
              -webkit-overflow-scrolling: touch;
              white-space: pre-wrap; word-break: break-word; }

/* 正文随卡片上边缘一起移动。只保留极轻微缩放，并固定排版宽度，
   因而拖动中不会重新断行，也不会出现文字钉在屏幕后面的关窗效果。 */
.sheet-scale {
  /* 先用固定宽度排版，再整层极轻微放大。浏览器不会在拖动中重新断行。 */
  width: var(--layout-w, 100%);
  transform: scale(var(--s, 1));
  transform-origin: top left;
  will-change: transform;
}
.sheet-card.is-settling .sheet-scale { transition: transform .3s cubic-bezier(.32,.72,0,1); }

/* Claude-style thought card: the common sheet geometry above supplies the
   half-screen start and continuous pull-to-full-screen interaction. */
.sheet[data-sheet-kind="thought"] .sheet-card {
  height: 52dvh; background: var(--thought-card-bg); border: 0;
  border-radius: var(--rt, 34px) var(--rt, 34px) var(--rb, 34px) var(--rb, 34px);
  box-shadow: 0 22px 70px rgba(0,0,0,.18);
}
html.standalone-shell .sheet[data-sheet-kind="thought"] .sheet-card { height: 52vh; }
.sheet[data-sheet-kind="thought"] .sheet-scrim { background: rgba(0,0,0,.18); }
.sheet[data-sheet-kind="thought"]::before { background-color: transparent !important; }
.sheet[data-sheet-kind="thought"] .sheet-card.is-full { height: 90dvh; }
html.standalone-shell .sheet[data-sheet-kind="thought"] .sheet-card.is-full { height: 90vh; }
.sheet[data-sheet-kind="thought"] .sheet-head {
  height: 36px; min-height: 36px; margin: 0 16px 6px; padding: 0; position: relative;
}
.sheet[data-sheet-kind="thought"] .sheet-head .round-btn {
  width: 32px; height: 32px; border: 0; position: relative; z-index: 1;
  background: color-mix(in srgb,var(--surface) 85%,transparent);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.sheet[data-sheet-kind="thought"] .sheet-grab { width: 36px; margin: 8px auto; }
.sheet[data-sheet-kind="thought"] .sheet-head .spacer { width: 32px; }
.sheet[data-sheet-kind="thought"] .sheet-head h3 {
  position: absolute; left: 44px; right: 44px; pointer-events: none;
  font-family: inherit; font-size: 15px; font-weight: 600; letter-spacing: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sheet[data-sheet-kind="thought"] .sheet-body {
  padding: 0; overflow: hidden;
}
.sheet[data-sheet-kind="thought"] .sheet-scale { height: 100%; }
.thought-sheet-content {
  position: relative; height: 100%; min-height: 0; overflow: hidden;
  color: var(--text-primary); --process-card: var(--thought-card-bg);
}
html[data-layout-preset="classic"] .thought-sheet-content { --process-card: var(--classic-bg-solid); }
.thought-sheet-content .process-view {
  position: absolute; inset: 0; overflow: auto; padding: 6px 20px 30px;
  font-size: 14px; line-height: 1.7; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  transition: transform .3s cubic-bezier(.2,.8,.2,1), opacity .3s;
}
.thought-sheet-content .process-detail {
  transform: translateX(100%); background: var(--process-card);
  box-shadow: -6px 0 16px color-mix(in srgb,var(--page-text) 6%,transparent);
}
.thought-sheet-content.detail .process-list { transform: translateX(-28%); opacity: 0; pointer-events: none; }
.thought-sheet-content.detail .process-detail { transform: none; }
.thought-sheet-content p { margin: 0; white-space: pre-wrap; }
.thought-sheet-content p + p { margin-top: .7em; }
.thought-sheet-content .process-timeline { list-style: none; margin: 0; padding: 4px 0 0; }
.thought-sheet-content .process-timeline::before { display: none; }
.thought-sheet-content .process-event { position: relative; display: block; padding-left: 34px; }
.thought-sheet-content .process-event + .process-event { margin-top: 0; }
.thought-sheet-content .process-event::before {
  content: ""; position: absolute; left: 11px; top: 0; bottom: 0; width: 1px; background: var(--page-line);
}
.thought-sheet-content .process-event:first-child::before { top: 22px; }
.thought-sheet-content .process-event:last-child::before { bottom: auto; height: 22px; }
.thought-sheet-content .process-event:only-child::before { display: none; }
.thought-sheet-content .process-event-icon {
  position: absolute; left: 0; top: 10px; width: 23px; height: 23px;
  border: 0; border-radius: 0; background: var(--process-card); color: var(--page-subtext); animation: none;
}
.thought-sheet-content .process-event-tool .process-event-icon {
  border: 1px solid var(--page-line); border-radius: 50%; background: var(--page-card);
}
.process-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--page-subtext); }
.thought-sheet-content .process-event-main {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 9px 0;
  font-size: 14px; line-height: 1.7; color: inherit;
}
.thought-sheet-content .process-event-line { display: block; flex: 1; min-width: 0; }
.thought-sheet-content .process-event-label { display: block; font-size: inherit; line-height: inherit; color: inherit; }
.process-event-query { display: block; color: var(--page-subtext); font-size: 12px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thought-sheet-content .process-event-state { flex: none; font-size: 11px; color: var(--page-subtext); }
.thought-sheet-content .process-event-state.is-failed { color: var(--danger); }
.process-chevron { flex: none; color: var(--page-subtext); opacity: .65; }
.process-spin { display: inline-block; width: 12px; height: 12px; border: 1.5px solid var(--page-line); border-top-color: var(--page-accent); border-radius: 50%; animation: process-spin .8s linear infinite; }
@keyframes process-spin { to { transform: rotate(360deg); } }
.process-flow {
  background: linear-gradient(90deg,var(--page-text) 0%,var(--page-text) 35%,var(--page-subtext) 50%,var(--page-text) 65%,var(--page-text) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text;
  color: transparent !important; animation: process-flow 1.8s linear infinite;
}
@keyframes process-flow { from { background-position: 100% 0; } to { background-position: -150% 0; } }
.process-detail-heading { font-size: 13px; color: var(--page-subtext); margin: 14px 0 6px; }
.process-detail-heading:first-child { margin-top: 4px; }
.process-result-box { background: color-mix(in srgb,var(--page-card) 70%,transparent); border-radius: 14px; padding: 10px 13px; font-size: 13px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.thought-sheet-content .process-order-note { color: var(--page-subtext); font-size: 12px; margin-bottom: 8px; }
@media (prefers-reduced-motion: reduce) {
  .thought-sheet-content .process-view { transition: none; }
  .process-flow, .process-spin { animation: none; }
}
.conversation-recents, .list, .modal-body { overscroll-behavior: contain; }

.modal {
  position: absolute; inset: 0; height: auto;
  z-index: 55; background: transparent;
}
.modal-card { height: 100%; display: flex; flex-direction: column;
              padding-top: env(safe-area-inset-top); background: var(--surface);
              }   /* 44 的兜底见上面 */
.modal-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 6px 18px 16px;
}
.settings-root-nav { visibility: hidden; pointer-events: none; }
.appearance-screen { position: relative; min-height: 100%; overflow: hidden; }

/* Settings 首页只给入口，详细控件放到下一层；避免几十个输入框一次铺满。 */
.settings-home { display: flex; flex-direction: column; gap: 24px; padding-bottom: 14px; }
.settings-section-title {
  margin: 2px 4px 8px; color: var(--dim); font-size: 12.5px;
  letter-spacing: .05em; text-transform: uppercase;
}
.settings-menu {
  overflow: hidden; border: 1px solid var(--line-soft); border-radius: 16px;
  background: var(--surface); }
.settings-entry {
  width: 100%; min-height: 62px; display: grid;
  grid-template-columns: 32px minmax(0,1fr) 18px; align-items: center; gap: 12px;
  padding: 10px 16px; border: 0; border-bottom: 1px solid var(--line-soft);
  background: none; color: var(--text); text-align: left; font: inherit; cursor: pointer;
}
.settings-entry:last-child { border-bottom: 0; }
.settings-entry:active { background: var(--surface-2); }
.settings-entry .i { width: 22px; height: 22px; color: var(--muted); }
.settings-entry-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.settings-entry-copy strong { font-size: 16px; font-weight: 500; }
.settings-entry-copy small {
  color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.settings-entry .chevron { color: var(--dim); font-size: 25px; line-height: 1; font-weight: 300; }
.prompt-studio { display: flex; flex-direction: column; padding-bottom: 22px; }
.prompt-studio-status {
  display: inline-flex; align-items: center; min-height: 28px; margin-top: 10px; padding: 5px 10px;
  border: 1px solid var(--line-soft); border-radius: 999px; color: var(--muted);
  background: color-mix(in srgb,var(--surface) 72%,transparent); font-size: 12px;
}
.prompt-studio-status.is-draft { color: var(--text); border-color: var(--accent); }
.prompt-section-input { min-height: 168px !important; font-size: 16px !important; line-height: 1.6; }
.prompt-validation { margin: -8px 0 18px; padding: 10px 12px; border-radius: 12px; background: var(--surface); }
.prompt-validation p { margin: 0; font-size: 12px; line-height: 1.5; }
.prompt-validation p + p { margin-top: 5px; }
.prompt-validation-error { color: var(--danger); }
.prompt-validation-warning { color: var(--muted); }
.prompt-publish-box {
  display: flex; flex-direction: column; gap: 10px; margin: -4px 0 22px; padding: 12px;
  border: 1px solid var(--line-soft); border-radius: 16px; background: var(--surface);
}
.prompt-version-note {
  width: 100%; min-height: 44px; padding: 0 12px; border: 1px solid var(--line-soft);
  border-radius: 11px; color: var(--text); background: color-mix(in srgb,var(--bg) 45%,transparent);
  font-size: 16px;
}
.prompt-studio-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.prompt-studio-actions button { min-width: 0; min-height: 44px; }
.prompt-preview {
  margin-bottom: 24px; overflow: hidden; border: 1px solid var(--line-soft);
  border-radius: 16px; background: var(--surface);
}
.prompt-preview > summary { padding: 14px; cursor: pointer; font-size: 14px; }
.prompt-preview-body { padding: 0 12px 12px; }
.prompt-preview-body section { margin-top: 10px; }
.prompt-preview-heading { margin-bottom: 6px; color: var(--muted); font-size: 12px; }
.prompt-preview pre {
  max-height: 300px; margin: 0; padding: 11px; overflow: auto; white-space: pre-wrap;
  overflow-wrap: anywhere; border: 1px solid var(--line-soft); border-radius: 10px;
  background: color-mix(in srgb,var(--bg) 55%,transparent); color: var(--text);
  font: 12px/1.55 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  -webkit-user-select: text; user-select: text;
}
.prompt-protected-list { color: var(--muted); font-size: 12px; line-height: 1.5; }
.prompt-protected-list ul { margin: 7px 0 0; padding-left: 20px; }
.prompt-history { margin-bottom: 24px; }
.prompt-revision-row {
  min-height: 58px; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line-soft); border-bottom: 0; background: var(--surface);
}
.prompt-revision-row:nth-child(2) { border-radius: 14px 14px 0 0; }
.prompt-revision-row:last-child { border-bottom: 1px solid var(--line-soft); border-radius: 0 0 14px 14px; }
.prompt-revision-row:only-of-type { border-bottom: 1px solid var(--line-soft); border-radius: 14px; }
.prompt-revision-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.prompt-revision-copy strong { font-size: 14px; font-weight: 550; }
.prompt-revision-copy small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.prompt-revision-row .ghost-btn { flex: 0 0 auto; min-height: 36px; padding: 0 12px; }
.prompt-studio-empty { padding: 20px 0; }
.prompt-revision-row { flex-wrap: wrap; }
.prompt-revision-preview { flex: 1 0 100%; min-width: 0; }
.prompt-revision-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--page-text); }
.request-usage-list .row > div { min-width: 0; overflow-wrap: anywhere; }
.request-usage-list small { display: block; margin-top: 6px; color: var(--page-muted, var(--dim)); }
.prompt-persona .prompt-studio-status { align-self:flex-start; gap:6px; min-height:0; margin:0 16px 14px 32px; padding:6px 12px; font-size:13px; color:var(--settings-soft); border-color:var(--page-line); background:transparent; }
.prompt-persona-group { margin:0 16px 22px; }
.prompt-persona-card { overflow:hidden; border-radius:22px; background:var(--page-card); box-shadow:0 0 0 1px var(--page-line); }
textarea.prompt-persona-editor { display:block; width:100%; min-height:42vh !important; padding:16px; margin:0; border:0; outline:none; resize:none; background:transparent; color:var(--page-text); font:400 16px/1.7 -apple-system,"PingFang SC",system-ui,sans-serif !important; box-sizing:border-box; }
textarea.prompt-persona-editor::placeholder { color:var(--settings-faint,var(--settings-soft)); }
.prompt-persona-tips { margin:10px 16px 0; }
.prompt-persona-tips summary { list-style:none; font-size:13px; color:var(--page-accent); cursor:pointer; }
.prompt-persona-tips summary::-webkit-details-marker { display:none; }
.prompt-persona-tips ul { margin:8px 0 0 18px; padding:0; font-size:13px; color:var(--settings-soft); line-height:1.8; }
.prompt-persona-foot { padding:8px 16px 0; font-size:12.5px; line-height:1.55; color:var(--settings-soft); }
.prompt-persona-extra { margin:0 16px 22px; color:var(--settings-soft); font-size:13px; }
.mcp-settings { display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.mcp-binding, .mcp-server-card, .mcp-editor, .mcp-empty {
  border: 1px solid var(--line-soft); border-radius: 18px; background: var(--surface);
  }
.mcp-binding { padding: 14px; }
.mcp-binding-head { display: flex; flex-direction: column; gap: 4px; }
.mcp-binding-head strong { font-size: 14px; }
.mcp-binding-head small, .mcp-binding-status { color: var(--muted); font-size: 11px; line-height: 1.5; }
.mcp-binding-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 12px; }
.mcp-binding-row select { min-width: 0; font-size: 16px; }
.mcp-binding-status { margin: 9px 0 0; }
.mcp-server-list { display: grid; gap: 10px; }
.mcp-server-card { padding: 14px; }
.mcp-server-head { display: flex; align-items: flex-start; gap: 10px; }
.mcp-server-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; }
.mcp-server-copy strong { font-size: 15px; overflow-wrap: anywhere; }
.mcp-server-copy small { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.mcp-status { flex: none; padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 9px; text-transform: uppercase; }
.mcp-status.connected { background: color-mix(in srgb,var(--accent) 16%,var(--surface)); color: var(--text); }
.mcp-status.unavailable { color: var(--danger); }
.mcp-server-facts { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.mcp-server-error { margin: 9px 0 0; color: var(--danger); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.mcp-card-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.mcp-small-action, .mcp-add-connection {
  min-height: 36px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 11px; cursor: pointer;
}
.mcp-small-action.danger { color: var(--danger); }
.mcp-small-action:disabled { opacity: .48; }
.mcp-tools { margin-top: 12px; border-top: 1px solid var(--line-soft); }
.mcp-tools summary { padding: 11px 1px 0; color: var(--muted); font-size: 11px; cursor: pointer; }
.mcp-tools-body { display: grid; gap: 7px; padding-top: 9px; color: var(--muted); font-size: 11px; }
.mcp-tool-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 10px; border-radius: 13px; background: var(--surface-2); }
.mcp-tool-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.mcp-tool-copy strong, .mcp-tool-copy code, .mcp-tool-copy small { overflow-wrap: anywhere; }
.mcp-tool-copy strong { color: var(--text); font-size: 11px; }
.mcp-tool-copy code { color: var(--muted); font-size: 9px; }
.mcp-tool-copy small { font-size: 9px; line-height: 1.4; }
.mcp-tool-toggle { width: 42px; min-height: 28px; border: 0; border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 10px; }
.mcp-tool-toggle.is-on { background: var(--accent); color: var(--accent-ink); }
.mcp-tool-toggle:disabled { opacity: .4; }
.mcp-empty { padding: 22px 16px; text-align: center; }
.mcp-empty strong { font-size: 14px; }
.mcp-empty p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.mcp-add-connection { width: 100%; min-height: 44px; border-style: dashed; background: color-mix(in srgb,var(--surface) 52%,transparent); font-size: 13px; }
.mcp-editor { display: flex; flex-direction: column; gap: 0; padding: 14px; }
.mcp-editor-title { display: flex; flex-direction: column; gap: 3px; padding: 0 2px 10px; }
.mcp-editor-title strong { font-size: 18px; }
.mcp-editor-title small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.mcp-editor .row { min-height: 52px; }
.mcp-editor input, .mcp-editor select, .mcp-editor textarea { min-width: 0; font-size: 16px; }
.mcp-credential { min-height: 76px; resize: vertical; text-align: left !important; }
.mcp-editor-actions { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 12px; }
.mcp-editor-actions .primary-btn { min-width: 0; }
.appearance-section { padding-top: 16px; }
.appearance-section-label {
  margin: 0 8px 9px; color: var(--muted); font-size: 12px; font-weight: 650;
  letter-spacing: .055em;
}
.appearance-editor {
  overflow: hidden; border: 1px solid var(--line-soft); border-radius: 24px;
  background: var(--surface); }
.appearance-editor-row {
  min-height: 70px; padding: 12px 15px; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; position: relative;
}
.appearance-editor-row:not(:last-child)::after {
  content: ""; position: absolute; left: 15px; right: 15px; bottom: 0;
  height: 1px; background: var(--line-soft);
}
.appearance-row-copy { min-width: 0; flex: 1; }
.appearance-row-copy strong, .appearance-row-copy small { display: block; }
.appearance-row-copy strong { font-size: 14px; font-weight: 500; }
.appearance-row-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.appearance-range {
  width: clamp(112px, 36vw, 142px); min-width: 0; flex: 0 1 142px;
  display: grid; grid-template-columns: minmax(0,94px) 38px; align-items: center; gap: 7px;
}
.appearance-range input[type="range"] { width: 100%; min-width: 0; accent-color: var(--accent); }
.appearance-value { width: 38px; text-align: right; color: var(--muted); font-size: 10px; white-space: nowrap; }
.appearance-file-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.appearance-small-button {
  border: 0; border-radius: 12px; padding: 8px 10px; background: color-mix(in srgb,var(--accent) 20%,var(--surface));
  color: var(--text); font: inherit; font-size: 10px; cursor: pointer;
}
.appearance-switch {
  width: 44px; height: 25px; flex: 0 0 44px; padding: 0; position: relative;
  border: 0; border-radius: 999px; background: color-mix(in srgb,var(--muted) 32%,transparent); cursor: pointer;
}
.appearance-switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 19px; height: 19px;
  border-radius: 50%; background: white; transition: left .18s ease;
}
.appearance-switch.is-on { background: var(--accent); }
.appearance-switch.is-on::after { left: 22px; }
.appearance-primary-action,
.appearance-secondary-action {
  width: 100%; min-height: 44px; padding: 10px 13px; border-radius: 14px;
  font: inherit; font-size: 14px; cursor: pointer;
}
.appearance-primary-action { border: 0; background: var(--accent); color: var(--accent-ink); }
.appearance-secondary-action { border: 1px solid var(--line); background: var(--surface); color: var(--text); }

/* Settings v2 follows the dedicated settings reference exactly.  The shell itself
   is the page background; only the grouped cards are surfaced. */
#settings {
  background: transparent; color: var(--page-text);
}
#settings .modal-card {
  max-width: none; margin: 0; padding-top: 0; background: transparent;
  border: 0; border-radius: 0; box-shadow: none; }
#settings .sheet-head {
  position: relative; z-index: 5; min-height: calc(env(safe-area-inset-top) + var(--page-top-gap) + 54px);
  padding: calc(env(safe-area-inset-top) + var(--page-top-gap)) 16px 12px;
  background: var(--page-bg); color: var(--page-text);
  }
#settings .sheet-head h3 {
  position: absolute; left: 50%; top: calc(env(safe-area-inset-top) + var(--page-top-gap)); bottom: auto;
  height: 42px; display: flex; align-items: center; transform: translateX(-50%);
  margin: 0; color: var(--page-text); font-size: 17px; font-weight: 600; white-space: nowrap;
}
#settings .sheet-head .spacer { width: 42px; }
#settings #settings-nav {
  width: 42px; height: 42px; flex: 0 0 42px; border: 0; border-radius: 50%;
  background: var(--page-card); color: var(--page-text); box-shadow: 0 0 0 1px var(--page-line);
}
#settings #settings-nav .i { width: 20px; height: 20px; }
#settings .modal-body {
  padding: 8px 0 16px; background: transparent;
  color: var(--page-text);
}
#settings .modal-body.settings-child { padding-bottom: calc(26px + env(safe-area-inset-bottom)); }
#settings .modal-body.settings-has-bar { padding-bottom: calc(94px + env(safe-area-inset-bottom)); }
#settings .settings-home { gap: 0; padding-bottom: 14px; }
#settings .settings-home > section { margin: 0 16px 22px; }
#settings .settings-section-title,
#settings .group-label {
  margin: 0; padding: 0 16px 8px; color: var(--page-subtext); font-size: 13px;
  font-weight: 400; letter-spacing: 0; text-transform: none;
}
#settings .settings-menu,
#settings .group-box {
  overflow: hidden; border: 0; border-radius: 22px; background: var(--page-card);
  box-shadow: 0 0 0 1px var(--page-line); }
#settings .settings-entry {
  position: relative; min-height: 54px; display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border: 0; background: transparent; color: var(--page-text); font-size: 16px;
}
#settings .settings-entry + .settings-entry::before {
  content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--page-line);
}
#settings .settings-entry:active { background: rgba(0,0,0,.03); }
#settings .settings-entry > .i { display: none; }
#settings .settings-entry-copy { flex: 1; gap: 3px; }
#settings .settings-entry-copy strong { color: var(--page-text); font-size: 16px; font-weight: 400; }
#settings .settings-entry-copy small { color: var(--page-subtext); font-size: 12.5px; line-height: 1.4; }
#settings .settings-entry .chevron { color: var(--settings-faint); font-size: 20px; }
#settings .settings-entry-value {
  max-width: 58%; overflow: hidden; color: var(--page-subtext); font-size: 15px;
  text-overflow: ellipsis; white-space: nowrap;
}
#settings .settings-us-card { margin: 0 16px 22px; }
#settings .settings-us-button {
  width: 100%; padding: 16px; display: flex; align-items: center; gap: 14px;
  border: 0; background: transparent; color: var(--settings-ink); text-align: left; font: inherit;
}
#settings .settings-us-avatars { display: flex; }
#settings .settings-us-avatars .avatar-preview { width: 54px; height: 54px; border: 3px solid var(--page-card); }
#settings .settings-us-avatars .avatar-preview + .avatar-preview { margin-left: -14px; }
#settings .settings-us-copy { min-width: 0; flex: 1; }
#settings .settings-us-copy strong { display: block; font-size: 18px; font-weight: 600; }
#settings .settings-us-copy small { display: block; color: var(--page-subtext); font-size: 13px; }
#settings .settings-us-button .chevron { color: var(--settings-faint); font-size: 20px; }
#settings .settings-signout { margin: 0 16px 22px; }
#settings .settings-signout .menu-item { justify-content: center; min-height: 54px; color: var(--settings-red); font-weight: 500; }
.settings-version-tap {
  appearance: none; align-self: center; margin: -8px auto 8px; padding: 8px 18px;
  border: 0; background: transparent; color: var(--settings-faint);
  font: 11px/1.3 -apple-system,BlinkMacSystemFont,"SF Pro Text",sans-serif;
}
.layout-debug { position: absolute; z-index: 100; inset: 0; display: grid; place-items: center; padding: 18px; }
.layout-debug-scrim { position: absolute; inset: 0; width: 100%; border: 0; background: rgba(0,0,0,.24); }
.layout-debug-card {
  position: relative; width: min(100%,360px); max-height: min(76dvh,620px); overflow: auto;
  padding: 14px; border-radius: 24px; background: var(--settings-card); color: var(--settings-ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.22);
}
html.standalone-shell .layout-debug-card { max-height: min(76vh,620px); }
.layout-debug-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 10px; }
.layout-debug-head strong { font-size: 17px; }
.layout-debug-head button {
  width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: var(--settings-accent-bg); color: var(--settings-ink); font-size: 24px; line-height: 1;
}
.layout-debug-values { overflow: hidden; border-radius: 16px; background: var(--settings-bg); }
.layout-debug-values .row {
  min-height: 42px; padding: 9px 12px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; border-bottom: 1px solid var(--settings-line); font-size: 13px;
}
.layout-debug-values .row:last-child { border-bottom: 0; }
.layout-debug-values .row label { color: var(--settings-soft); }
.layout-debug-values .row span { text-align: right; font-variant-numeric: tabular-nums; }
.bubble-debug-section { padding: 12px; border-top: 1px solid var(--settings-line); }
.bubble-debug-title { display: block; margin-bottom: 8px; font-size: 14px; }
.bubble-debug-card {
  margin-top: 8px; padding: 10px; border-radius: 12px; background: var(--settings-card);
  font: 11px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; overflow-wrap:anywhere;
}
.bubble-debug-card b,.bubble-debug-card span { display:block; }
.bubble-debug-card b { margin-bottom:4px; font-family:inherit; font-size:12px; }
.bubble-debug-card span { color:var(--settings-soft); }
.layout-debug-refresh {
  width: 100%; min-height: 44px; margin-top: 12px; border: 0; border-radius: 14px;
  background: var(--settings-accent); color: var(--settings-card);
  font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1;
}
.keyboard-debug {
  position:absolute; z-index:100; top:calc(env(safe-area-inset-top) + 66px); right:12px;
  width:min(320px,calc(100% - 24px)); padding:12px; border:1px solid var(--page-line);
  border-radius:16px; background:var(--page-card); color:var(--page-text); pointer-events:none;
  box-shadow:0 6px 24px rgba(0,0,0,.12);
}
.keyboard-debug pre { margin:0; white-space:pre-wrap; font:11px/1.45 ui-monospace,monospace; }
.keyboard-debug button {
  position:absolute; right:4px; top:2px; width:28px; height:28px; border:0;
  background:var(--page-card); color:var(--page-text); border-radius:50%; font-size:22px; pointer-events:auto;
}
.edge-back-debug {
  position:fixed; z-index:100; inset:auto 12px auto auto;
  top:calc(env(safe-area-inset-top) + 90px); margin:0;
  width:min(340px,calc(100% - 24px)); padding:12px;
  border:1px solid var(--page-line); border-radius:16px;
  background:var(--page-card); color:var(--page-text); pointer-events:none;
  box-shadow:0 6px 24px rgba(0,0,0,.12);
}
.edge-back-debug pre { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; font:11px/1.45 ui-monospace,monospace; }
.edge-back-debug button {
  position:absolute; right:4px; top:2px; width:28px; height:28px; border:0;
  background:var(--page-card); color:var(--page-text); border-radius:50%; font-size:22px; pointer-events:auto;
}
#settings .group { margin: 0 16px 22px; }
#settings .row {
  position: relative; min-height: 54px; padding: 12px 16px; border: 0; gap: 12px;
  color: var(--settings-ink); font-size: 16px;
}
#settings .row + .row::before {
  content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--settings-line);
}
#settings .row label { width: auto; flex: 1; color: var(--settings-ink); font-size: 16px; }
#settings .row input, #settings .row select, #settings .row textarea { color: var(--settings-ink); }
#settings .hint,
#settings .row small {
  color: var(--settings-soft); font-size: 12.5px; line-height: 1.55;
}
#settings .hint { margin: 0; padding: 8px 16px 0; }
#settings .settings-advanced { margin: 0 16px 22px; }
#settings .settings-advanced > summary {
  list-style: none; display: flex; align-items: center; gap: 6px; padding: 4px 16px 10px;
  color: var(--settings-soft); font-size: 13px; cursor: pointer;
}
#settings .settings-advanced > summary::-webkit-details-marker { display: none; }
#settings .settings-advanced > summary::before { content: "›"; font-size: 16px; transition: transform .2s; }
#settings .settings-advanced[open] > summary::before { transform: rotate(90deg); }
#settings .settings-switch {
  appearance: none; -webkit-appearance: none; width: 51px; height: 31px; flex: 0 0 51px;
  position: relative; border: 0; border-radius: 999px; background: var(--settings-line); transition: background .2s;
}
#settings .settings-switch::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px;
  border-radius: 50%; background: var(--settings-card); box-shadow: 0 2px 6px rgba(0,0,0,.18); transition: transform .2s;
}
#settings .settings-switch:checked { background: var(--settings-accent); }
#settings .settings-switch:checked::after { transform: translateX(20px); }
#settings .settings-dot { width: 8px; height: 8px; display: inline-block; border-radius: 50%; background: var(--settings-green); }
#settings .settings-dot.off { background: var(--settings-faint); }
#settings .settings-fixed-bar {
  position: absolute; z-index: 57; left: 0; right: 0; bottom: 0; display: flex; gap: 10px;
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
  background: color-mix(in srgb,var(--settings-bg) 90%,transparent);
  box-shadow: 0 -1px 0 var(--settings-line); }
#settings .settings-fixed-bar button {
  min-height: 48px; flex: 1; border: 0; border-radius: 999px; background: var(--settings-card);
  color: var(--settings-ink); box-shadow: 0 0 0 1px var(--settings-line); font: inherit; font-size: 16px; font-weight: 500;
}
#settings .settings-fixed-bar button.primary { background: var(--settings-accent); color: #fff; box-shadow: none; }
#settings .settings-meter { width: 100%; height: 6px; overflow: hidden; margin-top: 8px; border-radius: 9px; background: var(--settings-line); }
#settings .settings-meter > i { display: block; height: 100%; border-radius: 9px; background: var(--settings-accent); }
#settings .settings-time-range { display: flex; align-items: center; gap: 6px; color: var(--settings-soft); }
#settings .settings-time-range input { flex: 0 1 106px; padding: 5px 8px; border-radius: 10px; background: var(--settings-accent-bg); text-align: center; }
#settings .settings-number-unit { display: inline-flex; align-items: center; gap: 6px; color: var(--settings-soft); font-size: 15px; }
#settings .settings-number-unit input { width: 68px; flex: 0 0 68px; text-align: right; }


#settings .appearance-screen { min-height: 100%; overflow: visible; background: transparent; border: 0; border-radius: 0; padding: 0; }
#settings .appearance-screen::before, #settings .appearance-screen::after { display: none !important; }
#settings .appearance-screen > .appearance-section { margin-left: 16px; margin-right: 16px; }

#settings .mcp-settings { gap: 14px; padding-bottom: 20px; }
#settings .mcp-binding, #settings .mcp-server-card, #settings .mcp-editor, #settings .mcp-empty {
  margin: 0 16px; border: 0; border-radius: 22px; background: var(--settings-card);
  box-shadow: 0 0 0 1px var(--settings-line); }
#settings .mcp-binding-row { display: block; }
#settings .mcp-binding-row select { width: 100%; min-height: 44px; border: 0; background: transparent; font-size: 16px; }
#settings .mcp-server-card { padding: 14px 0 0; overflow: hidden; }
#settings .mcp-server-head, #settings .mcp-server-facts, #settings .mcp-server-error { margin-left: 16px; margin-right: 16px; }
#settings .mcp-card-actions { display: block; margin-top: 12px; }
#settings .mcp-card-actions .mcp-small-action,
#settings .mcp-enable-row {
  width: 100%; min-height: 54px; padding: 12px 16px; display: flex; align-items: center;
  justify-content: space-between; position: relative; border: 0; border-radius: 0; background: transparent;
  color: var(--settings-ink); font: inherit; font-size: 16px; text-align: left;
}
#settings .mcp-card-actions > * + *::before {
  content: ""; position: absolute; left: 16px; right: 0; top: 0; height: 1px; background: var(--settings-line);
}
#settings .mcp-card-actions .danger { color: var(--settings-red); justify-content: center; }
#settings .mcp-tools { margin-top: 0; padding: 0 16px 14px; border-top: 1px solid var(--settings-line); }
#settings .mcp-tools summary { min-height: 54px; display: flex; align-items: center; color: var(--settings-ink); font-size: 16px; }
#settings .mcp-add-connection { width: calc(100% - 32px); margin: 0 16px; min-height: 54px; border: 0; border-radius: 22px; background: var(--settings-card); box-shadow: 0 0 0 1px var(--settings-line); color: var(--settings-accent); font-size: 16px; }

.avatar-setting {
  display: grid; grid-template-columns: 54px minmax(0,1fr) auto;
  align-items: center; gap: 12px; padding: 13px 15px;
  border-bottom: 1px solid var(--line-soft);
}
.avatar-setting:last-child { border-bottom: 0; }
.avatar-preview {
  width: 54px; height: 54px; min-width: 54px; min-height: 54px;
  max-width: 54px; max-height: 54px; flex: 0 0 54px; display: grid; place-items: center;
  position: relative; overflow: hidden; border: 1px solid var(--line);
  border-radius: 50%; background: var(--surface-2); color: var(--text);
  font: 650 16px/1 Georgia, serif;
}
.avatar-preview.assistant { background: var(--text-primary); color: var(--surface-primary); }
.avatar-setting-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.avatar-setting-copy strong { font-size: 15px; font-weight: 550; }
.avatar-setting-copy small { color: var(--dim); font-size: 11.5px; line-height: 1.35; }
.avatar-setting-actions { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.avatar-upload-btn, .avatar-remove-btn {
  min-width: 70px; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 999px; background: none; color: var(--text);
  font-family: inherit; font-size: 13px; line-height: 1.2; cursor: pointer;
}
.avatar-remove-btn { border-color: transparent; color: var(--danger); }
.avatar-upload-btn:disabled, .avatar-remove-btn:disabled { opacity: .45; cursor: default; }

.group { margin-bottom: 26px; }
.group-label { color: var(--dim); font-size: 12.5px; letter-spacing: .05em;
               text-transform: uppercase; margin: 0 0 8px 4px; }
.group-box { background: var(--surface); border: 1px solid var(--line-soft);
             border-radius: 14px; overflow: hidden;
             }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 15px;
       border-bottom: 1px solid var(--line-soft); }
.row:last-child { border-bottom: none; }
.row label { flex: none; width: 104px; color: var(--muted); font-size: 14px; }
.row input, .row select, .row textarea {
  flex: 1; min-width: 0; background: none; border: none; color: var(--text);
  font: inherit; font-size: 16px; text-align: right;   /* 16 是底线，见文件开头 */
}
/* 这里原来是 14.5px —— 就是它让"编辑记忆""改 profile"一点进去就整页放大。
   多行输入框更要守住 16，她在这儿打的字最多 */
.row textarea { text-align: left; resize: vertical; min-height: 118px;
                line-height: 1.6; font-size: 16px; }
.row input:focus, .row select:focus, .row textarea:focus { outline: none; }
.row input:disabled, .row select:disabled { opacity: .42; }
.row.col { flex-direction: column; align-items: stretch; gap: 8px; }
.row.col label { width: auto; }
.hint { color: var(--dim); font-size: 12.5px; padding: 0 5px; margin: 7px 0 0; }
.heartbeat-status .row span { margin-left: auto; color: var(--dim); font-size: 13px;
                              text-align: right; }

.seg { display: flex; gap: 8px; padding: 13px 15px; }
.seg button { flex: 1; padding: 9px; border: 1px solid var(--page-line);
              border-radius: 10px; background: none; color: var(--page-text);
              font: inherit; font-size: 14px; cursor: pointer; }
.seg button.is-on { background: var(--page-accent-soft); color: var(--page-accent);
                    border-color: var(--page-accent); }

.menu-item { display: flex; align-items: center; gap: 12px; width: 100%;
             padding: 15px 20px; border: none; background: none; color: var(--page-text);
             font: inherit; font-size: 15px; text-align: left; cursor: pointer; }
.menu-item:active { background: var(--page-accent-soft); }
.menu-item.danger { color: var(--danger); }

/* 长按弹出的小卡片。不是半屏 —— 半屏为了三个选项掀掉半个屏幕太重了 */
.popover { position: absolute; inset: 0; z-index: 58; }
.popover::before { background-color: transparent !important; background-image: none !important; filter: none !important; }
.popover::after { background: transparent !important; }
.popover-scrim { position: absolute; inset: 0; background: transparent; }
.popover-card {
  position: absolute; width: min(280px,calc(100vw - 20px)); padding: 8px;
  background: color-mix(in srgb,var(--page-card) 92%,transparent); border: 1px solid var(--page-line);
  border-radius: 26px; box-shadow: 0 18px 50px rgba(0,0,0,.20);
  /* 从被按住的那一条底下弹出来，起手略小一点再回弹到位。
     曲线尾巴上那一下过冲就是"弹"的感觉，线性会显得是硬切上去的 */
  transform-origin: var(--pop-origin, 50% 0);
  animation: pop-in .2s cubic-bezier(.2,.9,.25,1.08) both;
}
html[data-theme="dark"] .popover-card {
  background: color-mix(in srgb,var(--page-card) 92%,transparent); border-color: var(--page-line);
  box-shadow: 0 20px 58px rgba(0,0,0,.46);
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(.9); }
  to   { opacity: 1; transform: scale(1); }
}

/* 按住的那一条自己要有反应 —— 手指压下去东西缩一下，
   iOS 网页拿不到振动马达，"跳一下"只能靠眼睛看见 */
.is-pressing { transform: scale(.96); transition: transform .18s ease; }
.recent, .card { transition: transform .18s ease; }
.pop-title { margin: 0; padding: 9px 14px 7px; color: var(--page-subtext); font-size: 13px;
             overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-item { display: flex; align-items: center; gap: 12px; width: 100%;
            min-height: 47px; padding: 10px 13px; border: none; border-radius: 16px; background: none;
            color: var(--page-text); font: inherit; font-size: 17px; line-height: 1.25;
            text-align: left; cursor: pointer; }
.pop-item:active { background: var(--page-accent-soft); }
.pop-item.danger { color: #ff3b30; }
.pop-item .i { width: 19px; height: 19px; flex: none; }
.pop-item .pop-chevron { width: 15px; height: 15px; margin-left: auto; opacity: .58; }
.pop-item .copy-front { fill: var(--page-card); }
.pop-item .retry-head { fill: currentColor; stroke: none; }
.popover-card { max-height: min(78dvh, 620px); overflow-y: auto; }
html.standalone-shell .popover-card { max-height: min(78vh, 620px); }

/* 记忆页顶部的标签条：横向滑动，点一下只看那一类 */
.tagbar { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 12px;
          scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.tagbar::-webkit-scrollbar { display: none; }
.tagbar button {
  flex: none; padding: 6px 13px; border: 1px solid var(--page-line);
  border-radius: 999px; background: none; color: var(--page-subtext);
  font: inherit; font-size: 13.5px; cursor: pointer; white-space: nowrap;
}
.tagbar button.is-on { background: var(--page-accent-soft); color: var(--page-accent);
                       border-color: var(--page-accent); }
.tagbar button em { font-style: normal; opacity: .6; margin-left: 5px; }

.toast { position: absolute; left: 50%; bottom: 92px; transform: translateX(-50%);
         background: var(--bubble); color: var(--text); border: 1px solid var(--line);
         padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 70; }

/* Shared chat controls. */
.floating-controls {
  isolation: isolate; gap: 10px;
}
.floating-controls::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: calc(-18px - env(safe-area-inset-top)) -18px -24px;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--bg) 96%, transparent) 0%,
    color-mix(in srgb, var(--bg) 84%, transparent) 66%, transparent 100%);
  }
.chat-head-actions {
  height: 50px; display: inline-flex; align-items: center; flex: none;
  padding: 0 4px; border: 1px solid var(--border-divider); border-radius: 999px;
  background: var(--surface); box-shadow: 0 12px 34px rgba(0,0,0,.08);
}
.chat-head-action {
  width: 42px; height: 42px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--text-primary);
}
.chat-head-action:active { background: var(--surface-2); }
.chat-head-action .i { width: 24px; height: 24px; stroke-width: 1.75; }

.assistant-actions {
  display: none; align-items: center; gap: 3px; min-height: 34px;
  margin: 9px 0 0; padding: 0;
}
.msg-ai.is-latest .assistant-actions,
.msg-ai.is-actions-open .assistant-actions { display: flex; }
.assistant-actions .act {
  width: 34px; height: 34px; border-radius: 9px; color: var(--text-secondary);
}
.assistant-actions .act .i { width: 19px; height: 19px; stroke-width: 1.65; }
.assistant-actions .act.is-on { color: var(--accent); background: color-mix(in srgb,var(--accent) 10%,transparent); }
.assistant-actions .act[data-action="more"] { display: none; }

.composer-model {
  position: relative; width: auto; min-width: 82px; max-width: 168px;
  padding: 0 12px; border-radius: 999px; display: flex; align-items: baseline;
  justify-content: center; gap: 4px; overflow: hidden; white-space: nowrap;
}
.composer-model > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 550; }
.composer-model > small { flex: none; color: var(--dim); font-size: 11px; text-transform: capitalize; }
.composer-model > select {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer; -webkit-appearance: menulist-button; appearance: auto;
}
.composer-mic .i { width: 23px; height: 23px; stroke-width: 1.7; }

.empty .claude-empty { display: none; text-align: center; }
.empty .claude-empty img { width: 38px; height: 38px; margin: 0 auto 14px; object-fit: contain; }
.empty .claude-empty h2 {
  margin: 0; color: var(--text-secondary); font: 400 22px/1.35 Georgia,"Times New Roman",serif;
}




/* ─────────────────────────────────────────────── Desktop */
@media (min-width: 900px) {
  .conversation-panel {
    inset: 0; width: auto; border: 0; border-radius: 0;
    padding-top: 0; transform: translateX(-102%);
  }
  .conversation-panel-head,
.conversation-recents {
    width: min(100%, 760px); margin-left: auto; margin-right: auto;
  }
  .thread, .page { max-width: var(--content-max); margin: 0 auto; width: 100%; }
  .composer-wrap { max-width: var(--content-max); margin: 0 auto; width: 100%; }
  .modal-card { max-width: 620px; margin: 0 auto; }
  .sheet-card { max-width: 620px; margin: 0 auto; border-radius: 20px 20px 0 0; }
}

/* ─────────────────────────────────────────────── 图库 */

/* 聊天里发出来的表情包。不套气泡——爸爸的消息本来就没气泡 */
.msg-ai .sticker-out { margin-top: 8px; max-width: 168px; border-radius: 12px; display: block; }

/* 面板里的确认键钉在底部。
   传表情包那次她根本看不见 Add ——描述框一撑高，按钮就被推到屏幕外面去了，
   而底部卡片没有任何"下面还有东西"的暗示。钉住就不会再有这个问题。 */
.sheet-foot {
  flex: none; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line-soft); background: var(--surface);
}
.sheet-foot .primary-btn { margin: 0; }

/* app 自己的确认框。系统那个 confirm() 长得跟这里没关系，
   而且装到主屏幕之后有被壳吞掉的先例——点了没反应 */
.confirm { position: absolute; inset: 0; z-index: 65;
           display: grid; place-items: center; padding: 30px; }
.confirm-scrim { position: absolute; inset: 0; background: rgba(0,0,0,.42); }
.confirm-card {
  position: relative; width: 100%; max-width: 300px; padding: 22px 20px 14px;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: 17px; text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,.34);
}
.confirm-card p { margin: 0 0 18px; font-size: 15px; line-height: 1.5; }
.confirm-row { display: flex; gap: 8px; }
.confirm-row button {
  flex: 1; padding: 11px; border-radius: 11px; font: inherit; font-size: 15px;
  cursor: pointer; border: 1px solid var(--line); background: none; color: var(--text);
}
.confirm-row button.danger { border-color: transparent; background: var(--danger);
                             color: #fff; font-weight: 600; }

/* 设置页里的模型选择：下拉 + 一个手打兜底 */
.picker { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.picker select, .picker input { width: 100%; }

/* ─────────────────────────────────────────────── 代码框 */
.codebox { position: relative; margin: 0 0 .85em; }
.codebox pre { margin: 0; }
.code-copy {
  position: absolute; top: 7px; right: 7px;
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--line-soft); border-radius: 8px;
  background: var(--bg); color: var(--dim); cursor: pointer;
}
.code-copy:active { color: var(--text); background: var(--surface-2); }
.code-copy .i { width: 15px; height: 15px; }
.code-copy.is-done { color: var(--accent); }

/* token 数：跟复制、重新生成同一行，甩到最右边。
   小一号、浅一档 —— 她要看得见，但不想被它抢戏 */
.msg-actions { align-items: center; }
.tokens {
  margin-left: auto; color: var(--dim); font-size: 11.5px;
  font-variant-numeric: tabular-nums; letter-spacing: .01em;
}

/* 正在改的那条：输入框上面挂一条，让她知道这次发出去是替换不是新增 */
.editing-chip {
  display: flex; align-items: center; gap: 8px; margin-bottom: 7px;
  padding: 7px 12px; border-radius: 10px;
  background: var(--surface-2); color: var(--muted); font-size: 12.5px;
}
.editing-chip span { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.editing-chip button { border: none; background: none; color: var(--dim);
                       cursor: pointer; font: inherit; padding: 0 2px; }
/* 被改的那条和它之后的先变淡 —— 发出去它们就没了，先让她看见 */
.msg.is-stale { opacity: .38; }

/* ─────────────────────────────────────────────── 她发出去的附件 */
/* 图片出缩略图，其他文件出一张带文件名的小卡。
   气泡里原来只画文字，她刷新一次就再也不知道自己那条带了什么文件 */
.msg-user .att-img {
  display: block; max-width: 200px; max-height: 200px;
  border-radius: 18px; margin-bottom: 8px; object-fit: cover;
}
.att-file {
  display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
  padding: 9px 11px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line-soft);
}
.att-file .i { width: 17px; height: 17px; flex: none; color: var(--muted); }
.att-name { flex: 1; min-width: 0; font-size: 13px;
            overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.att-size { flex: none; font-size: 11.5px; color: var(--dim); }

/* 音频附件继续使用现有 attachment 数据，只把可播放文件渲染成更柔和的语音卡。 */
.voice-card {
  width: min(100%, 260px, 68vw); margin-bottom: 9px; padding: 10px 12px;
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center; gap: 10px;
  background: var(--bubble-assistant); border: 1px solid var(--border-divider);
  border-radius: 20px;
}
.voice-play {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: var(--bubble-thought);
  color: var(--icon-strong); cursor: pointer;
}
.voice-play .i { width: 16px; height: 16px; }
.voice-wave { height: 24px; display: flex; align-items: center; gap: 3px; overflow: hidden; }
.voice-wave i {
  width: 3px; height: var(--h, 8px); flex: none; border-radius: 999px;
  background: var(--bubble-user); opacity: .78;
}
.voice-card.is-playing .voice-wave i { animation: voice-soft-pulse .9s ease-in-out infinite alternate; }
.voice-card.is-playing .voice-wave i:nth-child(2n) { animation-delay: -.35s; }
.voice-time { color: var(--text-secondary); font-size: 12px; font-variant-numeric: tabular-nums; }
.voice-name {
  grid-column: 2 / 4; margin-top: -6px; overflow: hidden;
  color: var(--text-secondary); font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis;
}
@keyframes voice-soft-pulse { from { transform: scaleY(.72); } to { transform: scaleY(1.08); } }

/* 长按后才创建的技术详情，不在日常聊天流里占位置。 */
.message-details { display: flex; flex-direction: column; gap: 18px; }
.message-detail-section { display: flex; flex-direction: column; gap: 8px; }
.message-detail-section h4 {
  margin: 0; color: var(--text-secondary); font: inherit; font-size: 12px;
  font-weight: 650; letter-spacing: .05em; text-transform: uppercase;
}
.message-detail-grid {
  overflow: hidden; border: 1px solid var(--border-divider); border-radius: 16px;
  background: var(--surface-primary);
}
.message-detail-row {
  display: flex; align-items: flex-start; gap: 18px; padding: 10px 13px;
  border-bottom: 1px solid var(--border-divider); font-size: 13px;
}
.message-detail-row:last-child { border-bottom: 0; }
.message-detail-row span:first-child { color: var(--text-secondary); }
.message-detail-row span:last-child { margin-left: auto; text-align: right; word-break: break-word; }
.tool-detail { padding: 11px 13px; border-bottom: 1px solid var(--border-divider); }
.tool-detail:last-child { border-bottom: 0; }
.tool-detail strong { display: block; margin-bottom: 3px; font-size: 13px; }
.tool-detail p { margin: 0; color: var(--text-secondary); font-size: 12.5px; white-space: pre-wrap; }

/* 生成中：发送键变成一个小方块 = 暂停 */
.send.is-stop { background: var(--surface-2); color: var(--text); border-color: var(--border-divider); }

/* 正在想的时候那一行是活的 */
@keyframes think-pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

/* Classic — values mirror Classic预览.html. This is the everyday theme, so it
   deliberately owns its complete chat geometry instead of inheriting Claude/GPT. */
html[data-layout-preset="classic"], .classic-live-preview { --fs:14px; --R:1.5; --PV:.4; --PH:.9; }
html[data-layout-preset="classic"] .floating-controls {
  top: 0; left: 0; right: 0; gap: 10px; padding: calc(env(safe-area-inset-top) + var(--page-top-gap)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  }
html[data-layout-preset="classic"] .floating-controls::before { display:none; }
html[data-layout-preset="classic"] .icon-btn {
  width:46px; height:46px; flex:0 0 46px; border:0; border-radius:50%;
  background:var(--bg); box-shadow:0 2px 14px rgba(0,0,0,.08),0 0 0 1px var(--border-divider);
}
html[data-layout-preset="classic"] .chat-head-actions {
  height:46px; gap:4px; padding:0 6px; border:0; border-radius:999px; background:var(--bg);
  box-shadow:0 2px 14px rgba(0,0,0,.08),0 0 0 1px var(--border-divider);
}
html[data-layout-preset="classic"] .chat-head-action { width:40px; height:40px; }
html[data-layout-preset="classic"] .chat-shell-title {
  top:calc(env(safe-area-inset-top) + var(--page-top-gap)); bottom:auto; left:76px; right:112px;
  height:46px; line-height:46px; display:block; font-size:17px; font-weight:600;
}
html[data-layout-preset="classic"] .thread {
  padding:calc(env(safe-area-inset-top) + var(--page-top-gap) + 54px) 12px 120px;
}
html[data-layout-preset="classic"],.classic-live-preview {
  --classic-inner-gap:7px; --classic-speaker-gap:20px; --classic-same-speaker-gap:14px;
}
html[data-layout-preset="classic"][data-classic-tail="false"],.classic-live-preview[data-tail="false"] { --classic-inner-gap:8px; }
html[data-layout-preset="classic"] .msg { margin:var(--classic-speaker-gap) 0 0; }
html[data-layout-preset="classic"] .msg.classic-same-speaker { margin-top:var(--classic-same-speaker-gap); }
html[data-layout-preset="classic"] .msg.classic-first { margin-top:14px; }
html[data-layout-preset="classic"][data-classic-merge="true"] .msg:not(.classic-group-start) { margin-top:var(--classic-inner-gap); }
html[data-layout-preset="classic"] .message-row {
  width:100%; align-items:var(--classic-row-align,flex-end); gap:8px;
}
html[data-layout-preset="classic"] .msg-user {
  width:100%; align-items:var(--classic-row-align,flex-end); gap:8px; margin-bottom:0;
}
html[data-layout-preset="classic"] .msg-ai { margin-bottom:0; }
html[data-layout-preset="classic"] .message-avatar {
  width:30px; height:30px; min-width:30px; min-height:30px; max-width:30px; max-height:30px;
  flex:0 0 30px; margin:0; border:0; border-radius:50%; font-size:11px;
}
html[data-layout-preset="classic"][data-classic-avatar-shape="rounded"] .message-avatar { border-radius:9px; }
html[data-layout-preset="classic"][data-classic-avatar="false"] .message-avatar,
html[data-layout-preset="classic"][data-classic-avatar-frequency="last"] .msg:not(.classic-group-end) .message-avatar { visibility:hidden; }
html[data-layout-preset="classic"] .message-stack {
  width:calc(100% - 38px); min-width:0; max-width:none; flex:0 1 calc(100% - 38px);
}
html[data-layout-preset="classic"] .classic-segment-row { width:100%; display:flex; align-items:var(--classic-row-align,flex-end); gap:8px; }
html[data-layout-preset="classic"] .classic-segment-row + .classic-segment-row,
html[data-layout-preset="classic"] .assistant-turn .message-segment + .message-segment { margin-top:var(--classic-inner-gap); }
html[data-layout-preset="classic"] .classic-segment-row > .message-segment { max-width:var(--classic-bubble-max-width,75%); }
/* Classic bubble has one source. Safari 18 does not accept length × number in
   calc(), so the approved 14px defaults are precomputed here. .bub owns the
   geometry; its only paint layer is the direct .bg child. */
.classic-tail,.classic-bubble-time,.classic-time-spacer { display:none; }
html[data-layout-preset="classic"] .bub,
.classic-live-preview .bub {
  --fs:14px; --R:1.5; --PV:.4; --PH:.9;
  --bub-radius:21px; --bub-pad-y:5.6px; --bub-pad-x:12.6px;
  position:relative; isolation:isolate; width:fit-content;
  max-width:min(100%,calc(75% + 28.5px));
  padding:var(--bub-pad-y,5.6px) var(--bub-pad-x,12.6px);
  border:0; border-radius:var(--bub-radius,21px); background:transparent; background-clip:padding-box;
  box-shadow:none; font-size:var(--fs,14px); line-height:1.4; letter-spacing:0;
  white-space:pre-wrap; word-break:break-word; overflow-wrap:break-word;
}
html[data-layout-preset="classic"] .bub > .bg,
.classic-live-preview .bub > .bg {
  position:absolute; z-index:-1; inset:0; display:block; pointer-events:none;
  border-radius:inherit; background:var(--bub-fill,#fff);
}
html[data-layout-preset="classic"] .bub[data-classic-role="user"] {
  --bub-fill:var(--classic-user-bg,#CFE0F1);
  margin-left:auto;
  color:var(--classic-user-text);
}
html[data-layout-preset="classic"] .bub[data-classic-role="assistant"] {
  --bub-fill:var(--classic-assistant-bg,#FFFFFF);
  color:var(--classic-assistant-text);
}
html[data-layout-preset="classic"] .classic-bubble p { margin:0; }
html[data-layout-preset="classic"] .classic-bubble p + p { margin-top:.4em; }
html[data-layout-preset="classic"] .classic-bubble p:empty { display:none; }
html[data-layout-preset="classic"][data-classic-elevation="light"] .classic-bubble,
.classic-live-preview[data-elevation="light"] .classic-bubble {
  filter:drop-shadow(0 1px 1.5px rgba(60,80,110,.07)) drop-shadow(0 4px 10px rgba(60,80,110,.07));
}
.classic-tail {
  position:absolute; z-index:-1; bottom:-7px; width:14px; height:13.5px;
  fill:var(--bub-fill,#fff); pointer-events:none; overflow:visible;
}
.classic-tail svg { display:block; width:100%; height:100%; overflow:visible; }
html[data-layout-preset="classic"][data-classic-tail="true"] .classic-group-end .classic-final-bubble > .classic-tail { display:block; }
html[data-layout-preset="classic"] .classic-bubble[data-classic-role="user"] > .classic-tail,
.classic-live-preview .classic-bubble[data-classic-role="user"] > .classic-tail { right:calc(var(--tx,9.69px) - 3px); }
html[data-layout-preset="classic"] .classic-bubble[data-classic-role="assistant"] > .classic-tail,
.classic-live-preview .classic-bubble[data-classic-role="assistant"] > .classic-tail { left:calc(var(--tx,9.69px) - 3px); transform:scaleX(-1); }
html[data-layout-preset="classic"] .classic-time-spacer,
.classic-live-preview .classic-time-spacer { display:inline-block; width:36.4px; height:1px; }
html[data-layout-preset="classic"] .classic-bubble-time,
.classic-live-preview .classic-bubble-time {
  display:block; position:absolute; right:10.08px; bottom:7.84px;
  color:currentColor; font-size:9.52px; line-height:1; opacity:.5; font-variant-numeric:tabular-nums;
}
html[data-layout-preset="classic"] .message-stack > .message-meta { display:none; }
html[data-layout-preset="classic"][data-classic-time="below"] .classic-time-spacer,
html[data-layout-preset="classic"][data-classic-time="below"] .classic-bubble-time,
html[data-layout-preset="classic"][data-classic-time="none"] .classic-time-spacer,
html[data-layout-preset="classic"][data-classic-time="none"] .classic-bubble-time { display:none; }
html[data-layout-preset="classic"][data-classic-time="below"] .message-stack > .message-meta { display:block; }
html[data-layout-preset="classic"][data-classic-time="below"][data-classic-tail="true"] .message-stack > .message-meta { margin-top:8px; }
html[data-layout-preset="classic"][data-classic-time="none"] .message-meta { display:none; }
html[data-layout-preset="classic"] .reasoning-wrap {
  max-width:calc((100% - 38px) * var(--classic-bubble-max-ratio,.75)); margin:0 0 0 38px; padding:0 0 5px;
}
html[data-layout-preset="classic"] .reasoning-toggle { min-height:0; padding:0; font-size:14px; color:var(--classic-assistant-text); opacity:.7; }
html[data-layout-preset="classic"] .reasoning-toggle .reasoning-clock,
html[data-layout-preset="classic"] .reasoning-toggle .chev { display:none; }
html[data-layout-preset="classic"][data-classic-thought="false"] .reasoning-wrap { display:none; }
html[data-layout-preset="classic"][data-classic-thought-shimmer="true"] .process-wrap.is-running .reasoning-summary {
  background:linear-gradient(90deg,var(--text-primary) 20%,var(--page-accent) 48%,var(--text-primary) 76%); background-size:220% 100%;
  -webkit-background-clip:text; background-clip:text; color:transparent; animation:classic-shimmer 1.6s linear infinite;
}
@keyframes classic-shimmer { to { background-position:-220% 0; } }
html[data-layout-preset="classic"] .assistant-actions { display:none; gap:0; margin:4px 0 0; }
html[data-layout-preset="classic"][data-classic-actions="press"] .assistant-actions { display:none !important; }
html[data-layout-preset="classic"][data-classic-actions="latest"] .msg-ai.is-latest .assistant-actions,
html[data-layout-preset="classic"][data-classic-actions="all"] .assistant-actions { display:flex !important; }
html[data-layout-preset="classic"] .assistant-actions .act { display:none; width:32px; height:30px; }
html[data-layout-preset="classic"] .assistant-actions .act[data-action="copy"],
html[data-layout-preset="classic"] .assistant-actions .act[data-action="retry"] { display:grid; }

html[data-layout-preset="classic"] .composer-wrap {
  padding:10px 12px calc(8px + env(safe-area-inset-bottom)); gap:8px;
  background:linear-gradient(to bottom,transparent,var(--bg) 28px);
}
html[data-layout-preset="classic"] .composer {
  min-height:40px; padding:0; display:grid; grid-template-columns:40px minmax(0,1fr); gap:8px;
  border:0; border-radius:0; background:transparent; box-shadow:none; }
html[data-layout-preset="classic"] .composer-add {
  grid-column:1; grid-row:1; width:40px; height:40px; border:0; border-radius:50%; background:var(--surface-input);
  box-shadow:0 2px 12px rgba(40,58,78,.08); }
html[data-layout-preset="classic"] .composer-main {
  grid-column:2; grid-row:1; min-height:40px; max-height:120px; padding:4px 42px 4px 14px;
  border:0; border-radius:21px; background:rgba(250,252,255,.72); box-shadow:0 2px 12px rgba(40,58,78,.08);
  }
html[data-layout-preset="classic"] .composer textarea { min-height:32px; max-height:112px; padding:6px 0; font-size:16px; line-height:20px; }
html[data-layout-preset="classic"] .composer-model,
html[data-layout-preset="classic"] .composer-mic { display:none; }
html[data-layout-preset="classic"] .composer-send {
  /* Shares the input's grid cell, not the wrapper's changing safe-area inset. */
  position:static; grid-column:2; grid-row:1; justify-self:end; align-self:end; z-index:1;
  margin:4px; width:32px; height:32px;
  border:0; border-radius:50%; background:var(--classic-accent); color:#fff;
}
html[data-layout-preset="classic"] .composer-send.is-classic-mic { background:transparent; color:var(--classic-assistant-text); }
html[data-layout-preset="classic"] .composer-send.is-recording { background:#c65f5a; color:#fff; animation:classic-record 1s ease-in-out infinite; }
@keyframes classic-record { 50% { transform:scale(.9); opacity:.72; } }
html[data-layout-preset="classic"] .send.is-stop { background:var(--classic-accent); color:#fff; }

/* 三个聊天主题共用这一套 visualViewport 位移。静止时仍由各主题自己的
   safe-area + 8px 规则贴底；键盘打开后只留 8px，不重复计算安全区。 */
html.keyboard-open[data-app-view="chat"] #view-chat .composer-wrap {
  position:relative; z-index:12;
  padding-bottom:8px;
  margin-bottom:var(--chat-keyboard-inset,var(--keyboard-height)); transform:none;
}
html.keyboard-open[data-app-view="chat"] #view-chat .thread {
  padding-bottom:22px;
}
#view-chat .thread { overflow-anchor:none; }
html[data-layout-preset="classic"] .editing-chip { margin-left:48px; }
html[data-layout-preset="classic"] .pop-item-meta { margin-left:auto; max-width:92px; overflow:hidden; color:var(--dim); font-size:13px; text-overflow:ellipsis; white-space:nowrap; }
html[data-layout-preset="classic"] #popover-card[data-pop-kind="bubble"] { width:200px; border-radius:18px; padding:6px; }
html[data-layout-preset="classic"] #popover-card[data-pop-kind="bubble"] .pop-item { min-height:44px; padding:11px 12px; font-size:15px; }
html[data-layout-preset="classic"] .sheet[data-sheet-kind="thought"] .sheet-card { background:var(--classic-bg-solid,#f1f4f8); border-radius:32px; }
html[data-layout-preset="classic"][data-classic-thought-height="large"] .sheet[data-sheet-kind="thought"] .sheet-card { height:72dvh; }
html.standalone-shell[data-layout-preset="classic"][data-classic-thought-height="large"] .sheet[data-sheet-kind="thought"] .sheet-card { height:72vh; }

/* Classic editor — the preview stays pinned while the six compact sections
   scroll underneath, matching the supplied editor reference. */
.classic-editor-screen { padding-bottom:110px; background:transparent; }
.classic-live-preview {
  --classic-fs:14px; --classic-bubble-flatness:.4; --classic-bubble-roundness:1.5;
  --classic-bubble-horizontal:.9; --classic-bubble-max-ratio:.75; --pe-user:#cfe0f1;
  --pe-user-text:#3c5168; --pe-ai:#fff; --pe-ai-text:#3f4e60; --pe-accent:#7596b8;
  position:sticky; z-index:8; top:0; height:290px; margin:12px 14px 4px; overflow:hidden;
  border-radius:24px; background:linear-gradient(145deg,#f5e8ef,#e6eff8);
  box-shadow:0 12px 30px rgba(52,75,98,.12);
}
.classic-preview-head { height:54px; padding:9px 12px; display:grid; grid-template-columns:42px 1fr auto; align-items:center; color:#3e4b5a; }
.classic-preview-head button,.classic-preview-head span { height:36px; padding:0 12px; border:0; border-radius:20px; background:rgba(255,255,255,.65); color:inherit; }
.classic-preview-head strong { text-align:center; font-size:14px; }
.classic-preview-thread { padding:6px 12px 58px; }
.classic-preview-thought { min-height:20px; margin-left:38px; padding:0 0 5px; color:#657487; font-size:10px; }
.classic-preview-line { width:100%; display:flex; align-items:flex-end; gap:8px; margin:14px 0 0; }
.classic-preview-line.user { justify-content:flex-end; }
.classic-preview-line > i { width:30px; height:30px; flex:0 0 30px; display:grid; place-items:center; overflow:hidden; border-radius:50%; background:#7c8fa3; color:#fff; font-size:7px; font-style:normal; }
.classic-preview-bubble { flex:0 1 auto; max-width:calc(100% * var(--classic-bubble-max-ratio,.75)); }
.classic-preview-line .bub[data-classic-role="assistant"] { --bub-fill:var(--pe-ai,#fff); color:var(--pe-ai-text); }
.classic-preview-line .bub[data-classic-role="user"] { --bub-fill:var(--pe-user,#cfe0f1); color:var(--pe-user-text); }
.classic-live-preview .classic-group-end .classic-final-bubble > .classic-tail { display:block; }
.classic-live-preview[data-time="none"] .classic-time-spacer,
.classic-live-preview[data-time="none"] .classic-bubble-time,
.classic-live-preview[data-time="below"] .classic-time-spacer,
.classic-live-preview[data-time="below"] .classic-bubble-time { display:none; }
.classic-live-preview[data-avatar="false"] .classic-preview-line>i { visibility:hidden; }
.classic-preview-composer { position:absolute; left:12px; right:12px; bottom:12px; height:40px; display:grid; grid-template-columns:40px 1fr 32px; gap:8px; align-items:center; }
.classic-preview-composer b,.classic-preview-composer span { height:40px; display:flex; align-items:center; background:rgba(250,252,255,.72); }
.classic-preview-composer b { justify-content:center; border-radius:50%; font-size:20px; font-weight:400; }
.classic-preview-composer span { margin-right:-40px; padding:0 46px 0 14px; border-radius:21px; color:#8a97a6; font-size:13px; }
.classic-preview-composer em { width:32px; height:32px; display:grid; place-items:center; border-radius:50%; background:var(--pe-accent); color:#fff; font-style:normal; }
.classic-editor-tabs { position:sticky; z-index:9; top:306px; display:flex; gap:18px; overflow-x:auto; padding:6px 20px 0; background:var(--page-bg); scrollbar-width:none; }
.classic-editor-tabs::-webkit-scrollbar { display:none; }
.classic-editor-tabs button { flex:none; padding:10px 0 9px; border:0; border-bottom:2px solid transparent; background:none; color:var(--settings-soft); font:600 13px/1 system-ui; }
.classic-editor-tabs button.on { border-color:var(--page-accent); color:var(--page-accent); }
.classic-editor-content { padding:4px 14px 12px; }
.classic-editor-group { margin:12px 0; }
.classic-editor-label { margin:0 12px 6px; color:var(--settings-soft); font-size:11px; font-weight:700; letter-spacing:.08em; }
.classic-editor-box { overflow:hidden; border-radius:20px; background:var(--page-card); box-shadow:0 7px 18px color-mix(in srgb,var(--page-text) 6%,transparent); }
.classic-editor-row { min-height:52px; padding:10px 14px; display:flex; align-items:center; gap:14px; border-bottom:1px solid var(--page-line); }
.classic-editor-row:last-child { border-bottom:0; }
.classic-editor-row-copy { min-width:0; flex:1; display:flex; flex-direction:column; gap:3px; }
.classic-editor-row-copy strong { color:var(--settings-ink); font-size:14px; font-weight:600; }
.classic-editor-row-copy small { color:var(--settings-soft); font-size:11px; line-height:1.35; }
.classic-segmented { flex:none; display:flex; padding:2px; border-radius:11px; background:var(--page-card); }
.classic-segmented button { min-height:29px; padding:0 9px; border:0; border-radius:9px; background:transparent; color:var(--settings-soft); font-size:11px; white-space:nowrap; }
.classic-segmented button.on { background:var(--page-accent-soft); color:var(--page-accent); box-shadow:0 2px 7px color-mix(in srgb,var(--page-text) 12%,transparent); }
.classic-range { width:min(46vw,190px); display:grid; grid-template-columns:1fr 42px; align-items:center; gap:8px; }
.classic-range input { width:100%; accent-color:var(--settings-accent); }
.classic-range span { color:var(--settings-soft); font-size:11px; text-align:right; }
.classic-color { width:38px; height:30px; padding:2px; border:0; border-radius:9px; background:var(--settings-accent-bg); }
.classic-text-input { width:min(52vw,220px); padding:9px 11px; border:0; border-radius:11px; background:var(--settings-accent-bg); color:var(--settings-ink); font:inherit; }
.classic-reset { width:calc(100% - 28px); margin:2px 14px 12px; padding:13px; border:0; border-radius:16px; background:var(--settings-card); color:var(--settings-accent); font-weight:650; }
.classic-reset { position:sticky; z-index:7; bottom:10px; margin:10px 28px; width:calc(100% - 56px); color:#b24747; box-shadow:0 8px 24px rgba(50,70,90,.12); }
.classic-scheme-list { display:flex; flex-direction:column; gap:10px; margin:12px 0; }
.classic-scheme-card { position:relative; width:100%; min-height:72px; padding:9px 12px; display:flex; align-items:center; gap:12px; border:0; border-radius:18px; background:var(--settings-card); color:var(--settings-ink); text-align:left; }
.classic-scheme-card>i { width:54px; height:54px; flex:none; border-radius:14px; background:linear-gradient(135deg,var(--a),var(--b)); }
.classic-scheme-card>span:not(.classic-scheme-actions) { display:flex; flex-direction:column; gap:4px; }
.classic-scheme-card small { color:var(--settings-soft); }
.classic-name-overlay { position:absolute; z-index:120; inset:0; display:grid; place-items:center; padding:24px; background:rgba(0,0,0,.12); }
.classic-name-card { width:min(320px,100%); padding:20px; display:flex; flex-direction:column; gap:14px; border-radius:24px; background:color-mix(in srgb,var(--settings-card) 90%,transparent); box-shadow:0 24px 70px color-mix(in srgb,var(--settings-ink) 22%,transparent); }
.classic-name-card strong { color:var(--settings-ink); font-size:17px; text-align:center; }
.classic-name-card input { width:100%; padding:12px 13px; border:1px solid var(--settings-line); border-radius:13px; background:var(--settings-card); color:var(--settings-ink); font:inherit; outline:none; }
.classic-name-actions { display:grid; grid-template-columns:1fr 1fr; gap:9px; }
.classic-name-actions button { min-height:42px; border:0; border-radius:13px; background:var(--settings-accent-bg); color:var(--settings-accent); font-weight:650; }
.classic-name-actions button.primary { background:var(--settings-accent); color:var(--accent-ink); }

/* Classic final — values below mirror the approved Classic editor and bubble
   previews. Products are supplied as px variables by appearance.js for Safari. */
html[data-app-view="home"] #app-wallpaper-layer::before,
#view-home::before { background-color:var(--home-background-color,var(--bg)); }

html[data-layout-preset="classic"] .bub,
.classic-live-preview .bub {
  max-width:var(--classic-bubble-max-width,75%);
  padding:var(--classic-bubble-pad-y,5.6px) var(--classic-bubble-pad-x,12.6px);
  border-radius:var(--classic-bubble-radius,21px);
}
html[data-layout-preset="classic"] .bub > .sh,
.classic-live-preview .bub > .sh {
  position:absolute; z-index:-1; inset:0; display:block; pointer-events:none;
  border-radius:inherit;
}
html[data-layout-preset="classic"] .bub > .sh > .bg,
.classic-live-preview .bub > .sh > .bg {
  position:absolute; inset:0; display:block; border-radius:inherit; background:var(--bub-fill,#fff);
}
.bub > .sh > .classic-tail {
  z-index:0; bottom:var(--classic-tail-bottom,-7px); width:var(--classic-tail-size,14px);
  height:var(--classic-tail-height,13.5px); fill:var(--bub-fill,#fff);
}
html[data-layout-preset="classic"][data-classic-tail="true"] .classic-group-end .classic-final-bubble > .sh > .classic-tail,
.classic-live-preview[data-tail="true"] .classic-group-end .classic-final-bubble > .sh > .classic-tail { display:block; }
html[data-layout-preset="classic"] .classic-bubble[data-classic-role="user"] > .sh > .classic-tail,
.classic-live-preview .classic-bubble[data-classic-role="user"] > .sh > .classic-tail { right:calc(var(--tx,9.69px) - 3px); }
html[data-layout-preset="classic"] .classic-bubble[data-classic-role="assistant"] > .sh > .classic-tail,
.classic-live-preview .classic-bubble[data-classic-role="assistant"] > .sh > .classic-tail { left:calc(var(--tx,9.69px) - 3px); transform:scaleX(-1); }

html[data-layout-preset="classic"][data-classic-message-mode="paragraph"] .message-avatar { display:none; }
html[data-layout-preset="classic"][data-classic-message-mode="paragraph"] .msg-ai .message-stack {
  width:100%; max-width:none; flex:1 1 100%;
}
html[data-layout-preset="classic"][data-classic-message-mode="paragraph"] .msg-user .message-stack { width:100%; flex-basis:100%; }
html[data-layout-preset="classic"] .msg-ai .body.classic-prose,
html[data-layout-preset="classic"] .classic-prose {
  width:100%; max-width:none; padding:0; color:var(--classic-assistant-text); font-size:var(--fs,14px);
  border:0; border-radius:0; background:transparent;
  line-height:1.6; white-space:normal; overflow-wrap:anywhere;
}
html[data-layout-preset="classic"] .classic-prose p { margin:0; }
html[data-layout-preset="classic"] .classic-prose p + p { margin-top:.6em; }
html[data-layout-preset="classic"][data-classic-message-mode="paragraph"] .msg-ai .message-meta {
  display:block; order:2; margin-top:5px; color:var(--classic-assistant-text); opacity:.5;
}
html[data-layout-preset="classic"][data-classic-message-mode="paragraph"][data-classic-time="none"] .msg-ai .message-meta { display:none; }
html[data-layout-preset="classic"][data-classic-message-mode="paragraph"] .msg-ai .assistant-actions { order:3; margin-top:2px; }
html[data-layout-preset="classic"][data-classic-message-mode="paragraph"] .reasoning-wrap { max-width:none; margin-left:0; }
html[data-layout-preset="classic"] .reasoning-toggle .reasoning-clock { display:block; width:14px; height:14px; }
html[data-layout-preset="classic"] .reasoning-toggle .chev { display:none; }

/* Appearance overview: three compact cards, one tap applies. */

/* The Settings header, preview and six tabs form one opaque pinned block. */
html[data-settings-surface="classic-editor"] #settings .modal-body { padding-top:0; }
.classic-editor-final { padding-bottom:0; }
.classic-editor-fixed { position:sticky; z-index:10; top:0; padding-top:0; background:var(--page-bg); }
.classic-editor-final .classic-live-preview {
  position:relative; top:auto; height:262px; margin:0 14px 10px; border-radius:24px;
  isolation:isolate; background:var(--classic-preview-bg,#f1f4f8); box-shadow:0 0 0 1px var(--settings-line); }
.classic-editor-final .classic-live-preview::before { content:""; position:absolute; z-index:-2; inset:-20px; background:var(--classic-preview-bg,#f1f4f8) var(--classic-preview-image,none) center/cover no-repeat; filter:blur(var(--classic-preview-blur,0)); }
.classic-editor-final .classic-live-preview::after { content:""; position:absolute; z-index:-1; inset:0; background:rgba(0,0,0,var(--classic-preview-veil,0)); pointer-events:none; }
.classic-editor-final .classic-preview-head { height:48px; padding:6px 12px; }
.classic-preview-full { white-space:nowrap; font-size:12px; }
.classic-editor-final .classic-preview-thread { padding:4px 12px 56px; }
.classic-editor-final .classic-preview-line { margin-top:10px; }
.classic-editor-final .classic-preview-line + .classic-preview-line { margin-top:var(--classic-speaker-gap); }
.classic-editor-final .classic-preview-line.assistant + .classic-preview-line.assistant,
.classic-editor-final .classic-preview-line.user + .classic-preview-line.user { margin-top:var(--classic-same-speaker-gap); }
.classic-editor-final .classic-preview-column > .classic-preview-bubble + .classic-preview-bubble { margin-top:var(--classic-inner-gap); }
.classic-editor-final .classic-preview-column { min-width:0; max-width:75%; display:flex; flex-direction:column; align-items:flex-start; }
.classic-editor-final .classic-preview-line.user .classic-preview-column { align-items:flex-end; }
.classic-editor-final .classic-live-preview[data-mode="paragraph"] .classic-preview-line.assistant .classic-preview-column { width:100%; max-width:100%; flex:1; }
.classic-editor-final .classic-preview-bubble { max-width:var(--classic-bubble-max-width,75%); }
.classic-editor-final .classic-preview-column .classic-preview-bubble { max-width:100%; }
.classic-preview-time,.classic-preview-actions { margin-top:2px; color:var(--classic-assistant-text); font-size:9px; opacity:.55; }
.classic-editor-final .classic-preview-line .message-avatar { width:30px; height:30px; flex:0 0 30px; border-radius:50%; object-fit:cover; }
.classic-editor-final .classic-preview-line .classic-prose { flex:1; line-height:1.6; color:var(--classic-assistant-text); }
.classic-editor-final .classic-live-preview[data-mode="paragraph"] .classic-preview-line .message-avatar { display:none; }
.classic-editor-final .classic-preview-thought { display:flex; gap:5px; margin:0 0 2px; border:0; background:transparent; color:var(--classic-assistant-text); font-size:10px; opacity:.7; }
.classic-editor-final .classic-preview-thought .reasoning-clock { display:inline; }
.classic-editor-final .classic-editor-tabs {
  position:relative; top:auto; gap:20px; padding:2px 20px 0; border-bottom:1px solid var(--page-line); background:var(--page-bg);
}
.classic-editor-final .classic-editor-tabs button { padding:9px 0 11px; border-bottom-width:3px; font-size:15px; font-weight:500; }
.classic-editor-final .classic-editor-tabs button.on { color:var(--page-accent); }
.classic-editor-final .classic-editor-content { padding:0 0 calc(24px + env(safe-area-inset-bottom)); }
/* Only while the keyboard is visible: bound the editor to visualViewport and
   give options their own native scroll area. Compact preview restores on blur. */
html.keyboard-open[data-settings-surface="classic-editor"] #settings .modal-card {
  height:var(--editor-visible-height,100%);
}
html.keyboard-open[data-settings-surface="classic-editor"] #settings .sheet-head { flex-shrink:0; }
html.keyboard-open[data-settings-surface="classic-editor"] #settings .modal-body {
  display:flex; overflow:hidden; padding-bottom:0;
}
html.keyboard-open[data-settings-surface="classic-editor"] #settings .classic-editor-final {
  display:flex; flex:1; flex-direction:column; min-height:0; overflow:hidden;
}
html.keyboard-open[data-settings-surface="classic-editor"] .classic-editor-fixed { position:relative; flex:none; }
html.keyboard-open[data-settings-surface="classic-editor"] .classic-live-preview { height:var(--editor-preview-height,262px); }
html.keyboard-open[data-settings-surface="classic-editor"] .classic-editor-content {
  flex:1; min-height:0; overflow-y:auto; overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch; touch-action:pan-y; padding-bottom:24px;
}
html.keyboard-open .classic-name-overlay { overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; }
html.keyboard-open .classic-name-card { flex-shrink:0; }
.classic-editor-final .classic-editor-group { margin:0 16px 20px; padding-top:16px; }
.classic-editor-final .classic-editor-group + .classic-editor-group { padding-top:0; }
.classic-editor-final .classic-editor-label { margin:0 0 8px; padding-left:4px; font-size:13px; letter-spacing:0; }
.classic-editor-final .classic-editor-row { min-height:52px; padding:11px 16px; }
.classic-editor-final .classic-editor-row-copy strong { font-size:15px; font-weight:400; }
/* Numeric avatar geometry is shared by real sentence rows and live preview.
   Position products are JS pixels, never CSS variable multiplication. */
html[data-layout-preset="classic"][data-classic-message-mode="sentence"] .bub,
.classic-live-preview[data-mode="sentence"] .bub { --fs:inherit; }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"] .msg-user,
html[data-layout-preset="classic"][data-classic-message-mode="sentence"] .message-row,
html[data-layout-preset="classic"][data-classic-message-mode="sentence"] .classic-segment-row,
.classic-live-preview[data-mode="sentence"] .classic-preview-line { align-items:flex-start; }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"] .message-avatar,
.classic-live-preview[data-mode="sentence"] .classic-preview-line .message-avatar {
  width:var(--classic-avatar-size,37px); height:var(--classic-avatar-size,37px);
  min-width:var(--classic-avatar-size,37px); min-height:var(--classic-avatar-size,37px);
  max-width:var(--classic-avatar-size,37px); max-height:var(--classic-avatar-size,37px);
  flex:0 0 var(--classic-avatar-size,37px); font-size:var(--classic-avatar-font,15.91px);
  font-weight:600; margin:0;
}
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar-shape="rounded"] .message-avatar,
.classic-live-preview[data-mode="sentence"][data-avatar-shape="rounded"] .message-avatar { border-radius:var(--classic-avatar-radius,11.1px); }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"] .message-stack {
  width:calc(100% - var(--classic-avatar-column,45px)); flex-basis:calc(100% - var(--classic-avatar-column,45px));
}
html[data-layout-preset="classic"] .assistant-reply.classic-avatar-every > .message-stack { width:100%; flex-basis:100%; }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"] .reasoning-wrap {
  margin-left:var(--classic-avatar-column,45px); max-width:var(--classic-avatar-thought-width);
}
html[data-layout-preset="classic"][data-classic-message-mode="sentence"] .classic-avatar-every > .message-stack > .message-meta,
html[data-layout-preset="classic"][data-classic-message-mode="sentence"] .classic-avatar-every > .message-stack > .assistant-actions { margin-left:var(--classic-avatar-column,45px); }
.classic-live-preview[data-mode="sentence"] .classic-preview-thought { margin-left:var(--classic-avatar-column,45px); }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar="false"] .message-avatar,
.classic-live-preview[data-mode="sentence"][data-avatar="false"] .message-avatar { display:none; }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar="false"] .msg-user,
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar="false"] .assistant-reply,
.classic-live-preview[data-mode="sentence"][data-avatar="false"] .classic-preview-line { padding-left:4px; padding-right:4px; }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar="false"] .message-stack { width:100%; flex-basis:100%; }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar="false"] .bub { max-width:var(--classic-no-avatar-max); }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar="false"] .classic-segment-row > .bub,
.classic-live-preview[data-mode="sentence"][data-avatar="false"] .classic-preview-column { max-width:var(--classic-no-avatar-every-max); }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar="false"] .reasoning-wrap,
.classic-live-preview[data-mode="sentence"][data-avatar="false"] .classic-preview-thought { margin-left:4px; }
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar="false"] .classic-avatar-every > .message-stack > .message-meta,
html[data-layout-preset="classic"][data-classic-message-mode="sentence"][data-classic-avatar="false"] .classic-avatar-every > .message-stack > .assistant-actions { margin-left:0; }
.classic-editor-final .classic-avatar-slider { flex-direction:column; align-items:stretch; gap:9px; }
.classic-avatar-group .classic-editor-label { margin:0; padding:0 14px 8px; }
.classic-avatar-group .classic-editor-row { font-size:15.5px; }
.classic-avatar-group .classic-editor-row-copy strong { font-size:15.5px; }
.classic-avatar-group .classic-editor-row-copy small { display:block; font-size:12px; margin-top:2px; line-height:1.45; }
.classic-avatar-group .appearance-switch { width:51px; height:31px; flex:0 0 51px; }
.classic-avatar-group .appearance-switch::after { top:2px; left:2px; width:27px; height:27px; box-shadow:0 2px 6px rgba(0,0,0,.18); transition:transform .2s; }
.classic-avatar-group .appearance-switch.is-on::after { left:2px; transform:translateX(20px); }
.classic-avatar-group .classic-segmented { border-radius:12px; padding:3px; background:color-mix(in srgb,var(--page-text) 7%,var(--page-bg)); }
.classic-avatar-group .classic-segmented button { flex:1; padding:8px 4px; font-size:14px; }
.classic-avatar-group .classic-segmented button.on { background:var(--page-card); color:var(--page-text); font-weight:600; box-shadow:0 1px 4px rgba(0,0,0,.08); }
.classic-avatar-slider .classic-editor-row-copy { flex:none; }
.classic-avatar-slider .classic-range { display:flex; align-items:center; width:100%; gap:10px; }
.classic-avatar-slider .classic-range input { flex:1; min-width:0; }
.classic-avatar-slider .classic-range span { min-width:46px; white-space:nowrap; font-size:13.5px; font-weight:500; font-variant-numeric:tabular-nums; }
.classic-avatar-ticks { display:flex; justify-content:space-between; margin-top:-2px; }
.classic-avatar-ticks button { padding:4px 2px; border:0; background:none; color:var(--page-subtext); font-size:12.5px; }
.classic-avatar-ticks button.on { color:var(--page-text); font-weight:600; }
.classic-avatar-foot { margin:0; padding:8px 14px 0; color:var(--page-subtext); font-size:12.5px; line-height:1.55; }
.classic-editor-final .classic-mode-hint { margin:-4px 20px 18px; color:var(--settings-soft); font-size:12px; line-height:1.55; }
.classic-editor-final .classic-reset {
  position:static; width:calc(100% - 32px); height:48px; margin:0 16px 7px; padding:0;
  border-radius:18px; background:var(--settings-card); color:#c24d4d; box-shadow:0 0 0 1px var(--settings-line); font-size:15px;
}
.classic-auto-save-note { margin:0 20px 4px; color:var(--settings-soft); font-size:11px; line-height:1.45; text-align:center; }

.classic-editor-final .classic-scheme-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; margin:16px; }
.classic-editor-final .classic-scheme-card { min-height:0; padding:8px; display:block; border:2px solid transparent; border-radius:18px; text-align:left; }
.classic-editor-final .classic-scheme-card.current { border-color:var(--settings-accent); }
.classic-scheme-thumb { height:82px; display:block; position:relative; overflow:hidden; border-radius:12px; background:var(--scheme-bg); }
.classic-scheme-thumb i { position:absolute; width:55%; height:20px; border-radius:12px; background:var(--scheme-ai); top:17px; left:8px; }
.classic-scheme-thumb i + i { width:48%; top:47px; right:8px; left:auto; background:var(--scheme-me); }
.classic-editor-final .classic-scheme-card strong { display:block; margin:8px 2px 2px; font-size:13px; }
.classic-editor-final .classic-scheme-card small { display:block; margin:0 2px; font-size:11px; }
.classic-editor-final .appearance-primary-action,.classic-editor-final .appearance-secondary-action { width:calc(100% - 32px); margin:0 16px 10px; }
.classic-scheme-menu-overlay { position:fixed; z-index:180; inset:0; display:grid; place-items:center; padding:24px; background:rgba(0,0,0,.2); }
.classic-scheme-menu { width:min(310px,100%); overflow:hidden; border-radius:20px; background:var(--settings-card); box-shadow:0 24px 70px rgba(0,0,0,.18); }
.classic-scheme-menu button { width:100%; min-height:52px; padding:0 18px; border:0; border-bottom:1px solid var(--settings-line); background:transparent; color:var(--settings-ink); font-size:16px; }
.classic-scheme-menu button:last-child { border-bottom:0; }
.classic-scheme-menu button.danger { color:#c24d4d; }

.home-wallpaper-preview {
  height:210px; position:relative; overflow:hidden; margin:0 14px 18px; border-radius:22px;
  background:var(--home-preview-solid,var(--settings-bg)) var(--home-preview-image,none) center/cover no-repeat;
  box-shadow:0 0 0 1px var(--settings-line);
}
.home-wallpaper-preview::before { content:""; position:absolute; inset:-20px; background:inherit; filter:blur(var(--home-preview-blur,0)); }
.home-wallpaper-preview::after { content:""; position:absolute; inset:0; background:rgba(0,0,0,var(--home-preview-veil,0)); }
.home-preview-date,.home-preview-card,.home-wallpaper-preview>i { position:absolute; z-index:1; background:rgba(255,255,255,.72); }
.home-preview-date { left:16px; top:16px; width:70px; height:74px; padding:10px; display:flex; flex-direction:column; border-radius:18px; }
.home-preview-date b { font-size:25px; }
.home-preview-date small { font-size:10px; }
.home-preview-card { left:98px; right:16px; top:16px; height:74px; border-radius:18px; }
.home-wallpaper-preview>i { left:16px; right:16px; bottom:16px; height:82px; border-radius:18px; }

/* Persona libraries follow the supplied settings preview and active palette. */
.persona-library{padding:0 16px 22px}
.persona-library-card{background:var(--card);border:1px solid var(--line);border-radius:22px;overflow:hidden;margin-bottom:22px}
.persona-library-row{display:flex;align-items:center;gap:12px;padding:0 16px;min-height:66px;position:relative}
.persona-library-row+.persona-library-row:before,.persona-library-field+.persona-library-field:before{content:"";position:absolute;left:16px;right:0;top:0;border-top:1px solid var(--line)}
.persona-library-main{flex:1;min-width:0;padding:12px 0;text-align:left;background:none;border:0;color:var(--text);font-size:16px}
.persona-library-main span{display:block;overflow-wrap:anywhere}
.persona-library-main small{display:block;color:var(--dim);font-size:12.5px;line-height:1.4;margin-top:3px;overflow-wrap:anywhere}
.persona-library-field{display:flex;align-items:center;gap:12px;position:relative;min-height:54px;padding:12px 16px;font-size:16px;color:var(--text)}
.persona-library-field>span{flex-shrink:0}
.persona-library-field input:not([type=checkbox]){min-width:0;width:100%;flex:1;background:none;border:0;outline:none;color:var(--text);text-align:right;font-size:16px}
.persona-library-switch{appearance:none;-webkit-appearance:none;width:51px;height:31px;flex:0 0 51px;background:var(--line);border:0;border-radius:999px;position:relative;cursor:pointer;margin-left:auto}
.persona-library-switch:before{content:"";position:absolute;width:27px;height:27px;left:2px;top:2px;background:#fff;border-radius:50%;box-shadow:0 1px 3px #0002;transition:transform .15s}
.persona-library-switch:checked{background:var(--accent)}
.persona-library-switch:checked:before{transform:translateX(20px)}
.persona-library-add{border:0;background:none;color:var(--accent);font-size:26px;min-width:44px;min-height:44px}
.persona-library-editor{display:block;box-sizing:border-box;width:100%;border:0;outline:none;resize:none;background:transparent;padding:16px;color:var(--text);font-family:inherit;font-size:16px;line-height:1.7}
.persona-library-heading{font-size:13px;color:var(--dim);padding:0 16px 8px}
.persona-library-foot{font-size:12.5px;line-height:1.5;color:var(--dim);padding:0 16px;margin:8px 0 22px}
.persona-library-delete{margin-top:22px}
.persona-library-delete button{width:100%;min-height:54px;padding:12px 16px;text-align:left;color:var(--danger,#d64d4d);background:none;border:0;font-size:16px}
.skill-open-notes{font-size:12px;line-height:1.6;color:var(--dim);margin:2px 0 8px;align-self:stretch}
