/* 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; }
.ripple { position: fixed; z-index: 95; width: 10px; height: 10px; translate: -50% -50%; border: 1px solid var(--silver); border-radius: 50%; pointer-events: none; animation: ripple .8s var(--ease) forwards; }

/* ---------- 钴蓝铜版画 ---------- */
.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-y: auto; background: var(--ink); border-right: 1px solid var(--line); }
.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 .25s; }
.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); }
.char-item .name { font-weight: 500; font-size: 14px; }
.char-item .muted { font-size: 11px; }

/* 头像：钴蓝方块，主角用线稿头像，其他用首字 */
.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 .5s var(--ease); }
.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; animation: rise .4s var(--ease); }
.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 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; } }
@keyframes ripple { from { width: 10px; height: 10px; opacity: .9; } to { width: 90px; height: 90px; opacity: 0; } }


/* ---------- 记忆侧栏 ---------- */
.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 .ar-avatar { position: absolute; width: 34%; aspect-ratio: 3 / 4; transition: left .4s var(--ease), top .4s var(--ease), transform .4s var(--ease); pointer-events: none; }
.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; }
  .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: radial-gradient(ellipse at 50% 38%, rgba(70, 90, 240, .55), transparent 64%), var(--cobalt-dk); }
.stage2d::after { content: ""; position: absolute; inset: 0; background: var(--noise); opacity: .14; mix-blend-mode: overlay; pointer-events: none; }
.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 10px 30px rgba(0, 0, 40, .45)); user-select: none; -webkit-user-drag: none; }
.portrait canvas { position: absolute; inset: 0; }
.portrait.talking > img { animation: breathe 5.5s ease-in-out infinite, talk .32s ease-in-out infinite alternate; }
.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; }
.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); }

.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: 34px; height: 40px; flex-shrink: 0; }
.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); }
