/* UI 原语。颜色/圆角/间距一律取令牌 */

/* ---- Page ---- */
.page { height: 100%; display: flex; flex-direction: column; background: var(--bg); }
/* 左边缘往右滑返回。逻辑在 ui/page.js */
/* 跟着手指走的那一段：不要过渡，否则手指到哪儿它慢半拍 */
.page.is-swiping { transition: none; will-change: transform; }
/* 松手之后补完或者弹回去。page.js 按这条过渡的时长决定什么时候收尾 */
.page.is-settling { transition: transform var(--settle-ms, var(--dur)) var(--settle-ease, var(--ease)); }
/* 让出来的那一条是外壳底色。给这一页压一道阴影，看着才像一层浮起来往右挪，
   而不是页面裂了一道缝 */
.page.is-swiping, .page.is-settling { box-shadow: var(--shadow-3); }
.page-body { flex: 1; min-height: 0; }
/* 底下没有页签栏时，滚动区一直铺到屏幕底，最后一行会压在 Home Indicator 下面。
   有页签栏的那些不加 —— 页签栏自己已经把安全区让出来了。 */
.page > .page-body:last-child { padding-bottom: var(--safe-bottom); }
/* 底栏自己已经把安全区算进去的（会话的输入栏、美化生成面板），这里不再让一次 ——
   两处都让，iPhone 上输入栏下面就平白空出 34 像素。
   钉在底部（sticky; bottom: 0）的条子尤其要在这里：它停在滚动区留白的上沿，下面那一截透出列表，
   条子看着高了一截（用户截图：QQ 音乐「已购」底部的播放条）。以后新加钉在底部的条子，加进这一行，
   条子自己让安全区。测试 safebar。
   第二行是 4.714 补的（用户截图：会话多选栏、录音栏下面空一截露出壁纸）：自己让了安全区、却漏在这一行外面的那几个 ——
   会话的多选栏与录音栏（.select-bar）、好友拉黑那一行、一起看的输入栏、短信输入栏、日记的工具栏、商城私信的输入栏、
   正在播放、记账流水、发起群聊的角色列表。测试 safedouble 逐个核对；以后新加自己让安全区的底栏，同样加进来 */
.page > .page-body:last-child:has(.composer-bar, .gen, .fr-composer, .mu-bar-safe, .mem-select, .dy-dock, .vd-tapbar, .ml-foot) { padding-bottom: 0; }
.page > .page-body:last-child:has(.select-bar, .tie-bar, .wt-input, .sms-composer, .dy-tools, .ml-composer, .mu-now, .bl-list, .ng-list) { padding-bottom: 0; }

.navbar {
  flex: none; height: var(--navbar-h);
  display: grid; grid-template-columns: 56px 1fr 56px; align-items: center;
  background: var(--bg);
}
.nav-left  { display: flex; justify-content: flex-start; padding-left: var(--sp-1); }
.nav-right { display: flex; justify-content: flex-end; gap: var(--sp-1); padding-right: var(--sp-2); }
/* 右上角放得下两个图标按钮时不要挤成两行 */
.navbar { grid-template-columns: 56px 1fr auto; }
.nav-right { min-width: 56px; }
.nav-title { text-align: center; font-size: var(--fs-15); font-weight: var(--fw-semi); }

/* ---- 应用内 TabBar ---- */
/* 高度要把安全区**加上去**，不能让它从里面挖。
   box-sizing 是 border-box（base.css），写成 height: var(--tabbar-h) 加
   padding-bottom: 34px，能放东西的就只剩 20px —— 图标和字会顶出底栏上沿，
   字还会压进 Home Indicator 那条。dock 那边（shell.css）一直是 calc 写法，
   这里漏了。 */
.tabbar {
  flex: none;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: flex; background: var(--bg);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; color: var(--text-3);
  transition: color var(--dur-fast) var(--ease);
}
.tab:where(.is-active) { color: var(--accent); }
.tab-icon { position: relative; }
.tab-label { font-size: var(--fs-11); }
.tab-badge {
  position: absolute; top: -4px; right: -8px; min-width: 15px; height: 15px;
  padding: 0 4px; border-radius: var(--r-full); background: var(--accent);
  color: var(--on-accent); font-size: 9px; line-height: 15px; text-align: center;
}

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  border-radius: var(--r-sm); font-weight: var(--fw-medium); white-space: nowrap;
}
/* 按钮上写着名字的（「角色：某某」）：里面套一段 .ellipsis，名字再长也不超出外面那一栏、收成省略号（4.c158-10）。
   只管这一种：所有按钮都加 max-width 的话，别处靠撑宽的按钮被收窄、点不到（duoface 抓到） */
.btn:where(:has(> .ellipsis)) { max-width: 100%; }
.btn > .ellipsis { min-width: 0; }
.btn-md { height: 40px; padding: 0 var(--sp-4); font-size: var(--fs-14); }
.btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-12); border-radius: var(--r-xs); }
.btn-lg { height: 46px; padding: 0 var(--sp-5); font-size: var(--fs-15); }
.btn-full { width: 100%; }
a.btn { text-decoration: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-ghost   { background: var(--surface-2); color: var(--text); }
.btn-outline { background: none; color: var(--text); box-shadow: inset 0 0 0 1px var(--border-2); }
.btn-danger  { background: var(--danger-weak); color: var(--danger); font-weight: var(--fw-semi); }
.btn:disabled { opacity: .4; pointer-events: none; }

/* 图标按钮画出来是 34，**摸得着的是 44**。
   两家的人机指南都给到 44 到 48，而手指的接触面本来就有十来毫米宽 ——
   按钮画大了难看，所以只把命中区撑开：一个看不见的伪元素往外扩五像素。
   .press 的按下反馈仍然落在看得见的那一块上。 */
.icon-btn {
  position: relative;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center; color: var(--text);
}
.icon-btn::after {
  content: ''; position: absolute; inset: -5px;
}
.icon-btn:where(.is-active) { color: var(--accent); background: var(--accent-weak); }

/* ---- 表单 ---- */
.field { display: block; margin-bottom: var(--sp-4); }
.field-label { font-size: var(--fs-13); color: var(--text-2); margin-bottom: var(--sp-2); }
.field-desc  { font-size: var(--fs-12); color: var(--text-3); margin-top: var(--sp-2); line-height: 1.5; }
/* 填的东西本身有问题时那一行。和 field-desc 同一位置，只是颜色不同 ——
   说明是一直在的，这一条只在填错时出现 */
.field-warn  { font-size: var(--fs-12); color: var(--danger); margin-top: var(--sp-2); line-height: 1.5; }

/* 数字输入：一个输入框加一个单位 */
.num-row { display: flex; align-items: center; gap: var(--sp-3); }
.num-row input { flex: 1; min-width: 0; }
.num-unit { flex: none; font-size: var(--fs-15); color: var(--text-3); }

/* 未读数。消息列表直接用这个类，不经过组件 */
.badge {
  min-width: 17px; height: 17px; padding: 0 5px; border-radius: var(--r-full);
  background: var(--accent); color: var(--on-accent);
  font-size: var(--fs-11); line-height: 17px; text-align: center;
}

.switch {
  width: 46px; height: 27px; border-radius: var(--r-full); background: var(--surface-3);
  padding: 2px; display: flex; transition: background var(--dur) var(--ease);
}
.switch.is-on { background: var(--accent); }
.switch:disabled { opacity: .4; cursor: default; }
.switch-dot {
  width: 23px; height: 23px; border-radius: var(--r-full); background: var(--surface);
  box-shadow: var(--shadow-1); transition: transform var(--dur) var(--ease);
}
.switch.is-on .switch-dot { transform: translateX(19px); }

.segmented {
  display: flex; gap: 2px; padding: 2px; background: var(--surface-2);
  border-radius: var(--r-sm);
}
.seg-item {
  flex: 1; height: 30px; border-radius: var(--r-xs); font-size: var(--fs-13);
  color: var(--text-2); transition: all var(--dur-fast) var(--ease);
}
.seg-item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

/* ---- 头像 / 角标 ---- */
/* 尺寸从公开变量读起，没有才用组件传下来的那一份。
   这三条从前是内联写的，内联赢过一切，「美化」改不动头像 —— 见 4.136。
   --ph-avatar-size 只管会话里的头像（.ph-face 那一层），不然一份会话美化
   会把整个应用的头像一起改大。圆角是全局的，形状本来就该一致。 */
.avatar {
  object-fit: cover; background: var(--surface-3); flex: none;
  width: var(--av-size, 44px); height: var(--av-size, 44px);
  border-radius: var(--ph-avatar-r, var(--avatar-r, var(--av-r, 14px)));
  font-size: var(--av-fs, 17px);
}
:where(.ph-face) .avatar {
  width: var(--ph-avatar-size, var(--av-size, 36px));
  height: var(--ph-avatar-size, var(--av-size, 36px));
}
/* 透明底头像：只剩图本身（角色卡上「透明底头像」打开时）。特异度与 .avatar 相同，美化照样压得住 */
.avatar:where(.is-bare) { background: transparent; border-radius: 0; object-fit: contain; }
.avatar-fallback {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); font-weight: var(--fw-medium); text-transform: uppercase;
}

.spinner {
  display: inline-block; border: 2px solid var(--border-2);
  border-top-color: var(--accent); border-radius: var(--r-full);
  animation: spin .7s linear infinite;
}

/* ---- 列表 ---- */
.list-wrap { margin: var(--sp-4) 0; }
.list-title {
  font-size: var(--fs-12); color: var(--text-3);
  padding: 0 var(--sp-4) var(--sp-2);
}
.list { background: var(--surface); }
.list-inset { margin: 0 var(--sp-3); border-radius: var(--r-md); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); min-height: 50px;
  border-bottom: 1px solid var(--border);
}
.list-item:where(:last-child) { border-bottom: none; }
/* 区域内滚动。条数不定的列表在这里截断并自己滚，页面本身的滚动不受影响。
   高度取的是「四行半」——露半行出来，一眼就知道下面还有 */
.list-cap {
  max-height: 248px; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.list-item.is-danger .li-title { color: var(--danger); }
.li-left  { flex: none; display: flex; color: var(--text-2); }
.li-body  { flex: 1; min-width: 0; }
/* 右边放数字框、长状态字时，窄屏（320px）上不能把标题挤成一列字：标题那一栏至少占四成，
   右边那一块自己缩。数字框本来是浏览器给的默认宽度（约 150px），数字用不着那么宽（4.422） */
.list-item:has(.li-right) > .li-body { min-width: 40%; }
.li-right { flex: 0 1 auto; min-width: 0; }
.li-right .num-row { min-width: 0; }
.li-right .num-row input { width: 6em; min-width: 2.5em; }
.li-title { font-size: var(--fs-15); }
.li-multiline .li-title { white-space: normal; line-height: 1.55; }
.li-sub   { font-size: var(--fs-12); color: var(--text-3); margin-top: 2px; line-height: 1.5; }
.li-right { display: flex; align-items: center; gap: var(--sp-2); color: var(--text-3); font-size: var(--fs-13); }
/* 没标 multiline 的那一行，副标题只占一行，多出来的省略 —— 列表是用来扫一眼的，
   要看全文就点进去。右边的状态字同理，太长时省略，不把标题挤走 */
.li-body:not(.li-multiline) .li-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-value { max-width: 10em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-arrow { color: var(--text-3); flex: none; }

/* ---- 空态 ---- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2); padding: var(--sp-8) var(--sp-5); color: var(--text-3); text-align: center;
}
.empty-title { font-size: var(--fs-14); color: var(--text-2); margin-top: var(--sp-2); }
.empty-desc  { font-size: var(--fs-12); line-height: 1.6; max-width: 260px; }

/* ---- 浮层 ---- */
.overlay {
  position: absolute; inset: 0; z-index: var(--z-sheet);
  background: var(--scrim); display: flex; align-items: flex-end;
  animation: fade-in var(--dur-fast) var(--ease);
}
.overlay-center { align-items: center; justify-content: center; padding: var(--sp-5); }
.overlay.is-preview { background: transparent; }
.overlay.is-preview .sheet { box-shadow: var(--shadow-3); }

.sheet {
  /* 高度由调用方给，但走变量而不是内联样式：契约钩子上写内联样式，
     外部作者写什么都盖不住它，而且完全看不出为什么（见 ARCHITECTURE 4.136） */
  width: 100%; height: var(--sheet-h, auto);
  max-height: 85%; display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding-bottom: var(--safe-bottom);
  animation: slide-up var(--dur-nav) var(--ease-nav);
}
.sheet-grip {
  width: 34px; height: 4px; border-radius: var(--r-full); background: var(--border-2);
  margin: var(--sp-2) auto var(--sp-1);
}
.sheet-title {
  text-align: center; font-size: var(--fs-15); font-weight: var(--fw-semi);
  padding: var(--sp-2) var(--sp-4) var(--sp-3);
  /* 标题里带着外卖名、文件名这类不带空格的一长串时照样断行（4.c158-9） */
  overflow-wrap: anywhere;
}
.sheet-body { flex: 1; min-height: 0; padding: 0 var(--sp-4) var(--sp-4); }
/* 抽屉换成整页时（Sheet 的 page，4.447）内容照旧留出抽屉里的那一圈边距，底部让出 Home Indicator */
.sheet-page-body { padding: var(--sp-2) var(--sp-4) calc(var(--sp-6) + var(--safe-bottom)); }

/* 整屏浮层。盖住整个应用层,状态栏留着不动,看起来就是一个普通页面。 */
.fullsheet {
  position: absolute; inset: 0; z-index: var(--z-sheet);
  background: var(--bg);
  animation: slide-in var(--dur-nav) var(--ease-nav);
}
/* 关掉时的快照（4.764，overlay.js 的 exitGhost）：进来怎么进，出去就怎么出。整页滑回右边，抽屉沉下去，遮罩淡掉；
   不接手指，底下的页面马上点得到。曲线与换页同一条（--ease-nav，4.762） */
.sheet-host.is-exit { pointer-events: none; }
.sheet-host.is-exit > .fullsheet { animation: slide-out var(--dur-nav) var(--ease-nav) forwards; }
.sheet-host.is-exit > .overlay { animation: fade-out var(--dur-nav) var(--ease-nav) forwards; }
:where(.sheet-host.is-exit > .overlay) > .sheet { animation: slide-down var(--dur-nav) var(--ease-nav) forwards; }
@keyframes slide-out { from { transform: translateX(0); } to { transform: translateX(100%); } }
@keyframes slide-down { from { transform: translateY(0); } to { transform: translateY(100%); } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

.modal {
  width: 100%; max-width: 320px; background: var(--surface);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-3);
}
/* 确认框标题上方的示意图（4.524） */
.modal-img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; background: var(--surface-2); }
.modal-title {
  font-size: var(--fs-15); font-weight: var(--fw-semi); text-align: center;
  padding: var(--sp-5) var(--sp-4) var(--sp-2);
}
.modal-body { padding: var(--sp-2) var(--sp-4) var(--sp-4); }
.modal-message { font-size: var(--fs-13); color: var(--text-2); text-align: center; line-height: 1.6; }
.modal-count { margin-top: var(--sp-1); font-size: var(--fs-12); color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.modal-actions { display: flex; border-top: 1px solid var(--border); }
.modal-choices { display: flex; flex-direction: column; border-top: 1px solid var(--border); }
.modal-choice { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3) var(--sp-4); text-align: center; border-bottom: 1px solid var(--border); color: var(--text); }
.modal-choice:last-child { border-bottom: 0; }
.modal-choice-label { font-size: var(--fs-15); }
.modal-choice.is-primary .modal-choice-label { font-weight: var(--fw-medium); }
.modal-choice.is-cancel { color: var(--text-2); }
.modal-choice-desc { font-size: var(--fs-12); color: var(--text-3); line-height: 1.5; }
.modal-btn {
  flex: 1; height: 46px; font-size: var(--fs-15); color: var(--text-2);
  border-right: 1px solid var(--border);
}
.modal-btn:last-child { border-right: none; }
.modal-btn-primary { color: var(--accent); font-weight: var(--fw-medium); }
.modal-btn-primary.is-danger { color: var(--danger); font-weight: var(--fw-semi); }

/* 底部一列按钮（choose，4.448）。挂在 body 上，所以自己贴底、让出 Home 横条 */
.action-layer { position: fixed; padding: 0 var(--sp-3) calc(var(--sp-3) + var(--safe-bottom)); flex-direction: column; justify-content: flex-end; align-items: stretch; }
.action-sheet {
  max-width: 480px; margin: 0 auto; width: 100%;
  background: transparent; box-shadow: none; overflow: visible;
  display: flex; flex-direction: column; gap: var(--sp-2);
  max-height: 85%; animation: slide-up var(--dur) var(--ease-out);
}
.action-group { background: var(--surface); border-radius: var(--r-lg); min-height: 0; overflow-y: auto; }
.action-head { padding: var(--sp-3) var(--sp-4); text-align: center; border-bottom: 1px solid var(--border); }
.action-title { font-size: var(--fs-13); color: var(--text-2); font-weight: var(--fw-medium); }
.action-message { margin-top: 2px; font-size: var(--fs-12); color: var(--text-3); line-height: 1.5; }
.action-sheet .modal-choices { border-top: 0; }
.action-sheet .modal-choice { padding: var(--sp-3) var(--sp-4); min-height: 52px; justify-content: center; }
.action-sheet .modal-choice.is-danger .modal-choice-label { color: var(--danger); }
.action-cancel { background: var(--surface); border-radius: var(--r-lg); border-bottom: 0; font-weight: var(--fw-medium); }

/* 组件式浮层渲染到所在那一层的最后面（overlay.js 的 Portal）。这一层本身不占位 */
.sheet-host { display: contents; }
/* 整屏浮层从应用层顶上盖起，顶栏自己让出刘海那一条，和应用页的顶栏一样 */
:where(.sheet-host > .fullsheet > .page) > .navbar:where(:first-child) {
  height: calc(var(--navbar-h) + var(--top-inset));
  padding-top: var(--top-inset);
  --nav-inset: var(--top-inset);
}

/* 贴着元素弹出的小浮层（4.446）。位置由 Popover 量好写进 --pop-x / --pop-y */
.pop-layer { position: absolute; inset: 0; z-index: var(--z-sheet); }
.pop {
  position: absolute; left: var(--pop-x, 0); top: var(--pop-y, 0);
  max-width: calc(100% - var(--sp-5)); visibility: hidden;
  background: var(--surface); color: var(--text); border-radius: var(--r-lg);
  box-shadow: var(--shadow-3); border: 1px solid var(--border);
}
.pop.is-placed { visibility: visible; animation: pop-in var(--dur-fast) var(--ease-out); }
.pop::after {
  content: ''; position: absolute; left: var(--pop-arrow, 50%); width: 10px; height: 10px;
  background: inherit; border: inherit; transform: translateX(-50%) rotate(45deg);
}
.pop[data-side="above"]::after { bottom: -6px; border-top: 0; border-left: 0; }
.pop[data-side="below"]::after { top: -6px; border-bottom: 0; border-right: 0; }
.pop[data-side="center"]::after { display: none; }
@keyframes pop-in { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.pop-grid {
  display: grid; grid-template-columns: repeat(var(--pop-cols, 5), 56px);
  gap: var(--sp-1); padding: var(--sp-2);
}
.pop-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: var(--sp-2) 0; border-radius: var(--r-md); color: var(--text);
  font-size: var(--fs-11); line-height: 1.2; text-align: center;
}
.pop-item:active { background: var(--surface-2); }
/* 长按菜单分页（4.902）：一页两行，宽度与一页的格子一样宽，左右滑，底下圆点 */
.pop-pager {
  display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain; scrollbar-width: none;
  width: calc(var(--pop-cols, 5) * 56px + (var(--pop-cols, 5) - 1) * var(--sp-1) + 2 * var(--sp-2));
}
.pop-pager::-webkit-scrollbar { display: none; }
.pop-page { flex: 0 0 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; }
.pop-item.is-danger { color: var(--danger); }
/* 长按一段的格子上面那一行小字（4.718）：这一段多少字 */
.pop-head { padding: var(--sp-2) var(--sp-3) 0; font-size: var(--fs-11); color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; }
/* 列表行长按的竖排菜单（4.450） */
.pop-list { display: flex; flex-direction: column; min-width: 168px; padding: var(--sp-1); }
.pop-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r-md);
  color: var(--text); font-size: var(--fs-14); text-align: left; white-space: nowrap;
}
.pop-row:active { background: var(--surface-2); }
/* 抽屉那一档（4.467）：同一份长按菜单放进底部抽屉，行高一些、撑满 */
.pop-list:where(.is-sheet) { min-width: 0; padding: var(--sp-2) var(--sp-2) var(--sp-4); }
.pop-list:where(.is-sheet) .pop-row { padding: 14px var(--sp-4); font-size: var(--fs-16); }
.pop-row.is-danger { color: var(--danger); }

/* 挂在 .root 里（4.607）：fixed 的 inset: 0 量的是 WebKit 的可视区，iPhone 上比整屏短一截 */
.overlay-host { position: absolute; inset: 0; pointer-events: none; z-index: var(--z-toast); }
.toast-stack {
  position: absolute; left: 0; right: 0; bottom: 96px;
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
}
.toast {
  display: flex; align-items: center; gap: var(--sp-2);
  max-width: 78%; padding: var(--sp-2) var(--sp-4);
  background: var(--toast-bg); color: var(--toast-fg);
  /* 4.791 用户：「现在的报错真的好丑啊，一个大黑坨」。从前是胶囊圆角、字有多长摊多长，一段长原因摊成一大块黑色。
     现在最多两行，多的省略（完整的写在各自页面里）；圆角取 --r-lg，一行时看着仍是胶囊，两行时是圆角矩形 */
  border-radius: var(--r-lg); font-size: var(--fs-13); line-height: 1.45;
  animation: fade-in var(--dur-fast) var(--ease);
}
.toast > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* 字色跟着 --toast-fg（4.842）：从前写死 --on-scrim（永远是白色），深色模式下底是白的，报错成了一块白，字看不见 */
.toast-error { background: var(--toast-error); color: var(--toast-fg); }

/* 挂了长按手势的元素必须带上这个类。见 CLAUDE.md 第 12 条。
   不加的话 iOS 会在长按时弹出系统自己的选中与「拷贝」浮层，
   和本项目的长按菜单同时出现，两边抢同一个手势。
   要复制就在自己的菜单里给一个「复制」。 */
/* 整个外壳默认不可选。
 *
 * 只给挂了长按的那几处加 .no-callout 是不够的：提示行、日期行、按钮旁边的
 * 空白，长按一样弹系统的选中与「拷贝」浮层，和本项目自己的长按菜单撞在一起。
 * 这里是手机，不是网页，本来就没有「选中一段文字」这回事。
 *
 * 要复制就在自己的菜单里给一个「复制」——消息菜单里本来就有（第 12 条）。
 * 真正要能选的只有输入框，下面单独放开。
 */
.root, .no-callout {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
/* 输入框必须能选：不放开的话，光标、拖选、系统的「粘贴」全都不正常 */
input, textarea, [contenteditable="true"], .selectable {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

/* 扫码登录 */
/* 几种扫码方式的切换（4.772）。从前放在居中的容器里只按文字撑开，三项挤成一条、「QQ 音乐」折成两行（4.773）：
   现在和页面顶上那一排一样铺开，限一个最大宽度，字不折行；和下面的二维码之间多留一段 */
.qr-kinds { display: flex; justify-content: center; margin: var(--sp-2) 0 var(--sp-5); }
.qr-kinds > .segmented { flex: 1; max-width: 320px; }
.qr-kinds .seg-item { white-space: nowrap; padding: 0 var(--sp-3); }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.qr-img {
  width: 180px; height: 180px; border-radius: var(--r-md);
  background: var(--scrim-fill); padding: var(--sp-2);
}
.qr-note { font-size: var(--fs-13); color: var(--text-3); text-align: center; line-height: 1.6; }

/* 账号登录（ui/qrlogin.js 的 AccountLogin）：短信验证码或密码，给没有手机扫码的人 */
.acct-login { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-4); }
.acct-row { display: flex; gap: var(--sp-2); align-items: center; }
.acct-row > input { flex: 1; min-width: 0; }
.acct-row > input.acct-ct { flex: none; width: 4.5em; text-align: center; }
.acct-row > .btn { flex: none; }
.acct-note { font-size: var(--fs-12); color: var(--text-3); line-height: 1.6; }
.acct-note.is-error { color: var(--danger); }
.acct-sep { font-size: var(--fs-12); color: var(--text-3); text-align: center; margin: var(--sp-6) 0 var(--sp-4); }

/* ---- 应用里的说明页（ui/markdown.js） ---- */
.md { font-size: var(--fs-14); line-height: 1.75; color: var(--text); word-break: break-word; }
.md h1 { font-size: var(--fs-20); font-weight: var(--fw-medium); margin: var(--sp-5) 0 var(--sp-3); }
.md h2 { font-size: var(--fs-17); font-weight: var(--fw-medium); margin: var(--sp-6) 0 var(--sp-2); }
.md h3, .md h4 { font-size: var(--fs-15); font-weight: var(--fw-medium); margin: var(--sp-4) 0 var(--sp-2); }
.md p { margin: 0 0 var(--sp-3); }
.md ul, .md ol { margin: 0 0 var(--sp-3); padding-left: var(--sp-5); }
.md li { margin-bottom: var(--sp-1); }
.md blockquote {
  margin: 0 0 var(--sp-3); padding: var(--sp-2) var(--sp-3);
  border-left: 3px solid var(--border-2); color: var(--text-2);
}
.md code { font-family: var(--font-mono); font-size: var(--fs-13); background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.md pre {
  margin: var(--sp-2) 0 var(--sp-3); padding: var(--sp-3); overflow-x: auto;
  background: var(--surface-2); border-radius: var(--r-sm);
}
.md pre code { background: none; padding: 0; white-space: pre; }
.md hr { border: none; border-top: 1px solid var(--border); margin: var(--sp-5) 0; }
.md a { color: var(--accent); word-break: break-all; }
.md-table { overflow-x: auto; margin: 0 0 var(--sp-3); }
.md table { border-collapse: collapse; font-size: var(--fs-13); min-width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: var(--sp-1) var(--sp-2); text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); font-weight: var(--fw-medium); }

/* ---- 数字密码键盘（ui/pinpad.js） ---- */
.pinpad { display: flex; flex-direction: column; align-items: center; }
.pinpad-dots { display: flex; gap: var(--sp-3); }
.pinpad-dots i {
  width: 12px; height: 12px; border-radius: var(--r-full);
  border: 1px solid var(--text-3); background: transparent;
}
.pinpad-dots i.is-on { background: var(--text); border-color: var(--text); }
.pinpad-dots.is-wrong i { border-color: var(--danger); }
.pinpad-note { min-height: 1.5em; font-size: var(--fs-13); color: var(--text-2); margin-top: var(--sp-3); text-align: center; }
.pinpad-note.is-wrong { color: var(--danger); }
.pinpad-keys {
  display: grid; grid-template-columns: repeat(3, 72px);
  gap: var(--sp-3); justify-content: center; margin-top: var(--sp-6);
}
.pinpad-key {
  display: flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: var(--r-full);
  background: var(--surface-2); color: var(--text);
  font-size: var(--fs-24); font-variant-numeric: tabular-nums;
}
.pinpad-key:disabled { opacity: .4; }
.pinpad-foot { display: flex; justify-content: flex-end; width: calc(72px * 3 + var(--sp-3) * 2); margin-top: var(--sp-2); }
.pinpad-del { font-size: var(--fs-14); color: var(--text-2); padding: var(--sp-2); width: 72px; }
.pinpad-del.is-hidden { visibility: hidden; }

/* ---- 看大图（4.382）：深色铺满，图居中；点图放大到原尺寸可拖动 ---- */
.viewer-host { position: absolute; inset: 0; z-index: var(--z-modal); }
.viewer {
  position: absolute; inset: 0; background: var(--stage-bg); color: var(--on-scrim);
  display: flex; flex-direction: column; animation: fade-in var(--dur-fast) var(--ease);
}
.viewer-top {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: calc(env(safe-area-inset-top) + var(--sp-2)) var(--sp-4) var(--sp-2);
}
.viewer-btn, .viewer-nav {
  width: 40px; height: 40px; border-radius: var(--r-full); border: 0;
  background: var(--scrim); color: var(--on-scrim); display: grid; place-items: center;
}
.viewer-count { font-size: var(--fs-14); opacity: .8; }
.viewer-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.viewer-img {
  max-width: 100%; max-height: 100%; object-fit: contain; user-select: none;
  transform: translate(var(--vw-x, 0px), var(--vw-y, 0px)) scale(var(--vw-s, 1));
  transition: transform var(--dur-fast) var(--ease);
}
/* 手势（4.453）：跟手时不要过渡；往下拖时背景与上下两栏一起变淡 */
.viewer { touch-action: none; background: color-mix(in srgb, var(--stage-bg) calc(var(--vw-fade, 1) * 100%), transparent); }
.viewer.is-live .viewer-img { transition: none; }
.viewer-top, .viewer-bar, .viewer-nav { opacity: var(--vw-fade, 1); }
.viewer-stage.is-zoom .viewer-img { transform: none; }
.viewer-stage.is-zoom { overflow: auto; display: block; touch-action: pan-x pan-y; }
.viewer-stage.is-zoom .viewer-img { max-width: none; max-height: none; }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); }
.viewer-nav.is-prev { left: var(--sp-3); }
.viewer-nav.is-next { right: var(--sp-3); }
.viewer-bar {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4) calc(env(safe-area-inset-bottom) + var(--sp-4));
}
.viewer-save {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 44px; padding: 0 var(--sp-6); border-radius: var(--r-full); border: 0;
  background: var(--scrim-fill); color: var(--on-scrim-fill); font-size: var(--fs-15);
}
.viewer-save:disabled { opacity: .5; }
.viewer-note { font-size: var(--fs-12); opacity: .6; }
.viewer-note { text-align: center; }
/* 原图（4.400）：和「保存」并排，描边、不填底 */
.viewer-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--sp-3); }
.viewer-orig {
  height: 44px; padding: 0 var(--sp-4); border-radius: var(--r-full);
  border: 1px solid color-mix(in srgb, currentColor 40%, transparent); background: transparent; color: inherit; font-size: var(--fs-14);
}
.viewer-orig:disabled { opacity: .6; }

/* 拖动排序（ui/list.js 的 SortList，4.387） */
.sort-row { transform: translateY(var(--sort-dy, 0px)); transition: transform var(--dur-fast) var(--ease); }
.sort-row.is-dragging { transition: none; position: relative; z-index: 1; background: var(--surface); box-shadow: var(--shadow-2); }
.sort-handle {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 32px; align-self: stretch; color: var(--text-3); touch-action: none; cursor: grab;
}
.sort-handle.is-fixed { cursor: default; }

/* 「页面动效」关掉（data-motion，look.js）或系统减弱动态效果：弹层的淡入、抽屉与整页浮层的滑入一起不做。
   从前这个开关只管换页，用户：「关掉动效之后部分页面还是有，很多时候看起来像闪屏」 */
:where(:root[data-motion="off"]) .overlay { animation: none; }
:where(:root[data-motion="off"]) .sheet { animation: none; }
:where(:root[data-motion="off"]) .fullsheet { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .overlay { animation: none; }
  .sheet { animation: none; }
  .fullsheet { animation: none; }
}
/* 退回来重新打开的整页浮层（会话菜单，从别的页回来时）直接出现，不再从右边滑进来一次 */
.fullsheet:where(.is-instant) { animation: none; }

/* 致谢名单（4.746）。弹窗里名单长，限高在框里滚（像素，CLAUDE.md 第 1 条）；设置里那一页整页铺开 */
.credits { display: flex; flex-direction: column; gap: var(--sp-3); text-align: center; }
.modal-message .credits { max-height: 360px; overflow-y: auto; overscroll-behavior: contain; }
.credits-title { font-size: var(--fs-13); font-weight: var(--fw-semi); color: var(--text); margin-bottom: var(--sp-1); }
.credits-names { font-size: var(--fs-13); color: var(--text-2); line-height: 1.7; word-break: break-word; }
.credits-page { padding: var(--sp-5) var(--sp-4); }

/* 写描述生成图片（4.972）：生成出来的那张先在页里看一眼 */
.draw-mine-img { display: block; width: 100%; border-radius: var(--r-md); margin-top: var(--sp-3); }
