/* ============================================================
   RIROU — 外壳布局 (Shell Layout)
   ============================================================ */

#phone-frame {
  max-width: 420px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh; /* 优先用dvh，移动端浏览器工具栏收起/展开时更准确；不支持dvh的浏览器用上面的100vh兜底 */
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  /* 关键：给phone-frame一个transform，让它成为内部所有
     position:fixed元素的"containing block"（CSS规范：有transform
     的元素会成为fixed定位后代的参照系）。这样"固定在底部"就是
     真的固定在这个手机边框的底部，而不是意外固定到了浏览器整个
     视口——在桌面宽屏预览时尤其重要，同时也让这套定位逻辑不再
     依赖上面flex/height链条的每一层都完美无缺才能生效。 */
  transform: translateZ(0);
}

#phone-frame::before,
#phone-frame::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(210, 240, 230, 0.35) 0%, rgba(210, 240, 230, 0.02) 70%, transparent 100%);
  filter: blur(1px);
  z-index: 0;
  pointer-events: none;
}
#phone-frame::before { width: 140px; height: 140px; top: 60px; left: -30px; }
#phone-frame::after { width: 90px; height: 90px; top: 260px; right: -20px; }

body[data-show-status-bar='false'] #status-bar {
  display: none;
}

#status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 24px 6px;
  font-size: 13px;
  color: var(--text-secondary);
  letter-spacing: 1px;
  position: relative;
  z-index: 2;
}

#status-bar .offline-flag {
  display: none;
  color: var(--accent-mint);
  font-family: var(--font-script);
  margin-left: auto;
}
body[data-offline='true'] #status-bar .offline-flag {
  display: inline;
}

#go-home-btn {
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--ease);
}
#go-home-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

#screen-area {
  flex: 1;
  position: relative;
  z-index: 2;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 0 132px;
  min-width: 0;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
}

.screen {
  display: none;
  padding: var(--space-3) 20px;
  animation: screen-in 0.32s ease;
}
.screen.active {
  display: block;
}
.screen[data-screen='home'] {
  padding-left: 0;
  padding-right: 0;
}
.screen[data-screen='home'] > * {
  padding-left: 20px;
  padding-right: 20px;
}
.screen[data-screen='home'] #home-pages {
  padding-left: 0;
  padding-right: 0;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   顶部通栏小组件
   ============================================================ */

.widget-top {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin-bottom: var(--space-2);
  box-shadow: 0 0 24px var(--glow-soft), inset 0 0 18px rgba(220, 245, 238, 0.05);
}

.widget-top-avatar {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent-mint);
  overflow: hidden;
}
.widget-top-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.widget-top-mid {
  flex: 1;
  min-width: 0;
}

.widget-top-greeting {
  font-size: 14px;
  color: var(--text-primary);
  font-family: var(--font-script);
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.widget-top-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.widget-top-time {
  font-size: 22px;
  font-weight: 400;
  color: var(--text-primary);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   桌面：多页滑动容器
   ============================================================ */

.home-pages {
  display: flex;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.home-pages::-webkit-scrollbar { display: none; }

.home-page {
  width: 100%;
  max-width: 100%;
  min-width: 100%;
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 0 20px;
  overflow: hidden;
}

.desktop-footer-stack {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  /* bottom 由 js (positionDesktopFooterStack) 根据实际渲染出来的
     底部导航栏位置动态设置，这里只给一个保底值，避免JS还没跑完
     之前瞬间跑到屏幕最底部 */
  bottom: 90px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 9;
  pointer-events: none;
}
.desktop-footer-stack .page-dots {
  pointer-events: auto;
}

.footer-cursive {
  text-align: center;
  font-family: var(--font-script);
  font-size: 13px;
  color: var(--accent-mint);
  opacity: 0.6;
  letter-spacing: 1px;
  white-space: nowrap;
  pointer-events: none;
}

.page-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  box-shadow: 0 0 12px var(--glow-soft);
}
.page-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-soft);
  transition: var(--ease);
}
.page-dot.active {
  background: var(--accent-mint);
  transform: scale(1.3);
}

#edit-mode-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================================
   混合网格（第一页）：右侧竖排小组件 + App 图标环绕填充
   ============================================================ */

.home-mixed-grid {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 78px;
  grid-auto-flow: dense;
  gap: 14px 12px;
  overflow: hidden;
}

.app-grid-plain {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 78px;
  gap: 14px 12px;
  overflow: hidden;
}

/* ============================================================
   App 图标
   ============================================================ */

.app-icon {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  font-family: var(--font-cn);
  touch-action: manipulation;
  transition: transform var(--ease);
}

.app-icon-glyph {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent-mint);
  overflow: hidden;
  transition: transform var(--ease), box-shadow var(--ease), border-color var(--ease);
}
.app-icon-glyph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-icon:hover .app-icon-glyph,
.app-icon:focus-visible .app-icon-glyph {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: 0 0 14px var(--glow-soft);
}

.app-icon-label {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.app-icon[data-placeholder='true'] .app-icon-glyph {
  opacity: 0.5;
}
.app-icon[data-placeholder='true'] .app-icon-label {
  opacity: 0.5;
}

/* --- 长按编辑模式：Desktop Item（App+Widget）轻微摆动，暗示可拖拽 --- */
@keyframes icon-wiggle {
  0%, 100% { transform: rotate(-1.2deg); }
  50% { transform: rotate(1.2deg); }
}
.home-pages.edit-mode .desktop-item:not(.dragging) {
  animation: icon-wiggle 0.24s infinite ease-in-out;
}
.desktop-item.dragging {
  animation: none !important;
  opacity: 0.85;
  box-shadow: 0 0 24px var(--glow-strong, var(--glow-soft));
}
.app-icon.dragging {
  opacity: 0.75;
  transform: scale(1.08);
}

/* ============================================================
   底部 Tab 导航
   ============================================================ */

#tab-bar {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: calc(100% - 40px);
  max-width: 380px;
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px;
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  box-shadow: 0 0 24px var(--glow-soft);
  z-index: 10;
}

.tab-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--text-muted);
  font-family: var(--font-cn);
  font-size: 10px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 14px;
  transition: color var(--ease), background var(--ease);
}

.tab-btn .tab-glyph {
  font-size: 16px;
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
}
.tab-btn .tab-glyph img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

.tab-btn.active {
  color: var(--text-primary);
  background: var(--accent-current);
}

/* ============================================================
   通用组件
   ============================================================ */

.k-card {
  background: var(--surface);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-card);
  padding: 24px 20px;
  margin-bottom: var(--space-2);
  box-shadow: 0 0 24px var(--glow-soft), inset 0 0 18px rgba(220, 245, 238, 0.05);
  border: 1px solid var(--border-soft);
}

/* ============================================================
   联系人左滑（编辑/星标/删除）
   ============================================================ */
.contact-swipe-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  margin-bottom: 8px;
}
.contact-swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 168px;
  display: flex;
}
.contact-swipe-btn {
  flex: 1;
  border: none;
  color: var(--text-primary);
  font-size: 11px;
  cursor: pointer;
  background: var(--surface-strong);
  border-left: 1px solid var(--border-soft);
}
.contact-swipe-edit { background: var(--surface-strong); }
.contact-swipe-star { background: rgba(220, 245, 238, 0.08); }
.contact-swipe-del { background: rgba(255, 140, 140, 0.12); }
.contact-row {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px 14px;
  touch-action: pan-y;
  will-change: transform;
}

.wc-char-profile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-chat-popup);
  align-items: flex-end;
  justify-content: center;
}
.wc-char-profile-card {
  width: 100%;
  max-width: 420px;
  max-height: 75vh;
  overflow-y: auto;
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: 24px 24px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 0 30px var(--glow-soft);
}

.k-card-title {
  font-size: 16px;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  gap: 8px;
}
.k-card-title::after {
  content: '✿';
  color: var(--accent-mint);
  font-size: 15px;
}

.k-btn {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-btn);
  border: none;
  font-family: var(--font-cn);
  font-size: 15px;
  font-weight: 400;
  background: linear-gradient(135deg, var(--accent-btn-a) 0%, var(--accent-btn-b) 100%);
  color: #ffffff;
  margin-top: 10px;
  cursor: pointer;
  transition: var(--ease);
  box-shadow: 0 0 18px var(--glow-soft);
}
.k-btn:hover {
  box-shadow: 0 0 24px var(--glow-strong);
  transform: translateY(-2px);
}

.k-btn-light {
  background: var(--surface-strong);
  color: var(--text-secondary);
  border: 1px solid var(--border-soft);
  box-shadow: none;
}

.char-avatar[data-online='false'] {
  filter: grayscale(0.6) brightness(0.55);
  position: relative;
}
.char-avatar[data-online='false']::after {
  content: '暂时联系不到';
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

.badge-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-mint-deep);
  box-shadow: 0 0 6px var(--glow-strong);
}

/* --- 头像/图片上传占位按钮（设置页复用） --- */
.avatar-upload {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--accent-mint);
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}
.avatar-upload img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .app-icon-glyph, .tab-btn, .k-btn { transition: none; }
  .home-pages.edit-mode .desktop-item { animation: none; }
}

/* ============================================================
   穗西 · 悬浮小助手
   ============================================================ */

#suixi-root {
  position: fixed;
  z-index: 90;
}

#suixi-ball {
  position: fixed;
  right: 16px;
  bottom: 110px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  box-shadow: 0 0 18px var(--glow-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--accent-mint);
  cursor: pointer;
  overflow: hidden;
  z-index: 91;
  touch-action: manipulation;
}
#suixi-ball.dragging {
  box-shadow: 0 0 24px var(--glow-soft), 0 0 0 2px var(--accent-mint);
}
#suixi-ball img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#suixi-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: var(--z-chat-popup);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

#suixi-popup-inner {
  width: 100%;
  max-width: 420px;
  background: var(--bg-1);
  border: 1px solid var(--border-soft);
  border-radius: 24px 24px 0 0;
  padding: 20px;
  box-shadow: 0 0 30px var(--glow-soft);
  max-height: 70vh;
  overflow-y: auto;
}

#suixi-ask-history {
  max-height: 260px;
  overflow-y: auto;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: 12px;
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
}
.suixi-ask-line {
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 8px;
  white-space: pre-wrap;
}
.suixi-ask-line.user {
  color: var(--text-primary);
}
.suixi-ask-line.assistant {
  color: var(--text-secondary);
}
.suixi-ask-role {
  color: var(--accent-mint);
  margin-right: 4px;
}

.suixi-title {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.suixi-title::after {
  content: '✿';
  color: var(--accent-mint);
  font-size: 14px;
}

#suixi-menu .k-btn,
#suixi-menu .k-btn-light {
  margin-bottom: 8px;
}

.suixi-back {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 10px;
  padding: 0;
}

.suixi-faq-item {
  padding: 10px 0;
  border-top: 1px solid var(--border-soft);
}
.suixi-faq-q {
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.suixi-faq-a {
  font-size: 12px;
  color: var(--text-secondary);
}

/* ============================================================
   桌面小组件补充：铃兰花装饰 / 组件内联编辑 / 沙漏 / 黑胶
   ============================================================ */

.home-hero-flower {
  display: block;
  width: 100%;
  height: 64px;
  max-height: 64px;
  object-fit: contain;
  opacity: 0.7;
  margin: 0 0 10px;
  filter: drop-shadow(0 0 12px var(--glow-soft));
  user-select: none;
  pointer-events: none;
  overflow: hidden;
}

.widget-edit-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3;
}

.widget-top { position: relative; }

.widget-edit-panel {
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: var(--space-2);
}
.widget-edit-panel input[type='text'] {
  width: 100%;
  padding: 10px;
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--surface-strong);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
  font-family: var(--font-cn);
}

/* --- 沙漏倒计时小组件（跟黑胶并排，各占一半宽） ---
   用 aspect-ratio 固定宽高比，不再靠"跨两行网格"+百分比高度
   这种链路来定高——这条链路在部分WebKit环境下解析不稳定，
   一旦中间某一环没能拿到"确定高度"，canvas就会退回它自己的
   内部像素尺寸渲染，表现出来就是"组件突然变得很长很宽"。
   aspect-ratio直接给出确定尺寸，从根上避免这条链路。 */
.widget-hourglass {
  grid-column: 1 / 3;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 10px;
  box-shadow: 0 0 18px var(--glow-soft);
  box-sizing: border-box;
  width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

/* --- 组件3：还原成最初的样式——大圆角矩形 + 右下角叠一个小
   圆角矩形，独立占一整行宽度，用aspect-ratio定比例，不再挤进
   3列×4行的网格里（那个版本把比例挤变形了）。都能单独换照片，
   照片始终在最底层。 --- */
.widget3-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  margin-bottom: var(--space-2);
  box-sizing: border-box;
}
.widget3-big {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  box-shadow: 0 0 18px var(--glow-soft);
  overflow: hidden;
  z-index: 1;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.widget3-small {
  position: absolute;
  right: 6%;
  bottom: -8%;
  width: 30%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-tile);
  background: var(--surface-strong);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-soft);
  box-shadow: 0 0 14px var(--glow-soft);
  overflow: hidden;
  z-index: 2;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.widget3-big.tap-pulse,
.widget3-small.tap-pulse {
  transform: scale(0.96);
}
.widget3-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0; /* 照片始终在这个小组件的最底层 */
}

/* --- 黑胶唱片音乐小组件（跟沙漏并排） ---
   同样改用aspect-ratio定高，外壳半透明磨砂玻璃，只在外圈发光，
   唱盘本体不额外发光 */
.widget-vinyl {
  grid-column: 3 / 5;
  aspect-ratio: 1 / 1;
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-card);
  padding: 10px;
  box-shadow: 0 0 18px var(--glow-soft); /* 只在外壳这一圈发光 */
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.widget-vinyl-disc {
  width: 74%;
  height: 74%;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle, rgba(0,0,0,0.35) 0px, rgba(0,0,0,0.35) 1px, rgba(20,20,20,0.9) 2px, rgba(20,20,20,0.9) 3px),
    radial-gradient(circle, #1a1a1a 0%, #0b0b0b 70%, #000 100%);
  box-shadow: none; /* 唱盘本体不发光，光晕只在外壳 */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transform-origin: 50% 50%;
  flex-shrink: 0;
}
.widget-vinyl-disc.spinning {
  animation: vinyl-spin 3.2s linear infinite;
}
@keyframes vinyl-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.widget-vinyl-center {
  width: 42%;
  height: 42%;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-strong);
  border: 1px solid rgba(255,255,255,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: var(--accent-mint);
}
.widget-vinyl-center img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 唱臂：固定在右上角，播放时落到唱盘上，暂停时抬起 */
.vinyl-tonearm {
  position: absolute;
  top: 6%;
  right: 8%;
  width: 3px;
  height: 42%;
  background: linear-gradient(to bottom, #e8e8e8, #b8b8b8);
  border-radius: 2px;
  transform-origin: top center;
  transform: rotate(-32deg);
  transition: transform 0.5s ease;
  z-index: 3;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
.vinyl-tonearm::before {
  content: '';
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d8d8d8;
}
.vinyl-tonearm.dropped {
  transform: rotate(-6deg);
}

/* --- 聊天顶部小花：手动回复模式下有待读回复时的提示 --- */
#wc-flower-check.pending {
  animation: flower-pulse 1.4s ease-in-out infinite;
}
@keyframes flower-pulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.2); opacity: 1; text-shadow: 0 0 10px var(--glow-strong); }
}

.screen[data-screen='weichat'].wc-conversation-active {
  height: 100%;
  overflow: hidden;
  padding-bottom: 0;
}

.wc-conversation-shell {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.wc-conversation-header {
  flex: 0 0 auto;
}

/* Chat Surface · Header 材质（只作用于聊天顶部，不影响其他页面共用的.k-card） */
.wc-chat-header .wc-chat-header-card {
  background: var(--wc-header-bg, var(--surface));
  border-color: var(--wc-header-border-color, var(--border-soft));
  -webkit-backdrop-filter: var(--wc-header-blur, blur(8px));
  backdrop-filter: var(--wc-header-blur, blur(8px));
}
.wc-chat-header .wc-chat-header-title {
  color: var(--wc-header-title-color, var(--text-primary));
}

#wc-messages {
  flex: 1 1 auto;
  min-height: 0 !important;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  background: var(--wc-wallpaper-bg, none);
  /* padding-bottom 由JS(positionChatComposer)按输入栏实际渲染高度
     动态设置，不写死数字——输入栏高度会因为safe-area、系统字号、
     换行等变化，写死padding会导致要么留白太多要么盖住最后一条消息 */
}

/* ============================================================
   聊天气泡（Chat Beautification 变量在这里生效）
   ============================================================ */
/* 编辑器预览里的迷你Header/Composer——只用class，不复用#wc-form这个id
   （一是避免重复id，二是#wc-form是position:fixed，会把预览里的输入栏
   拽出预览框）。视觉变量和真实聊天用的是同一批，所以预览所见即所得。 */
.wc-theme-preview .wc-chat-header-card {
  margin-bottom: 8px;
  padding: 10px 12px;
}
.wc-theme-preview .wc-chat-composer-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 12px;
  background: var(--wc-composer-bg, transparent);
  -webkit-backdrop-filter: var(--wc-composer-blur, none);
  backdrop-filter: var(--wc-composer-blur, none);
  box-shadow: 0 0 0 1px var(--wc-composer-border-color, var(--border-soft));
}
.wc-theme-preview .wc-chat-composer-preview > * { min-width: 0; }
.wc-theme-preview .wc-chat-composer-preview .wc-chat-input { flex: 1 1 auto; width: 0; }
.wc-theme-preview .wc-chat-composer-preview .wc-chat-send {
  background: var(--wc-send-bg, linear-gradient(135deg, var(--accent-btn-a) 0%, var(--accent-btn-b) 100%));
  color: var(--wc-send-color, #ffffff);
  flex-shrink: 0;
}
.wc-theme-preview .wc-chat-composer-preview .wc-chat-attachment { flex-shrink: 0; }

.wc-theme-preview {
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
  background: var(--bg-2);
  overflow: hidden;
}
/* 壁纸只作用于Body，跟真实聊天页一致（Header/Composer是"材质层"，不铺壁纸） */
.wc-theme-preview .wc-theme-preview-body {
  background: var(--wc-wallpaper-bg, none);
  padding: 8px;
  border-radius: 10px;
}

.wc-msg-row {
  display: flex;
  margin-bottom: 10px;
}
.wc-msg-row.mine {
  justify-content: flex-end;
}
.wc-msg-col {
  max-width: var(--wc-bubble-max-width, 70%);
  min-width: 0;
}
.wc-msg-sender {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.wc-bubble {
  padding: var(--wc-bubble-padding, 10px 14px);
  border-radius: var(--wc-bubble-radius, 16px);
  font-size: var(--wc-bubble-font, 14px);
  font-family: var(--wc-font-family, inherit);
  position: relative;
  overflow: hidden;
  word-break: break-word;
  white-space: pre-wrap; /* 阶段0：AI 回复里的换行要显示出来 */
  background-repeat: no-repeat;
  background-size: var(--wc-border-image-size, cover);
  background-position: center;
  background-image: var(--wc-border-image, none);
}
.wc-sys-row {
  display: flex;
  justify-content: center;
  margin: 8px 0;
}
.wc-sys-msg {
  max-width: 82%;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  white-space: pre-wrap;
  word-break: break-word;
}
.wc-bubble.mine {
  background-color: var(--wc-user-bubble-bg, var(--accent-btn-a));
  color: #fff;
  border: var(--wc-bubble-border, 1px solid transparent);
}
.wc-bubble.theirs {
  background-color: var(--wc-other-bubble-bg, var(--surface-strong));
  color: var(--text-primary);
  border: var(--wc-bubble-border, 1px solid var(--border-soft));
}

#wc-plus-panel {
  position: fixed;
  left: 16px;
  right: 16px;
  z-index: 19;
}

#wc-form {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: var(--z-chat-composer);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(
    --wc-composer-bg,
    linear-gradient(180deg, transparent 0%, var(--bg-1) 28%, var(--bg-1) 100%)
  );
  -webkit-backdrop-filter: var(--wc-composer-blur, none);
  backdrop-filter: var(--wc-composer-blur, none);
  box-shadow: 0 -1px 0 var(--wc-composer-border-color, transparent);
  box-sizing: border-box;
}
/* 发送按钮：保持真实的 <button type="submit">，只换"衣服"。
   用 #wc-form 前缀提高优先级，确保能盖过全局 .k-btn 的背景/文字色，
   fallback 就是 .k-btn 原本的渐变和白字，默认外观完全不变。 */
#wc-form .wc-chat-send {
  background: var(
    --wc-send-bg,
    linear-gradient(135deg, var(--accent-btn-a) 0%, var(--accent-btn-b) 100%)
  );
  color: var(--wc-send-color, #ffffff);
}
/* 阶段 1：输入栏的固定样式从 weichat.js 内联 style 抽出为 class（外观不变）。
   选择器用 .wc-chat-composer 前缀（0,2,0），主题源码 CSS 现在可以按正常层叠覆盖它们；
   编辑器预览用的是 .wc-chat-composer-preview，不受影响。 */
.wc-chat-composer .wc-chat-attachment {
  background: var(--wc-attach-bg, var(--surface-strong));
  border: 1px solid var(--wc-composer-border-color, var(--border-soft));
  color: var(--wc-attach-color, var(--text-primary));
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
}
.wc-chat-composer .wc-chat-input {
  padding: 12px 14px;
  border-radius: var(--wc-composer-radius, 16px);
  border: 1px solid var(--wc-input-border-color, var(--border-soft));
  background: var(--wc-input-bg, var(--surface));
  color: var(--wc-input-color, var(--text-primary));
  font-family: var(--wc-font-family, var(--font-cn));
  font-size: 14px;
}
.wc-chat-composer .wc-chat-send {
  width: auto;
  margin-top: 0;
  padding: 12px 20px;
}
.wc-multi-actions {
  display: flex;
  gap: 8px;
}
/* placeholder只能用外部CSS设置（伪元素没法inline）。fallback用darkgray，
   跟浏览器默认placeholder色基本一致。 */
.wc-chat-input::placeholder {
  color: var(--wc-input-placeholder-color, darkgray);
}
#wc-form > * {
  min-width: 0; /* 关键修复：flex子项默认min-width是auto，输入框这类元素
                   不设成0的话不会真正收缩，会把发送按钮挤出屏幕右侧 */
}
#wc-plus-btn,
#wc-form button[type='submit'] {
  flex-shrink: 0; /* +号和发送按钮任何时候都不允许被压缩变形/消失 */
}
#wc-input {
  flex: 1 1 auto;
  width: 0; /* 配合flex:1，强制以flex分配的空间为准，避免input的默认宽度参与计算 */
}

/* ============================================================
   聊天 · 右侧滑出设置抽屉
   ============================================================ */

.wc-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: var(--z-chat-overlay);
  display: flex;
  justify-content: flex-end;
}

.wc-drawer-panel {
  width: 86%;
  max-width: 360px;
  height: 100%;
  background: var(--bg-1);
  border-left: 1px solid var(--border-soft);
  box-shadow: 0 0 30px var(--glow-soft);
  transform: translateX(100%);
  transition: transform 0.24s ease;
  z-index: var(--z-chat-drawer);
  display: flex;
  flex-direction: column;
  min-height: 0; /* 配合父级flex column，让内容区能真正拿到"剩余空间"而不是被内容撑破 */
}
.wc-drawer-panel.open {
  transform: translateX(0);
}

.wc-drawer-header {
  flex: 0 0 auto;
  padding: 20px 20px 12px;
}

.wc-drawer-content {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 0 20px 20px;
}

.wc-drawer-footer {
  flex: 0 0 auto;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border-soft);
  background: var(--bg-1);
}


/* ============================================================
   Rirou 当前阶段：PWA / Widget 尺寸安全边界
   ============================================================ */
.widget-top,
.widget-hourglass,
.widget-vinyl,
.widget3-frame {
  min-width: 0;
  max-width: 100%;
}

.home-mixed-grid > * {
  min-width: 0;
}

/* ============================================================
   朋友圈 (PHASE 4)
   ============================================================ */
.moment-card { padding: 18px 16px; }
.moment-note {
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.moment-note-title {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.moment-note p {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}
.moment-images {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0;
}
.moment-images img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
}
.moment-actions {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.moment-actions button {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.moment-actions button.liked {
  color: var(--accent-mint);
}
.moment-comments {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  background: var(--surface-strong);
  border-radius: 10px;
  padding: 8px 10px;
}
.moment-comment-line {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.moment-comment-name {
  color: var(--accent-mint);
}
.moment-comment-input {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.moment-comment-input input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-soft);
  font-size: 12px;
}
.moment-comment-input button {
  background: var(--surface-strong);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  cursor: pointer;
}
.moments-homepage-overlay {
  animation: fade-in 0.2s ease;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Widget Studio W1 ---------- */
.user-widget-frame {
  position: relative; overflow: hidden; border-radius: 18px;
  background: rgba(255,255,255,0.05);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.10);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}
.user-widget-iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.user-widget-shield { position: absolute; inset: 0; z-index: 2; }
.user-widget-missing { display:flex; align-items:center; justify-content:center; height:100%; font-size:11px; opacity:.5; }

/* ---------- Widget Studio W2：Visual Builder ---------- */
#ws-studio-root {
  position: absolute; inset: 0; z-index: 200; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 60%, var(--bg-2) 100%);
  color: var(--text-primary); font-family: var(--font-cn); overflow: hidden;
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
#ws-studio-root .ws-top { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 18px 8px; flex:0 0 auto; }
#ws-studio-root .ws-title { font-size:15px; letter-spacing:2px; font-weight:300; }
#ws-studio-root .ws-link { background:none; border:0; color:var(--text-secondary); font-size:13px; padding:6px 4px; cursor:pointer; font-family:inherit; }
#ws-studio-root .ws-strong { color: var(--accent-mint); }
#ws-studio-root .ws-name { flex:1; min-width:0; background:rgba(255,255,255,.05); border:1px solid var(--border-soft); border-radius:12px; color:inherit; padding:7px 12px; font-size:14px; font-family:inherit; text-align:center; }
#ws-studio-root .ws-body { flex:1 1 auto; overflow-y:auto; padding:6px 18px 28px; -webkit-overflow-scrolling:touch; }
#ws-studio-root .ws-lead { font-size:12px; line-height:1.7; color:var(--text-secondary); margin:6px 0 14px; }
#ws-studio-root .ws-section, #ws-studio-root .ws-sub { font-size:11px; letter-spacing:1px; color:var(--text-secondary); margin:16px 0 8px; opacity:.85; }
#ws-studio-root .ws-sub { margin:4px 0 8px; }
#ws-studio-root .ws-primary { width:100%; padding:13px; border-radius:16px; border:1px solid var(--border-soft); background:rgba(185,167,232,.16); color:inherit; font-size:14px; font-family:inherit; cursor:pointer; }
#ws-studio-root .ws-ghost { width:100%; margin-top:8px; padding:10px; border-radius:14px; border:1px dashed var(--border-soft); background:none; color:var(--text-secondary); font-size:12px; font-family:inherit; }
#ws-studio-root .ws-card { display:flex; flex-direction:column; gap:10px; padding:12px 14px; margin-bottom:10px; border-radius:16px; background:rgba(255,255,255,.04); border:1px solid var(--border-soft); -webkit-backdrop-filter:blur(10px); backdrop-filter:blur(10px); }
#ws-studio-root .ws-card-name { font-size:14px; }
#ws-studio-root .ws-card-meta { font-size:11px; color:var(--text-secondary); margin-top:2px; }
#ws-studio-root .ws-card-actions, #ws-studio-root .ws-row, #ws-studio-root .ws-adds { display:flex; flex-wrap:wrap; gap:6px; }
#ws-studio-root .ws-mini { background:rgba(255,255,255,.06); border:1px solid var(--border-soft); color:var(--text-secondary); border-radius:999px; padding:5px 12px; font-size:11px; font-family:inherit; cursor:pointer; }
#ws-studio-root .ws-danger { color:#d9a0a8; }
#ws-studio-root .ws-empty, #ws-studio-root .ws-note { font-size:11px; line-height:1.7; color:var(--text-secondary); opacity:.8; margin:8px 0; }
#ws-studio-root .ws-preview-wrap { flex:0 0 auto; padding:4px 20px 8px; border-bottom:1px solid var(--border-soft); background:rgba(0,0,0,.12); }
#ws-studio-root .ws-preview-box { position:relative; width:100%; overflow:hidden; }
#ws-studio-root .ws-preview-grid { display:grid; grid-template-columns:repeat(4,1fr); grid-auto-rows:78px; gap:14px 12px; width:100%; transform-origin:top left; }
#ws-studio-root .ws-preview-bar { display:flex; justify-content:space-between; align-items:center; gap:8px; margin-top:8px; }
#ws-studio-root .ws-status { font-size:11px; color:var(--text-secondary); }
#ws-studio-root .ws-hint { font-size:11px; color:var(--accent-mint); min-height:14px; margin-top:4px; }
#ws-studio-root .ws-select-mini, #ws-studio-root select, #ws-studio-root input[type=text], #ws-studio-root input[type=number], #ws-studio-root textarea {
  background:rgba(255,255,255,.05); border:1px solid var(--border-soft); border-radius:10px; color:inherit; padding:6px 10px; font-size:12px; font-family:inherit; max-width:100%; }
#ws-studio-root textarea { width:100%; resize:vertical; }
#ws-studio-root select option { color:#222; }
#ws-studio-root .ws-tabs { display:flex; gap:2px; padding:8px 14px 0; flex:0 0 auto; overflow-x:auto; }
#ws-studio-root .ws-tab { flex:1; background:none; border:0; border-bottom:1px solid transparent; color:var(--text-secondary); padding:8px 6px; font-size:12px; font-family:inherit; cursor:pointer; white-space:nowrap; }
#ws-studio-root .ws-tab.on { color:var(--text-primary); border-bottom-color:var(--accent-mint); }
#ws-studio-root .ws-group { padding:10px 12px; margin-bottom:12px; border-radius:14px; background:rgba(255,255,255,.035); border:1px solid var(--border-soft); }
#ws-studio-root .ws-field { display:flex; flex-direction:column; gap:5px; margin:8px 0; font-size:12px; color:var(--text-secondary); }
#ws-studio-root .ws-field > input[type=range] { width:100%; }
#ws-studio-root .ws-field > select, #ws-studio-root .ws-field > input[type=text], #ws-studio-root .ws-field > input[type=number] { width:100%; }
#ws-studio-root .ws-els { display:flex; flex-direction:column; gap:6px; margin-bottom:10px; }
#ws-studio-root .ws-el { display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; border-radius:12px; border:1px solid var(--border-soft); background:rgba(255,255,255,.03); font-size:12px; cursor:pointer; }
#ws-studio-root .ws-el.on { border-color:var(--accent-mint); background:rgba(185,167,232,.1); }
#ws-studio-root .ws-el-btns button { background:none; border:0; color:var(--text-secondary); font-size:14px; padding:2px 7px; cursor:pointer; }
#ws-studio-root .ws-glyphs { display:flex; flex-wrap:wrap; gap:4px; }
#ws-studio-root .ws-glyph { width:34px; height:34px; border-radius:10px; border:1px solid var(--border-soft); background:rgba(255,255,255,.04); color:inherit; font-size:16px; cursor:pointer; }
#ws-studio-root .ws-glyph.on { border-color:var(--accent-mint); }
#ws-studio-root .ws-toast { position:absolute; left:50%; bottom:calc(24px + env(safe-area-inset-bottom)); transform:translateX(-50%) translateY(8px); background:rgba(30,26,48,.92); border:1px solid var(--border-soft); border-radius:999px; padding:8px 18px; font-size:12px; opacity:0; pointer-events:none; transition:.25s; }
#ws-studio-root .ws-toast.show { opacity:1; transform:translateX(-50%); }

/* ---------- Widget Studio W3：权限页 ---------- */
#ws-studio-root .ws-perm { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:8px 0; border-bottom:1px solid rgba(255,255,255,.06); }
#ws-studio-root .ws-perm:last-child { border-bottom:0; }
#ws-studio-root .ws-perm-name { font-size:13px; }
#ws-studio-root .ws-perm-meta { font-size:11px; color:var(--text-secondary); margin-top:2px; }

/* ---------- Widget Studio W4：Code Lab ---------- */
#ws-studio-root .ws-views { display:flex; align-items:center; gap:6px; padding:8px 18px 0; flex:0 0 auto; }
#ws-studio-root .ws-view { background:rgba(255,255,255,.05); border:1px solid var(--border-soft); color:var(--text-secondary); border-radius:999px; padding:5px 16px; font-size:12px; font-family:inherit; cursor:pointer; }
#ws-studio-root .ws-view.on { color:var(--text-primary); border-color:var(--accent-mint); background:rgba(185,167,232,.14); }
#ws-studio-root .ws-modetag { margin-left:auto; font-size:11px; color:var(--text-secondary); }
#ws-studio-root .ws-tab { flex:0 0 auto; padding:8px 11px; }
#ws-studio-root textarea.ws-code { font-family:ui-monospace,Menlo,Consolas,monospace; font-size:12px; line-height:1.55; min-height:260px; height:42vh; white-space:pre; overflow:auto; tab-size:2; resize:vertical; }
#ws-studio-root .ws-code-info { font-size:11px; color:var(--text-secondary); margin:6px 0; }
#ws-studio-root .ws-code-info.bad { color:#d9a0a8; }
#ws-studio-root .ws-banner { font-size:11px; line-height:1.7; padding:8px 12px; border-radius:12px; margin:8px 0; border:1px solid var(--border-soft); background:rgba(255,255,255,.04); color:var(--text-secondary); }
#ws-studio-root .ws-banner.ok { border-color:rgba(185,167,232,.4); }
#ws-studio-root .ws-banner.warn { border-color:rgba(232,200,140,.5); color:#e8d4a8; }
#ws-studio-root .ws-banner.bad { border-color:rgba(217,160,168,.55); color:#e6b3ba; }
#ws-studio-root .ws-check { display:flex; align-items:center; gap:10px; padding:7px 0; font-size:12px; color:var(--text-secondary); }
#ws-studio-root .ws-check em { font-style:normal; font-size:10px; margin-left:8px; opacity:.7; }
#ws-studio-root .ws-asset { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid rgba(255,255,255,.06); }
#ws-studio-root .ws-asset-thumb { width:40px; height:40px; border-radius:10px; background:rgba(255,255,255,.06); display:flex; align-items:center; justify-content:center; overflow:hidden; font-size:13px; flex:0 0 auto; }
#ws-studio-root .ws-asset-thumb img { width:100%; height:100%; object-fit:cover; }
#ws-studio-root .ws-asset-main { flex:1; min-width:0; }
#ws-studio-root .ws-asset-name { font-size:13px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#ws-studio-root .ws-console { font-family:ui-monospace,Menlo,Consolas,monospace; font-size:11px; line-height:1.6; max-height:40vh; overflow:auto; padding:8px 10px; border-radius:12px; background:rgba(0,0,0,.25); border:1px solid var(--border-soft); }
#ws-studio-root .ws-log { padding:2px 0; word-break:break-all; white-space:pre-wrap; }
#ws-studio-root .ws-log span { opacity:.45; margin-right:8px; }
#ws-studio-root .ws-log.error { color:#e6b3ba; }
#ws-studio-root .ws-log.warn { color:#e8d4a8; }
#ws-studio-root .ws-pre { font-family:ui-monospace,Menlo,Consolas,monospace; font-size:11px; line-height:1.6; white-space:pre-wrap; word-break:break-all; margin:0; color:var(--text-secondary); }
#ws-studio-root code { font-family:ui-monospace,Menlo,Consolas,monospace; font-size:11px; }

/* ---------- Widget Studio W5：Mini App（半屏 / 大卡片 / 全屏 / 悬浮） ---------- */
#mini-root { position:absolute; inset:0; z-index:300; --mini-sat:env(safe-area-inset-top,0px); --mini-sab:env(safe-area-inset-bottom,0px); --mini-kb:0px; --mini-vh:100dvh; color:var(--text-primary); font-family:var(--font-cn); }
#mini-root .mini-backdrop { position:absolute; inset:0; background:rgba(10,8,22,.45); -webkit-backdrop-filter:blur(6px); backdrop-filter:blur(6px); animation:mini-fade .18s ease; }
#mini-root .mini-panel { position:absolute; display:flex; flex-direction:column; overflow:hidden; background:linear-gradient(180deg,rgba(44,36,76,.97),rgba(26,21,48,.985)); border:1px solid var(--border-soft); box-shadow:0 18px 50px rgba(0,0,0,.45); animation:mini-in .22s ease; }
#mini-root .mini-head { flex:0 0 auto; display:flex; align-items:center; gap:8px; padding:9px 12px 8px 16px; position:relative; }
#mini-root .mini-grab { display:none; position:absolute; left:50%; top:5px; width:36px; height:4px; margin-left:-18px; border-radius:2px; background:rgba(255,255,255,.22); }
#mini-root .mini-title { flex:1; min-width:0; font-size:13px; letter-spacing:1px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
#mini-root .mini-modes { display:flex; gap:4px; }
#mini-root .mini-mode-btn { background:rgba(255,255,255,.06); border:1px solid var(--border-soft); color:var(--text-secondary); border-radius:999px; padding:4px 10px; font-size:11px; font-family:inherit; cursor:pointer; }
#mini-root .mini-close { width:30px; height:30px; border-radius:50%; border:1px solid var(--border-soft); background:rgba(255,255,255,.06); color:inherit; font-size:18px; line-height:1; cursor:pointer; }
#mini-root .mini-body { flex:1 1 auto; min-height:0; position:relative; overscroll-behavior:contain; }
#mini-root .mini-iframe { display:block; width:100%; height:100%; border:0; background:transparent; }
/* 半屏：底部抽屉，键盘弹出时抬到键盘上方 */
#mini-root.mini-half .mini-panel { left:0; right:0; bottom:var(--mini-kb); height:min(max(300px, calc(var(--mini-vh) * .5)), calc(var(--mini-vh) - var(--mini-sat) - 24px)); border-radius:22px 22px 0 0; border-bottom:0; }
#mini-root.mini-half .mini-grab { display:block; }
#mini-root.mini-half .mini-body { padding-bottom:var(--mini-sab); }
#mini-root.mini-half.kb-up .mini-body { padding-bottom:0; }
/* 大卡片：居中，四周留边 */
#mini-root.mini-card .mini-panel { left:16px; right:16px; top:calc(var(--mini-sat) + 28px); height:min(calc(var(--mini-vh) - var(--mini-sat) - 56px), 560px); border-radius:24px; }
/* 全屏：铺满，顶部让开刘海，底部让开 Home 条 */
#mini-root.mini-full .mini-backdrop { display:none; }
#mini-root.mini-full .mini-panel { left:0; right:0; top:0; height:var(--mini-vh); border-radius:0; border:0; padding-top:var(--mini-sat); }
#mini-root.mini-full .mini-body { padding-bottom:var(--mini-sab); }
#mini-root.mini-full.kb-up .mini-body { padding-bottom:0; }
/* 悬浮：小窗，可拖动，不挡住下面的界面 */
#mini-root.mini-float { pointer-events:none; }
#mini-root.mini-float .mini-backdrop { display:none; }
#mini-root.mini-float .mini-panel { pointer-events:auto; left:var(--mini-fx,12px); top:var(--mini-fy,96px); width:236px; height:168px; border-radius:18px; }
#mini-root.mini-float .mini-head { padding:6px 8px 4px 12px; cursor:grab; touch-action:none; }
#mini-root.mini-float .mini-title { font-size:11px; }
#mini-root.mini-float .mini-close { width:24px; height:24px; font-size:15px; }
#mini-root.closing .mini-panel { opacity:0; transform:translateY(10px) scale(.98); transition:opacity .16s ease, transform .16s ease; }
#mini-root.closing .mini-backdrop { opacity:0; transition:opacity .16s ease; }
@keyframes mini-in { from { opacity:0; transform:translateY(14px) scale(.985); } to { opacity:1; transform:none; } }
@keyframes mini-fade { from { opacity:0; } to { opacity:1; } }
@media (prefers-reduced-motion: reduce) { #mini-root .mini-panel, #mini-root .mini-backdrop { animation:none; } }

/* ===== W6 官方模板库 ===== */
#ws-studio-root .tg-chips { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:6px; }
#ws-studio-root .tg-chip { display:inline-flex; align-items:center; gap:6px; background:rgba(255,255,255,.05); border:1px solid var(--border-soft); color:var(--text-secondary); border-radius:999px; padding:4px 10px 4px 5px; font-size:11px; font-family:inherit; cursor:pointer; }
#ws-studio-root .tg-chip.on { color:inherit; border-color:rgba(185,167,232,.7); background:rgba(185,167,232,.16); }
#ws-studio-root .tg-sw { position:relative; display:inline-block; width:22px; height:22px; border-radius:7px; overflow:hidden; flex:0 0 auto; }
#ws-studio-root .tg-dot { width:14px; height:14px; margin-left:3px; border-radius:50%; border:1px solid rgba(255,255,255,.35); flex:0 0 auto; }
#ws-studio-root .tg-tabs { display:flex; gap:6px; margin:14px 0 10px; overflow-x:auto; }
#ws-studio-root .tg-tab { flex:0 0 auto; background:none; border:1px solid var(--border-soft); color:var(--text-secondary); border-radius:999px; padding:6px 14px; font-size:12px; font-family:inherit; cursor:pointer; }
#ws-studio-root .tg-tab.on { color:inherit; background:rgba(185,167,232,.16); border-color:rgba(185,167,232,.7); }
#ws-studio-root .tg-cap { font-size:11px; line-height:1.6; color:var(--text-secondary); opacity:.9; }
#ws-studio-root .tg-card .ws-preview-box { padding:2px 0; }

/* ============================================================
   微聊 阶段2：时间分隔 / 新消息分隔 / 引用 / 状态 / 长按菜单 / 会话列表
   （只用现有变量与主题变量；不引入新的配色）
   ============================================================ */
.wc-time-sep, .wc-new-divider {
  display: flex;
  justify-content: center;
  margin: 10px 0 8px;
}
.wc-time-sep span {
  font-size: 11px;
  color: var(--text-muted);
}
.wc-new-divider { align-items: center; gap: 10px; }
.wc-new-divider::before, .wc-new-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}
.wc-new-divider span { font-size: 11px; color: var(--accent-mint); }

.wc-msg-row.wc-grouped { margin-top: -6px; }

/* 气泡长按：不触发系统选字/放大镜，复制走长按菜单 */
.wc-bubble, .wc-sys-msg {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.wc-quote {
  font-size: 11px;
  line-height: 1.4;
  color: var(--text-muted);
  background: var(--surface);
  border-left: 2px solid var(--border-soft);
  border-radius: 8px;
  padding: 4px 8px;
  margin-bottom: 3px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wc-quote.missing { cursor: default; font-style: italic; }
.wc-quote-name { margin-right: 6px; color: var(--text-secondary); }
.wc-quote-text { opacity: 0.9; }
.wc-flash .wc-bubble { outline: 2px solid var(--accent-mint); outline-offset: 2px; }

.wc-msg-status { font-size: 10px; color: var(--text-muted); text-align: right; margin-top: 2px; }
.wc-msg-status.failed { color: #c96a6a; }
.wc-retry {
  background: none; border: none; padding: 0 2px; font-size: 10px;
  color: var(--accent-mint); text-decoration: underline; cursor: pointer;
}

.wc-msg-row.wc-selected .wc-bubble, .wc-sys-row.wc-selected .wc-sys-msg { outline: 2px solid var(--accent-mint); outline-offset: 2px; }

.wc-empty-card {
  margin: 40px auto 0;
  max-width: 260px;
  text-align: center;
  padding: 18px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
}
.wc-empty-card img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.wc-empty-card .wc-empty-name { margin-top: 8px; font-size: 14px; color: var(--text-primary); }
.wc-empty-card .wc-empty-sub { margin-top: 4px; font-size: 11px; color: var(--text-muted); }
.wc-empty-card .wc-empty-hint { margin-top: 10px; font-size: 12px; color: var(--text-secondary); }

.wc-new-pill {
  position: fixed;
  right: 16px;
  z-index: calc(var(--z-chat-composer) + 1);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--surface-strong);
  color: var(--accent-mint);
  font-size: 12px;
  cursor: pointer;
  display: none;
}
.wc-new-pill.show { display: block; }

#wc-quote-bar, #wc-multi-bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: calc(var(--z-chat-composer) + 1);
  box-sizing: border-box;
  padding: 6px 16px;
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--surface-strong);
  border-top: 1px solid var(--border-soft);
  display: none;
  align-items: center;
  gap: 8px;
}
#wc-quote-bar.show, #wc-multi-bar.show { display: flex; }
#wc-quote-bar .wc-quote-bar-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wc-quote-bar button, #wc-multi-bar button {
  background: none; border: 1px solid var(--border-soft); border-radius: 10px;
  color: var(--text-primary); padding: 6px 12px; font-size: 12px; cursor: pointer;
}
#wc-multi-bar { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); justify-content: space-between; }

.wc-sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-chat-popup);
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.wc-sheet {
  width: 100%;
  max-width: 480px;
  box-sizing: border-box;
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--surface-strong);
  border-radius: 18px 18px 0 0;
  border: 1px solid var(--border-soft);
}
.wc-sheet button {
  display: block;
  width: 100%;
  padding: 13px 0;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-primary);
  font-size: 15px;
  cursor: pointer;
}
.wc-sheet button.danger { color: #c96a6a; }
.wc-sheet button:last-child { border-bottom: none; color: var(--text-muted); }

.wc-list-main { flex: 1; min-width: 0; }
.wc-list-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.wc-list-time { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.wc-list-preview {
  font-size: 12px; color: var(--text-secondary); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wc-list-preview .wc-draft-tag { color: #c96a6a; margin-right: 4px; }
.wc-list-badge {
  display: inline-block; min-width: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 9px; background: var(--accent-btn-a); color: #fff;
  font-size: 11px; line-height: 18px; text-align: center;
}
.wc-list-badge.muted { background: var(--text-muted); }
.wc-list-tag { font-size: 10px; color: var(--text-muted); margin-left: 6px; }
.wc-list-pinned { background: var(--surface-strong) !important; }

/* ===== 阶段 1：聊天列表卡片的固定样式（原 chatsTab 内联 style，外观不变） ===== */
.wc-list-card {
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: center;
}
.wc-list-avatar {
  cursor: default;
  width: 44px;
  height: 44px;
}
.wc-list-name {
  font-size: 15px;
  color: var(--text-primary);
}
.wc-list-lurk {
  font-size: 11px;
  color: var(--accent-mint);
  margin-top: 2px;
}
.wc-list-none {
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  margin-top: 30px;
}

/* ===== 阶段 1：头像单击/双击的触摸兼容 =====
   touch-action: manipulation 去掉双击缩放带来的点击延迟并避免双击触发页面缩放；
   -webkit-touch-callout / user-select 避免 iOS 长按头像弹出图片菜单。 */
.wc-msg-row .char-avatar {
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ============================================================
   微聊 P1：「铃兰清透」官方外观（新默认）
   - 只作用于 .wc-look-lily（聊天壳）与 #wc-composer-root[data-wc-look='lily']
   - 「经典深色」= 不加这些规则，保持升级前的样式；用户自建主题生效时也走经典底子
   - 壁纸 .wc-lily-wall 为【临时素材】：CSS 渐变 + 自绘线稿 SVG，可替换，
     不是正式美术资产；用户自己设置的聊天壁纸（主题）依然优先
   ============================================================ */
.wc-look-lily,
#wc-composer-root[data-wc-look='lily'] {
  --text-primary: #2c3a4a;
  --text-secondary: #566779;
  --text-muted: #8392a3;
  --surface: rgba(255, 255, 255, 0.55);
  --surface-strong: rgba(255, 255, 255, 0.72);
  --border-soft: rgba(110, 150, 185, 0.26);
  --accent-mint: #4f9f8e;
}
.wc-look-lily { position: relative; isolation: isolate; }
.wc-lily-wall {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 300' fill='none' stroke='%23ffffff' stroke-opacity='.75' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M30 300C32 220 40 150 62 70'/%3E%3Cpath d='M62 70c-8 6-14 14-14 24 8-2 14-10 14-24ZM62 90c8 4 14 12 12 22-8-4-12-12-12-22Z'/%3E%3Cpath d='M170 300C166 230 156 170 140 110'/%3E%3Cpath d='M140 110c-8 6-12 14-10 22 8-4 12-12 10-22ZM140 130c8 4 12 12 10 20-8-4-10-12-10-20Z'/%3E%3C/svg%3E") right bottom / 70% auto no-repeat,
    radial-gradient(120% 60% at 15% 0%, #dff3f0 0%, rgba(223, 243, 240, 0) 70%),
    radial-gradient(100% 60% at 100% 35%, #e6e9fb 0%, rgba(230, 233, 251, 0) 70%),
    linear-gradient(180deg, #eef8f6 0%, #eaf1fb 55%, #f4f0fb 100%);
}
.wc-look-lily .wc-lily-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: linear-gradient(180deg, rgba(238, 248, 246, 0.78), rgba(238, 248, 246, 0));
}
.wc-lily-iconbtn {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  color: var(--text-secondary);
  cursor: pointer; padding: 0;
}
.wc-lily-iconbtn.pending { color: var(--accent-mint); box-shadow: 0 0 0 2px rgba(79, 159, 142, 0.35); }
.wc-lily-hd-avatar { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; overflow: hidden; border: 2px solid rgba(255, 255, 255, 0.85); }
.wc-lily-hd-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wc-lily-hd-main { flex: 1 1 auto; min-width: 0; }
.wc-look-lily .wc-lily-hd-name { font-size: 15px; font-weight: 600; color: var(--wc-header-title-color, var(--text-primary)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-look-lily .wc-lily-hd-status { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wc-rel-banner {
  margin: 0 16px 4px;
  padding: 6px 14px;
  border-radius: 999px;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.wc-rel-sub { color: var(--accent-mint); }
#wc-banner-slot { flex: 0 0 auto; }
.wc-look-lily #wc-messages { background: var(--wc-wallpaper-bg, transparent); padding-left: 14px; padding-right: 14px; }
.wc-look-lily .wc-msg-col { max-width: var(--wc-bubble-max-width, 78%); }
.wc-look-lily .wc-bubble { border-radius: var(--wc-bubble-radius, 20px); line-height: 1.55; box-shadow: 0 2px 10px rgba(90, 130, 170, 0.12); }
.wc-look-lily .wc-bubble.theirs {
  background-color: var(--wc-other-bubble-bg, rgba(255, 255, 255, 0.64));
  border: var(--wc-bubble-border, 1px solid rgba(255, 255, 255, 0.8));
  color: var(--text-primary);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.wc-look-lily .wc-bubble.mine {
  background-color: var(--wc-user-bubble-bg, transparent);
  background-image: var(--wc-border-image, linear-gradient(135deg, rgba(170, 218, 208, 0.92), rgba(160, 196, 236, 0.9)));
  border: var(--wc-bubble-border, 1px solid rgba(255, 255, 255, 0.6));
  color: #22384a;
}
.wc-look-lily .wc-time-sep span {
  padding: 3px 12px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.7);
  color: var(--text-muted);
}
.wc-look-lily .wc-sys-msg { background: rgba(255, 255, 255, 0.5); border-color: rgba(255, 255, 255, 0.7); }

/* 输入栏：胶囊、半透明、贴安全区；容器本身透明 */
#wc-composer-root[data-wc-look='lily'] #wc-form {
  background: var(--wc-composer-bg, linear-gradient(180deg, rgba(238, 244, 251, 0), rgba(238, 244, 251, 0.85) 45%));
  box-shadow: none;
  padding: 8px 14px calc(10px + env(safe-area-inset-bottom, 0px));
}
#wc-composer-root[data-wc-look='lily'] .wc-chat-composer .wc-chat-input {
  border-radius: 999px;
  padding: 11px 16px;
  background: var(--wc-input-bg, rgba(255, 255, 255, 0.78));
  border: 1px solid var(--wc-input-border-color, rgba(255, 255, 255, 0.9));
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 2px 12px rgba(90, 130, 170, 0.12);
}
#wc-composer-root[data-wc-look='lily'] .wc-chat-composer .wc-chat-attachment {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(90, 130, 170, 0.12);
}
#wc-composer-root[data-wc-look='lily'] #wc-form .wc-chat-send {
  border-radius: 999px;
  background: var(--wc-send-bg, linear-gradient(135deg, #8fcfc2 0%, #8fb4e6 100%));
  color: var(--wc-send-color, #1f3447);
  padding: 11px 18px;
}
.wc-look-opt { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .wc-look-lily *, #wc-composer-root[data-wc-look='lily'] * { transition: none !important; animation: none !important; } }

/* ============================================================
   微聊 P1 · 全屏沉浸式（v0.7.1）
   聊天页（非经典深色）占满整个手机屏幕：无状态栏留白、无外层面板、背景顶到底连续。
   用 :has() 仅在“当前可见的新外观聊天页”时生效，回到桌面/其他 App 自动恢复。
   ============================================================ */
#phone-frame:has(.screen.active .wc-look-lily) #status-bar { display: none; }
#phone-frame:has(.screen.active .wc-look-lily)::before,
#phone-frame:has(.screen.active .wc-look-lily)::after { display: none; }
#phone-frame:has(.screen.active .wc-look-lily) #screen-area { padding: 0; overflow: hidden; }
#phone-frame:has(.screen.active .wc-look-lily) .screen.wc-conversation-active { padding: 0; height: 100%; animation: none; }
.wc-look-lily { width: 100%; }
.wc-look-lily .wc-lily-header { padding-top: calc(10px + env(safe-area-inset-top, 0px)); background: none; }
.wc-look-lily .wc-lily-wall {
  background:
    /* 临时装饰：自绘铃兰线稿（左下角、右上角），非正式美术资产 */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 260' fill='none' stroke='%23ffffff' stroke-opacity='.8' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 260C24 190 34 120 70 40'/%3E%3Cpath d='M70 40c14 2 22 10 26 22M60 62c12 4 18 14 20 26M46 100c-12-4-20 0-26 10M38 130c12 2 18 10 22 20'/%3E%3Cpath d='M70 40c-6 10-4 20 4 26 6-8 6-18-4-26ZM60 62c-6 8-4 18 4 24 6-8 6-16-4-24Z' fill='%23ffffff' fill-opacity='.35'/%3E%3C/svg%3E") left bottom / 46% auto no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160' fill='none' stroke='%23ffffff' stroke-opacity='.7' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M160 10C120 20 90 50 70 100'/%3E%3Cpath d='M130 22c-6 12-2 22 8 26 4-10 0-20-8-26ZM100 48c-8 10-6 20 2 26 6-8 6-18-2-26Z' fill='%23ffffff' fill-opacity='.3'/%3E%3C/svg%3E") right top / 40% auto no-repeat,
    radial-gradient(70% 38% at 18% 8%, rgba(255, 244, 214, 0.75) 0%, rgba(255, 244, 214, 0) 70%),
    radial-gradient(90% 50% at 90% 40%, rgba(214, 236, 226, 0.9) 0%, rgba(214, 236, 226, 0) 70%),
    linear-gradient(180deg, #eaf6f0 0%, #e6efe8 55%, #eef0e4 100%);
}
.wc-look-lily.wc-variant-mist .wc-lily-wall {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 260' fill='none' stroke='%23ffffff' stroke-opacity='.7' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M20 260C24 190 34 120 70 40'/%3E%3Cpath d='M70 40c14 2 22 10 26 22M60 62c12 4 18 14 20 26'/%3E%3C/svg%3E") left bottom / 40% auto no-repeat,
    radial-gradient(80% 45% at 20% 5%, rgba(190, 215, 255, 0.85) 0%, rgba(190, 215, 255, 0) 70%),
    radial-gradient(90% 50% at 95% 55%, rgba(205, 200, 250, 0.7) 0%, rgba(205, 200, 250, 0) 70%),
    linear-gradient(180deg, #e6f0ff 0%, #dde8fa 55%, #ece9fb 100%);
}
.wc-look-lily.wc-variant-mist { --accent-mint: #4a7fc0; }
.wc-look-lily.wc-variant-mist .wc-bubble.mine { background-image: var(--wc-border-image, linear-gradient(135deg, rgba(150, 190, 245, 0.92), rgba(176, 170, 240, 0.88))); }
.wc-look-lily .wc-bubble.theirs { background-color: var(--wc-other-bubble-bg, rgba(255, 255, 255, 0.58)); }
.wc-look-lily .wc-bubble { animation: wc-bub-in 0.26s ease both; }
@keyframes wc-bub-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.wc-lily-hd-main[data-hd-profile], .wc-lily-hd-avatar[data-hd-profile], .wc-rel-banner { cursor: pointer; }
/* 铃兰快捷回复：左下角，位于输入栏最左侧，不叠在输入框上 */
#wc-composer-root[data-wc-look='lily'] #wc-form { align-items: flex-end; }
#wc-composer-root[data-wc-look='lily'] .wc-lily-reply {
  flex: 0 0 auto; width: 40px; height: 40px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: var(--accent-mint); cursor: pointer;
}
#wc-composer-root[data-wc-look='lily'] .wc-lily-reply.pending { box-shadow: 0 0 0 3px rgba(79, 159, 142, 0.35); animation: flower-pulse 1.4s ease-in-out infinite; }
#wc-composer-root[data-wc-look='lily'][data-wc-variant='mist'] { --accent-mint: #4a7fc0; }
#wc-composer-root[data-wc-look='lily'][data-wc-variant='mist'] #wc-form .wc-chat-send { background: var(--wc-send-bg, linear-gradient(135deg, #9cc2f2 0%, #b0a8f0 100%)); }
#wc-composer-root[data-wc-look='lily'] #wc-form { background: none; }
#wc-composer-root[data-wc-look='lily'] .wc-chat-composer .wc-chat-attachment { flex: 0 0 auto; width: 40px; height: 40px; }
/* 多行输入框（textarea）：外观与原 input 一致，自动增高 */
.wc-chat-composer .wc-chat-input { resize: none; line-height: 1.4; max-height: 120px; box-sizing: border-box; font-family: var(--wc-font-family, var(--font-cn)); overflow-y: auto; }
#wc-composer-root[data-wc-look='lily'] .wc-chat-composer .wc-chat-input { border-radius: 22px; }
#wc-composer-root[data-wc-look='lily'] #wc-form .wc-chat-send { align-self: flex-end; }
@media (prefers-reduced-motion: reduce) { .wc-look-lily .wc-bubble { animation: none !important; } }

/* ============================================================
   v0.7.2 打磨（对照参考图 REF-02）
   ============================================================ */
/* 输入栏：一整条磨砂胶囊；左=铃兰快捷回复（线稿花，无独立圆底），右=加号（线圈）；有字才出现发送 */
#wc-composer-root[data-wc-look='lily'] #wc-form { padding: 6px 14px calc(10px + env(safe-area-inset-bottom, 0px)); display: block; }
.wc-lily-capsule {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 6px 8px 6px 6px;
  border-radius: 28px;
  background: var(--wc-input-bg, rgba(255, 255, 255, 0.38));
  border: 1px solid var(--wc-input-border-color, rgba(255, 255, 255, 0.7));
  -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 4px 18px rgba(80, 110, 100, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-lily-reply {
  width: 38px; height: 38px; border: 0; background: none; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 50%;
  color: #7f8f86; position: relative;
}
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-lily-reply.pending { color: var(--accent-mint); animation: none; box-shadow: none; }
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-lily-reply.pending::after {
  content: ''; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-mint);
}
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-chat-input {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent; box-shadow: none;
  -webkit-backdrop-filter: none; backdrop-filter: none; border-radius: 0;
  padding: 9px 2px; color: var(--text-primary);
}
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-chat-input::placeholder { color: #8b9a92; }
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-chat-attachment {
  width: 38px; height: 38px; border: 0; background: none; box-shadow: none; padding: 0; color: #7f8f86;
  display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 0;
}
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-chat-send {
  align-self: center; padding: 8px 16px; border-radius: 999px; font-size: 14px;
}
.wc-lily-capsule:has(#wc-input:placeholder-shown) .wc-chat-send { display: none; }
/* 顶部：返回/菜单不再是带底的圆钮，只留线稿图标（参考图）；头像带细白边 */
.wc-look-lily .wc-lily-iconbtn { background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--text-primary); width: 36px; }
.wc-look-lily .wc-lily-hd-avatar { border: 1.5px solid rgba(255, 255, 255, 0.9); box-shadow: 0 1px 6px rgba(60, 90, 80, 0.18); }
.wc-look-lily .wc-lily-hd-name { text-shadow: 0 1px 6px rgba(255, 255, 255, 0.55); }
/* 横幅：半透明细线胶囊，右侧小箭头 */
.wc-rel-banner { position: relative; padding: 8px 34px 8px 16px; background: rgba(255, 255, 255, 0.34); border: 1px solid rgba(255, 255, 255, 0.65); justify-content: center; }
.wc-rel-chev { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); display: inline-flex; color: var(--text-muted); }
/* 气泡：更透、带一个靠近头像一侧的小尖角、柔光描边 */
.wc-look-lily .wc-bubble.theirs {
  background-color: var(--wc-other-bubble-bg, rgba(255, 255, 255, 0.46));
  border-top-left-radius: 6px;
  box-shadow: 0 2px 12px rgba(70, 100, 90, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.wc-look-lily .wc-bubble.mine { border-top-right-radius: 6px; box-shadow: 0 2px 12px rgba(70, 110, 130, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.wc-look-lily .wc-bubble.mine:not(.x) { background-image: var(--wc-border-image, linear-gradient(135deg, rgba(196, 226, 200, 0.82), rgba(170, 214, 206, 0.8))); }
.wc-look-lily.wc-variant-mist .wc-bubble.mine:not(.x) { background-image: var(--wc-border-image, linear-gradient(135deg, rgba(150, 190, 245, 0.88), rgba(176, 170, 240, 0.84))); }
.wc-look-lily .wc-time-sep span { background: rgba(120, 140, 130, 0.22); border: 0; color: #fff; text-shadow: 0 0 4px rgba(60, 80, 70, 0.35); font-size: 11px; }
/* iOS 主屏 App：状态栏半透明后内容会进入刘海区，非沉浸页面的状态条本身已按安全区留白（隐藏状态条时由 #phone-frame 补回）；沉浸聊天页则让背景铺到最顶 */
body[data-show-status-bar='false'] #phone-frame { padding-top: env(safe-area-inset-top, 0px); box-sizing: border-box; }
body[data-show-status-bar='false'] #phone-frame:has(.screen.active .wc-look-lily) { padding-top: 0; }
#phone-frame:has(.screen.active .wc-look-lily) { background: #e9f3ee; }
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-chat-input,
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-chat-input:focus,
#wc-composer-root[data-wc-look='lily'] .wc-lily-capsule .wc-chat-input:focus-visible {
  outline: none !important; border: 0 !important; box-shadow: none !important; background: transparent !important;
}

/* ============================================================
   v0.7.3 新外观下的弹层与小部件（仅 .wc-look-lily / data-wc-look='lily'）
   ============================================================ */
/* 加号面板：悬浮磨砂卡片，位于胶囊上方；图标为自绘线稿 */
#wc-composer-root[data-wc-look='lily'] #wc-plus-panel { left: 14px; right: 14px; }
.wc-plus-card {
  padding: 14px 10px 12px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.75);
  -webkit-backdrop-filter: blur(20px) saturate(1.2); backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 8px 28px rgba(70, 100, 90, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  animation: wc-pop-in 0.2s ease both;
}
.wc-plus-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px 4px; }
.wc-plus-item { background: none; border: 0; padding: 2px 0; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; color: var(--text-secondary); font-family: inherit; }
.wc-plus-ic {
  width: 52px; height: 52px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-mint);
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 2px 10px rgba(70, 100, 90, 0.1);
}
.wc-plus-item:active .wc-plus-ic { transform: scale(0.95); background: rgba(255, 255, 255, 0.85); }
.wc-plus-lb { font-size: 12px; }
.wc-plus-hint { margin: 10px 6px 0; min-height: 0; font-size: 12px; color: var(--text-muted); text-align: center; }
.wc-plus-hint:empty { display: none; }

/* 长按菜单：贴着气泡的磨砂小弹窗 */
.wc-sheet-overlay.wc-pop-overlay { background: rgba(60, 80, 90, 0.12); align-items: stretch; justify-content: flex-start; }
.wc-popover {
  position: fixed;
  min-width: 148px;
  padding: 6px;
  border-radius: 20px;
  background: rgba(252, 253, 252, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 10px 32px rgba(50, 80, 70, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  color: #2c3a4a;
  transform-origin: var(--wc-pop-origin-x, 50%) 100%;
  animation: wc-pop-in 0.18s ease both;
}
.wc-popover[data-dir='down'] { transform-origin: var(--wc-pop-origin-x, 50%) 0; }
.wc-popover button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 14px; border: 0; background: none; border-radius: 14px;
  font-size: 15px; font-family: inherit; color: #2c3a4a; cursor: pointer; text-align: left;
}
.wc-popover button + button { border-top: 0; }
.wc-popover button:active { background: rgba(120, 160, 150, 0.2); }
.wc-popover button.danger { color: #c4585a; }
.wc-pop-ic { display: inline-flex; color: #5b7a70; }
.wc-popover button.danger .wc-pop-ic { color: #c4585a; }
.wc-look-lily .wc-menu-target { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 6px 22px rgba(70, 110, 100, 0.25); position: relative; z-index: 1; }
@keyframes wc-pop-in { from { opacity: 0; transform: scale(0.94) translateY(4px); } to { opacity: 1; transform: none; } }

/* 引用栏 / 多选栏 / 新消息提示：同款磨砂悬浮胶囊 */
#phone-frame:has(.screen.active .wc-look-lily) #wc-quote-bar,
#phone-frame:has(.screen.active .wc-look-lily) #wc-multi-bar {
  left: 14px; right: 14px; border: 1px solid rgba(255, 255, 255, 0.8); border-radius: 18px;
  background: rgba(255, 255, 255, 0.55); color: #4c5d6c;
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  box-shadow: 0 4px 18px rgba(70, 100, 90, 0.14);
  margin-bottom: 6px;
}
#phone-frame:has(.screen.active .wc-look-lily) #wc-multi-bar { bottom: calc(10px + env(safe-area-inset-bottom, 0px)); padding-bottom: 8px; }
#phone-frame:has(.screen.active .wc-look-lily) #wc-quote-bar button,
#phone-frame:has(.screen.active .wc-look-lily) #wc-multi-bar button { border-radius: 999px; border-color: rgba(120, 150, 140, 0.35); background: rgba(255, 255, 255, 0.6); color: #2c3a4a; }
#phone-frame:has(.screen.active .wc-look-lily) .wc-new-pill {
  border: 1px solid rgba(255, 255, 255, 0.85); background: rgba(255, 255, 255, 0.62); color: var(--accent-mint, #4f9f8e);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 3px 14px rgba(70, 100, 90, 0.16);
}
@media (prefers-reduced-motion: reduce) { .wc-popover, .wc-plus-card { animation: none !important; } }

/* ============================================================
   v0.7.4 场景背景分层（临时素材）+ 多层柔光气泡
   ============================================================ */
.wc-look-lily .wc-lily-wall { background: none; overflow: hidden; }
.wc-lily-wall .wc-layer { position: absolute; inset: 0; pointer-events: none; }
.wc-lily-wall .wc-layer svg, .wc-lily-wall .wc-scene-custom { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wc-scene-custom { background-size: cover; background-position: center; }
.wc-layer-base { background: radial-gradient(90% 40% at 20% 0%, #fff4d2 0%, rgba(255, 244, 210, 0) 70%), linear-gradient(180deg, #e6f3ec 0%, #dcebe1 50%, #e9efe2 100%); }
.wc-variant-mist .wc-layer-base { background: radial-gradient(90% 40% at 20% 0%, #dfe6ff 0%, rgba(223, 230, 255, 0) 70%), linear-gradient(180deg, #dce8fb 0%, #d4e0f6 52%, #e6e4f8 100%); }
.wc-layer-scene { filter: blur(2.5px); opacity: 0.95; }
.wc-layer-scene[data-temp='user'] { filter: none; opacity: 1; }
.wc-layer-mid { filter: blur(0.8px); opacity: 0.9; }
.wc-layer-near { filter: blur(1.1px); opacity: 0.92; }
.wc-layer-light { mix-blend-mode: screen; opacity: 0.9; }
.wc-layer-figure-wrap { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.wc-layer-figure { position: absolute; aspect-ratio: 2 / 3; background-size: contain; background-repeat: no-repeat; background-position: center top; transform: translate(-50%, 0); mask-image: linear-gradient(180deg, #000 70%, transparent 100%); -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%); }
/* 多层柔光气泡：内高光 + 内侧反光 + 外柔光 + 细描边，彼此叠加，而不是单一投影 */
.wc-look-lily .wc-bubble.theirs {
  background-color: transparent;
  background-image: var(--wc-other-bubble-img, linear-gradient(160deg, rgba(255, 255, 255, 0.72) 0%, rgba(248, 251, 246, 0.5) 55%, rgba(240, 247, 240, 0.42) 100%));
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.85),
    inset 0 -10px 18px rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.35),
    0 6px 18px rgba(70, 110, 90, 0.12),
    0 0 26px rgba(255, 255, 255, 0.28);
}
.wc-look-lily .wc-bubble.mine:not(.x) {
  background-color: var(--wc-user-bubble-bg, transparent);
  background-image: var(--wc-border-image, linear-gradient(160deg, rgba(236, 247, 226, 0.88) 0%, rgba(196, 228, 206, 0.8) 55%, rgba(170, 214, 200, 0.78) 100%));
  box-shadow:
    inset 0 1.5px 0 rgba(255, 255, 255, 0.8),
    inset 0 -10px 18px rgba(255, 255, 255, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3),
    0 6px 18px rgba(70, 120, 100, 0.14),
    0 0 26px rgba(214, 240, 215, 0.4);
}
.wc-look-lily.wc-variant-mist .wc-bubble.mine:not(.x) {
  background-image: var(--wc-border-image, linear-gradient(160deg, rgba(190, 212, 250, 0.9) 0%, rgba(160, 190, 244, 0.84) 55%, rgba(176, 170, 240, 0.8) 100%));
  box-shadow: inset 0 1.5px 0 rgba(255, 255, 255, 0.75), inset 0 -10px 18px rgba(255, 255, 255, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.3), 0 6px 18px rgba(80, 110, 190, 0.18), 0 0 26px rgba(190, 205, 250, 0.45);
}
.wc-fig-box { padding: 8px; border: 1px solid var(--border-soft); border-radius: 12px; }
