/* KRINO WORLD · 沿用鲸鱼娘的钴蓝铜版画风格（Whale Girl 前端的视觉标准） */
:root {
  --ink: #131319;
  --ink-2: #1a1a22;
  --ink-3: #22222c;
  --line: #2c2c38;
  --line-2: #3a3a48;
  --text: #ececf1;
  --muted: #8b8c9a;
  --silver: #b9bac7;
  --silver-hi: #e6e7ef;
  --cobalt: #1414a8;
  --cobalt-2: #2323c8;
  --cobalt-dk: #0c0c78;
  --rose: #c75b84;
  --danger: #e2556b;
  --ok: #7fd1a8;
  --char: #5b8fd6;
  --sans: "Inter", "Helvetica Neue", -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.65 var(--sans); color: var(--text); background: var(--ink); overflow: hidden; -webkit-font-smoothing: antialiased; }
::selection { background: var(--cobalt); color: var(--silver-hi); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); }
::-webkit-scrollbar-track { background: transparent; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }
.error { color: var(--danger); min-height: 1.2em; }
.mono { font-family: var(--mono); letter-spacing: .08em; }
.eyebrow { font-size: 11px; color: var(--muted); letter-spacing: .2em; margin-bottom: 6px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row.right { justify-content: flex-end; }
a { color: var(--silver); }
code { font-family: var(--mono); font-size: 12px; color: var(--silver-hi); background: var(--ink-3); padding: 1px 5px; }

/* 全屏颗粒 */
#grain { position: fixed; inset: -50%; z-index: 90; pointer-events: none; background: var(--noise); opacity: .045; animation: grain 1.2s steps(6) infinite; }

/* ---------- 表单 ---------- */
input, select, textarea {
  font: inherit; color: inherit; width: 100%; background: var(--ink); border: 1px solid var(--line); border-radius: 2px; padding: 9px 12px;
  transition: border-color .25s var(--ease), background .25s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--silver); background: var(--ink-2); }
input[type=checkbox] { accent-color: var(--cobalt-2); width: 15px; height: 15px; }
input[type=range] { accent-color: var(--silver); padding: 0; border: 0; background: none; }
textarea { resize: vertical; }
label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }
label > input, label > textarea, label > select { margin-top: 6px; color: var(--text); font-size: 14px; }
label.inline { display: flex; gap: 8px; align-items: center; color: var(--text); }
label.inline input, label.inline select { width: auto; margin: 0; }

button {
  font: inherit; font-weight: 500; letter-spacing: .04em; border: 1px solid var(--silver); border-radius: 2px; padding: 8px 18px; cursor: pointer; white-space: nowrap;
  color: var(--ink); background: var(--silver); position: relative; overflow: hidden; isolation: isolate; transition: color .3s var(--ease), border-color .3s;
}
button::before { content: ""; position: absolute; inset: 0; z-index: -1; background: var(--silver-hi); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
button:hover::before { transform: scaleX(1); }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
button.ghost::before { background: var(--ink-3); }
button.ghost:hover { border-color: var(--silver); }
button.danger { background: transparent; color: var(--danger); border-color: rgba(226, 85, 107, .5); }
button.danger::before { background: rgba(226, 85, 107, .12); }
button.link { background: none; border: 0; color: var(--muted); padding: 0; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); }
button.link::before { display: none; }
button.link:hover { color: var(--text); }
button.small { padding: 4px 11px; font-size: 12px; }
button:disabled { opacity: .35; cursor: default; }
button:disabled::before { display: none; }
.badge { font: 11px var(--mono); letter-spacing: .06em; color: var(--silver); border: 1px solid var(--line-2); padding: 0 6px; vertical-align: middle; white-space: nowrap; }
.badge.warn { color: var(--danger); border-color: rgba(226, 85, 107, .45); }
.badge.cobalt { background: var(--cobalt); border-color: var(--cobalt); color: var(--silver-hi); }
.tag { color: var(--silver); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: pulse 2.4s infinite; }

/* ---------- 钴蓝铜版画 ---------- */
.plate {
  position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--cobalt);
  background-image: radial-gradient(ellipse at 50% 35%, rgba(60, 60, 230, .55), transparent 70%);
}
.plate::after { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .32; mix-blend-mode: overlay; pointer-events: none; animation: grain 1.6s steps(5) infinite; }
.plate-fig {
  position: absolute; inset: 4% 4% 0;
  -webkit-mask: url(/static/assets/kujira-line.png) center bottom / contain no-repeat; mask: url(/static/assets/kujira-line.png) center bottom / contain no-repeat;
  background: linear-gradient(115deg, var(--silver) 0 42%, #f4f5fb 50%, var(--silver) 58% 100%) 0 0 / 300% 100%;
  animation: sheen 7s ease-in-out infinite, breathe 6s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.plate-scan { position: absolute; left: 0; right: 0; top: 0; height: 100%; pointer-events: none; }
/* 印刷式出现：从上往下显影，一条亮线扫过 */
.plate.print .plate-fig, .plate.hero .plate-fig, .plate.stand .plate-fig { animation: develop 1.8s var(--ease) both, sheen 7s 1.8s ease-in-out infinite, breathe 6s 1.8s ease-in-out infinite; }
.plate.print .plate-scan::before, .plate.hero .plate-scan::before, .plate.stand .plate-scan::before {
  content: ""; position: absolute; left: 0; right: 0; height: 2px; background: var(--silver-hi); box-shadow: 0 0 18px 4px rgba(230, 231, 239, .55);
  animation: scan 1.8s var(--ease) both;
}
.fig-head {
  display: block; width: 100%; height: 100%; background: var(--silver);
  -webkit-mask: url(/static/assets/kujira-head.png) center / cover no-repeat; mask: url(/static/assets/kujira-head.png) center / cover no-repeat;
}
[data-talk] { position: relative; cursor: pointer; }
.say {
  position: absolute; left: 12px; top: 12px; z-index: 3; max-width: calc(100% - 24px);
  background: var(--ink); color: var(--silver-hi); font-size: 13px; padding: 6px 12px; border: 1px solid var(--silver);
}
.say.in { animation: type-in .5s steps(12) both; }

/* ---------- 开场 ---------- */
.boot { position: fixed; inset: 0; z-index: 80; background: var(--ink); display: grid; place-content: center; justify-items: center; gap: 16px; transition: opacity .7s var(--ease), visibility .7s; }
.boot.done { opacity: 0; visibility: hidden; }
.boot-plate { width: min(260px, 60vw); aspect-ratio: 3 / 4.2; }
/* 加载页：头顶钢盆的线稿（老梗），用钴蓝铜版画的显影动画 */
.boot-plate.bowl { width: min(360px, 70vw); aspect-ratio: 946 / 658; }
.plate.bowl .plate-fig { inset: 6% 6% 0;
  -webkit-mask: url(/static/assets/kujira-bowl.png) center bottom / contain no-repeat; mask: url(/static/assets/kujira-bowl.png) center bottom / contain no-repeat; }
.boot-line { width: min(360px, 70vw); display: flex; justify-content: center; font-size: 10px; color: var(--muted); letter-spacing: .25em; }
.boot-count { animation: pulse 1s infinite; }

/* ---------- 登录 ---------- */
.auth { position: relative; z-index: 1; height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr); }
.auth-art { height: 100%; background: radial-gradient(ellipse at 50% 40%, rgba(60, 60, 230, .5), transparent 65%), var(--cobalt-dk);
  display: grid; place-items: end center; overflow: hidden; }
.auth-art img { height: 96%; max-width: 92%; object-fit: contain; animation: develop 1.6s var(--ease) both, breathe 6s 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
.auth-side { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 88px); animation: rise .9s .3s var(--ease) both; }
.auth-side h1 { font-size: clamp(40px, 6vw, 72px); font-weight: 300; letter-spacing: .02em; margin: 0; line-height: 1.05; }
.auth-side .lead { color: var(--muted); font-size: 16px; margin: 10px 0 34px; }
.auth-side form { max-width: 360px; }
.field span { font-size: 10px; letter-spacing: .2em; }
.auth-side .row button { flex: 1; }
.fine { font-size: 10px; color: var(--muted); letter-spacing: .2em; margin-top: 30px; }

/* ---------- 布局 ---------- */
.app { position: relative; z-index: 1; display: flex; height: 100%; animation: fade .6s var(--ease); }
.sidebar { width: 228px; flex-shrink: 0; display: flex; flex-direction: column; padding: 18px 14px; gap: 2px; overflow: hidden; background: var(--ink); border-right: 1px solid var(--line); }
/* 左上角的标志和左下角的账号一直在原地，只有中间（角色列表、页面导航）在角色多的时候自己滚 */
.sidebar .brand, .sidebar-foot { flex-shrink: 0; }
.sidebar-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 -14px; padding: 0 14px 12px;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.brand { display: flex; gap: 12px; align-items: center; padding: 2px 4px 16px; }
.brand-mark { width: 44px; height: 44px; flex-shrink: 0; background: var(--cobalt); overflow: hidden; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; }
.brand-name { font-size: 17px; font-weight: 500; letter-spacing: .06em; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: .3em; }
.section-title { font-size: 10px; color: var(--muted); letter-spacing: .25em; margin: 16px 4px 8px; display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.char-list { display: flex; flex-direction: column; gap: 2px; }
.char-item { display: flex; gap: 10px; align-items: center; padding: 7px 6px; cursor: pointer; position: relative; transition: background .22s var(--ease); }
.char-item:hover { background: var(--ink-2); }
.char-item.active { background: var(--ink-3); }
.char-item.active::before { content: ""; position: absolute; left: -14px; top: 0; bottom: 0; width: 2px; background: var(--silver); transform-origin: center; animation: bar-in .22s var(--ease); }
.char-item .name { font-weight: 500; font-size: 14px; }
.char-item .muted { font-size: 11px; }
.char-item .char-text { min-width: 0; flex: 1; }  /* 让描述在侧栏宽度内换行，不撑出去 */
.char-item .tagline { line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }

/* 头像：钴蓝方块，主角用线稿头像，其他用首字 */
.ava { --s: 32px; width: var(--s); height: var(--s); flex-shrink: 0; display: grid; place-items: center; overflow: hidden; position: relative; background: var(--cobalt); color: var(--silver-hi); font-size: calc(var(--s) * .45); font-weight: 400; }
.ava::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--c, var(--silver)); }
.ava.lg { --s: 56px; }

.nav { display: flex; flex-direction: column; }
.nav button { background: none; border: 0; color: var(--muted); text-align: left; display: flex; align-items: center; gap: 12px; padding: 8px 6px; font-weight: 400; }
.nav button::before { background: var(--ink-2); }
.nav button em { font-style: normal; font-size: 10px; color: var(--line-2); transition: color .25s; }
.nav button:hover { color: var(--text); }
.nav button.active { color: var(--text); }
.nav button.active em { color: var(--silver); }
.nav button.active::after { content: ""; position: absolute; right: 6px; top: 50%; width: 14px; height: 1px; background: var(--silver); animation: draw .4s var(--ease); }
.sidebar-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: center; padding: 14px 4px 0; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 28px 36px; overflow-y: auto; }
.view.view-enter { animation: rise .25s var(--ease); }  /* 切页面要跟手：长了像卡 */
/* 切页发丝线只作用在圈子以外的页面。圈子仍用原来的 rise，不改像素小镇。 */
.view:not(#view-social) { position: relative; }
.view.view-enter:not(#view-social) { animation: none; }
.view.view-enter:not(#view-social)::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; z-index: 4; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(95, 212, 255, .9) 42%, var(--silver-hi) 50%, rgba(199, 91, 132, .55) 60%, transparent);
  transform-origin: left center; animation: draw .46s var(--ease) both;
}
.page-head { margin-bottom: 18px; }
.page-head h2 { margin: 0 0 6px; font-size: 28px; font-weight: 300; letter-spacing: .02em; }
.page-head p { margin: 0; max-width: 680px; }
.toolbar { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.toolbar select { width: auto; }
.panel { background: var(--ink-2); border: 1px solid var(--line); padding: 16px 18px; }

/* ---------- 聊天 ---------- */
#view-chat { padding: 0; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; padding: 12px 22px; border-bottom: 1px solid var(--line); }
.chat-title { display: flex; gap: 12px; align-items: center; }
.chat-title .ava { --s: 40px; }
.chat-title .name { font-weight: 500; font-size: 16px; letter-spacing: .04em; }
.chat-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat-actions select { width: 200px; padding: 6px 10px; }
.chat-body { flex: 1; min-height: 0; display: flex; }
.messages { flex: 1; overflow-y: auto; padding: 28px 30px; display: flex; flex-direction: column; gap: 20px; }
.msg { max-width: 72%; display: flex; gap: 12px; }
.msg.enter { animation: rise .55s var(--ease) both; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg .ava { --s: 32px; margin-top: 22px; }
.msg-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.msg.user .msg-col { align-items: flex-end; }
.msg .who { font: 10px var(--mono); color: var(--muted); letter-spacing: .2em; text-transform: uppercase; }
.msg .bubble { padding: 11px 15px; white-space: pre-wrap; word-break: break-word; line-height: 1.75; }
.msg.user .bubble { background: var(--silver); color: var(--ink); }
.msg.assistant .bubble { background: var(--ink-2); border: 1px solid var(--line); border-left: 2px solid var(--c, var(--silver)); }
.msg-tools { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--muted); align-items: center; opacity: 0; transition: opacity .25s; }
.msg:hover .msg-tools, .msg-tools:has(.chip) { opacity: 1; }
.chip { display: inline-flex; align-items: center; gap: 8px; border: 1px dashed var(--line-2); color: var(--text); padding: 3px 4px 3px 10px; font-size: 12px; animation: fade .5s .3s both; }
.chip b { font: 10px var(--mono); letter-spacing: .15em; color: var(--muted); font-weight: 400; }
.chip button { padding: 1px 10px; font-size: 12px; }
details.trace { font-size: 12px; color: var(--muted); max-width: 100%; }
details.trace summary { cursor: pointer; list-style: none; font: 11px var(--mono); letter-spacing: .08em; opacity: .55; }
details.trace summary::-webkit-details-marker { display: none; }
details.trace summary:hover, details.trace[open] summary { opacity: 1; color: var(--text); }
details.trace > div, details.trace ul { margin: 6px 0 0; padding: 6px 10px 6px 20px; border-left: 1px solid var(--line-2); }
details.trace > div { padding-left: 10px; }
.typing { align-self: flex-start; display: flex; gap: 12px; align-items: center; animation: fade .3s both; }
.typing .dots { display: flex; gap: 5px; padding: 14px 16px; background: var(--ink-2); border: 1px solid var(--line); }
.typing .dots i { width: 5px; height: 5px; background: var(--silver); animation: dot 1.2s infinite var(--ease); }
.typing .dots i:nth-child(2) { animation-delay: .15s; }
.typing .dots i:nth-child(3) { animation-delay: .3s; }
.typing .lbl { font: 11px var(--mono); color: var(--muted); letter-spacing: .1em; }
.empty { margin: auto; text-align: center; display: grid; justify-items: center; gap: 10px; animation: rise .7s var(--ease); }
.empty .em-title { font-size: 26px; font-weight: 300; letter-spacing: .04em; }
.empty .em-greet { color: var(--muted); max-width: 420px; }
.chat-form { display: flex; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); }
.chat-form textarea { flex: 1; resize: none; }
#send-btn { padding: 0 26px; }
#send-btn:disabled { animation: pulse 1s infinite; }

/* ---------- 记忆 ---------- */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--ink-2); border: 1px solid var(--line); padding: 14px 18px; transition: border-color .3s, transform .3s var(--ease); animation: rise .5s var(--ease) both; }
.card:hover { border-color: var(--line-2); transform: translateX(3px); }
.card-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.card-head .title { font-weight: 500; }
.card-body { margin-top: 6px; }
.card-body p { margin: 4px 0; }
.card .meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.card .meta .stars { font-family: var(--mono); letter-spacing: .1em; color: var(--silver); }

/* ---------- 人设 ---------- */
.persona-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.lore-list a { display: inline-block; margin: 2px 10px 2px 0; }
.library { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.lib-card {
  background: var(--ink-2); border: 1px solid var(--line); padding: 16px; position: relative; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .3s, transform .35s var(--ease); animation: rise .5s var(--ease) both;
}
.lib-card:hover { border-color: var(--line-2); transform: translateY(-3px); }
.lib-card h3 { margin: 6px 0 0; font-size: 17px; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.lib-card p { margin: 0; }
.lib-card .row { margin-top: auto; padding-top: 8px; }
.lib-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-card.pickable { cursor: pointer; }
.lib-card.picked { border-color: var(--silver); box-shadow: inset 0 0 0 1px var(--silver); }
.lib-card .check { position: absolute; right: 12px; top: 12px; width: 18px; height: 18px; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 12px; transition: background .2s; }
.lib-card.picked .check { background: var(--silver); border-color: var(--silver); color: var(--ink); }
.lib-card.done { opacity: .5; cursor: default; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { background: none; color: var(--muted); border-color: var(--line-2); padding: 3px 12px; font-size: 12px; }
.chips button::before { background: var(--ink-3); }
.chips button.active { color: var(--ink); background: var(--silver); border-color: var(--silver); }
.pick-bar {
  position: sticky; bottom: -28px; margin: 18px -36px -28px; padding: 12px 36px; display: flex; justify-content: flex-end; gap: 14px; align-items: center;
  background: rgba(19, 19, 25, .92); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-top: 1px solid var(--line);
}
.pick-bar span { font-size: 11px; color: var(--muted); }

.create { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px; align-items: start; }
.create-out:empty { display: none; }
.create-out .gen-loading { aspect-ratio: 4 / 3; }
.gen-form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.lore-edit { border-top: 1px solid var(--line); padding-top: 6px; }

.dropzone { position: relative; border: 1px dashed var(--line-2); min-height: 170px; display: grid; place-items: center; text-align: center; transition: border-color .25s, background .25s; background: var(--ink-2); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone.over, .dropzone:hover { border-color: var(--silver); background: var(--ink-3); }
.dz-title { font-size: 17px; font-weight: 300; letter-spacing: .04em; margin-bottom: 4px; }
.note { margin-top: 18px; max-width: 760px; }
.note ul { margin: 6px 0 10px; padding-left: 18px; }
.import input[type=file] { width: auto; }
.settings { max-width: 580px; }
fieldset { border: 1px solid var(--line); margin: 14px 0; }
legend { font-size: 10px; letter-spacing: .2em; color: var(--muted); padding: 0 6px; }

/* ---------- 弹窗 / 提示 ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(8, 8, 12, .72); display: grid; place-items: center; padding: 16px; animation: fade .25s; }
.modal-card { background: var(--ink-2); border: 1px solid var(--line-2); padding: 22px 24px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; transform-origin: center top; animation: panel-in .28s var(--ease); box-shadow: 0 0 0 1px rgba(95, 212, 255, .18); }
.modal-card h3 { margin: 0 0 8px; font-weight: 400; font-size: 20px; }
.toast { position: fixed; bottom: 26px; left: 50%; translate: -50% 0; z-index: 70; padding: 9px 18px; background: var(--silver); color: var(--ink); font-size: 13px; animation: toast .4s var(--ease); }

/* ---------- 动画 ---------- */
@keyframes grain { 0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); } 60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); } }
@keyframes sheen { 0%, 55% { background-position: 100% 0; } 100% { background-position: -50% 0; } }
@keyframes breathe { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-4px) scale(1.006); } }
@keyframes develop { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes scan { 0% { top: 0; opacity: 1; } 90% { opacity: 1; } 100% { top: 100%; opacity: 0; } }
@keyframes type-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes panel-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bar-in { from { transform: scaleY(.15); } to { transform: scaleY(1); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes draw { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes toast { from { opacity: 0; translate: -50% 14px; } to { opacity: 1; translate: -50% 0; } }
@keyframes dot { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes pulse { 50% { opacity: .35; } }


/* ---------- 记忆侧栏 ---------- */
.chat-body { position: relative; }
.drawer { width: 340px; flex-shrink: 0; border-left: 1px solid var(--line); background: var(--ink-2); display: flex; flex-direction: column; min-height: 0; animation: drawer-in .35s var(--ease); }
.drawer-head { display: flex; align-items: center; gap: 6px; padding: 10px 12px 0; border-bottom: 1px solid var(--line); }
.drawer-head .tabs { margin: 0; display: flex; gap: 2px; flex: 1; }
.drawer-head .tabs button { background: none; border: 0; color: var(--muted); padding: 6px 8px 9px; font-size: 12px; border-bottom: 2px solid transparent; }
.drawer-head .tabs button::before { display: none; }
.drawer-head .tabs button.active { color: var(--silver-hi); border-bottom-color: var(--char); }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 14px 18px; }
.drawer-body > div > input { width: 100%; margin-bottom: 8px; }
.drawer-body .chips { margin-bottom: 10px; }
.drawer-body label.inline { display: flex; margin: 4px 0; }
.count { font: 10px var(--mono); margin-left: 4px; color: var(--char); }
.dot-badge { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--rose); margin-left: 6px; vertical-align: middle; animation: fade .4s; }
.mem-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.mem-card { border: 1px solid var(--line); border-left: 2px solid var(--char); padding: 9px 11px; background: var(--ink); animation: rise .4s var(--ease) both; transition: border-color .25s; }
.mem-card:hover { border-color: var(--line-2); border-left-color: var(--char); }
.mem-card.archived, .mem-card.forgotten, .mem-card.superseded { opacity: .62; border-left-color: var(--line-2); }
.mem-card.ask { border-left-color: var(--rose); }
.mem-text { cursor: pointer; line-height: 1.6; }
.mem-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 5px; }
.mem-acts { display: flex; gap: 12px; margin-top: 6px; opacity: .0; transition: opacity .2s; }
.mem-card:hover .mem-acts, .mem-card.ask .mem-acts { opacity: 1; }
.danger-link { color: var(--danger) !important; }
.badge.rp { color: #c9a8ff; border-color: rgba(201, 168, 255, .45); }
.badge.demo { color: var(--ink); background: #f0c987; border-color: #f0c987; cursor: help; margin-left: 6px; }
.persona-card { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.persona-card .name { font-size: 16px; font-weight: 500; }
.ver { border-bottom: 1px solid var(--line); padding: 8px 0; }
.ver pre, .dev-fm { white-space: pre-wrap; background: var(--ink); padding: 8px; max-height: 220px; overflow: auto; }
table.map { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.map td { border-bottom: 1px solid var(--line); padding: 4px 6px; vertical-align: top; }
.warn-list { color: #f0c987; }
.detail-content { font-size: 15px; line-height: 1.7; }
ul.src, ol.hist { padding-left: 18px; margin: 4px 0; }
ol.hist li.cur { color: var(--silver-hi); }
q { color: var(--silver-hi); }

/* 每轮之后的记忆提示 */
.mem-pill { align-self: flex-start; background: none; border: 1px dashed var(--line-2); color: var(--muted); font-size: 12px; padding: 2px 10px; animation: fade .6s .2s both; }
.mem-pill::before { display: none; }
.mem-pill:hover { color: var(--silver-hi); border-color: var(--char); }
.trace ul { margin: 4px 0; padding-left: 18px; }

/* ---------- 创意工坊 ---------- */
.ws-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.ws-bar input { flex: 1; min-width: 200px; }
.ws-tags { margin-bottom: 14px; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.ws-card { background: var(--ink-2); border: 1px solid var(--line); cursor: pointer; overflow: hidden; animation: rise .45s var(--ease) both; transition: border-color .25s, transform .25s var(--ease); }
.ws-card:hover { border-color: var(--silver); transform: translateY(-3px); }
.ws-card.dim { opacity: .55; }
.ws-cover { position: relative; aspect-ratio: 16 / 7; background: var(--c); overflow: hidden; display: grid; place-items: center;
  background-image: radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, .22), transparent 60%), linear-gradient(160deg, transparent 40%, rgba(0, 0, 0, .35)); }
.ws-cover::after { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .3; mix-blend-mode: overlay; }
.ws-cover span { font-size: 44px; font-weight: 300; color: var(--silver-hi); text-shadow: 0 2px 18px rgba(0, 0, 0, .35); transition: transform .5s var(--ease); }
.ws-card:hover .ws-cover span { transform: scale(1.12) rotate(-4deg); }
.ws-cover i { position: absolute; right: 8px; bottom: 6px; font-style: normal; font-size: 10px; color: var(--silver-hi); opacity: .8; }
.ws-info { padding: 10px 12px 12px; }
.ws-info h3 { margin: 0; font-size: 15px; font-weight: 500; }
.ws-info p { margin: 2px 0 8px; min-height: 2.6em; }
.ws-meta, .ws-stats { display: flex; gap: 10px; color: var(--muted); align-items: center; }
.ws-stats { margin-top: 6px; color: var(--silver); }
.ws-empty { grid-column: 1 / -1; }
.modal-card.wide { width: min(820px, 100%); }
.ws-detail-head { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: start; margin-bottom: 10px; }
.ws-detail-head .ws-cover { aspect-ratio: 4 / 3; }
.ws-credit a { color: var(--silver-hi); }
.ws-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.vote { background: transparent; color: var(--text); border-color: var(--line-2); padding: 4px 12px; font-size: 12px; }
.vote::before { background: var(--ink-3); }
.vote.on { border-color: var(--silver); background: var(--cobalt); color: var(--silver-hi); }
.vote.on::before { display: none; }
.ws-body { max-height: 260px; overflow-y: auto; background: var(--ink); border: 1px solid var(--line); padding: 4px 14px; font-size: 13px; }
.ws-log { padding-left: 0; list-style: none; margin: 4px 0; display: grid; gap: 3px; font-size: 13px; }
.ws-cform { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.ws-c { border-bottom: 1px solid var(--line); padding: 6px 0; animation: rise .3s var(--ease) both; }
.ws-c > div { display: flex; gap: 8px; align-items: center; }
.ws-c p { margin: 3px 0 0; }
.ws-mine-row { margin-top: 0; }

/* ---------- 你们 ---------- */
.bond-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.bond-stage { font-size: 22px; font-weight: 300; letter-spacing: .1em; color: var(--silver-hi); }
.bond-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; font-size: 11px; color: var(--muted); text-align: center; margin-bottom: 6px; }
.bond-steps span { border-top: 2px solid var(--line-2); padding-top: 3px; }
.bond-steps .past { border-color: var(--silver); color: var(--silver); }
.bond-steps .now { border-color: var(--char); color: var(--silver-hi); }
.bond-track { margin: 4px 0 6px; }
.bond-track i { background: var(--char); }
.bond-view { font-size: 14px; line-height: 1.7; color: var(--silver-hi); margin: 4px 0; }
.bond-ms { list-style: none; padding: 0; margin: 4px 0; display: grid; gap: 4px; }
.bond-ms li { display: grid; grid-template-columns: 44px 1fr auto; gap: 8px; align-items: baseline; font-size: 13px; }
.bond-ms li button { opacity: 0; } .bond-ms li:hover button { opacity: 1; }

@media (max-width: 860px) {
  .ws-detail-head { grid-template-columns: 1fr; }
  .ws-grid { grid-template-columns: 1fr; }
}

/* ---------- 头像 ---------- */
.ava img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ava.sm { --s: 24px; }
.ava.xl { --s: 88px; }
.ava.xxl { --s: 148px; font-size: 56px; }
.adopt-btn { display: flex; justify-content: space-between; width: calc(100% - 24px); margin: 6px 12px 0; background: transparent; color: var(--muted); border: 1px dashed var(--line-2); padding: 7px 12px; font-size: 12px; }
.adopt-btn::before { background: var(--ink-3); }
.adopt-btn:hover { color: var(--silver-hi); border-color: var(--silver); }
.adopt-card { display: grid; place-items: center; align-content: center; gap: 6px; min-height: 180px; background: transparent; color: var(--muted); border: 1px dashed var(--line-2); font-size: 14px; }
.adopt-card::before { background: var(--ink-2); }
.adopt-card span { font-size: 34px; font-weight: 200; line-height: 1; }
.adopt-card em { font-style: normal; font-size: 11px; }
.adopt-card:hover { color: var(--silver-hi); border-color: var(--silver); }

/* ======================================================================
   KRINO WORLD 新增：3D 舞台、语音、人格编辑器、眼镜模拟器。全部沿用上面的色板与组件。
   ====================================================================== */
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { background: none; border: 0; color: var(--muted); padding: 8px 0; font-weight: 400; border-bottom: 2px solid transparent; }
.tabs button::before { display: none; }
.tabs button.active { color: var(--silver-hi); border-bottom-color: var(--silver); }
.track { height: 3px; background: var(--line); overflow: hidden; }
.track i { display: block; height: 100%; background: var(--silver); transition: width .6s var(--ease); }
.ai-badge { font: 10px var(--mono); letter-spacing: .15em; color: var(--silver-hi); background: var(--cobalt); padding: 1px 6px; vertical-align: middle; }

.chat-col { flex: 1; min-width: 320px; display: flex; flex-direction: column; min-height: 0; }
.chat-col .messages { padding: 22px 22px; }
.chat-col .msg { max-width: 88%; }
.msg.event { align-self: center; max-width: 100%; font-size: 12px; color: var(--muted); font-family: var(--mono); letter-spacing: .05em; }
.msg .bubble.story { border-left-color: #c9a8ff; }
.msg .acts { display: flex; gap: 6px; flex-wrap: wrap; }
.msg .acts .badge { font-size: 10px; }
.net-banner { background: rgba(226, 85, 107, .14); color: var(--danger); border-bottom: 1px solid rgba(226, 85, 107, .4); padding: 6px 22px; font-size: 12px; }
.chat-form { align-items: stretch; }
.img-chip { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); padding: 0 22px 6px; }
.img-chip img { height: 34px; border: 1px solid var(--line-2); }

/* 人格编辑器 */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.field-grid .full { grid-column: 1 / -1; }
.source-editor { font: 13px/1.6 var(--mono); min-height: 480px; tab-size: 2; }
.slider-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; margin: 6px 0; font-size: 13px; color: var(--muted); }
.slider-row span:last-child { font: 11px var(--mono); color: var(--silver); text-align: right; }
.pick-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-grid label { margin: 0; display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line-2); padding: 3px 10px; color: var(--text); font-size: 12px; cursor: pointer; }
.pick-grid label:has(input:checked) { border-color: var(--silver); background: var(--ink-3); }
.pick-grid input { width: auto; margin: 0; }
.lore-item { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 8px; }
.sticky-bar { position: sticky; bottom: -28px; margin: 18px -36px -28px; padding: 12px 36px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: rgba(19, 19, 25, .92); backdrop-filter: blur(8px); border-top: 1px solid var(--line); z-index: 3; }
.char-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 18px; }

.badge.real { color: var(--ok); border-color: rgba(127, 209, 168, .45); }
.badge.story { color: #c9a8ff; border-color: rgba(201, 168, 255, .45); }
.badge.inferred { color: #f0c987; border-color: rgba(240, 201, 135, .45); }

/* 设置 */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.svc { display: grid; grid-template-columns: 52px 1fr auto; gap: 4px 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.svc b { font: 11px var(--mono); letter-spacing: .12em; }
.ok-txt { color: var(--ok); } .warn-txt { color: #f0c987; } .err-txt { color: var(--danger); }
table.res { width: 100%; border-collapse: collapse; font-size: 12px; }
table.res td, table.res th { text-align: left; border-bottom: 1px solid var(--line); padding: 4px 6px; vertical-align: top; }
table.res th { font: 10px var(--mono); color: var(--muted); letter-spacing: .12em; font-weight: 400; }

/* 眼镜模拟器：左边是“镜片里看到的”（摄像头 + AR 叠加），右边是设备状态和输入 */
.glasses { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.lens { position: relative; aspect-ratio: 16 / 10; background: #08080c; border: 1px solid var(--line-2); overflow: hidden; }
.lens video, .lens .lens-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lens .lens-bg { background: radial-gradient(ellipse at 50% 120%, #1d1d6a, #08080c 70%);
  background-image: linear-gradient(rgba(185, 186, 199, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(185, 186, 199, .06) 1px, transparent 1px);
  background-size: 40px 40px; }
.lens { cursor: grab; touch-action: none; user-select: none; }
.lens:active { cursor: grabbing; }
/* 她：left/top 是她身体中心在镜片里的位置（由头部姿态和她在世界里的位置算出），--s 是远近缩放。转头时立即跟上；走到你眼前时才平滑移动 */
.lens .ar-avatar, .device-lens .ar-avatar { position: absolute; width: 34%; aspect-ratio: 3 / 4; translate: -50% -55%; scale: var(--s, 1); transition: opacity .3s; pointer-events: none; }
.lens .ar-avatar.walk, .device-lens .ar-avatar.walk { transition: left .8s var(--ease), top .8s var(--ease), scale .8s var(--ease), opacity .3s; }
.lens .ar-avatar.out, .device-lens .ar-avatar.out { opacity: 0; }
.ar-edge { position: absolute; width: 0; height: 0; translate: -50% -50%; border: 9px solid transparent; border-left: 15px solid #3df5ff; filter: drop-shadow(0 0 4px rgba(61, 245, 255, .7));
  pointer-events: none; animation: edge-pulse 1.4s ease-in-out infinite; }
.ar-edge[hidden] { display: none; }
@keyframes edge-pulse { 50% { opacity: .45; } }
.lens .ar-subtitle.live, .device-lens .ar-subtitle.live { border-style: dashed; }
.lens .ar-subtitle.system, .device-lens .ar-subtitle.system { color: #ffb3c4; }
.lens .ar-subtitle { position: absolute; left: 50%; bottom: 7%; translate: -50% 0; max-width: 80%; background: rgba(8, 8, 12, .7); border: 1px solid rgba(230, 231, 239, .5);
  color: var(--silver-hi); padding: 6px 14px; font-size: 14px; animation: fade .3s; }
.lens .ar-subtitle b { font: 10px var(--mono); letter-spacing: .15em; color: var(--silver); margin-right: 8px; }
.lens .ar-panel { position: absolute; right: 4%; top: 6%; width: 36%; background: rgba(20, 20, 168, .55); border: 1px solid var(--silver); padding: 8px 12px; font-size: 12px; color: var(--silver-hi); animation: rise .3s var(--ease); }
.lens .ar-panel b { display: block; font-size: 13px; margin-bottom: 2px; }
.lens .hud { position: absolute; left: 10px; top: 8px; font: 10px var(--mono); letter-spacing: .15em; color: var(--silver); }
.lens .reticle { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; translate: -50% -50%; border: 1px solid rgba(230, 231, 239, .5); border-radius: 50%; }
.ev-log { font: 11px var(--mono); max-height: 260px; overflow-y: auto; background: var(--ink); border: 1px solid var(--line); padding: 6px 8px; }
.ev-log div { padding: 2px 0; border-bottom: 1px solid var(--line); word-break: break-all; }
.ev-log .in { color: var(--silver); } .ev-log .out { color: var(--ok); } .ev-log .err { color: var(--danger); }
.cap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-size: 12px; }
.cap-grid span { border: 1px solid var(--line); padding: 3px 6px; color: var(--muted); }
.cap-grid span.on { color: var(--silver-hi); border-color: var(--line-2); }

@media (max-width: 1100px) {
  .chat-body { flex-direction: column; }
  .stage2d { flex: none; height: 42vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .editor-grid, .glasses { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .section-title, .sidebar .char-list, .sidebar-foot { display: none; }
  .sidebar-scroll { display: contents; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .view { padding: 18px 16px; }
  .field-grid { grid-template-columns: 1fr; }
  .drawer { position: absolute; inset: 0; width: auto; z-index: 5; }
}

/* ======================================================================
   2D 角色舞台（立绘 / Live2D）与简化后的页面
   ====================================================================== */
.stage2d { flex: 1.1; min-width: 0; position: relative; overflow: hidden; border-right: 1px solid var(--line); background: #07070d; }
/* 像素夜景（pixelbg.js 画，颜色跟着角色）+ 一层很淡的扫描线 */
.pixel-bg { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; pointer-events: none; }
.stage2d::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px);
  pointer-events: none; z-index: 1; }
.stage-host { position: absolute; inset: 0; }
.portrait { position: absolute; inset: 4% 0 0; display: grid; place-items: end center; }
.portrait > img { height: 100%; max-width: 96%; object-fit: contain; object-position: bottom; transform-origin: 50% 100%;
  animation: breathe 5.5s ease-in-out infinite; filter: drop-shadow(0 0 1px rgba(255, 255, 255, .25)) drop-shadow(0 12px 18px rgba(0, 0, 0, .55)); user-select: none; -webkit-user-drag: none; }
.portrait canvas { position: absolute; inset: 0; }
.portrait.is-vrm { inset: 0 0 10%; }
.portrait .vrm-canvas { width: 100%; height: 100%; display: block; }
.portrait.loading3d::after { content: ""; position: absolute; left: 50%; top: 45%; width: 26px; height: 26px; margin: -13px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .18); border-top-color: var(--char, #3df5ff); animation: spin3d .9s linear infinite; }
@keyframes spin3d { to { transform: rotate(360deg); } }
.portrait.talking > img { animation: breathe 5.5s ease-in-out infinite, talk .32s ease-in-out infinite alternate; }
.portrait.talking.voiced > img { animation: breathe 5.5s ease-in-out infinite; translate: 0 calc(var(--mouth, 0) * -4px); }  /* 有真实音量：跟着声音动 */
.portrait > img { transition: rotate .5s ease, translate .08s linear; }
.portrait.listening > img { rotate: -1.6deg; }  /* 专心听：头微微侧过来 */
.portrait .emote { position: absolute; top: 12%; right: 22%; font: 700 22px var(--mono); color: var(--silver-hi); background: rgba(19, 19, 25, .7);
  border: 1px solid var(--silver); padding: 2px 10px; opacity: 0; transform: translateY(6px) scale(.9); transition: opacity .25s, transform .25s var(--ease); }
.portrait .emote.on { opacity: 1; transform: none; }
.portrait[data-expr="shy"] > img { filter: drop-shadow(0 10px 30px rgba(0, 0, 40, .45)) saturate(1.08) brightness(1.04); }
.portrait[data-expr="sad"] > img, .portrait[data-expr="sleepy"] > img { filter: drop-shadow(0 10px 30px rgba(0, 0, 40, .45)) saturate(.8) brightness(.92); }
/* 预设动作（立绘）：整体的小幅度变换，不做夸张变形，避免“怪” */
.portrait.mv-wave > img { animation: mv-wave 1.8s ease-in-out; }
.portrait.mv-nod > img { animation: mv-nod 1.1s ease-in-out; }
.portrait.mv-shake_head > img { animation: mv-shake 1.2s ease-in-out; }
.portrait.mv-bow > img { animation: mv-bow 1.6s ease-in-out; }
.portrait.mv-think > img { animation: mv-tilt 2.2s ease-in-out; }
.portrait.mv-tilt_head > img { animation: mv-tilt 1.6s ease-in-out; }
.portrait.mv-cheer > img { animation: mv-hop 1.5s ease-in-out; }
.portrait.mv-spin > img { animation: mv-spin 1.8s ease-in-out; }
@keyframes talk { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes mv-wave { 0%, 100% { transform: rotate(0); } 20%, 60% { transform: rotate(2.2deg); } 40%, 80% { transform: rotate(-1.6deg); } }
@keyframes mv-nod { 0%, 100% { transform: none; } 30%, 70% { transform: translateY(6px) scaleY(.99); } 50% { transform: none; } }
@keyframes mv-shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes mv-bow { 0%, 100% { transform: none; } 40%, 60% { transform: translateY(14px) rotate(1deg) scaleY(.97); } }
@keyframes mv-tilt { 0%, 100% { transform: none; } 30%, 70% { transform: rotate(-3deg); } }
@keyframes mv-hop { 0%, 100% { transform: none; } 25%, 75% { transform: translateY(-18px); } 50% { transform: translateY(0); } }
@keyframes mv-spin { 0%, 100% { transform: none; } 50% { transform: scaleX(-1); } }
.stage-top { position: absolute; left: 16px; top: 12px; z-index: 2; display: flex; gap: 8px; align-items: center; }
.stage-name { font-size: 18px; font-weight: 500; letter-spacing: .06em; color: var(--silver-hi); text-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.stage-voice { position: absolute; right: 12px; top: 10px; z-index: 2; background: rgba(19, 19, 25, .6); color: var(--silver-hi); border-color: var(--line-2);
  padding: 4px 10px; font-size: 16px; }
.stage-voice::before { background: var(--cobalt); }
.stage-voice.off { opacity: .6; }
/* 她说话和朗读的语言：朗读按钮下面一排 中 / 日 / EN */
.stage-lang { position: absolute; right: 12px; top: 52px; z-index: 2; display: flex; background: rgba(19, 19, 25, .6); border: 1px solid var(--line-2); }
.stage-lang button { min-width: 32px; padding: 4px 8px; border: 0; background: none; color: var(--silver); font: 500 12px var(--sans); letter-spacing: .04em; cursor: pointer; }
.stage-lang button::before { display: none; }
.stage-lang button[aria-pressed="true"] { background: var(--cobalt); color: var(--silver-hi); }
.stage-lang button:disabled { opacity: .5; cursor: default; }
.stage-ar { position: absolute; right: 56px; top: 10px; z-index: 2; padding: 6px 12px; font: 600 12px var(--sans); letter-spacing: .14em; background: rgba(19, 19, 25, .6); color: #3df5ff; border-color: rgba(61, 245, 255, .45); }
.stage-ar::before { background: var(--cobalt); }
.stage-say { position: absolute; left: 50%; bottom: 64px; translate: -50% 0; z-index: 2; max-width: min(84%, 460px); background: rgba(19, 19, 25, .86);
  border: 1px solid var(--silver); color: var(--silver-hi); padding: 8px 14px; font-size: 14px; line-height: 1.6; animation: rise .35s var(--ease); }
.stage-say.story { border-color: #c9a8ff; }
.gestures { position: absolute; left: 0; right: 0; bottom: 14px; z-index: 2; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; padding: 0 12px; }
.gestures button { background: rgba(19, 19, 25, .7); color: var(--silver-hi); border-color: var(--line-2); padding: 4px 12px; font-size: 12px; }
.gestures button::before { background: var(--cobalt); }
.gestures.busy button { opacity: .45; pointer-events: none; }  /* 她还在回应上一下，先不让点 */

.chat-tools { display: flex; justify-content: space-between; padding: 10px 22px 0; }
.icon-btn { background: transparent; color: var(--text); border-color: var(--line-2); padding: 0 12px; font-size: 16px; }
.icon-btn::before { background: var(--ink-3); }
#mic-btn.listening { background: var(--danger); border-color: var(--danger); color: #fff; animation: pulse 1s infinite; }
.chat-form textarea { min-height: 42px; }
.bubble-row { display: flex; gap: 6px; align-items: flex-end; }
.speak-btn { background: none; border: 0; padding: 2px 4px; font-size: 14px; opacity: .45; color: var(--text); }
.speak-btn::before { display: none; }
.speak-btn:hover, .speak-btn.on { opacity: 1; }
.speak-btn.on { animation: pulse 1s infinite; }
.starters { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }

/* 角色页 */
.cast-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 18px; }
.cast-card { flex: 0 0 auto; width: 240px; display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--ink-2);
  border: 1px solid var(--line); cursor: pointer; transition: border-color .2s; }
.cast-card:hover { border-color: var(--line-2); }
.cast-card.active { border-color: var(--silver); }
.cast-card > div { flex: 1; min-width: 0; }
.cast-card .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cast-card.add { justify-content: center; color: var(--muted); border-style: dashed; background: none; font: inherit; }
.cast-card.add span { font-size: 22px; font-weight: 200; }
.editor { background: var(--ink-2); border: 1px solid var(--line); padding: 16px 18px; }
.editor-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.name-input { font-size: 22px; font-weight: 300; width: auto; flex: 0 1 280px; background: transparent; border-color: transparent; padding: 4px 6px; }
.name-input:hover, .name-input:focus { border-color: var(--line-2); }
.editor details summary { cursor: pointer; color: var(--muted); font-size: 13px; margin: 12px 0 4px; }
.pick-portrait { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.portrait-opt { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; background: var(--ink); color: var(--muted);
  border: 1px solid var(--line); height: 132px; font: inherit; font-size: 11px; cursor: pointer; }
.portrait-opt::before { display: none; }
.portrait-opt img { flex: 1; min-height: 0; max-width: 100%; object-fit: contain; }
.portrait-opt em { font-style: normal; }
.portrait-opt.active { border-color: var(--silver); color: var(--silver-hi); background: var(--cobalt-dk); }
.portrait-opt.upload span, .l2d-tag { flex: 1; display: grid; place-items: center; font-size: 22px; }
.l2d-tag { font: 12px var(--mono); letter-spacing: .1em; color: var(--silver); }
.ghost-btn { display: inline-flex; align-items: center; margin: 0; padding: 6px 14px; border: 1px solid var(--line-2); color: var(--text); cursor: pointer; font-size: 13px; }
.ghost-btn.small { padding: 3px 10px; font-size: 12px; }
.ghost-btn:hover { border-color: var(--silver); }
.menu-list { display: flex; flex-direction: column; }
.menu-list button { background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); text-align: left; padding: 10px 4px; font-weight: 400; }
.menu-list button::before { background: var(--ink-3); }
.pre { white-space: pre-wrap; }

/* 工坊 */
.ws-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ws-foot button { padding: 3px 14px; }

/* 设置 */
.settings-simple { max-width: 560px; display: flex; flex-direction: column; gap: 4px; }
.switch { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 14px; cursor: pointer; margin: 0; }
.switch input { margin-top: 3px; flex-shrink: 0; }
.switch small { display: block; color: var(--muted); font-size: 12px; }
#adv summary { cursor: pointer; color: var(--muted); padding: 12px 0; }
.ava img.top { object-position: 50% 0; }
.nameplate { position: absolute; inset: 12% 18% 18%; display: grid; place-content: center; justify-items: center; gap: 10px;
  border: 1px solid rgba(230, 231, 239, .5); background: radial-gradient(ellipse at 50% 30%, color-mix(in srgb, var(--c) 70%, white 10%), var(--c) 70%);
  animation: breathe 6s ease-in-out infinite; }
.nameplate span { font-size: clamp(64px, 12vw, 140px); font-weight: 200; color: var(--silver-hi); line-height: 1; text-shadow: 0 4px 30px rgba(0, 0, 0, .35); }
.nameplate em { font-style: normal; font: 12px var(--mono); letter-spacing: .4em; color: var(--silver-hi); opacity: .8; }
.portrait[data-plate] .emote { right: 14%; }
.icon-btn svg, .stage-voice svg, .speak-btn svg { display: block; }
.stage-voice { padding: 6px 8px; }
.speak-btn svg { width: 16px; height: 16px; }

/* KRINO MATRIX 商标：图形 + 中文大字“决策矩阵” + 字距拉开的英文小字（国内版）；海外版只有英文 */
.lockup { display: flex; align-items: center; gap: 12px; }
.lockup img { width: auto; height: 46px; flex-shrink: 0; }  /* 深色背景版商标（krino-mark.svg），透明底 */
.lockup b { display: block; font-weight: 500; font-size: 19px; letter-spacing: .14em; line-height: 1.15; color: var(--silver-hi); }
.lockup span { display: block; font-size: 9.5px; letter-spacing: .32em; color: var(--silver); margin-top: 3px; white-space: nowrap; }
.auth-brand { margin-bottom: 18px; }
html[data-edition="global"] .lockup .cn { display: none; }
html[data-edition="global"] .lockup span { font-size: 17px; letter-spacing: .12em; color: var(--silver-hi); font-weight: 500; margin: 0; }
.brand.lockup { padding: 2px 4px 16px; }
.site-foot { margin-top: 8px; letter-spacing: .04em; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--silver); }

/* ---------- 02 工作台：左边肉体，右边灵魂 ---------- */
.studio { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(0, 1.15fr); gap: 22px; align-items: start; }
.studio-body > .section-title:first-child, .studio-soul > .section-title:first-child { margin-top: 4px; }
#p-save.dirty { box-shadow: 0 0 0 2px var(--char); }
.wb-stage { position: relative; height: min(56vh, 600px); display: grid; place-items: end center; border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 85%, color-mix(in srgb, var(--char) 22%, transparent), transparent 65%), var(--ink); overflow: hidden; }
/* 立绘铺满预览区、整个人都看得见：按预览区大小缩放（不按图片原尺寸撑开，原来脚会被裁掉） */
.wb-stage > img { position: absolute; inset: 3% 2% 0; width: 96%; height: 97%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 10px 30px rgba(0, 0, 40, .45)); }
.wb-edit-open { position: absolute; right: 10px; bottom: 10px; z-index: 3; }
.wb-stage > .l2d-tag { align-self: center; color: var(--muted); }
.wb-empty { align-self: center; color: var(--muted); padding: 24px; text-align: center; }
.wb-busy { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; justify-items: center; background: rgba(19, 19, 25, .62); color: var(--silver-hi); }
.wb-busy i, .wb-face.loading::after { width: 26px; height: 26px; border: 2px solid var(--line-2); border-top-color: var(--silver-hi); border-radius: 50%; animation: wb-spin .9s linear infinite; }
@keyframes wb-spin { to { transform: rotate(360deg); } }
.wb-actions { align-items: center; }
.studio-body .pick-portrait { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.studio-body .portrait-opt { height: 112px; min-width: 0; }
.studio-body .portrait-opt em { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-faces { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 8px; }
.wb-face { padding: 0; background: var(--ink-3); border: 1px solid var(--line); color: var(--text); aspect-ratio: 1; display: grid; place-items: center; overflow: hidden; position: relative; }
.wb-face::before { display: none; }
.wb-face img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 6%; transform: scale(1.6); transform-origin: 50% 0; }  /* 只看脸 */
.wb-face span { color: var(--muted); font-size: 18px; }
.wb-face em { position: absolute; left: 0; right: 0; bottom: 0; font: normal 11px var(--sans); background: rgba(19, 19, 25, .75); padding: 1px 0; }
.wb-face.loading::after { content: ""; position: absolute; top: calc(50% - 13px); left: calc(50% - 13px); }
.ws-cover.has-img { place-items: end center; }
.ws-cover.has-img img { position: absolute; inset: 6% 0 0; width: 100%; height: 94%; object-fit: contain; object-position: 50% 0; transform: scale(1.5); transform-origin: 50% 0; transition: transform .5s var(--ease); }
.ws-card:hover .ws-cover.has-img img { transform: scale(1.6); }
@media (max-width: 1100px) { .studio { grid-template-columns: 1fr; } .wb-stage { height: 46vh; } }

/* 设置页的积分模块 */
.credits-box { margin-bottom: 14px; }
.credits-line { justify-content: space-between; align-items: baseline; }
.credits-bar { height: 4px; background: var(--line); margin: 8px 0 6px; overflow: hidden; }
.credits-bar i { display: block; height: 100%; background: var(--silver-hi); }
.credits-bar.low i { background: #e0a33a; }  /* 快用完了 */

/* 联网回答的来源 */
.msg .sources { margin-top: 4px; font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.msg .sources a { color: var(--silver); text-decoration: none; border-bottom: 1px dotted var(--line-2); }
.msg .sources a:hover { color: var(--silver-hi); }

/* Q 版小人：两个透明视频叠在一起轮流放，切换时淡入淡出 */
.portrait.is-chibi { inset: 8% 6% 17%; }  /* 下面留出字幕和互动按钮的位置，脚不被挡 */
.chibi { position: absolute; inset: 0; }
.chibi video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; opacity: 0;
  transition: opacity .12s linear; pointer-events: none; filter: drop-shadow(0 12px 26px rgba(0, 0, 40, .35)); }
.chibi video.front { opacity: 1; }
.wb-chibi { position: absolute; inset: 4% 6% 2%; }
.portrait-opt { position: relative; }
.portrait-opt .chibi-tag { position: absolute; top: 4px; right: 4px; font: normal 10px var(--sans); background: var(--char, #1414a8); color: #fff; padding: 0 5px; }

/* 眼镜模拟器：输入框单独一行，不被按钮挤窄 */
.glasses .g-text { width: 100%; margin: 10px 0 0; }

/* 录音时麦克风按钮跟着音量亮起来 */
#mic-btn.listening { box-shadow: 0 0 0 calc(2px + var(--lv, 0) * 10px) color-mix(in srgb, var(--char, #1414a8) 45%, transparent); transition: box-shadow .08s linear; }

/* 工作台右栏：她的意识星图（只看不改，soulgraph.js）。赛博朋克配色只用在这一块 */
.name-title { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: .02em; }
.soul-brain { position: relative; border: 1px solid #1d2a44; background: radial-gradient(ellipse at 50% 35%, #0d1a33 0%, #070b16 60%, #04060c 100%);
  overflow: hidden; color: #cfe6ff; }
.soul-brain canvas { display: block; width: 100%; height: 540px; cursor: grab; touch-action: none; }
.sb-hud { position: absolute; pointer-events: none; font-size: 11px; letter-spacing: .04em; }
.sb-tl { top: 12px; left: 14px; max-width: 62%; }
.sb-kicker { font: 10px var(--mono); letter-spacing: .28em; color: #5fd4ff; opacity: .85; }
.sb-title { margin-top: 6px; font-size: 16px; white-space: nowrap; font-weight: 600; color: #f2f7ff; text-shadow: 0 0 12px rgba(95, 212, 255, .45); }
.sb-sub { margin-top: 3px; color: #8fa5c8; font-size: 11px; }
.sb-stats { display: flex; gap: 16px; margin-top: 10px; }
.sb-stats b { display: block; font: 600 18px var(--mono); color: #fff; text-shadow: 0 0 10px rgba(255, 190, 90, .55); }
.sb-stats b.mem { text-shadow: 0 0 10px rgba(190, 120, 255, .7); }
.sb-stats span { color: #7f93b5; font-size: 10px; }
.sb-bl { bottom: 46px; left: 14px; width: 30%; font-size: 10.5px; }
.sb-bar { display: grid; grid-template-columns: 74px 1fr 24px; align-items: center; gap: 6px; margin: 3px 0; color: #9fb3d4; }
.sb-bar i { height: 3px; background: #15223a; position: relative; overflow: hidden; }
.sb-bar i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--c); box-shadow: 0 0 6px var(--c); }
.sb-bar em { font: 10px var(--mono); font-style: normal; color: #cfe6ff; text-align: right; }
.sb-br { bottom: 12px; right: 14px; text-align: right; font: 10px var(--mono); color: #5c7096; }
.sb-legend { position: absolute; top: 12px; right: 14px; display: flex; gap: 12px; font-size: 10.5px; color: #9fb3d4; pointer-events: none; }
.sb-legend span::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; background: var(--c); box-shadow: 0 0 6px var(--c); }
.sb-tip { position: absolute; pointer-events: none; max-width: 250px; padding: 6px 9px; background: rgba(6, 12, 26, .92); border: 1px solid #2a4870;
  box-shadow: 0 0 14px rgba(95, 212, 255, .25); font-size: 12px; line-height: 1.5; color: #e6f2ff; opacity: 0; transition: opacity .15s; }
.sb-tip.on { opacity: 1; }
.sb-tip small { display: block; color: #5fd4ff; font: 10px var(--mono); letter-spacing: .1em; }
.sb-ctrl { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 2px; background: rgba(6, 12, 26, .8); border: 1px solid #1f3558; padding: 2px; }
.sb-ctrl button { background: transparent; border: 0; color: #9fb3d4; font-size: 11px; padding: 4px 10px; min-height: 0; }
.sb-ctrl button::before { display: none; }
.sb-ctrl button:hover, .sb-ctrl button.on { color: #fff; background: #12223d; }
.sb-panel { border: 1px solid #1d2a44; border-top: 0; background: linear-gradient(180deg, #08101f, #070b14); padding: 12px 14px; color: #dbe9ff; }
.sb-tabs { display: flex; gap: 2px; margin-bottom: 8px; }
.sb-tabs button { flex: 1; background: transparent; border: 1px solid #1d2a44; color: #8fa5c8; font-size: 12px; padding: 5px 0; min-height: 0; }
.sb-tabs button::before { display: none; }
.sb-tabs button.on { color: #fff; border-color: #2d6a9a; background: #0f2140; box-shadow: inset 0 -2px 0 #5fd4ff; }
.sb-body { max-height: 300px; overflow: auto; }
.sb-list { list-style: none; margin: 0; padding: 0; }
.sb-list li { display: grid; grid-template-columns: 22px 1fr; gap: 6px; padding: 7px 0; border-bottom: 1px dashed #17243d; font-size: 13px; line-height: 1.55; }
.sb-list li em { font: 10px var(--mono); font-style: normal; color: #5c7096; padding-top: 3px; }
.sb-list li small { display: block; color: #7f93b5; font-size: 11px; margin-top: 2px; }
.sb-list li.hot { background: linear-gradient(90deg, rgba(95, 212, 255, .1), transparent); }
.sb-list li:has(.sb-wrong) { grid-template-columns: 22px 1fr auto; }
.sb-wrong { align-self: start; font: 11px var(--mono); color: #7f93b5; background: none; border: 1px solid #22344f; border-radius: 4px; padding: 2px 7px; cursor: pointer; opacity: .55; transition: opacity .15s, color .15s, border-color .15s; }
.sb-list li:hover .sb-wrong, .sb-wrong:focus-visible { opacity: 1; }
.sb-wrong:hover { color: #ff8fb0; border-color: #ff8fb0; }
.sb-wrong:disabled { opacity: .3; cursor: default; }
.sb-list .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; background: var(--c); box-shadow: 0 0 6px var(--c); vertical-align: middle; }
.sb-sec { font: 10px var(--mono); letter-spacing: .2em; margin: 10px 0 2px; color: #ffcf7a; }
.sb-empty { color: #7f93b5; font-size: 12.5px; padding: 8px 0; }
.sb-greet { margin: 10px 0 0; padding: 9px 12px; border-left: 2px solid #ffbe5a; background: rgba(255, 190, 90, .05); font-size: 13.5px; line-height: 1.6; color: #f1e6d0; }
.sb-lock { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-top: 12px; padding-top: 10px;
  border-top: 1px solid #17243d; color: #7f93b5; font-size: 12px; }
@media (max-width: 700px) { .soul-brain canvas { height: 380px; } .sb-bl, .sb-legend { display: none; } }

.draft-form { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }

/* ======================================================================
   语音：听写（麦克风）和语音对话（边听边回，参照 ChatGPT 的语音模式）
   ====================================================================== */
#mic-btn.busy { pointer-events: none; }
.mic-spin { display: block; width: 16px; height: 16px; border: 2px solid var(--line-2); border-top-color: var(--silver-hi); border-radius: 50%; animation: vm-spin .8s linear infinite; }
.vm-open { display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; color: var(--silver-hi); background: var(--cobalt); border-color: var(--cobalt-2); }
.vm-open::before { background: var(--cobalt-2); }
.vm-open svg { display: block; }

.chat-col { position: relative; }
.vm { position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 28px 22px 22px;
  background: linear-gradient(rgba(61, 245, 255, .05) 1px, transparent 1px) 0 0 / 16px 16px, linear-gradient(90deg, rgba(61, 245, 255, .05) 1px, transparent 1px) 0 0 / 16px 16px, #07070d;
  opacity: 0; transform: translateY(8px); transition: opacity .25s steps(4), transform .25s steps(4); }
.vm::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .2) 0 1px, transparent 1px 3px); pointer-events: none; }
.vm.in { opacity: 1; transform: none; }
.vm-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; width: 100%; min-height: 0; position: relative; z-index: 1; }

/* 像素光球（pixelbg.js 的 pixelOrb 画）：在听 = 青色，跟着你的音量；在想 = 黄色转圈；说话 = 品红往外扩散；静音 = 灰 */
.vm-orb { --size: clamp(150px, 30vmin, 220px); width: var(--size); height: var(--size); padding: 0; border: 0; background: none; position: relative; overflow: visible; isolation: auto; cursor: pointer; }
.vm-orb::before { display: none; }
.vm-orb canvas { width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
.vm-orb:focus-visible { outline: 2px dashed #3df5ff; outline-offset: 6px; }
.vm-status { font: 12px var(--mono); letter-spacing: .14em; color: #3df5ff; text-transform: uppercase; min-height: 1.5em; text-align: center; }
.vm[data-state="muted"] .vm-status { color: var(--muted); }
.vm[data-state="speaking"] .vm-status { color: #ff3d9a; }
.vm[data-state="thinking"] .vm-status { color: #f2ff3d; }
.vm-caption { max-width: min(520px, 100%); min-height: 3.3em; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; }
.vm-caption.you { color: var(--text); }
.vm-caption.her { color: var(--silver-hi); }
.vm-bar { position: relative; z-index: 1; display: flex; gap: 12px; }
.vm-btn:hover { box-shadow: 3px 3px 0 #3df5ff; }
.vm-btn { display: inline-flex; align-items: center; gap: 8px; background: transparent; color: var(--text); border-color: var(--line-2); padding: 9px 20px; }
.vm-btn::before { background: var(--ink-3); }
.vm-btn svg { display: block; }
.vm-mute.on { color: var(--danger); border-color: rgba(226, 85, 107, .5); }
.vm-end:hover { border-color: var(--silver); }

@keyframes vm-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .mic-spin { animation: none !important; }
  .vm { transition: none; }
}

/* ---------- 圈子 ---------- */
#social-page { max-width: 960px; width: 100%; margin: 0 auto; }
#sc-lower { max-width: 760px; margin: 0 auto; scroll-margin-top: 12px; }
/* 像素小镇：画布 640×384，按宽度放大且保持像素颗粒；手机上地图不缩小，可以左右拖 */
.town { position: relative; margin: 0 0 14px; }
.tw-scroll { overflow-x: auto; overflow-y: hidden; border: 3px solid #5a3a20; box-shadow: 0 0 0 1px #1b1b28, 0 6px 0 rgba(0,0,0,.35); background: #2b1c10; -webkit-overflow-scrolling: touch; }
.tw-inner { position: relative; width: 100%; min-width: 640px; }
.tw-inner canvas { display: block; width: 100%; aspect-ratio: 640 / 384; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: pan-x; }
.tw-layer { position: absolute; inset: 0; pointer-events: none; }
.tw-bubble { position: absolute; transform: translate(-50%, -100%); max-width: 200px; width: max-content; background: #fff8e6; color: #3a2614; border: 2px solid #5a3a20;
  border-top-color: var(--c); padding: 3px 8px; font-size: 12px; line-height: 1.45; box-shadow: 2px 2px 0 rgba(0,0,0,.35); animation: rise .25s var(--ease) both; }
.tw-bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -4px; border: 4px solid transparent; border-top-color: #5a3a20; border-bottom: 0; }
.tw-clock { position: absolute; top: 8px; right: 8px; background: #f4e6c4; color: #3a2614; border: 2px solid #5a3a20; padding: 2px 8px; font-size: 11px; box-shadow: 2px 2px 0 rgba(0,0,0,.35); pointer-events: none; }
.tw-tip { position: absolute; background: #1b1b28; color: #fff8e6; font-size: 12px; padding: 1px 6px; pointer-events: none; white-space: nowrap; z-index: 2; }
.tw-hint { margin: 6px 2px 0; }
/* 星露谷风格的对话框：木框 + 米色底，盖在地图下沿 */
.tw-dlg { position: absolute; left: 10px; right: 10px; bottom: 34px; z-index: 3; background: #fff1d0; color: #3a2614; border: 3px solid #8a5a2b;
  box-shadow: 0 0 0 2px #4a2c12, 4px 4px 0 rgba(0,0,0,.4); padding: 12px 14px; max-height: 70%; overflow-y: auto; animation: rise .2s var(--ease) both; }
.tw-dlg .muted { color: #7a5a3a; }
.tw-dlg .badge { color: #5a3a20; border-color: #c9a26b; margin-left: 6px; }
.tw-x { position: absolute; top: 4px; right: 8px; color: #7a5a3a; }
.tw-dlg-who { display: flex; gap: 12px; align-items: center; }
.tw-dlg-who .ava { border: 2px solid var(--c); }
.tw-line { margin: 8px 0; font-size: 15px; line-height: 1.6; min-height: 1.6em; white-space: pre-wrap; word-break: break-word; }
.tw-acts, .tw-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.tw-row > .muted { width: 3em; }
.tw-row input { flex: 1; min-width: 160px; background: #fffaf0; color: #3a2614; border-color: #c9a26b; }
.tw-dlg button.ghost { color: #5a3a20; border-color: #8a5a2b; }
.tw-talk { margin: 8px 0; max-height: 180px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.tw-said { margin: 0; font-size: 14px; line-height: 1.55; word-break: break-word; }
.tw-said b { margin-right: 6px; color: #8a5a2b; }
.tw-said span { white-space: pre-wrap; }
.tw-said.me { text-align: right; }
.tw-said.me b { color: #5a6a8a; }
.tw-dlg button.ghost::before { background: #ffe5a8; }
.chip-btn { background: #fffaf0; color: #3a2614; border: 2px solid #c9a26b; padding: 2px 10px; font-size: 13px; }
.chip-btn::before { display: none; }
.chip-btn.on { border-color: var(--c, #8a5a2b); background: #ffe5a8; font-weight: 600; }
@media (max-width: 700px) { .tw-dlg { left: 4px; right: 4px; bottom: 30px; max-height: 85%; } .tw-line { font-size: 14px; } }
@media (prefers-reduced-motion: reduce) { .tw-bubble, .tw-dlg { animation: none; } }
.sc-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.sc-mine { display: flex; gap: 8px; flex-wrap: wrap; }
.sc-char { display: flex; align-items: center; gap: 10px; background: var(--ink-2); color: var(--text); border: 1px solid var(--line); padding: 8px 12px 8px 8px; text-align: left; }
.sc-char::before { display: none; }
.sc-char.on { border-color: var(--c); box-shadow: 0 0 0 1px var(--c) inset; }
.sc-char-text { display: flex; flex-direction: column; line-height: 1.3; }
.sc-id { color: var(--muted); font-size: 11px; cursor: copy; }
.sc-id:hover { color: var(--silver-hi); }
.sc-self { margin: 0; font-size: 13px; color: var(--silver); border-left: 2px solid var(--char); padding: 2px 0 2px 10px; }
.sc-self em { font-style: normal; font-size: 10px; color: var(--muted); margin-right: 8px; }
.sc-req { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--cobalt-2); background: rgba(35, 35, 200, .12); padding: 10px 12px; margin-bottom: 10px; }
.sc-req-text { flex: 1; min-width: 200px; }
.sc-req em { display: block; font-style: normal; color: var(--silver); font-size: 13px; }
.sc-tabs { align-items: center; margin: 4px 0 12px; }
.sc-auto { margin-left: auto; }
.sc-bar { margin: 0 0 12px; }
.sc-feed, .sc-friends { display: flex; flex-direction: column; gap: 10px; }
.sc-post, .sc-friend { display: flex; gap: 12px; background: var(--ink-2); border: 1px solid var(--line); border-left: 2px solid var(--c); padding: 12px 14px; animation: rise .4s var(--ease) both; }
.sc-friend { cursor: pointer; }
.sc-friend:hover { border-color: var(--line-2); border-left-color: var(--c); }
.sc-friend > div, .sc-post-body { flex: 1; min-width: 0; }
.sc-post-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.sc-text { margin: 4px 0 6px; white-space: pre-wrap; word-break: break-word; line-height: 1.75; }
.sc-likes { font-size: 12px; color: var(--rose); }
.sc-comments { margin-top: 6px; background: var(--ink-3); padding: 6px 10px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.sc-acts { display: flex; gap: 14px; margin-top: 6px; }
.sc-acts .on { color: var(--rose); }
.sc-imp { margin: 4px 0; font-size: 13px; color: var(--silver); }
.sc-imp em { font-style: normal; font-size: 11px; color: var(--muted); margin-right: 6px; }
.sc-friend p { margin: 2px 0 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.sc-add { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.sc-add input { flex: 1; min-width: 180px; }
.sc-thread { display: flex; flex-direction: column; gap: 14px; padding: 6px 0 14px; max-height: 58vh; overflow-y: auto; }
.sc-typing { animation: pulse 1.4s ease-in-out infinite; }
@media (max-width: 700px) { .sc-auto { margin-left: 0; width: 100%; } .sc-char { flex: 1; } }

/* 角色的专属声音：按描述设计 */
.voice-design { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; margin: 10px 0 4px; }
/* 声音微调：点一下在描述后面加一句，再按描述重新设计 */
.voice-tune { order: 3; flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.voice-tune .tune { padding: 3px 9px; font-size: 12px; background: none; color: var(--text); border: 1px solid var(--line-2); cursor: pointer; }
.voice-tune .tune:hover { border-color: var(--char); color: var(--silver-hi); }
label.check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--text); margin: 6px 0 2px; cursor: pointer; }
label.check input { margin-top: 3px; }
/* 登录前的确认弹窗：要点、两个附件、勾选（guard.js 的 consentHTML） */
.consent { margin-top: 16px; }
.modal-card .consent:first-child { margin-top: 0; }
.consent-points { margin: 4px 0 14px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.consent-docs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 10px 0; margin-bottom: 8px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 13px; }
.consent-docs .mono { font-size: 11px; letter-spacing: .14em; color: var(--muted); }
.consent-docs a, .consent .check a { color: var(--silver-hi); }
.wb-motion { align-items: center; margin-top: 4px; }
.voice-design textarea { flex: 1; min-height: 2.8em; }
.voice-design button { flex: none; }
@media (max-width: 760px) { .voice-design { flex-direction: column; align-items: stretch; } }

/* ---------- 酒馆（圈子里的一个标签） ---------- */
.tv-room { display: flex; flex-direction: column; gap: 8px; }
.tv-log { display: flex; flex-direction: column; gap: 14px; min-height: 240px; max-height: 58vh; overflow-y: auto; padding: 12px 14px;
  background: var(--ink-2); border: 1px solid var(--line); }
.tv-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tv-bar input { flex: 1; min-width: 180px; }
.tv-typing { animation: pulse 1.4s ease-in-out infinite; margin: 0; }

/* 新角色的创建进度：右下角卡片（creating.js），关掉窗口、换页面都还在 */
#create-dock { position: fixed; right: 18px; top: 64px; z-index: 65; display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px)); }
#create-dock.hidden { display: none; }
.cd-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--ink-2); border: 1px solid var(--line-2);
  border-left: 3px solid var(--char); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: cd-in .4s var(--ease); }
@keyframes cd-in { from { opacity: 0; transform: translateY(14px); } }
.cd-card.done { border-left-color: var(--ok); }
.cd-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cd-body b { font-weight: 500; font-size: 13px; }
.cd-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 12px; font-size: 12px; }
.cd-steps li { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.cd-steps li.ok { color: var(--ok); }
.cd-steps li i { width: 9px; height: 9px; border: 1.5px solid var(--char); border-top-color: transparent; border-radius: 50%; animation: cd-spin .8s linear infinite; }
.cd-ok { color: var(--ok); font-size: 18px; }
.cd-x { padding: 2px 4px; color: var(--muted); }
/* 四个像素方块轮流亮：和门户的像素风一致 */
.cd-anim { flex: none; display: grid; grid-template-columns: 12px 12px; gap: 3px; }
.cd-anim span { width: 12px; height: 12px; background: var(--char); opacity: .2; animation: cd-pix 1.2s steps(1) infinite; }
.cd-anim span:nth-child(2) { animation-delay: .3s; } .cd-anim span:nth-child(4) { animation-delay: .6s; } .cd-anim span:nth-child(3) { animation-delay: .9s; }
@keyframes cd-pix { 0%, 24% { opacity: 1; } 25%, 100% { opacity: .2; } }
@keyframes cd-spin { to { transform: rotate(360deg); } }
.gen-wait { display: flex; align-items: center; gap: 14px; padding: 14px 0; }
.char-item.creating { cursor: progress; }
.char-item.creating .ava { position: relative; overflow: hidden; }
.char-item.creating .ava::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .28) 50%, transparent 70%);
  background-size: 250% 100%; animation: cd-shimmer 1.6s linear infinite; }
@keyframes cd-shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { .cd-anim span, .cd-steps li i, .char-item.creating .ava::after { animation: none; } .cd-anim span { opacity: .6; } }

/* 新角色：形象和声音还在后台做 */
.pending-tag { font: normal 10px/1 var(--mono); letter-spacing: .08em; color: #3df5ff; border: 1px solid rgba(61, 245, 255, .5); padding: 2px 5px; margin-left: 6px;
  vertical-align: 2px; animation: pulse 1.4s steps(3) infinite; }

/* 设置 → API 密钥 */
.key-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); background: var(--ink-2); }
.key-row code, .key-show code { font: 12px var(--mono); color: var(--silver-hi); }
.key-show { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--char); background: var(--ink-2); margin: 10px 0; }
.key-show code { flex: 1; word-break: break-all; user-select: all; }

/* 工作台：删除形象（悬停时出现在右上角） */
.portrait-cell { position: relative; }
.portrait-cell .portrait-opt { width: 100%; }
.look-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; display: grid; place-items: center; font-size: 11px;
  background: rgba(19, 19, 25, .85); color: var(--muted); border: 1px solid var(--line-2); cursor: pointer; opacity: 0; transition: opacity .15s; }
.portrait-cell:hover .look-del, .look-del:focus-visible { opacity: 1; }
.look-del:hover { color: #fff; background: var(--danger); border-color: var(--danger); }
@media (hover: none) { .look-del { opacity: 1; } }

/* 未成年人保护（guard.js）：第一次用时的登记、时间到了的遮罩、求助电话卡片、AI 提示、监护人面板 */
.guard-cover { position: fixed; inset: 0; z-index: 55; background: rgba(8, 8, 12, .9); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.guard-card { width: min(480px, 100%); background: var(--ink-2); border: 1px solid var(--line-2); padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.guard-card h2 { margin: 0; font-weight: 400; }
.guard-card .row input { flex: 1; min-width: 0; }
.help-card { margin: 10px 0 10px 42px; padding: 12px 14px; border: 1px solid var(--rose); border-left-width: 3px; background: rgba(199, 91, 132, .08);
  display: flex; flex-direction: column; gap: 6px; font-size: 13px; max-width: 420px; }
.help-card .row { justify-content: space-between; }
.help-card a { color: var(--silver-hi); font-family: var(--mono); }
.ai-note { margin: 0; padding: 0 16px 8px; font-size: 11px; color: var(--muted); text-align: center; }
.usage-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 120px; align-items: end; }
.usage-bars div { height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; font-size: 10px; color: var(--muted); }
.usage-bars i { width: 60%; background: var(--char); min-height: 2px; }
.usage-bars b { font-weight: 400; color: var(--text); }
.report-reply { color: var(--ok); margin-top: 4px; }

/* 国际站登录页：出生年月、已满 18 岁 */

/* 出生年月：月、年两个下拉框 */
.dob { display: flex; gap: 8px; }
.dob select { flex: 1; min-width: 0; }

/* 技术底纹（静态网格 + 底光，不做会动的光带）只铺在圈子以外。圈子页打开时 .main 不换背景，像素小镇和圈子样式保持原样。 */
.main:not(:has(#view-social:not(.hidden))) {
  position: relative;
  background:
    linear-gradient(rgba(95, 212, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(95, 212, 255, .045) 1px, transparent 1px),
    radial-gradient(880px 420px at 100% -10%, rgba(20, 20, 168, .28), transparent 55%),
    #0b0c11;
  background-size: 56px 56px, 56px 56px, auto, auto;
}

/* 工作台：左边整幅形象，右边整幅灵魂；形象、声音、语言和灵魂详情收进角落 */
#view-persona { overflow: hidden; padding: 12px 16px 14px; }
#persona-page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#view-persona .cast-row { flex-shrink: 0; }
#view-persona .studio-editor { flex: 1; min-height: 0; display: flex; flex-direction: column; background: transparent; border: 0; padding: 0; }
#view-persona .editor-head { flex-shrink: 0; }
#view-persona .studio { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: stretch; }
#view-persona .studio-body, #view-persona .studio-soul { position: relative; min-height: 0; display: flex; }
#view-persona #body-host, #view-persona #soul-host { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
#view-persona .wb-stage { flex: 1; height: auto; min-height: 0; }
#view-persona .soul-brain { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#view-persona .soul-brain canvas { height: auto; flex: 1; min-height: 0; }
#view-persona .sb-panel { border: 0; background: transparent; padding: 0; }
.studio-corners { position: absolute; z-index: 4; display: flex; gap: 6px; pointer-events: auto; }
.studio-body .studio-corners { left: 10px; top: 10px; right: auto; bottom: auto; flex-direction: column; align-items: flex-start; }
.soul-corners { top: 12px; right: 14px; bottom: auto; left: auto; gap: 4px; }
.soul-corners .corner { display: inline-flex; align-items: center; gap: 5px; padding: 1px 6px; line-height: 1.2; font-size: 10.5px; letter-spacing: .06em; background: rgba(6, 12, 26, .72); }
.soul-corners .sb-key { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); flex: none; }
.corner { background: rgba(8, 10, 16, .78); color: var(--silver-hi); border: 1px solid rgba(207, 230, 255, .4); padding: 6px 10px; font: 11px var(--mono); letter-spacing: .12em; cursor: pointer; transition: border-color .2s var(--ease), box-shadow .2s var(--ease); }
.corner:hover, .corner:focus-visible { border-color: #5fd4ff; outline: 1px solid #5fd4ff; box-shadow: inset 0 0 0 1px rgba(95, 212, 255, .55); }
.studio-dock { position: absolute; inset: 0; z-index: 6; display: grid; align-items: end; padding: 12px; background: rgba(4, 6, 12, .62); animation: dock-veil .22s var(--ease); }
.studio-dock[hidden] { display: none !important; }
.studio-dock.is-closing { animation: dock-veil .2s var(--ease) reverse forwards; pointer-events: none; }
.dock-card { width: min(560px, 100%); max-height: 100%; overflow: auto; background: #10141c; border: 1px solid rgba(207, 230, 255, .22); padding: 12px 14px; transform-origin: left bottom; animation: dock-card .26s var(--ease); }
.studio-dock.is-closing .dock-card { animation: dock-card .2s var(--ease) reverse forwards; }
.dock-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.dock-head h3 { margin: 0; flex: 1; font-size: 14px; font-weight: 500; letter-spacing: .06em; }
@media (max-width: 1100px) {
  #view-persona .studio { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #view-persona .wb-stage { height: auto; }
}
@media (max-width: 900px) {
  #view-persona { overflow: auto; }
  #view-persona .studio { grid-template-columns: 1fr; }
  #view-persona .studio-body, #view-persona .studio-soul, #view-persona .wb-stage, #view-persona .soul-brain, #view-persona .soul-brain canvas { min-height: 78vh; height: 78vh; }
}
@keyframes dock-veil { from { background-color: rgba(4, 6, 12, 0); } to { background-color: rgba(4, 6, 12, .62); } }
@keyframes dock-card { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
html.page-hidden #grain,
html.page-hidden .plate::after { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .view.view-enter:not(#view-social)::after,
  .char-item.active::before, .modal, .modal-card,
  .studio-dock, .dock-card, .studio-dock.is-closing, .studio-dock.is-closing .dock-card { animation: none !important; }
}

/* AR：全屏覆盖层。xr 模式下相机画面由浏览器在下面画，这一层只放界面；camera 模式自己铺摄像头画面 */
.ar { position: fixed; inset: 0; z-index: 60; overflow: hidden; color: var(--silver-hi); touch-action: none; user-select: none; -webkit-user-select: none; }
.ar-camera { background: #000; }
.ar-cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ar-cam.mirror { scale: -1 1; }
.ar-puppet { position: absolute; width: min(46vmin, 300px); height: min(62vmin, 400px); }
.ar-xr .ar-puppet { left: 0; top: 0; width: 360px; height: 480px; opacity: 0; pointer-events: none; z-index: -1; }  /* 只拿来取画面，贴到空间里的卡片上 */
.ar-camera .ar-puppet { left: 50%; top: 70%; translate: -50% -100%; transform-origin: 50% 100%; visibility: hidden; }
.ar-camera.placed-cam .ar-puppet { visibility: visible; }
.ar-camera .ar-puppet .portrait, .ar-camera .ar-puppet .portrait.is-chibi, .ar-camera .ar-puppet .portrait.is-vrm { inset: 0; }
.ar-camera .ar-puppet::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: -4%; height: 8%; z-index: -1;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .5), transparent); }
.ar-top { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; }
.ar-name { font-weight: 600; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.ar-mode { font: 10px var(--mono); letter-spacing: .15em; color: #3df5ff; text-shadow: 0 1px 4px rgba(0, 0, 0, .7); }
.ar-see { font: 11px var(--sans); padding: 3px 9px; color: #fff; background: rgba(19, 19, 25, .6); border: 1px solid var(--line-2); }
.ar-see.on { background: rgba(61, 245, 255, .25); border-color: #3df5ff; }
.ar-close { margin-left: auto; padding: 6px 12px; background: rgba(19, 19, 25, .7); color: var(--silver-hi); border-color: var(--line-2); }
.ar-hint { position: absolute; top: 40%; left: 50%; translate: -50% 0; max-width: 84%; padding: 8px 14px; text-align: center; font-size: 14px;
  background: rgba(19, 19, 25, .72); border: 1px solid var(--line-2); pointer-events: none; }
.ar-hint[hidden], .ar-say[hidden] { display: none; }
.ar-say { position: absolute; left: 50%; bottom: 46%; translate: -50% 0; max-width: min(84%, 420px); padding: 8px 14px; font-size: 14px; line-height: 1.6;
  background: rgba(19, 19, 25, .82); border: 1px solid var(--line-2); pointer-events: none; }
.ar-size { position: absolute; right: 12px; top: 50%; translate: 0 -50%; display: flex; flex-direction: column; gap: 8px; }
.ar-size button { width: 40px; height: 40px; padding: 0; font-size: 20px; background: rgba(19, 19, 25, .7); color: var(--silver-hi); border-color: var(--line-2); }
.ar:not(.placed) .ar-size, .ar:not(.placed) .ar-voice { display: none; }
.ar-voice { position: absolute; left: 0; right: 0; bottom: 0; height: 42%; }
/* 语音面板和顶栏盖在画面上：只有按钮接点击，其余地方点穿过去（点到她 = 让她消失，点画面 = 放下她） */
.ar-voice, .ar-voice .vm, .ar-voice .vm-stage, .ar-voice .vm-bar, .ar-top { pointer-events: none; }
.ar-voice button, .ar-top > * { pointer-events: auto; }
.ar-voice .vm, .dev-voice .vm { background: linear-gradient(transparent, rgba(0, 0, 0, .55) 40%); padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
.ar-voice .vm::after, .dev-voice .vm::after { display: none; }
.ar-voice .vm-stage, .dev-voice .vm-stage { gap: 8px; justify-content: flex-end; }
.ar-voice .vm-orb, .dev-voice .vm-orb { --size: 84px; }
.ar-voice .vm-caption, .dev-voice .vm-caption { min-height: 0; font-size: 14px; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.ar .toast { z-index: 80; }

/* KRINO GLASSES 桌面测试版（/device）：透明窗口就是镜片，她站在你的桌面上，底下一条小工具栏 */
html:has(body.device), body.device { background: transparent; overflow: hidden; height: 100%; }
body.device:not(.in-app) { background: radial-gradient(ellipse at 50% 120%, #1d1d6a, #08080c 70%); }  /* 浏览器里打开时给个底色，看得清 */
.device-lens { position: fixed; inset: 0 0 52px; overflow: hidden; pointer-events: none; }
.device-lens .ar-avatar { width: min(62%, 300px); }
.device-lens .ar-subtitle { position: absolute; left: 50%; bottom: 4%; translate: -50% 0; width: max-content; max-width: 92%; padding: 7px 12px; font-size: 13px; line-height: 1.6;
  background: rgba(8, 8, 12, .78); border: 1px solid rgba(230, 231, 239, .5); color: var(--silver-hi); pointer-events: auto; }
.device-lens .ar-subtitle b { font: 10px var(--mono); letter-spacing: .15em; color: var(--silver); margin-right: 8px; }
.device-lens .ar-panel { position: absolute; left: 6%; right: 6%; top: 8%; background: rgba(20, 20, 168, .72); border: 1px solid var(--silver); padding: 8px 12px; font-size: 12px;
  color: var(--silver-hi); animation: rise .3s var(--ease); pointer-events: auto; }
.device-lens .ar-panel b { display: block; font-size: 13px; margin-bottom: 2px; }
.dev-hud { position: absolute; left: 10px; top: 8px; font: 10px var(--mono); letter-spacing: .12em; color: rgba(230, 231, 239, .75); text-shadow: 0 1px 3px #000; }
.dev-bar { position: fixed; left: 6px; right: 6px; bottom: 6px; height: 40px; display: flex; align-items: center; gap: 4px; padding: 0 6px;
  background: rgba(19, 19, 25, .88); border: 1px solid var(--line-2); }
.dev-bar:empty { display: none; }
.dev-grip { -webkit-app-region: drag; cursor: move; color: var(--muted); padding: 0 4px; letter-spacing: -2px; user-select: none; }
.dev-dot { font-size: 10px; color: var(--danger); }
.dev-dot.connected { color: #3df58a; }
.dev-dot.connecting, .dev-dot.stale { color: #f2ff3d; }
.dev-bar select { width: auto; max-width: 92px; padding: 4px 6px; font-size: 12px; }
.dev-bar input { flex: 1; min-width: 40px; padding: 5px 8px; font-size: 12px; }
.dev-btn { flex: none; width: 30px; height: 30px; padding: 0; font-size: 15px; line-height: 1; background: transparent; color: var(--text); border-color: transparent; }
.dev-btn svg { display: block; margin: auto; }
.dev-btn::before { background: var(--ink-3); }
.dev-btn.on { border-color: #3df5ff; box-shadow: 0 0 8px rgba(61, 245, 255, .5); }
.dev-voice { position: fixed; left: 0; right: 0; bottom: 52px; height: 150px; pointer-events: none; }
.dev-voice .vm { pointer-events: auto; }
.dev-login { position: fixed; left: 12px; right: 12px; top: 50%; translate: 0 -50%; padding: 18px; text-align: center; background: rgba(19, 19, 25, .94); border: 1px solid var(--line-2); }
.dev-login b { font: 600 13px var(--mono); letter-spacing: .2em; }
.dev-voice .vm { padding: 6px 10px; }
.dev-voice .vm-orb { --size: 56px; }
.dev-voice .vm-btn { padding: 5px 12px; font-size: 12px; }
.vm-caption.warn { color: var(--text); font-size: 14px; }

/* 3D 形象：工作台的预览（一直留着的 3D 舞台）、形象列表里的小人图标、调颜色 */
.wb-3d { position: absolute; inset: 0; }
.wb-3d .portrait.is-vrm { inset: 0; }
.vrm-tile { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; }
.vrm-tile i { position: relative; width: 26px; height: 58px; display: block;
  background: linear-gradient(var(--h) 0 22%, #f1d3c2 22% 34%, var(--t) 34% 66%, var(--b) 66% 80%, #f1d3c2 80%); border-radius: 12px 12px 4px 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); }
.vrm-tile i::before { content: ""; position: absolute; left: -4px; right: -4px; top: 0; height: 40%; background: var(--h); border-radius: 14px 14px 6px 6px; z-index: -1; }
.wb-colors { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin: 10px 0 4px; }
.wb-colors label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin: 0; }
.wb-colors input[type="color"] { width: 30px; height: 26px; padding: 0; border: 1px solid var(--line-2); background: none; cursor: pointer; }
.wb-colors input[type="color"]:disabled { cursor: default; opacity: .8; }
.wb-colors p { flex-basis: 100%; margin: 2px 0 0; }

/* 她变出来的东西（props.js）：摆在她旁边，正在画时一团微光，画好了“啵”地冒出来 */
/* 她投的全息投影（props.js）：半透明、发光、带扫描线，浮在她旁边，脚下一个发光点投出一束光 */
.props { position: absolute; inset: 0; pointer-events: none; --holo: 120, 240, 255; }
.holo { position: absolute; pointer-events: auto; cursor: pointer; transform-origin: 50% 100%; }
.holo .holo-body { position: relative; animation: holo-float 5s ease-in-out infinite, holo-flicker 7s steps(1) infinite; }
.holo .beam { position: absolute; left: 50%; top: 100%; width: 70%; height: var(--lift, 30%); translate: -50% 0; pointer-events: none;
  clip-path: polygon(0 0, 100% 0, 52% 100%, 48% 100%); background: linear-gradient(rgba(var(--holo), .2), rgba(var(--holo), .02) 70%, rgba(var(--holo), .3)); }
.holo .emitter { position: absolute; left: 50%; top: calc(100% + var(--lift, 30%)); width: 18px; height: 6px; translate: -50% -50%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, #fff, rgba(var(--holo), .9) 45%, transparent); box-shadow: 0 0 10px rgba(var(--holo), .9); }
/* 信息面板：从她身侧往外展开，微微转向她 */
.holo-panel { --lift: calc(var(--h, 400px) * .3 * var(--k, 1)); }
.holo-panel.right { translate: 6% 0; }
.holo-panel.left { translate: -106% 0; }
.holo-panel .holo-body { width: max(160px, calc(var(--h, 400px) * .62 * var(--k, 1))); padding: .7em .9em .8em; overflow: hidden;
  font: max(11px, calc(var(--h, 400px) * .042 * var(--k, 1))) / 1.45 var(--sans); color: #d6fcff; text-shadow: 0 0 6px rgba(var(--holo), .85);
  background: linear-gradient(160deg, rgba(var(--holo), .16), rgba(var(--holo), .05)); border: 1px solid rgba(var(--holo), .55);
  box-shadow: 0 0 18px rgba(var(--holo), .3), inset 0 0 22px rgba(var(--holo), .12); backdrop-filter: blur(1.5px); }
.holo-panel.right .holo-body { transform: perspective(700px) rotateY(-12deg); }
.holo-panel.left .holo-body { transform: perspective(700px) rotateY(12deg); }
.holo-panel .holo-body::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(transparent 0 2px, rgba(var(--holo), .08) 2px 3px); animation: holo-scan 6s linear infinite; }
.holo-panel b { display: block; font-weight: 600; letter-spacing: .06em; padding-bottom: .35em; margin-bottom: .35em; border-bottom: 1px solid rgba(var(--holo), .4); }
.holo-panel p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.holo-panel .beam { left: 50%; width: 40%; }
/* 东西的影像：浮在半空，青色扫描线只盖在东西身上 */
.holo-image { translate: -50% 0; aspect-ratio: 1 / 1; --lift: 22%; }
.holo-image .holo-body { height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.holo-image img { height: 100%; width: auto; max-width: none; display: block; user-select: none; opacity: .88;
  filter: saturate(.7) brightness(1.15) drop-shadow(0 0 6px rgba(var(--holo), .75)); }
.holo-image .tint { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: repeating-linear-gradient(transparent 0 2px, rgba(var(--holo), .3) 2px 3px), rgba(var(--holo), .18);
  -webkit-mask: var(--src) center bottom / contain no-repeat; mask: var(--src) center bottom / contain no-repeat; animation: holo-scan 6s linear infinite; }
.holo-image.pending { aspect-ratio: 1 / 1; }
.holo .forming { position: absolute; left: 50%; bottom: 20%; width: 46%; aspect-ratio: 1; translate: -50% 0; border-radius: 50%;
  border: 1px dashed rgba(var(--holo), .8); box-shadow: 0 0 14px rgba(var(--holo), .5), inset 0 0 14px rgba(var(--holo), .4); animation: spin3d 2.4s linear infinite, prop-glow 1.2s ease-in-out infinite; }
/* 亮起 / 收起 / 第一下点中（再点一下收起） */
.holo.on .holo-body { animation: holo-on .5s cubic-bezier(.2, 1.4, .4, 1), holo-float 5s ease-in-out .5s infinite, holo-flicker 7s steps(1) .5s infinite; }
.holo.off { animation: holo-off .32s ease-in forwards; pointer-events: none; }
.holo.armed .holo-body { outline: 1px dashed rgba(255, 242, 176, .9); outline-offset: 4px; }
@keyframes holo-on { 0% { transform: scale(1, .02); filter: brightness(3); opacity: 0; } 45% { transform: scale(1, .02); opacity: 1; } 100% { filter: none; } }
@keyframes holo-off { to { transform: scale(1, .02); opacity: 0; filter: brightness(3); } }
@keyframes holo-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -3px; } }
@keyframes holo-flicker { 0%, 96%, 100% { opacity: 1; } 97% { opacity: .55; } 98% { opacity: .9; } }
@keyframes holo-scan { from { background-position: 0 0; } to { background-position: 0 60px; } }
@keyframes prop-glow { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .holo .holo-body, .holo.on .holo-body, .holo .forming, .holo .tint, .holo-panel .holo-body::after { animation: none; } }

/* 世界模式：潜入小镇（dive.js）——全屏第一人称，深色玻璃面板 + 细青线的界面 */
.dive { position: fixed; inset: 0; z-index: 60; background: #04060e; color: #e9fbff; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  --hud: 120, 240, 255; }
.dive-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; opacity: 0; transition: opacity .8s; }
.dive.ready .dive-canvas { opacity: 1; }
.dive-canvas:active { cursor: grabbing; }
.dive-hud, .dive-voice, .dive-hint, .dive-say { opacity: 0; transition: opacity .6s .3s; }
.dive.ready .dive-hud, .dive.ready .dive-voice, .dive.ready .dive-hint, .dive.ready .dive-say { opacity: 1; }
.dive-hud { position: absolute; top: max(12px, env(safe-area-inset-top)); left: 12px; right: 12px; display: flex; align-items: flex-start; gap: 10px; z-index: 3; pointer-events: none; }
.dive-hud > * { pointer-events: auto; }
.dive-me, .dive-where, .dive-me b { font-weight: 600; letter-spacing: .04em; text-shadow: 0 0 8px rgba(var(--hud), .6); }
.dive-where { margin-left: auto; text-align: right; display: grid; min-width: 0; }
.dive-where b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dive-exit { flex: none; }
.dive-where b { font-weight: 600; letter-spacing: .08em; }
.dive-exit { align-self: stretch; padding: 6px 12px; font-size: 12px; background: rgba(60, 10, 20, .6); border-color: rgba(255, 120, 140, .6); color: #ffd6dc; }
.dive-hint { position: absolute; left: 50%; top: 74px; translate: -50% 0; font-size: 12px; color: rgba(230, 250, 255, .85); text-shadow: 0 1px 3px #000;
  pointer-events: none; z-index: 3; white-space: nowrap; transition: opacity .6s; }
.dive-hint.gone { opacity: 0 !important; }
.dive-edge { position: absolute; left: 50%; top: 40%; translate: -50% 0; padding: 6px 14px; font-size: 13px; color: #ffe9b0; background: rgba(40, 20, 0, .55);
  border: 1px solid rgba(255, 210, 120, .5); z-index: 3; pointer-events: none; }
.dive-say { position: absolute; left: 50%; bottom: calc(40% + env(safe-area-inset-bottom)); translate: -50% 0; max-width: min(600px, calc(100% - 32px));
  padding: 9px 16px; font-size: 15px; line-height: 1.55; z-index: 3; pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 22, 40, .82), rgba(8, 12, 22, .78)); border: 1px solid rgba(var(--hud), .4); border-left: 3px solid rgba(var(--hud), .9); }
/* 语音对话（和“现实”一样，底部一个会动的球，没有输入框）；她离开时收起 */
.dive-voice { position: absolute; left: 0; right: 0; bottom: 0; height: 38%; z-index: 3; pointer-events: none; }
.dive-voice .vm { background: linear-gradient(transparent, rgba(0, 4, 12, .55) 40%); padding: 12px 16px max(16px, env(safe-area-inset-bottom)); }
.dive-voice .vm::after { display: none; }
.dive-voice .vm-stage { gap: 8px; justify-content: flex-end; }
.dive-voice .vm-orb { --size: 84px; }
.dive-voice .vm-caption { min-height: 0; font-size: 14px; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
.dive-voice button { pointer-events: auto; }
.dive.away .dive-voice { display: none; }
.dive-stick { position: absolute; width: 96px; height: 96px; margin: -48px 0 0 -48px; border-radius: 50%; border: 1px solid rgba(var(--hud), .5);
  background: radial-gradient(circle, rgba(var(--hud), .12), rgba(var(--hud), .03)); z-index: 3; pointer-events: none; }
.dive-stick i { position: absolute; left: 50%; top: 50%; width: 40px; height: 40px; margin: -20px; border-radius: 50%; background: rgba(var(--hud), .45); box-shadow: 0 0 12px rgba(var(--hud), .6); }
.dive-say[hidden], .dive-edge[hidden], .dive-stick[hidden] { display: none; }
/* 潜入 / 回到现实的过场 */
.dive-trans { position: absolute; inset: 0; z-index: 10; background: #04060e; }
.dive-trans canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.dive-trans-text { position: absolute; left: 50%; top: 50%; translate: -50% -50%; text-align: center; display: grid; gap: 8px; justify-items: center; }
.dive-trans-text b { font: 600 clamp(28px, 7vw, 54px) / 1 var(--sans); letter-spacing: .4em; padding-left: .4em; color: #fff; text-shadow: 0 0 18px rgba(120, 220, 255, .9), 0 0 40px rgba(120, 160, 255, .6); }
.dive-trans-text span { font-size: 13px; letter-spacing: .2em; color: rgba(220, 245, 255, .85); }
.dive-trans-text ul { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; font: 12px var(--mono); color: rgba(200, 240, 255, .85); min-height: 100px; }
.dive-trans-text li { animation: rise .3s var(--ease); }
.dive-trans-text li i { font-style: normal; color: #7dffb0; margin-left: 8px; }
.dive-trans.flash::after { content: ""; position: absolute; inset: 0; background: #fff; animation: dive-flash .45s ease-out forwards; }
@keyframes dive-flash { from { opacity: 0; } 40% { opacity: 1; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dive-trans canvas { display: none; } }
@media (max-width: 560px) {
  .dive-hud { gap: 6px; }
  .dive-me { padding: 6px 9px; }
  .dive-where { padding: 6px 9px; } .dive-where b { white-space: nowrap; font-size: 13px; }
  .dive-exit { padding: 4px 8px; font-size: 11px; }
  .dive-hint { top: 84px; white-space: normal; text-align: center; width: calc(100% - 32px); }
}

/* 氛围（ambience.js）：整个画面一层粒子 + 一点色调，她脚下一圈光 */
.ambience, .ambience-tint { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ambience { z-index: 2; }
.ambience-tint { transition: background 1.2s; }
.ar-camera .ar-puppet::before { content: ""; position: absolute; left: -30%; right: -30%; bottom: -10%; height: 22%; z-index: -2; pointer-events: none;
  background: radial-gradient(closest-side, var(--floor, transparent), transparent); transition: background 1.2s; }
.ar > .ar-top, .ar > .ar-voice, .ar > .ar-size, .ar > .ar-hint, .ar > .ar-say { z-index: 3; }

.dive-me { display: flex; align-items: center; gap: 8px; }
.dive-where small { font-size: 11px; letter-spacing: .2em; color: rgba(var(--hud), .9); }
.dive-puppet { position: absolute; left: 0; top: 0; width: 360px; height: 480px; opacity: 0; pointer-events: none; z-index: -1; }  /* 只拿来取画面，贴到世界里的卡片上 */
/* 潜行：选世界 / 拍一张 */
.dive-pick-back { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(2, 4, 10, .7); backdrop-filter: blur(3px); }
.dive-pick { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: grid; gap: 10px; padding: 16px; color: #e9fbff; --hud: 120, 240, 255;
  background: linear-gradient(160deg, rgba(10, 22, 40, .95), rgba(8, 12, 22, .95)); border: 1px solid rgba(var(--hud), .45); box-shadow: 0 0 24px rgba(var(--hud), .15); }
.dive-pick-head { display: flex; align-items: center; justify-content: space-between; }
.dive-pick-head b { font-size: 18px; letter-spacing: .3em; text-shadow: 0 0 10px rgba(var(--hud), .7); }
.dive-pick p { margin: 0; }
.dive-wish { display: flex; gap: 8px; }
.dive-wish input { flex: 1; min-width: 0; padding: 10px 12px; color: inherit; background: rgba(var(--hud), .06); border: 1px solid rgba(var(--hud), .5); font: inherit; }
.dive-wish input:focus { outline: none; border-color: rgba(var(--hud), 1); box-shadow: 0 0 0 1px rgba(var(--hud), .4); }
.dive-wish button { padding: 0 16px; font-weight: 700; }
.dive-ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.dive-ideas button { font-size: 12px; }
.dive-shoot { display: grid; place-items: center; padding: 14px; cursor: pointer; border: 1px dashed rgba(var(--hud), .6); background: rgba(var(--hud), .06); font-weight: 600; }
.dive-shoot:hover { background: rgba(var(--hud), .12); }
.dive-shoot.off { opacity: .5; cursor: not-allowed; }
.dive-worlds { display: grid; gap: 8px; }
.dive-world { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; padding: 6px; border: 1px solid rgba(var(--hud), .2); background: rgba(255, 255, 255, .03); }
.dive-world.ready { cursor: pointer; border-color: rgba(var(--hud), .5); }
.dive-world.ready:hover { background: rgba(var(--hud), .08); }
.dive-world img, .dive-world-blank { width: 96px; height: 60px; object-fit: cover; background: rgba(var(--hud), .08); }
.dive-world-info { display: grid; gap: 4px; min-width: 0; }
.dive-world-info b { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dive-world-info small { color: rgba(220, 245, 255, .75); }
.dive-world-info .err { color: #ffb0b8; }
.dive-world-bar { height: 4px; background: rgba(var(--hud), .12); }
.dive-world-bar i { display: block; height: 100%; background: rgb(var(--hud)); box-shadow: 0 0 6px rgba(var(--hud), .8); transition: width .6s; }
/* AR 的三种模式：投影 / 增强 / 潜行 */
.ar-modes { position: absolute; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 44px); translate: -50% 0; z-index: 3; display: flex;
  border: 1px solid rgba(120, 240, 255, .45); background: rgba(8, 14, 26, .6); backdrop-filter: blur(4px); }
.ar-modes button { padding: 6px 14px; font-size: 13px; letter-spacing: .1em; background: transparent; border: 0; color: rgba(220, 245, 255, .75); }
.ar-modes button.on { color: #fff; background: rgba(120, 240, 255, .22); box-shadow: inset 0 -2px 0 rgb(120, 240, 255); text-shadow: 0 0 8px rgba(120, 240, 255, .8); }
.ar-inner[hidden], .ar-inner3d[hidden] { display: none; }
.ar.inner-on .ar-cam { filter: saturate(.85) brightness(.92); transition: filter 2s; }  /* 她的世界只在她身边一块：外面的现实只稍微压暗一点 */
.ar-camera .ar-puppet.walking .portrait { animation: ar-hop .32s ease-in-out infinite alternate; }
@keyframes ar-hop { from { transform: translateY(0); } to { transform: translateY(-3%); } }
.ar-inner, .ar-inner3d { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.ar-inner3d { -webkit-mask-image: radial-gradient(ellipse 62% 40% at 50% 64%, #000 72%, transparent 100%);
  mask-image: radial-gradient(ellipse 62% 40% at 50% 64%, #000 72%, transparent 100%); }  /* 3D 的里世界也只在一块里（和 inner.js 的 ZONE 差不多大） */
/* AR 的状态条：正在做什么、还要多久、做好了点哪里 */
.ar-status { position: absolute; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 86px); translate: -50% 0; z-index: 3; display: flex; align-items: center; gap: 8px;
  max-width: calc(100% - 24px); padding: 6px 8px 6px 12px; font-size: 13px; color: #e9fbff; background: rgba(8, 14, 26, .78); border: 1px solid rgba(120, 240, 255, .45);
  backdrop-filter: blur(4px); box-shadow: 0 0 14px rgba(120, 240, 255, .15); }
.ar-status[hidden] { display: none; }
.ar-status-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: rgb(120, 240, 255); box-shadow: 0 0 8px rgb(120, 240, 255); animation: ar-blink 1s ease-in-out infinite; }
.ar-status.ok .ar-status-dot { background: #7dffb0; box-shadow: 0 0 8px #7dffb0; animation: none; }
.ar-status.err { border-color: rgba(255, 140, 150, .6); }
.ar-status.err .ar-status-dot { background: #ff8c96; box-shadow: none; animation: none; }
.ar-status-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ar-status-bar { width: 64px; height: 4px; flex: none; background: rgba(120, 240, 255, .15); }
.ar-status-bar[hidden] { display: none; }
.ar-status-bar i { display: block; height: 100%; background: rgb(120, 240, 255); transition: width 1s linear; }
.ar-status-act { flex: none; padding: 4px 12px; font-size: 13px; }
.ar-status-act[hidden] { display: none; }
.ar-status.nudge { animation: ar-nudge .45s ease; }
@keyframes ar-nudge { 0%, 100% { translate: -50% 0; } 25% { translate: calc(-50% - 6px) 0; } 75% { translate: calc(-50% + 6px) 0; } }
@keyframes ar-blink { 50% { opacity: .35; } }
.ar-modes button.ready { color: #fff; animation: ar-ready 1.4s ease-in-out infinite; }
@keyframes ar-ready { 50% { background: rgba(125, 255, 176, .28); box-shadow: inset 0 0 12px rgba(125, 255, 176, .5); } }
/* AR 里的说明卡（代替浏览器的确认框） */
.ar-sheet { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 20; width: min(420px, calc(100% - 24px));
  display: grid; gap: 8px; padding: 14px 16px; color: #e9fbff; background: linear-gradient(160deg, #0b1830, #080c18);
  border: 1px solid rgba(120, 240, 255, .5); box-shadow: 0 0 24px rgba(120, 240, 255, .2); animation: rise .25s var(--ease); }
.ar-sheet[hidden] { display: none; }
.ar-sheet b { font-size: 16px; letter-spacing: .06em; }
.ar-sheet p { margin: 0; font-size: 14px; line-height: 1.6; white-space: pre-line; color: rgba(233, 251, 255, .9); }
.ar-sheet small { color: rgb(120, 240, 255); font-size: 12px; }
.ar-sheet-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.ar-sheet-btns button { padding: 8px 16px; }
@media (prefers-reduced-motion: reduce) { .ar-status-dot, .ar-modes button.ready, .ar-status.nudge { animation: none; } }
.dive-cost { margin: 0; color: rgb(120, 240, 255); }
.dive-world-info .ok { color: #7dffb0; }
/* 潜行第一次：怎么走 */
.dive-coach { position: absolute; left: 50%; top: 50%; translate: -50% -50%; z-index: 5; width: min(340px, calc(100% - 32px)); display: grid; gap: 10px; padding: 16px;
  background: rgba(8, 14, 26, .88); border: 1px solid rgba(var(--hud), .5); box-shadow: 0 0 24px rgba(var(--hud), .2); backdrop-filter: blur(4px); transition: opacity .35s; }
.dive-coach.gone { opacity: 0; pointer-events: none; }
.dive-coach b { font-size: 15px; letter-spacing: .1em; }
.dive-coach-row { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; font-size: 13px; line-height: 1.5; }
.dive-coach-row i { font-style: normal; font: 600 12px var(--mono); text-align: center; padding: 6px 0; border: 1px solid rgba(var(--hud), .45); color: rgb(var(--hud)); }
.dive-coach button { justify-self: end; padding: 7px 18px; }
.dive:not(.ready) .dive-coach { display: none; }
.dive:has(.dive-coach:not(.gone)) .dive-hint { display: none; }
.dive-trans-cancel { position: absolute; right: 12px; top: max(12px, env(safe-area-inset-top)); z-index: 2; padding: 6px 14px; font-size: 13px;
  color: rgba(220, 245, 255, .85); border-color: rgba(120, 240, 255, .35); background: rgba(4, 6, 14, .5); }

/* 手机：输入框字号至少 16px，不然 iPhone 点进输入框会把整页放大，body 又不能滚，看起来就是“显示不全”。
   窄屏输入栏：输入框优先占宽，语音对话按钮只留图标 */
@media (pointer: coarse) {
  input, select, textarea, label > input, label > textarea, label > select { font-size: 16px; }
}
@media (max-width: 480px) {
  .chat-form { gap: 6px; padding: 10px 12px max(10px, env(safe-area-inset-bottom)); }
  .chat-form textarea { min-width: 0; }
  .chat-form .icon-btn { padding: 0 10px; }
  .vm-open { padding: 0 12px; }
  .vm-open span { display: none; }
}
