/*
 * 夏天这一单的外观：外壳、下嵌抽屉、液态玻璃、通用小部件。定稿见 docs/design/样张-液态玻璃.html。
 * 尺寸：控件高 40～44，左右边距 12，间距走 4／8 的倍数；图标和旁边的小字同高。
 * 聊天页自己的样式在 pages/chat.css。
 */

:root {
  --ink: #16171b;
  --ink-2: #5c5f6b;      /* 次要字，白底 6.2:1 */
  --ink-3: #8a8d99;      /* 时间、占位、小图标 */
  --in: #f1f1f4;         /* 对方的气泡 */
  --out: #dde9fb;        /* 自己的气泡：雾蓝 */
  --navy: #26324a;       /* 开关开着、光标 */
  --blue: #3d7be3;       /* 未读点 */
  --chip: #e3edfc; --chip-ink: #2a5fb8;  /* Live 小胶囊 */
  --live: #2eb35e;
  --line: rgb(22 23 27 / .08);
  --drawer: #f3f3f6;
  --sans: Roboto, "Noto Sans SC", "PingFang SC", system-ui, sans-serif;
  --ease: cubic-bezier(.32, .72, 0, 1);
  --edge: 12px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: max(env(safe-area-inset-bottom, 0px), 10px);
}

html, body { background: #fff; color: var(--ink); font-family: var(--sans); font-size: 15px; -webkit-font-smoothing: antialiased; }

/* ---------- 液态玻璃：几乎透明，靠边缘折射（liquid-glass.js 写 backdrop-filter）、上沿高光、下沿暗边显出厚度 ---------- */
.lg { background: rgb(255 255 255 / .16);
  box-shadow:
    inset 1.5px 1.5px 1px -.5px rgb(255 255 255 / .95),
    inset -1px -1px 1px -.5px rgb(255 255 255 / .7),
    inset 0 0 6px rgb(255 255 255 / .35),
    inset 0 0 0 .5px rgb(22 23 27 / .10),
    0 2px 4px rgb(22 23 27 / .06),
    0 6px 18px rgb(22 23 27 / .10); }
/* 字色跟着背景走：玻璃后面暗（照片里的暗处）就白字白图标，glass-ink.js 量了亮度后加 .on-dark */
.lg.on-dark, .lg.on-dark .icon, .lg.on-dark b, .lg.on-dark .state, .lg.on-dark textarea { color: #fff; }
.lg.on-dark textarea::placeholder { color: rgb(255 255 255 / .82); }
.lg.on-dark textarea { caret-color: #fff; }
.lg.on-dark { background: rgb(255 255 255 / .14); text-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.lg.on-dark svg { filter: drop-shadow(0 1px 1.5px rgb(0 0 0 / .25)); }

.icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--ink); }
.icon svg { width: 20px; height: 20px; }
.press { transition: transform .16s var(--ease); -webkit-tap-highlight-color: transparent; }
.press:active { transform: scale(.94); }

/* 头像：有图用图，没图写名字第一个字 */
.av { border-radius: 50%; flex: none; display: grid; place-items: center; background: #dfe1e8 center / cover no-repeat; color: var(--ink-2); font-weight: 600; overflow: hidden; }

/* 左右滑开关：关着浅灰，开着深墨蓝 */
.sw { position: relative; width: 36px; height: 22px; border-radius: 11px; flex: none; background: #e4e4ea; box-shadow: inset 0 0 0 .5px rgb(22 23 27 / .06); transition: background .2s; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(22 23 27 / .2); transition: transform .22s var(--ease); }
.sw[aria-checked="true"] { background: var(--navy); }
.sw[aria-checked="true"]::after { transform: translateX(14px); }

/* ---------- 外壳：抽屉在下面，聊天页是一张卡片，打开抽屉时往右推开、左边变圆角，不盖住 ---------- */
.app { background: var(--drawer); }
.card { background: #fff; transition: transform .38s var(--ease), border-radius .38s var(--ease), box-shadow .38s var(--ease); z-index: 1; }
.app.open .card { transform: translateX(64%); border-radius: 32px 0 0 32px; box-shadow: -2px 0 28px rgb(22 23 27 / .10); overflow: hidden; }
.card-shade { background: transparent; }

.drawer { width: 64%; padding: calc(var(--safe-t) + 46px) 12px calc(var(--safe-b) + 14px); gap: 0; z-index: 0; }
/* 抽屉底跟着当前聊天的壁纸走，上面压一层模糊加白；没壁纸就是浅灰 */
.drawer-bg { position: absolute; inset: 0; overflow: hidden; z-index: -1; }
.drawer-bg::before { content: ""; position: absolute; inset: -40px; background: var(--drawer-wall, none) center / cover no-repeat; filter: blur(26px) saturate(1.2); }
.drawer-bg::after { content: ""; position: absolute; inset: 0; background: rgb(243 243 246 / .58); }
.drawer > :not(.drawer-bg) { position: relative; }
.meline { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }
.meline .av { width: 44px; height: 44px; font-size: 17px; }
.meline b { font-size: 16px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meline .pen { width: 32px; height: 32px; margin-left: -6px; display: grid; place-items: center; color: var(--ink-2); flex: none; }
.meline .pen svg { width: 13px; height: 13px; }
.rooms { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.room { width: 100%; display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px; border-radius: 16px; text-align: left; }
.room[aria-current="page"] { background: rgb(255 255 255 / .78); box-shadow: 0 1px 3px rgb(22 23 27 / .06); }
.room .av { width: 36px; height: 36px; font-size: 14px; }
.room-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.room-main b { font-size: 14px; font-weight: 600; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-main span { font-size: 12px; line-height: 16px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 18px; padding: 0 7px; border-radius: 9px; background: var(--chip); color: var(--chip-ink); font-size: 10.5px; font-weight: 500; flex: none; }
.chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--live); }
.unread { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: none; margin-right: 6px; }
.newrow { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 8px; font-size: 14px; font-weight: 500; width: 100%; text-align: left; }
.newrow .icon { width: 36px; height: 36px; background: rgb(255 255 255 / .78); box-shadow: 0 1px 3px rgb(22 23 27 / .06); }
.newrow .icon svg { width: 18px; height: 18px; }
.drawer .grow { flex: 1; }
.drawer .foot a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 8px; font-size: 14px; color: var(--ink); text-decoration: none; border-radius: 14px; }
.drawer .foot a[aria-current="page"] { background: rgb(255 255 255 / .78); }
.drawer .foot svg { width: 20px; height: 20px; color: var(--ink-2); }
/* 抽屉打开时一行行升起来 */
.app.open .drawer > :not(.drawer-bg) { animation: rise .42s var(--ease) backwards; }
.app.open .drawer > :nth-child(3) { animation-delay: .05s; } .app.open .drawer > :nth-child(4) { animation-delay: .1s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* 登录 */
.login .t-title { font-family: var(--sans); font-weight: 600; letter-spacing: -.01em; }
.login input { border-radius: 22px; }
.login .primary { background: var(--navy); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- 设置、角色卡这类子页（定稿见 docs/design/样张-设置.html）：浅灰底、白色分组卡片、顶上一颗玻璃返回键 ---------- */
.subpage { position: relative; background: var(--drawer); overflow: hidden; }
.subpage .scroll { position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; padding: calc(var(--safe-t) + 60px) 12px calc(var(--safe-b) + 24px); }
.subpage .scroll::-webkit-scrollbar { display: none; }
.subpage .fade-top { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--safe-t) + 70px); z-index: 9; pointer-events: none;
  background: linear-gradient(rgb(243 243 246 / .95) 0, rgb(243 243 246 / .9) calc(var(--safe-t) + 30px), rgb(243 243 246 / 0)); }
.topbar { position: absolute; top: calc(var(--safe-t) + 8px); left: 12px; right: 12px; height: 44px; z-index: 10; display: flex; align-items: center; gap: 10px; }
.topbar .title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.topbar .grow { flex: 1; }
.topbar .done { height: 44px; padding: 0 18px; border-radius: 22px; display: inline-flex; align-items: center; font-size: 15px; font-weight: 600; color: var(--ink); }
.topbar .done:disabled { color: var(--ink-3); }
.gname { margin: 18px 12px 6px; font-size: 12px; color: var(--ink-2); }
.subpage .scroll > :first-child > .gname:first-child, .subpage .scroll > .gname:first-child { margin-top: 4px; } /* 只有整页第一个分组名贴顶 */
.sgroup { background: #fff; border-radius: 18px; overflow: hidden; }
.srow { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 14px; position: relative; text-align: left; font-size: 15px; color: var(--ink); }
.srow + .srow::before, .sfield + .sfield::before, .sfield + .srow::before, .srow + .sfield::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; height: .5px; background: var(--line); }
button.srow:active { background: rgb(22 23 27 / .03); }
.srow .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.srow .main b { font-size: 15px; font-weight: 500; line-height: 20px; }
.srow .main span { font-size: 12px; line-height: 16px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.srow .val { font-size: 14px; color: var(--ink-3); white-space: nowrap; }
.srow .chev { width: 16px; height: 16px; color: var(--ink-3); flex: none; }
.srow .ricon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--drawer); color: var(--ink-2); }
.srow .ricon svg { width: 17px; height: 17px; }
.srow.add b { color: var(--blue); }
.srow.add .ricon { background: var(--chip); color: var(--blue); }
.srow.plain .main b { font-weight: 400; }
.srow.center { justify-content: center; }
.srow.center b { color: #c2412d; font-weight: 500; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 9px; background: var(--drawer); color: var(--ink-2); font-size: 10.5px; font-weight: 500; margin-left: 6px; vertical-align: 1px; }
.snote { margin: 6px 14px 0; font-size: 12px; line-height: 1.55; color: var(--ink-3); }
.sfield { display: block; padding: 9px 14px 10px; position: relative; }
.sfield > span { display: block; font-size: 12px; line-height: 16px; color: var(--ink-2); margin-bottom: 3px; }
.sfield input, .sfield textarea { width: 100%; border: 0; padding: 0; background: none; outline: none; resize: none; font: 15px/1.55 var(--sans); color: var(--ink); }
.sfield input::placeholder, .sfield textarea::placeholder { color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 14px 12px; }
.chips button { height: 28px; padding: 0 11px; border-radius: 14px; font-size: 12.5px; background: var(--drawer); color: var(--ink-2); }
.chips button[aria-pressed="true"] { background: var(--chip); color: var(--chip-ink); font-weight: 500; }

/* 子页的底部玻璃卡片（模型配置）：和聊天页的思考弹层同一种，高度跟着内容走 */
.subpage .scrim { position: absolute; inset: 0; z-index: 11; background: rgb(22 23 27 / .08); }
.subpage .sheet { position: absolute; left: 8px; right: 8px; bottom: var(--safe-b); z-index: 12; max-height: 86%; border-radius: 30px; padding: 0 16px 16px; display: flex; flex-direction: column;
  background: rgb(255 255 255 / .72); animation: sheet-up .32s var(--ease); overflow-y: auto; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .3; } }
.subpage .sheet .handle { position: static; align-self: center; width: 64px; height: 26px; display: grid; place-items: center; flex: none; }
.subpage .sheet .handle::after { content: ""; width: 36px; height: 4px; border-radius: 2px; background: rgb(22 23 27 / .18); }
.subpage .sheet-title { margin: 0 4px 12px; font-size: 17px; font-weight: 600; }
.subpage .sheet .sgroup { background: rgb(255 255 255 / .85); }
.subpage .ok { display: flex; align-items: center; gap: 6px; margin: 10px 6px 0; font-size: 12px; color: var(--ink-2); }
.subpage .ok i { width: 7px; height: 7px; border-radius: 50%; background: var(--live); flex: none; }
.subpage .ok.bad i { background: #c2412d; }
.subpage .btns { display: flex; gap: 8px; margin-top: 14px; }
.subpage .btn { flex: 1; height: 44px; border-radius: 22px; display: grid; place-items: center; font-size: 15px; font-weight: 600; }
.subpage .btn.ghost { background: rgb(255 255 255 / .5); color: var(--ink-2); box-shadow: inset 0 0 0 .5px rgb(22 23 27 / .1); }
.subpage .btn.solid { background: #fff; color: var(--blue); box-shadow: inset 0 0 0 .5px rgb(22 23 27 / .08), 0 2px 8px rgb(22 23 27 / .08); }
.subpage .btn:disabled { opacity: .5; }
.subpage .del { display: block; margin: 8px auto 0; height: 36px; padding: 0 12px; font-size: 13px; color: var(--ink-3); }
.hero { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 2px 0 16px; }
.hero .av { width: 84px; height: 84px; font-size: 30px; box-shadow: 0 2px 10px rgb(22 23 27 / .12); }
.hero .link { font-size: 13px; color: var(--blue); font-weight: 500; height: 28px; }
.wthumb { width: 44px; height: 30px; border-radius: 8px; background: var(--drawer) center / cover no-repeat; box-shadow: inset 0 0 0 .5px rgb(22 23 27 / .1); flex: none; }
.serr { margin: 10px 14px 0; font-size: 12px; color: #c2412d; }
