/* ==========================================================================
   Digital Human — Liquid Glass × Plan A Design System
   Dual Character Theme ([data-char-theme="warm"|"cool"]) × Day/Night Mode
   ========================================================================== */

:root {
  /* Base Light · Warm (Sunlit Jade Botanical Liquid Glass) */
  --bg: #D5DFD8;
  --cream: #EEF3EF;
  --oat: rgba(255, 255, 255, 0.34);
  --card: rgba(255, 255, 255, 0.52);
  --card-solid: #FFFFFF;
  --ink: #181C1A;
  --ink-soft: #4F5752;
  --ink-faint: #737B76;
  --line: rgba(24, 34, 29, 0.10);
  --line-strong: rgba(24, 34, 29, 0.18);

  /* Accent (Warm Light = Deep Jade Celadon, matching lg-03) */
  --bean: #315242;
  --accent: #315242;
  --accent-2: #213A2E;
  --accent-soft: rgba(49, 82, 66, 0.14);
  --accent-border: rgba(49, 82, 66, 0.30);
  --accent-ink: #FAF7F2;
  --accent-shadow: rgba(34, 58, 46, 0.28);
  --accent-dot: #A26B58;
  --live-dot: #3EA66B;
  --danger: #C2483B;
  --danger-soft: rgba(194, 72, 59, 0.14);
  --like-active: #D95B66;
  --like-active-bg: rgba(217, 91, 102, 0.12);
  --like-active-border: rgba(217, 91, 102, 0.34);
  --like-glow: rgba(217, 91, 102, 0.24);

  /* Liquid Glass Surfaces (Translucent Specular Frosted Glass) */
  --glass-bg: linear-gradient(148deg, rgba(255, 255, 255, 0.56) 0%, rgba(255, 255, 255, 0.28) 50%, rgba(255, 255, 255, 0.44) 100%);
  --glass-bg-solid: #EEF2EE;
  --glass-surface: rgba(255, 255, 255, 0.36);
  --glass-surface-strong: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.74);
  --glass-highlight: rgba(255, 255, 255, 0.96);
  --glass-shadow: 0 22px 54px rgba(24, 42, 34, 0.14), 0 2px 10px rgba(24, 42, 34, 0.06);
  --glass-blur: blur(30px) saturate(195%);
  --scrim: rgba(20, 26, 22, 0.28);

  /* Painterly Daylight Ambient Mesh Gradients (visible refraction behind frosted panes) */
  --amb-1: rgba(242, 186, 144, 0.76);
  --amb-2: rgba(108, 174, 148, 0.70);
  --amb-3: rgba(140, 186, 212, 0.58);
  --amb-4: rgba(236, 202, 158, 0.66);

  /* Bubbles */
  --bot-bubble-bg: rgba(255, 255, 255, 0.62);
  --bot-bubble-border: rgba(255, 255, 255, 0.88);
  --bot-bubble-shadow: 0 8px 24px rgba(24, 40, 34, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.95);
  --user-bubble-bg: linear-gradient(135deg, #3B5D4D, #274135);
  --user-bubble-ink: #FAF7F2;

  /* Schedule Category Badges */
  --b-work: #8A5A3C; --b-work-bg: rgba(212, 160, 126, 0.22);
  --b-leisure: #3B634E; --b-leisure-bg: rgba(108, 168, 134, 0.18);
  --b-social: #3A6680; --b-social-bg: rgba(96, 158, 196, 0.18);
  --b-meal: #9A6A2E; --b-meal-bg: rgba(224, 174, 102, 0.22);
  --b-rest: #686259; --b-rest-bg: rgba(140, 132, 120, 0.16);
  --b-surprise: #A63F3F; --b-surprise-bg: rgba(216, 98, 98, 0.18);

  --chat-max-w: 840px;
  --radius-shell: 26px;
  --radius-card: 18px;
  --radius-pill: 999px;
}

/* Cool Character Theme · Light (Nordic Glacier Liquid Glass) */
html[data-char-theme="cool"] {
  --bg: #CBD8E6;
  --cream: #EBF1F8;
  --oat: rgba(255, 255, 255, 0.34);
  --ink: #141B24;
  --ink-soft: #4B596B;
  --ink-faint: #6D7D90;
  --line: rgba(20, 28, 38, 0.10);
  --line-strong: rgba(20, 28, 38, 0.18);

  --bean: #3468A0;
  --accent: #3468A0;
  --accent-2: #234A75;
  --accent-soft: rgba(52, 104, 160, 0.14);
  --accent-border: rgba(52, 104, 160, 0.32);
  --accent-ink: #FFFFFF;
  --accent-shadow: rgba(35, 74, 117, 0.28);
  --accent-dot: #4C84C2;
  --live-dot: #34B374;

  --glass-bg: linear-gradient(148deg, rgba(255, 255, 255, 0.58) 0%, rgba(242, 248, 255, 0.28) 50%, rgba(255, 255, 255, 0.45) 100%);
  --glass-bg-solid: #EDF3FA;
  --glass-shadow: 0 22px 54px rgba(18, 34, 56, 0.14), 0 2px 10px rgba(18, 34, 56, 0.06);

  --amb-1: rgba(118, 168, 232, 0.72);
  --amb-2: rgba(162, 150, 224, 0.54);
  --amb-3: rgba(112, 192, 212, 0.58);
  --amb-4: rgba(192, 214, 242, 0.64);

  --user-bubble-bg: linear-gradient(135deg, #437AB8, #2C578A);
  --user-bubble-ink: #FFFFFF;
}

/* Dark Mode — Warm (Warm Obsidian + Amber Sand, matching lg-05) */
html[data-color-mode="dark"] {
  --bg: #100E0C;
  --cream: #181512;
  --oat: rgba(255, 246, 232, 0.08);
  --card: rgba(255, 246, 232, 0.08);
  --card-solid: #1E1A16;
  --ink: #F4EFE7;
  --ink-soft: #B0A496;
  --ink-faint: #8A7F73;
  --line: rgba(255, 246, 232, 0.11);
  --line-strong: rgba(255, 246, 232, 0.18);

  --bean: #D2A074;
  --accent: #D2A074;
  --accent-2: #B07952;
  --accent-soft: rgba(214, 168, 128, 0.20);
  --accent-border: rgba(214, 168, 128, 0.38);
  --accent-ink: #19130F;
  --accent-shadow: rgba(168, 114, 86, 0.34);
  --accent-dot: #D9A579;
  --live-dot: #6EE7B7;
  --danger: #F87171;
  --danger-soft: rgba(248, 113, 113, 0.16);
  --like-active: #F07882;
  --like-active-bg: rgba(240, 120, 130, 0.16);
  --like-active-border: rgba(240, 120, 130, 0.38);
  --like-glow: rgba(240, 120, 130, 0.30);

  --glass-bg: linear-gradient(160deg, rgba(255, 248, 238, 0.088), rgba(255, 248, 238, 0.036));
  --glass-bg-solid: #1A1613;
  --glass-surface: rgba(255, 246, 232, 0.065);
  --glass-surface-strong: rgba(255, 246, 232, 0.125);
  --glass-border: rgba(255, 246, 232, 0.14);
  --glass-highlight: rgba(255, 248, 238, 0.17);
  --glass-shadow: 0 24px 60px rgba(0, 0, 0, 0.52);
  --scrim: rgba(0, 0, 0, 0.56);

  --amb-1: rgba(196, 146, 106, 0.22);
  --amb-2: rgba(132, 98, 76, 0.18);
  --amb-3: rgba(94, 118, 102, 0.16);
  --amb-4: rgba(74, 96, 114, 0.12);

  --bot-bubble-bg: rgba(255, 246, 232, 0.095);
  --bot-bubble-border: rgba(255, 246, 232, 0.15);
  --bot-bubble-shadow: inset 0 1px 0 rgba(255, 248, 238, 0.10);
  --user-bubble-bg: linear-gradient(135deg, rgba(208, 160, 120, 0.92), rgba(168, 114, 86, 0.94));
  --user-bubble-ink: #19130F;

  --b-work: #E8B894; --b-work-bg: rgba(214, 160, 120, 0.18);
  --b-leisure: #94D4AE; --b-leisure-bg: rgba(110, 196, 148, 0.16);
  --b-social: #9CC8F7; --b-social-bg: rgba(94, 152, 218, 0.18);
  --b-meal: #ECC688; --b-meal-bg: rgba(224, 178, 100, 0.18);
  --b-rest: #BEB4A8; --b-rest-bg: rgba(255, 246, 232, 0.10);
  --b-surprise: #FCA5A5; --b-surprise-bg: rgba(248, 113, 113, 0.18);
}

/* Dark Mode — Cool (Deep Refractive Steel Blue, matching lg-04) */
html[data-color-mode="dark"][data-char-theme="cool"] {
  --bg: #090C11;
  --cream: #101620;
  --oat: rgba(255, 255, 255, 0.08);
  --card: rgba(255, 255, 255, 0.08);
  --card-solid: #141B26;
  --ink: #EEF3FA;
  --ink-soft: #96A6BC;
  --ink-faint: #6F8097;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.19);

  --bean: #5892D6;
  --accent: #5892D6;
  --accent-2: #36649E;
  --accent-soft: rgba(84, 142, 208, 0.22);
  --accent-border: rgba(114, 172, 238, 0.42);
  --accent-ink: #FFFFFF;
  --accent-shadow: rgba(54, 100, 158, 0.42);
  --accent-dot: #7AB4F5;
  --live-dot: #4ADE80;

  --glass-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.088), rgba(255, 255, 255, 0.038));
  --glass-bg-solid: #111722;
  --glass-surface: rgba(255, 255, 255, 0.06);
  --glass-surface-strong: rgba(255, 255, 255, 0.13);
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-highlight: rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 24px 60px rgba(0, 0, 0, 0.54);

  --amb-1: rgba(58, 112, 178, 0.30);
  --amb-2: rgba(72, 126, 172, 0.24);
  --amb-3: rgba(44, 78, 128, 0.26);
  --amb-4: rgba(56, 94, 148, 0.18);

  --bot-bubble-bg: rgba(255, 255, 255, 0.095);
  --bot-bubble-border: rgba(255, 255, 255, 0.15);
  --bot-bubble-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --user-bubble-bg: linear-gradient(135deg, rgba(88, 146, 214, 0.94), rgba(54, 100, 158, 0.96));
  --user-bubble-ink: #FFFFFF;
}

/* Auto Mode follows OS prefers-color-scheme: dark */
@media (prefers-color-scheme: dark) {
  html[data-color-mode="auto"] {
    --bg: #100E0C;
    --cream: #181512;
    --oat: rgba(255, 246, 232, 0.08);
    --card: rgba(255, 246, 232, 0.08);
    --card-solid: #1E1A16;
    --ink: #F4EFE7;
    --ink-soft: #B0A496;
    --ink-faint: #8A7F73;
    --line: rgba(255, 246, 232, 0.11);
    --line-strong: rgba(255, 246, 232, 0.18);

    --bean: #D2A074;
    --accent: #D2A074;
    --accent-2: #B07952;
    --accent-soft: rgba(214, 168, 128, 0.20);
    --accent-border: rgba(214, 168, 128, 0.38);
    --accent-ink: #19130F;
    --accent-shadow: rgba(168, 114, 86, 0.34);
    --accent-dot: #D9A579;
    --live-dot: #6EE7B7;
    --danger: #F87171;
    --danger-soft: rgba(248, 113, 113, 0.16);
    --like-active: #F07882;
    --like-active-bg: rgba(240, 120, 130, 0.16);
    --like-active-border: rgba(240, 120, 130, 0.38);
    --like-glow: rgba(240, 120, 130, 0.30);

    --glass-bg: linear-gradient(160deg, rgba(255, 248, 238, 0.088), rgba(255, 248, 238, 0.036));
    --glass-bg-solid: #1A1613;
    --glass-surface: rgba(255, 246, 232, 0.065);
    --glass-surface-strong: rgba(255, 246, 232, 0.125);
    --glass-border: rgba(255, 246, 232, 0.14);
    --glass-highlight: rgba(255, 248, 238, 0.17);
    --glass-shadow: 0 24px 60px rgba(0, 0, 0, 0.52);
    --scrim: rgba(0, 0, 0, 0.56);

    --amb-1: rgba(196, 146, 106, 0.22);
    --amb-2: rgba(132, 98, 76, 0.18);
    --amb-3: rgba(94, 118, 102, 0.16);
    --amb-4: rgba(74, 96, 114, 0.12);

    --bot-bubble-bg: rgba(255, 246, 232, 0.095);
    --bot-bubble-border: rgba(255, 246, 232, 0.15);
    --bot-bubble-shadow: inset 0 1px 0 rgba(255, 248, 238, 0.10);
    --user-bubble-bg: linear-gradient(135deg, rgba(208, 160, 120, 0.92), rgba(168, 114, 86, 0.94));
    --user-bubble-ink: #19130F;

    --b-work: #E8B894; --b-work-bg: rgba(214, 160, 120, 0.18);
    --b-leisure: #94D4AE; --b-leisure-bg: rgba(110, 196, 148, 0.16);
    --b-social: #9CC8F7; --b-social-bg: rgba(94, 152, 218, 0.18);
    --b-meal: #ECC688; --b-meal-bg: rgba(224, 178, 100, 0.18);
    --b-rest: #BEB4A8; --b-rest-bg: rgba(255, 246, 232, 0.10);
    --b-surprise: #FCA5A5; --b-surprise-bg: rgba(248, 113, 113, 0.18);
  }

  html[data-color-mode="auto"][data-char-theme="cool"] {
    --bg: #090C11;
    --cream: #101620;
    --oat: rgba(255, 255, 255, 0.08);
    --card: rgba(255, 255, 255, 0.08);
    --card-solid: #141B26;
    --ink: #EEF3FA;
    --ink-soft: #96A6BC;
    --ink-faint: #6F8097;
    --line: rgba(255, 255, 255, 0.11);
    --line-strong: rgba(255, 255, 255, 0.19);

    --bean: #5892D6;
    --accent: #5892D6;
    --accent-2: #36649E;
    --accent-soft: rgba(84, 142, 208, 0.22);
    --accent-border: rgba(114, 172, 238, 0.42);
    --accent-ink: #FFFFFF;
    --accent-shadow: rgba(54, 100, 158, 0.42);
    --accent-dot: #7AB4F5;
    --live-dot: #4ADE80;

    --glass-bg: linear-gradient(160deg, rgba(255, 255, 255, 0.088), rgba(255, 255, 255, 0.038));
    --glass-bg-solid: #111722;
    --glass-surface: rgba(255, 255, 255, 0.06);
    --glass-surface-strong: rgba(255, 255, 255, 0.13);
    --glass-border: rgba(255, 255, 255, 0.14);
    --glass-highlight: rgba(255, 255, 255, 0.18);
    --glass-shadow: 0 24px 60px rgba(0, 0, 0, 0.54);

    --amb-1: rgba(58, 112, 178, 0.30);
    --amb-2: rgba(72, 126, 172, 0.24);
    --amb-3: rgba(44, 78, 128, 0.26);
    --amb-4: rgba(56, 94, 148, 0.18);

    --bot-bubble-bg: rgba(255, 255, 255, 0.095);
    --bot-bubble-border: rgba(255, 255, 255, 0.15);
    --bot-bubble-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    --user-bubble-bg: linear-gradient(135deg, rgba(88, 146, 214, 0.94), rgba(54, 100, 158, 0.96));
    --user-bubble-ink: #FFFFFF;
  }
}

/* Reset & Base */
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* Cold-start Auth Guard (Zero Character Leak & No Flash) */
body[data-auth="checking"] {
  background: #D5DFD8;
}
@media (prefers-color-scheme: dark) {
  body[data-auth="checking"] {
    background: #0A0D12;
  }
}
body[data-auth="checking"] .app,
body[data-auth="checking"] .drawer,
body[data-auth="checking"] .more-sheet,
body[data-auth="checking"] #devicePanel {
  display: none;
}

/* Fixed GPU-lightweight Ambient Mesh Backdrop */
.bg-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(880px 660px at 10% 12%, var(--amb-1), transparent 64%),
    radial-gradient(860px 680px at 88% 18%, var(--amb-2), transparent 62%),
    radial-gradient(820px 640px at 18% 88%, var(--amb-3), transparent 64%),
    radial-gradient(820px 620px at 86% 86%, var(--amb-4, var(--amb-1)), transparent 64%);
  transition: background 0.35s ease;
}

/* Liquid Glass Surface Primitive */
.glass-panel {
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-shell);
  box-shadow:
    var(--glass-shadow),
    inset 0 1.5px 0 var(--glass-highlight),
    inset 0 -1px 0 rgba(255, 255, 255, 0.14);
}

/* Subtle Translucent Glass Scrollbars (eliminates harsh default OS black bars) */
#sessionList,
#log,
.drawer,
#charPickerPanel,
.more-sheet {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
#sessionList::-webkit-scrollbar,
#log::-webkit-scrollbar,
.drawer::-webkit-scrollbar,
#charPickerPanel::-webkit-scrollbar,
.more-sheet::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
#sessionList::-webkit-scrollbar-track,
#log::-webkit-scrollbar-track,
.drawer::-webkit-scrollbar-track,
#charPickerPanel::-webkit-scrollbar-track,
.more-sheet::-webkit-scrollbar-track {
  background: transparent;
}
#sessionList::-webkit-scrollbar-thumb,
#log::-webkit-scrollbar-thumb,
.drawer::-webkit-scrollbar-thumb,
#charPickerPanel::-webkit-scrollbar-thumb,
.more-sheet::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}
#sessionList::-webkit-scrollbar-thumb:hover,
#log::-webkit-scrollbar-thumb:hover,
.drawer::-webkit-scrollbar-thumb:hover,
#charPickerPanel::-webkit-scrollbar-thumb:hover,
.more-sheet::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}

@supports not (backdrop-filter: blur(1px)) {
  .glass-panel {
    background: var(--glass-bg-solid);
  }
}

/* ==========================================================================
   Plan A 3-Column Shell (Desktop >1200px / Tablet 721-1200px / Mobile ≤720px)
   ========================================================================== */
.app {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr) 336px;
  gap: 14px;
  padding: 14px;
}

.app.drawer-collapsed,
.app.no-life-drawer {
  grid-template-columns: 256px minmax(0, 1fr);
}

/* ---- Left Glass Sidebar ---- */
.sidebar {
  min-width: 0;
  height: 100%;
  padding: 14px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.side-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 6px 0;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 660;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}
.brand-logo-badge {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 28% 24%, #222B36 0%, #141922 62%, #0D1016 100%);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 2px 8px rgba(18, 28, 34, 0.20), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  overflow: hidden;
}
.brand-logo-badge img {
  width: 16px;
  height: 16px;
  object-fit: contain;
  display: block;
}
.sidebar-close {
  display: none;
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
}
.sidebar-scrim { display: none; }

.side-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 16px;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
}
.avatar-lg {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--glass-border);
  flex-shrink: 0;
}
.side-meta { min-width: 0; flex: 1; }
.side-name {
  font-size: 15px;
  font-weight: 660;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.side-sub {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Hidden visually: character switching lives in ··· → 二级「切换联系人」弹窗，保留节点兼容旧契约 */
.char-select {
  display: none;
}

.sidebar .new-chat {
  padding: 10px 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px var(--accent-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.24);
  transition: transform 0.14s ease, filter 0.14s ease;
}
.sidebar .new-chat:hover { filter: brightness(1.06); }
.sidebar .new-chat:active { transform: scale(0.985); }

.side-section-label {
  font-size: 11px;
  font-weight: 620;
  color: var(--ink-faint);
  padding: 2px 8px 0;
  letter-spacing: 0.04em;
}

#sessionList {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 2px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sess {
  position: relative;
  padding: 9px 11px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.sess:hover {
  background: var(--glass-surface);
}
.sess.active {
  background: var(--glass-surface-strong);
  border-color: var(--glass-border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.sess .t {
  font-size: 13.2px;
  font-weight: 540;
  line-height: 1.4;
  padding-right: 18px;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sess .s {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.sess .rm {
  position: absolute;
  top: 7px;
  right: 8px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0 4px;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.14s ease;
}
.sess:hover .rm { opacity: 0.85; }
.sess .sess-unread {
  position: absolute;
  right: 9px;
  bottom: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent-dot);
  color: #fff;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.side-foot {
  padding: 10px 6px 2px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
}
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 12px;
  font-weight: 560;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 9px;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.user-badge:hover,
.user-badge[aria-expanded="true"] {
  background: var(--glass-surface-strong);
  border-color: var(--glass-border);
  color: var(--ink);
}
.header-admin-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 560;
  color: var(--ink-soft);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.header-admin-link:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--glass-surface-strong);
}

/* Hidden attribute utilities */
.user-badge[hidden],
.autoplay[hidden],
.seg-btn[hidden],
#lifeBtn[hidden],
.header-admin-link[hidden],
.sheet-action[hidden],
.sheet-reply-btn[hidden],
.voice-rec-sheet[hidden] { display: none; }

/* ==========================================================================
   Center Glass Chat Column
   ========================================================================== */
.main {
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.chat-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Slim Floating Glass Topbar */
header.topbar {
  min-height: 54px;
  padding: 8px 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--glass-surface);
  border-bottom: 1px solid var(--line);
}
/* 桌面端（>720px）左侧栏已常驻展示联系人头像与状态，隐藏中栏顶栏重复头像区、左侧改展示当前对话标题；移动端（≤720px）恢复头像并展示紧凑短标题 */
.topbar-left {
  display: none;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.topbar-session-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 8px;
}
.topbar-mobile-topic {
  display: none;
}
.avatar-sm {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--glass-border);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.10);
  flex-shrink: 0;
}
.topbar-who {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar-title-row {
  display: flex;
  align-items: center;
  gap: 7px;
}
header h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0.01em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  -webkit-font-smoothing: antialiased;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live-dot);
  box-shadow: 0 0 0 3px rgba(70, 160, 110, 0.18);
  flex-shrink: 0;
}
.topbar-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  min-width: 0;
}
.chip {
  display: inline-block;
  flex-shrink: 0;
  padding: 1px 8px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-soft);
  background: var(--glass-surface);
  white-space: nowrap;
}
.topbar-extra {
  font-size: 11.5px;
  color: var(--ink-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover {
  background: var(--glass-surface-strong);
  color: var(--ink);
  border-color: var(--accent-border);
}

#menuBtn { display: none; }

/* Reply Mode 3-Pill Glass Segmented Control */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 3px;
}
.seg-btn {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 540;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--glass-surface-strong);
  color: var(--accent);
  font-weight: 630;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#lifeBtn {
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  color: var(--ink-soft);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
#lifeBtn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--glass-surface-strong);
}

/* Desktop >1200px: hide #lifeBtn when docked 3rd column is visible; scope .drawer-collapsed strictly to >1200px */
@media (min-width: 1201px) {
  .app:not(.drawer-collapsed) #lifeBtn {
    display: none;
  }
  .app.drawer-collapsed .drawer {
    display: none;
  }
}

/* ---- Chat Message Stream ---- */
#log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}
#log.dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
  background: var(--accent-soft);
}

.empty {
  color: var(--ink-faint);
  font-size: 13.5px;
  text-align: center;
  margin: auto 0;
  padding: 36px 20px;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: min(78%, 640px);
}
.msg.user {
  align-self: flex-end;
  align-items: flex-end;
}
.msg.bot {
  align-self: flex-start;
}

.bot-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.bot-row > img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--glass-border);
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}
.bot-row .col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.bubble {
  padding: 11px 15px;
  border-radius: 20px;
  font-size: 14.8px;
  line-height: 1.62;
  white-space: pre-wrap;
  word-break: break-word;
}
.user .bubble {
  background: var(--user-bubble-bg);
  color: var(--user-bubble-ink);
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 22px var(--accent-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.bot .bubble {
  background: var(--bot-bubble-bg);
  border: 1px solid var(--bot-bubble-border);
  color: var(--ink);
  border-bottom-left-radius: 6px;
  box-shadow: var(--bot-bubble-shadow);
}
.hint {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 4px;
  opacity: 0.84;
}
.msg.user .read-receipt {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
  padding-right: 4px;
  line-height: 1.2;
  letter-spacing: 0.03em;
  user-select: none;
  opacity: 0.85;
}
.sys {
  align-self: center;
  font-size: 11.5px;
  color: var(--ink-soft);
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  padding: 4px 13px;
  border-radius: 999px;
}
.msg-time-divider {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 8px;
  user-select: none;
  pointer-events: none;
}
.msg-time-divider:first-child,
.history-more-bar + .msg-time-divider {
  margin-top: 2px;
}
.msg-time-divider > span {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--glass-surface);
  border: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 11.5px;
  line-height: 1.45;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  pointer-events: auto;
}
html[data-color-mode="dark"] .msg-time-divider > span {
  color: var(--ink-soft);
}
@media (prefers-color-scheme: dark) {
  html[data-color-mode="auto"] .msg-time-divider > span {
    color: var(--ink-soft);
  }
}
.thinking .bubble::after {
  content: "…";
  animation: blink 1.2s infinite;
}
@keyframes blink { 0%, 100% { opacity: 0.22; } 50% { opacity: 1; } }

/* ---- Lazy History Top Bar ---- */
.history-more-bar {
  align-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0 4px;
  min-height: 26px;
  text-align: center;
  user-select: none;
}
.history-more-btn {
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  line-height: 1.4;
  padding: 4px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.history-more-btn:hover {
  background: var(--glass-surface-strong);
  border-color: var(--accent-border);
  color: var(--accent);
}
.history-more-bar.is-error .history-more-btn {
  border-style: dashed;
  color: var(--danger);
}
.history-more-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-soft);
  padding: 3px 12px;
  border-radius: 999px;
  opacity: 0.82;
}
.history-more-bar.is-loading .history-more-label {
  background: var(--glass-surface);
  opacity: 0.95;
  animation: blink 1.2s infinite;
}
.history-more-bar.is-done .history-more-label {
  background: transparent;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

/* ---- Borderless Rounded Photos & User Image Grid ---- */
.bubble img.photo {
  display: block;
  width: auto;
  height: auto;
  max-width: min(272px, 72vw);
  max-height: 330px;
  border-radius: 18px;
  margin: 8px 0 2px;
  border: 1.5px solid var(--glass-border);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.15);
  cursor: zoom-in;
  transition: transform 0.18s ease;
}
.bubble img.photo:hover { transform: scale(1.01); }
.bubble .photo-err {
  display: inline-block;
  margin: 4px 0 2px;
  padding: 5px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--glass-surface);
  color: var(--ink-soft);
  font-size: 12px;
}

.user .bubble.has-images { padding: 10px 12px; }
.user .bubble.images-only { padding: 6px; }
.user .bubble .user-text {
  white-space: pre-wrap;
  word-break: break-word;
}
.user-images {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  width: min(268px, 66vw);
  max-width: 100%;
}
.user-images.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(304px, 72vw);
}
.user-images.single {
  display: block;
  width: auto;
  max-width: 100%;
}
.user-text + .user-images,
.user-images + .user-text {
  margin-top: 7px;
}
.user-images .user-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.14);
  cursor: zoom-in;
  transition: opacity 0.15s ease;
}
.user-images .user-photo:hover { opacity: 0.94; }
.user-images.single .user-photo {
  width: auto;
  height: auto;
  max-width: min(248px, 64vw);
  max-height: 268px;
  aspect-ratio: auto;
  border-radius: 16px;
}
.user-images .user-photo.is-loading {
  cursor: progress;
  background: linear-gradient(
    110deg,
    rgba(255, 255, 255, 0.14) 25%,
    rgba(255, 255, 255, 0.32) 50%,
    rgba(255, 255, 255, 0.14) 75%
  );
  background-size: 200% 100%;
  animation: user-photo-shimmer 1.2s infinite linear;
}
.user-images.single .user-photo.is-loading {
  width: 168px;
  height: 126px;
}
@keyframes user-photo-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.user-images .photo-err {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 48px;
  margin: 0;
  padding: 6px 10px;
  border: 1px dashed rgba(255, 255, 255, 0.52);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--user-bubble-ink);
  font-size: 12px;
  line-height: 1.4;
}

/* ---- Liquid Glass Voice Bar (16-Bar Waveform + Speed Toggle) ---- */
.voicebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  margin-bottom: 8px;
  background: var(--bot-bubble-bg);
  border: 1px solid var(--bot-bubble-border);
  border-radius: 18px;
  box-shadow: var(--bot-bubble-shadow);
  width: min(316px, 76vw);
  max-width: 100%;
}
.voicebar .vplay {
  width: 34px;
  height: 34px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--accent-shadow);
}
.voicebar .vplay:disabled { opacity: 0.5; cursor: default; }
.voicebar .vtrack {
  flex: 1;
  min-width: 72px;
  height: 24px;
  display: flex;
  align-items: center;
  position: relative;
  cursor: pointer;
}
.voicebar .vbars {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2.5px;
  width: 100%;
  height: 22px;
}
.voicebar .vbar {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--line-strong);
  transition: background 0.12s ease;
}
.voicebar .vbar.on {
  background: var(--accent);
}
.voicebar .vfill {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.25;
  pointer-events: none;
}
.voicebar .vtime {
  font-size: 11.5px;
  color: var(--ink-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.voicebar .vspeed {
  border: none;
  border-radius: 7px;
  padding: 2px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  flex-shrink: 0;
}
.voicebar .vspeed:hover { filter: brightness(1.08); }
.hint.vpending { font-style: italic; }

/* ---- 1:1 Cinema Video Card (.bc-card) ---- */
.bc-card {
  position: relative;
  width: min(296px, 78vw);
  aspect-ratio: 1 / 1;
  margin-top: 8px;
  border: 1.5px solid var(--glass-border);
  border-radius: 20px;
  overflow: hidden;
  background: #141210;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
}
.bc-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.bc-playbtn {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 60px;
  height: 60px;
  padding: 0 0 0 3px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.22);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  color: #fff;
  font-size: 21px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  transition: transform 0.15s ease, background 0.15s ease;
}
.bc-playbtn:hover {
  transform: scale(1.05);
  background: rgba(255, 255, 255, 0.30);
}
.bc-card.needs-tap .bc-playbtn { display: flex; }
.bc-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
}
.bc-status:empty { display: none; }
.bc-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: blink 1.2s infinite;
}
.bc-card .bc-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  background: radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.08), rgba(14, 14, 16, 0.92));
  color: #C7BFB2;
  font-size: 12.5px;
  line-height: 1.55;
}
.bc-card .bc-placeholder .t {
  font-size: 15.5px;
  font-weight: 620;
  color: #F6EFE5;
}

/* ---- Floating Liquid Glass Composer Dock ---- */
.composer-wrap {
  flex-shrink: 0;
  padding: 6px 20px max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

#pending {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 4px;
}
#pending:empty { display: none; }
#pending .chip-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-surface-strong);
  font-size: 12px;
  color: var(--ink-soft);
  max-width: 224px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
#pending .chip-file img {
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 8px;
}
#pending .chip-file .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 124px;
}
#pending .chip-file .rm {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
  padding: 0 3px;
}

#form.composer-dock {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 7px 8px 7px 10px;
  border-radius: 28px;
  background: var(--glass-surface-strong);
  border: 1px solid var(--glass-border);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.09), inset 0 1.5px 0 var(--glass-highlight);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
#form.composer-dock:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.12), 0 0 0 3px var(--accent-soft);
}

.dock-plus {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--glass-surface);
  color: var(--ink-soft);
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.dock-plus:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

#input {
  flex: 1;
  min-width: 0;
  resize: none;
  border: none;
  background: transparent;
  padding: 7px 4px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  line-height: 1.45;
  min-height: 36px;
  max-height: 150px;
  overflow-y: auto;
  outline: none;
}
#input::placeholder {
  color: var(--ink-faint);
}

#mic {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
#mic:hover {
  background: var(--glass-surface);
  color: var(--ink);
}
#mic.rec {
  background: var(--danger);
  color: #fff;
  animation: micpulse 1.2s infinite;
}
@keyframes micpulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 76, 62, 0.42); }
  50% { box-shadow: 0 0 0 9px rgba(220, 76, 62, 0); }
}

#send {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--accent-shadow);
  transition: transform 0.14s ease, filter 0.14s ease;
}
#send:hover:not(:disabled) { filter: brightness(1.08); }
#send:active:not(:disabled) { transform: scale(0.94); }
#send:disabled { opacity: 0.45; cursor: default; }

.mic-hint {
  font-size: 11.5px;
  color: var(--ink-soft);
  text-align: center;
  min-height: 0;
}
.mic-hint:empty { display: none; }

.ai-notice {
  flex-shrink: 0;
  text-align: center;
  font-size: 11px;
  color: var(--ink-faint);
  opacity: 0.85;
  padding: 0 10px 2px;
  user-select: none;
}

/* ---- Thumb-Friendly Liquid Glass Voice Recording Sheet ---- */
.voice-rec-sheet {
  width: 100%;
  max-width: 520px;
  margin: 0 auto 4px;
  padding: 16px 18px 14px;
  border-radius: 24px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(32px) saturate(190%);
  backdrop-filter: blur(32px) saturate(190%);
  border: 1px solid var(--glass-border);
  box-shadow: 0 -8px 34px rgba(0, 0, 0, 0.14), inset 0 1.5px 0 var(--glass-highlight);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.rec-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 640;
  color: var(--danger);
}
.rec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 5px var(--danger-soft);
  animation: blink 1.1s infinite;
}
.rec-timer {
  font-variant-numeric: tabular-nums;
}
.rec-wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
}
.rec-wave i {
  display: block;
  width: 4px;
  height: 12px;
  border-radius: 3px;
  background: linear-gradient(to top, var(--accent), var(--accent-dot));
  animation: recbar 1.05s ease-in-out infinite;
}
.rec-wave i:nth-child(2n) { animation-delay: 0.16s; }
.rec-wave i:nth-child(3n) { animation-delay: 0.32s; }
.rec-wave i:nth-child(4n) { animation-delay: 0.48s; }
.rec-wave i:nth-child(5n) { animation-delay: 0.64s; }
@keyframes recbar {
  0%, 100% { height: 10px; opacity: 0.55; }
  50% { height: 34px; opacity: 1; }
}
.rec-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.rec-btn-cancel {
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 9px 18px;
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  cursor: pointer;
}
.rec-btn-stop {
  width: 52px;
  height: 52px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(220, 76, 62, 0.36);
}
.rec-btn-send {
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 9px 18px;
  font: inherit;
  font-size: 13px;
  font-weight: 620;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--accent-shadow);
}

/* ==========================================================================
   Right Glass Companion & Life Column (#drawer)
   Desktop >1200px: Docked 3rd Glass Column
   Tablet ≤1200px: Slide-over Glass Drawer
   Mobile ≤720px: Full-Screen Glass Sheet
   ========================================================================== */
.drawer {
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.app.no-life-drawer .drawer {
  display: none;
}
.drawer-scrim { display: none; }

/* Companion Card ("TA 的当下") */
.companion-card {
  border-radius: 18px;
  padding: 12px;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}
.companion-hero {
  display: flex;
  align-items: center;
  gap: 10px;
}
.companion-avatar {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  object-fit: cover;
  border: 1.5px solid var(--glass-border);
  flex-shrink: 0;
}
.companion-info {
  min-width: 0;
  flex: 1;
}
.companion-name-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.companion-name {
  font-size: 15px;
  font-weight: 660;
}
.companion-mood-pill {
  font-size: 11px;
  font-weight: 620;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}
.companion-sub {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.companion-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--ink-faint);
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-variant-numeric: tabular-nums;
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 4px;
  flex-shrink: 0;
}
.drawer-head .t {
  font-size: 15px;
  font-weight: 660;
}
.drawer-head .sub {
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 1px;
}

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  flex-shrink: 0;
}
.drawer-tab {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 13px;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 560;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.drawer-tab:hover {
  color: var(--ink);
  background: var(--glass-surface-strong);
}
.drawer-tab.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 650;
}

.drawer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.drawer-view {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 10px;
}
.drawer-view.active { display: flex; }

/* ---- Editorial Diary View (Minimal Dot Calendar + Serif Reader) ---- */
.cal {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 11px 12px;
  flex-shrink: 0;
}
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.cal-title {
  font-size: 13.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.cal-nav { display: flex; gap: 4px; }
.cal-nav button {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  color: var(--ink-soft);
  border-radius: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.cal-nav button:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-wd {
  text-align: center;
  font-size: 10.5px;
  color: var(--ink-faint);
  padding: 2px 0 4px;
}
.cal-cell {
  min-height: 32px;
  border-radius: 10px;
  padding: 3px 0 7px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.cal-cell .d {
  font-size: 12px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  color: var(--ink-soft);
}
.cal-cell.has-diary {
  cursor: pointer;
  background: var(--glass-surface);
}
.cal-cell.has-diary .d {
  color: var(--ink);
  font-weight: 560;
}
.cal-cell.has-diary::after {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-dot);
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
}
.cal-cell.has-diary:hover {
  background: var(--accent-soft);
}
.cal-cell.today .d {
  color: var(--accent);
  font-weight: 700;
}
.cal-cell.sel {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 10px var(--accent-shadow);
}
.cal-cell.sel .d {
  color: var(--accent-ink);
  font-weight: 700;
}
.cal-cell.sel::after {
  background: var(--accent-ink);
}
/* Keywords kept in tooltip (title) for zero cramped overflow */
.cal-cell .kws { display: none; }

.diary-reader {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  overflow: hidden;
}
.diary-reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 6px 16px;
  flex-shrink: 0;
}
.diary-reader-head.is-empty { display: none; }
.diary-reader-head:has(> .diary-reader-title:empty):has(> .life-like-btn[hidden]) { display: none; }
.diary-reader-title {
  font-family: "Songti SC", "Noto Serif SC", "STSong", Georgia, serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  padding: 0;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.diary-reader-title:empty { display: none; }

/* ---- Liquid Glass Life Like Button (Heart Toggle + Pop Animation) ---- */
.life-like-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  color: var(--ink-faint);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
  font-size: 13.5px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
}
.life-like-btn[hidden] { display: none; }
.life-like-btn.compact {
  width: 24px;
  height: 24px;
  font-size: 12px;
}
.life-like-btn:hover:not(:disabled) {
  color: var(--like-active);
  border-color: var(--like-active-border);
  background: var(--like-active-bg);
}
.life-like-btn:active:not(:disabled) {
  transform: scale(0.92);
}
.life-like-btn:focus-visible {
  outline: 2px solid var(--like-active-border);
  outline-offset: 1px;
}
.life-like-btn.liked {
  color: var(--like-active);
  background: var(--like-active-bg);
  border-color: var(--like-active-border);
  box-shadow: 0 0 12px var(--like-glow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.life-like-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.life-like-btn.is-pop {
  animation: likePop 0.38s cubic-bezier(0.22, 1.4, 0.36, 1);
}
@keyframes likePop {
  0% { transform: scale(1); }
  35% { transform: scale(1.28); }
  68% { transform: scale(0.92); }
  100% { transform: scale(1); }
}
.diary-content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 16px 20px;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13.8px;
  line-height: 1.85;
  color: var(--ink);
}
.diary-content.empty {
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.diary-content.empty div {
  text-align: center;
  font-size: 13px;
  line-height: 1.65;
}

/* ---- Editorial Schedule Timeline ---- */
.sched-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  flex-shrink: 0;
}
.sched-range {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-nav button {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 4px 10px;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.sched-nav button:hover:not(:disabled) {
  border-color: var(--accent-border);
  color: var(--accent);
}
.sched-nav button:disabled { opacity: 0.4; cursor: default; }

.sched-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 2px 16px;
}
.sched-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sched-grid.solo { display: block; }
.sched-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sched-day-h {
  font-size: 12px;
  font-weight: 660;
  color: var(--accent);
  padding: 2px 4px 6px;
  margin-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}
.sb {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  border-radius: 15px;
  padding: 10px 11px;
  margin-bottom: 7px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sb:last-child { margin-bottom: 0; }
.sb.is-now {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}
.sb-time {
  font-size: 12px;
  font-weight: 620;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  width: 44px;
  flex-shrink: 0;
  padding-top: 1px;
}
.sb.is-now .sb-time { color: var(--accent); }
.sb-main { flex: 1; min-width: 0; }
.sb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}
.sb-head-right {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}
.sb-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.bt-work { color: var(--b-work); background: var(--b-work-bg); }
.bt-leisure { color: var(--b-leisure); background: var(--b-leisure-bg); }
.bt-social { color: var(--b-social); background: var(--b-social-bg); }
.bt-meal { color: var(--b-meal); background: var(--b-meal-bg); }
.bt-rest { color: var(--b-rest); background: var(--b-rest-bg); }
.bt-surprise { color: var(--b-surprise); background: var(--b-surprise-bg); }
.sb-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 560;
  color: var(--ink);
  word-break: break-word;
  line-height: 1.4;
}
.sb-note {
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 3px;
  word-break: break-word;
  line-height: 1.45;
}
.sb-none {
  font-size: 11px;
  color: var(--ink-faint);
  padding: 2px 4px;
}
.sched-empty {
  color: var(--ink-soft);
  font-size: 13px;
  text-align: center;
  padding: 40px 16px;
}

.whims {
  margin-top: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  background: var(--glass-surface);
  color: var(--ink-soft);
  font-size: 12px;
}
.whims summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 12px;
  user-select: none;
}
.whims summary::-webkit-details-marker { display: none; }
.whims summary::before { content: '▸'; margin-right: 4px; font-size: 10px; }
.whims[open] summary::before { content: '▾'; }
.whims-count { font-size: 11px; opacity: 0.85; font-variant-numeric: tabular-nums; }
.whims-list { padding: 2px 12px 12px; display: flex; flex-direction: column; gap: 9px; }
.whim-item { border-top: 1px dashed var(--line); padding-top: 8px; }
.whim-item:first-child { border-top: none; padding-top: 2px; }
.whim-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.whim-head-right { display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0; }
.whim-ts { font-size: 11px; font-variant-numeric: tabular-nums; opacity: 0.85; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whim-badge {
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--ink-soft);
  background: var(--oat);
}
.whim-badge.done { color: var(--b-leisure); background: var(--b-leisure-bg); }
.whim-badge.deferred { color: var(--b-rest); background: var(--b-rest-bg); }
.whim-text { margin-top: 3px; color: var(--ink); word-break: break-word; }
.whim-chain { font-size: 11px; color: var(--ink-soft); margin-top: 2px; word-break: break-word; }
.whim-none { color: var(--ink-soft); font-size: 12px; padding: 2px 2px 8px; }

/* ---- Growth & Wishes Views ---- */
.growth-scroll,
.wishes-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 2px 18px;
}
.growth-h,
.wishes-h {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--ink-faint);
  margin: 4px 4px 8px;
  letter-spacing: 0.05em;
}
.g-item {
  position: relative;
  border-left: 2px solid var(--line-strong);
  padding: 2px 0 14px 14px;
  margin-left: 6px;
}
.g-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}
.g-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}
.g-date { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; min-width: 0; }
.g-insight { font-size: 13.5px; margin: 3px 0 2px; line-height: 1.65; }
.g-prog { font-size: 11.5px; color: var(--ink-soft); margin: 2px 0; }
.g-meta { font-size: 10.5px; color: var(--ink-faint); margin-top: 3px; }
.wk-item {
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  padding: 10px 12px;
  margin: 7px 0;
  cursor: pointer;
  background: var(--glass-surface);
  transition: border-color 0.15s ease;
}
.wk-item:hover { border-color: var(--accent-border); }
.wk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.wk-meta {
  flex: 1;
  min-width: 0;
}
.wk-item .wk-name { font-size: 13px; font-weight: 560; word-break: break-all; }
.wk-item .wk-date { font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; margin-top: 2px; }
.wk-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.75;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
}
.g-empty { color: var(--ink-soft); font-size: 12.5px; padding: 6px 4px 10px; }

.wishes-group { margin-bottom: 16px; }
.wishes-group:last-child { margin-bottom: 0; }
.wish-card {
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  border-radius: 16px;
  padding: 11px 13px;
  margin-bottom: 9px;
}
.wish-card:last-child { margin-bottom: 0; }
.wish-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wish-badge {
  font-size: 10.5px;
  font-weight: 620;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--accent);
  background: var(--accent-soft);
}
.wish-badge.todo { color: var(--b-social); background: var(--b-social-bg); }
.wish-head-right {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.wish-src {
  font-size: 10.5px;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.wish-boost-pop {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--like-active);
  background: var(--like-active-bg);
  border: 1px solid var(--like-active-border);
  box-shadow: 0 3px 10px var(--like-glow);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  z-index: 2;
  animation: wishBoostFloat 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes wishBoostFloat {
  0% { opacity: 0; transform: translateY(-20%) scale(0.86); }
  16% { opacity: 1; transform: translateY(-54%) scale(1.04); }
  28% { opacity: 1; transform: translateY(-54%) scale(1); }
  72% { opacity: 1; transform: translateY(-64%) scale(1); }
  100% { opacity: 0; transform: translateY(-105%) scale(0.95); }
}
.wish-text {
  font-size: 13.5px;
  font-weight: 580;
  margin-top: 6px;
  word-break: break-word;
  line-height: 1.48;
}
.wish-desire {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.wish-bar {
  flex: 1;
  height: 5px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.wish-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dot));
  transition: width 0.35s ease;
}
.wish-pct {
  font-size: 11px;
  color: var(--ink-soft);
  width: 32px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.wish-reason { font-size: 11.5px; color: var(--ink-soft); margin-top: 5px; word-break: break-word; line-height: 1.5; }
.wish-note { font-size: 11.5px; color: var(--ink-faint); margin-top: 4px; font-style: italic; word-break: break-word; }
.wishes-none { color: var(--ink-soft); font-size: 13px; text-align: center; padding: 40px 16px; }

/* ==========================================================================
   Unified ··· More Menu (Desktop Glass Popover / Mobile Bottom Action Sheet)
   ========================================================================== */
.sheet-scrim,
.device-scrim {
  position: fixed;
  inset: 0;
  z-index: 87;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.sheet-scrim.show,
.device-scrim.show {
  opacity: 1;
  pointer-events: auto;
}
.device-scrim { z-index: 94; }

/* 左下角全局与账号浮层（桌面左下角紧贴用户按钮向上弹出 / 手机底部 Action Sheet） */
.more-sheet {
  position: fixed;
  left: 16px;
  bottom: 68px;
  top: auto;
  right: auto;
  z-index: 88;
  width: min(304px, calc(100vw - 24px));
  max-height: calc(100dvh - 88px);
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-radius: 22px;
  opacity: 0;
  transform: translateY(8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.2s ease;
}
.more-sheet.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* 中栏顶栏 ··· 当前对话紧凑菜单（桌面锚定在 ··· 正下方，不遮挡右侧栏） */
.chat-menu {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 88;
  width: min(228px, calc(100vw - 24px));
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-radius: 18px;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.18s ease;
}
.chat-menu.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.sheet-handle { display: none; }
.sheet-reply-section { display: none; }
.sheet-section-title {
  font-size: 12px;
  font-weight: 650;
  color: var(--ink-soft);
  padding: 0 4px 6px;
}
.sheet-reply-grid {
  display: flex;
  gap: 8px;
}
.sheet-reply-btn {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  color: var(--ink-soft);
  border-radius: 14px;
  padding: 10px 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  cursor: pointer;
}
.sheet-reply-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--accent);
  font-weight: 660;
}

.sheet-list {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sheet-item {
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  padding: 12px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease;
}
.sheet-item:last-child { border-bottom: none; }
.sheet-action:hover { background: var(--glass-surface-strong); }
.sheet-item.is-danger { color: var(--danger); }
.more-sheet .sheet-item.sheet-mobile-only { display: none; }
.sheet-item-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.sheet-item-val {
  font-size: 12.5px;
  color: var(--ink-soft);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sheet-arrow { color: var(--ink-faint); font-size: 15px; }

.autoplay {
  user-select: none;
  cursor: pointer;
}
.autoplay input {
  appearance: none;
  -webkit-appearance: none;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.16s ease;
}
.autoplay input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: left 0.16s ease;
}
.autoplay input:checked { background: var(--accent); }
.autoplay input:checked::after { left: 18px; }
.autoplay input:disabled { cursor: not-allowed; }

/* Topbar Theme Preset Orb */
.theme-btn-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.55), 0 0 0 1px var(--line-strong), 0 2px 6px rgba(0, 0, 0, 0.16);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
#themeToggleBtn:hover .theme-btn-dot {
  transform: scale(1.09);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.65), 0 0 0 1.5px var(--accent-border), 0 3px 8px var(--accent-shadow);
}

/* More Sheet 4-Preset Theme Swatch Grid */
.sheet-theme-row {
  flex-direction: column;
  align-items: stretch;
  gap: 9px;
  cursor: default;
}
.theme-swatch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  width: 100%;
}
.theme-swatch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px 11px;
  border-radius: 13px;
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: inset 0 1px 0 var(--glass-highlight);
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.14s ease;
}
.theme-swatch-btn:hover {
  background: var(--glass-surface-strong);
  border-color: var(--accent-border);
  color: var(--ink);
}
.theme-swatch-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 660;
  box-shadow: inset 0 1px 0 var(--glass-highlight), 0 0 0 1px var(--accent-border), 0 4px 12px var(--accent-shadow);
}
.swatch-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.52), 0 0 0 1px rgba(128, 128, 128, 0.28);
  transition: box-shadow 0.16s ease, transform 0.16s ease;
}
.theme-swatch-btn.active .swatch-dot {
  transform: scale(1.06);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.6), 0 0 0 2px var(--card-solid), 0 0 0 3.5px var(--accent);
}
.sw-warm-light {
  background: linear-gradient(135deg, #F5F7F4 0%, #D5DFD8 46%, #315242 54%, #213A2E 100%);
}
.sw-cool-light {
  background: linear-gradient(135deg, #F3F8FE 0%, #CBD8E6 46%, #3468A0 54%, #234A75 100%);
}
.sw-warm-dark {
  background: linear-gradient(135deg, #161310 0%, #2B241D 46%, #D2A074 54%, #B07952 100%);
}
.sw-cool-dark {
  background: linear-gradient(135deg, #090C11 0%, #152032 46%, #5892D6 54%, #36649E 100%);
}

/* ==========================================================================
   Secondary Character Picker Modal (#charPickerPanel)
   ========================================================================== */
.char-picker-scrim {
  position: fixed;
  inset: 0;
  z-index: 94;
  background: var(--scrim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.char-picker-scrim.show {
  opacity: 1;
  pointer-events: auto;
}
#charPickerPanel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.97);
  z-index: 96;
  width: min(380px, calc(100vw - 24px));
  border-radius: 24px;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#charPickerPanel.show {
  display: flex;
  transform: translate(-50%, -50%) scale(1);
}
.char-picker-search-wrap {
  padding: 0 14px 10px;
}
.char-picker-search-wrap[hidden] { display: none; }
.char-picker-search {
  width: 100%;
  padding: 9px 13px;
  border-radius: 13px;
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  outline: none;
}
.char-picker-search:focus {
  border-color: var(--accent-border);
  background: var(--glass-surface-strong);
}
.char-switcher {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 2px 12px 14px;
}
.char-pill {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: var(--glass-surface);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 560;
  cursor: pointer;
  min-width: 0;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.char-pill:hover {
  background: var(--glass-surface-strong);
  border-color: var(--glass-border);
}
.char-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}
.char-pill img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid var(--glass-border);
}
.char-pill .cp-av-fb {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1.5px solid var(--accent-border);
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
}
.char-pill.avatar-fallback img { display: none; }
.char-pill.avatar-fallback .cp-av-fb { display: inline-flex; }
.char-pill .cp-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.char-pill .cp-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 620;
}
.char-pill .cp-active-tag {
  font-size: 11px;
  font-weight: 630;
  color: var(--accent);
  background: var(--glass-surface-strong);
  border: 1px solid var(--accent-border);
  padding: 2px 9px;
  border-radius: 999px;
  flex-shrink: 0;
  display: none;
}
.char-pill.active .cp-active-tag { display: inline-block; }
.char-picker-empty {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  padding: 22px 12px;
}

/* ==========================================================================
   Device Manager Modal (#devicePanel)
   ========================================================================== */
#devicePanel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -48%) scale(0.97);
  z-index: 96;
  width: min(400px, calc(100vw - 24px));
  border-radius: 24px;
  display: none;
  overflow: hidden;
}
#devicePanel.show {
  display: block;
  transform: translate(-50%, -50%) scale(1);
}
.dev-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 16px 16px 10px;
}
.dev-head .t { font-size: 15.5px; font-weight: 660; }
.dev-head .sub { font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; line-height: 1.45; }
.dev-list { max-height: 48vh; overflow-y: auto; padding: 2px 12px 8px; }
.dev-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 6px;
  border-top: 1px dashed var(--line);
}
.dev-item:first-child { border-top: none; }
.dev-item.inactive { opacity: 0.55; }
.dev-main { flex: 1; min-width: 0; }
.dev-label {
  font-size: 13px;
  word-break: break-word;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.dev-meta { font-size: 11px; color: var(--ink-soft); margin-top: 2px; word-break: break-word; }
.dev-badge {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.dev-badge.pc { color: var(--b-social); background: var(--b-social-bg); }
.dev-badge.mobile { color: var(--b-work); background: var(--b-work-bg); }
.dev-badge.tablet { color: var(--b-leisure); background: var(--b-leisure-bg); }
.dev-badge.other { color: var(--b-rest); background: var(--b-rest-bg); }
.dev-current {
  font-size: 10px;
  color: var(--accent);
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0 7px;
  white-space: nowrap;
}
.dev-revoke {
  border: 1px solid var(--glass-border);
  background: var(--glass-surface);
  color: var(--ink-soft);
  border-radius: 9px;
  font: inherit;
  font-size: 11.5px;
  padding: 3px 9px;
  cursor: pointer;
  flex-shrink: 0;
}
.dev-revoke:hover { border-color: var(--danger); color: var(--danger); }
.dev-foot {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dev-foot button {
  font: inherit;
  font-size: 12.5px;
  font-weight: 560;
  padding: 7px 15px;
  border-radius: 12px;
  cursor: pointer;
}
#devLogout {
  border: none;
  background: var(--danger);
  color: #fff;
}
#devClose {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  color: var(--ink-soft);
}
#devClose:hover { border-color: var(--accent-border); color: var(--accent); }

/* ==========================================================================
   Enhanced Lightbox (Close + Download)
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(12, 12, 14, 0.84);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  cursor: zoom-out;
}
.lightbox.show { display: flex; }
.lightbox img {
  max-width: 92vw;
  max-height: 86vh;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.52);
  cursor: default;
}
.lightbox-bar {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 112;
}
.lightbox-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: #fff;
  text-decoration: none;
  font: inherit;
  font-size: 13px;
  font-weight: 560;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.24); }

/* ==========================================================================
   Liquid Glass Confirm / Alert Dialog (#dhDialogBackdrop / #dhDialogCard)
   ========================================================================== */
.dh-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(22, 30, 26, 0.22);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.2s ease;
}
.dh-dialog-backdrop.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
html[data-char-theme="cool"] .dh-dialog-backdrop {
  background: rgba(16, 24, 36, 0.22);
}
html[data-color-mode="dark"] .dh-dialog-backdrop {
  background: rgba(6, 7, 10, 0.48);
}
@media (prefers-color-scheme: dark) {
  html[data-color-mode="auto"] .dh-dialog-backdrop {
    background: rgba(6, 7, 10, 0.48);
  }
}

.dh-dialog-card {
  width: min(372px, calc(100vw - 32px));
  padding: 22px 22px 18px;
  border-radius: 20px;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.84) 0%, rgba(246, 250, 247, 0.72) 52%, rgba(255, 255, 255, 0.80) 100%);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 24px 60px rgba(18, 32, 26, 0.20),
    0 4px 16px rgba(18, 32, 26, 0.08),
    inset 0 1.5px 0 var(--glass-highlight),
    inset 0 -1px 0 rgba(255, 255, 255, 0.16);
  transform: translateY(6px) scale(0.95);
  opacity: 0;
  outline: none;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
}
.dh-dialog-backdrop.show .dh-dialog-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}
html[data-char-theme="cool"] .dh-dialog-card {
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.86) 0%, rgba(240, 247, 255, 0.74) 52%, rgba(255, 255, 255, 0.82) 100%);
  box-shadow:
    0 24px 60px rgba(16, 30, 50, 0.20),
    0 4px 16px rgba(16, 30, 50, 0.08),
    inset 0 1.5px 0 var(--glass-highlight),
    inset 0 -1px 0 rgba(255, 255, 255, 0.16);
}
html[data-color-mode="dark"] .dh-dialog-card {
  background: linear-gradient(160deg, rgba(40, 34, 28, 0.90) 0%, rgba(24, 20, 17, 0.84) 100%);
  box-shadow:
    0 28px 68px rgba(0, 0, 0, 0.58),
    0 4px 16px rgba(0, 0, 0, 0.32),
    inset 0 1.5px 0 var(--glass-highlight),
    inset 0 -1px 0 rgba(255, 248, 238, 0.06);
}
html[data-color-mode="dark"][data-char-theme="cool"] .dh-dialog-card {
  background: linear-gradient(160deg, rgba(22, 31, 46, 0.92) 0%, rgba(13, 19, 30, 0.86) 100%);
}
@media (prefers-color-scheme: dark) {
  html[data-color-mode="auto"] .dh-dialog-card {
    background: linear-gradient(160deg, rgba(40, 34, 28, 0.90) 0%, rgba(24, 20, 17, 0.84) 100%);
    box-shadow:
      0 28px 68px rgba(0, 0, 0, 0.58),
      0 4px 16px rgba(0, 0, 0, 0.32),
      inset 0 1.5px 0 var(--glass-highlight),
      inset 0 -1px 0 rgba(255, 248, 238, 0.06);
  }
  html[data-color-mode="auto"][data-char-theme="cool"] .dh-dialog-card {
    background: linear-gradient(160deg, rgba(22, 31, 46, 0.92) 0%, rgba(13, 19, 30, 0.86) 100%);
  }
}
@supports not (backdrop-filter: blur(1px)) {
  .dh-dialog-card,
  html[data-char-theme="cool"] .dh-dialog-card,
  html[data-color-mode="dark"] .dh-dialog-card,
  html[data-color-mode="dark"][data-char-theme="cool"] .dh-dialog-card,
  html[data-color-mode="auto"] .dh-dialog-card,
  html[data-color-mode="auto"][data-char-theme="cool"] .dh-dialog-card {
    background: var(--glass-bg-solid);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dh-dialog-backdrop,
  .dh-dialog-card,
  .dh-dialog-btn {
    transition: none;
  }
  .dh-dialog-card {
    transform: none;
  }
  .dh-dialog-btn:active {
    transform: none;
  }
}

.dh-dialog-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dh-dialog-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 660;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.dh-dialog-message {
  margin: 9px 0 0;
  font-size: 13.8px;
  line-height: 1.62;
  color: var(--ink-soft);
  word-break: break-word;
  white-space: pre-line;
}
.dh-dialog-actions {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.dh-dialog-btn {
  min-width: 78px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: 12px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, filter 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.dh-dialog-btn:active {
  transform: scale(0.975);
}
.dh-dialog-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.dh-dialog-cancel {
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  color: var(--ink-soft);
  box-shadow: inset 0 1px 0 var(--glass-highlight);
}
.dh-dialog-cancel:hover {
  background: var(--glass-surface-strong);
  border-color: var(--line-strong);
  color: var(--ink);
}
.dh-dialog-cancel[hidden] {
  display: none;
}
.dh-dialog-confirm {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  box-shadow: 0 6px 16px var(--accent-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.dh-dialog-confirm:hover {
  filter: brightness(1.07);
}
.dh-dialog-confirm.is-danger {
  background: linear-gradient(135deg, #CA4E40, #A8372B);
  color: #FFF9F7;
  box-shadow: 0 6px 18px rgba(194, 72, 59, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.dh-dialog-confirm.is-danger:hover {
  filter: brightness(1.06);
}
.dh-dialog-confirm.is-danger:focus-visible {
  outline-color: var(--danger);
}
html[data-color-mode="dark"] .dh-dialog-confirm.is-danger {
  background: linear-gradient(135deg, #D9574C, #B63A32);
  color: #FFF9F7;
  box-shadow: 0 6px 20px rgba(217, 87, 76, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
@media (prefers-color-scheme: dark) {
  html[data-color-mode="auto"] .dh-dialog-confirm.is-danger {
    background: linear-gradient(135deg, #D9574C, #B63A32);
    color: #FFF9F7;
    box-shadow: 0 6px 20px rgba(217, 87, 76, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  }
}

/* ==========================================================================
   Tablet Breakpoint (≤1200px): 2-Column + Slide-Over Right Glass Drawer
   ========================================================================== */
@media (max-width: 1200px) {
  .app,
  .app.drawer-collapsed,
  .app.no-life-drawer {
    grid-template-columns: 244px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
  }
  .drawer {
    position: fixed;
    top: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 86;
    width: min(390px, calc(100vw - 24px));
    height: auto;
    display: flex;
    transform: translateX(calc(100% + 28px));
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .drawer.show {
    transform: translateX(0);
  }
  .app.no-life-drawer .drawer { display: none; }
  .drawer-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 82;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .drawer-scrim.show {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ==========================================================================
   Mobile Breakpoint (≤720px):
   Phone ① 极简悬浮玻璃顶栏 + Quick Char Strip + Bottom Action Sheet + Full Drawer
   ========================================================================== */
@media (max-width: 720px) {
  .app,
  .app.drawer-collapsed,
  .app.no-life-drawer {
    display: flex;
    flex-direction: column;
    padding: 0;
    gap: 0;
  }

  .main {
    flex: 1;
    width: 100%;
    height: 100%;
  }

  .chat-col.glass-panel {
    border: none;
    border-radius: 0;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    box-shadow: none;
  }

  /* Phone ①: Minimal Floating Topbar (crisp non-blurred surface so iOS text stays razor-sharp) */
  header.topbar {
    min-height: 54px;
    margin: max(8px, env(safe-area-inset-top)) 10px 4px;
    padding: 7px 10px;
    justify-content: space-between;
    border-radius: 22px;
    background: var(--glass-surface-strong);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border: 1px solid var(--glass-border);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07), inset 0 1px 0 var(--glass-highlight);
  }
  .topbar-left { display: flex; gap: 8px; flex: 1 1 auto; min-width: 0; }
  .topbar-session-title { display: none; }
  .topbar-mobile-topic {
    display: inline-block;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 116px;
    font-size: 11px;
    color: var(--ink-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
  }
  .topbar-mobile-topic:empty { display: none; }
  .avatar-sm { width: 34px; height: 34px; }
  header h1 { font-size: 15px; }
  .topbar-extra { display: none; }
  #menuBtn { display: inline-flex; width: 32px; height: 32px; font-size: 14px; }
  #replyModeSeg,
  #themeToggleBtn { display: none; }
  #lifeBtn {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    overflow: hidden;
  }
  #moreBtn { width: 34px; height: 34px; }

  /* Left Glass Slide-Out Sidebar */
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 86;
    width: min(290px, 82vw);
    border-radius: 0 26px 26px 0;
    padding-top: max(18px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    transform: translateX(-104%);
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 82;
    background: var(--scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }
  .sidebar-scrim.show {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar-close { display: inline-flex; }
  .user-badge {
    padding: 7px 11px;
    font-size: 13px;
    min-height: 36px;
  }

  /* Full-Screen Liquid Glass Life Drawer */
  .drawer {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    border-radius: 0;
    border: none;
    padding: max(14px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  }

  /* Bottom Action Sheet (lg-07 Phone ②) */
  .more-sheet,
  .chat-menu {
    top: auto !important;
    right: 0 !important;
    left: 0 !important;
    bottom: 0;
    width: 100vw;
    max-height: 86dvh;
    overflow-y: auto;
    border-radius: 28px 28px 0 0;
    padding: 10px 16px max(20px, env(safe-area-inset-bottom));
    transform: translateY(104%);
  }
  .more-sheet.show,
  .chat-menu.show {
    transform: translateY(0);
  }
  .sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: var(--line-strong);
    margin: 0 auto 4px;
  }
  .sheet-reply-section { display: block; }
  .more-sheet .sheet-item.sheet-mobile-only { display: flex; }
  .theme-swatch-btn { padding: 10px 12px; font-size: 13px; }

  .dh-dialog-backdrop { padding: 16px; }
  .dh-dialog-card {
    width: min(356px, calc(100vw - 28px));
    padding: 20px 18px 16px;
    border-radius: 22px;
  }
  .dh-dialog-title { font-size: 16px; }
  .dh-dialog-message { font-size: 14px; }
  .dh-dialog-actions { margin-top: 18px; gap: 10px; }
  .dh-dialog-btn {
    flex: 1;
    min-height: 44px;
    padding: 10px 14px;
    font-size: 14px;
    border-radius: 14px;
  }

  #log { padding: 10px 12px 16px; gap: 11px; }
  .msg { max-width: 90%; }
  .bot-row { gap: 7px; }
  .bot-row > img { width: 28px; height: 28px; }
  .bubble { font-size: 14.5px; padding: 10px 13px; }
  .composer-wrap { padding: 4px 10px max(8px, calc(env(safe-area-inset-bottom) - 10px)); }
  #input { font-size: 16px; }

  .history-more-bar { margin: 0 0 2px; min-height: 24px; }
  .history-more-btn { font-size: 11.5px; padding: 4px 12px; max-width: 92vw; }
  .history-more-label { font-size: 11.5px; padding: 2px 10px; }
  .msg-time-divider { margin: 10px 0 4px; }
  .msg-time-divider > span { font-size: 11px; padding: 2px 9px; }
  .user-images { width: min(248px, 74vw); }
  .user-images.grid-3 { width: min(276px, 78vw); }
  .user-images.single .user-photo { max-width: min(220px, 70vw); max-height: 240px; }
  .header-admin-link { padding: 4px 9px; font-size: 11.5px; }
  .cal { padding: 10px 10px; }
  .sched-nav { padding: 8px 10px; gap: 4px; }
  .sched-range { font-size: 12px; }
  .life-like-btn { width: 30px; height: 30px; font-size: 14px; }
  .life-like-btn.compact { width: 26px; height: 26px; font-size: 13px; }
  .wish-boost-pop { right: 30px; }
}
