/* warm iOS-style UI layer. Existing DOM ids and feature styles remain intact. */
:root {
  --ui-bg: #f2f2f7;
  --ui-surface: rgba(255,255,255,.86);
  --ui-text: #1d1d1f;
  --ui-muted: #8e8e93;
  --ui-line: rgba(60,60,67,.16);
  --ui-blue: #007aff;
  --ui-radius-xl: 24px;
  --ui-radius-lg: 18px;
  --ui-radius-md: 14px;
  --ui-shadow: 0 12px 34px rgba(31,31,40,.08);
  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
}

/* 日记页：把关系记录做成轻量 iOS Journal 流，不改变原有写入/回复逻辑。 */
.diary-view, #view-diary { max-width: 760px; padding: 28px 24px 40px; }
#view-diary > .view-title { margin-bottom: 14px; font-size: 30px; font-weight: 700; letter-spacing: -.05em; }
#view-diary .diary-summary { margin-bottom: 14px; padding: 16px 18px; border: 1px solid rgba(255,255,255,.14); border-radius: 20px; background: linear-gradient(145deg, rgba(255,255,255,.14), rgba(255,255,255,.06)); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); backdrop-filter: blur(18px); }
#view-diary .sch-summary-text { color: var(--ui-muted); line-height: 1.7; }
#view-diary .diary-write-btn { min-height: 40px; margin-bottom: 14px; padding: 9px 15px; border: 1px solid rgba(0,122,255,.2); border-radius: 999px; background: rgba(0,122,255,.1); color: var(--ui-blue); }
#view-diary #diaryList { display: grid; gap: 10px; margin-top: 0; }
#view-diary .diary-entry { margin: 0; padding: 16px 17px; border: 1px solid rgba(255,255,255,.13); border-radius: 20px; background: linear-gradient(145deg, rgba(255,255,255,.13), rgba(255,255,255,.055)); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 8px 22px rgba(0,0,0,.08); backdrop-filter: blur(18px); }
#view-diary .diary-entry-author { color: var(--ui-blue); font-weight: 650; }
#view-diary .diary-entry-body { color: var(--ui-text); line-height: 1.75; }
#view-diary .diary-entry-replies { border-top-color: rgba(255,255,255,.12); }
@media (max-width: 768px) {
  #view-diary { max-width: none; padding: 16px 14px calc(90px + env(safe-area-inset-bottom, 0px)); }
  #view-diary > .view-title { font-size: 28px; }
  #view-diary .diary-entry { border-radius: 18px; padding: 14px; }
}

/* Warm music cards/player: frontend-owned UI for authorized music services. */
.warm-music-card {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 340px;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid rgba(125, 125, 135, .18);
  border-radius: 14px;
  background: rgba(255, 255, 255, .12);
}
.warm-music-cover, .warm-music-player-cover {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 10px;
  object-fit: cover;
  background: rgba(125, 125, 135, .16);
}
.warm-music-copy, .warm-music-player-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  flex: 1;
}
.warm-music-copy strong, .warm-music-player-copy strong {
  overflow: hidden;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.warm-music-copy span, .warm-music-player-copy span {
  overflow: hidden;
  color: var(--text-secondary);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.warm-music-copy small { color: var(--text-dim); font-size: 10px; }
.warm-music-play, .warm-music-player button {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent, #c49b50);
  color: #fff;
  cursor: pointer;
}
.warm-music-play:hover, .warm-music-player button:hover { filter: brightness(1.08); }
.warm-music-player {
  position: fixed;
  z-index: 1200;
  right: 22px;
  bottom: calc(var(--chat-input-bottom, 0px) + 18px);
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(340px, calc(100vw - 32px));
  padding: 10px;
  border: 1px solid rgba(125, 125, 135, .22);
  border-radius: 17px;
  background: color-mix(in srgb, var(--glass-bg, #fff) 88%, transparent);
  box-shadow: 0 12px 35px rgba(0, 0, 0, .18);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.warm-music-player[hidden] { display: none; }
.warm-music-player > button:last-child { width: 24px; height: 24px; flex-basis: 24px; background: transparent; color: var(--text-dim); font-size: 18px; }
.music-moment-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 8px 0 14px;
  padding: 22px 24px;
  border: 1px solid rgba(141, 112, 55, .18);
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 250, 229, .92), rgba(246, 237, 215, .76));
  box-shadow: 0 14px 32px rgba(83, 63, 21, .08);
}
.music-moment-disc {
  display: grid;
  flex: 0 0 66px;
  width: 66px;
  height: 66px;
  place-items: center;
  border: 7px solid rgba(255, 255, 255, .76);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 12%, #c29d50 13% 19%, #28231e 20% 58%, #8e6e32 59% 100%);
  color: #fff;
  font-size: 28px;
  box-shadow: 0 6px 14px rgba(63, 44, 11, .2);
}
.music-moment-kicker { color: #977332; font-size: 10px; letter-spacing: .16em; }
.music-moment-hero h2 { margin: 5px 0 5px; color: #3d3427; font-size: 22px; }
.music-moment-hero p { margin: 0; color: #766b5b; font-size: 12px; line-height: 1.6; }
.music-moment-guide { margin-top: 14px; }
.music-moment-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.music-moment-steps > div { display: grid; gap: 4px; padding: 13px; border: 1px solid rgba(141, 112, 55, .12); border-radius: 15px; background: rgba(255, 255, 255, .48); }
.music-moment-steps span { display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; background: #bd984d; color: #fff; font-size: 11px; }
.music-moment-steps strong { color: var(--text, #38342f); font-size: 13px; }
.music-moment-steps small { color: var(--text-dim); font-size: 11px; line-height: 1.45; }
.music-account-status { display: flex; align-items: center; min-height: 42px; padding: 0 12px; color: var(--text-dim); font-size: 13px; }
.music-account-status::before { content: ""; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: #b9b2a4; }
.music-account-status.is-ready { color: #6f613f; }
.music-account-status.is-ready::before { background: #bd984d; box-shadow: 0 0 0 4px rgba(189, 152, 77, .14); }
.music-account-status.is-unready { color: var(--text-dim); }
.music-account-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 0 12px 10px; }
.music-connect-btn[aria-disabled="true"] { pointer-events: none; opacity: .5; }
.music-disconnect-btn { color: var(--danger, #e55); }
.music-advanced-config { margin: 4px 12px 0; color: var(--text-dim); font-size: 11px; }
.music-qr-panel { display:flex; align-items:center; gap:14px; margin:12px 0 4px; padding:12px; border:1px solid var(--border); border-radius:12px; background:var(--glass-bg); }
.music-qr-image-wrap { width:156px; height:156px; display:flex; align-items:center; justify-content:center; background:#fff; border-radius:8px; overflow:hidden; }
.music-qr-image-wrap img { width:148px; height:148px; object-fit:contain; }
.music-qr-copy { display:flex; flex-direction:column; gap:8px; font-size:12px; color:var(--text-dim); }
.music-qr-copy strong { color:var(--text); font-size:14px; }
@media (max-width: 600px) { .music-qr-panel { align-items:flex-start; } .music-qr-image-wrap { width:128px; height:128px; } .music-qr-image-wrap img { width:122px; height:122px; } }
.music-advanced-config summary { padding: 8px 0; cursor: pointer; user-select: none; }
.music-advanced-config .s-item { padding-left: 0; padding-right: 0; }
.music-search-group { margin-top: 14px; }
.music-search-bar { display: flex; gap: 8px; align-items: center; padding: 0 12px; }
.music-search-bar .settings-input { min-width: 0; flex: 1; }
.music-search-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 0 12px 10px; }
.music-search-results:empty { display: none; }
/* REQ-20260906-001 音乐时刻 × MCP：音源卡 / tab / 歌词 / 完整播放条 */
.music-source-card { margin-top: 14px; }
.music-cookie-section { margin-top: 10px; padding: 10px 12px 0; border-top: 1px dashed rgba(141, 112, 55, .18); }
.music-cookie-section .settings-input { margin-top: 6px; font-family: ui-monospace, monospace; font-size: 11px; }
.music-cookie-section .music-account-status { min-height: 34px; font-size: 12px; }
.music-source-caps { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; }
.music-cap-badge { padding: 3px 10px; border: 1px solid rgba(189, 152, 77, .38); border-radius: 999px; background: rgba(189, 152, 77, .1); color: #8a6d2f; font-size: 11px; }
.music-tabs { display: flex; gap: 6px; padding: 10px 12px 0; }
.music-tab { padding: 6px 14px; border: 1px solid var(--border, rgba(125,125,135,.2)); border-radius: 999px; background: transparent; color: var(--text-secondary, #777); font-size: 12px; cursor: pointer; }
.music-tab.is-active { border-color: rgba(189, 152, 77, .55); background: rgba(189, 152, 77, .12); color: #8a6d2f; font-weight: 600; }
.music-tab:disabled { opacity: .55; cursor: wait; }
.music-lyrics { max-height: 260px; overflow-y: auto; padding: 4px 12px 12px; display: grid; gap: 8px; }
.music-lyric-line { color: var(--text-dim); font-size: 13px; line-height: 1.55; transition: color .25s ease, transform .25s ease; transform-origin: left center; }
.music-lyric-line.is-active { color: #8a6d2f; font-weight: 650; transform: scale(1.02); }
.warm-music-player { width: min(430px, calc(100vw - 32px)); flex-wrap: wrap; }
.warm-music-fee-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 9px; font-weight: 600; vertical-align: 1px; }
.warm-music-fee-tag.is-vip { border: 1px solid rgba(189, 152, 77, .55); background: rgba(189, 152, 77, .12); color: #8a6d2f; }
.warm-music-fee-tag.is-free { border: 1px solid rgba(96, 150, 90, .45); background: rgba(96, 150, 90, .1); color: #4c7a46; }
/* ===== 全屏正在播放 ===== */
#warmMusicNowPlaying { position: fixed; inset: 0; z-index: 1300; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px calc(env(safe-area-inset-bottom, 0px) + 24px); background: var(--bg, #f5f4f0); overflow-y: auto; }
#warmMusicNowPlaying[hidden] { display: none; }
.np-header { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 480px; }
.np-collapse { border: 0; background: transparent; font-size: 20px; color: var(--text, #38342f); cursor: pointer; padding: 4px 8px; }
.np-header-spacer { width: 36px; }
.np-disc { position: relative; width: min(78vw, 320px); aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; background: repeating-radial-gradient(circle at 50% 50%, #16161a 0 2px, #222227 2px 3px, #16161a 3px 6px); box-shadow: 0 18px 40px rgba(0, 0, 0, .3), inset 0 0 60px rgba(255, 255, 255, .04); animation: np-spin 14s linear infinite; animation-play-state: paused; }
.np-disc.is-playing { animation-play-state: running; }
.np-disc img { width: 58%; aspect-ratio: 1; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 4px rgba(0, 0, 0, .55); }
.np-disc .np-cover-fallback { position: absolute; font-size: 56px; color: rgba(255, 255, 255, .85); }
.np-disc-hole { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--bg, #f5f4f0); box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6); }
@keyframes np-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .np-disc { animation: none; } }
.np-title { margin: 6px 0 0; font-size: 24px; font-weight: 700; color: var(--text, #38342f); text-align: center; }
.np-artist { margin: 0; color: var(--text-secondary, #6f6a60); font-size: 15px; }
.np-album { margin: 0; color: var(--text-dim, #9a948a); font-size: 12px; }
.np-lyric { margin: 2px 0 0; min-height: 22px; max-width: 480px; text-align: center; color: var(--text-secondary, #6f6a60); font-size: 15px; line-height: 1.5; }
.np-lyric-swap { animation: np-lyric-fade .35s ease; }
@keyframes np-lyric-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.np-times { display: flex; justify-content: space-between; width: 100%; max-width: 480px; color: var(--text-dim); font-size: 11px; }
.np-progress { width: 100%; max-width: 480px; height: 6px; border-radius: 3px; background: rgba(125, 125, 135, .38); cursor: pointer; }
.np-progress-fill { height: 100%; width: 0; border-radius: 3px; background: var(--accent, #c49b50); }
.np-controls { display: flex; align-items: center; gap: 22px; }
.np-controls button { border: 0; background: transparent; font-size: 20px; color: var(--text, #38342f); cursor: pointer; padding: 6px; }
.np-controls button.is-on { color: var(--accent, #c49b50); }
.np-controls .np-play { width: 64px; height: 64px; border-radius: 50%; background: var(--accent, #c49b50); color: #fff; font-size: 22px; }
.np-queue { width: 100%; max-width: 480px; }
.np-queue h3 { margin: 0 0 8px; font-size: 14px; color: var(--text, #38342f); }
.np-queue-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid rgba(125, 125, 135, .18); border-radius: 12px; cursor: pointer; }
.np-queue-item.is-current { border-color: var(--accent, #c49b50); background: rgba(189, 152, 77, .08); }
.np-queue-copy { display: grid; gap: 2px; min-width: 0; }
.np-queue-copy strong { font-size: 13px; color: var(--text, #38342f); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-queue-copy span { font-size: 11px; color: var(--text-dim); }
.np-queue-duration { color: var(--text-dim); font-size: 11px; flex: none; }
.np-queue-empty { color: var(--text-dim); font-size: 12px; text-align: center; padding: 12px 0; }
@media (max-width: 600px) {
  .warm-music-player { left: 12px; right: 12px; width: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); }
  .warm-music-player-progress, .warm-music-player-time { display: none; }
  .warm-music-player-controls input[data-music-player-volume] { display: none; }
  .warm-music-player-controls button[data-music-player-prev] { display: none; }
  .np-cover { width: min(86vw, 320px); }
}
.warm-music-player-copy { flex: 1 1 130px; min-width: 130px; }
.warm-music-player-progress { display: grid; gap: 4px; flex: 1 1 100%; order: 5; cursor: pointer; }
.warm-music-player-progress-track { height: 4px; border-radius: 2px; background: rgba(125, 125, 135, .38); overflow: hidden; }
.warm-music-player-progress-fill { width: 0; height: 100%; border-radius: 2px; background: var(--accent, #c49b50); transition: width .15s linear; }
.warm-music-player-time { display: flex; justify-content: space-between; color: var(--text-dim); font-size: 10px; }
.warm-music-player-controls { display: flex; align-items: center; gap: 6px; }
.warm-music-player-controls input[type="range"] { width: 68px; accent-color: var(--accent, #c49b50); }
@media (max-width: 600px) {
  .warm-music-player { right: 12px; }
}
@media (max-width: 768px) {
  .music-search-results { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .music-moment-hero { align-items: flex-start; padding: 18px; }
  .music-moment-disc { flex-basis: 54px; width: 54px; height: 54px; font-size: 22px; }
  .music-moment-hero h2 { font-size: 19px; }
  .music-moment-steps { grid-template-columns: 1fr; }
  .music-moment-steps > div { grid-template-columns: auto 1fr; align-items: center; column-gap: 9px; }
  .music-moment-steps small { grid-column: 2; }
}
@media (max-width: 768px) {
  .warm-music-player { right: 12px; bottom: calc(var(--chat-bottom-gap, 140px) + 10px); }
}

/* 首页参考风格：浅色 iOS 18 仪表盘。自定义壁纸时仍沿用壁纸与蒙层。 */
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) {
  min-height: max(720px, calc(100dvh - 8px));
  border-radius: 0;
  background: linear-gradient(180deg, #f5f5f7 0%, #e5e5ea 100%);
  color: #1c1c1e;
  box-shadow: none;
}
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper)::before,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper)::after { display: none; }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-statusbar { color: #1c1c1e; text-shadow: none; }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-title-block { display: none; }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-hero-top { justify-content: center; padding: 58px 24px 0; }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-hero-tools { justify-content: center; }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-wallpaper-button { display: none; }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .ls-rel-pill {
  min-width: 178px;
  min-height: 42px;
  justify-content: center;
  border: 1px solid rgba(255,255,255,.72);
  background: rgba(255,255,255,.48);
  color: #3a3a3c;
  box-shadow: 0 8px 24px rgba(31,31,40,.08), inset 0 1px 0 rgba(255,255,255,.8);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
}
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-ios-grid {
  width: min(100%, 430px);
  box-sizing: border-box;
  margin: 0 auto;
  padding: 18px 24px calc(28px + env(safe-area-inset-bottom, 0px));
  color: #1c1c1e;
}
.main:has(> .content > #view-home.active) .home-calendar-widget {
  min-height: 176px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 28px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 8px 28px rgba(31,31,40,.06), inset 0 1px 0 #fff;
  backdrop-filter: blur(20px) saturate(1.35);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
}
.main:has(> .content > #view-home.active) .home-calendar-date strong { font-size: 66px; color: #111; }
.main:has(> .content > #view-home.active) .home-calendar-month > b { color: #ff3b30; }
.main:has(> .content > #view-home.active) .home-calendar-schedule { color: #6e6e73; font-size: 19px; }
.main:has(> .content > #view-home.active) .home-weather-widget,
.main:has(> .content > #view-home.active) .home-square-widget,
.main:has(> .content > #view-home.active) .home-app-tile,
.main:has(> .content > #view-home.active) .home-photo-large,
.main:has(> .content > #view-home.active) .home-search-pill,
.main:has(> .content > #view-home.active) .home-ios-dock {
  border-color: rgba(255,255,255,.8);
  box-shadow: 0 7px 20px rgba(31,31,40,.07), inset 0 1px 0 rgba(255,255,255,.9);
}
.main:has(> .content > #view-home.active) .home-weather-widget {
  min-height: 154px;
  border-radius: 28px;
  background: linear-gradient(145deg, #667b8b, #293b4b);
  color: #fff;
}
.main:has(> .content > #view-home.active) .home-square-widget,
.main:has(> .content > #view-home.active) .home-app-tile {
  border-radius: 18px;
  background: rgba(255,255,255,.64);
  color: #3a3a3c;
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
}
.main:has(> .content > #view-home.active) .home-square-widget svg { color: #636366; }
.main:has(> .content > #view-home.active) .home-photo-large {
  border-radius: 28px;
  background: rgba(255,255,255,.56);
}
.main:has(> .content > #view-home.active) .home-app-glyph { border-radius: 18px; box-shadow: inset 0 1px 0 rgba(255,255,255,.65), 0 2px 8px rgba(0,0,0,.08); }
.main:has(> .content > #view-home.active) .home-search-pill {
  color: #636366;
  background: rgba(255,255,255,.52);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.main:has(> .content > #view-home.active) .home-ios-dock {
  border-radius: 28px;
  background: rgba(255,255,255,.48);
  backdrop-filter: blur(22px) saturate(1.45);
  -webkit-backdrop-filter: blur(22px) saturate(1.45);
}
.main:has(> .content > #view-home.active) .home-ios-dock button { background: rgba(255,255,255,.46); color: #636366; }
.main:has(> .content > #view-home.active) .home-ios-dock span { display: none; }
.main:has(> .content > #view-home.active) .home-apps { display: none; }

@media (max-width: 768px) {
  .main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-hero-top { padding-top: 54px; }
  .main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-ios-grid { padding-left: 18px; padding-right: 18px; }
  .main:has(> .content > #view-home.active) .home-calendar-widget { padding: 18px; }
}

/* 首页参考图最终版：以 iScreen 深色玻璃组件桌面为主视觉。 */
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) {
  background: linear-gradient(145deg, #687887 0%, #394755 48%, #18232e 100%);
  color: #fff;
}
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper)::before {
  display: block;
  z-index: -1;
  background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 72px 72px;
  opacity: .25;
}
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper)::after { display: block; background: linear-gradient(180deg, rgba(0,0,0,.08), transparent 42%, rgba(0,0,0,.42)); }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-statusbar { color: #fff; text-shadow: 0 1px 5px rgba(0,0,0,.28); }
.main:has(> .content > #view-home.active) .home-hero-top { display: none; }
.main:has(> .content > #view-home.active) .home-ios-grid { display: none; }
.main:has(> .content > #view-home.active) .home-apps { display: none; }
.main:has(> .content > #view-home.active) .home-iscreen-widgets {
  display: grid;
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 28px calc(26px + env(safe-area-inset-bottom, 0px));
  color: #fff;
}
.main:has(> .content > #view-home.active) .home-social-widget,
.main:has(> .content > #view-home.active) .home-photo-widget,
.main:has(> .content > #view-home.active) .home-relationship-widget,
.main:has(> .content > #view-home.active) .home-small-widget,
.main:has(> .content > #view-home.active) .home-iscreen-dock {
  border-color: rgba(255,255,255,.38);
  background: rgba(255,255,255,.22);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.38), 0 14px 34px rgba(0,0,0,.16);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
}
.main:has(> .content > #view-home.active) .home-social-widget { min-height: 188px; padding: 22px 24px 16px; border-radius: 30px; }
.main:has(> .content > #view-home.active) .home-social-copy strong { font-size: 21px; }
.main:has(> .content > #view-home.active) .home-social-copy span { font-size: 14px; color: rgba(255,255,255,.82); }
.main:has(> .content > #view-home.active) .home-social-share { margin: 18px 0 14px; color: rgba(255,255,255,.82); font-size: 14px; }
.main:has(> .content > #view-home.active) .home-widget-now { min-height: 48px; border-color: rgba(255,255,255,.32); background: rgba(255,255,255,.18); }
.main:has(> .content > #view-home.active) .home-widget-pair { gap: 14px; }
.main:has(> .content > #view-home.active) .home-photo-widget,
.main:has(> .content > #view-home.active) .home-relationship-widget { min-height: 220px; border-radius: 30px; }
.main:has(> .content > #view-home.active) .home-small-widgets { gap: 12px; }
.main:has(> .content > #view-home.active) .home-small-widget { min-height: 122px; border-radius: 24px; }
.main:has(> .content > #view-home.active) .home-small-icon { width: 58px; height: 58px; border-radius: 18px; background: rgba(255,255,255,.2); }
.main:has(> .content > #view-home.active) .home-iscreen-dock { margin-top: 8px; padding: 12px; border-radius: 30px; background: rgba(18,24,31,.48); }
.main:has(> .content > #view-home.active) .home-iscreen-dock button { min-height: 72px; border-radius: 21px; background: rgba(255,255,255,.12); }

@media (max-width: 768px) {
  .main:has(> .content > #view-home.active) .home-iscreen-widgets { padding: 42px 18px calc(22px + env(safe-area-inset-bottom, 0px)); }
  .main:has(> .content > #view-home.active) .home-social-widget { min-height: 164px; padding: 17px 16px 13px; border-radius: 25px; }
  .main:has(> .content > #view-home.active) .home-social-copy strong { font-size: 18px; }
  .main:has(> .content > #view-home.active) .home-social-share { margin: 12px 0 10px; font-size: 12px; }
  .main:has(> .content > #view-home.active) .home-photo-widget,
  .main:has(> .content > #view-home.active) .home-relationship-widget { min-height: 166px; border-radius: 24px; }
  .main:has(> .content > #view-home.active) .home-small-widget { min-height: 100px; border-radius: 19px; }
  .main:has(> .content > #view-home.active) .home-small-icon { width: 46px; height: 46px; border-radius: 15px; }
  .main:has(> .content > #view-home.active) .home-iscreen-dock { border-radius: 24px; }
  .main:has(> .content > #view-home.active) .home-iscreen-dock button { min-height: 58px; border-radius: 17px; }
}

/* iScreen 主屏第一屏：关系组件、生活组件与 Dock。旧 hero-grid 继续保留给数据刷新兼容。 */
.main:has(> .content > #view-home.active) .home-hero.lockscreen {
  min-height: max(720px, calc(100dvh - 8px));
  border-radius: 0;
  box-shadow: none;
}
.main:has(> .content > #view-home.active) .home-hero-grid { display: none; }
.main:has(> .content > #view-home.active) .home-hero-top { padding-top: 10px; }
.main:has(> .content > #view-home.active) .home-title-block .ls-time { display: none; }
.main:has(> .content > #view-home.active) .home-kicker { font-size: 13px; font-weight: 650; letter-spacing: .14em; }
.main:has(> .content > #view-home.active) .ls-rel-pill { padding: 8px 12px; font-size: 12px; }
.main:has(> .content > #view-home.active) .home-iscreen-widgets { padding-top: 12px; }
.home-iscreen-widgets { display: grid; gap: 12px; padding: 24px 28px 20px; color: #fff; }
.home-social-widget, .home-photo-widget, .home-relationship-widget, .home-small-widget, .home-iscreen-dock {
  border: 1px solid rgba(255,255,255,.28);
  background: linear-gradient(145deg, rgba(255,255,255,.28), rgba(255,255,255,.12));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 12px 30px rgba(0,0,0,.13);
  backdrop-filter: blur(24px) saturate(1.18);
  -webkit-backdrop-filter: blur(24px) saturate(1.18);
}
.home-social-widget { min-height: 156px; padding: 18px 20px 14px; border-radius: 29px; }
.home-social-head { display: flex; align-items: center; gap: 13px; }
.home-widget-avatar { width: 58px; height: 58px; flex: 0 0 auto; overflow: hidden; border: 2px solid rgba(255,255,255,.72); border-radius: 50%; background: rgba(255,255,255,.22); }
.home-widget-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.home-social-copy { display: grid; gap: 4px; min-width: 0; }
.home-social-copy strong { font-size: 19px; letter-spacing: -.03em; }
.home-social-copy span, .home-social-share { color: rgba(255,255,255,.78); font-size: 13px; }
.home-social-badge { margin-left: auto; color: #ffb6ca; font-size: 22px; }
.home-social-share { margin: 14px 0 12px 2px; letter-spacing: .04em; }
.home-widget-now { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 0 13px; border-radius: 999px; background: rgba(255,255,255,.2); }
.home-now-icon { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; background: rgba(255,255,255,.78); color: #566170; font-size: 16px; }
.home-widget-now strong { overflow: hidden; flex: 1; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.home-widget-now time { color: rgba(255,255,255,.76); font-size: 12px; font-variant-numeric: tabular-nums; }
.home-widget-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.home-photo-widget, .home-relationship-widget { position: relative; min-height: 178px; padding: 16px; overflow: hidden; border-radius: 27px; color: #fff; text-align: left; }
.home-photo-widget { display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(145deg, rgba(255,255,255,.25), rgba(255,255,255,.08)); }
.home-photo-placeholder { position: absolute; inset: 0; overflow: hidden; background: radial-gradient(circle at 65% 28%, rgba(255,255,255,.38), transparent 34%), linear-gradient(145deg, rgba(92,113,128,.45), rgba(34,39,48,.22)); }
.home-photo-placeholder::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(15,20,28,.42)); pointer-events: none; }
.home-photo-placeholder img { width: 100%; height: 100%; object-fit: cover; opacity: .82; filter: saturate(.78) contrast(.95); }
.home-widget-corner { position: absolute; z-index: 1; top: 12px; left: 14px; font-size: 21px; }
.home-photo-meta { position: relative; z-index: 1; display: grid; gap: 5px; padding: 9px 10px; border-radius: 15px; background: rgba(0,0,0,.18); }
.home-photo-meta b { font-size: 14px; }
.home-photo-meta small { overflow: hidden; color: rgba(255,255,255,.72); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.home-relationship-widget { display: flex; align-items: flex-start; gap: 11px; }
.home-widget-avatar-large { width: 73px; height: 73px; }
.home-rel-copy { display: grid; gap: 8px; padding-top: 6px; }
.home-rel-copy strong { font-size: 20px; font-weight: 500; }
.home-rel-copy span { color: rgba(255,255,255,.78); font-size: 13px; }
.home-rel-copy b { color: #f5c47f; }
.home-rel-copy small { color: rgba(255,255,255,.68); font-size: 11px; }
.home-rel-spark { position: absolute; right: 18px; bottom: 18px; color: #ffd6e0; font-size: 30px; }
.home-small-widgets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.home-small-widget { display: grid; min-height: 105px; place-items: center; align-content: center; gap: 5px; padding: 9px 4px; border-radius: 20px; color: #fff; cursor: pointer; }
.home-small-widget:hover, .home-iscreen-dock button:hover { background: rgba(255,255,255,.24); }
.home-small-icon { display: grid; width: 52px; height: 52px; place-items: center; border: 1px solid rgba(255,255,255,.32); border-radius: 17px; background: rgba(255,255,255,.2); font-size: 27px; }
.home-small-svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 5px rgba(0,0,0,.18)); }
.home-clock-icon { font-variant-numeric: tabular-nums; }
.home-small-widget b { font-size: 12px; }
.home-small-widget small { overflow: hidden; max-width: 100%; color: rgba(255,255,255,.66); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.home-iscreen-dock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 2px; padding: 9px; border-radius: 27px; background: rgba(19,23,31,.42); }
.home-iscreen-dock button { display: grid; min-height: 62px; place-items: center; gap: 4px; border: 0; border-radius: 18px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.9); cursor: pointer; }
.home-iscreen-dock svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.home-iscreen-dock span { font-size: 10px; }
.main:has(> .content > #view-home.active) > .content .home-dock { display: none; }

@media (max-width: 768px) {
  .main:has(> .content > #view-home.active) .home-hero.lockscreen { min-height: calc(100dvh - 62px); }
  .main:has(> .content > #view-home.active) .home-hero-top { padding-top: 8px; }
  .main:has(> .content > #view-home.active) .home-statusbar { padding-top: 8px; }
  .home-iscreen-widgets { gap: 10px; padding: 10px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .home-social-widget { min-height: 142px; padding: 15px 16px 12px; border-radius: 24px; }
  .home-widget-avatar { width: 51px; height: 51px; }
  .home-social-copy strong { font-size: 17px; }
  .home-social-share { margin: 11px 0 9px; font-size: 12px; }
  .home-widget-pair { gap: 9px; }
  .home-photo-widget, .home-relationship-widget { min-height: 151px; padding: 12px; border-radius: 23px; }
  .home-widget-avatar-large { width: 57px; height: 57px; }
  .home-rel-copy { gap: 5px; padding-top: 2px; }
  .home-rel-copy strong { font-size: 16px; }
  .home-small-widgets { gap: 7px; }
  .home-small-widget { min-height: 91px; border-radius: 17px; }
  .home-small-icon { width: 43px; height: 43px; border-radius: 14px; font-size: 22px; }
  .home-iscreen-dock { border-radius: 23px; }
  .home-iscreen-dock button { min-height: 53px; border-radius: 15px; }
}

html[data-theme="dark"] {
  --ui-bg: #000;
  --ui-surface: rgba(28,28,30,.92);
  --ui-text: #f5f5f7;
  --ui-muted: #98989d;
  --ui-line: rgba(84,84,88,.55);
  --ui-blue: #0a84ff;
  --ui-shadow: 0 12px 34px rgba(0,0,0,.28);
}

html, body { font-family: var(--ui-font) !important; background: var(--ui-bg); color: var(--ui-text); }
button, input, textarea, select { font-family: inherit; }
.app, .content { background: var(--ui-bg); }
.sidebar { background: rgba(250,250,252,.84); border-color: var(--ui-line); box-shadow: 8px 0 28px rgba(30,30,40,.04); }
.sidebar-nav { gap: 4px; }
.nav-item { border-radius: 12px; color: #6e6e73; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-item:hover { background: rgba(0,122,255,.07); color: var(--ui-blue); }
.nav-item.active { background: rgba(0,122,255,.11); color: var(--ui-blue); font-weight: 600; }
a.nav-item { text-decoration: none; }
.nav-item svg { stroke: currentColor; }
.home-view, .sch-view, .settings-view { max-width: 1180px; margin: 0 auto; width: 100%; }
.home-shell { gap: 20px; }
.home-hero { border: 1px solid var(--ui-line); border-radius: var(--ui-radius-xl); background: linear-gradient(145deg, #fff 0%, #eef4ff 100%); box-shadow: var(--ui-shadow); }
.home-hero-top { padding: 26px 28px 0; }
.ls-clock { color: var(--ui-text); font-weight: 650; letter-spacing: -.055em; }
.ls-rel-pill { border: 1px solid rgba(0,122,255,.16); background: rgba(255,255,255,.72); color: var(--ui-blue); }
.home-hero-grid { padding: 18px 28px 28px; }
.home-hero-figure { border-radius: 20px; background: linear-gradient(145deg, #eaf1ff, #fff); }
.home-actions { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.home-action-card { min-height: 104px; border: 1px solid var(--ui-line); border-radius: var(--ui-radius-lg); background: var(--ui-surface); box-shadow: 0 5px 20px rgba(30,30,40,.04); }
.home-action-card:hover { transform: translateY(-2px); box-shadow: var(--ui-shadow); }
.home-panel-card, .glass { border-color: var(--ui-line); box-shadow: 0 5px 20px rgba(30,30,40,.035); }
.rel-card, .home-memory-panel, .home-schedule-panel, .food-section, .anniversary-card { border-radius: var(--ui-radius-lg); }
.section-link, .model-text-btn { color: var(--ui-blue); }
.settings-profile, .s-group { border-color: var(--ui-line); background: var(--ui-surface); box-shadow: 0 5px 20px rgba(30,30,40,.035); }
.s-group { border-radius: var(--ui-radius-lg); }
.s-label { color: var(--ui-text); font-weight: 650; }
.settings-input, .settings-textarea, .settings-select { border-color: var(--ui-line); border-radius: 11px; background: rgba(255,255,255,.9); }
.settings-mini-btn, .sch-add-btn, .moments-btn { border-radius: 999px; border-color: rgba(0,122,255,.18); background: rgba(0,122,255,.09); color: var(--ui-blue); }
.role-advanced-details { margin: 8px 0; border: 1px solid var(--ui-line); border-radius: 14px; background: rgba(255,255,255,.05); overflow: hidden; }
.role-advanced-details summary { padding: 12px 14px; color: var(--ui-muted); font-size: 12px; font-weight: 650; cursor: pointer; list-style-position: inside; }
.role-advanced-details[open] summary { color: var(--ui-blue); border-bottom: 1px solid var(--ui-line); }
.role-advanced-details .s-item { padding-left: 14px; padding-right: 14px; }
.btn-glow { border-radius: 999px; background: var(--ui-blue); box-shadow: 0 8px 20px rgba(0,122,255,.22); }
.mobile-more-toggle, .mobile-more-panel { display: none; }

/* 核心聊天：让内容成为视觉中心，操作退到轻量层。 */
.chat-header { min-height: 54px; padding: 10px 4px; border-bottom: 1px solid var(--ui-line); }
.chat-header-info { gap: 10px; }
.chat-header-avatar { width: 38px; height: 38px; border: 0; box-shadow: 0 0 0 2px var(--ui-surface-solid, #fff), 0 0 0 3px rgba(0,122,255,.18); }
.chat-header-name-row > div { font-size: 16px !important; font-weight: 650 !important; letter-spacing: -.02em; }
.chat-header-info > div > div:nth-child(2) { color: var(--ui-green) !important; letter-spacing: .04em !important; font-size: 10px !important; }
.chat-header-mood { color: var(--ui-muted); font-size: 11px; }
.chat-header-actions { align-items: center; gap: 8px; }
.chat-header-btn { padding: 7px 10px; border: 1px solid var(--ui-line); border-radius: 999px; color: var(--ui-blue); background: var(--ui-surface); }
.rel-capsule { border: 1px solid var(--ui-line); background: var(--ui-surface); border-radius: 999px; }
.chat-msgs { padding: 20px 8px 32px; gap: 14px; }
.chat-bubble-warm, .chat-bubble-user { max-width: min(680px, 86%); }
.chat-bubble-warm .glass, .chat-bubble-user .user-bubble { border: 1px solid var(--ui-line); border-radius: 20px; box-shadow: 0 3px 12px rgba(0,0,0,.04); }
.chat-bubble-user .user-bubble { background: var(--ui-blue); color: #fff; border: 0; border-radius: 20px 20px 6px 20px; }
.chat-bubble-warm .glass { border-radius: 20px 20px 20px 6px; background: var(--ui-surface); }
.chat-input-bar { margin: 8px 0 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); border: 1px solid var(--ui-line); border-radius: 18px 18px 0 0; background: var(--ui-surface); box-shadow: 0 -8px 24px rgba(0,0,0,.06); }
.chat-input { border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-bg); padding: 10px 15px; }
.chat-input:focus { border-color: var(--ui-blue); box-shadow: 0 0 0 3px rgba(0,122,255,.12); }

/* 页面头部统一为 iOS Navigation Bar 的轻量层级。 */
.view-title, .view-title-row, .dynamics-topbar { border-bottom-color: var(--ui-line); }
.view-title { font-weight: 700; letter-spacing: -.04em; }
.sch-view, .settings-view { padding-top: 6px; }
.sch-view > * { flex-shrink: 0; }

/* 记录区：统一成 iOS 的页面标题与分组卡片。 */
.sch-view .view-title-row { min-height: 52px; padding: 4px 2px 12px; align-items: center; }
.sch-view .view-title-row .view-title { margin: 0; }
.sch-view .view-title { color: var(--ui-text); }
.diary-summary, .sch-summary, #calendarContext, #monthCalendarCard, #calendarDayDetail, #mapCanvasContainer, #mapEmpty, #mapCurrentSpace { border: 1px solid var(--ui-line); background: var(--ui-surface); box-shadow: none; }
.diary-summary { border-radius: var(--ui-radius-lg); padding: 18px 20px; }
#diaryList { display: grid; gap: 12px; margin-top: 14px; }
.diary-entry { border: 1px solid var(--ui-line); border-radius: var(--ui-radius-lg); background: var(--ui-surface); box-shadow: none; }
.diary-write-btn, .sch-add-btn { border-radius: 999px; background: rgba(0,122,255,.1); color: var(--ui-blue); border-color: rgba(0,122,255,.18); }
#monthCalendarCard { border-radius: var(--ui-radius-lg); }
.calendar-month-btn { border-radius: 999px; color: var(--ui-blue); }
.calendar-day-detail, .schedule-list { border-radius: var(--ui-radius-lg); }
.schedule-list { padding: 4px 16px; }
.schedule-item { padding: 14px 4px; border-bottom-color: var(--ui-line); }
.sch-btn { border-radius: 999px; }
.dynamics-profile { border: 1px solid var(--ui-line); background: var(--ui-surface); box-shadow: none; }
.dynamics-cover { background: linear-gradient(135deg, #dce8ff 0%, #f6e8f0 100%); }
.dynamics-feed { display: grid; gap: 12px; }
.dynamics-feed .post-item { margin: 0; border-color: var(--ui-line); border-radius: var(--ui-radius-lg); background: var(--ui-surface); box-shadow: none; }
#mapCanvasContainer { border-radius: var(--ui-radius-lg); }
.map-floating-tools { border: 1px solid var(--ui-line); border-radius: 999px; background: var(--ui-surface); box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.map-place-manager { margin-top: 14px; border-color: var(--ui-line); border-radius: var(--ui-radius-lg); background: var(--ui-surface); }
.map-footprint-item, .map-place-row { border-color: var(--ui-line); border-radius: var(--ui-radius-md); background: var(--ui-surface); }
.album-card, .album-photo-card { border-color: var(--ui-line); border-radius: var(--ui-radius-lg); background: var(--ui-surface); box-shadow: none; }
.album-card:hover { transform: translateY(-2px); box-shadow: var(--ui-shadow); }
.activity-card, .activity-item, .activity-empty { border-color: var(--ui-line); border-radius: var(--ui-radius-lg); background: var(--ui-surface); }

/* 档案：角色主页，而不是设置表单。 */
.profile-view { gap: 16px; }
.profile-view > .view-title { margin-bottom: 0; }
.profile-view #profileRoleHost, .profile-view #profileUserHost { display: flex; flex-direction: column; gap: 16px; }
.profile-view #settingsProfileCard { border: 0; border-radius: var(--ui-radius-xl); background: linear-gradient(145deg, #fff 0%, #edf3ff 100%); box-shadow: var(--ui-shadow); text-align: center; }
.profile-view #settingsProfileCard .settings-profile-avatar { margin: 0 auto 12px; }
.profile-view #settingsProfileCard .settings-profile-name { font-size: 28px; font-weight: 700; letter-spacing: -.04em; }
.profile-view #roleManagementGroup { border: 1px solid var(--ui-line); }
.profile-view #roleManagementGroup > .s-label::before { content: "角色资料"; }
.profile-view #roleManagementGroup > .s-label { font-size: 0; }
.profile-view #roleManagementGroup > .s-label::before { font-size: 16px; }
.profile-view #userPersonaGroup > .s-label::before { content: "我的档案"; }
.profile-view #userPersonaGroup > .s-label { font-size: 0; }
.profile-view #userPersonaGroup > .s-label::before { font-size: 16px; }

/* 设置：接近 iOS Settings 的分组列表。 */
#view-settings > .s-group { border: 1px solid var(--ui-line); box-shadow: none; overflow: hidden; }
#view-settings > .s-group > .s-label { padding: 14px 16px; margin: 0; border-bottom: 1px solid var(--ui-line); color: var(--ui-muted); font-size: 12px; letter-spacing: .02em; text-transform: none; }
#view-settings > .s-group > .s-item { min-height: 48px; padding: 11px 16px; background: transparent; }
#view-settings > .s-group > .s-item + .s-item { border-top: 1px solid var(--ui-line); }
#view-settings > .s-group > .s-item .label { color: var(--ui-text); }
#view-settings > .s-group .model-manager-intro, #view-settings > .s-group .capability-center-help { margin: 14px 16px; color: var(--ui-muted); }
#view-settings > .s-group .model-manager-toolbar { padding: 0 16px 12px; }
#view-settings > .s-group .model-connection-list { margin: 0 16px 14px; border-color: var(--ui-line); border-radius: 13px; }
#view-settings > .s-group .model-config-editor { margin: 0 16px 14px; border-color: var(--ui-line); border-radius: 14px; }
#view-settings > .s-group .capability-assignment-summary { margin: 0 16px 10px; }
#view-settings > .s-group .s-group-collapse { border-radius: 14px; box-shadow: none; }
.settings-view .s-item input[type="date"], .settings-view .s-item input[type="number"], .settings-view .s-item select { min-height: 36px; }
/* 设置页是长列表：分组不能参与 flex 压缩，否则内容会被截断成空白横线。 */
.settings-view > * { flex-shrink: 0; }
#view-settings > .s-group { overflow: visible; }
#view-settings > .s-group > .s-label { color: #6e6e73; }
#view-settings > .s-group > .s-item .label,
#view-settings > .s-group > .s-item .value,
#view-settings > .s-group .hint { color: var(--ui-text); }
.settings-account-actions { margin: 18px 0 calc(24px + env(safe-area-inset-bottom, 0px)); text-align: center; }
.settings-danger-btn { width: 100%; min-height: 48px; border: 1px solid rgba(255,59,48,.24); border-radius: 14px; background: rgba(255,59,48,.08); color: #d92d27; font: inherit; font-weight: 650; cursor: pointer; transition: background .18s ease, transform .18s ease; }
.settings-danger-btn:hover { background: rgba(255,59,48,.14); transform: translateY(-1px); }
.settings-danger-btn:active { transform: translateY(0); }
.settings-danger-hint { margin-top: 8px; color: var(--ui-muted); font-size: 11px; }

/* 基础交互层：弹窗、抽屉、按钮和空状态统一成 iOS 风格。 */
.modal-overlay,
.merge-preview-overlay {
  background: rgba(0, 0, 0, .28);
  backdrop-filter: blur(14px) saturate(1.08);
  -webkit-backdrop-filter: blur(14px) saturate(1.08);
}
.modal-box,
.confirm-box,
.merge-preview-drawer {
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  color: var(--ui-text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .18);
}
.modal-box { border-radius: 22px; padding: 22px; }
.confirm-box { border-radius: 22px; }
.modal-title,
.confirm-title,
.drawer-header h2 { color: var(--ui-text); font-weight: 700; letter-spacing: -.02em; }
.modal-btn,
.modal-btn-cancel,
.modal-btn-confirm,
.btn-ghost,
.btn-glow {
  min-height: 40px;
  border-radius: 999px;
  font-weight: 600;
  transition: transform .16s ease, filter .16s ease, background .16s ease;
}
.modal-btn:active,
.btn-ghost:active,
.btn-glow:active,
.drawer-close:active { transform: scale(.96); }
.modal-btn-confirm,
.btn-glow { background: var(--ui-blue); color: #fff; border-color: transparent; box-shadow: 0 8px 20px rgba(0, 122, 255, .2); }
.modal-btn-cancel,
.btn-ghost { background: var(--ui-soft); color: var(--ui-blue); border-color: var(--ui-line); }
.drawer-backdrop { background: rgba(0, 0, 0, .28); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.drawer-overlay > .drawer-panel {
  width: min(520px, 100%);
  background: var(--ui-surface);
  border-left: 0;
  border-radius: 24px 0 0 24px;
  box-shadow: -20px 0 60px rgba(0, 0, 0, .16);
}
.drawer-header { padding: 16px 20px; border-bottom-color: var(--ui-line); }
.drawer-close { background: var(--ui-soft); color: var(--ui-muted); border: 0; }
.drawer-close:hover { background: var(--ui-line); color: var(--ui-text); }
.drawer-body { padding: 18px 20px; }
.empty-card,
.schedule-empty,
.dynamics-empty,
.model-connection-empty,
.diary-empty,
.story-card-empty,
.album-empty-state {
  border: 1px dashed var(--ui-line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--ui-surface) 72%, transparent);
  color: var(--ui-muted);
}
.schedule-empty,
.dynamics-empty,
.model-connection-empty,
.diary-empty,
.story-card-empty { margin: 8px 0; }
.image-studio-task-notice { background: var(--ui-surface); border-color: var(--ui-line); color: var(--ui-text); box-shadow: 0 16px 42px rgba(0, 0, 0, .16); border-radius: 16px; }

@media (max-width: 768px) {
  .modal-overlay,
  .merge-preview-overlay { align-items: flex-end; padding: 0; }
  .modal-box,
  .confirm-box,
  .merge-preview-drawer {
    width: 100%;
    max-width: none;
    max-height: min(88dvh, 760px);
    border-radius: 24px 24px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    animation: uiSheetIn .22s ease-out;
  }
  .confirm-box { position: relative; top: auto; left: auto; transform: none; }
  .drawer-overlay { align-items: flex-end; justify-content: center; }
  .drawer-overlay > .drawer-panel {
    width: 100%;
    height: min(92dvh, 760px);
    max-height: 92dvh;
    align-self: flex-end;
    border-radius: 24px 24px 0 0;
    animation: uiSheetIn .22s ease-out;
  }
  .drawer-header { padding: 16px; }
  .drawer-body { padding: 16px; }
  #systemPromptModal > div,
  #recentLogsModal > div {
    width: 100% !important;
    max-width: none !important;
    height: min(88dvh, 760px) !important;
    max-height: 88dvh !important;
    border-radius: 24px 24px 0 0 !important;
    animation: uiSheetIn .22s ease-out;
  }
  .image-studio-task-notice { right: 12px; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); max-width: none; }
}
@keyframes uiSheetIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }

/* 小世界首页：手机桌面式的背景 + 半透明 Widget。 */
.main:has(> .content > #view-home.active) > .char-panel { display: none; }
.main:has(> .content > #view-home.active) > .content { padding: 0; background: var(--ui-bg); }
.main:has(> .content > #view-home.active) .home-view { max-width: none; min-height: 100%; }
.main:has(> .content > #view-home.active) .home-shell { min-height: 100%; gap: 0; }
.home-view { max-width: 980px; }
.home-hero.lockscreen {
  position: relative;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 30px;
  overflow: hidden;
  isolation: isolate;
  background-image: linear-gradient(180deg, rgba(20,27,38,.08), rgba(20,27,38,.54)), var(--role-wallpaper, linear-gradient(145deg, #bcc9d8, #677483));
  background-position: center;
  background-size: cover;
  box-shadow: 0 18px 50px rgba(25,35,48,.18);
}
.home-hero.lockscreen::before { z-index: -1; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 72px 72px; opacity: .35; mask-image: linear-gradient(180deg, #000, transparent 92%); }
.home-hero.lockscreen::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(0,0,0,.08), transparent 42%, rgba(0,0,0,.35)); pointer-events: none; }
.home-statusbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 28px 0; color: rgba(255,255,255,.94); font-size: 12px; font-weight: 650; letter-spacing: .02em; text-shadow: 0 1px 5px rgba(0,0,0,.24); }
.home-status-time { font-variant-numeric: tabular-nums; }
.home-status-network { display: inline-flex; align-items: center; gap: 9px; }
.home-status-carrier { font-size: 11px; font-weight: 600; opacity: .9; }
.home-status-network svg { width: 19px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.home-status-network svg:first-of-type { width: 18px; }
.home-status-battery { position: relative; display: inline-flex; width: 25px; height: 12px; align-items: center; padding: 2px; border: 1.5px solid currentColor; border-radius: 4px; }
.home-status-battery::after { content: ""; position: absolute; top: 3px; right: -4px; width: 2px; height: 5px; border-radius: 0 2px 2px 0; background: currentColor; }
.home-status-battery i { display: block; width: 84%; height: 100%; border-radius: 2px; background: currentColor; }
.home-hero-top { padding: 28px 28px 0; align-items: center; }
.home-kicker { color: rgba(255,255,255,.86); letter-spacing: .18em; }
.ls-clock { color: #fff; font-size: clamp(64px, 12vw, 112px); font-weight: 300; text-shadow: 0 3px 18px rgba(0,0,0,.2); }
.ls-date { color: rgba(255,255,255,.9); font-size: 15px; }
.ls-rel-pill { background: rgba(255,255,255,.2); border-color: rgba(255,255,255,.32); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 8px 24px rgba(0,0,0,.12); backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2); }
.ls-rel-label { color: #fff; }
.home-hero-grid { grid-template-columns: minmax(190px,.7fr) minmax(0,1.3fr); gap: 14px; margin-top: 28px; padding: 0 28px 28px; }
.home-hero-figure, .home-hero-copy, .home-quote, .home-mini-metric { border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.28), 0 12px 30px rgba(0,0,0,.12); backdrop-filter: blur(20px) saturate(1.15); -webkit-backdrop-filter: blur(20px) saturate(1.15); }
.home-hero-figure { min-height: 210px; border-radius: 24px; background-image: linear-gradient(rgba(255,255,255,.08), rgba(0,0,0,.15)), var(--role-wallpaper, linear-gradient(145deg,#d8e0eb,#8793a0)); background-position: center; background-size: cover; }
.ls-character-placeholder { color: rgba(255,255,255,.9); filter: drop-shadow(0 3px 8px rgba(0,0,0,.2)); }
.home-hero-copy { min-height: 210px; padding: 18px; border-radius: 24px; color: #fff; }
.ls-weather { color: rgba(255,255,255,.92); }
.ls-weather-tip, .home-status-line { color: rgba(255,255,255,.82); }
.home-quote { padding: 14px; border-radius: 18px; color: #fff; }
.home-mini-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.home-mini-metric { border-radius: 16px; padding: 12px; color: #fff; }
.home-apps { position: relative; margin-top: -2px; padding: 0 14px; }
.home-icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.home-apps-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 10px; color: rgba(255,255,255,.9); }
.home-apps-title { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.home-apps-hint { color: rgba(255,255,255,.62); font-size: 11px; }
.home-apps-viewport { overflow: hidden; border-radius: 24px; touch-action: pan-y; }
.home-apps-track { display: flex; width: 100%; transition: transform .28s ease; }
.home-apps-page { flex: 0 0 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding: 2px 0; }
.home-action-card { min-height: 104px; position: relative; overflow: hidden; background: linear-gradient(145deg, rgba(255,255,255,.34), rgba(255,255,255,.16)); border-color: rgba(255,255,255,.38); color: #fff; backdrop-filter: blur(22px) saturate(1.2); -webkit-backdrop-filter: blur(22px) saturate(1.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.42), 0 10px 26px rgba(0,0,0,.14); }
.home-action-card::before { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, rgba(255,255,255,.22), transparent 42%); pointer-events: none; }
.home-action-card .home-action-icon { width: 42px; height: 42px; border: 1px solid rgba(255,255,255,.34); border-radius: 14px; background: rgba(255,255,255,.18); color: #fff; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0,0,0,.18)); }
.home-action-card:active { transform: scale(.97); }
.home-apps-pagination { display: flex; justify-content: center; gap: 7px; padding: 13px 0 2px; }
.home-apps-dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px; background: rgba(255,255,255,.42); box-shadow: 0 1px 4px rgba(0,0,0,.16); transition: width .2s ease, background .2s ease; }
.home-apps-dot.active { width: 20px; background: rgba(255,255,255,.92); }
.home-action-card .home-action-desc { color: rgba(255,255,255,.78); }
.home-dock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 18px 14px 0; padding: 10px; border: 1px solid rgba(255,255,255,.28); border-radius: 26px; background: rgba(16,20,28,.34); box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 16px 34px rgba(0,0,0,.2); backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2); }
.home-dock-item { display: flex; min-height: 64px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 18px; background: rgba(255,255,255,.1); color: rgba(255,255,255,.9); font-size: 11px; transition: transform .2s ease, background .2s ease; }
.home-dock-item:hover { transform: translateY(-2px); background: rgba(255,255,255,.18); }
.home-dock-item:active { transform: scale(.95); }
.home-dock-icon { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.home-apps-heading, .home-hero + .home-apps .home-apps-heading, .ls-unlock-hint { display: none; }

@media (max-width: 768px) {
  .home-hero.lockscreen { min-height: 0; border-radius: 0; }
  .home-hero-top { padding: 24px 18px 0; }
  .home-statusbar { padding: 12px 18px 0; }
  .ls-clock { font-size: clamp(62px, 21vw, 92px); }
  .home-hero-grid { grid-template-columns: 1fr; gap: 10px; margin-top: 20px; padding: 0 14px 14px; }
  .home-hero-figure { min-height: 180px; }
  .home-hero-copy { min-height: 0; }
  .home-apps { padding: 0 2px; }
  .home-apps-page { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
  .home-action-card { min-height: 76px; }
  .home-dock { margin: 16px 2px 0; padding: 8px; border-radius: 23px; }
  .home-dock-item { min-height: 58px; }
}

@media (max-width: 768px) {
  :root { --ui-radius-xl: 20px; --ui-radius-lg: 16px; }
  .content { padding: 10px 12px 0 !important; }
  .sidebar { height: calc(62px + env(safe-area-inset-bottom, 0px)); min-height: calc(62px + env(safe-area-inset-bottom, 0px)); padding: 6px 8px env(safe-area-inset-bottom, 0px); border-radius: 18px 18px 0 0; }
  .sidebar-nav { flex: 1; gap: 2px; justify-content: space-around; overflow: hidden; padding: 0; }
  .role-switch-bar { display: none; }
  .nav-item { min-height: 48px; font-size: 10px; }
  .nav-item svg { width: 19px; height: 19px; }
  .home-hero { border-radius: var(--ui-radius-xl); }
  .home-hero-top { padding: 20px 18px 0; }
  .home-statusbar { padding: 10px 18px 0; }
  .home-status-carrier { display: none; }
  .home-hero-grid { grid-template-columns: 1fr; padding: 12px 18px 20px; }
  .home-hero-figure { min-height: 150px; max-height: 190px; }
  .home-apps { padding: 0; }
  .home-apps-page { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 7px; }
  .home-action-card { min-height: 78px; padding: 11px 5px; border-radius: 18px; }
  .home-action-icon { font-size: 25px; }
  .home-action-title { font-size: 12px; }
  .home-dock { margin: 14px 0 0; }
  .home-action-desc { display: none; }
  .home-memory-panel, .food-section, .anniversary-card { display: none !important; }
  .home-panels-grid { grid-template-columns: 1fr; }
  .view-title { font-size: 27px; font-weight: 700; letter-spacing: -.04em; }
  .s-group { border-radius: 15px; }
  .settings-profile { border-radius: 18px; }
  .profile-view #settingsProfileCard { padding: 24px 18px; }
  .profile-view #roleManagementGroup > .s-label { padding: 15px 16px; }
  #view-settings > .s-group > .s-label { padding: 13px 14px; }
  #view-settings > .s-group > .s-item { padding: 11px 14px; }
  .sch-view .view-title-row { min-height: 48px; padding-bottom: 10px; }
  .sch-view .view-title { font-size: 26px; }
  .dynamics-cover { height: 108px; }
  .dynamics-profile-row { margin-top: -42px; }
  .dynamics-avatar { width: 84px; height: 84px; }
  #monthCalendarCard { padding: 10px; }
  .calendar-weekdays, .calendar-grid { gap: 3px; }
  .schedule-list { padding: 3px 12px; }
  .map-floating-tools { left: 10px; right: 10px; }
  .album-card-grid, .album-photo-grid { gap: 9px; }
  .chat-header { min-height: 50px; padding: 7px 2px 9px; }
  .chat-header-actions { gap: 5px; }
  .chat-header-btn { font-size: 10px; padding: 6px 8px; }
  .rel-capsule { padding: 6px 8px; min-height: 31px; }
  .chat-msgs { padding: 14px 2px 24px; gap: 12px; }
  .chat-input-bar { margin: 6px -2px 0; padding: 7px 8px calc(7px + env(safe-area-inset-bottom, 0px)); border-radius: 17px 17px 0 0; }
  .chat-input { min-height: 42px; }
}

/* 手机底部 Dock（REQ-20260907-005 M4）：唯一 [≡]/[←] 按钮，导航入口统一进抽屉。 */
@media (max-width: 768px) {
  .sidebar { background: rgba(250,250,252,.78); border-top: 1px solid rgba(255,255,255,.66); box-shadow: 0 -8px 28px rgba(30,30,40,.08); backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2); }
  .sidebar-brand, .sidebar-footer { display: none; }
}

/* 单聊移动端功能入口：头部低频能力集中到可滚动面板，避免被桌面按钮隐藏规则吞掉。 */
.chat-mobile-more-btn, .chat-mobile-actions-panel { display: none; }
.rel-capsule-wrap { position: relative; display: flex; align-items: center; }
.rel-capsule-expanded {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 120;
  width: min(280px, calc(100vw - 32px));
  max-height: min(60vh, 520px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 16px;
  border: 1px solid var(--ui-line);
  border-radius: 14px;
  background: var(--ui-surface, #fff);
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  -webkit-overflow-scrolling: touch;
}
html[data-theme="dark"] .sidebar { background: rgba(28,28,30,.84); border-top-color: rgba(84,84,88,.55); }

/* 通讯录：沿用聊天列表的数据，但独立成一个手机页面。 */
.contacts-view { gap: 0; max-width: 760px; padding: 28px 24px 40px; }
.relationship-network-view { gap: 0; max-width: 980px; padding: 28px 24px 40px; }
.relationship-network-subtitle { color: var(--ui-muted); font-size: 12px; margin-top: 4px; }
.relationship-network-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.relationship-network-toolbar { color: var(--ui-muted); font-size: 12px; min-height: 22px; padding: 8px 2px 2px; }
.relationship-network-stage { position: relative; min-height: 430px; margin-top: 8px; border: 1px solid var(--ui-line); border-radius: 20px; background: radial-gradient(circle at 50% 45%, rgba(201,169,110,.12), transparent 48%), rgba(255,255,255,.45); overflow: hidden; }
.relationship-network-stage svg { display: block; width: 100%; height: auto; min-height: 430px; }
.relationship-network-edge { stroke: rgba(132, 113, 82, .42); stroke-width: 2; }
.relationship-network-edge-label { fill: var(--ui-muted); font-size: 12px; text-anchor: middle; }
.relationship-network-user-line { stroke: rgba(201,169,110,.25); stroke-width: 1.5; stroke-dasharray: 5 6; }
.relationship-network-node { cursor: pointer; outline: none; }
.relationship-network-node:focus .relationship-network-node-ring, .relationship-network-node:hover .relationship-network-node-ring { stroke: var(--ui-blue); stroke-width: 3; }
.relationship-network-node-ring { fill: rgba(255,255,255,.94); stroke: var(--ui-line); stroke-width: 2; }
.relationship-network-node.is-current .relationship-network-node-ring { stroke: var(--ui-blue); stroke-width: 3; }
.relationship-network-node.is-user .relationship-network-node-ring { fill: var(--ui-blue); stroke: var(--ui-blue); }
.relationship-network-node-initial { fill: var(--ui-text); font-size: 16px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.relationship-network-node.is-user .relationship-network-node-initial { fill: #fff; }
.relationship-network-node-name { fill: var(--ui-text); font-size: 13px; text-anchor: middle; pointer-events: none; }
.relationship-network-list { display: none; }
.relationship-draft-modal { max-width: 720px; max-height: 82vh; overflow:auto; }
.relationship-event-schedule-option { display:block; margin:14px 0 8px; color:var(--text-secondary); font-size:13px; cursor:pointer; }
.relationship-event-schedule-inputs { display:grid; grid-template-columns:1fr 1fr 1fr; gap:8px; padding:10px; border-radius:10px; background:rgba(201,169,110,.07); }
.relationship-event-schedule-inputs label { display:grid; gap:5px; color:var(--text-dim); font-size:11px; }.relationship-event-schedule-inputs input { min-width:0; }
.relationship-draft-header, .relationship-draft-footer { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.relationship-draft-header h3 { margin:0; }
.relationship-draft-header p { margin:5px 0 0; color:var(--ui-muted); font-size:12px; }
.relationship-draft-list { display:grid; gap:8px; margin:16px 0; }
.relationship-draft-row { display:flex; gap:10px; align-items:flex-start; padding:12px; border:1px solid var(--ui-line); border-radius:12px; background:rgba(255,255,255,.55); cursor:pointer; }
.relationship-draft-row > input { margin-top:4px; accent-color:var(--ui-blue); }
.relationship-draft-main { flex:1; min-width:0; }
.relationship-draft-nodes { display:flex; align-items:center; gap:7px; font-size:13px; flex-wrap:wrap; }
.relationship-draft-nodes span { color:var(--ui-muted); }
.relationship-draft-nodes small { color:var(--ui-muted); font-size:10px; margin-left:auto; }
.relationship-draft-edit { display:flex; gap:8px; margin-top:8px; }
.relationship-draft-edit .settings-select { width:100px; flex:none; }
.relationship-draft-edit .settings-input { min-width:0; }
.relationship-draft-footer { align-items:center; color:var(--ui-muted); font-size:11px; }
@media (max-width: 560px) { .relationship-draft-modal { max-height:88vh; } .relationship-draft-edit { display:grid; grid-template-columns:100px minmax(0,1fr); } .relationship-draft-footer { display:grid; gap:10px; } }
@media (max-width: 700px) { .relationship-network-view { padding: 16px 14px calc(90px + env(safe-area-inset-bottom, 0px)); } .relationship-network-stage { display:none; } .relationship-network-list { display:grid; gap:8px; margin-top:8px; } .relationship-network-list-row { display:grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items:center; gap:8px; padding:11px 12px; border:1px solid var(--ui-line); border-radius:12px; background:rgba(255,255,255,.6); font-size:12px; } .relationship-network-list-role { color:var(--ui-text); cursor:pointer; } .relationship-network-list-type { color:var(--ui-muted); text-align:center; } .relationship-network-actions { justify-content:flex-start; } }
.contacts-view .view-title-row { align-items: center; margin-bottom: 14px; }
.contacts-view .view-title { font-size: 30px; font-weight: 700; letter-spacing: -.05em; }
.contacts-view .settings-mini-btn { min-height: 34px; padding: 7px 13px; border-radius: 999px; }
.contacts-search-wrap .settings-input { min-height: 44px; padding: 10px 16px; border: 1px solid rgba(255,255,255,.16); border-radius: 16px; background: rgba(255,255,255,.08); box-shadow: inset 0 1px 0 rgba(255,255,255,.12); backdrop-filter: blur(18px); }
.contacts-section-label { margin: 14px 2px 8px; color: var(--ui-muted); font-size: 12px; font-weight: 650; }
.contacts-role-list { max-height: none; gap: 9px; }
.contacts-role-list .chat-role-item, .contacts-role-list .chat-group-item { min-height: 76px; padding: 12px 14px; border: 1px solid rgba(255,255,255,.13); border-radius: 20px; background: linear-gradient(145deg, rgba(255,255,255,.14), rgba(255,255,255,.06)); box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 9px 22px rgba(0,0,0,.1); backdrop-filter: blur(18px); transition: transform .2s ease, background .2s ease, border-color .2s ease; }
.contacts-role-list .chat-role-item:hover, .contacts-role-list .chat-group-item:hover { transform: translateY(-1px); background: linear-gradient(145deg, rgba(255,255,255,.2), rgba(255,255,255,.08)); border-color: rgba(255,255,255,.26); }
.contacts-role-list .chat-role-item:active, .contacts-role-list .chat-group-item:active { transform: scale(.985); }
.contacts-role-list .chat-role-item::after, .contacts-role-list .chat-group-item::after { content: "›"; align-self: center; color: rgba(255,255,255,.48); font-size: 24px; font-weight: 300; }
.contacts-role-list .chat-role-avatar, .contacts-role-list .chat-group-icon, .contacts-role-list .chat-group-avatar-stack { width: 50px; height: 50px; border-radius: 16px; }
.contacts-role-list .chat-role-name { color: var(--ui-text); font-size: 15px; font-weight: 650; }
.contacts-role-list .chat-role-preview { margin-top: 5px; color: var(--ui-muted); font-size: 12px; }
.contacts-role-list .chat-role-meta { padding-right: 4px; }
.contacts-role-list .chat-role-actions { display: none; }
@media (max-width: 768px) {
  .contacts-view { max-width: none; padding: 16px 14px calc(90px + env(safe-area-inset-bottom, 0px)); }
  .contacts-view .view-title-row { margin-bottom: 8px; }
  .contacts-search-wrap { position: sticky; top: 52px; z-index: 7; padding: 0 0 8px; background: var(--ui-bg); }
  .contacts-search-wrap .settings-input { min-height: 40px; border-radius: 12px; background: rgba(255,255,255,.78); }
  .contacts-section-label { margin: 8px 2px; }
  .contacts-role-list .chat-role-item, .contacts-role-list .chat-group-item { min-height: 70px; padding: 10px 12px; }
  .contacts-role-list .chat-role-avatar, .contacts-role-list .chat-group-icon, .contacts-role-list .chat-group-avatar-stack { width: 46px; height: 46px; border-radius: 15px; }
  .contacts-role-list .chat-role-name { font-size: 14px; }
  .contacts-role-list .chat-role-preview { font-size: 12px; margin-top: 4px; }
  .contacts-role-list .chat-role-list { max-height: none; }
}
html[data-theme="dark"] .contacts-search-wrap .settings-input { background: rgba(44,44,46,.84); }

/* 工具面板必须脱离输入栏滚动裁剪层，否则点击 + 只能看到空白。 */
@media (max-width: 768px) {
  .chat-input-bar { overflow: visible !important; }
  .chat-tools-panel { z-index: 120; visibility: visible; }
  .chat-tools-panel[hidden] { visibility: hidden; }
  .chat-input-bar { gap: 7px; padding: 8px 10px calc(9px + env(safe-area-inset-bottom,0px)); border-top: 0; border-radius: 18px 18px 0 0; background: rgba(250,250,250,.96); box-shadow: 0 -4px 18px rgba(0,0,0,.08); }
  .chat-input-bar > .chat-tools-toggle,
  .chat-input-bar > #voiceBtn { width: 36px; height: 36px; flex: 0 0 36px; border: 0; background: transparent; color: #111; font-size: 22px; }
  .chat-input-bar > #voiceBtn { font-size: 20px; }
  .chat-input-bar > .chat-input { height: 38px; min-height: 38px; padding: 7px 13px; border: 1px solid #d5d5d8; border-radius: 10px; background: #fff; box-shadow: inset 0 1px 2px rgba(0,0,0,.04); }
  .chat-input-bar > .chat-reply-mode { width: 54px; min-height: 34px; padding: 3px 1px; }
  .chat-input-bar > #sendBtn { width: 40px; height: 40px; flex: 0 0 40px; border: 0; border-radius: 50%; background: #0a84ff; color: #fff; box-shadow: none; }
  .chat-input-bar > #sendBtn:disabled { background: #b9cbe0; color: #fff; opacity: 1; }
}

.contacts-filter { display: flex; gap: 6px; margin: 4px 0 2px; padding: 3px; border-radius: 12px; background: var(--ui-soft); }
.contacts-filter button { flex: 1; min-height: 32px; border-radius: 9px; color: var(--ui-muted); font-size: 12px; }
.contacts-filter button.active { background: var(--ui-surface); color: var(--ui-blue); font-weight: 650; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
@media (max-width: 768px) {
  .contacts-filter { margin: 2px 0 4px; }
  .contacts-filter button { min-height: 34px; }
}

/* 修正单聊消息结构：头像独立成列，心理活动和正文在同一内容列内换行。 */
@media (max-width: 768px) {
  .chat-bubble-warm:not(.tool-result-msg):not(.diary-status-msg):not(.location-candidate-msg):not(.group-responder-status-msg) {
    display: grid;
    grid-template-columns: 34px minmax(0,1fr);
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    column-gap: 8px;
    row-gap: 4px;
  }
  /* REQ-20260909-001: 单聊助手行现为 5 行（header/reasoning/psych/body/time）。
     该网格无显式 grid-template-rows，负行号 1/-1 只对显式轨道生效会塌缩，故用 span 5。 */
  .chat-bubble-warm:not(.tool-result-msg):not(.diary-status-msg):not(.location-candidate-msg):not(.group-responder-status-msg) .msg-header { grid-column: 1; grid-row: 1 / span 5; width: 34px; }
  .chat-bubble-warm:not(.tool-result-msg):not(.diary-status-msg):not(.location-candidate-msg):not(.group-responder-status-msg) .psych-entry,
  .chat-bubble-warm:not(.tool-result-msg):not(.diary-status-msg):not(.location-candidate-msg):not(.group-responder-status-msg) .reasoning-block-wrap,
  .chat-bubble-warm:not(.tool-result-msg):not(.diary-status-msg):not(.location-candidate-msg):not(.group-responder-status-msg) .message-body,
  .chat-bubble-warm:not(.tool-result-msg):not(.diary-status-msg):not(.location-candidate-msg):not(.group-responder-status-msg) .chat-msg-time { grid-column: 2; min-width: 0; width: 100%; }
  .chat-bubble-warm:not(.tool-result-msg):not(.diary-status-msg):not(.location-candidate-msg):not(.group-responder-status-msg) .msg-header { align-items: center; }
  .chat-bubble-warm:not(.tool-result-msg):not(.diary-status-msg):not(.location-candidate-msg):not(.group-responder-status-msg) .glass { max-width: 100%; width: fit-content; }
  .chat-bubble-user {
    display: grid;
    grid-template-columns: minmax(0,1fr) 34px;
    width: 100%;
    max-width: 100%;
    align-self: stretch;
    column-gap: 8px;
    row-gap: 4px;
  }
  .chat-bubble-user .msg-header { grid-column: 2; grid-row: 1 / span 4; width: 34px; }
  .chat-bubble-user .quote-reply,
  .chat-bubble-user .user-bubble,
  .chat-bubble-user .chat-msg-time { grid-column: 1; justify-self: end; max-width: 100%; }
  .chat-bubble-user .user-bubble { width: fit-content; }
  .chat-bubble-user .msg-header { align-items: center; }
  .chat-bubble-warm.tool-result-msg,
  .chat-bubble-warm.diary-status-msg,
  .chat-bubble-warm.location-candidate-msg,
  .chat-bubble-warm.group-responder-status-msg { display: block; width: fit-content; max-width: 92%; align-self: flex-start; }
  .chat-bubble-warm .psych-entry,
  .chat-bubble-warm .psych-content,
  .chat-bubble-warm .message-body,
  .chat-bubble-user .user-bubble { min-width: 0; max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }
  .chat-bubble-warm .psych-content { white-space: pre-wrap; color: #888; font-size: 12px; line-height: 1.55; }
  .chat-bubble-warm .dialogue-bubbles { min-width: 0; max-width: 100%; }
  .chat-bubble-warm .dialogue-bubble { max-width: 100%; overflow-wrap: anywhere; }
  .chat-message-image, .user-message-image { display: block; width: min(250px, 100%); max-width: 100%; max-height: 420px; object-fit: cover; border-radius: 9px; }
  .chat-bubble-warm .image-intent-note { max-width: 100%; overflow-wrap: anywhere; }
}

/* 微信式主导航已被抽屉导航取代（REQ-20260907-005 M4）：移动端侧栏只保留 Dock 按钮。 */

/* 手机内页：统一导航栏、内容卡片和操作层级。 */
@media (max-width: 768px) {
  .content { padding: 8px 10px calc(74px + env(safe-area-inset-bottom,0px)) !important; overflow-x: hidden; }
  .view-title-row,
  .dynamics-topbar {
    position: sticky;
    top: 0;
    z-index: 8;
    min-height: 52px;
    margin: -8px -10px 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--ui-line);
    background: rgba(242,242,247,.82);
    backdrop-filter: blur(20px) saturate(1.15);
    -webkit-backdrop-filter: blur(20px) saturate(1.15);
  }
  .view-title { font-size: 25px; line-height: 1.15; }
  .view-title-row .section-link,
  .view-title-row button,
  .dynamics-topbar button { min-height: 34px; padding: 7px 11px; border-radius: 999px; }
  .diary-summary, .sch-summary, #calendarContext, #monthCalendarCard, #calendarDayDetail, #mapCanvasContainer, #mapEmpty, #mapCurrentSpace, .settings-profile, .s-group { border-radius: 18px; }
  .diary-summary, .sch-summary { padding: 16px; }
  #view-profile, #view-settings, .diary-view, .sch-view { gap: 12px; }
  .s-group > .s-item { min-height: 50px; }
  .settings-input, .settings-textarea, .settings-select { min-height: 40px; font-size: 14px; }
  .diary-entry, .schedule-card, .activity-card, .album-card, .memory-item, .wallet-card { border-radius: 16px; }
  .diary-entry, .activity-card, .album-card { padding: 14px; }
  .map-floating-tools { border-radius: 18px; padding: 8px; background: rgba(255,255,255,.78); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
  .map-floating-tools button, .album-toolbar button, .activity-toolbar button { min-height: 38px; border-radius: 999px; }
  .album-card-grid, .album-photo-grid { padding: 0 2px; }
  .home-view + .view, .chat-view { min-width: 0; }
  .chat-view .view-title-row { display: none; }
  .chat-list { padding-bottom: 8px; }
  .chat-list-item { border-radius: 17px; margin-bottom: 7px; }
}
html[data-theme="dark"] .view-title-row,
html[data-theme="dark"] .dynamics-topbar { background: rgba(0,0,0,.78); }

/* 聊天页：让消息成为唯一主角，顶部和输入栏只承担导航与输入。 */
@media (max-width: 768px) {
  .chat-view { background: var(--ui-bg); }
  .chat-header { flex-shrink: 0; border-bottom: 1px solid var(--ui-line); background: rgba(242,242,247,.82); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
  .chat-header-info { min-width: 0; }
  .chat-header-info > div { min-width: 0; }
  .chat-header-name-row { min-width: 0; }
  .chat-header-name-row > div:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-header-actions { flex-shrink: 0; }
  .chat-header-btn { min-height: 34px; border-radius: 999px; background: rgba(255,255,255,.64); }
  .chat-msgs { padding-left: 8px; padding-right: 8px; }
  .chat-bubble-warm .glass, .chat-bubble-user .user-bubble { box-shadow: 0 2px 10px rgba(0,0,0,.045); }
  .chat-input-bar { margin: 0; border: 0; border-top: 1px solid var(--ui-line); border-radius: 0; background: rgba(242,242,247,.88); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
  .chat-input { min-height: 42px; background: rgba(255,255,255,.74); }
  .chat-role-list { max-height: min(32dvh, 250px); padding: 2px; }
  .chat-role-item, .chat-group-item { min-height: 52px; padding: 8px; border-radius: 14px; }
}
html[data-theme="dark"] .chat-header,
html[data-theme="dark"] .chat-input-bar { background: rgba(0,0,0,.78); }
html[data-theme="dark"] .chat-header-btn,
html[data-theme="dark"] .chat-input { background: rgba(44,44,46,.84); }

/* AI-009：单聊最终移动端布局收口。消息区只为尾部 spacer 留安全间距，
   不再同时叠加同值 padding；键盘状态和 focus-within 共用同一条 flex 链路。 */
@media (max-width: 768px) {
  .chat-header-actions { min-width: 0; }
  .chat-mobile-more-btn {
    display: inline-flex;
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ui-line);
    border-radius: 50%;
    background: rgba(255,255,255,.7);
    color: var(--ui-text);
    font-size: 18px;
    letter-spacing: 2px;
  }
  .chat-mobile-more-btn[aria-expanded="true"] { background: var(--ui-blue); color: #fff; }
  .chat-mobile-actions-panel {
    position: fixed;
    top: calc(env(safe-area-inset-top, 0px) + 64px);
    right: max(8px, env(safe-area-inset-right, 0px));
    z-index: 10000;
    display: block;
    width: min(360px, calc(100vw - 16px));
    max-height: min(70dvh, 520px);
    box-sizing: border-box;
    overflow-y: auto;
    padding: 12px;
    border: 1px solid var(--ui-line);
    border-radius: 18px;
    background: rgba(250,250,250,.97);
    box-shadow: 0 14px 38px rgba(0,0,0,.2);
    -webkit-overflow-scrolling: touch;
    pointer-events: auto;
  }
  .chat-mobile-actions-panel[hidden] { display: none !important; }
  .chat-mobile-actions-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 10px; }
  .chat-mobile-actions-head button { min-height: 36px; padding: 5px 10px; border: 0; border-radius: 999px; background: transparent; color: var(--ui-blue); font-size: 13px; }
  .chat-mobile-actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .chat-mobile-actions-item { min-width: 0; min-height: 48px; padding: 8px 6px; border: 1px solid var(--ui-line); border-radius: 13px; background: var(--ui-surface); color: var(--ui-text); font-size: 13px; overflow-wrap: anywhere; }
  .rel-capsule-wrap { flex: 0 0 auto; }
  .rel-capsule-expanded { width: min(320px, calc(100vw - 16px)); max-height: min(60dvh, 460px); }
  .chat-view, body.keyboard-open .chat-view, .chat-view:has(#chatInput:focus) { height: 100%; max-height: 100%; min-height: 0; overflow: hidden; }
  .chat-msgs, body.keyboard-open .chat-msgs, .chat-view:has(#chatInput:focus) .chat-msgs { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; overflow-x: hidden; padding-bottom: 8px !important; }
  .chat-input-bar, body.keyboard-open .chat-input-bar, .chat-view:has(#chatInput:focus) .chat-input-bar { flex: 0 0 auto; min-height: 50px; max-height: min(35dvh, 180px); overflow: visible; position: relative; inset: auto; width: auto; transform: none; }
}

@media (max-width: 768px) and (max-height: 915px) {
  .chat-mobile-actions-panel { max-height: min(60dvh, 440px); }
}

/* 单聊顶部：角色头像、名字和关系心形居中。 */
@media (max-width: 768px) {
  .chat-header { justify-content: space-between; }
  .chat-header-info { position: absolute; left: 50%; transform: translateX(-50%); display: inline-flex; width: auto; align-items: center; gap: 7px; }
  .chat-header-info::after { content: "♥"; color: #ff4f79; font-size: 17px; line-height: 1; margin-left: 1px; }
  .chat-header-info > div:nth-child(2) { display: block; width: auto; }
  .chat-header-info > div:nth-child(2) > div:nth-child(2), .chat-header-info > div:nth-child(2) > .chat-header-mood { display: none; }
  .chat-header-name-row { justify-content: center; }
  .chat-header-name-row > div:first-child { color: #111; font-size: 15px !important; font-weight: 650 !important; }
  .chat-header-location { display: none; }
  .chat-header-actions { position: relative; z-index: 1; margin-left: auto; }
  .rel-capsule { padding: 4px; }
  .rel-capsule-heartval, .rel-capsule-sep, .rel-capsule-mood, .rel-capsule-trend { display: none; }
  .rel-capsule-heart { font-size: 20px; }
}

/* 单聊微信式皮肤：浅灰聊天底、左右气泡、头像贴边。 */
.chat-back-btn { display: none; border: 0; background: transparent; padding: 0; cursor: pointer; }
.chat-tools-panel { display: contents; }
@media (max-width: 768px) {
  .app:has(#view-chat.active) > .sidebar { display: none; }
  .app:has(#view-chat.active) > .main { width: 100%; }
  .chat-view { background: #ededed; }
  .chat-header { position: relative; gap: 8px; padding: 8px 8px 9px; background: rgba(250,250,250,.96); border-bottom: 1px solid rgba(0,0,0,.08); }
  .chat-back-btn { display: inline-flex; flex: 0 0 44px; width: 44px; height: 44px; align-items: center; justify-content: center; color: #111; font-size: 34px; font-weight: 300; line-height: 1; }
  .chat-header-info { flex: 1; }
  .chat-header-actions { margin-left: auto; }
  .chat-header-btn { display: none; }
  .chat-header-mood { color: #888; }
  .rel-capsule { border: 0; background: transparent; color: #222; }
  .chat-msgs { background: #ededed; padding: 14px 10px 24px; gap: 12px; }
  .chat-bubble-warm, .chat-bubble-user { max-width: 88%; flex-direction: row; align-items: flex-start; gap: 7px; }
  .chat-bubble-user { flex-direction: row-reverse; }
  .chat-bubble-warm .msg-header, .chat-bubble-user .msg-header { width: 34px; flex: 0 0 34px; align-items: center; padding: 0; margin: 0; }
  .chat-bubble-warm .msg-header .msg-avatar, .chat-bubble-user .msg-header .msg-avatar { width: 34px; height: 34px; margin: 0; border: 0; }
  .chat-bubble-warm .msg-name, .chat-bubble-user .msg-name { display: none; }
  .chat-bubble-warm .glass, .chat-bubble-user .user-bubble { max-width: calc(100vw - 92px); padding: 9px 12px; border: 0; border-radius: 4px 12px 12px 12px; background: #fff; color: #1f1f1f; box-shadow: 0 1px 2px rgba(0,0,0,.06); font-size: 15px; line-height: 1.55; }
  .chat-bubble-user .user-bubble { border-radius: 12px 4px 12px 12px; background: #95ec69; color: #111; }
  .chat-bubble-warm .message-body, .chat-bubble-user .message-body { min-width: 0; }
  .chat-msg-time { color: #aaa; font-size: 10px; }
  .chat-input-bar { position: relative; flex-wrap: nowrap; background: #f7f7f7; border-top: 1px solid rgba(0,0,0,.08); padding: 7px 8px calc(8px + env(safe-area-inset-bottom,0px)); }
  .chat-tools-panel { position: absolute; left: 8px; right: 8px; bottom: calc(100% + 8px); display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid rgba(0,0,0,.08); border-radius: 16px; background: rgba(250,250,250,.96); box-shadow: 0 10px 28px rgba(0,0,0,.16); }
  .chat-tools-panel[hidden] { display: none; }
  .chat-tools-panel .btn-icon { display: flex !important; visibility: visible !important; width: 38px; height: 38px; flex: 0 0 38px; background: #fff; border: 1px solid #e1e1e1; color: #222; opacity: 1; }
  .chat-tools-panel button { pointer-events: auto; }
  .chat-tools-toggle { font-size: 24px !important; }
  .chat-tools-toggle[aria-expanded="true"] { transform: rotate(45deg); }
  .chat-input-bar .btn-icon { width: 34px; height: 34px; flex-basis: 34px; border: 0; background: transparent; color: #222; font-size: 22px; }
  .chat-input-bar .chat-input { min-height: 36px; padding: 7px 12px; border: 1px solid #ddd; border-radius: 6px; background: #fff; color: #111; }
  .chat-input-bar #sendBtn { background: #07c160; color: #fff; border-radius: 50%; }
  .quote-reply-bar, .image-preview-bar { background: #f7f7f7; border-radius: 0; }
}

.message-content-live { white-space: pre-wrap; overflow-wrap: anywhere; }

/* 全局反馈：Toast 和排队提示在手机上不遮挡状态栏与输入栏。 */
.ui-toast {
  position: fixed;
  top: max(16px, env(safe-area-inset-top,0px));
  left: 50%;
  z-index: 9999;
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 17px;
  transform: translateX(-50%);
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: rgba(248,248,250,.88);
  color: var(--ui-text);
  box-shadow: 0 12px 34px rgba(0,0,0,.16);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  animation: uiToastIn .2s ease-out;
}
.ui-toast-success { border-color: rgba(52,199,89,.28); }
.ui-toast-error { border-color: rgba(255,59,48,.3); color: #b42318; }
.ui-toast-success::before, .ui-toast-error::before { margin-right: 6px; }
.ui-toast-success::before { content: "✓"; color: #34c759; }
.ui-toast-error::before { content: "!"; color: #ff3b30; font-weight: 800; }
@keyframes uiToastIn { from { opacity: 0; transform: translate(-50%,-8px); } to { opacity: 1; transform: translate(-50%,0); } }
html[data-theme="dark"] .ui-toast { background: rgba(44,44,46,.92); }
html[data-theme="dark"] .ui-toast-error { color: #ffb4ae; }

/* 单聊空状态与输入区：接近原生 AI 聊天的留白与轻操作。 */
@media (max-width: 768px) {
  .chat-header { padding: 8px 2px 10px; }
  .chat-header-avatar { width: 34px; height: 34px; }
  .chat-header-name-row > div:first-child { font-size: 15px !important; }
  .chat-header-info > div > div:nth-child(2) { font-size: 9px !important; }
  .chat-header-mood { font-size: 10px; }
  .chat-header-actions { gap: 4px; }
  .chat-header-btn { max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rel-capsule { min-height: 32px; }
  #chatMsgList:empty { display: flex; min-height: 180px; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: var(--ui-muted); text-align: center; }
  #chatMsgList:empty::before { content: "今天想聊什么？"; color: var(--ui-text); font-size: 20px; font-weight: 650; letter-spacing: -.03em; }
  #chatMsgList:empty::after { content: "从天气、日程或最近的记忆开始"; font-size: 12px; }
  .chat-input-bar { gap: 6px; overflow-x: auto; }
  .chat-input-bar .btn-icon { flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; }
  .chat-input-bar .chat-input { flex: 1 1 150px; min-width: 120px; }
  .chat-input-bar #sendBtn { background: var(--ui-blue); color: #fff; }
  .quote-reply-bar, .image-preview-bar { margin: 0; border-radius: 14px 14px 0 0; }
}

/* 桌面 / 平板宽度：保持三层结构，但给内容更多呼吸空间。 */
@media (min-width: 769px) and (max-width: 1180px) {
  .sidebar { width: 190px; }
  .sidebar-brand { padding-left: 18px; padding-right: 18px; }
  .sidebar-nav { padding-left: 10px; padding-right: 10px; }
  .nav-item { padding-left: 12px; padding-right: 12px; }
  .char-panel { width: 300px; }
  .content { padding: 24px 26px; }
  .home-hero-top, .home-hero-grid { padding-left: 22px; padding-right: 22px; }
  .home-hero-grid { grid-template-columns: minmax(130px,.75fr) minmax(0,1.25fr); }
  .settings-view, .sch-view, .home-view { max-width: 900px; }
}

@media (min-width: 1181px) {
  .content { padding-top: 30px; padding-bottom: 40px; }
  .home-view, .settings-view, .sch-view { max-width: 1180px; }
  .home-hero { min-height: 620px; }
  .s-group, .settings-profile { box-shadow: 0 8px 26px rgba(31,31,40,.045); }
}

/* 内容页：地图、相册、动态使用轻量 Widget，不让工具栏吞掉首屏。 */
@media (max-width: 768px) {
  .dynamics-profile { border-radius: 20px; background: var(--ui-surface); box-shadow: var(--ui-shadow); }
  .dynamics-cover { height: 104px; }
  .dynamics-profile-row { padding: 0 14px; margin-top: -42px; }
  .dynamics-avatar { width: 84px; height: 84px; border-width: 4px; }
  .dynamics-actions { padding-bottom: 4px; }
  .dynamics-actions .moments-btn { padding: 7px 10px; font-size: 12px; }
  .dynamics-info { padding: 12px 14px; }
  .dynamics-info h1 { font-size: 21px; }
  .dynamics-feed .post-item { margin-bottom: 8px; padding: 14px; border-radius: 17px; }
  .album-card-grid, .album-photo-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .album-card, .album-photo-card { border-radius: 17px; overflow: hidden; }
  .album-toolbar { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 2px; }
  .album-toolbar > * { flex: 0 0 auto; }
  #view-map .map-section-heading { margin-top: 4px; }
  #mapCanvasContainer { min-height: 260px; border-radius: 20px; overflow: hidden; }
  #mapCanvasContainer.map-canvas-expanded { position: fixed; inset: 10px 10px calc(72px + env(safe-area-inset-bottom,0px)); z-index: 40; min-height: 0; }
  .map-place-manager, .map-footprint-section, .map-current-space { border-radius: 17px; }
  .map-place-row, .map-footprint-item { min-height: 48px; border-radius: 14px; }
  .map-floating-tools { top: 10px; }
  .sch-summary { border-radius: 18px; background: linear-gradient(145deg, rgba(0,122,255,.12), var(--ui-surface)); }
  .sch-summary-text { font-size: 14px; line-height: 1.6; }
  .schedule-list { padding: 2px 0; display: grid; gap: 8px; }
  .schedule-item { min-width: 0; padding: 12px; border: 1px solid var(--ui-line); border-radius: 16px; background: var(--ui-surface); }
  .sch-actions { flex-wrap: wrap; justify-content: flex-end; }
  .sch-btn { min-height: 32px; border-radius: 999px; padding: 5px 9px; }
  .diary-summary { border-radius: 18px; background: linear-gradient(145deg, rgba(255,149,0,.1), var(--ui-surface)); }
  .diary-write-btn { min-height: 38px; border-radius: 999px; }
  .diary-entry { padding: 14px; }
  .diary-entry-header { gap: 8px; flex-wrap: wrap; }
  .diary-entry-body { line-height: 1.7; font-size: 14px; }
  .diary-entry-replies { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--ui-line); }
  #view-wallet .view-title { margin-bottom: 2px; }
  #view-wallet [style*="display: grid"], #view-wallet [style*="display:grid"] { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 8px !important; }
  #view-wallet button { min-height: 38px; border-radius: 999px; }
}

/* 档案与关系：个人、角色、关系状态各自成块，减少抽象信息的堆叠。 */
@media (max-width: 768px) {
  .profile-view > .view-title { margin-bottom: 2px; }
  .profile-view #profileRoleHost,
  .profile-view #profileUserHost { display: flex; flex-direction: column; gap: 12px; }
  .profile-view #profileRoleHost > .s-group,
  .profile-view #profileUserHost > .s-group { margin: 0; border-radius: 18px; overflow: hidden; }
  .profile-view #profileRoleHost > .s-group > .s-label,
  .profile-view #profileUserHost > .s-group > .s-label { padding: 14px 16px; margin: 0; border-bottom: 1px solid var(--ui-line); }
  .profile-view #profileRoleHost > .s-group > .s-item,
  .profile-view #profileUserHost > .s-group > .s-item { padding: 12px 16px; }
  .profile-view .settings-input, .profile-view .settings-textarea, .profile-view .settings-select { width: 100%; max-width: none !important; }
  #view-settings .settings-profile { min-height: 170px; margin-bottom: 4px; padding: 22px 18px; }
  #view-settings .settings-profile-avatar { width: 68px; height: 68px; }
  #view-settings .settings-profile-name { font-size: 26px; letter-spacing: .02em; }
  #view-settings .settings-profile-bio { font-size: 14px; line-height: 1.45; }
  #view-settings .settings-profile-days { font-size: 13px; }
  #view-settings .model-manager-actions { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 6px; }
  #view-settings .model-manager-actions .settings-mini-btn { min-width: 0; padding: 8px 5px; font-size: 11px; }
  #relCard { border-radius: 18px; }
  .rel-card-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .rel-metric { min-height: 58px; border: 1px solid var(--ui-line); background: rgba(255,255,255,.36); }
.rel-metric b { font-size: 18px; }
}

/* 单聊深色模式：与参考图的黑色聊天界面保持一致。 */
@media (max-width: 768px) {
  html[data-theme="dark"] .chat-view,
  html[data-theme="dark"] .chat-msgs { background: #000; }
  html[data-theme="dark"] .chat-header { background: rgba(20,20,20,.96); border-bottom-color: rgba(255,255,255,.12); }
  html[data-theme="dark"] .chat-header-name-row > div:first-child,
  html[data-theme="dark"] .chat-back-btn,
  html[data-theme="dark"] .chat-input-bar > .chat-tools-toggle,
  html[data-theme="dark"] .chat-input-bar > #voiceBtn { color: #f5f5f7; }
  html[data-theme="dark"] .chat-bubble-warm .glass { background: #2c2c2e; color: #f5f5f7; box-shadow: none; }
  html[data-theme="dark"] .chat-bubble-user .user-bubble { background: #0a84ff; color: #fff; }
  html[data-theme="dark"] .chat-input-bar { background: rgba(24,24,24,.96); box-shadow: 0 -4px 18px rgba(0,0,0,.28); }
  html[data-theme="dark"] .chat-input-bar > .chat-input { border-color: #454548; background: #2c2c2e; color: #f5f5f7; }
  html[data-theme="dark"] .chat-input-bar > #sendBtn { background: #0a84ff; }
  html[data-theme="dark"] .chat-tools-panel { background: rgba(38,38,40,.98); border-color: #454548; }
  html[data-theme="dark"] .chat-tools-panel .btn-icon,
}

@media (max-width: 768px) {
  .chat-date-divider { display: block !important; align-self: center; margin: 4px auto 8px; padding: 3px 8px; border-radius: 7px; background: rgba(0,0,0,.08); color: #888; font-size: 10px; letter-spacing: .02em; }
  html[data-theme="dark"] .chat-date-divider { background: rgba(255,255,255,.12); color: #999; }
}

/* 通讯录进入聊天后的 iOS 收口：保持业务结构，只统一系统栏、气泡和输入区。 */
@media (max-width: 768px) {
  .chat-view { background: #f2f2f7; }
  .chat-header { min-height: 58px; padding: 7px 10px 8px; background: rgba(242,242,247,.9); border-bottom: 1px solid rgba(60,60,67,.16); box-shadow: 0 1px 8px rgba(0,0,0,.04); backdrop-filter: blur(24px) saturate(1.4); -webkit-backdrop-filter: blur(24px) saturate(1.4); }
  .chat-back-btn { color: #0a84ff; font-size: 31px; }
  .chat-header-info { gap: 9px; }
  .chat-header-avatar { width: 38px; height: 38px; border: 2px solid rgba(255,255,255,.88); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
  .chat-header-name-row > div:first-child { color: #1c1c1e; font-size: 15px !important; font-weight: 650 !important; }
  .chat-header-info > div > div:nth-child(2) { color: #34c759 !important; font-size: 9px !important; }
  .chat-msgs { background: linear-gradient(180deg, #f2f2f7 0%, #e9e9ee 100%); padding: 16px 12px 28px; gap: 13px; }
  .chat-bubble-warm .glass, .chat-bubble-user .user-bubble { border: 0; box-shadow: 0 2px 8px rgba(0,0,0,.06); font-size: 15px; line-height: 1.55; }
  .chat-bubble-warm .glass { background: rgba(255,255,255,.92); }
  .chat-bubble-user .user-bubble { background: #0a84ff; color: #fff; }
  .chat-input-bar { background: rgba(242,242,247,.92); border-top: 1px solid rgba(60,60,67,.16); box-shadow: 0 -4px 16px rgba(0,0,0,.05); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
  .chat-input-bar > .chat-input { border: 1px solid rgba(60,60,67,.2); background: rgba(255,255,255,.92); box-shadow: none; }
  .chat-input-bar > #sendBtn { background: #0a84ff; }
  html[data-theme="dark"] .chat-view { background: #000; }
  html[data-theme="dark"] .chat-header { background: rgba(28,28,30,.9); border-bottom-color: rgba(255,255,255,.14); }
  html[data-theme="dark"] .chat-header-name-row > div:first-child { color: #f5f5f7; }
  html[data-theme="dark"] .chat-msgs { background: linear-gradient(180deg, #000 0%, #161618 100%); }
  html[data-theme="dark"] .chat-bubble-warm .glass { background: #2c2c2e; color: #f5f5f7; }
  html[data-theme="dark"] .chat-input-bar { background: rgba(24,24,26,.92); border-top-color: rgba(255,255,255,.14); }
  html[data-theme="dark"] .chat-input-bar > .chat-input { background: #2c2c2e; border-color: #454548; color: #f5f5f7; }
}

/* iScreen 主屏最终覆盖：确保在旧版首页规则之后生效。 */
.main > .char-panel { display: none; }
.main > .content { flex: 1 1 auto; width: 100%; }
.main:has(> .content > #view-home.active) .home-secondary { display: none !important; }
.main:has(> .content > #view-home.active) .home-hero.lockscreen { min-height: max(720px, calc(100dvh - 8px)); border-radius: 0; box-shadow: none; }
.main:has(> .content > #view-home.active) .home-hero.lockscreen { background-image: var(--home-wallpaper, none); background-color: transparent; background-position: var(--home-wallpaper-position, center); }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) { background-image: linear-gradient(145deg, #66778a 0%, #334150 46%, #17212c 100%); }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper)::before { opacity: .16; }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-social-widget,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-photo-widget,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-relationship-widget,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-small-widget { background: linear-gradient(145deg, rgba(255,255,255,.23), rgba(255,255,255,.1)); }
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-iscreen-dock { background: rgba(8,13,20,.58); border-color: rgba(255,255,255,.34); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 18px 38px rgba(0,0,0,.28); }
.main:has(> .content > #view-home.active) .home-hero.lockscreen::after { background: linear-gradient(180deg, rgba(0,0,0,var(--home-overlay, .18)), transparent 42%, rgba(0,0,0,var(--home-overlay, .18))); }
.home-hero-tools { position: relative; display: flex; align-items: center; gap: 8px; }
.home-ios-grid { display: grid; gap: 12px; padding: 16px 28px 12px; color: #fff; }
.home-calendar-widget { display: grid; grid-template-columns: .9fr 1.1fr; gap: 12px; min-height: 176px; padding: 18px 20px; border: 1px solid rgba(255,255,255,.42); border-radius: 28px; background: rgba(255,255,255,.82); color: #17202b; box-shadow: 0 14px 30px rgba(0,0,0,.12), inset 0 1px 0 #fff; }
.home-calendar-date { display: flex; align-items: flex-start; gap: 10px; }
.home-calendar-date strong { font-size: 72px; font-weight: 400; line-height: .85; letter-spacing: -.08em; }
.home-calendar-date span { display: grid; gap: 4px; padding-top: 3px; color: #6d747c; font-size: 14px; }
.home-calendar-date em { color: #ef4b5b; font-style: normal; font-weight: 700; }
.home-calendar-month { display: grid; gap: 10px; align-content: start; }
.home-calendar-month > b { color: #ef4b5b; font-size: 24px; }
.home-week-row, .home-calendar-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; text-align: center; font-size: 12px; }
.home-week-row span:first-child, .home-week-row span:last-child { color: #8b9198; }
.home-calendar-dots { color: #303640; font-size: 13px; font-weight: 650; }
.home-calendar-dots span { display: grid; min-height: 21px; place-items: center; }
.home-calendar-dots .today { border-radius: 50%; background: #ef4b5b; color: #fff; }
.home-calendar-schedule { grid-column: 1 / -1; align-self: end; color: #737980; font-size: 20px; }
.home-ios-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.home-weather-widget, .home-square-widget, .home-app-tile, .home-photo-large, .home-search-pill, .home-ios-dock { border: 1px solid rgba(255,255,255,.3); color: #fff; background: rgba(255,255,255,.2); box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 10px 22px rgba(0,0,0,.1); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.home-weather-widget { display: grid; min-height: 154px; align-content: space-between; padding: 16px 18px; border-radius: 25px; text-align: left; background: linear-gradient(145deg, rgba(55,82,105,.9), rgba(28,41,55,.82)); }
.home-ios-location { font-size: 16px; font-weight: 650; }
.home-weather-widget strong { font-size: 62px; font-weight: 300; letter-spacing: -.08em; }
.home-weather-widget > span:last-child { font-size: 15px; }
.home-square-widget { display: grid; min-height: 154px; place-items: center; align-content: center; gap: 10px; border-radius: 25px; }
.home-square-widget svg { width: 52px; height: 52px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.home-square-widget b, .home-app-tile b, .home-photo-large b { font-size: 13px; }
.home-ios-row-apps { grid-template-columns: .8fr .8fr 1.8fr; }
.home-app-tile { display: grid; min-height: 120px; place-items: center; align-content: center; gap: 8px; border-radius: 23px; }
.home-app-glyph { display: grid; width: 55px; height: 55px; place-items: center; border-radius: 17px; background: linear-gradient(145deg, #f55b55, #d12632); font-size: 31px; }
.home-app-glyph.camera { background: linear-gradient(145deg, #d9dde0, #66727b); }
.home-photo-large { position: relative; display: grid; min-height: 120px; place-items: end start; overflow: hidden; padding: 14px; border-radius: 25px; text-align: left; }
.home-photo-large img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .8; }
.home-photo-large::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 40%, rgba(0,0,0,.5)); }
.home-photo-large b { position: relative; z-index: 1; }
.home-search-pill { justify-self: center; min-width: 120px; padding: 10px 18px; border-radius: 999px; font-size: 15px; }
.home-ios-dock { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px; border-radius: 27px; background: rgba(35,31,43,.48); }
.home-ios-dock button { display: grid; min-height: 60px; place-items: center; gap: 5px; border: 0; border-radius: 18px; background: rgba(255,255,255,.12); color: #fff; }
.home-ios-dock svg { width: 29px; height: 29px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.home-ios-dock span { font-size: 10px; }
.main:has(> .content > #view-home.active) .home-iscreen-widgets { display: none; }
.home-wallpaper-button { min-height: 30px; padding: 0 11px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; background: rgba(255,255,255,.16); color: rgba(255,255,255,.9); font-size: 11px; cursor: pointer; backdrop-filter: blur(16px); }
.home-wallpaper-button:hover { background: rgba(255,255,255,.26); }
.home-wallpaper-panel { position: absolute; z-index: 8; top: calc(100% + 9px); right: 0; display: grid; width: 190px; gap: 10px; padding: 12px; border: 1px solid rgba(255,255,255,.3); border-radius: 17px; background: rgba(28,34,44,.72); box-shadow: 0 12px 30px rgba(0,0,0,.22); backdrop-filter: blur(24px) saturate(1.2); }
.home-wallpaper-panel[hidden] { display: none; }
.home-wallpaper-panel label { display: grid; gap: 6px; color: rgba(255,255,255,.84); font-size: 11px; }
.home-wallpaper-panel input[type="range"] { width: 100%; accent-color: #fff; }
.home-wallpaper-panel button { min-height: 30px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; background: rgba(255,255,255,.12); color: #fff; font-size: 11px; cursor: pointer; }
.main:has(> .content > #view-home.active) .home-hero-grid { display: none; }
.main:has(> .content > #view-home.active) > .content .home-dock { display: none; }

/* 最终桌面收口：主屏组件必须可见。旧版覆盖曾同时隐藏 ios 网格、功能页和
   iScreen 组件，导致移动端只剩状态栏与空白背景。 */
.main:has(> .content > #view-home.active) .home-iscreen-widgets { display: grid; }

/* 无壁纸时采用浅色玻璃主题，避免白字落在浅色透明底上失去对比度。 */
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) {
  background: linear-gradient(180deg, #f7f7fa 0%, #e7e7ed 100%);
  color: #1c1c1e;
}
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-statusbar,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-social-widget,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-relationship-widget,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-small-widget {
  color: #1c1c1e;
  text-shadow: none;
}
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-social-widget,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-relationship-widget,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-small-widget {
  border-color: rgba(60,60,67,.14);
  background: rgba(255,255,255,.72);
  box-shadow: 0 10px 28px rgba(31,31,40,.08), inset 0 1px 0 rgba(255,255,255,.92);
}
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-widget-now,
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-photo-meta {
  color: #3a3a3c;
}
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-iscreen-dock {
  background: rgba(255,255,255,.56);
  border-color: rgba(60,60,67,.14);
  box-shadow: 0 12px 30px rgba(31,31,40,.1), inset 0 1px 0 rgba(255,255,255,.9);
}
.main:has(> .content > #view-home.active) .home-hero.lockscreen:not(.home-has-wallpaper) .home-iscreen-dock button {
  background: rgba(255,255,255,.58);
  color: #3a3a3c;
}
@media (max-width: 768px) {
  .main:has(> .content > #view-home.active) .home-hero.lockscreen { min-height: calc(100dvh - 62px); }
  .home-iscreen-widgets { gap: 10px; padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .home-social-widget { min-height: 142px; padding: 15px 16px 12px; border-radius: 24px; }
  .home-widget-avatar { width: 51px; height: 51px; }
  .home-social-copy strong { font-size: 17px; }
  .home-social-share { margin: 11px 0 9px; font-size: 12px; }
  .home-widget-pair { gap: 9px; }
  .home-photo-widget, .home-relationship-widget { min-height: 151px; padding: 12px; border-radius: 23px; }
  .home-widget-avatar-large { width: 57px; height: 57px; }
  .home-rel-copy { gap: 5px; padding-top: 2px; }
  .home-rel-copy strong { font-size: 16px; }
  .home-small-widgets { gap: 7px; }
  .home-small-widget { min-height: 91px; border-radius: 17px; }
  .home-small-icon { width: 43px; height: 43px; border-radius: 14px; font-size: 22px; }
  .home-iscreen-dock { border-radius: 23px; }
  .home-iscreen-dock button { min-height: 53px; border-radius: 15px; }
}
.relationship-network-events { margin-top:16px; padding:14px; border:1px solid var(--glass-border); border-radius:14px; background:var(--glass-bg); }
.relationship-network-events-title { font-size:13px; font-weight:700; margin-bottom:9px; }
.relationship-network-events-list { display:grid; gap:8px; }
.relationship-network-event { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px; border-radius:10px; background:rgba(201,169,110,.07); }
.relationship-network-event strong { font-size:13px; }
.relationship-network-event p { margin:4px 0 0; color:var(--text-dim); font-size:12px; line-height:1.5; }
.relationship-network-event-actions { display:flex; gap:6px; align-items:center; flex-shrink:0; }
.relationship-network-event.is-done { opacity:.55; }
.relationship-network-event-empty { color:var(--text-dim); font-size:12px; padding:4px 0; }
.relationship-event-preview-content { min-height: 72px; margin: 14px 0; padding: 13px; border-radius: 10px; background: rgba(201,169,110,.08); color: var(--text-secondary); font-size: 14px; line-height: 1.75; white-space: pre-wrap; }
@media (max-width:560px) { .relationship-network-event { align-items:flex-start; flex-direction:column; } .relationship-network-event-actions { width:100%; justify-content:flex-end; } }

/* 多日生活作息 */
.life-schedule-panel { margin-top: 14px; padding: 15px; border: 1px solid var(--glass-border); border-radius: 16px; background: var(--glass-bg); }
.life-schedule-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.life-schedule-head > div { display: grid; gap: 3px; }
.life-schedule-head strong { font-size: 15px; }.life-schedule-head span { color: var(--text-dim); font-size: 12px; }
.life-schedule-controls { display: grid; grid-template-columns: 1.1fr 1fr 1fr .7fr 1.2fr; gap: 8px; margin-top: 12px; }
.life-schedule-controls select, .life-schedule-controls input { min-width: 0; padding: 9px; border: 1px solid var(--glass-border); border-radius: 9px; background: var(--bg-card); color: var(--text-primary); }
.life-schedule-share { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; color: var(--text-secondary); font-size: 12px; }
.life-schedule-share > div { display: flex; flex-wrap: wrap; gap: 8px; }.life-schedule-share label { white-space: nowrap; }
.life-schedule-generate-status { min-height: 18px; margin-top: 9px; color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.life-schedule-list { display: grid; gap: 10px; margin-top: 13px; color: var(--text-dim); font-size: 12px; }
.life-schedule-day { display: grid; gap: 6px; }.life-schedule-day > strong { color: var(--text-secondary); }
.life-schedule-item { display: grid; grid-template-columns: 92px 1fr auto auto auto; gap: 8px; align-items: center; padding: 8px 9px; border-radius: 9px; background: rgba(201,169,110,.07); color: var(--text-secondary); }
.life-schedule-item time { color: var(--text-dim); font-variant-numeric: tabular-nums; }.life-schedule-item span { display: grid; gap: 2px; }.life-schedule-item small { color: var(--text-dim); }.life-schedule-item em { color: var(--accent); font-style: normal; font-size: 11px; }.life-schedule-item button { border: 0; background: transparent; color: var(--text-dim); font-size: 11px; cursor: pointer; }
.life-schedule-item.is-override { background: rgba(116, 178, 255, .12); outline: 1px solid rgba(116, 178, 255, .28); }.life-schedule-item.is-override em { color: #83b7ff; }
.life-schedule-draft-intro { padding: 10px 11px; border: 1px dashed rgba(116, 178, 255, .45); border-radius: 9px; color: var(--text-secondary); background: rgba(116, 178, 255, .07); }.life-schedule-draft-item { display: flex; gap: 10px; align-items: flex-end; padding: 10px; border: 1px solid rgba(116, 178, 255, .28); border-radius: 10px; background: rgba(116, 178, 255, .045); }.life-schedule-draft-fields { display: grid; grid-template-columns: 1fr 1fr 1.4fr 1fr; gap: 8px; flex: 1; }.life-schedule-draft-fields label { display: grid; gap: 4px; color: var(--text-dim); font-size: 11px; }.life-schedule-draft-fields input { min-width: 0; padding: 7px; border: 1px solid var(--glass-border); border-radius: 7px; background: var(--bg-card); color: var(--text-primary); }.life-schedule-draft-remove { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; white-space: nowrap; }.life-schedule-draft-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 11px; border-radius: 10px; background: rgba(116, 178, 255, .08); color: var(--text-secondary); font-size: 12px; }.life-schedule-draft-actions > div { display: flex; gap: 8px; }.life-schedule-draft-actions .primary { color: var(--accent); border-color: rgba(201,169,110,.45); }
@media (max-width: 620px) { .life-schedule-head { align-items: flex-start; flex-direction: column; }.life-schedule-controls { grid-template-columns: 1fr 1fr; }.life-schedule-item { grid-template-columns: 82px 1fr auto auto; }.life-schedule-item em { display: none; } }
@media (max-width: 760px) { .life-schedule-draft-fields { grid-template-columns: 1fr 1fr; } .life-schedule-draft-item { align-items: stretch; flex-direction: column; } .life-schedule-draft-remove { align-self: flex-end; } }

/* 单聊作息抽屉 */
.chat-routine-modal-content { width: min(680px, calc(100vw - 32px)); max-height: min(78vh, 720px); overflow: auto; padding: 20px; border-radius: 18px; background: var(--bg-card); box-shadow: 0 18px 54px rgba(0,0,0,.26); }
.modal-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }.chat-routine-subtitle { margin-top: 4px; color: var(--text-dim); font-size: 12px; }.modal-close-btn { border: 0; background: transparent; color: var(--text-dim); font-size: 24px; line-height: 1; cursor: pointer; }
.chat-routine-controls { display: flex; gap: 8px; margin: 14px 0; }.chat-routine-controls input, .chat-routine-controls select { min-width: 0; padding: 8px; border: 1px solid var(--glass-border); border-radius: 9px; background: var(--bg-card); color: var(--text-primary); }
.chat-routine-list { display: grid; gap: 16px; color: var(--text-dim); font-size: 13px; }.chat-routine-day { display: grid; gap: 8px; }.chat-routine-day-title { color: var(--text-secondary); font-size: 15px; }.chat-routine-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.chat-routine-lane { min-width: 0; padding: 11px; border: 1px solid var(--glass-border); border-radius: 13px; background: rgba(255,255,255,.025); }.chat-routine-lane header { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; color: var(--text-primary); }.chat-routine-lane header i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }.chat-routine-lane-user header i { background: #83b7ff; }.chat-routine-lane-items { display: grid; gap: 6px; }.chat-routine-item { display: grid; grid-template-columns: 76px 1fr; gap: 7px; padding: 8px; border-radius: 9px; background: rgba(201,169,110,.07); color: var(--text-secondary); }.chat-routine-lane-user .chat-routine-item { background: rgba(116,178,255,.08); }.chat-routine-item time { color: var(--text-dim); font-variant-numeric: tabular-nums; }.chat-routine-item span { display: grid; gap: 2px; min-width: 0; }.chat-routine-item small { color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.chat-routine-empty { padding: 8px; color: var(--text-dim); font-size: 12px; }
@media (max-width: 600px) { .chat-routine-pair { grid-template-columns: 1fr; } }
@media (max-width: 768px) { .chat-routine-btn.chat-header-btn { display: inline-flex; } }

.chat-header-btn.chat-scene-return-btn,
.chat-header-btn.chat-scene-location-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; min-width: 36px; padding: 0; }
.chat-scene-return-btn svg,
.chat-scene-location-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.chat-place-preset-intro { padding: 0 8px 16px; margin: 0 0 14px; border-bottom: 1px solid var(--glass-border); color: var(--text-dim); font-size: 11px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-place-presets { margin: 10px 0; padding: 10px; border: 1px solid var(--glass-border); border-radius: 12px; }
.chat-place-presets h3 { margin: 0 0 8px; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.chat-place-presets #chatPlacePresetEditor { display: grid; gap: 8px; }
.chat-place-presets #chatPlacePresetEditor > div { display: flex; flex-wrap: wrap; gap: 6px; }
.chat-place-presets input,
.chat-place-presets textarea { box-sizing: border-box; width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--glass-border); border-radius: 8px; background: var(--bg-card); color: var(--text-primary); font: inherit; }
.chat-place-presets textarea { min-height: 72px; resize: vertical; }
.chat-place-presets button,
.chat-scene-place-choice button,
.chat-scene-recent-places button { min-height: 32px; padding: 5px 9px; border: 1px solid var(--glass-border); border-radius: 8px; background: rgba(255,255,255,.04); color: var(--text-secondary); cursor: pointer; }
.chat-place-presets button:disabled { cursor: not-allowed; opacity: .55; }
.chat-place-preset-note { margin: 0; color: var(--text-dim); font-size: 11px; line-height: 1.5; }
.chat-scene-place-picker { display: grid; gap: 7px; }
.chat-scene-place-label { color: var(--text-secondary); font-size: 12px; }
.chat-scene-place-choice { display: flex; flex-wrap: wrap; gap: 7px; }
.chat-scene-place-choice select { flex: 1 1 180px; min-width: 0; }
.chat-scene-place-picker > input { width: 100%; box-sizing: border-box; }
.chat-scene-recent-places { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--text-dim); font-size: 11px; }
.chat-scene-panel-actions button:disabled { opacity: .55; cursor: wait; }
.chat-legacy-record { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.offline-reply-card { display: grid; gap: 9px; white-space: pre-wrap; overflow-wrap: anywhere; }
.offline-reply-card .offline-narration { border-left: 3px solid #dfc27f; padding: 2px 0 2px 9px; color: #85817a; font-size: 12px; font-weight: 400; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.offline-reply-card .offline-dialogue-bubbles { display: grid; gap: 6px; min-width: 0; max-width: 100%; color: inherit; font-size: inherit; font-weight: 400; line-height: 1.55; }
.offline-reply-card .offline-dialogue-line { margin: 0; padding: 0; color: inherit; font-size: inherit; font-weight: 400; line-height: inherit; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-role-unread-count { display: inline-flex; min-width: 18px; height: 18px; align-items: center; justify-content: center; padding: 0 5px; border-radius: 9px; color: #fff; background: #ef6b73; font-size: 11px; line-height: 18px; font-variant-numeric: tabular-nums; }

/* AI-010: responsive single-chat shell. This is the final ownership layer
   for chat geometry; the earlier view-specific rules remain available to
   other screens but cannot create a second scrolling surface here. */
.chat-view.active {
  min-width: 0;
  min-height: 0;
}
.chat-view.active > .chat-header,
.chat-view.active > .chat-input-bar {
  flex: 0 0 auto;
}
.chat-view.active > .chat-msgs {
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
}
.chat-view.active > .chat-proactive-panel,
.chat-view.active > .chat-scene-panel,
.chat-view.active > .quote-reply-bar,
.chat-view.active > .image-preview-bar {
  flex: 0 1 auto;
  min-height: 0;
  max-width: 100%;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .app:has(#view-chat.active),
  .app:has(#view-chat.active) > .main,
  .app:has(#view-chat.active) > .main > .content,
  .app:has(#view-chat.active) #view-chat.active {
    height: var(--visual-vh, 100dvh);
    min-height: 0;
    max-height: var(--visual-vh, 100dvh);
  }
  .app:has(#view-chat.active) > .main,
  .app:has(#view-chat.active) > .main > .content,
  .app:has(#view-chat.active) #view-chat.active { overflow: hidden; }
  .app:has(#view-chat.active) > .main > .content { display: flex; flex-direction: column; padding: 0; }

  .chat-view.active > .chat-header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px;
    width: 100%;
    min-height: 58px;
    padding: 6px 8px;
    box-sizing: border-box;
  }
  .chat-view.active > .chat-header .chat-header-info {
    position: static;
    inset: auto;
    width: min(100%, 220px);
    min-width: 0;
    transform: none;
    justify-self: center;
    overflow: hidden;
  }
  .chat-view.active > .chat-header .chat-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 84px;
    margin-left: 0;
  }
  .chat-view.active > .chat-header .chat-header-btn { display: none !important; }
  .chat-view.active > .chat-header .chat-scene-return-btn:not([hidden]),
  .chat-view.active > .chat-header .chat-scene-location-btn:not([hidden]) { display: inline-flex !important; }
  .chat-view.active > .chat-header .chat-back-btn,
  .chat-view.active > .chat-header .chat-mobile-more-btn { min-width: 44px; min-height: 44px; }
  .chat-view.active > .chat-header .rel-capsule-wrap { min-width: 0; }
  .chat-view.active > .chat-header .rel-capsule { max-width: 36px; overflow: hidden; }

  .chat-view.active > .chat-msgs {
    flex: 1 1 0;
    padding: 12px 10px 8px !important;
    -webkit-overflow-scrolling: touch;
  }
  .chat-view.active > .chat-proactive-panel { max-height: min(38dvh, 320px); overflow-y: auto; overflow-x: hidden; }
  .chat-view.active > .chat-scene-panel { max-height: min(55dvh, 440px); overflow-y: auto; overflow-x: hidden; }
  .chat-view.active > .quote-reply-bar,
  .chat-view.active > .image-preview-bar { max-height: min(18dvh, 120px); overflow-y: auto; overflow-x: hidden; }
  .chat-view.active > .chat-input-bar {
    min-height: 50px;
    max-height: min(35dvh, 180px);
    width: 100%;
    box-sizing: border-box;
    overflow: visible;
  }
  body.keyboard-open .app:has(#view-chat.active),
  body.keyboard-open .app:has(#view-chat.active) > .main,
  body.keyboard-open .app:has(#view-chat.active) > .main > .content,
  body.keyboard-open .app:has(#view-chat.active) #view-chat.active {
    height: var(--visual-vh, 100dvh);
    max-height: var(--visual-vh, 100dvh);
  }
}

@media (max-width: 390px) {
  .chat-view.active > .chat-header { grid-template-columns: 44px minmax(0, 1fr) 84px; padding-left: 4px; padding-right: 4px; }
  .chat-view.active > .chat-header .chat-header-info { width: min(100%, 190px); }
}

/* AI-009 responsive refactor: one final mobile chat layout contract. Older
   mobile rules above are intentionally kept for non-chat views, while this
   block owns the active single-chat geometry at the narrow breakpoints. */
@media (max-width: 768px) {
  .chat-view:not(.group-mode) > .chat-header {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    align-items: center;
    gap: 4px;
    min-height: 58px;
    padding: 6px 8px;
    box-sizing: border-box;
  }
  .chat-view:not(.group-mode) > .chat-header .chat-header-info {
    position: static;
    inset: auto;
    width: min(100%, 220px);
    min-width: 0;
    transform: none;
    justify-self: center;
    overflow: hidden;
  }
  .chat-view:not(.group-mode) > .chat-header .chat-header-info::after { flex: 0 0 auto; }
  .chat-view:not(.group-mode) > .chat-header .chat-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    min-width: 88px;
    margin-left: 0;
  }
  .chat-view:not(.group-mode) > .chat-header .chat-back-btn,
  .chat-view:not(.group-mode) > .chat-header .chat-mobile-more-btn { min-width: 44px; min-height: 44px; }
  .chat-view:not(.group-mode) > .chat-header .rel-capsule-wrap { min-width: 0; }
  .chat-view:not(.group-mode) > .chat-header .rel-capsule { max-width: 36px; overflow: hidden; }
  .chat-view:not(.group-mode) > .chat-header .rel-capsule-expanded { right: 0; max-height: min(62dvh, 480px); }

  .chat-view:not(.group-mode) > .chat-msgs {
    flex: 1 1 0;
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: auto;
    overscroll-behavior-y: contain;
    padding: 12px 10px 8px !important;
  }
  .chat-view:not(.group-mode) > .chat-input-bar {
    flex: 0 0 auto;
    min-height: 50px;
    max-height: min(35dvh, 180px);
    box-sizing: border-box;
    overflow: visible;
  }
  body.keyboard-open .chat-view:not(.group-mode) > .chat-msgs,
  .chat-view:not(.group-mode):has(#chatInput:focus) > .chat-msgs { flex-basis: 0; }
}

@media (max-width: 390px) {
  .chat-view:not(.group-mode) > .chat-header { grid-template-columns: 44px minmax(0, 1fr) 84px; padding-left: 4px; padding-right: 4px; }
  .chat-view:not(.group-mode) > .chat-header .chat-header-info { width: min(100%, 190px); }
  .chat-view:not(.group-mode) > .chat-header .chat-header-actions { min-width: 84px; }
}

/* AI-011: the mobile message viewport must remain a flex column. An older
   keyboard rule changed it to display:block, so the message tail and the
   composer could drift apart while iOS resized the visual viewport. */
@media (max-width: 768px) {
  .chat-view.active > .chat-msgs,
  .chat-view:not(.group-mode) > .chat-msgs,
  body.keyboard-open .chat-view:not(.group-mode) > .chat-msgs,
  .chat-view:not(.group-mode):has(#chatInput:focus) > .chat-msgs {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch;
    gap: 12px;
    min-height: 0;
    padding-bottom: 8px !important;
  }
}

/* REQ010: keep the mobile header hit targets stationary while the software
   keyboard opens/closes. Blur must not switch the app from the keyboard's
   fixed viewport positioning back to the document-flow layout mid-tap. */
@media (max-width: 768px) {
  .app:has(#view-chat.active.req010-ordinary-chat) {
    position: fixed !important;
    inset: var(--visual-viewport-offset, 0px) 0 auto 0 !important;
    height: var(--visual-vh, 100dvh) !important;
    min-height: var(--visual-vh, 100dvh) !important;
  }
  .app:has(#view-chat.active.req010-ordinary-chat) > .main,
  .app:has(#view-chat.active.req010-ordinary-chat) > .main > .content,
  .app:has(#view-chat.active.req010-ordinary-chat) #view-chat.active {
    height: var(--visual-vh, 100dvh) !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
  }
  .app:has(#view-chat.active.req010-ordinary-chat) > .main > .content {
    padding: 0 !important;
  }
  .chat-view.req010-ordinary-chat > .chat-header,
  body.keyboard-open .chat-view.req010-ordinary-chat > .chat-header,
  .chat-view.req010-ordinary-chat:has(#chatInput:focus) > .chat-header {
    display: grid !important;
    flex: 0 0 58px !important;
    height: 58px !important;
    min-height: 58px !important;
    margin: 0 !important;
    padding: 6px 8px !important;
    box-sizing: border-box;
  }
  .chat-view.req010-ordinary-chat.active > .chat-header .chat-header-actions {
    flex: 0 0 168px;
    width: 168px;
    min-width: 168px;
    height: 44px;
    flex-wrap: nowrap;
    gap: 4px;
    overflow: visible;
  }
  .chat-view.req010-ordinary-chat.active > .chat-header .chat-scene-return-btn:not([hidden]),
  .chat-view.req010-ordinary-chat.active > .chat-header .chat-scene-location-btn:not([hidden]) {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
  }
  .chat-view.req010-ordinary-chat.active > .chat-header .rel-capsule-wrap {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
  }
  .chat-view.req010-ordinary-chat.active > .chat-header .chat-mobile-more-btn {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 390px) {
  .chat-view.req010-ordinary-chat > .chat-header,
  body.keyboard-open .chat-view.req010-ordinary-chat > .chat-header,
  .chat-view.req010-ordinary-chat:has(#chatInput:focus) > .chat-header {
    padding-right: 4px !important;
    padding-left: 4px !important;
  }
  .chat-view.req010-ordinary-chat > .chat-header { grid-template-columns: 44px minmax(0, 1fr) 168px; }
}

/* ===== REQ-20260906-003 音乐首页改版 + 共听 ===== */
.music-gear-btn { white-space: nowrap; }
.music-settings-card { overflow: hidden; transition: max-height .25s ease, opacity .2s ease; }
.music-settings-card.is-collapsed { max-height: 0 !important; opacity: 0; padding-top: 0; padding-bottom: 0; margin: 0; border: 0; pointer-events: none; }

.music-home-section { margin-top: 16px; }
.music-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 0 0 10px; padding: 0 2px;
}
.music-section-head strong { font-size: 15px; color: var(--text-primary, #3d3427); }
.music-more-btn {
  border: 0; background: transparent; color: var(--text-dim, #98918a);
  font-size: 12px; cursor: pointer; padding: 4px 6px; border-radius: 8px;
}
.music-more-btn:hover { background: rgba(0,0,0,.04); color: var(--text-primary, #3d3427); }

/* 每日推荐入口卡 */
.music-entry-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.music-entry-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 12px; border: 1px solid var(--border, rgba(125,125,135,.18)); border-radius: 14px;
  background: var(--surface, #fff); cursor: pointer; text-align: left;
}
.music-entry-card:hover { border-color: rgba(189,152,77,.5); }
.music-entry-card strong { font-size: 13px; color: var(--text-primary, #3d3427); }
.music-entry-card small { font-size: 11px; color: var(--text-dim, #98918a); }
.music-entry-cover {
  width: 34px; height: 34px; border-radius: 10px; margin-bottom: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
}
.music-entry-cover-daily { background: linear-gradient(135deg, #8e9bfa, #5a6cf0); }
.music-entry-cover-fm { background: linear-gradient(135deg, #f0a05a, #e07a3f); }

/* 歌单卡片网格 */
.music-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.music-playlist-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 0 0 8px; border: 0; background: transparent; cursor: pointer; text-align: left;
}
.music-playlist-card:hover strong { color: #8a6d2f; }
.music-playlist-cover {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 12px; overflow: hidden;
  background: linear-gradient(135deg, #b7bdfa, #8e9bfa); margin-bottom: 2px; display: block;
}
.music-playlist-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.music-playlist-card strong { font-size: 12px; color: var(--text-primary, #3d3427); line-height: 1.35; }
.music-playlist-card small { font-size: 11px; color: var(--text-dim, #98918a); }

/* 歌单详情 */
.music-playlist-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.music-playlist-meta { display: flex; flex-direction: column; }
.music-playlist-meta strong { font-size: 14px; color: var(--text-primary, #3d3427); }
.music-playlist-meta small { font-size: 11px; color: var(--text-dim, #98918a); }

/* 播放历史行 */
.music-history-list { display: flex; flex-direction: column; gap: 6px; }
.music-history-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 1px solid var(--border, rgba(125,125,135,.14));
  border-radius: 12px; background: var(--surface, #fff); cursor: pointer; text-align: left;
}
.music-history-row:hover { border-color: rgba(189,152,77,.45); }
.music-history-cover {
  width: 40px; height: 40px; border-radius: 10px; overflow: hidden; flex: none;
  background: linear-gradient(135deg, #c9cdfb, #9aa4fb); display: block;
}
.music-history-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.music-history-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.music-history-copy strong { font-size: 13px; color: var(--text-primary, #3d3427); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-history-copy small { font-size: 11px; color: var(--text-dim, #98918a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-history-time { flex: none; font-size: 11px; color: var(--text-dim, #98918a); }

/* Cookie 引导 */
.music-cookie-guide {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px dashed rgba(189,152,77,.5); border-radius: 12px;
  font-size: 12px; color: #8a6d2f; background: rgba(189,152,77,.06);
}

/* 音乐卡片"一起听"按钮 */
.warm-music-card-actions { display: inline-flex; align-items: center; gap: 6px; }
.warm-music-together {
  border: 1px solid rgba(90,108,240,.45); background: rgba(90,108,240,.08);
  border-radius: 999px; width: 28px; height: 28px; font-size: 13px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.warm-music-together:hover { background: rgba(90,108,240,.18); }

/* 迷你条一起听按钮 */
.warm-music-player-controls [data-music-player-together] {
  border: 0; background: transparent; font-size: 15px; cursor: pointer; opacity: .85;
}
.warm-music-player-controls [data-music-player-together]:hover { opacity: 1; transform: scale(1.08); }

/* 全局共听横幅（REQ-20260907-005）：所有视图可见，锚定在迷你播放器上方 */
.shared-music-banner {
  position: fixed;
  right: 12px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 84px);
  z-index: 1150;
  display: flex; align-items: center; gap: 8px;
  max-width: min(430px, calc(100vw - 24px));
  padding: 8px 12px;
  border: 1px solid rgba(90,108,240,.35); border-radius: 999px;
  background: color-mix(in srgb, var(--glass-bg, #fff) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  font-size: 12px; color: #4a56c9;
}
.shared-music-banner[hidden] { display: none; }
/* 桌面端：迷你条更宽且双行（进度条），横幅随之抬高、右缘对齐 22px */
@media (min-width: 769px) {
  .shared-music-banner { right: 22px; bottom: 160px; }
}
/* 聊天页（≤768px）迷你条被输入区抬高（--chat-bottom-gap），横幅同步上移 */
@media (max-width: 768px) {
  body:has(#view-chat.active) .shared-music-banner { bottom: calc(var(--chat-bottom-gap, 140px) + 84px); }
}
.shared-music-banner-disc { font-size: 14px; }
.shared-music-banner-copy { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shared-music-banner-close {
  flex: none; border: 1px solid rgba(90,108,240,.4); border-radius: 999px;
  background: transparent; color: #4a56c9; font-size: 11px; padding: 3px 10px; cursor: pointer;
}
.shared-music-banner-close:hover { background: rgba(90,108,240,.12); }

@media (max-width: 640px) {
  .music-entry-grid, .music-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 音乐页 Cookie 输入：大输入框 + 实时提示 */
.music-cookie-textarea { min-height: 110px; font-size: 12px; line-height: 1.6; word-break: break-all; resize: vertical; }
.music-cookie-hint { margin-top: 4px; color: #8a6d2f; }

/* ==========================================================
   REQ-20260907-005：移动端导航抽屉 / 角色 sheet / 横幅 / Dock
   ========================================================== */

/* 桌面端一律隐藏移动端专属组件（I2：桌面聊天头部无 [≡]）。 */
.chat-drawer-btn, .mobile-dock-btn { display: none; }

/* ---- 底部 Dock（M4）---- */
@media (max-width: 768px) {
  .sidebar-nav > .nav-item { display: none !important; }
  .mobile-dock-btn {
    display: inline-flex;
    flex: 1 1 auto;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 15px;
    background: rgba(0,122,255,.12);
    color: var(--ui-blue);
    transition: transform .1s ease;
  }
  .mobile-dock-btn:active { transform: scale(0.95); }
  .mobile-dock-icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-dock-btn[data-mode="back"] { background: rgba(0,122,255,.08); }
  .mobile-dock-btn .mobile-dock-icon-back { display: none; }
  .mobile-dock-btn[data-mode="back"] .mobile-dock-icon-back { display: block; }
  .mobile-dock-btn[data-mode="back"] .mobile-dock-icon-menu { display: none; }
}

/* ---- 聊天头部汉堡（M2.1）---- */
@media (max-width: 768px) {
  .chat-drawer-btn {
    display: inline-flex;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ui-line);
    border-radius: 50%;
    background: rgba(255,255,255,.7);
    color: var(--ui-text);
  }
  .chat-drawer-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .chat-drawer-btn:active { transform: scale(0.95); }
  /* M2.1：头部三按钮 = [≡] 角色名 [•••]，返回聊天交给浏览器后退与 Dock。 */
  .chat-back-btn { display: none; }
}

/* ---- 抽屉（3.2 / 3.4 / M7）---- */
.drawer-nav { position: fixed; inset: 0; z-index: 1000; }
.drawer-nav[hidden] { display: none; }
.drawer-nav-backdrop {
  position: absolute; inset: 0; z-index: 999;
  background: rgba(0,0,0,.32);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.drawer-nav-panel {
  position: absolute; top: 0; bottom: 0; left: 0; z-index: 1000;
  display: flex; flex-direction: column;
  width: min(280px, 80vw);
  box-sizing: border-box;
  background: var(--ui-surface-solid, #fff);
  border-radius: 0 16px 16px 0;
  box-shadow: 8px 0 28px rgba(0,0,0,.12);
  padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
  /* 键盘弹出时 --visual-vh 缩短 → 抽屉整体变矮，导航列表内部滚动（M7.2）。 */
  height: var(--visual-vh, 100dvh);
  animation: drawerNavIn 220ms ease-out;
}
.drawer-nav.is-closing .drawer-nav-panel { animation: drawerNavOut 180ms ease-in forwards; }
.drawer-nav.is-closing .drawer-nav-backdrop { animation: drawerFadeOut 180ms ease-in forwards; }
@keyframes drawerNavIn { from { transform: translateX(-100%); } to { transform: translateX(0); } }
@keyframes drawerNavOut { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@keyframes drawerFadeOut { from { opacity: 1; } to { opacity: 0; } }

/* 角色信息区（M3.2）：折叠 60px，展开最大 200px 内部滚动。 */
.drawer-nav-role { flex-shrink: 0; border-bottom: 1px solid var(--ui-line); }
.drawer-nav-role-summary {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 60px; box-sizing: border-box;
  padding: 8px 16px;
  border: 0; background: none; color: var(--ui-text); text-align: left;
}
.drawer-nav-role-avatar {
  position: relative; flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 50%; overflow: hidden;
  background: rgba(0,122,255,.1);
  display: flex; align-items: center; justify-content: center;
}
.drawer-nav-role-avatar img { width: 100%; height: 100%; object-fit: cover; }
.drawer-nav-role-avatar-fallback { font-size: 20px; }
.drawer-nav-role-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.drawer-nav-role-meta strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-nav-role-meta small { color: var(--ui-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-nav-role-chevron { margin-left: auto; flex-shrink: 0; width: 18px; height: 18px; fill: none; stroke: var(--ui-muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s ease; }
.drawer-nav-role[aria-expanded="true"] .drawer-nav-role-chevron { transform: rotate(180deg); }
.drawer-nav-role-details { max-height: 200px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 2px 16px 12px; box-sizing: border-box; }
.drawer-role-bars { display: flex; flex-direction: column; gap: 6px; }
.drawer-role-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ui-muted); }
.drawer-role-bar { flex: 1; height: 6px; border-radius: 999px; background: rgba(0,122,255,.1); overflow: hidden; }
.drawer-role-bar-fill { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--ui-blue); transition: width .3s ease; }
.drawer-role-bar-fill.drawer-role-bar-intimacy { background: var(--ui-pink, #ff5f9e); }
.drawer-role-bar-fill.drawer-role-bar-trust { background: var(--ui-green, #34c759); }
.drawer-role-bar-val { min-width: 24px; text-align: right; font-size: 11px; }
.drawer-role-desire { margin-top: 8px; font-size: 12px; color: var(--ui-muted); line-height: 1.5; }

/* 导航列表（M3.4 / M7.1）：超出滚动，单条 48px。 */
.drawer-nav-list {
  flex: 1 1 0; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.drawer-nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 48px; box-sizing: border-box;
  padding: 0 16px;
  border: 0; border-bottom: 1px solid var(--ui-line);
  background: none; color: var(--ui-text); font-size: 15px; text-align: left;
}
.drawer-nav-item:active { background: rgba(0,122,255,.08); }
/* 共生空间入口是唯一 <a> 项：去链接下划线，复用按钮语义样式 */
a.drawer-nav-item { text-decoration: none; }
.drawer-nav-icon { flex-shrink: 0; width: 20px; text-align: center; font-size: 16px; line-height: 1; }

/* 账号区（M3.5 / M7.4） */
.drawer-nav-footer {
  flex-shrink: 0; min-height: 60px; box-sizing: border-box;
  padding: 10px 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  border-top: 1px solid var(--ui-line);
  display: flex; align-items: center;
}
.drawer-nav-login { flex: 1; min-height: 40px; border: 0; background: none; color: var(--ui-blue); font-size: 14px; text-align: left; }
.drawer-nav-account { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.drawer-nav-account-user { display: flex; align-items: center; gap: 8px; min-width: 0; border: 0; background: none; color: var(--ui-text); font-size: 14px; }
.drawer-nav-account-avatar { flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: rgba(0,122,255,.1); display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 16px; }
.drawer-nav-account-avatar img { width: 100%; height: 100%; object-fit: cover; }
.drawer-nav-account-user span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-nav-logout { flex-shrink: 0; min-height: 32px; padding: 4px 10px; border: 1px solid var(--ui-line); border-radius: 999px; background: none; color: var(--ui-red, #ff3b30); font-size: 12px; }

/* 抽屉打开时锁定背景滚动（M2.2.1 / 规格 3.4：fixed + top 保滚动位置，仅移动端）。 */
body.drawer-open { overflow: hidden; }
@media (max-width: 768px) {
  body.drawer-open { position: fixed; width: 100%; top: var(--scroll-top, 0px); }
}

/* ---- 切换角色 sheet（M3.3）---- */
.role-switch-sheet { position: fixed; inset: 0; z-index: 1100; }
.role-switch-sheet[hidden] { display: none; }
.role-switch-sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.32); }
.role-switch-sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  max-height: min(70dvh, 560px);
  box-sizing: border-box;
  padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
  border-radius: 20px 20px 0 0;
  background: var(--ui-surface-solid, #fff);
  box-shadow: 0 -12px 40px rgba(0,0,0,.18);
  animation: roleSheetIn 220ms ease-out;
}
@keyframes roleSheetIn { from { transform: translateY(100%); } to { transform: translateY(0); } }
.role-switch-sheet-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10px; }
.role-switch-sheet-head strong { font-size: 17px; }
.role-switch-sheet-head button { border: 0; background: none; color: var(--ui-blue); font-size: 15px; }
.role-switch-sheet-list { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.role-switch-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 56px; box-sizing: border-box;
  padding: 8px 4px;
  border: 0; border-bottom: 1px solid var(--ui-line);
  background: none; color: var(--ui-text); font-size: 15px; text-align: left;
}
.role-switch-item img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: rgba(0,122,255,.1); }
.role-switch-item .role-switch-current { margin-left: auto; flex-shrink: 0; padding: 3px 10px; border-radius: 999px; background: rgba(0,122,255,.12); color: var(--ui-blue); font-size: 12px; }
.role-switch-item.is-current { font-weight: 600; }
.role-switch-empty { padding: 24px 4px; color: var(--ui-muted); font-size: 14px; text-align: center; }

/* ---- 聊天头部“生成中…”指示器（M5.2.2.1）---- */
.chat-generating-indicator { display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; color: var(--ui-muted); font-size: 12px; vertical-align: middle; }
.chat-generating-indicator[hidden] { display: none; }
.chat-generating-spinner, .aux-generating-spinner {
  width: 12px; height: 12px; box-sizing: border-box;
  border: 2px solid rgba(120,120,128,.3); border-top-color: var(--ui-muted);
  border-radius: 50%; animation: chatGeneratingSpin 900ms linear infinite;
}
.aux-generating-spinner { border-top-color: var(--ui-blue); }
@keyframes chatGeneratingSpin { to { transform: rotate(360deg); } }
.chat-generating-indicator.is-failed { color: var(--ui-red, #ff3b30); cursor: pointer; }
.chat-generating-indicator.is-failed .chat-generating-spinner { animation: none; border: 0; border-radius: 0; width: auto; height: auto; }
.chat-generating-indicator.is-failed .chat-generating-spinner::before { content: "⚠️"; font-size: 12px; }

/* ---- 辅助页“聊天生成中”横幅（M5.2.2.2）---- */
.aux-generating-banner {
  position: fixed; top: calc(env(safe-area-inset-top, 0px) + 8px); left: 50%; transform: translateX(-50%);
  z-index: 800;
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px; max-width: calc(100vw - 24px);
  border-radius: 999px;
  background: rgba(0,122,255,.08);
  color: var(--ui-blue); font-size: 13px; white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.aux-generating-banner[hidden] { display: none; }
.aux-generating-banner.is-failed { background: rgba(255,59,48,.12); color: var(--ui-red, #ff3b30); }
.aux-generating-banner.is-failed .aux-generating-spinner { animation: none; border: 0; border-radius: 0; width: auto; height: auto; }
.aux-generating-banner.is-failed .aux-generating-spinner::before { content: "⚠️"; font-size: 13px; }

/* ---- 离线横幅（M6.1.7）---- */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1200;
  display: flex; align-items: center; justify-content: center;
  min-height: 34px; padding: 6px 12px calc(env(safe-area-inset-top, 0px) + 6px);
  background: rgba(255,59,48,.92); color: #fff; font-size: 13px;
}
.offline-banner[hidden] { display: none; }

/* ---- 失败消息重试/取消（M6.1.1）---- */
.chat-msg-send-failed {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px; font-size: 12px; color: var(--ui-red, #ff3b30);
  justify-content: flex-end;
}
.chat-msg-send-failed .chat-msg-retry-btn {
  min-height: 28px; padding: 3px 12px;
  border: 1px solid rgba(0,122,255,.4); border-radius: 999px;
  background: none; color: var(--ui-blue); font-size: 12px;
}
.chat-msg-send-failed .chat-msg-cancel-btn {
  min-height: 28px; padding: 3px 8px;
  border: 0; border-radius: 999px; background: none;
  color: var(--ui-muted); font-size: 12px;
}

/* 单聊失败/核对状态使用中性占位；真实状态与诊断仍保存在消息数据中。 */
.chat-status-loading { min-height: 18px; align-items: center; }
.chat-terminal-placeholder { color: var(--text-dim); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .chat-terminal-placeholder { max-width: 100%; }
  .chat-status-loading { gap: 4px; }
}

@media (max-width: 768px) {
  .chat-mobile-more-btn { margin-left: auto; }
}

/* 横屏：抽屉宽度固定 280px，内部滚动（M7.3）。 */
@media (max-width: 768px) and (orientation: landscape) {
  .drawer-nav-panel { width: 280px; }
}

/* ==========================================================
   REQ-20260907-005 音乐体验修复：一起听按钮三态 + 播放器拖动
   ========================================================== */

/* 一起听 🎧 三态：默认（邀请当前角色一起听）/ is-inviting（邀请中，脉冲+禁点）/ is-active（已共听，主题色高亮，点击结束） */
.warm-music-together.is-inviting,
.warm-music-player-controls [data-music-player-together].is-inviting {
  pointer-events: none;
  opacity: .55;
  animation: warm-together-pulse 1.1s ease-in-out infinite;
}
.warm-music-together.is-active {
  border-color: rgba(189,152,77,.75);
  background: rgba(189,152,77,.18);
  color: #8a6d2f;
}
.warm-music-player-controls [data-music-player-together].is-active {
  opacity: 1;
  color: var(--accent, #c49b50);
  filter: drop-shadow(0 0 6px rgba(196,155,80,.5));
}
@keyframes warm-together-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.14); }
}
@media (prefers-reduced-motion: reduce) {
  .warm-music-together.is-inviting,
  .warm-music-player-controls [data-music-player-together].is-inviting { animation: none; }
}

/* 播放器拖动：手柄 = 封面 + 歌名区；按钮/进度/音量不受影响 */
.warm-music-player-cover,
.warm-music-player-copy {
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.warm-music-player.is-dragging,
.warm-music-player.is-dragging .warm-music-player-cover,
.warm-music-player.is-dragging .warm-music-player-copy { cursor: grabbing; }
.warm-music-player.is-dragging .warm-music-player-copy { pointer-events: none; }
/* 自由定位：JS 写入 --player-left/--player-top；覆盖各断点的 right/bottom 锚定（特异性 0,2,0 > 媒体查询 0,1,0） */
.warm-music-player.is-free-positioned {
  left: var(--player-left, auto);
  top: var(--player-top, auto);
  right: auto;
  bottom: auto;
  width: min(430px, calc(100vw - 32px));
}

/* fee=8「登录可听」/「需购专辑」中性角标（REQ-20260910-004） */
.warm-music-fee-tag.is-other { border: 1px solid rgba(125, 125, 135, .35); background: rgba(125, 125, 135, .08); color: var(--text-secondary, #777); }

/* ==========================================================
   M2-001：正在播放页沉浸歌词（多行轮播 + 卡拉OK着色 + 点行 seek）
   ========================================================== */
@property --np-fill { syntax: "<percentage>"; inherits: false; initial-value: 0%; }
.np-lyrics-panel {
  position: relative; width: 100%; max-width: 480px;
  height: clamp(190px, 36vh, 340px); overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(transparent, #000 16%, #000 84%, transparent);
}
.np-lyrics-panel[hidden] { display: none; }
.np-lyrics-scroll { position: absolute; inset: 0; overflow-y: auto; scrollbar-width: none; padding: clamp(70px, 16vh, 150px) 6px; }
.np-lyrics-scroll::-webkit-scrollbar { display: none; }
.np-line {
  padding: 7px 8px; font-size: 15px; line-height: 1.55; border-radius: 8px;
  color: var(--text-secondary, #6f6a60); opacity: .5; cursor: pointer;
  transition: opacity .35s ease, font-size .35s ease;
}
.np-line:hover { opacity: .85; }
.np-line.is-current {
  font-size: 19px; font-weight: 700; opacity: 1;
  color: transparent;
  background-image: linear-gradient(90deg,
    var(--accent, #c49b50) var(--np-fill, 0%),
    color-mix(in srgb, var(--accent, #c49b50) 32%, var(--text-secondary, #6f6a60)) var(--np-fill, 0%));
  -webkit-background-clip: text; background-clip: text;
  transition: --np-fill .4s linear;
}
.np-lyrics-toggle {
  border: 0; background: transparent; width: 36px; height: 28px; border-radius: 8px;
  font-size: 14px; color: var(--text-secondary, #6f6a60); cursor: pointer;
}
.np-lyrics-toggle.is-on { background: rgba(189, 152, 77, .16); color: var(--accent, #c49b50); font-weight: 700; }
#warmMusicNowPlaying.is-immersive .np-disc,
#warmMusicNowPlaying.is-immersive .np-queue,
#warmMusicNowPlaying.is-immersive .np-album { display: none; }
#warmMusicNowPlaying.is-immersive .np-lyrics-panel { height: min(66vh, 600px); max-width: 560px; }
@media (max-width: 600px) {
  #warmMusicNowPlaying.is-immersive .np-lyrics-panel { height: 58vh; }
}

/* ===== REQ-20260928-001 F1 聚合 pill + F2 已读回执（两态 D6）+ D18 设置样式 =====
 * 视觉规格依据 UI 确认文档 v1.1（§0.3 变量 / §1.1 pill / §2 已读勾）。
 * 注意：test_frontend_chain.js 只读 styles.css，新增样式断言落 test_chat_batch_wiring.js。 */
:root {
  --chat-read-check: #07c160;           /* 已读 ✓✓（浅色，取已确认原型 .st-read 语义绿） */
  --chat-status-clock: #b9b9c0;         /* 发送中 ⏱ 灰（弱化常驻，D6） */
  --chat-status-icon-size: 14px;
  --chat-agg-pill-bg: rgba(31, 31, 40, .82);
  --chat-agg-pill-fg: #fff;
  --chat-agg-pill-accent: #a5e8c0;
  --chat-pop-ease: cubic-bezier(.3, 1.6, .5, 1);
}
html[data-theme="dark"] {
  --chat-read-check: #30d158;
  --chat-status-clock: #8e8e93;
  --chat-agg-pill-bg: rgba(44, 44, 46, .92);
  --chat-agg-pill-fg: #f5f5f7;
  --chat-agg-pill-accent: #7ed8a8;
}
/* F2 状态图标：时间行内（时间 → 状态图标 → 收藏 ⭐），占位固定不跳动。 */
.msg-status {
  display: inline-flex;
  width: var(--chat-status-icon-size);
  height: var(--chat-status-icon-size);
  margin-left: 4px;
  vertical-align: -2px;
}
.msg-status svg { width: 100%; height: 100%; display: block; }
.msg-status[data-state="sending"] { color: var(--chat-status-clock); }
.msg-status[data-state="read"] { color: var(--chat-read-check); animation: chatStatusPop .32s var(--chat-pop-ease); }
/* D6 两态显示：sent 内部态与开关关闭态用占位可见性（防时间行宽度跳动），渲染层直接不输出 span。 */
.msg-status.is-hidden { visibility: hidden; }
@keyframes chatStatusPop {
  0% { transform: scale(.3); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
/* F1 聚合提示 pill（队列指示器承载位改造）：居中小 pill，窗口期常显（含单条 N=1）。 */
.chat-agg-pill {
  width: fit-content;
  margin: 4px auto;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--chat-agg-pill-bg);
  color: var(--chat-agg-pill-fg);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 3px 10px rgba(31, 31, 40, .22);
  pointer-events: none;
}
/* F1 A1 打断重生成：半截回复气泡淡出移除。 */
.chat-row-removing {
  opacity: 0;
  transform: translateY(-6px) scale(.98);
  transition: opacity .3s ease, transform .3s ease;
}
/* D18 聚合节奏三档分段（复用 contacts-filter 分段形态，选中金字 accent）。 */
.chat-agg-seg {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}
.chat-agg-seg button {
  flex: 1;
  min-height: 44px;
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  background: transparent;
  color: var(--ui-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chat-agg-seg button.active {
  border-color: var(--accent, #c49b50);
  color: var(--accent, #c49b50);
  background: rgba(189, 152, 77, .12);
}
@media (prefers-reduced-motion: reduce) {
  .msg-status[data-state="read"] { animation: none; }
  .chat-row-removing { transition: none; }
}

/* ===== REQ-20260928-001 F3 emoji 表情包 + F4 反应徽章（UI 确认文档 v1.1 §3/§4/§6） =====
 * 注意：test_frontend_chain.js 只读 styles.css，本区块的样式断言由
 * backend/test_chat_batch_wiring.js 自行补读 styles-v2.css 承载。 */
:root {
  --chat-reaction-bg: #fff;                      /* 反应徽章底（徽章同时是描边色） */
  --chat-reaction-shadow: 0 3px 10px rgba(31, 31, 40, .22);
  --chat-danger: #fa5151;                        /* "新"角标/危险色（原型 --danger 同值） */
  --chat-emoji-big-size: 42px;                   /* 纯 emoji 放大字号（原型 .emoji-big 同值） */
  --chat-rx-pop-ease: cubic-bezier(.3, 1.8, .45, 1); /* 徽章弹跳（原型 rxPop 同值） */
  --chat-overlay-bg: rgba(0, 0, 0, .3);
}
html[data-theme="dark"] {
  --chat-reaction-bg: #2c2c2e;
  --chat-reaction-shadow: 0 3px 10px rgba(0, 0, 0, .5);
  --chat-danger: #ff453a;
  --chat-overlay-bg: rgba(0, 0, 0, .5);
}

/* F3/D9：纯 emoji（1..3 个 cluster）整条放大——透明底（去气泡底色与投影）、
 * 42px、居中；混排/超 3 个走现排版零变化（TC-F3-03/04/05）。 */
.user-bubble.emoji-big,
.dialogue-bubble.emoji-big {
  background: transparent !important;
  box-shadow: none;
  border: 0;
  font-size: var(--chat-emoji-big-size);
  line-height: 1.25;
  text-align: center;
  padding: 2px 6px;
  width: fit-content;
}

/* F4/D11：反应徽章——.user-bubble 内部末子节点、左下角 30px 圆（原型 .rx 逐项对齐）；
 * ::before 透明外扩触控区 ≥44px；z-index 防相邻气泡遮盖。 */
.user-bubble { position: relative; }
.chat-reaction {
  position: absolute;
  left: -13px;
  bottom: -9px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid var(--chat-reaction-bg);
  background: var(--chat-reaction-bg);
  box-shadow: var(--chat-reaction-shadow);
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  z-index: 3;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.chat-reaction::before { content: ""; position: absolute; inset: -7px; border-radius: 50%; }
.chat-reaction.chat-reaction-pop { animation: chatRxPop .5s var(--chat-rx-pop-ease); }
@keyframes chatRxPop {
  0% { transform: scale(0); }
  62% { transform: scale(1.28); }
  100% { transform: scale(1); }
}
/* 长按 420ms / 点按提示浮层："AI 回应了一个表情 X"，1.7s 自隐（原型 bindRxTip 同语义）。 */
.chat-rx-tip {
  position: fixed;
  z-index: 90;
  max-width: 70vw;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--chat-agg-pill-bg, rgba(31, 31, 40, .82));
  color: var(--chat-agg-pill-fg, #fff);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
}

/* F3/D8：＋面板"表情"入口（首位）。"新"角标已按验收反馈 #6 移除（样式一并清理）。 */
.chat-emoji-entry { position: relative; }

/* F3：表情选择面板——抽屉形态、锚定输入栏上沿（与 chatToolsPanel 同位模式
 * bottom:calc(100% + 8px)），不覆盖输入栏与发送按钮（需求 F3.3-6 硬约束）；
 * 移动端 ≤768px 可弹出/滚动/关闭（C8）。 */
.chat-input-bar { position: relative; }
.chat-emoji-overlay {
  position: fixed;
  inset: 0;
  background: var(--chat-overlay-bg);
  z-index: 119;
}
.chat-emoji-overlay[hidden] { display: none !important; }
.chat-emoji-panel {
  position: absolute;
  left: 8px;
  bottom: calc(100% + 8px);
  width: min(380px, calc(100% - 16px));
  max-height: min(52dvh, 420px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border-radius: var(--ui-radius-xl, 24px) var(--ui-radius-xl, 24px) var(--ui-radius-md, 14px) var(--ui-radius-md, 14px);
  background: var(--ui-surface, rgba(250, 250, 250, .98));
  border: 1px solid var(--ui-line, rgba(0, 0, 0, .08));
  box-shadow: var(--ui-shadow, 0 10px 28px rgba(0, 0, 0, .16));
  z-index: 120;
  overflow: hidden;
}
.chat-emoji-panel[hidden] { display: none !important; }
.chat-emoji-head { display: flex; align-items: center; justify-content: space-between; flex: 0 0 auto; }
.chat-emoji-title { font-size: 14px; font-weight: 700; color: var(--ui-text, var(--text-primary, #111)); }
.chat-emoji-close {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  background: transparent;
  color: var(--ui-muted, var(--text-dim, #888));
  font-size: 15px;
  cursor: pointer;
}
.chat-emoji-close::after { content: ""; position: absolute; inset: -7px; } /* 触控区外扩 ≥44px */
.chat-emoji-hint { font-size: 11.5px; color: var(--ui-muted, var(--text-dim, #888)); line-height: 1.5; flex: 0 0 auto; }
.chat-emoji-panel-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}
.chat-emoji-recent { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.chat-emoji-recent-label { font-size: 11px; color: var(--ui-muted, var(--text-dim, #888)); flex-shrink: 0; }
.chat-emoji-recent-grid { display: flex; gap: 2px; overflow-x: auto; }
.chat-emoji-recent-grid .chat-emoji-cell { flex: 0 0 40px; }
.chat-emoji-tabs { display: flex; gap: 6px; overflow-x: auto; flex: 0 0 auto; }
.chat-emoji-tab {
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ui-muted, var(--text-dim, #888));
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-emoji-tab.on { background: var(--chat-read-check, #07c160); color: #fff; }
.chat-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}
@media (max-width: 380px) {
  .chat-emoji-grid { grid-template-columns: repeat(7, 1fr); } /* 原型同断点降 7 列 */
}
.chat-emoji-cell {
  min-height: 44px;
  border: 0;
  background: transparent;
  font-size: 27px;
  line-height: 1.2;
  border-radius: 10px;
  cursor: pointer;
  padding: 4px 0;
}
.chat-emoji-cell:active { transform: scale(.86); background: rgba(7, 193, 96, .14); }
@media (max-width: 768px) {
  .chat-emoji-panel { left: 8px; right: 8px; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-reaction.chat-reaction-pop { animation: none; }
}

/* REQ011: scene editing is an overlay, never a second chat flex row. */
.chat-view.req010-ordinary-chat { position: relative; }
.chat-view.active > .chat-scene-panel.req011-scene-overlay {
  position: absolute; inset: 0; z-index: 100;
  display: flex; align-items: flex-end; background: #24263245;
  padding: 0; margin: 0; border: 0; border-radius: 0;
  width: 100%; height: 100%; max-height: none; overflow: hidden;
}
.chat-view.active > .chat-scene-panel.req011-scene-overlay[hidden] { display: none !important; }
.chat-scene-sheet {
  box-sizing: border-box; width: 100%; max-height: calc(100% - 32px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-card, #fafafe); color: var(--text-primary);
  border-radius: 24px 24px 0 0; padding: 21px 18px 24px;
}
.chat-scene-sheet [data-scene-action="close"] { float: right; font-size: 22px; min-width: 32px; min-height: 32px; border: 0; background: transparent; color: inherit; }
.chat-scene-sheet .chat-scene-panel-title { font-size: 18px; font-weight: 500; margin-bottom: 9px; }
.chat-scene-sheet .chat-scene-panel-copy, .chat-scene-feedback { font-size: 11px; color: var(--text-dim); line-height: 1.8; }
.chat-scene-sheet .chat-scene-place-picker { margin-top: 15px; }
.chat-scene-sheet .chat-scene-place-choice { display: block; }
.chat-scene-sheet select, .chat-scene-sheet input, .chat-scene-sheet textarea {
  display: block; width: 100%; box-sizing: border-box; min-width: 0;
  padding: 11px 12px; border: 1px solid var(--glass-border); border-radius: 11px;
  background: var(--bg-card); color: inherit; font: inherit; font-size: 13px;
}
.chat-scene-sheet [hidden] { display: none !important; }
.chat-scene-sheet [data-scene-action="custom-place"], .chat-scene-sheet .chat-preset-entry {
  display: block; margin-top: 14px; padding: 0; border: 0; background: transparent; color: #0a84ff; font-size: 12px;
}
.chat-scene-sheet .chat-scene-recent-places { margin-top: 10px; }
.chat-scene-sheet .chat-scene-recent-places button { border-radius: 16px; padding: 7px 11px; }
.chat-scene-sheet .chat-place-presets { border: 0; padding: 0; margin: 15px 0; }
.chat-scene-sheet textarea { min-height: 88px; max-height: 180px; line-height: 1.7; font-size: 12px; }
.chat-scene-sheet .chat-place-presets button { border: 0; background: transparent; color: #0a84ff; font-size: 12px; }
.chat-scene-sheet .chat-place-presets section { padding: 10px; border-radius: 12px; background: var(--bg-hover); white-space: pre-wrap; }
.chat-scene-sheet .chat-scene-panel-actions { display: flex; gap: 9px; margin-top: 19px; }
.chat-scene-sheet .chat-scene-panel-actions button { flex: 1; padding: 12px 10px; border: 0; border-radius: 12px; background: var(--bg-hover); color: inherit; font-size: 12px; }
.chat-scene-sheet .chat-scene-panel-actions .primary { flex: 1.5; background: #0a84ff; color: white; }
.offline-reply-card .offline-narration { border-left-color: #d6d0c2; color: #90909b; line-height: 1.85; padding-left: 11px; }
