/* 外观借自 dwell-on-something（PolyForm Noncommercial 1.0.0）：配色、液态玻璃、顶栏、悬浮输入框 */
:root {
  --bg: #faf9f5;
  --card: #ffffff;
  --panel: #f0eee6;
  --line: #e8e5dc;
  --text: #2b2a27;
  --dim: #8a867c;
  --accent: #c96442;
  --accent-soft: #d97757;
  --user-bubble: #f0eee6;
  --red: #c0392b;
  --overlay: rgba(40, 38, 34, .4);
  --serif: "Songti SC", "Noto Serif SC", Georgia, serif;
  --glass: color-mix(in srgb, var(--card) 70%, transparent);
  --glass-shadow:
    0 10px 34px rgba(0,0,0,.09),
    0 1px 3px rgba(0,0,0,.05),
    inset 0 1px 0 rgba(255,255,255,.92),
    inset 0 -7px 18px rgba(255,255,255,.34),
    inset 0 0 0 1px rgba(255,255,255,.44);
  --glass-top: 76%;
  --glass-bottom: 58%;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262624; --card: #30302e; --panel: #383836; --line: #3d3d3a;
    --text: #f5f4ef; --dim: #a3a099; --user-bubble: #353532;
    --red: #e07a6a; --overlay: rgba(0, 0, 0, .55);
    --glass-shadow:
      0 12px 38px rgba(0,0,0,.42),
      0 1px 3px rgba(0,0,0,.3),
      inset 0 1px 0 rgba(255,255,255,.16),
      inset 0 -7px 18px rgba(255,255,255,.045),
      inset 0 0 0 1px rgba(255,255,255,.09);
    --glass-top: 74%;
    --glass-bottom: 56%;
  }
}
:root[data-theme="dark"] {
    --bg: #262624; --card: #30302e; --panel: #383836; --line: #3d3d3a;
    --text: #f5f4ef; --dim: #a3a099; --user-bubble: #353532;
    --red: #e07a6a; --overlay: rgba(0, 0, 0, .55);
    --glass-shadow:
      0 12px 38px rgba(0,0,0,.42),
      0 1px 3px rgba(0,0,0,.3),
      inset 0 1px 0 rgba(255,255,255,.16),
      inset 0 -7px 18px rgba(255,255,255,.045),
      inset 0 0 0 1px rgba(255,255,255,.09);
    --glass-top: 74%;
    --glass-bottom: 56%;
  }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; max-width: 100vw;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  font-size: 16px; line-height: 1.7;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.dim { color: var(--dim); font-size: 14px; }

/* 液态玻璃：半透明 + 模糊 + 四道内阴影 */
.glass, .composer {
  background: var(--glass);
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--card) var(--glass-top), transparent),
    color-mix(in srgb, var(--card) var(--glass-bottom), transparent));
  -webkit-backdrop-filter: blur(24px) saturate(1.9) brightness(1.04);
  backdrop-filter: blur(24px) saturate(1.9) brightness(1.04);
  box-shadow: var(--glass-shadow);
}

/* ============ 顶栏：悬浮，消息从底下滑过去 ============ */
#top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding: 8px 12px 20px; padding-top: calc(8px + env(safe-area-inset-top));
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--bg) 88%, transparent) 0%,
    color-mix(in srgb, var(--bg) 55%, transparent) 55%,
    transparent 100%);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 52%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 52%, transparent 100%);
}
.iconbtn { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex: none; }
.iconbtn:active { background: rgba(128,128,128,.12); }
.title { flex: 1; text-align: center; min-width: 0; }
.title h1 { margin: 0; font-size: 17px; font-weight: 600; line-height: 1.3; }
.title .sub { font-size: 12px; color: var(--dim); line-height: 1.2; }
.title .sub.typing { color: var(--accent); }

.menuCard {
  position: fixed; z-index: 40; border-radius: 18px; padding: 6px; min-width: 170px;
  display: flex; flex-direction: column;
}
#menu { right: 12px; top: calc(54px + env(safe-area-inset-top)); }
.menuCard button { text-align: left; padding: 10px 14px; border-radius: 12px; font-size: 15px; }
.menuCard button:active { background: rgba(128,128,128,.14); }

/* ============ 消息流 ============ */
#list {
  position: fixed; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  padding: calc(76px + env(safe-area-inset-top)) 18px var(--foot-h, 150px);
}
#msgs { max-width: 720px; margin: 0 auto; }
.older { text-align: center; color: var(--dim); font-size: 13px; padding: 6px; }
.day { text-align: center; font-size: 12px; color: var(--dim); margin: 22px 0 10px; }
.row { display: flex; margin-top: 8px; transition: transform .15s; }
.row.gap { margin-top: 20px; }
.row.her { justify-content: flex-end; }
.him .content { max-width: 100%; min-width: 0; }
.her .content { max-width: 85%; min-width: 0; display: flex; flex-direction: column; align-items: flex-end; }

/* 他：不套气泡，直接铺开；她：灰色圆角气泡 */
.gu { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble {
  background: var(--user-bubble); border-radius: 18px; padding: 9px 15px;
  white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%;
}
.gu a, .bubble a { color: var(--accent); }
.time { font-size: 11.5px; color: var(--dim); margin-top: 3px; line-height: 1.2; user-select: none; }
.her .time { text-align: right; }
.time .fail { color: var(--red); font-weight: 600; }
.flash { animation: flash 1.3s; }
@keyframes flash { 0%, 55% { background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 12px; } }

.quote {
  display: block; width: 100%; text-align: left; border-left: 2.5px solid var(--accent-soft);
  padding: 1px 10px; margin: 2px 0 6px; font-size: 14px; color: var(--dim); line-height: 1.5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quote b { display: block; font-weight: 600; font-size: 12.5px; color: var(--accent); }

.media { display: block; max-width: min(240px, 70vw); max-height: 320px; border-radius: 14px; margin: 4px 0; }
.sticker { display: block; width: 132px; height: 132px; object-fit: contain; margin: 2px 0; }
.file { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; padding: 10px 12px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); margin: 4px 0; }
.file .fi { width: 36px; height: 36px; border-radius: 10px; background: var(--panel); display: grid; place-items: center; flex: none; color: var(--dim); }
.file .dim { font-size: 12.5px; }

/* 语音 */
.voice { display: inline-flex; align-items: center; gap: 10px; min-width: 200px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--panel); margin: 2px 0; }
.voice .play { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.voice .play svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.voice .track { flex: 1; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.voice .track i { display: block; height: 100%; width: 0; background: var(--accent-soft); }
.voice .dur { font-size: 12px; color: var(--dim); min-width: 30px; font-variant-numeric: tabular-nums; }

/* 思考 / 工具：一行「›」，点开才看 */
.toolline {
  color: var(--dim); font-size: 14.5px; cursor: pointer; user-select: none;
  display: flex; align-items: center; gap: 6px; min-height: 26px; max-width: 100%; text-align: left;
}
.toolline:active { opacity: .6; }
.toolline svg { width: 15px; height: 15px; flex: none; stroke-width: 1.8; }
.toolline .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.toolline .chev { flex: none; transition: transform .2s; width: 13px; height: 13px; }
.toolline.open .chev { transform: rotate(90deg); }
.fold {
  margin: 4px 0 6px 21px; padding: 2px 0 2px 12px; border-left: 2px solid var(--line);
  font-size: 14.5px; color: var(--dim); line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 55vh; overflow-y: auto;
}
.fold.tools { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.inner { font-family: var(--serif); font-style: italic; color: var(--dim); white-space: pre-wrap; }

.buttons { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.buttons button { padding: 7px 16px; border-radius: 999px; background: var(--panel); font-size: 14px; }
.buttons button:disabled { opacity: .45; }

/* ============ 底部：悬浮输入卡 ============ */
#foot {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 6px 12px calc(10px + env(safe-area-inset-bottom));
  pointer-events: none;
}
#foot > * { pointer-events: auto; }
.composer { max-width: 720px; margin: 0 auto; border-radius: 24px; padding: 12px 14px 10px; }
#input {
  width: 100%; border: 0; outline: 0; resize: none; background: transparent; color: var(--text);
  font: inherit; line-height: 1.6; max-height: 160px; padding: 2px 2px 8px; display: block;
}
#input::placeholder { color: var(--dim); }
.ctlrow { display: flex; align-items: center; gap: 8px; }
.ctlrow .gap { flex: 1; }
.round { width: 36px; height: 36px; border-radius: 50%; background: var(--panel); display: flex; align-items: center; justify-content: center; flex: none; }
.round svg { width: 17px; height: 17px; }
.round.on { background: var(--text); color: var(--bg); }
.send { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.send svg { width: 17px; height: 17px; }
.send:disabled { opacity: .35; }
.mini { width: 26px; height: 26px; display: grid; place-items: center; color: var(--dim); flex: none; }
.mini svg { width: 15px; height: 15px; }

.reply-bar { display: flex; align-items: center; gap: 6px; padding: 0 0 8px; }
.reply-line { flex: 1; min-width: 0; border-left: 2.5px solid var(--accent-soft); padding-left: 10px; font-size: 14px; line-height: 1.45; }
.reply-line b { display: block; color: var(--accent); font-size: 12.5px; font-weight: 600; }
.reply-line span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dim); }
.tray { display: flex; gap: 8px; padding-bottom: 8px; flex-wrap: wrap; }
.tray .item { position: relative; width: 54px; height: 54px; border-radius: 10px; overflow: hidden; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.tray img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tray .doc { font-size: 10.5px; color: var(--dim); padding: 4px; line-height: 1.3; overflow: hidden; height: 100%; }
.tray .x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; display: grid; place-items: center; }
.tray .up { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.35); color: #fff; font-size: 11px; }
.stickers { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 6px; max-height: 36vh; overflow-y: auto; padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line); }
.stickers button { aspect-ratio: 1; border-radius: 12px; }
.stickers button:active { background: rgba(128,128,128,.12); }
.stickers img { width: 100%; height: 100%; object-fit: contain; }
.stickers .add { box-shadow: inset 0 0 0 1.5px var(--line); color: var(--dim); font-size: 13px; }

.doing {
  width: max-content; max-width: 100%; margin: 0 auto 8px; padding: 6px 14px; border-radius: 999px;
  font-size: 13.5px; color: var(--dim); display: flex; align-items: center; gap: 8px;
}
.doing .dots { display: inline-flex; gap: 3px; }
.doing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-soft); animation: blink 1.2s infinite; }
.doing .dots i:nth-child(2) { animation-delay: .2s; }
.doing .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.to-bottom {
  position: absolute; right: 16px; top: -46px; width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text);
}

/* ============ 长按菜单、看大图、登录页、提示 ============ */
.ctx { min-width: 150px; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 60; display: grid; place-items: center; }
.viewer img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }
.login { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; z-index: 70; padding: 16px; }
.login .mark { font-family: var(--serif); font-size: 44px; font-weight: 700; color: var(--accent); }
.toast {
  position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 80;
  padding: 9px 16px; border-radius: 16px; font-size: 14px; max-width: calc(100vw - 32px);
}

/* ============ 侧边栏 ============ */
#drawerWrap { position: fixed; inset: 0; z-index: 45; display: none; }
#drawerWrap.open { display: block; }
#drawerWrap .shade { position: absolute; inset: 0; background: var(--overlay); opacity: 0; transition: opacity .22s; }
#drawerWrap.show .shade { opacity: 1; }
#drawer {
  position: absolute; top: 0; bottom: 0; left: 0; width: min(58vw, 224px);
  background: var(--bg); display: flex; flex-direction: column;
  padding: calc(16px + env(safe-area-inset-top)) 0 calc(14px + env(safe-area-inset-bottom));
  transform: translateX(-102%); transition: transform .24s ease; box-shadow: 4px 0 24px rgba(0,0,0,.12);
}
#drawerWrap.show #drawer { transform: none; }
.brand { font-family: var(--serif); font-size: 26px; font-weight: 700; padding: 6px 22px 14px; letter-spacing: .01em; }
.nav { flex: 1; overflow-y: auto; padding: 0 10px; }
.nav .sep { height: 1px; background: var(--line); margin: 8px 12px; }
.item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; border-radius: 12px; font-size: 16px; text-align: left; }
.item svg { width: 20px; height: 20px; stroke-width: 1.8; }
.item.on { background: var(--panel); }
.item:active { background: var(--panel); }
.drawer-foot { flex: none; padding: 8px 12px 0; border-top: 1px solid var(--line); margin-top: 8px; }

/* ============ 页面（从侧边栏打开，盖在聊天上面） ============ */
.page {
  position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top); animation: rise .22s ease;
}
@keyframes rise { from { transform: translateY(24px); opacity: .6; } }
.phead { flex: none; display: flex; align-items: center; padding: 8px 10px 6px; }
.phead .pt { flex: 1; text-align: center; font-size: 17px; font-weight: 600; }
.pbody { flex: 1; overflow-y: auto; padding: 6px 18px calc(24px + env(safe-area-inset-bottom)); }
.pbody.frame-body { padding: 0; overflow: hidden; }
.pbody.frame-body iframe { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
.seg { flex: none; display: flex; gap: 4px; margin: 2px 18px 10px; padding: 4px; border-radius: 999px; background: var(--panel); }
.seg button { flex: 1; padding: 6px 0; border-radius: 999px; font-size: 14px; color: var(--dim); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); font-weight: 600; }
.empty { text-align: center; color: var(--dim); padding: 40px 0; font-size: 14px; }
.err-line { color: var(--red); font-size: 13px; padding: 8px 0; }
.card { background: var(--card); border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 14.5px; }
.kv span:first-child { color: var(--dim); }
.bar { height: 5px; border-radius: 3px; background: var(--panel); overflow: hidden; margin: 6px 0 4px; }
.bar i { display: block; height: 100%; background: var(--accent-soft); border-radius: 3px; }
.rings { display: flex; gap: 12px; }
.ring { flex: 1; text-align: center; background: var(--card); border-radius: 18px; padding: 14px 8px 12px; box-shadow: inset 0 0 0 1px var(--line); }
.ring svg { width: 96px; height: 96px; margin: 0 auto; }
.ring .lb { font-size: 14px; font-weight: 600; margin-top: 4px; }
.ring .dim { font-size: 12px; }
.note-line { font-size: 13px; color: var(--dim); margin: 10px 2px 14px; }
.daynav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.daynav select { flex: 1; font: inherit; font-size: 14.5px; color: var(--text); background: var(--panel); border: 0; border-radius: 12px; padding: 8px 10px; }
.daynav button { width: 36px; height: 36px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; }
.daynav button:disabled { opacity: .35; }
.diary h3 { font-family: var(--serif); font-size: 19px; margin: 18px 0 6px; }
.diary p { margin: 0 0 12px; white-space: pre-wrap; line-height: 1.85; }
.ev { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ev .stripe { width: 4px; border-radius: 2px; flex: none; }
.ev .when { font-size: 12.5px; color: var(--dim); }
.ev .tag { font-size: 11px; color: #fff; padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.ev details { font-size: 13.5px; color: var(--dim); margin-top: 4px; }
.rem { padding: 12px 0; border-bottom: 1px solid var(--line); }
.rem .when { font-size: 12.5px; color: var(--dim); }

/* 相册 */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid button { aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--panel); }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .st img { object-fit: contain; padding: 6px; }
.more { display: block; margin: 16px auto; padding: 8px 18px; border-radius: 999px; background: var(--panel); font-size: 14px; color: var(--dim); }
.viewer-go { position: absolute; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 10px 20px; border-radius: 999px; font-size: 15px; color: var(--text); }

/* 搜索 */
.searchbar { flex: none; display: flex; align-items: center; gap: 8px; margin: 2px 18px 10px; padding: 9px 14px; border-radius: 999px; background: var(--panel); color: var(--dim); }
.searchbar input { flex: 1; border: 0; outline: 0; background: transparent; font: inherit; color: var(--text); }
.hit { display: block; width: 100%; text-align: left; padding: 12px 0; border-bottom: 1px solid var(--line); }
.hit .who { font-size: 12.5px; color: var(--dim); }
.hit .tx { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; line-height: 1.6; }
.hit mark { background: color-mix(in srgb, var(--accent) 22%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* 设置 */
.group-label { font-size: 13px; color: var(--dim); margin: 18px 4px 6px; }
.group { background: var(--card); border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.grow { display: flex; align-items: center; gap: 12px; padding: 13px 16px; min-height: 52px; }
.grow + .grow { border-top: 1px solid var(--line); }
.grow .lbl { flex: 1; min-width: 0; }
.grow .lbl small { display: block; font-size: 12.5px; color: var(--dim); line-height: 1.4; }
.toggle { position: relative; width: 48px; height: 28px; border-radius: 999px; background: var(--line); flex: none; transition: background .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(20px); }
.grow .seg { margin: 0; flex: none; }
.grow .seg button { padding: 4px 12px; flex: none; }
.num { width: 58px; font: inherit; text-align: center; color: var(--text); background: var(--panel); border: 0; border-radius: 10px; padding: 6px 4px; }
.grow select { font: inherit; color: var(--text); background: var(--panel); border: 0; border-radius: 10px; padding: 6px 8px; }
.saveBtn { padding: 6px 14px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 14px; flex: none; }

/* 正在输入：在他那一侧，像一条消息 */
.typing-row .typing { display: inline-flex; align-items: center; gap: 8px; color: var(--dim); font-size: 14px; padding: 4px 0; }
.typing-row .dots { display: inline-flex; gap: 4px; }
.typing-row .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-soft); animation: blink 1.2s infinite; }
.typing-row .dots i:nth-child(2) { animation-delay: .2s; }
.typing-row .dots i:nth-child(3) { animation-delay: .4s; }

/* ============ Claude 窗口专用 ============ */
.md { white-space: normal; overflow-wrap: anywhere; }
.md p { margin: 0 0 10px; }
.md p:last-child, .md ul:last-child, .md ol:last-child, .md pre:last-child, .md table:last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--serif); line-height: 1.4; margin: 14px 0 6px; }
.md h1 { font-size: 22px; } .md h2 { font-size: 19px; } .md h3, .md h4 { font-size: 17px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; }
.md li { margin: 2px 0; }
.md code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em; padding: 1px 5px; border-radius: 5px; background: rgba(128,128,128,.15); }
.md pre { margin: 8px 0 10px; padding: 12px 14px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); overflow-x: auto; }
.md pre code { background: none; padding: 0; font-size: 12.5px; line-height: 1.65; white-space: pre; }
.md blockquote { margin: 0 0 10px; padding-left: 12px; border-left: 2.5px solid var(--line); color: var(--dim); }
.md table { border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 5px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--panel); font-weight: 600; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.md a { color: var(--accent); }

.ask { background: var(--card); border-radius: 18px; box-shadow: inset 0 0 0 1px var(--line); padding: 12px 14px; max-width: 100%; }
.ask .what { font-size: 13px; color: var(--dim); margin-bottom: 4px; }
.ask .cmd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel); border-radius: 10px; padding: 8px 10px; }
.ask .q { font-weight: 600; margin: 4px 0 8px; }
.ask .opts { display: flex; flex-direction: column; gap: 6px; }
.ask .opt { text-align: left; padding: 9px 12px; border-radius: 12px; background: var(--panel); }
.ask .opt small { display: block; color: var(--dim); font-size: 12.5px; line-height: 1.4; }
.ask .opt.picked { background: var(--accent); color: #fff; }
.ask .opt.picked small { color: rgba(255,255,255,.8); }
.ask .acts { display: flex; gap: 8px; margin-top: 10px; }
.ask .acts button { flex: 1; padding: 9px; border-radius: 999px; font-weight: 600; }
.ask .yes { background: var(--accent); color: #fff; }
.ask .no { background: var(--panel); }
.ask .done { margin-top: 8px; font-size: 13px; color: var(--dim); }
.divider { text-align: center; font-size: 12.5px; color: var(--dim); margin: 22px 0 6px; }
.syserr { font-size: 13.5px; color: var(--red); border-left: 2px solid var(--red); padding-left: 10px; white-space: pre-wrap; }
.send.stop { background: var(--panel); color: var(--text); }
.send.stop svg { display: none; }
.send.stop::after { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--text); }

/* 下面这段和聊天 App（cyberboss web public/app.css）的一样：模型胶囊、上下文小圈、底部面板、压缩确认 */
/* 输入框左下角：模型（照 dwell-on-something 的 pill + 底部面板） */
.modelChip { display: flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px; background: var(--panel); font-size: 14px; color: var(--text); white-space: nowrap; flex: none; }
.modelChip:active { opacity: .7; }
.modelChip:empty { display: none; }
.msheetWrap { position: fixed; inset: 0; z-index: 55; display: none; }
.msheetWrap.open { display: flex; align-items: flex-end; justify-content: center; }
.msheetWrap .shade { position: absolute; inset: 0; background: var(--overlay); }
.msheet {
  position: relative; width: 100%; max-width: 640px; max-height: 86vh; min-height: 300px;
  background: var(--bg); border-radius: 24px 24px 0 0; display: flex; flex-direction: column;
  animation: rise .22s ease;
}
.msheet .head { flex: none; display: flex; align-items: center; padding: 16px 16px 12px; }
.msheet .hbtn { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; }
.msheet .hbtn svg { width: 19px; height: 19px; }
.msheet .ht { flex: 1; text-align: center; font-size: 18px; font-weight: 700; padding: 0 8px; }
.msheet .hspace { width: 40px; flex: none; }
.msheet .body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 6px 20px calc(20px + env(safe-area-inset-bottom)); }
.msheet .mgroup { background: var(--panel); border-radius: 18px; overflow: hidden; }
.msheet .mgap { height: 14px; }
.msheet .mrow { display: block; width: 100%; text-align: left; padding: 15px 18px; }
.msheet .mrow + .mrow, .msheet .mlink + .mlink { border-top: 1px solid var(--line); }
.msheet .mrow .mn { font-size: 16.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.msheet .mrow .ck { margin-left: auto; color: var(--accent); width: 18px; height: 18px; }
.msheet .mrow .md { font-size: 13.5px; color: var(--dim); margin-top: 2px; }
.msheet .mlink { display: flex; align-items: center; width: 100%; padding: 15px 18px; font-size: 16px; text-align: left; }
.msheet .mlink .val { margin-left: auto; color: var(--dim); font-size: 15px; }
.msheet .mlink .chev { color: var(--dim); font-size: 14px; margin-left: 6px; }
.msheet .mrow:active, .msheet .mlink:active { background: rgba(128,128,128,.08); }
.msheet .gnote { font-size: 13.5px; color: var(--dim); padding: 12px 6px 0; line-height: 1.6; }

/* 右上角上下文小圈 + 上下文面板 + 压缩确认 */
.ctxSpacer { visibility: hidden; }
.ctxRing svg { width: 22px; height: 22px; }
.ctxRing .trk { stroke: var(--line); stroke-width: 3; }
.ctxRing .val { stroke: var(--dim); stroke-width: 3; stroke-linecap: round; transition: stroke-dasharray .4s; }
.ctxRing.warn .val, .ubar.warn i { stroke: #d4a017; background: #d4a017; }
.ctxRing.hot .val, .ubar.hot i { stroke: var(--red); background: var(--red); }
.ucard { background: var(--panel); border-radius: 18px; padding: 16px 18px; }
.ucard + .ucard { margin-top: 10px; }
.ucard .utop { display: flex; align-items: baseline; justify-content: space-between; font-size: 15.5px; font-weight: 600; }
.ucard .utop .up { font-size: 14px; color: var(--dim); font-weight: 400; }
.ubar { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 10px 0 8px; }
.ubar i { display: block; height: 100%; border-radius: 999px; background: var(--dim); }
.ucard .ufoot { font-size: 13.5px; color: var(--dim); }
.ucard hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.msheet .glabel { font-size: 13.5px; color: var(--dim); padding: 18px 4px 8px; }
.compactBtn { display: block; width: 100%; margin-top: 18px; padding: 14px; border-radius: 16px; background: var(--panel); font-size: 16px; color: var(--text); }
.compactBtn:disabled { opacity: .4; }
.confirmWrap { position: fixed; inset: 0; z-index: 65; display: flex; align-items: center; justify-content: center; padding: 24px; }
.confirmWrap[hidden] { display: none; }
.confirmWrap .shade { position: absolute; inset: 0; background: var(--overlay); }
.confirmBox { position: relative; width: 100%; max-width: 320px; background: var(--card); border-radius: 22px; padding: 22px 20px 16px; animation: rise .18s ease; }
.confirmBox .ct { font-size: 17px; font-weight: 700; text-align: center; }
.confirmBox .cd { font-size: 14px; color: var(--dim); line-height: 1.65; margin-top: 10px; white-space: pre-line; }
.confirmBox .cbtns { display: flex; gap: 10px; margin-top: 18px; }
.confirmBox .cbtns button { flex: 1; padding: 12px 0; border-radius: 14px; background: var(--panel); font-size: 15.5px; }
.confirmBox .cbtns .danger { background: var(--accent); color: #fff; }
