:root {
      --accent-primary: #a855f7;
      --accent-primary-hover: #9333ea;
      --bg-page: #0c0c0e;
      --bg-panel: #161618;
      --bg-elevated: #1e1e22;
      --border: rgba(255, 255, 255, 0.08);
      --text: #f4f4f5;
      --text-secondary: #a1a1aa;
      --sidebar-w: clamp(208px, 20vw, 300px);
      --aside-w: clamp(240px, 26vw, 400px);
      --header-h: 52px;
      --radius: 12px;
      --shadow-sm: 0 4px 24px rgba(0, 0, 0, 0.35);
      color-scheme: dark;
      --ref-luxury-room: url("/static/images/luxury-bedroom.jpg");
      --ref-npc-avatar: url("/static/images/npc-avatar.jpg");
      --ref-sidebar-avatar: url("/static/images/npc-avatar-sidebar.jpg");
    }
    /* 跨浏览器 / 设备：防 iOS 横竖屏乱缩放、字体渲染、刘海屏安全区变量 */
    html {
      -webkit-text-size-adjust: 100%;
      text-size-adjust: 100%;
    }
    body {
      -webkit-font-smoothing: antialiased;
      -moz-osx-font-smoothing: grayscale;
      padding-left: env(safe-area-inset-left, 0px);
      padding-right: env(safe-area-inset-right, 0px);
    }
    * { box-sizing: border-box; }
    html, body { height: 100%; margin: 0; }
    body {
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
      background: var(--bg-page);
      color: var(--text);
      font-size: 14px;
      overflow: hidden;
    }
    /* Dark-theme scrollbars (Win Chromium / WebKit + Firefox) */
    .app-root * {
      scrollbar-width: thin;
      scrollbar-color: rgba(255, 255, 255, 0.22) rgba(255, 255, 255, 0.04);
    }
    .app-root *::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }
    .app-root *::-webkit-scrollbar-track {
      background: rgba(255, 255, 255, 0.04);
      border-radius: 999px;
    }
    .app-root *::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.22);
      border-radius: 999px;
      border: 2px solid transparent;
      background-clip: content-box;
    }
    .app-root *::-webkit-scrollbar-thumb:hover {
      background: rgba(255, 255, 255, 0.34);
      border: 2px solid transparent;
      background-clip: content-box;
    }
    .app-root { display: flex; flex-direction: column; height: 100%; min-height: 0; }
    .app-header {
      height: var(--header-h);
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 18px;
      background: var(--bg-panel);
      border-bottom: 1px solid var(--border);
    }
    .brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
    .logo {
      width: 32px; height: 32px; border-radius: 10px;
      background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
      flex-shrink: 0;
      box-shadow: 0 0 18px rgba(168, 85, 247, 0.28);
    }
    .brand-title h1 {
      margin: 0; font-size: 15px; font-weight: 700; line-height: 1.2;
      color: var(--text);
      letter-spacing: -0.02em;
    }
    .brand-sub { font-size: 11px; color: var(--text-secondary); margin-top: 2px; max-width: 420px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; }
    .header-actions label { font-size: 11px; color: var(--text-secondary); margin: 0; }
    .header-actions select {
      min-width: 128px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border);
      background: var(--bg-elevated); color: var(--text); font-size: 12px;
    }
    .status-pill {
      font-size: 11px; padding: 4px 10px; border-radius: 999px; max-width: 280px;
      white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    }
    .status-pill.ok { background: rgba(52, 211, 153, 0.15); color: #6ee7b7; border: 1px solid rgba(52, 211, 153, 0.35); }
    .status-pill.warn { background: rgba(251, 191, 36, 0.12); color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.35); }

    .app-body {
      flex: 1;
      display: flex;
      min-height: 0;
    }
    .sidebar {
      width: var(--sidebar-w);
      flex-shrink: 0;
      background: #121214;
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      min-height: 0;
    }
    .sidebar-scroll { flex: 1; overflow: auto; padding: 12px; }
    .sidebar-chat-head {
      padding: 2px 2px 14px;
      margin-bottom: 10px;
      border-bottom: 1px solid var(--border);
    }
    .sidebar-chat-head-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 10px;
    }
    .sidebar-chat-head-top h2 {
      margin: 0;
      font-size: 15px;
      font-weight: 700;
      letter-spacing: -0.02em;
    }
    .btn-new-scene-head {
      width: 34px;
      height: 34px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--bg-elevated);
      color: var(--text);
      cursor: pointer;
      font-size: 18px;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
    }
    .btn-new-scene-head:hover { border-color: rgba(168, 85, 247, 0.5); color: #e9d5ff; }
    .sidebar-search-wrap { position: relative; margin-bottom: 10px; }
    .sidebar-search-wrap input {
      width: 100%;
      padding: 9px 12px 9px 36px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--bg-elevated);
      color: var(--text);
      font-size: 13px;
      outline: none;
    }
    .sidebar-search-wrap input::placeholder { color: #71717a; }
    .sidebar-search-wrap input:focus {
      border-color: rgba(168, 85, 247, 0.45);
      box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.12);
    }
    .sidebar-search-ico {
      position: absolute;
      left: 11px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 13px;
      opacity: 0.5;
      pointer-events: none;
    }
    .filter-pills { display: flex; gap: 8px; flex-wrap: wrap; }
    .filter-pill {
      padding: 5px 12px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: transparent;
      color: var(--text-secondary);
      font-size: 12px;
      cursor: pointer;
      font-family: inherit;
    }
    .filter-pill:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.16); }
    .filter-pill.active {
      border-color: rgba(168, 85, 247, 0.6);
      color: #e9d5ff;
      background: rgba(168, 85, 247, 0.12);
    }
    .sidebar-jump {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-top: 10px;
    }
    .sidebar-jump button {
      border: 1px solid var(--border);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.03);
      color: var(--text-secondary);
      padding: 8px 10px;
      font: inherit;
      font-size: 12px;
      cursor: pointer;
    }
    .sidebar-jump button:hover,
    .sidebar-jump button.active {
      color: #e9d5ff;
      border-color: rgba(168, 85, 247, 0.55);
      background: rgba(168, 85, 247, 0.12);
    }
    .side-section { margin-bottom: 16px; }
    .side-section:last-child { margin-bottom: 0; }
    .side-title {
      font-size: 10px; font-weight: 700; text-transform: uppercase;
      letter-spacing: 0.08em; color: var(--text-secondary); margin: 0 0 8px;
    }
    .field label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
    .field input,
    .field select,
    .field textarea.story-bg {
      width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
      background: var(--bg-elevated); color: var(--text); font-size: 13px; margin-bottom: 8px;
      font: inherit;
    }
    .field textarea.story-bg { resize: vertical; min-height: 56px; line-height: 1.35; }
    .field input:focus,
    .field select:focus,
    .field textarea.story-bg:focus {
      outline: none; border-color: rgba(168, 85, 247, 0.5); box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.12);
    }
    .btn-primary {
      width: 100%; padding: 9px 12px; border-radius: 10px; border: none;
      background: linear-gradient(135deg, #7c3aed, #a855f7); color: #fff; font-size: 13px; font-weight: 600;
      cursor: pointer; margin-top: 4px;
    }
    .btn-primary:hover { filter: brightness(1.06); }
    .btn-secondary {
      width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border);
      background: var(--bg-elevated); color: var(--text); font-size: 12px; cursor: pointer; margin-top: 6px;
    }
    .btn-secondary:hover { background: #27272a; }
    .scene-info { font-size: 12px; color: var(--text-secondary); margin-top: 8px; line-height: 1.4; }
    .scene-mood {
      font-size: 12px; color: var(--text-secondary); margin-top: 6px; line-height: 1.45;
      padding: 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.03); border: 1px dashed var(--border);
    }

    .char-list {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding-bottom: 4px;
    }
    .char-item {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 190px;
      text-align: left;
      padding: 9px 10px;
      border-radius: 12px;
      border: 1px solid transparent;
      background: var(--bg-elevated);
      cursor: pointer;
      font: inherit; color: inherit;
    }
    .char-item:hover { background: #252529; }
    .char-item.active { border-color: rgba(168, 85, 247, 0.45); background: rgba(168, 85, 247, 0.1); }
    .char-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      object-fit: cover;
      flex-shrink: 0;
      border: 1px solid rgba(255, 255, 255, 0.1);
      background: #27272a;
    }
    .char-avatar-fallback {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      font-weight: 600;
      color: #fff;
      background: linear-gradient(135deg, #6366f1, #a855f7);
      flex-shrink: 0;
    }
    .char-text { min-width: 0; display: flex; flex-direction: column; }
    .char-name { font-weight: 600; font-size: 13px; }
    .char-role { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

    .profile-card {
      margin-top: 10px; padding: 10px; border-radius: 8px; border: 1px solid var(--border);
      background: var(--bg-elevated); font-size: 12px; line-height: 1.45; color: var(--text-secondary);
    }
    .profile-card strong { color: var(--text); }
    .profile-card-name { font-size: 13px; }
    .profile-tone { margin-top: 4px; color: var(--text-secondary); font-size: 12px; }
    .profile-tags { margin-top: 6px; }
    /* 与固定老板娘卡一致：兴趣/边界一行 + 多段设定 + 背景列表 */
    .profile-meta-line { margin-top: 8px; color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
    .profile-meta-split { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
    .profile-meta-item { font-size: 12px; color: var(--text-secondary); line-height: 1.55; }
    .profile-meta-k { font-weight: 600; color: var(--text); margin-right: 6px; }

    .profile-block { margin-top: 10px; }
    .profile-label { font-weight: 600; color: var(--text); font-size: 12px; display: block; margin-bottom: 4px; }
    .profile-value { color: var(--text-secondary); font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
    .profile-bg-item { padding-left: 10px; margin-top: 4px; border-left: 2px solid rgba(168, 85, 247, 0.45); color: var(--text-secondary); font-size: 12px; line-height: 1.45; }
    .pill {
      font-size: 10px; background: rgba(168, 85, 247, 0.2); color: #e9d5ff; border-radius: 999px;
      padding: 2px 8px; display: inline-block; margin: 2px 4px 0 0;
    }
    .pill-sm { font-size: 10px; padding: 2px 7px; margin: 0 4px 0 0; }
    .pill-occ { background: rgba(59, 130, 246, 0.22); color: #bfdbfe; }
    button.pill {
      border: 0;
      font: inherit;
      line-height: inherit;
      cursor: pointer;
    }
    .pill-aff-stage {
      color: #fff7ed;
      background: rgba(255, 27, 122, 0.22);
      box-shadow: inset 0 0 0 1px rgba(255, 27, 122, 0.26);
    }
    .pill-aff-stage:hover,
    .pill-aff-stage:focus-visible {
      background: rgba(255, 27, 122, 0.34);
      outline: none;
      box-shadow:
        inset 0 0 0 1px rgba(255, 27, 122, 0.44),
        0 0 12px rgba(255, 27, 122, 0.18);
    }
    .chat-peer-tags {
      display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center;
    }
    .character-profile-scroll {
      max-height: 280px;
      overflow-y: auto;
    }
    .sidebar-tools-fold { margin-top: 8px; border: 1px solid var(--border); border-radius: 10px; padding: 6px 8px; background: rgba(255,255,255,0.02); }
    .sidebar-tools-fold > summary { cursor: pointer; font-size: 12px; color: var(--text-secondary); list-style: none; }
    .sidebar-tools-fold > summary::-webkit-details-marker { display: none; }
    .composer-advanced { margin-bottom: 6px; border: 1px solid transparent; border-radius: 8px; padding: 2px 0; }
    .composer-advanced > summary {
      cursor: pointer; font-size: 11px; color: var(--text-secondary); list-style: none; user-select: none;
    }
    .composer-advanced > summary::-webkit-details-marker { display: none; }
    .composer-actions {
      display: flex; align-items: flex-end; gap: 6px; flex-shrink: 0; padding-bottom: 2px;
    }
    .btn-composer-ico {
      width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
      background: var(--bg-elevated); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer;
      display: inline-flex; align-items: center; justify-content: center;
    }
    .btn-composer-ico:hover { border-color: rgba(168, 85, 247, 0.45); }
    .gift-dialog { border: none; border-radius: 18px; padding: 0; background: #141418; color: var(--text); max-width: 440px; width: 92vw; box-shadow: 0 24px 80px rgba(0,0,0,.55); }
    .gift-dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
    .gift-dialog-inner { padding: 18px 18px 16px; }
    .gift-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
    .gift-dialog-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
    .gift-dialog-x {
      border: none; background: transparent; color: var(--text-secondary); font-size: 22px; line-height: 1; cursor: pointer; padding: 4px 8px;
    }
    .gift-dialog-sub { margin: 0 0 14px; font-size: 12px; color: var(--text-secondary); line-height: 1.45; }
    .gift-grid {
      display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
      max-height: min(52vh, 420px); overflow-y: auto; padding-right: 4px;
    }
    @media (min-width: 400px) {
      .gift-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    .gift-card {
      border: 1px solid var(--border); border-radius: 14px; padding: 12px 10px 10px;
      background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(244, 114, 182, 0.06));
      color: var(--text); cursor: pointer; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px;
      min-height: 134px;
    }
    .gift-card:hover { border-color: rgba(244, 114, 182, 0.45); }
    .gift-card:disabled { opacity: 0.45; cursor: not-allowed; filter: grayscale(0.2); }
    .gift-card.gift-card--locked {
      opacity: 0.42;
      filter: grayscale(0.35);
      border-style: dashed;
      position: relative;
    }
    .gift-card.gift-card--locked::after {
      content: "🔒";
      position: absolute;
      top: 8px;
      right: 8px;
      font-size: 14px;
      line-height: 1;
      opacity: 0.9;
    }
    .gift-ico { font-size: 28px; line-height: 1; }
    .gift-name { font-size: 12px; font-weight: 600; }
    .gift-effect { font-size: 10px; color: var(--text-secondary); line-height: 1.35; min-height: 27px; }
    .gift-price { font-size: 11px; color: #fbbf24; }
    .gift-status {
      margin-top: 12px;
      min-height: 18px;
      color: var(--text-secondary);
      font-size: 12px;
      line-height: 1.45;
    }
    .gift-status.is-ok { color: #86efac; }
    .gift-status.is-error { color: #fca5a5; }
    .gift-dialog--tabs { max-width: 520px; }
    .gift-dialog-head { flex-wrap: wrap; }
    .gift-dialog-tabs {
      display: flex;
      gap: 6px;
      flex: 1 1 100%;
      order: 3;
      margin-top: 4px;
    }
    .gift-tab {
      flex: 1;
      border: 1px solid var(--border);
      border-radius: 999px;
      background: transparent;
      color: var(--text-secondary);
      font-size: 12px;
      padding: 6px 10px;
      cursor: pointer;
    }
    .gift-tab.is-active {
      color: var(--text);
      border-color: rgba(244, 114, 182, 0.55);
      background: rgba(244, 114, 182, 0.12);
    }
    .gift-panel { display: none; }
    .gift-panel--active { display: block; }
    .gift-pack-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 10px;
      max-height: min(52vh, 400px);
      overflow-y: auto;
    }
    @media (min-width: 440px) {
      .gift-pack-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    }
    .gift-pack-card {
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 12px;
      background: rgba(255, 255, 255, 0.03);
      text-align: left;
      cursor: pointer;
      color: var(--text);
    }
    .gift-pack-card:disabled { cursor: not-allowed; opacity: 0.55; }
    .gift-pack-card.is-available { border-color: rgba(134, 239, 172, 0.45); }
    .gift-pack-card.is-claimed { opacity: 0.65; }
    .gift-pack-label { font-size: 11px; color: var(--text-secondary); margin: 0 0 6px; }
    .gift-pack-state { font-size: 15px; font-weight: 700; margin: 0; }
    .gift-backpack-grid {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 10px;
      max-height: min(48vh, 360px);
      overflow-y: auto;
    }
    .gift-backpack-item {
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 10px 8px;
      background: rgba(255, 255, 255, 0.04);
      text-align: center;
      cursor: pointer;
      color: var(--text);
    }
    .gift-backpack-item:disabled { opacity: 0.4; cursor: not-allowed; }
    .gift-backpack-empty { margin: 8px 0 0; font-size: 12px; }
    .achievement-toast-host {
      position: fixed;
      top: 72px;
      right: 16px;
      z-index: 12000;
      display: flex;
      flex-direction: column;
      gap: 8px;
      pointer-events: none;
      max-width: min(320px, calc(100vw - 32px));
    }
    .achievement-toast {
      padding: 10px 14px;
      border-radius: 10px;
      background: rgba(24, 20, 36, 0.92);
      border: 1px solid rgba(251, 191, 36, 0.45);
      color: #fde68a;
      font-size: 13px;
      line-height: 1.4;
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
      opacity: 0;
      transform: translateX(12px);
      transition: opacity 0.25s ease, transform 0.25s ease;
    }
    .achievement-toast.is-visible {
      opacity: 1;
      transform: translateX(0);
    }
    .gift-modal-status { margin: 0 0 10px; font-size: 12px; color: var(--text-secondary); }
    .gift-modal-status.is-ok { color: #86efac; }
    .gift-modal-status.is-error { color: #fca5a5; }
    .checkin-cal-nav {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      margin-bottom: 10px;
    }
    .checkin-month-label { font-size: 14px; font-weight: 600; }
    .checkin-calendar {
      display: grid;
      grid-template-columns: repeat(7, minmax(0, 1fr));
      gap: 6px;
    }
    .checkin-weekday {
      font-size: 10px;
      color: var(--text-secondary);
      text-align: center;
      padding: 4px 0;
    }
    .checkin-day {
      aspect-ratio: 1;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: rgba(255, 255, 255, 0.03);
      font-size: 12px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 2px;
      cursor: default;
      color: var(--text);
      padding: 4px;
    }
    .checkin-day.is-checked {
      color: #9ca3af;
      background: rgba(255, 255, 255, 0.02);
      cursor: not-allowed;
    }
    .checkin-day.is-checked .checkin-day-ico { opacity: 0.35; }
    .checkin-day.is-missed { color: #f87171; border-color: rgba(248, 113, 113, 0.45); }
    .checkin-day.is-today.is-available {
      border-color: rgba(134, 239, 172, 0.55);
      cursor: pointer;
    }
    .checkin-day.is-future { opacity: 0.35; }
    .checkin-day-ico { font-size: 10px; line-height: 1; }
    .checkin-modal-hint { margin-top: 12px; font-size: 12px; }
    .chat-peer-avatar-btn {
      border: none;
      padding: 0;
      background: transparent;
      cursor: pointer;
      border-radius: 50%;
      flex-shrink: 0;
    }
    .chat-peer-avatar-btn:focus-visible { outline: 2px solid rgba(244, 114, 182, 0.65); outline-offset: 2px; }
    .chat-peer-nurture-strip {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      padding: 0 8px;
    }
    .chat-peer-lv-badge {
      font-size: 13px;
      font-weight: 700;
      color: #f9a8d4;
      white-space: nowrap;
    }
    .chat-peer-pack-row {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      justify-content: center;
    }
    .chat-peer-pack-chip {
      font-size: 10px;
      padding: 3px 8px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: rgba(255, 255, 255, 0.05);
      color: var(--text-secondary);
      cursor: pointer;
      white-space: nowrap;
    }
    .chat-peer-pack-chip.is-ready {
      color: #86efac;
      border-color: rgba(134, 239, 172, 0.45);
    }
    .chat-checkin-btn {
      width: auto;
      min-width: 44px;
      padding: 0 10px;
      font-size: 12px;
      font-weight: 600;
      color: #fda4af;
    }
    .chat-checkin-btn.has-badge::after {
      content: "";
      position: absolute;
      top: 4px;
      right: 4px;
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: #ef4444;
    }
    #headerUserBtn.imm-user-pill {
      border: 1px solid rgba(45, 212, 191, 0.45);
      background: rgba(45, 212, 191, 0.08);
      color: #5eead4;
      cursor: pointer;
      font: inherit;
      padding: 4px 10px;
      max-width: 120px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    #headerUserBtn.imm-user-pill:hover {
      border-color: rgba(45, 212, 191, 0.75);
      background: rgba(45, 212, 191, 0.14);
    }
    .user-profile-dialog { max-width: 400px; }
    .user-profile-body { display: flex; flex-direction: column; gap: 12px; }
    .user-profile-row {
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-size: 13px;
    }
    .user-profile-id {
      display: block;
      padding: 10px 12px;
      border-radius: 10px;
      background: rgba(0, 0, 0, 0.25);
      border: 1px solid var(--border);
      font-size: 13px;
      font-family: ui-monospace, Consolas, monospace;
      word-break: break-all;
      color: #a7f3d0;
    }
    .user-profile-copy-hint { margin: 0; font-size: 12px; }
    .user-profile-copy-hint.is-ok { color: #86efac; }
    button.user-chip {
      cursor: pointer;
      font: inherit;
      border: 1px solid rgba(45, 212, 191, 0.4);
      background: rgba(45, 212, 191, 0.1);
      color: inherit;
    }
    button.user-chip:hover { border-color: rgba(45, 212, 191, 0.7); }
    .friends-box {
      max-height: 160px;
      overflow: auto;
      font-size: 12px;
      margin-top: 6px;
      display: flex;
      flex-direction: column;
      gap: 4px;
    }
    .friends-box .friend-item .preview { font-size: 11px; white-space: normal; line-height: 1.35; }
    .chatted-list { display: flex; flex-direction: column; gap: 4px; }
    .chatted-item {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      text-align: left;
      padding: 8px 10px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--bg-elevated);
      cursor: pointer;
      font: inherit;
      color: inherit;
    }
    .chatted-item:hover { background: #27272a; }
    .chatted-avatar {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      object-fit: cover;
      flex-shrink: 0;
      border: 1px solid #d0d5dd;
      background: #e5e7eb;
    }
    .chatted-avatar-fallback {
      width: 30px;
      height: 30px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 12px;
      font-weight: 600;
      color: #fff;
      background: linear-gradient(135deg, #7f56d9, #155eef);
      flex-shrink: 0;
    }
    .chatted-main { min-width: 0; flex: 1; }
    .chatted-item .name { font-size: 12px; font-weight: 600; color: var(--text); }
    .chatted-item .preview { font-size: 11px; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

    .min-w-0 { min-width: 0; }

    .sr-only {
      position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
      overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }

    .main-chat {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      min-height: 0;
      background: var(--bg-page);
    }
    .chat-surface {
      position: relative;
      flex: 1;
      display: flex;
      flex-direction: column;
      min-height: 0;
      border-left: 1px solid var(--border);
      border-right: 1px solid var(--border);
      background: #0a0a0c;
    }
    #chatMoreBackdrop[hidden],
    #chatMoreDropdown[hidden] {
      display: none !important;
      pointer-events: none;
    }
    .chat-more-backdrop {
      position: fixed;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      inset: 0;
      z-index: 100;
      background: rgba(0, 0, 0, 0.45);
      border: none;
      padding: 0;
      margin: 0;
      cursor: default;
    }
    .chat-more-dropdown {
      position: fixed;
      left: 50%;
      right: auto;
      transform: translateX(-50%);
      top: max(96px, 11vh);
      z-index: 110;
      width: min(400px, calc(100vw - 32px));
      max-height: min(78vh, 620px);
      display: flex;
      flex-direction: column;
      background: #141418;
      border: 1px solid var(--border);
      border-radius: 14px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
      overflow: hidden;
    }
    .chat-more-dropdown-head {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      padding: 10px 12px;
      border-bottom: 1px solid var(--border);
      font-size: 13px;
      font-weight: 600;
    }
    .chat-more-dropdown-body {
      flex: 1;
      min-height: 0;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }
    .memory-dropdown-panel {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      padding: 12px 14px 14px;
      gap: 2px;
      overflow: hidden;
    }
    .memory-dropdown-panel .memory-scroll {
      max-height: min(220px, 36vh);
    }
    .memory-dropdown-panel .chatted-list {
      max-height: min(160px, 28vh);
      overflow-y: auto;
    }
    .npc-outline-card {
      margin-bottom: 12px;
      padding: 12px;
      border-radius: 14px;
      border: 1px solid var(--border);
      background: var(--bg-elevated);
    }
    .npc-outline-hero {
      position: relative;
      border-radius: 12px;
      overflow: hidden;
      min-height: 160px;
      aspect-ratio: 4 / 5;
      max-height: 220px;
      background: linear-gradient(160deg, #3f3f46, #18181b);
      margin-bottom: 10px;
      border: 1px solid rgba(255, 255, 255, 0.06);
    }
    .npc-outline-hero img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .npc-outline-hero-ph {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 48px;
      font-weight: 800;
      color: rgba(255, 255, 255, 0.12);
    }
    .npc-outline-dots {
      position: absolute;
      bottom: 8px;
      left: 0;
      right: 0;
      display: flex;
      justify-content: center;
      gap: 5px;
    }
    .npc-outline-dots span {
      width: 6px;
      height: 6px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.25);
    }
    .npc-outline-dots span.on {
      background: rgba(255, 255, 255, 0.75);
    }
    .npc-outline-name-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }
    .npc-outline-name-row strong {
      font-size: 16px;
      color: var(--text);
    }
    .npc-outline-heart {
      border: none;
      background: transparent;
      color: var(--text-secondary);
      font-size: 18px;
      cursor: default;
      line-height: 1;
      padding: 4px;
    }
    .npc-outline-sub {
      font-size: 12px;
      color: var(--text-secondary);
      margin-top: 4px;
    }
    .npc-outline-bio {
      margin: 8px 0 0;
      font-size: 12px;
      line-height: 1.55;
      color: var(--text-secondary);
    }
    .npc-outline-about-title {
      margin: 12px 0 8px;
      font-size: 12px;
      font-weight: 700;
      color: var(--text);
      letter-spacing: 0.04em;
    }
    .npc-outline-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 10px 12px;
    }
    .noc-cell {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      min-width: 0;
    }
    .noc-ico {
      flex-shrink: 0;
      width: 34px;
      height: 34px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.06);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
    }
    .noc-meta {
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .noc-label {
      font-size: 10px;
      color: var(--text-secondary);
      text-transform: uppercase;
      letter-spacing: 0.06em;
    }
    .noc-val {
      font-size: 12px;
      color: var(--text);
      line-height: 1.35;
      word-break: break-word;
    }
    .chat-peer-header {
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 12px 18px;
      background: var(--bg-panel);
      border-bottom: 1px solid var(--border);
      position: relative;
      z-index: 105;
    }
    .chat-peer-left {
      display: flex;
      align-items: center;
      gap: 12px;
      min-width: 0;
    }
    #chatPeerAvatar {
      width: 44px;
      height: 44px;
      border-radius: 50%;
      overflow: hidden;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 15px;
      color: #fff;
      background: linear-gradient(135deg, #6366f1, #a855f7);
      border: 1px solid rgba(255, 255, 255, 0.12);
    }
    #chatPeerAvatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .affinity-ring {
      --affinity-ring-pct: 0%;
      --affinity-ring-color: #ff1b7a;
      --affinity-ring-bg: rgba(255, 255, 255, 0.14);
      box-sizing: border-box;
      position: relative;
      isolation: isolate;
      overflow: visible !important;
      padding: 3px;
      background:
        conic-gradient(var(--affinity-ring-color) 0 var(--affinity-ring-pct), var(--affinity-ring-bg) var(--affinity-ring-pct) 100%);
    }
    .affinity-ring::before {
      content: "";
      position: absolute;
      inset: -4px;
      border-radius: inherit;
      pointer-events: none;
      z-index: 0;
      background:
        conic-gradient(var(--affinity-ring-color) 0 var(--affinity-ring-pct), rgba(255, 255, 255, 0.18) var(--affinity-ring-pct) 100%);
      box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.18),
        0 0 16px rgba(255, 27, 122, 0.32);
      -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
      mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 4px));
    }
    .affinity-ring > img,
    .affinity-ring > .char-avatar,
    .affinity-ring > .chatted-avatar,
    .affinity-ring > .char-avatar-fallback,
    .affinity-ring > .chatted-avatar-fallback {
      width: 100%;
      height: 100%;
      border-radius: inherit;
      object-fit: cover;
      display: block;
      position: relative;
      z-index: 1;
    }
    .chat-peer-title {
      font-size: 15px;
      font-weight: 700;
      letter-spacing: -0.02em;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: min(280px, 48vw);
    }
    .chat-peer-sub {
      font-size: 12px;
      color: var(--text-secondary);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: min(320px, 52vw);
    }
    .chat-peer-actions {
      display: flex;
      gap: 6px;
      align-items: center;
      position: relative;
      z-index: 2;
    }
    .chat-ico-btn {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      border: 1px solid var(--border);
      background: var(--bg-elevated);
      color: var(--text-secondary);
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
    }
    .chat-ico-btn:hover { color: var(--text); border-color: rgba(168, 85, 247, 0.45); }
    #llmBanner.notice-bar {
      flex-shrink: 0;
      margin: 0;
      border-radius: 0;
      border: none;
      border-bottom: 1px solid rgba(234, 179, 8, 0.35);
    }
    .notice-bar {
      font-size: 12px;
      padding: 8px 18px;
      background: rgba(234, 179, 8, 0.14);
      color: #fde68a;
      border-left: 4px solid #eab308;
      line-height: 1.45;
    }
    .notice-bar.status-pill.ok {
      background: rgba(52, 211, 153, 0.12);
      color: #a7f3d0;
      border-left-color: #34d399;
      border-bottom: 1px solid rgba(52, 211, 153, 0.25);
    }
    .notice-bar.status-pill.warn {
      background: rgba(234, 179, 8, 0.14);
      color: #fde68a;
      border-left-color: #eab308;
      border-bottom: 1px solid rgba(234, 179, 8, 0.28);
    }
    .composer-scene-row {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin-bottom: 10px;
    }
    .composer-scene-label {
      font-size: 12px;
      color: var(--text-secondary);
      margin-right: 4px;
    }
    .scene-chip {
      padding: 6px 14px;
      border-radius: 999px;
      border: 1px solid var(--border);
      background: var(--bg-elevated);
      color: var(--text);
      font-size: 12px;
      cursor: pointer;
      font-family: inherit;
    }
    .scene-chip:hover { border-color: rgba(168, 85, 247, 0.45); color: #e9d5ff; }
    .composer-inner {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 0;
    }
    .composer-main-row {
      display: flex;
      align-items: flex-end;
      gap: 10px;
      width: 100%;
    }
    .aside-tabs {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-start;
      align-items: flex-end;
      gap: 2px 4px;
      border-bottom: 1px solid var(--border);
      margin: -4px -4px 10px;
      padding: 0 4px;
    }
    .aside-tab {
      flex: 0 1 auto;
      padding: 10px 12px;
      font-size: 13px;
      font-weight: 600;
      border: none;
      background: transparent;
      color: var(--text-secondary);
      cursor: pointer;
      font-family: inherit;
      border-bottom: 2px solid transparent;
      margin-bottom: -1px;
      white-space: nowrap;
    }
    .aside-tab:hover { color: var(--text); }
    .aside-tab.active {
      color: var(--text);
      border-bottom-color: #fafafa;
    }
    .aside-tab-panel {
      display: none;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
    }
    .aside-tab-panel.active { display: flex; }
    .gallery-frame {
      position: relative;
      border-radius: 14px;
      overflow: hidden;
      border: 1px solid var(--border);
      background: #0a0a0c;
      min-height: 200px;
      aspect-ratio: 3 / 4;
      max-height: 280px;
      margin-bottom: 10px;
    }
    .gallery-badge {
      position: absolute;
      top: 10px;
      right: 10px;
      font-size: 10px;
      font-weight: 800;
      padding: 4px 8px;
      border-radius: 6px;
      background: rgba(168, 85, 247, 0.85);
      color: #fff;
      z-index: 2;
    }
    #galleryHero {
      width: 100%;
      height: 100%;
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 160px;
    }
    #galleryHero img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }
    .gallery-placeholder-letter {
      font-size: 48px;
      font-weight: 800;
      color: rgba(255, 255, 255, 0.12);
    }
    .gallery-caption {
      font-size: 12px;
      color: var(--text-secondary);
      line-height: 1.45;
      margin: 0;
    }
    .chat-toolbar {
      flex-shrink: 0;
      padding: 10px 18px;
      border-bottom: 1px solid var(--border);
      background: rgba(22, 22, 24, 0.92);
      font-size: 12px;
      color: var(--text-secondary);
    }
    .view-panel-toolbar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 8px;
      margin: 0 0 10px;
    }
    .view-panel-toolbar .btn-secondary {
      font-size: 12px;
      padding: 6px 12px;
    }
    .view-panel {
      display: none;
      border-bottom: 1px solid var(--border);
      padding: 16px;
      overflow: auto;
      background: linear-gradient(180deg, rgba(168, 85, 247, 0.08), rgba(255, 255, 255, 0.01));
    }
    .view-panel.active { display: block; }
    .view-panel h2 { margin: 0 0 6px; font-size: 18px; }
    .view-panel .hint { color: var(--text-secondary); margin: 0 0 14px; font-size: 12px; }
    .friend-card-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 10px;
    }
    .friend-card {
      border: 1px solid var(--border);
      border-radius: 14px;
      background: rgba(255, 255, 255, 0.04);
      padding: 12px;
      text-align: left;
      color: inherit;
      cursor: pointer;
      font: inherit;
      display: flex;
      gap: 10px;
      align-items: center;
    }
    .friend-card:hover { border-color: rgba(168, 85, 247, 0.55); background: rgba(168, 85, 247, 0.1); }
    .group-member-list {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
      gap: 8px;
      margin: 12px 0;
    }
    .group-member {
      display: flex;
      gap: 8px;
      align-items: center;
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 9px 10px;
      background: rgba(255, 255, 255, 0.03);
      color: var(--text-secondary);
      font-size: 12px;
    }
    .scene-char-wrap { margin-top: 8px; }
    .tabs {
      flex-shrink: 0;
      display: flex;
      gap: 0;
      padding: 0 20px;
      background: var(--bg-panel);
      border-bottom: 1px solid var(--border);
    }
    .tab {
      padding: 10px 16px; font-size: 13px; border: none; background: transparent;
      color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent;
      margin-bottom: -1px; font-family: inherit;
    }
    .tab:hover { color: var(--text); }
    .tab.active { color: var(--accent-primary); font-weight: 600; border-bottom-color: var(--accent-primary); }
    .tab-panel { flex: 1; min-height: 0; display: none; flex-direction: column; }
    .tab-panel.active { display: flex; }
    .msg-scroll {
      flex: 1;
      min-height: 0;
      overflow: auto;
      -webkit-overflow-scrolling: touch;
      padding: 18px 20px 14px;
      background: linear-gradient(180deg, #0e0e11 0%, #0a0a0c 100%);
    }
    #panelChat.tab-panel.active {
      flex: 1;
      min-height: 0;
    }
    .activity-feed .msg-row { margin-bottom: 10px; }

    .msg-row { display: flex; flex-direction: column; margin-bottom: 20px; max-width: 720px; }
    .msg-row.user { align-self: flex-end; align-items: flex-end; margin-left: auto; }
    .msg-row.assistant { align-self: flex-start; align-items: flex-start; }
    .msg-row.system { align-self: center; align-items: center; max-width: 100%; }
    .msg-meta { font-size: 11px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 500; }
    .msg-bubble {
      padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.55;
      white-space: pre-wrap; word-break: break-word;
    }
    .msg-row.user .msg-bubble {
      background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
      color: #fff;
      border-radius: 16px 16px 4px 16px;
      box-shadow: 0 8px 28px rgba(124, 58, 237, 0.28);
    }
    .msg-row.assistant .msg-bubble {
      background: #1e1e22;
      color: var(--text);
      border: 1px solid rgba(255, 255, 255, 0.07);
      border-radius: 16px 16px 16px 4px;
      box-shadow: var(--shadow-sm);
    }
    .msg-bubble.msg-bubble--typing {
      color: var(--text-secondary);
      min-height: 1.35em;
    }
    .msg-bubble--rich.msg-bubble--typing .msg-body {
      color: var(--text-secondary);
      min-height: 1.35em;
    }
    .msg-bubble--rich.msg-bubble--streaming .msg-body {
      min-height: 1.35em;
    }
    .msg-bubble--rich {
      display: flex;
      flex-direction: column;
      gap: 10px;
      padding: 14px 16px;
    }
    .msg-workflow-pill {
      display: inline-flex;
      align-items: center;
      align-self: flex-start;
      font-size: 12px;
      font-weight: 500;
      color: var(--text-secondary);
      background: rgba(255, 255, 255, 0.06);
      border-radius: 999px;
      padding: 5px 12px;
      border: 1px solid var(--border);
      letter-spacing: 0.02em;
    }
    .msg-status-line {
      font-size: 12px;
      line-height: 1.5;
      color: var(--text-secondary);
      font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
      background: rgba(255, 255, 255, 0.04);
      border-radius: 8px;
      padding: 8px 10px;
      border: 1px solid var(--border);
      white-space: pre-wrap;
      word-break: break-word;
    }
    .msg-body {
      font-size: 14px;
      line-height: 1.55;
      white-space: pre-wrap;
      word-break: break-word;
      color: var(--text);
    }
    .msg-body--segmented {
      display: flex;
      flex-direction: column;
      gap: 10px;
      white-space: normal;
    }
    .msg-body-segment--action {
      font-size: 13px;
      line-height: 1.65;
      color: var(--text-secondary);
      font-style: italic;
      padding: 8px 10px;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.04);
      border-left: 2px solid rgba(161, 161, 170, 0.4);
      white-space: pre-wrap;
      word-break: break-word;
    }
    .msg-body-segment--speech {
      font-size: 15px;
      line-height: 1.55;
      color: var(--text);
      font-weight: 500;
      padding: 2px 0 2px 12px;
      border-left: 3px solid rgba(167, 139, 250, 0.55);
      white-space: pre-wrap;
      word-break: break-word;
    }
    .msg-action-tag {
      font-size: 11px;
      font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", monospace;
      color: var(--text-secondary);
      padding-top: 2px;
      border-top: 1px dashed var(--border);
      margin-top: 2px;
    }
    .msg-row.system .msg-bubble {
      background: transparent; color: var(--text-secondary); font-size: 13px; text-align: center;
      padding: 4px 12px;
    }
    .msg-row.scene-impression {
      align-self: stretch;
      align-items: stretch;
      max-width: 100%;
      margin-bottom: 16px;
    }
    .msg-row.scene-impression .scene-impression-label {
      font-size: 11px;
      letter-spacing: 0.06em;
      text-transform: none;
      color: var(--text-secondary);
      opacity: 0.85;
      margin-bottom: 6px;
      padding-left: 2px;
    }
    .msg-row.scene-impression .scene-impression-bubble {
      background: rgba(63, 63, 70, 0.45);
      border: 1px solid rgba(113, 113, 122, 0.35);
      border-left: 3px solid rgba(167, 139, 250, 0.55);
      color: var(--text);
      font-size: 14px;
      line-height: 1.65;
      padding: 12px 14px;
      border-radius: 10px;
      font-style: normal;
      white-space: pre-wrap;
    }

    .composer {
      flex-shrink: 0;
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 0;
      padding: 14px 18px 18px;
      background: #141416;
      border-top: 1px solid var(--border);
    }
    .composer-split {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      gap: 6px;
    }
    @media (min-width: 720px) {
      .composer-split {
        flex-direction: row;
        align-items: stretch;
        gap: 8px;
      }
      .composer-split .comp-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
    }
    .comp-col-label {
      font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.02em;
    }
    .composer textarea {
      flex: 1;
      width: 100%;
      min-height: 44px; max-height: 160px; resize: vertical;
      padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border);
      background: #1a1a1f; color: var(--text); font-size: 14px; font-family: inherit; line-height: 1.45;
    }
    .composer textarea.input-narration { background: rgba(255, 255, 255, 0.04); border-style: dashed; }
    .composer textarea:focus { outline: none; border-color: rgba(168, 85, 247, 0.45); box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.12); }
    .btn-send {
      width: 44px; height: 44px; flex-shrink: 0; border-radius: 50%; border: none;
      background: linear-gradient(145deg, #7c3aed, #a855f7); color: #fff; cursor: pointer;
      display: flex; align-items: center; justify-content: center;
      transition: filter 0.15s, transform 0.15s;
      box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
    }
    .btn-send:hover { filter: brightness(1.08); transform: scale(1.03); }
    .btn-send svg { width: 18px; height: 18px; }
    .btn-reset-chat {
      width: auto;
      min-width: 116px;
      height: 44px;
      flex-shrink: 0;
      padding: 0 14px;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: var(--bg-elevated);
      color: var(--text);
      font-size: 12px;
      cursor: pointer;
    }
    .btn-reset-chat:hover { background: #27272a; }
    .btn-reset-desire { min-width: 100px; }

    .aside-right {
      width: var(--aside-w);
      flex-shrink: 0;
      background: #121214;
      border-left: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      min-height: 0;
      padding: 12px;
    }
    .aside-right .memory-scroll {
      flex: 1;
      overflow: auto;
      margin-top: 8px;
      font-size: 12px;
      color: var(--text-secondary);
    }
    .v2-nurture-card {
      padding: 10px 12px;
      background: var(--bg-elevated);
      border: 1px solid var(--border);
      border-radius: 10px;
      font-size: 12px;
      line-height: 1.45;
      color: var(--text);
    }
    .v2-nurture-card .v2-nurture-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; }
    .v2-nurture-card .v2-nurture-row:first-child { margin-top: 0; }
    .v2-nurture-card .v2-muted { color: var(--text-secondary); font-size: 11px; }
    .v2-nurture-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
    .v2-nurture-actions .v2-nurture-actions-hint { width: 100%; font-size: 12px; color: var(--text-secondary); margin: 0; }
    .v2-nurture-actions .btn-secondary { font-size: 12px; padding: 6px 10px; }
    .v2-bar-track {
      height: 8px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.06);
      overflow: hidden;
      margin-top: 8px;
    }
    .v2-bar-fill {
      height: 100%;
      border-radius: 999px;
      background: linear-gradient(90deg, #6366f1, #a855f7);
      transition: width 0.2s ease;
    }
    .v2-muted.v2-muted--mt6 {
      margin-top: 6px;
    }
    .v2-muted.v2-muted--mt8 {
      margin-top: 8px;
    }
    .v2-bar-track.v2-bar-track--mt4 {
      margin-top: 4px;
    }
    .v2-bar-fill.v2-bar-fill--aff {
      opacity: 0.85;
    }
    .v2-bar-fill.v2-bar-fill--des {
      opacity: 0.65;
    }
    .v2-bonds-line {
      margin-top: 4px;
    }
    .btn-secondary.btn-secondary--memrow {
      width: auto;
      margin-top: 6px;
    }
    .memory-inline-muted {
      color: var(--text-secondary);
    }
    .pre-json-diagnostics {
      margin: 0;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .pre-json-diagnostics.pre-json-diagnostics--plain {
      word-break: normal;
    }
    .noc-cell.noc-cell--span {
      grid-column: 1 / -1;
    }
    .gallery-hero-placeholder {
      width: 100%;
      height: 100%;
      min-height: 160px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: linear-gradient(160deg, #3f3f46, #18181b);
      font-size: 44px;
      font-weight: 800;
      color: rgba(255, 255, 255, 0.12);
    }
    .v2-vfinal-strip {
      font-size: 11px;
      line-height: 1.5;
      color: var(--text);
      padding: 8px 10px;
      background: rgba(168, 85, 247, 0.08);
      border: 1px solid rgba(168, 85, 247, 0.25);
      border-radius: 8px;
      margin-top: 6px;
    }
    .aside-right .m-item { padding: 8px 0; border-bottom: 1px solid var(--border); line-height: 1.4; }
    .aside-right .m-item:last-child { border-bottom: none; }
    .memory-select {
      width: 100%; padding: 6px 8px; margin-bottom: 6px; border-radius: 8px; border: 1px solid var(--border);
      font-size: 12px; background: var(--bg-elevated); color: var(--text);
    }
    .memory-subtitle {
      font-size: 11px;
      font-weight: 600;
      color: var(--text-secondary);
      margin: 14px 0 6px;
    }
    .memory-dropdown-panel > .memory-subtitle:first-of-type {
      margin-top: 0;
    }
    .memory-chatted-embed {
      max-height: 220px;
      overflow-y: auto;
      margin-bottom: 4px;
    }
    #memoryRelSnapshot {
      font-size: 11px;
      line-height: 1.45;
      color: var(--text);
      padding: 8px 10px;
      background: var(--bg-elevated);
      border-radius: 8px;
      margin: 6px 0 8px;
      border: 1px solid var(--border);
    }
    #memoryRelSnapshot .mem-rel-line + .mem-rel-line { margin-top: 4px; color: var(--text-secondary); }
    .btn-header {
      width: auto; padding: 6px 12px; margin: 0; font-size: 12px;
    }

    @media (max-width: 1024px) {
      :root { --sidebar-w: 240px; --aside-w: 220px; }
    }

    /* ========= 方案 A：温暖沉浸式私密空间 ========= */
    body.theme-warm-space {
      --warm-gold: #e8c088;
      --warm-rose: #f9a8d4;
      --warm-ember: #fb7185;
      --glass-bg: rgba(22, 18, 28, 0.52);
      --glass-border: rgba(255, 230, 210, 0.12);
      --glow-gold: rgba(232, 192, 136, 0.35);
      --glow-rose: rgba(249, 168, 212, 0.28);
      --accent-primary: #d4a574;
      --accent-primary-hover: #c99860;
      --bg-page: #0a080c;
      --bg-panel: rgba(18, 14, 22, 0.75);
      --bg-elevated: rgba(30, 24, 34, 0.72);
      --border: rgba(255, 220, 200, 0.1);
      --text: #faf7f2;
      --text-secondary: #c4b5b0;
      --sidebar-w: 260px;
      --aside-w: 280px;
      --header-h: 56px;
      --shadow-sm: 0 8px 32px rgba(0, 0, 0, 0.45);
    }
    body.theme-warm-space .app-header--immersive {
      height: var(--header-h);
      padding: 0 14px 0 16px;
      display: grid;
      grid-template-columns: minmax(140px, 1fr) minmax(200px, 2.2fr) auto;
      align-items: center;
      gap: 12px;
      background: linear-gradient(180deg, rgba(28, 22, 32, 0.92), rgba(18, 14, 22, 0.88));
      border-bottom: 1px solid var(--glass-border);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
    }
    body.theme-warm-space .brand,
    body.theme-warm-space .header-actions { display: none; }
    body.theme-warm-space .imm-header-identity {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
      border: none;
      background: transparent;
      color: inherit;
      cursor: pointer;
      text-align: left;
      font: inherit;
      padding: 6px 8px;
      border-radius: 12px;
    }
    body.theme-warm-space .imm-header-identity:hover {
      background: rgba(255, 255, 255, 0.06);
    }
    body.theme-warm-space .imm-top-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      overflow: hidden;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 14px;
      background: linear-gradient(135deg, #6366f1, #a855f7);
      border: 1px solid rgba(255, 255, 255, 0.14);
      box-shadow: 0 0 20px var(--glow-rose);
      animation: imm-breathe-avatar 5.5s ease-in-out infinite;
    }
    body.theme-warm-space .imm-top-avatar.affinity-ring {
      border: none;
      box-shadow: 0 0 20px rgba(255, 27, 122, 0.22);
    }
    @keyframes imm-breathe-avatar {
      0%, 100% { box-shadow: 0 0 14px rgba(249, 168, 212, 0.2); transform: scale(1); }
      50% { box-shadow: 0 0 26px rgba(232, 192, 136, 0.45); transform: scale(1.03); }
    }
    body.theme-warm-space .imm-top-meta { min-width: 0; }
    body.theme-warm-space .imm-rel-chip {
      display: block;
      font-size: 12px;
      font-weight: 700;
      color: #fde68a;
      letter-spacing: 0.02em;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    body.theme-warm-space .imm-rel-chip[role="button"] {
      cursor: pointer;
      border-radius: 8px;
      padding: 2px 6px;
      margin-left: -6px;
      transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
    }
    body.theme-warm-space .imm-rel-chip[role="button"]:hover,
    body.theme-warm-space .imm-rel-chip[role="button"]:focus-visible {
      color: #fff7ed;
      background: rgba(255, 27, 122, 0.22);
      box-shadow: 0 0 0 1px rgba(255, 27, 122, 0.32);
      outline: none;
    }
    body.theme-warm-space .imm-top-sub { font-size: 10px; margin-top: 2px; }
    body.theme-warm-space .imm-header-search {
      position: relative;
      max-width: 520px;
      width: 100%;
      margin: 0 auto;
    }
    body.theme-warm-space .imm-header-search input {
      width: 100%;
      padding: 10px 14px 10px 38px;
      border-radius: 999px;
      border: 1px solid var(--glass-border);
      background: rgba(0, 0, 0, 0.25);
      color: var(--text);
      font-size: 13px;
      outline: none;
    }
    body.theme-warm-space .imm-header-search input:focus {
      border-color: rgba(232, 192, 136, 0.45);
      box-shadow: 0 0 0 2px rgba(232, 192, 136, 0.12);
    }
    body.theme-warm-space .imm-header-search-ico {
      position: absolute;
      left: 14px;
      top: 50%;
      transform: translateY(-50%);
      opacity: 0.45;
      pointer-events: none;
      font-size: 13px;
    }
    body.theme-warm-space .imm-header-actions {
      display: flex;
      align-items: center;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }
    body.theme-warm-space .imm-ico-btn {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      border: 1px solid var(--glass-border);
      background: rgba(255, 255, 255, 0.05);
      color: var(--text);
      cursor: pointer;
      font-size: 15px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-decoration: none;
    }
    body.theme-warm-space .imm-ico-btn.danger { color: #fecdd3; border-color: rgba(251, 113, 133, 0.35); }
    body.theme-warm-space .imm-user-pill { max-width: 100px; }
    body.theme-warm-space .imm-lang {
      display: flex;
      align-items: center;
      gap: 6px;
      font-size: 11px;
      color: var(--text-secondary);
    }
    body.theme-warm-space .imm-lang select {
      min-width: 100px;
      padding: 5px 8px;
      border-radius: 8px;
      border: 1px solid var(--glass-border);
      background: rgba(0, 0, 0, 0.2);
      color: var(--text);
      font-size: 12px;
    }
    body.theme-warm-space .imm-gift-ring {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: 1px solid rgba(232, 192, 136, 0.45);
      background: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.2), rgba(40, 32, 48, 0.9));
      cursor: pointer;
      font-size: 18px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    body.theme-warm-space .imm-gift-pulse {
      animation: imm-gift-breathe 2.8s ease-in-out infinite;
    }
    @keyframes imm-gift-breathe {
      0%, 100% { box-shadow: 0 0 0 0 rgba(232, 192, 136, 0); transform: scale(1); }
      50% { box-shadow: 0 0 22px rgba(249, 168, 212, 0.55); transform: scale(1.06); }
    }
    body.theme-warm-space .imm-desk-only { display: inline-flex; }
    body.theme-warm-space .sidebar {
      background: var(--glass-bg);
      border-right: 1px solid var(--glass-border);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
    }
    body.theme-warm-space .imm-space-title {
      margin: 0 0 10px;
      font-size: 13px;
      font-weight: 800;
      letter-spacing: 0.12em;
      color: rgba(253, 230, 200, 0.85);
      text-transform: uppercase;
    }
    body.theme-warm-space .imm-space-stack {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-bottom: 14px;
    }
    body.theme-warm-space .imm-space-card {
      position: relative;
      border-radius: 14px;
      padding: 10px 12px 10px 36px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(255, 255, 255, 0.04);
      cursor: default;
      transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
    }
    body.theme-warm-space .imm-space-card.is-active {
      border-color: rgba(125, 211, 252, 0.55);
      box-shadow: 0 0 22px rgba(56, 189, 248, 0.25);
      background: linear-gradient(135deg, rgba(56, 189, 248, 0.12), rgba(168, 85, 247, 0.1));
    }
    body.theme-warm-space .imm-space-card.is-locked { opacity: 0.72; }
    body.theme-warm-space .imm-space-card-lock {
      position: absolute;
      left: 10px;
      top: 50%;
      transform: translateY(-50%);
      font-size: 14px;
      opacity: 0.9;
    }
    body.theme-warm-space .imm-space-card-title { font-size: 13px; font-weight: 700; color: var(--text); }
    body.theme-warm-space .imm-space-card-sub {
      font-size: 11px;
      color: var(--text-secondary);
      margin-top: 4px;
      line-height: 1.35;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }
    body.theme-warm-space .imm-add-space-btn {
      margin-top: 10px;
      border-radius: 12px;
      background: linear-gradient(135deg, rgba(232, 192, 136, 0.95), rgba(244, 114, 182, 0.75));
      color: #1a1020;
      font-weight: 700;
    }
    body.theme-warm-space .chat-surface {
      position: relative;
      border-left-color: transparent;
      border-right-color: transparent;
      background: transparent;
      overflow: hidden;
    }
    body.theme-warm-space .main-chat {
      background: transparent;
    }
    body.theme-warm-space .imm-ambient {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      inset: 0;
      z-index: 0;
      pointer-events: none;
      overflow: hidden;
      border-radius: 0;
    }
    body.theme-warm-space .imm-ambient .imm-bg-layer {
      position: absolute;
      top: -4%;
      right: -4%;
      bottom: -4%;
      left: -4%;
      inset: -4%;
      background-size: cover;
      background-position: center;
      opacity: 0.55;
      transition: opacity 1.2s ease, transform 24s ease-in-out;
      animation: imm-pan-soft 80s linear infinite;
    }
    body.theme-warm-space .chat-surface[data-imm-tier="early"] .imm-bg-layer {
      background-image:
        linear-gradient(160deg, rgba(26, 21, 32, 0.42) 0%, rgba(45, 31, 40, 0.28) 42%, rgba(30, 27, 46, 0.38) 100%),
        var(--ref-luxury-room);
    }
    body.theme-warm-space .chat-surface[data-imm-tier="warm"] .imm-bg-layer {
      background-image:
        linear-gradient(165deg, rgba(36, 26, 24, 0.4) 0%, rgba(59, 42, 34, 0.28) 45%, rgba(31, 26, 40, 0.36) 100%),
        var(--ref-luxury-room);
    }
    body.theme-warm-space .chat-surface[data-imm-tier="intimate"] .imm-bg-layer {
      background-image:
        linear-gradient(170deg, rgba(28, 20, 24, 0.42) 0%, rgba(61, 40, 48, 0.3) 50%, rgba(34, 24, 48, 0.4) 100%),
        var(--ref-luxury-room);
    }
    body.theme-warm-space .chat-surface[data-imm-tier="bond"] .imm-bg-layer {
      background-image:
        linear-gradient(175deg, rgba(15, 16, 32, 0.45) 0%, rgba(42, 34, 64, 0.32) 55%, rgba(26, 16, 48, 0.42) 100%),
        var(--ref-luxury-room);
    }
    @keyframes imm-pan-soft {
      0% { transform: scale(1.06) translate(0, 0); }
      50% { transform: scale(1.08) translate(-1.5%, -1%); }
      100% { transform: scale(1.06) translate(0, 0); }
    }
    body.theme-warm-space .imm-candle-glow {
      position: absolute;
      bottom: -20%;
      left: 50%;
      width: 140%;
      height: 70%;
      transform: translateX(-50%);
      background: radial-gradient(ellipse at 50% 100%, rgba(255, 200, 120, 0.18), transparent 55%);
      animation: imm-candle-flicker 6s ease-in-out infinite;
    }
    @keyframes imm-candle-flicker {
      0%, 100% { opacity: 0.55; }
      40% { opacity: 0.75; }
      55% { opacity: 0.5; }
    }
    body.theme-warm-space .imm-stars {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      inset: 0;
      background-image: radial-gradient(1.5px 1.5px at 10% 20%, rgba(255, 255, 255, 0.35), transparent),
        radial-gradient(1px 1px at 30% 70%, rgba(255, 255, 255, 0.22), transparent),
        radial-gradient(1.5px 1.5px at 75% 35%, rgba(255, 230, 200, 0.3), transparent),
        radial-gradient(1px 1px at 88% 80%, rgba(255, 255, 255, 0.18), transparent);
      animation: imm-stars-drift 120s linear infinite;
      opacity: 0.35;
    }
    @keyframes imm-stars-drift {
      from { transform: translateY(0); }
      to { transform: translateY(-40px); }
    }
    body.theme-warm-space .imm-vignette {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      inset: 0;
      background: radial-gradient(ellipse at 50% 40%, transparent 30%, rgba(5, 3, 8, 0.75) 100%);
    }
    body.theme-warm-space .imm-arousal-veil {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      inset: 0;
      opacity: 0;
      background: radial-gradient(circle at 70% 30%, rgba(251, 113, 133, 0.18), transparent 55%);
      transition: opacity 0.8s ease;
    }
    body.theme-warm-space .chat-surface.is-high-arousal .imm-arousal-veil { opacity: 1; }
    body.theme-warm-space .chat-surface > :not(.imm-ambient):not(.petals-canvas) {
      position: relative;
      z-index: 1;
    }
    /* 玫瑰花瓣 Canvas：叠在氛围层之上、消息区之下；仅 warm-space 显示 */
    .petals-canvas {
      display: none;
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      pointer-events: none;
      z-index: 0;
      opacity: 0.82;
    }
    body.theme-warm-space .petals-canvas {
      display: block;
    }
    @media (prefers-reduced-motion: reduce) {
      body.theme-warm-space .petals-canvas {
        display: none !important;
      }
    }
    body.theme-warm-space .chat-peer-header {
      background: rgba(18, 14, 22, 0.55);
      border-bottom: 1px solid var(--glass-border);
      -webkit-backdrop-filter: blur(12px);
      backdrop-filter: blur(12px);
    }
    body.theme-warm-space .chat-toolbar {
      background: rgba(14, 12, 18, 0.5);
      border-bottom: 1px solid var(--glass-border);
    }
    body.theme-warm-space .msg-scroll {
      background: transparent;
    }
    body.theme-warm-space #panelChat.tab-panel.active {
      background: transparent;
    }
    body.theme-warm-space .msg-row.user .msg-bubble {
      background: linear-gradient(135deg, rgba(124, 58, 237, 0.85), rgba(244, 114, 182, 0.75));
      border: none;
      box-shadow: 0 12px 36px rgba(0, 0, 0, 0.35), 0 0 24px rgba(244, 114, 182, 0.2);
    }
    body.theme-warm-space .msg-row.assistant .msg-bubble {
      background: rgba(22, 18, 28, 0.55);
      border: 1px solid rgba(255, 220, 200, 0.1);
      box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
    }
    body.theme-warm-space .msg-body-segment--action {
      color: #b8a9a3;
      background: rgba(0, 0, 0, 0.22);
      border-left-color: rgba(196, 181, 176, 0.35);
    }
    body.theme-warm-space .msg-body-segment--speech {
      color: #faf7f2;
      border-left-color: rgba(232, 192, 136, 0.7);
    }
    body.theme-warm-space .msg-row.scene-impression .scene-impression-bubble {
      background: rgba(18, 14, 24, 0.72);
      border: 1px solid rgba(255, 220, 200, 0.14);
      border-left: 3px solid rgba(167, 139, 250, 0.7);
      -webkit-backdrop-filter: blur(12px);
      backdrop-filter: blur(12px);
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.38);
    }

    body.theme-warm-space .composer {
      background: rgba(12, 10, 16, 0.65);
      border-top: 1px solid var(--glass-border);
      -webkit-backdrop-filter: blur(14px);
      backdrop-filter: blur(14px);
      padding-bottom: env(safe-area-inset-bottom, 0px);
    }
    body.theme-warm-space .aside-right {
      background: var(--glass-bg);
      border-left: 1px solid var(--glass-border);
      -webkit-backdrop-filter: blur(18px);
      backdrop-filter: blur(18px);
    }
    body.theme-warm-space .imm-presence-panel {
      position: relative;
      margin-bottom: 12px;
      padding: 12px;
      border-radius: 14px;
      border: 1px solid var(--glass-border);
      background: rgba(0, 0, 0, 0.2);
    }
    body.theme-warm-space .imm-nurture-level-badge {
      position: absolute;
      top: 18px;
      right: 16px;
      z-index: 4;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 96px;
      padding: 8px 12px;
      border-radius: 999px;
      border: 1px solid rgba(255, 77, 141, 0.42);
      background: linear-gradient(135deg, rgba(255, 77, 141, 0.22), rgba(168, 85, 247, 0.16));
      color: #fff;
      font-weight: 800;
      font-size: 13px;
      letter-spacing: 0.02em;
      cursor: pointer;
      box-shadow: 0 0 18px rgba(255, 77, 141, 0.18);
      pointer-events: auto;
      user-select: none;
    }
    body.theme-warm-space .imm-nurture-level-badge:hover {
      border-color: rgba(255, 182, 214, 0.72);
      box-shadow: 0 0 26px rgba(255, 77, 141, 0.28);
      transform: translateY(-1px);
    }
    body.theme-warm-space .imm-nurture-level-badge[hidden] {
      display: none;
    }
    body.theme-warm-space .imm-nurture-level-badge.is-empty {
      opacity: 0.45;
      filter: saturate(0.65);
    }
    body.theme-warm-space .imm-presence-hero--clickable {
      width: 100%;
      position: relative;
      min-height: 118px;
      border: none;
      background: transparent;
      color: inherit;
      font: inherit;
      cursor: pointer;
      text-align: center;
      padding: 0;
      border-radius: 14px;
      padding-right: 112px;
    }
    body.theme-warm-space .imm-presence-hero--clickable:hover {
      background: rgba(255, 255, 255, 0.04);
    }
    body.theme-warm-space .imm-presence-hero--clickable:focus-visible {
      outline: 2px solid rgba(255, 77, 141, 0.55);
      outline-offset: 2px;
    }
    body.theme-warm-space .imm-presence-hero .ph {
      width: 72px;
      height: 72px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      font-weight: 800;
      background: linear-gradient(145deg, #4c3f54, #1a1520);
      border: 1px solid rgba(229, 152, 155, 0.35);
      box-shadow:
        0 0 0 2px rgba(229, 152, 155, 0.25),
        0 0 22px rgba(229, 152, 155, 0.22);
    }
    body.theme-warm-space .imm-presence-hero .ph.affinity-ring {
      border: none;
      box-shadow:
        0 0 0 2px rgba(255, 27, 122, 0.2),
        0 0 24px rgba(255, 27, 122, 0.24);
    }
    body.theme-warm-space .imm-bar-row { margin-top: 8px; width: 100%; }
    body.theme-warm-space .imm-bar-label {
      display: flex;
      justify-content: space-between;
      font-size: 11px;
      color: var(--text-secondary);
      margin-bottom: 4px;
    }
    body.theme-warm-space .imm-bar-track {
      height: 8px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.08);
      overflow: hidden;
    }
    body.theme-warm-space .imm-bar-fill {
      height: 100%;
      width: var(--presence-pct, 0%);
      border-radius: 999px;
      transition: width 0.45s ease;
    }
    body.theme-warm-space .imm-bar-fill.aff {
      background: linear-gradient(90deg, rgba(255, 183, 178, 0.85), rgba(229, 152, 155, 0.95));
    }
    body.theme-warm-space .imm-bar-fill.des {
      background: linear-gradient(90deg, rgba(251, 146, 60, 0.75), rgba(244, 63, 94, 0.85));
    }
    body.theme-warm-space .imm-memory-snippet {
      font-size: 11px;
      color: var(--text-secondary);
      padding: 8px 0;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      line-height: 1.4;
    }
    body.theme-warm-space .imm-memory-snippet:last-child { border-bottom: none; }
    body.theme-warm-space .imm-wish-cloud {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 8px;
    }
    body.theme-warm-space .imm-wish-tag {
      font-size: 10px;
      padding: 4px 8px;
      border-radius: 999px;
      border: 1px solid rgba(249, 168, 212, 0.35);
      color: #fce7f3;
      background: rgba(244, 114, 182, 0.1);
      box-shadow: 0 0 12px rgba(249, 168, 212, 0.12);
    }
    body.theme-warm-space .imm-quick-actions {
      display: flex;
      flex-wrap: wrap;
      gap: 6px;
      margin-top: 10px;
    }
    body.theme-warm-space .imm-quick-actions button {
      flex: 1 1 45%;
      font-size: 11px;
      padding: 8px 6px;
      border-radius: 10px;
      border: 1px solid var(--glass-border);
      background: rgba(255, 255, 255, 0.05);
      color: var(--text);
      cursor: pointer;
      font-family: inherit;
    }
    body.theme-warm-space .imm-level-up-overlay {
      position: fixed;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      inset: 0;
      z-index: 200;
      pointer-events: none;
      display: flex;
      align-items: center;
      justify-content: center;
      opacity: 0;
      transition: opacity 0.6s ease;
      background: radial-gradient(circle at 50% 50%, rgba(255, 200, 150, 0.35), transparent 60%);
    }
    body.theme-warm-space .imm-level-up-overlay.on {
      opacity: 1;
      animation: imm-level-flash 1.4s ease forwards;
    }
    @keyframes imm-level-flash {
      0% { opacity: 0; }
      20% { opacity: 1; }
      100% { opacity: 0; }
    }
    body.theme-warm-space .imm-mobile-tabbar {
      display: none;
      flex-shrink: 0;
      min-height: 52px;
      height: calc(52px + env(safe-area-inset-bottom, 0px));
      border-top: 1px solid var(--glass-border);
      background: rgba(12, 10, 16, 0.92);
      -webkit-backdrop-filter: blur(12px);
      backdrop-filter: blur(12px);
      align-items: stretch;
      justify-content: space-around;
      padding: 0 6px env(safe-area-inset-bottom, 0px);
    }
    body.theme-warm-space .imm-mobile-tabbar button {
      flex: 1;
      border: none;
      background: transparent;
      color: var(--text-secondary);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      font-family: inherit;
    }
    body.theme-warm-space .imm-mobile-tabbar button.is-active {
      color: #fde68a;
    }
    body.theme-warm-space .app-body.is-left-collapsed .sidebar {
      width: 0 !important;
      min-width: 0 !important;
      overflow: hidden !important;
      border: none !important;
      padding: 0 !important;
    }
    body.theme-warm-space .app-body.is-right-collapsed .aside-right {
      width: 0 !important;
      min-width: 0 !important;
      overflow: hidden !important;
      border: none !important;
      padding: 0 !important;
    }
    @media (max-width: 1023px) {
      body.theme-warm-space .imm-desk-only { display: none !important; }
      body.theme-warm-space .imm-mobile-tabbar { display: flex; }
      body.theme-warm-space .app-body.imm-mobile-view-chat .sidebar,
      body.theme-warm-space .app-body.imm-mobile-view-chat .aside-right {
        display: none;
      }
      body.theme-warm-space .app-body.imm-mobile-view-left .main-chat,
      body.theme-warm-space .app-body.imm-mobile-view-left .aside-right {
        display: none;
      }
      body.theme-warm-space .app-body.imm-mobile-view-right .main-chat,
      body.theme-warm-space .app-body.imm-mobile-view-right .sidebar {
        display: none;
      }
      body.theme-warm-space .aside-right { display: flex; }
      :root { --sidebar-w: 260px; --aside-w: 280px; }
    }
    body.theme-warm-space .chat-surface[data-imm-tier="bond"] .imm-stars { opacity: 0.55; }

    /* 参考「暗色浪漫 / 玫瑰金」稿：略加深底色、柔光描边与卡片高亮 */
    body.theme-warm-space {
      background: radial-gradient(120% 80% at 50% 0%, rgba(229, 152, 155, 0.06), transparent 55%), #0a0505;
    }
    body.theme-warm-space .imm-rel-chip {
      text-shadow: 0 0 18px rgba(255, 183, 178, 0.35);
    }
    body.theme-warm-space .imm-space-card.is-active {
      box-shadow:
        0 0 0 1px rgba(229, 152, 155, 0.45),
        0 0 28px rgba(229, 152, 155, 0.28),
        inset 0 0 24px rgba(255, 215, 200, 0.08);
    }

    /* 不支持 backdrop-filter 时略提高面板不透明度，避免「透成一片」 */
    @supports not ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
      body.theme-warm-space .app-header--immersive {
        background: rgba(12, 8, 14, 0.94);
      }
      body.theme-warm-space .sidebar {
        background: rgba(18, 14, 22, 0.96);
      }
      body.theme-warm-space .aside-right {
        background: rgba(18, 14, 22, 0.96);
      }
      body.theme-warm-space .chat-peer-header {
        background: rgba(18, 14, 22, 0.92);
      }
      body.theme-warm-space .msg-row.assistant .msg-bubble {
        background: rgba(22, 18, 28, 0.88);
      }
      body.theme-warm-space .composer {
        background: rgba(12, 10, 16, 0.94);
      }
      body.theme-warm-space .imm-mobile-tabbar {
        background: rgba(12, 10, 16, 0.98);
      }
    }

    /* ========== Candy.ai 风格：粉紫梦幻 + 烛光奢华（与 theme-warm-space 叠加） ========== */
    body.theme-candy {
      --candy-rose: #ff4d8d;
      --candy-lav: #c4b5fd;
      --candy-deep: #1a0f24;
      --candy-gold: #f5d0a8;
      --candy-glass: rgba(28, 18, 38, 0.72);
    }
    body.theme-candy.theme-warm-space {
      background:
        radial-gradient(ellipse 120% 80% at 50% -10%, rgba(157, 80, 187, 0.35), transparent 50%),
        radial-gradient(ellipse 90% 60% at 90% 60%, rgba(255, 77, 141, 0.12), transparent 45%),
        #0f0818;
    }
    body.theme-candy.theme-warm-space .sidebar {
      background: linear-gradient(180deg, rgba(26, 15, 36, 0.88), rgba(12, 8, 18, 0.92));
      border-right-color: rgba(196, 181, 253, 0.12);
    }
    /* 左栏参考肖像：aside 伪元素全高铺底 + cover，整层 75% 透明度；内容在 .sidebar-scroll 之上 */
    body.theme-warm-space #sidebarMain::after {
      content: "";
      position: absolute;
      inset: 0;
      background-image:
        linear-gradient(180deg, rgba(12, 8, 18, 0.5) 0%, rgba(12, 8, 18, 0.08) 38%, rgba(10, 6, 16, 0.62) 100%),
        var(--ref-sidebar-avatar);
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      pointer-events: none;
      z-index: 0;
      opacity: 0.75;
    }
    body.theme-warm-space #sidebarMain > .sidebar-scroll {
      position: relative;
      z-index: 1;
      background: transparent;
    }
    body.theme-warm-space #sidebarMain .candy-chatted-item {
      background: rgba(22, 14, 32, 0.55);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
    }
    body.theme-warm-space #sidebarMain .candy-chatted-item:hover {
      background: rgba(255, 77, 141, 0.12);
      border-color: rgba(255, 77, 141, 0.32);
    }
    body.theme-warm-space #sidebarMain .imm-space-card {
      background: rgba(28, 16, 40, 0.5);
      -webkit-backdrop-filter: blur(8px);
      backdrop-filter: blur(8px);
    }
    body.theme-warm-space #sidebarMain .imm-space-card.is-active {
      background: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(168, 85, 247, 0.14));
      border-color: rgba(125, 211, 252, 0.55);
      box-shadow:
        0 0 0 1px rgba(229, 152, 155, 0.35),
        0 0 22px rgba(56, 189, 248, 0.22),
        inset 0 0 20px rgba(255, 215, 200, 0.06);
    }
    body.theme-warm-space #sidebarMain .profile-card {
      background: rgba(22, 14, 34, 0.62);
      -webkit-backdrop-filter: blur(10px);
      backdrop-filter: blur(10px);
    }
    /* 场景设置：避免 backdrop-filter 单独成层显得「永远压在最前」；展开后长表单在块内滚动 */
    #sidebarMain #sceneSettingsFold {
      position: relative;
      z-index: auto;
      background: rgba(22, 14, 34, 0.82);
      border-color: rgba(255, 255, 255, 0.1);
      margin-bottom: 12px;
    }
    #sidebarMain #sceneSettingsFold[open] > .idx-st-2 {
      max-height: min(46vh, 400px);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding-right: 4px;
      margin-top: 6px;
    }
    #sidebarMain #sceneSettingsFold + #btnCreateScene {
      margin-top: 6px;
    }
    body.theme-warm-space #sidebarMain .sidebar-tools-fold {
      background: rgba(22, 14, 34, 0.52);
      -webkit-backdrop-filter: blur(8px);
      backdrop-filter: blur(8px);
    }
    body.theme-warm-space #sidebarMain .sidebar-search-wrap input {
      background: rgba(22, 14, 34, 0.55);
    }
    body.theme-candy .candy-chatted-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      margin-top: 10px;
      max-height: min(52vh, 520px);
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding-right: 2px;
    }
    body.theme-candy .candy-chatted-item {
      width: 100%;
      text-align: left;
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 10px 10px;
      border-radius: 14px;
      border: 1px solid rgba(255, 255, 255, 0.06);
      background: rgba(255, 255, 255, 0.04);
      color: var(--text);
      cursor: pointer;
      font: inherit;
      transition: box-shadow 0.35s ease, border-color 0.35s ease, background 0.35s ease;
    }
    body.theme-candy .candy-chatted-item:hover {
      border-color: rgba(255, 77, 141, 0.35);
      background: rgba(255, 77, 141, 0.08);
    }
    body.theme-candy .candy-chatted-item.is-active {
      border-color: rgba(196, 181, 253, 0.55);
      box-shadow:
        0 0 0 1px rgba(255, 77, 141, 0.25),
        0 0 28px rgba(157, 80, 187, 0.35);
      background: linear-gradient(135deg, rgba(157, 80, 187, 0.2), rgba(255, 77, 141, 0.12));
    }
    body.theme-candy.theme-warm-space .candy-chatted-item .chatted-avatar-fallback {
      background-image: linear-gradient(180deg, rgba(18, 8, 28, 0.4), rgba(18, 8, 28, 0.08)), var(--ref-sidebar-avatar);
      background-size: cover;
      background-position: center top;
      color: transparent;
      font-size: 0;
      border: 1px solid rgba(255, 255, 255, 0.12);
    }
    body.theme-candy .candy-chatted-item .chatted-name-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      width: 100%;
    }
    body.theme-candy .candy-chatted-item .name {
      font-weight: 700;
      font-size: 13px;
    }
    body.theme-candy .candy-chatted-item .chatted-time {
      font-size: 11px;
      color: var(--text-secondary);
      flex-shrink: 0;
    }
    body.theme-candy .candy-chatted-item .preview {
      font-size: 12px;
      color: var(--text-secondary);
      margin-top: 4px;
      line-height: 1.35;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
      line-clamp: 2;
      overflow: hidden;
    }
    body.theme-candy .candy-stage-line {
      font-size: 12px;
      line-height: 1.45;
      margin: 0 0 10px;
      color: var(--text-secondary);
    }
    body.theme-candy.theme-warm-space .imm-petals {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      inset: 0;
      pointer-events: none;
      opacity: 0.1;
      background-image:
        radial-gradient(ellipse 8px 14px at 15% 70%, rgba(255, 77, 141, 0.45), transparent),
        radial-gradient(ellipse 10px 16px at 82% 55%, rgba(255, 77, 141, 0.35), transparent),
        radial-gradient(ellipse 7px 12px at 40% 85%, rgba(245, 208, 168, 0.3), transparent),
        radial-gradient(ellipse 9px 15px at 70% 78%, rgba(196, 181, 253, 0.25), transparent);
      animation: candy-petals-drift 90s linear infinite;
    }
    @keyframes candy-petals-drift {
      from {
        transform: translateY(0) scale(1);
      }
      to {
        transform: translateY(-24px) scale(1.02);
      }
    }
    body.theme-candy.theme-warm-space .imm-candle-glow {
      opacity: 0.85;
      animation: imm-candle-flicker 7s ease-in-out infinite;
    }
    body.theme-candy.theme-warm-space .msg-row.user .msg-bubble {
      background: linear-gradient(135deg, rgba(76, 29, 149, 0.92), rgba(157, 80, 187, 0.88));
      box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45), 0 0 28px rgba(196, 181, 253, 0.22);
    }
    body.theme-candy.theme-warm-space .msg-row.assistant .msg-bubble {
      background: linear-gradient(145deg, rgba(255, 77, 141, 0.22), rgba(196, 181, 253, 0.18));
      border: 1px solid rgba(255, 182, 214, 0.22);
      box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4), 0 0 22px rgba(255, 77, 141, 0.12);
    }
    body.theme-candy.theme-warm-space .chat-peer-header {
      background: var(--candy-glass);
      border-bottom-color: rgba(255, 182, 214, 0.12);
    }
    body.theme-candy .chat-peer-sub-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }
    body.theme-candy .chat-peer-status {
      font-size: 11px;
      font-weight: 600;
      padding: 2px 8px;
      border-radius: 999px;
      background: rgba(52, 211, 153, 0.18);
      color: #a7f3d0;
      border: 1px solid rgba(52, 211, 153, 0.35);
    }
    body.theme-candy .chat-peer-status.is-away {
      background: rgba(251, 191, 36, 0.12);
      color: #fde68a;
      border-color: rgba(251, 191, 36, 0.35);
    }
    body.theme-candy .candy-composer .composer-main-row {
      align-items: stretch;
    }
    body.theme-candy .candy-composer-actions {
      flex-direction: column;
      gap: 6px;
    }
    body.theme-candy .aside-tabs--candy {
      border-bottom-color: rgba(255, 182, 214, 0.12);
      gap: 4px;
    }
    body.theme-candy .aside-tabs--candy .aside-tab {
      border-radius: 10px 10px 0 0;
      padding: 8px 10px;
      font-weight: 600;
      color: var(--text-secondary);
    }
    body.theme-candy .aside-tabs--candy .aside-tab.active {
      color: #fce7f3;
      background: linear-gradient(180deg, rgba(255, 77, 141, 0.2), transparent);
      box-shadow: inset 0 -2px 0 #ff4d8d;
    }
    body.theme-candy .candy-gifts-lead {
      margin-bottom: 12px;
    }
    body.theme-candy .candy-gifts-cta {
      width: 100%;
      background: linear-gradient(135deg, #9d50bb, #ff4d8d);
      border: none;
    }
    body.theme-candy.theme-warm-space .app-header--immersive {
      background: rgba(18, 10, 28, 0.88);
      border-bottom-color: rgba(196, 181, 253, 0.12);
    }

    /* ========== 奢华梦幻卧室：多层氛围（仅 theme-candy，覆盖上文 candy 渐变） ========== */
    body.theme-candy.theme-warm-space .main-chat {
      background: transparent;
    }
    body.theme-candy .candy-sidebar-chat-zone {
      margin-top: 2px;
      padding-top: 12px;
      border-top: 1px solid rgba(196, 181, 253, 0.16);
    }
    body.theme-candy .candy-sidebar-chat-zone.candy-sidebar-chat-zone--stack {
      margin-top: 0;
      border-top: none;
      padding-top: 8px;
    }
    body.theme-candy .candy-sidebar-chat-zone .filter-pills {
      margin-bottom: 8px;
    }
    body.theme-candy .candy-sidebar-chat-zone .sidebar-search-wrap {
      margin-bottom: 10px;
    }
    body.theme-candy .candy-sidebar-chat-zone .sidebar-chat-head-top {
      margin-top: 10px;
    }
    body.theme-candy.theme-warm-space .imm-ambient--luxury .imm-bg-layer {
      opacity: 0.74;
      animation: imm-pan-soft 100s linear infinite, candy-luxury-breathe 20s ease-in-out infinite;
    }
    @keyframes candy-luxury-breathe {
      0%,
      100% {
        filter: saturate(1.06) brightness(1.03);
      }
      50% {
        filter: saturate(1.22) brightness(1.1);
      }
    }
    body.theme-candy.theme-warm-space .chat-surface[data-imm-tier="early"] .imm-bg-layer {
      background-image:
        radial-gradient(ellipse 110% 90% at 50% 100%, rgba(110, 35, 70, 0.5), transparent 58%),
        radial-gradient(ellipse 55% 42% at 18% 68%, rgba(255, 77, 141, 0.14), transparent 52%),
        radial-gradient(ellipse 48% 36% at 88% 62%, rgba(196, 181, 253, 0.18), transparent 52%),
        radial-gradient(ellipse 70% 50% at 50% 0%, rgba(45, 20, 55, 0.35), transparent 55%),
        linear-gradient(
          170deg,
          rgba(14, 6, 20, 0.55) 0%,
          rgba(36, 16, 48, 0.38) 36%,
          rgba(26, 10, 28, 0.42) 58%,
          rgba(12, 5, 16, 0.62) 100%
        ),
        var(--ref-luxury-room);
    }
    body.theme-candy.theme-warm-space .chat-surface[data-imm-tier="warm"] .imm-bg-layer {
      background-image:
        radial-gradient(ellipse 115% 92% at 50% 100%, rgba(130, 45, 75, 0.48), transparent 58%),
        radial-gradient(ellipse 60% 45% at 25% 72%, rgba(255, 200, 160, 0.1), transparent 50%),
        radial-gradient(ellipse 50% 38% at 82% 58%, rgba(255, 120, 160, 0.12), transparent 50%),
        linear-gradient(172deg, rgba(18, 8, 24, 0.52) 0%, rgba(48, 24, 40, 0.4) 44%, rgba(28, 16, 32, 0.5) 100%),
        var(--ref-luxury-room);
    }
    body.theme-candy.theme-warm-space .chat-surface[data-imm-tier="intimate"] .imm-bg-layer {
      background-image:
        radial-gradient(ellipse 120% 95% at 48% 100%, rgba(90, 25, 55, 0.55), transparent 60%),
        radial-gradient(ellipse 65% 48% at 70% 68%, rgba(255, 77, 141, 0.16), transparent 52%),
        radial-gradient(ellipse 55% 40% at 15% 55%, rgba(196, 181, 253, 0.12), transparent 50%),
        linear-gradient(174deg, rgba(16, 6, 20, 0.55) 0%, rgba(56, 28, 50, 0.42) 50%, rgba(24, 10, 24, 0.52) 100%),
        var(--ref-luxury-room);
    }
    body.theme-candy.theme-warm-space .chat-surface[data-imm-tier="bond"] .imm-bg-layer {
      background-image:
        radial-gradient(ellipse 125% 100% at 50% 100%, rgba(60, 30, 90, 0.45), transparent 62%),
        radial-gradient(ellipse 80% 55% at 20% 30%, rgba(157, 80, 187, 0.2), transparent 55%),
        radial-gradient(ellipse 70% 50% at 85% 25%, rgba(255, 182, 220, 0.1), transparent 52%),
        linear-gradient(178deg, rgba(10, 5, 18, 0.55) 0%, rgba(42, 24, 80, 0.42) 56%, rgba(18, 8, 28, 0.52) 100%),
        var(--ref-luxury-room);
    }
    body.theme-candy.theme-warm-space .imm-silk-sheen {
      position: absolute;
      top: -10%;
      right: -10%;
      bottom: -10%;
      left: -10%;
      background: linear-gradient(
        118deg,
        transparent 0%,
        rgba(255, 252, 248, 0.04) 40%,
        rgba(255, 220, 235, 0.1) 50%,
        rgba(255, 252, 248, 0.04) 60%,
        transparent 100%
      );
      background-size: 220% 220%;
      animation: imm-silk-sweep 24s ease-in-out infinite;
      mix-blend-mode: soft-light;
      pointer-events: none;
    }
    @keyframes imm-silk-sweep {
      0%,
      100% {
        background-position: 10% 30%;
        opacity: 0.5;
      }
      50% {
        background-position: 90% 70%;
        opacity: 0.88;
      }
    }
    body.theme-candy.theme-warm-space .imm-rose-field {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      opacity: 0.52;
      background-image:
        radial-gradient(ellipse 16% 11% at 10% 90%, rgba(175, 35, 75, 0.55), transparent 72%),
        radial-gradient(ellipse 20% 13% at 32% 93%, rgba(210, 55, 100, 0.48), transparent 74%),
        radial-gradient(ellipse 14% 10% at 52% 91%, rgba(155, 28, 65, 0.5), transparent 72%),
        radial-gradient(ellipse 18% 12% at 74% 88%, rgba(220, 65, 115, 0.42), transparent 74%),
        radial-gradient(ellipse 22% 14% at 92% 86%, rgba(165, 40, 80, 0.38), transparent 76%),
        radial-gradient(ellipse 35% 22% at 50% 100%, rgba(70, 18, 40, 0.4), transparent 78%);
      animation: imm-rose-field-breathe 28s ease-in-out infinite;
      pointer-events: none;
    }
    @keyframes imm-rose-field-breathe {
      0%,
      100% {
        opacity: 0.44;
        transform: scale(1);
      }
      50% {
        opacity: 0.62;
        transform: scale(1.025);
      }
    }
    body.theme-candy.theme-warm-space .imm-mist {
      position: absolute;
      top: -8%;
      right: -8%;
      bottom: -18%;
      left: -8%;
      background:
        radial-gradient(ellipse 75% 58% at 28% 38%, rgba(157, 80, 187, 0.26), transparent 62%),
        radial-gradient(ellipse 70% 52% at 78% 32%, rgba(255, 77, 141, 0.16), transparent 58%),
        radial-gradient(ellipse 85% 48% at 50% 88%, rgba(16, 8, 24, 0.55), transparent 55%);
      -webkit-filter: blur(32px);
      filter: blur(32px);
      opacity: 0.68;
      animation: imm-mist-flow 40s ease-in-out infinite;
      pointer-events: none;
    }
    @keyframes imm-mist-flow {
      0%,
      100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.58;
      }
      35% {
        transform: translate(2.5%, -1.5%) scale(1.04);
        opacity: 0.75;
      }
      70% {
        transform: translate(-2%, 1.2%) scale(0.98);
        opacity: 0.62;
      }
    }
    body.theme-candy.theme-warm-space .imm-candle-orbs {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
      pointer-events: none;
    }
    body.theme-candy.theme-warm-space .imm-candle-dot {
      position: absolute;
      border-radius: 50%;
      background: radial-gradient(circle at 38% 32%, rgba(255, 252, 240, 0.75), rgba(255, 195, 130, 0.28) 38%, transparent 72%);
      box-shadow:
        0 0 36px rgba(255, 210, 160, 0.4),
        0 0 72px rgba(255, 130, 90, 0.15);
      opacity: 0.48;
      animation: imm-candle-dot-flicker 4.4s ease-in-out infinite;
    }
    body.theme-candy.theme-warm-space .imm-candle-dot:nth-child(1) {
      width: 88px;
      height: 88px;
      bottom: 7%;
      left: 6%;
      animation-delay: 0s;
    }
    body.theme-candy.theme-warm-space .imm-candle-dot:nth-child(2) {
      width: 64px;
      height: 64px;
      bottom: 5%;
      left: 40%;
      animation-delay: 1.2s;
    }
    body.theme-candy.theme-warm-space .imm-candle-dot:nth-child(3) {
      width: 96px;
      height: 96px;
      bottom: 9%;
      right: 10%;
      animation-delay: 0.35s;
    }
    body.theme-candy.theme-warm-space .imm-candle-dot:nth-child(4) {
      width: 52px;
      height: 52px;
      bottom: 24%;
      right: 26%;
      animation-delay: 2.1s;
    }
    @keyframes imm-candle-dot-flicker {
      0%,
      100% {
        opacity: 0.4;
        transform: scale(1);
        filter: brightness(1);
      }
      28% {
        opacity: 0.65;
        transform: scale(1.08);
        filter: brightness(1.18);
      }
      46% {
        opacity: 0.34;
        transform: scale(0.94);
        filter: brightness(0.9);
      }
      68% {
        opacity: 0.58;
        transform: scale(1.04);
        filter: brightness(1.06);
      }
    }
    body.theme-candy.theme-warm-space .imm-candle-glow {
      height: 82%;
      opacity: 1;
      background:
        radial-gradient(ellipse at 50% 100%, rgba(255, 215, 175, 0.38), transparent 54%),
        radial-gradient(ellipse at 20% 96%, rgba(255, 175, 120, 0.14), transparent 46%),
        radial-gradient(ellipse at 82% 96%, rgba(255, 200, 150, 0.16), transparent 46%);
      animation: imm-candle-flicker 5.8s ease-in-out infinite;
    }
    body.theme-candy.theme-warm-space .imm-petals {
      opacity: 0.58;
      background-image:
        radial-gradient(ellipse 11px 20px at 7% 58%, rgba(255, 85, 140, 0.58), transparent),
        radial-gradient(ellipse 13px 22px at 24% 80%, rgba(200, 45, 95, 0.5), transparent),
        radial-gradient(ellipse 9px 17px at 40% 48%, rgba(255, 130, 170, 0.52), transparent),
        radial-gradient(ellipse 12px 21px at 58% 74%, rgba(190, 40, 88, 0.45), transparent),
        radial-gradient(ellipse 10px 18px at 86% 54%, rgba(255, 77, 141, 0.52), transparent),
        radial-gradient(ellipse 8px 15px at 68% 32%, rgba(255, 200, 220, 0.32), transparent),
        radial-gradient(ellipse 9px 16px at 46% 22%, rgba(240, 120, 160, 0.28), transparent);
      animation: candy-petals-drift 120s linear infinite, candy-petals-sway 48s ease-in-out infinite;
    }
    @keyframes candy-petals-sway {
      0%,
      100% {
        transform: translateY(0) translateX(0);
      }
      50% {
        transform: translateY(-16px) translateX(8px);
      }
    }
    body.theme-candy.theme-warm-space .imm-vignette {
      background: radial-gradient(ellipse at 50% 38%, transparent 22%, rgba(6, 2, 12, 0.82) 100%);
    }
    body.theme-candy.theme-warm-space .msg-row.user .msg-bubble {
      background: linear-gradient(145deg, rgba(88, 28, 135, 0.95), rgba(157, 80, 187, 0.88), rgba(255, 77, 141, 0.55));
      box-shadow:
        0 16px 48px rgba(0, 0, 0, 0.55),
        0 0 40px rgba(196, 181, 253, 0.38),
        0 0 72px rgba(255, 77, 141, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);
    }
    body.theme-candy.theme-warm-space .msg-row.assistant .msg-bubble {
      background: linear-gradient(155deg, rgba(255, 77, 141, 0.26), rgba(196, 181, 253, 0.2), rgba(22, 14, 30, 0.55));
      border: 1px solid rgba(255, 200, 220, 0.22);
      box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.48),
        0 0 32px rgba(255, 120, 170, 0.22),
        0 0 56px rgba(157, 80, 187, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    }
    body.theme-candy.theme-warm-space .chat-peer-header,
    body.theme-candy.theme-warm-space .composer {
      background: rgba(14, 8, 22, 0.55);
      border-color: rgba(255, 182, 214, 0.12);
    }

    /* Reference photo fallbacks for avatars (text placeholder hidden when no <img>) */
    body.theme-candy.theme-warm-space #chatPeerAvatar:not(:has(img)),
    body.theme-candy.theme-warm-space #topBarNpcAvatar:not(:has(img)),
    body.theme-candy.theme-warm-space #asidePresenceAvatar:not(:has(img)),
    body.theme-candy.theme-warm-space #npcOutlineHeroInner:not(:has(img)) {
      font-size: 0;
      color: transparent;
      background-image: linear-gradient(180deg, rgba(18, 8, 28, 0.55), rgba(18, 8, 28, 0.15)), var(--ref-npc-avatar);
      background-size: cover;
      background-position: center top;
    }
    #memoryDebugPanel.memory-debug-panel--visible {
      display: block !important;
    }

    /* 图一 / 图二：左栏会话区占满 + 底部参考角图；右侧功能弹窗；三栏比例 */
    .sidebar {
      position: relative;
    }
    /*
     * 左栏布局契约（减少「叠层 / 无滚动」类问题）：
     * — aside：Flex 列 + min-height:0，子项 .candy-sidebar-scroll 占满剩余高度并负责纵向滚动或再分发给子面板。
     * — 沉浸 theme-warm-space + theme-candy 且非 UX：sidebar-layout--tabs；非激活面板 display:none !important，避免与「全局 .sidebar-tab-panel」等规则打架造成双栏同屏叠绘。
     * — 其它情况：纵向堆叠两面板，由 .sidebar-tab-panels 统一滚动。
     */
    .sidebar-panel-tabs {
      display: none;
      flex-shrink: 0;
      flex-wrap: wrap;
      gap: 6px;
      align-items: center;
      padding: 6px 2px 10px;
      margin: 0 0 2px;
      position: sticky;
      top: 0;
      z-index: 2;
      background: linear-gradient(180deg, rgba(18, 10, 26, 0.96) 70%, rgba(18, 10, 26, 0));
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    .sidebar-panel-tab {
      flex: 1 1 auto;
      min-width: 0;
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 10px;
      padding: 7px 8px;
      font: inherit;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      color: var(--text-secondary);
      background: rgba(255, 255, 255, 0.04);
    }
    .sidebar-panel-tab.is-active {
      color: #fce7f3;
      border-color: rgba(255, 77, 141, 0.45);
      background: linear-gradient(135deg, rgba(157, 80, 187, 0.28), rgba(255, 77, 141, 0.14));
    }
    .sidebar-tab-panels {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      gap: 0;
    }
    .sidebar-tab-panel {
      flex: 0 1 auto;
      min-height: 0;
      min-width: 0;
      gap: 12px;
      position: relative;
      z-index: 0;
    }
    #sidebarMain.sidebar-layout--tabs .sidebar-panel-tabs {
      display: flex;
    }
    #sidebarMain.sidebar-layout--tabs .candy-sidebar-scroll {
      overflow: hidden;
    }
    #sidebarMain.sidebar-layout--tabs .sidebar-tab-panels {
      flex: 1;
      min-height: 0;
      overflow: hidden;
    }
    #sidebarMain.sidebar-layout--tabs .sidebar-tab-panel {
      display: none !important;
      flex: 1;
      min-height: 0;
      flex-direction: column;
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
    }
    #sidebarMain.sidebar-layout--tabs .sidebar-tab-panel.is-active {
      display: flex !important;
      flex-direction: column;
    }
    #sidebarMain:not(.sidebar-layout--tabs) .sidebar-tab-panels {
      flex: 1;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
      gap: 12px;
    }
    #sidebarMain:not(.sidebar-layout--tabs) .sidebar-tab-panel {
      display: flex;
      flex-direction: column;
      flex: 0 1 auto;
      min-width: 0;
      min-height: 0;
    }
    #sidebarMain #sidebarCandySideCluster {
      display: flex;
      flex-direction: column;
      gap: 14px;
      min-width: 0;
      min-height: 0;
    }
    #sidebarMain.sidebar-main--candy-ux #sidebarPanelTools {
      display: none !important;
    }
    #sidebarMain.sidebar-main--candy-ux #sidebarPanelChat {
      display: flex !important;
      flex: 1;
      min-height: 0;
      overflow-y: auto;
    }
    .candy-sidebar-scroll {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      overscroll-behavior: contain;
    }
    .candy-sidebar-chat-zone--stack {
      flex: 1;
      min-height: 0;
      display: flex;
      flex-direction: column;
      border-top: none;
      margin-top: 0;
      padding-top: 0;
    }
    /* 开发模式（侧栏工作台 + scene/角色 全开）：会话区勿 flex:1 占满整柱，否则子项溢出会与下方 side-cluster 叠绘 */
    body.theme-candy #sidebarMain:not(.sidebar-main--candy-ux) .candy-sidebar-chat-zone--stack {
      flex: 0 1 auto;
      min-height: 0;
    }
    body.theme-candy #sidebarMain:not(.sidebar-main--candy-ux) .candy-chatted-list.candy-chatted-list--fill {
      flex: none;
      max-height: min(48vh, 480px);
    }
    .imm-space-block {
      margin: 10px 0 12px;
    }
    .imm-space-block .imm-space-title {
      margin-bottom: 8px;
    }
    .candy-chatted-list--fill {
      flex: 1 1 0;
      min-height: 0;
      overflow: auto;
    }
    .sidebar-candy-workbench {
      flex-shrink: 0;
      width: 100%;
      min-width: 0;
    }
    .sidebar-candy-side-cluster {
      flex-shrink: 0;
      width: 100%;
      min-width: 0;
      margin-top: 10px;
    }
    body.theme-candy .sidebar-candy-more-slot {
      display: none;
      flex-shrink: 0;
      margin-top: 6px;
    }
    body.theme-candy #sidebarMain.sidebar-main--candy-ux .sidebar-candy-more-slot {
      display: flex;
    }
    body.theme-candy #sidebarMain.sidebar-main--candy-ux .sidebar-candy-workbench,
    body.theme-candy #sidebarMain.sidebar-main--candy-ux .sidebar-candy-side-cluster {
      display: none !important;
    }
    body.theme-candy .btn-sidebar-candy-more {
      width: 100%;
      border: 1px solid rgba(255, 77, 141, 0.28);
      border-radius: 12px;
      padding: 8px 10px;
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      color: var(--text);
      background: linear-gradient(135deg, rgba(157, 80, 187, 0.22), rgba(255, 77, 141, 0.12));
    }
    body.theme-candy .btn-sidebar-candy-more:hover {
      border-color: rgba(255, 77, 141, 0.45);
    }
    .candy-sidebar-more-dialog.candy-sheet-dialog {
      width: min(440px, 94vw);
    }
    .candy-sidebar-more-dialog .candy-sheet-dialog__head {
      justify-content: space-between;
      gap: 12px;
    }
    .candy-sidebar-more-dialog .candy-sheet-dialog__title {
      margin: 0;
      font-size: 15px;
      font-weight: 700;
    }
    .nurture-level-dialog {
      width: min(420px, 92vw);
    }
    .affection-stage-dialog {
      width: min(480px, 92vw);
    }
    .nurture-level-dialog-body {
      padding: 2px 0 4px;
    }
    .nurture-level-dialog-body .v2-nurture-row {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      margin-top: 6px;
      font-size: 13px;
    }
    .nurture-level-dialog-body .v2-muted {
      color: var(--text-secondary);
      font-size: 12px;
    }
    .affection-stage-dialog-body {
      padding: 2px 0 4px;
    }
    .aff-stage-compact-head {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 12px;
      margin: 8px 0 10px;
      color: var(--text-secondary);
      font-size: 13px;
    }
    .aff-stage-compact-head strong {
      color: #fff7ed;
      font-size: 20px;
    }
    .aff-stage-track {
      position: relative;
      height: 46px;
      overflow: hidden;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.16);
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
    }
    .aff-stage-track-fill {
      position: absolute;
      inset: 0 auto 0 0;
      width: 0;
      min-width: 46px;
      border-radius: inherit;
      background: linear-gradient(90deg, #ff1b7a, #ff4aa2);
      box-shadow: 0 0 24px rgba(255, 27, 122, 0.32);
    }
    .aff-stage-track-text {
      position: absolute;
      inset: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0 18px;
      color: #fff;
      font-size: 14px;
      font-weight: 800;
      letter-spacing: 0.01em;
      text-align: center;
      text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
      white-space: nowrap;
    }
    .aff-stage-ticks {
      position: relative;
      height: 48px;
      margin-top: 10px;
      color: rgba(255, 255, 255, 0.46);
      font-size: 12px;
      font-weight: 700;
    }
    .aff-stage-tick {
      position: absolute;
      top: 0;
      left: var(--tick-left);
      transform: translateX(-50%);
      max-width: 72px;
      text-align: center;
      white-space: nowrap;
    }
    .aff-stage-tick::before {
      content: "";
      display: block;
      width: 1px;
      height: 8px;
      margin: 0 auto 5px;
      background: rgba(255, 255, 255, 0.25);
    }
    .aff-stage-tick:first-child {
      transform: translateX(0);
      text-align: left;
    }
    .aff-stage-tick.is-done {
      color: rgba(255, 255, 255, 0.74);
    }
    .aff-stage-tick.is-active {
      color: #fff7ed;
      text-shadow: 0 0 12px rgba(255, 27, 122, 0.32);
    }
    .candy-sidebar-more-dialog__body {
      max-height: min(72vh, 640px);
      overflow: auto;
      padding-top: 4px;
    }
    .candy-sidebar-more-dialog__body .side-section + .side-section {
      margin-top: 12px;
    }
    body.theme-candy .candy-aside-mode {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
      padding: 6px 2px 8px;
      margin: 0 -2px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }
    body.theme-candy .candy-aside-mode-label {
      font-size: 11px;
      letter-spacing: 0.02em;
    }
    body.theme-candy .candy-aside-mode-seg {
      display: inline-flex;
      border-radius: 999px;
      padding: 2px;
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid rgba(255, 255, 255, 0.08);
    }
    body.theme-candy .candy-aside-mode-btn {
      border: none;
      background: transparent;
      color: var(--text-secondary);
      font-size: 12px;
      font-weight: 600;
      padding: 5px 12px;
      border-radius: 999px;
      cursor: pointer;
      line-height: 1.2;
    }
    body.theme-candy .candy-aside-mode-btn:hover {
      color: var(--text);
    }
    body.theme-candy .candy-aside-mode-btn.is-active {
      background: linear-gradient(135deg, rgba(255, 77, 141, 0.35), rgba(160, 90, 255, 0.25));
      color: #fff;
      box-shadow: 0 0 0 1px rgba(255, 77, 141, 0.35);
    }
    body.theme-candy .candy-aside-tab-rail {
      margin: 0 -2px 0;
      padding-bottom: 4px;
      border-bottom: none;
    }
    body.theme-candy .aside-right {
      min-width: 0;
    }
    .candy-sheet-dialog,
    .candy-gallery-dialog {
      width: min(560px, 94vw);
      max-height: min(88vh, 900px);
      padding: 0;
      border: none;
      border-radius: 18px;
      background: rgba(14, 10, 20, 0.96);
      color: var(--text);
      box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    }
    .candy-gallery-dialog {
      width: min(720px, 96vw);
      max-height: min(90vh, 920px);
    }
    .candy-sheet-dialog::backdrop,
    .candy-gallery-dialog::backdrop {
      background: rgba(4, 2, 10, 0.62);
      backdrop-filter: blur(6px);
    }
    .candy-sheet-dialog__inner,
    .candy-gallery-dialog__inner {
      display: flex;
      flex-direction: column;
      max-height: inherit;
    }
    .candy-sheet-dialog__head,
    .candy-gallery-dialog__head {
      display: flex;
      align-items: center;
      justify-content: flex-end;
      padding: 8px 10px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }
    .candy-gallery-dialog__head {
      justify-content: space-between;
      gap: 12px;
    }
    .candy-gallery-dialog__title {
      margin: 0;
      font-size: 15px;
      font-weight: 700;
    }
    .candy-sheet-dialog__x,
    .candy-gallery-dialog__x {
      border: none;
      background: transparent;
      color: var(--text-secondary);
      font-size: 22px;
      line-height: 1;
      cursor: pointer;
      padding: 4px 10px;
      border-radius: 8px;
    }
    .candy-sheet-dialog__x:hover,
    .candy-gallery-dialog__x:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.06);
    }
    .candy-sheet-dialog__body,
    .candy-gallery-dialog__body {
      padding: 12px 14px 16px;
      overflow: auto;
      flex: 1;
      min-height: 0;
    }
    .candy-gallery-dialog__body .aside-tab-panel {
      display: flex !important;
      flex-direction: column;
      flex: 0 0 auto;
      min-height: 0;
    }
    .candy-gallery-dialog__body #asidePanelGallery {
      margin-bottom: 16px;
    }

    /* 养成壳验收：临时隐藏本地好感/关系/图库 v2 等易与 Partner 养成混淆的入口 */
    body.nurture-shell-focus .non-nurture-ui {
      display: none !important;
    }
    body.nurture-shell-focus .nurture-shell-only {
      display: block !important;
    }
    body:not(.nurture-shell-focus) .nurture-shell-only {
      display: none !important;
    }
    body.nurture-shell-focus .partner-nurture-aside-stats {
      margin: 10px 0 12px;
      padding: 10px 12px;
      border-radius: 12px;
      border: 1px solid rgba(244, 114, 182, 0.22);
      background: rgba(15, 10, 22, 0.45);
      font-size: 12px;
    }
    body.nurture-shell-focus .partner-nurture-aside-row {
      display: flex;
      justify-content: space-between;
      gap: 10px;
      margin-top: 4px;
    }
    body.nurture-shell-focus .partner-nurture-aside-row:first-child {
      margin-top: 0;
    }
    body.nurture-shell-focus .partner-nurture-aside-row strong {
      color: var(--text-primary);
      font-size: 14px;
    }
    body.nurture-shell-focus .imm-presence-hero {
      cursor: default;
    }
    body.nurture-shell-focus #asideTabGifts.aside-tab {
      display: inline-flex !important;
    }
    body.nurture-shell-focus .chat-peer-header {
      align-items: center;
    }
