/* slplss：浅灰底、黑色气泡、大圆角加轻阴影（方案乙），标题栏用方正版（方案甲）。 */
:root {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --ink: #111318;
  --muted: #8A8F99;
  --line: #E2E5EA;
  --chip: #E6E8EC;
  --heart: #E5484D;
  --shade: 0 1px 2px rgba(17, 19, 24, .06), 0 8px 20px rgba(17, 19, 24, .06);
  --pop: 0 14px 36px rgba(17, 19, 24, .22);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased;
  font: 15px/1.55 "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
input, textarea { font: inherit; color: inherit; }
h1, h2, h3, p, ul { margin: 0; padding: 0; }
[hidden] { display: none !important; }
svg { width: 20px; height: 20px; fill: currentColor; display: block; flex: none; }
svg.line { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

#app { position: relative; height: 100dvh; max-width: 600px; margin: 0 auto; display: flex; flex-direction: column; overflow: hidden; }
@media (min-width: 640px) { #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

/* ---- 标题栏（方正版：居中标题、底部细线） ---- */
.top {
  flex: none; position: relative; display: flex; align-items: center; justify-content: space-between;
  height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0; border-bottom: 1px solid var(--line); background: var(--bg);
}
.top .title { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 17px; font-weight: 600; line-height: 24px; white-space: nowrap; }
.top .side { display: flex; align-items: center; min-width: 88px; }
.top .side.right { justify-content: flex-end; }
.icon { position: relative; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; }
.tbtn { display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 8px; border-radius: 12px; font-size: 14px; white-space: nowrap; }
.tbtn svg { width: 19px; height: 19px; }
.tbtn em { font: 600 12px/1 system-ui, sans-serif; font-style: normal; color: var(--muted); }
.tbtn em:empty { display: none; }
.top .side { min-width: 0; }
@media (max-width: 359px) { .tbtn span { display: none; } }

/* ---- 对话 ---- */
.thread { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; padding: 4px 14px 20px; }
.time { text-align: center; font-size: 12px; color: var(--muted); margin: 16px 0 4px; }
.msg { display: flex; margin: 12px 0; }
.msg.me { justify-content: flex-end; }
.bubble { max-width: 84%; padding: 10px 15px; border-radius: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.me .bubble { background: var(--ink); color: #fff; }
.them .bubble { background: var(--surface); box-shadow: var(--shade); }
.typing { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; }
.dots i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.note { font-size: 12px; color: var(--muted); margin: -4px 0 10px 6px; }
.hint { text-align: center; font-size: 12px; color: var(--muted); margin: 2px 0 8px; }

/* 一轮的图：横向滑动的大卡片 */
.strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; margin: 4px -14px 2px; padding: 4px 14px 12px; scrollbar-width: none; overscroll-behavior-x: contain; }
.strip::-webkit-scrollbar { display: none; }
.strip .card { flex: 0 0 62%; scroll-snap-align: center; }
.card { position: relative; display: block; min-width: 0; text-align: left; cursor: pointer; outline: none;
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.pic { position: relative; display: block; aspect-ratio: 9 / 16; border-radius: 22px; overflow: hidden; background: var(--chip); box-shadow: var(--shade); transition: transform .15s ease; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; -webkit-user-drag: none; }
.no { position: absolute; left: 10px; top: 10px; padding: 3px 9px; border-radius: 999px; background: var(--surface); font: 700 12px/1.3 system-ui, sans-serif; }
.favdot { position: absolute; right: 9px; top: 9px; width: 26px; height: 26px; border-radius: 50%; background: var(--surface); color: var(--heart); display: none; place-items: center; }
.favdot svg { width: 14px; height: 14px; }
.card.is-fav .favdot { display: grid; }
.cap { display: block; padding: 10px 6px 0; }
.cap b { display: block; font-size: 15px; font-weight: 600; line-height: 1.3; }
.cap i { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-style: normal; font-size: 12px; line-height: 1.45; color: var(--muted); margin-top: 3px; }
.pending { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; font-size: 13px; color: var(--muted); }
.card.is-pending .pic { background: linear-gradient(100deg, #E6E8EC 40%, #F4F5F7 50%, #E6E8EC 60%); background-size: 300% 100%; animation: sweep 1.6s linear infinite; }
@keyframes sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }
.card.pressed .pic { transform: scale(.97); }
.card:focus-visible .pic { outline: 2px solid var(--ink); outline-offset: 3px; }

/* 引用标签：输入框里和气泡里都是它 */
.ref {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; margin: 0 2px; padding: 0 10px 0 3px; vertical-align: middle;
  border-radius: 999px; background: var(--chip); color: var(--ink); font: 600 13px/1 system-ui, sans-serif; white-space: nowrap;
  -webkit-user-select: all; user-select: all;
}
.ref img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; object-position: 50% 8%; }
.ref.noimg { padding-left: 10px; }
.me .ref { background: rgba(255, 255, 255, .18); color: #fff; cursor: pointer; }
.them .ref { cursor: pointer; }

/* 长按菜单 */
.menu { position: fixed; z-index: 40; display: flex; gap: 2px; padding: 11px 9px; border-radius: 18px; background: var(--surface); box-shadow: var(--pop); }
.menu button { width: 58px; display: grid; justify-items: center; gap: 5px; font-size: 11px; white-space: nowrap; }
.menu .danger { color: var(--heart); }

/* 输入框 */
.composer { flex: none; padding: 8px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--bg); }
.field { display: flex; align-items: flex-end; gap: 8px; min-height: 48px; padding: 6px 6px 6px 18px; background: var(--surface); border-radius: 24px; box-shadow: var(--shade); }
.say { flex: 1; min-width: 0; min-height: 36px; max-height: 136px; overflow-y: auto; padding: 7px 0; font-size: 16px; line-height: 22px; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; }
.say:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.send { width: 36px; height: 36px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; flex: none; }
.send svg { width: 18px; height: 18px; }
.send:disabled { opacity: .22; cursor: default; }

/* ---- 登录、上传、设置 ---- */
.page { flex: 1; overflow-y: auto; padding: calc(48px + env(safe-area-inset-top)) 22px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; }
.brand h1 { font-size: 34px; line-height: 1.15; font-weight: 700; }
.brand p { margin-top: 10px; color: var(--muted); }
.brand.small h1 { font-size: 28px; }
.form { display: grid; gap: 8px; margin-top: 30px; }
.form label, .label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 0 6px; }
.label { margin-top: 24px; margin-bottom: 8px; }
.box { width: 100%; min-height: 48px; padding: 12px 18px; font-size: 16px; background: var(--surface); border: 0; border-radius: 999px; box-shadow: var(--shade); outline: none; }
.box:focus-visible { box-shadow: var(--shade), 0 0 0 2px var(--ink); }
.box.area { display: block; border-radius: 18px; min-height: 88px; resize: none; line-height: 1.5; }
.box::placeholder { color: var(--muted); }
.inline { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.btn { min-height: 48px; padding: 0 20px; font-weight: 600; border-radius: 999px; display: inline-grid; place-items: center; white-space: nowrap; }
.btn.solid { background: var(--ink); color: #fff; }
.btn.ghost { background: var(--surface); box-shadow: var(--shade); }
.btn.warn { background: var(--heart); color: #fff; }
.btn.wide { width: 100%; margin-top: 18px; }
.btn.mini { min-height: 34px; padding: 0 14px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: default; }
.fine { font-size: 12px; color: var(--muted); margin: 14px 6px 0; }
.foot { margin-top: auto; padding-top: 20px; font-size: 13px; color: var(--muted); text-align: center; }
.slots { display: flex; gap: 10px; margin-top: 26px; }
.slot { position: relative; flex: 1; min-width: 0; aspect-ratio: 9 / 14; border-radius: 22px; overflow: hidden; background: var(--surface); display: grid; place-items: center; color: var(--muted); box-shadow: var(--shade); }
.slot img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; }
.slot .x { position: absolute; right: 8px; top: 8px; width: 26px; height: 26px; border-radius: 50%; background: rgba(17, 19, 24, .6); color: #fff; display: grid; place-items: center; }
.slot .x svg { width: 13px; height: 13px; }
.slot.add { background: transparent; box-shadow: none; border: 1.5px dashed #C5C9D1; }
.slots.small { margin-top: 0; }
.slots.small .slot { flex: 0 0 84px; border-radius: 16px; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--chip); border-top-color: var(--ink); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tips { list-style: none; margin-top: 18px; display: grid; gap: 4px; color: var(--muted); font-size: 14px; }
.tips li::before { content: "·"; margin-right: 8px; color: var(--ink); font-weight: 700; }

.plain { padding-top: 16px; }
.plain section { margin-bottom: 26px; }
.plain h3 { font-size: 13px; font-weight: 400; color: var(--muted); margin: 0 0 10px 6px; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; min-height: 44px; background: var(--surface); border-radius: 999px; font-weight: 600; box-shadow: var(--shade); }
.seg button.on { background: var(--ink); color: #fff; }
.rowline { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 8px 8px 8px 16px; background: var(--surface); border-radius: 18px; box-shadow: var(--shade); font-size: 14px; }
.list { display: grid; margin-top: 10px; background: var(--surface); border-radius: 18px; overflow: hidden; box-shadow: var(--shade); }
.list button { text-align: left; padding: 14px 16px; }
.list button + button { border-top: 1px solid var(--line); }
.list .warn { color: var(--heart); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
.empty { color: var(--muted); text-align: center; margin-top: 90px; padding: 0 20px; }

/* ---- 全屏看图 ---- */
.viewer { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: #0B0C0E; color: #fff; }
.vtop { flex: none; display: flex; align-items: center; justify-content: space-between; padding: calc(4px + env(safe-area-inset-top)) 6px 4px; font-size: 14px; color: #C9CCD3; }
.vtop .icon { color: #fff; }
.vstage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.vstage img { max-width: 100%; max-height: 100%; object-fit: contain; -webkit-user-drag: none; user-select: none; }
.vnav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; }
.vnav.prev { left: 14px; }
.vnav.next { right: 14px; }
.vnav.next svg { transform: rotate(180deg); }
@media (hover: none) { .vnav { display: none; } }
.vbot { flex: none; width: 100%; max-width: 600px; margin: 0 auto; padding: 12px 16px calc(16px + env(safe-area-inset-bottom)); }
.vcap b { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 600; }
.vno { font: 700 12px/1.3 system-ui, sans-serif; padding: 3px 9px; border-radius: 999px; background: rgba(255, 255, 255, .14); }
.vcap i { display: block; font-style: normal; font-size: 13px; color: #C9CCD3; margin-top: 5px; }
.vact { display: flex; gap: 10px; margin-top: 14px; }
.vact button { flex: 1; min-height: 46px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; border-radius: 999px; background: rgba(255, 255, 255, .12); }
.vact button.on { background: #fff; color: var(--ink); }
.vact button.on svg { color: var(--heart); }

/* ---- 确认框、提示 ---- */
.scrim { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; justify-items: center; background: rgba(17, 19, 24, .36); }
.sheet { width: 100%; max-width: 600px; padding: 24px 18px calc(16px + env(safe-area-inset-bottom)); background: var(--surface); border-radius: 22px 22px 0 0; }
.sheet p { text-align: center; font-size: 16px; line-height: 1.6; margin: 0 8px 10px; }
.sheet .btn { margin-top: 10px; }
.sheet .btn.ghost { box-shadow: none; background: var(--bg); }
.toast { position: fixed; left: 50%; top: calc(66px + env(safe-area-inset-top)); z-index: 70; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 40px);
  padding: 9px 16px; border-radius: 999px; background: rgba(17, 19, 24, .9); color: #fff; font-size: 14px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .dots i, .card.is-pending .pic, .spin { animation: none; }
  .pic { transition: none; }
}

/* ---- pages under a header ---- */
.page.under { padding-top: 22px; }
.warnline { color: var(--heart); }

/* ---- photo slots: status, crop ---- */
.slot .pick { position: absolute; inset: 0; display: block; }
.slot .pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot.bad { box-shadow: 0 0 0 2px var(--heart), var(--shade); }
.slot .flag { position: absolute; left: 8px; bottom: 8px; padding: 3px 8px; border-radius: 999px; background: var(--heart); color: #fff; font-size: 12px; font-weight: 600; pointer-events: none; }
.slot .ctag { position: absolute; right: 8px; bottom: 8px; display: flex; align-items: center; gap: 3px; padding: 4px 9px 4px 7px; border-radius: 999px; background: rgba(17, 19, 24, .6); color: #fff; font-size: 12px; }
.slot .ctag svg { width: 13px; height: 13px; }
.slot.bad .ctag { display: none; }
.slots.small .ctag span { display: none; }
.slots.small .ctag { padding: 5px; right: 6px; bottom: 6px; }
.slots.small .flag { left: 6px; bottom: 6px; font-size: 11px; padding: 2px 6px; }
.slot.busy { display: grid; place-content: center; justify-items: center; gap: 8px; }
.slabel { font-size: 12px; color: var(--muted); }

/* ---- crop editor ---- */
.cropper { position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; background: #0B0C0E; color: #fff; }
.ctop { flex: none; margin: 0; padding: calc(16px + env(safe-area-inset-top)) 24px 8px; text-align: center; font-size: 14px; line-height: 1.5; color: #C9CCD3; }
.ctop.warn { color: #FF9EA1; }
.cstage { position: relative; flex: 1; min-height: 0; margin: 8px 18px; touch-action: none; overflow: hidden; }
.cstage img { position: absolute; display: block; -webkit-user-select: none; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.cbox { position: absolute; box-shadow: 0 0 0 9999px rgba(11, 12, 14, .62); outline: 1px solid rgba(255, 255, 255, .9); cursor: move; touch-action: none; }
.cbox::before, .cbox::after { content: ""; position: absolute; pointer-events: none; border: 0 solid rgba(255, 255, 255, .35); }
.cbox::before { left: 33.333%; right: 33.333%; top: 0; bottom: 0; border-left-width: 1px; border-right-width: 1px; }
.cbox::after { top: 33.333%; bottom: 33.333%; left: 0; right: 0; border-top-width: 1px; border-bottom-width: 1px; }
.cbox b { position: absolute; z-index: 1; }
.cbox b[data-h=nw], .cbox b[data-h=ne], .cbox b[data-h=sw], .cbox b[data-h=se] { width: 30px; height: 30px; }
.cbox b[data-h=nw] { left: -4px; top: -4px; border-left: 4px solid #fff; border-top: 4px solid #fff; cursor: nwse-resize; }
.cbox b[data-h=ne] { right: -4px; top: -4px; border-right: 4px solid #fff; border-top: 4px solid #fff; cursor: nesw-resize; }
.cbox b[data-h=sw] { left: -4px; bottom: -4px; border-left: 4px solid #fff; border-bottom: 4px solid #fff; cursor: nesw-resize; }
.cbox b[data-h=se] { right: -4px; bottom: -4px; border-right: 4px solid #fff; border-bottom: 4px solid #fff; cursor: nwse-resize; }
.cbox b[data-h=n], .cbox b[data-h=s] { left: 30px; right: 30px; height: 28px; cursor: ns-resize; }
.cbox b[data-h=n] { top: -14px; }
.cbox b[data-h=s] { bottom: -14px; }
.cbox b[data-h=w], .cbox b[data-h=e] { top: 30px; bottom: 30px; width: 28px; cursor: ew-resize; }
.cbox b[data-h=w] { left: -14px; }
.cbox b[data-h=e] { right: -14px; }
.cbox b[data-h=n]::after, .cbox b[data-h=s]::after { content: ""; position: absolute; left: 50%; top: 11px; width: 26px; height: 4px; margin-left: -13px; border-radius: 2px; background: #fff; }
.cbox b[data-h=w]::after, .cbox b[data-h=e]::after { content: ""; position: absolute; top: 50%; left: 11px; width: 4px; height: 26px; margin-top: -13px; border-radius: 2px; background: #fff; }
.cbar { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 10px 18px calc(16px + env(safe-area-inset-bottom)); }
.cbar button { min-height: 44px; padding: 0 14px; font-size: 16px; color: #fff; }
.cbar .ok { padding: 0 24px; border-radius: 999px; background: #fff; color: var(--ink); font-weight: 600; }
.cbar .ok:disabled { opacity: .6; }

/* ---- my photos at the top of a conversation ---- */
.mypics { display: flex; gap: 6px; justify-content: flex-end; max-width: 84%; }
.mypic { width: min(132px, 34vw); aspect-ratio: 3 / 4; border-radius: 16px; overflow: hidden; box-shadow: var(--shade); background: var(--chip); }
.mypics.n3 .mypic { width: min(104px, 27vw); }
.mypic img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; display: block; }

/* ---- conversations ---- */
.newchat { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 48px; margin-bottom: 18px; border-radius: 999px; background: var(--ink); color: #fff; font-weight: 600; }
.newchat svg { width: 18px; height: 18px; }
.slist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.srow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px 10px 10px; text-align: left; background: var(--surface); border-radius: 18px; box-shadow: var(--shade);
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.srow .cover { flex: none; width: 46px; height: 62px; border-radius: 12px; overflow: hidden; background: var(--chip); display: grid; place-items: center; color: var(--muted); }
.srow .cover img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.sinfo { flex: 1; min-width: 0; }
.sinfo b { display: block; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sinfo i { display: block; font-style: normal; font-size: 12px; color: var(--muted); margin-top: 3px; }
.srow em { flex: none; font-style: normal; font-size: 12px; color: var(--muted); padding: 2px 9px; border-radius: 999px; background: var(--chip); }
.plain .hint { margin-top: 16px; }

/* ---- the stylist's replies: a little Markdown ---- */
.bubble.md { white-space: normal; }
.bubble.md > * { margin: 0; }
.bubble.md > * + * { margin-top: 8px; }
.bubble.md ul, .bubble.md ol { padding-left: 1.25em; }
.bubble.md li + li { margin-top: 4px; }
.bubble.md li::marker { color: var(--muted); }
.bubble.md strong { font-weight: 600; }

/* ---- logo ---- */
.top .title { display: flex; align-items: center; height: 24px; }
.top .title .wordmark { display: block; height: 15px; width: auto; }
.brand .logo img { display: block; width: 148px; height: auto; margin-left: -6px; }
.brand .logo + p { margin-top: 18px; }

/* ---- start page: shorter, so the feedback line is on screen without scrolling ---- */
.box.area.short { min-height: 76px; }
.page.under .slots { margin-top: 20px; }
.page.under .label { margin-top: 20px; }

/* ---- crop editor while the photo loads ---- */
.cload { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: #C9CCD3; font-size: 14px; }
.cstage.loading .cload { display: flex; }
.cstage.loading img, .cstage.loading .cbox { visibility: hidden; }
.spin.light { border-color: rgba(255, 255, 255, .25); border-top-color: #fff; }
.cbar button:disabled { opacity: .45; }
