/* ============================================================
 * 大肥鱼 · 样式
 * 深色水族缸风格，玻璃拟态，无框架依赖
 * ============================================================ */

:root {
  --bg: #06131c;
  --bg-2: #081a25;
  --panel: rgba(10, 26, 37, .78);
  --panel-solid: #0b1d29;
  --line: rgba(140, 220, 255, .13);
  --line-strong: rgba(140, 220, 255, .24);
  --ink: #e6f3fa;
  --ink-2: #b9cede;
  --muted: #7e99aa;
  --accent: #35d6c0;
  --accent-dim: rgba(53, 214, 192, .14);
  --warm: #ffb27a;
  --danger: #ff6b6b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .45);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

/* 关键：.modal / .unlock-banner 自己写了 display，会盖掉 UA 的 [hidden] */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body {
  background:
    radial-gradient(1200px 700px at 18% -10%, rgba(53, 214, 192, .12), transparent 60%),
    radial-gradient(900px 600px at 92% 110%, rgba(90, 130, 255, .12), transparent 62%),
    var(--bg);
}

h1, h2, h3, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 骨架 ---------- */
.app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
  flex: 0 0 auto;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 24, 34, .92), rgba(6, 19, 28, .72));
  backdrop-filter: blur(12px);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(140, 220, 255, .28);
  box-shadow: 0 2px 10px rgba(53, 214, 192, .35);
  flex: 0 0 auto;
}
.brand-fish { font-size: 22px; filter: drop-shadow(0 2px 8px rgba(53, 214, 192, .5)); }
.brand-text { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.brand-text h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .5px;
  white-space: nowrap;
}
.brand-text span {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }

.pill {
  font-size: 11px;
  color: var(--ink-2);
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  white-space: nowrap;
}
.pill-lock { color: var(--warm); border-color: rgba(255, 178, 122, .3); background: rgba(255, 178, 122, .08); }
.pill-on { color: var(--accent); border-color: rgba(53, 214, 192, .35); background: var(--accent-dim); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid rgba(53, 214, 192, .4);
  background: linear-gradient(180deg, rgba(53, 214, 192, .22), rgba(53, 214, 192, .1));
  color: #d8fbf5;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: transform .12s ease, background .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn:hover { background: rgba(53, 214, 192, .28); border-color: rgba(53, 214, 192, .6); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn.ghost {
  background: rgba(255, 255, 255, .03);
  border-color: var(--line-strong);
  color: var(--ink-2);
}
.btn.ghost:hover { background: rgba(255, 255, 255, .07); color: var(--ink); }

.btn.danger {
  background: rgba(255, 107, 107, .12);
  border-color: rgba(255, 107, 107, .38);
  color: #ffc9c9;
}
.btn.danger:hover { background: rgba(255, 107, 107, .22); }

.btn.small { padding: 6px 11px; font-size: 12px; }

.icon-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
}
.icon-btn:hover { background: rgba(255, 255, 255, .07); color: var(--ink); }

/* ---------- 主布局 ---------- */
.layout {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
}

/* ---------- 鱼缸舞台 ---------- */
.stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
  isolation: isolate;
  /* 背景图由 app.js 按 CONFIG.scene.image 设到元素上：
     放在 CSS 变量里的话，相对路径会按 assets/style.css 解析，变成 assets/assets/… */
  background-color: #101820;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

/* 顶部水面光束（叠在背景图上，保持很淡） */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(102deg, transparent 42%, rgba(180, 245, 255, .07) 48%, transparent 55%),
    linear-gradient(84deg, transparent 62%, rgba(180, 245, 255, .05) 68%, transparent 74%);
  mix-blend-mode: screen;
  animation: beam 14s ease-in-out infinite alternate;
}
@keyframes beam {
  from { opacity: .5; transform: translateX(-2%); }
  to   { opacity: .95; transform: translateX(2%); }
}

#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
  touch-action: none;
}

.stage-hud {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 3;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  max-width: calc(100% - 28px);
}

.chip {
  position: relative;
  border: 1px solid var(--line-strong);
  background: rgba(6, 20, 29, .55);
  backdrop-filter: blur(8px);
  color: var(--ink-2);
  font-size: 12px;
  padding: 7px 12px;
  border-radius: 999px;
  transition: all .16s ease;
}
.chip:hover { color: var(--ink); border-color: rgba(53, 214, 192, .5); background: rgba(53, 214, 192, .12); }
.chip:active { transform: scale(.96); }
.chip .lock {
  font-size: 9px;
  margin-left: 5px;
  opacity: .55;
}
.chip.premium.is-locked { color: var(--muted); }
.chip.premium.is-unlocked .lock { display: none; }
.chip.premium.is-unlocked { border-color: rgba(255, 178, 122, .45); color: var(--warm); }

.stage-foot {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 4;
  font-size: 11px;
  color: rgba(30, 34, 44, .55);
  pointer-events: none;
  letter-spacing: .3px;
  text-shadow: 0 1px 2px rgba(255, 255, 255, .35);
}

/* ---------- 视频角色 ---------- */
.char-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8.5%;
}

/* 角色背后的柔光，让她不像是硬贴上去的 */
.char-stage::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8%;
  width: min(420px, 46%);
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 226, 180, .16), transparent 66%);
  filter: blur(12px);
}

/* 只露出视频里角色所在的那块区域
   实测角色在 640x360 帧里的不透明范围是 x 230~430 / y 60~328，
   这里按 256x324 裁一块（留了点余量给挥手、跑动这些动作） */
.char-crop {
  position: relative;
  height: 60%;
  aspect-ratio: 256 / 324;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .5));
  animation: charFloat 5.4s ease-in-out infinite;
  -webkit-tap-highlight-color: transparent;
}

.char-crop video {
  position: absolute;
  width: 250%;
  height: 111.11%;
  left: -78.9%;
  top: -9.88%;
  object-fit: fill;
  opacity: 0;
  transition: opacity .22s ease;
}
.char-crop video.is-on { opacity: 1; }

/* 不支持透明视频时的静态立绘，裁切参数和视频完全一致 */
.char-crop .char-poster {
  position: absolute;
  width: 250%;
  height: 111.11%;
  left: -78.9%;
  top: -9.88%;
  object-fit: fill;
}

/* 手机端角色：动图 WebP，不用 <video>（浏览器会抓 video 做悬浮播放器） */
.char-crop .char-img {
  position: absolute;
  width: 250%;
  height: 111.11%;
  left: -78.9%;
  top: -9.88%;
  opacity: 0;
  transition: opacity .22s ease;
  pointer-events: none;
}
.char-crop .char-img.is-on { opacity: 1; }

@keyframes charFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

/* 说话时轻轻起伏（没有真口型，用这个示意） */
.char-stage.is-talking .char-crop {
  animation: charTalk .34s ease-in-out infinite;
}
@keyframes charTalk {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-3px) rotate(-.8deg); }
}

.char-stage.is-happy .char-crop {
  animation: charHappy .7s ease-in-out 2;
}
@keyframes charHappy {
  0%, 100% { transform: translateY(0) scale(1); }
  40% { transform: translateY(-14px) scale(1.02); }
}

.unlock-banner {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 320px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 178, 122, .32);
  background: linear-gradient(180deg, rgba(46, 30, 20, .9), rgba(28, 18, 13, .92));
  backdrop-filter: blur(10px);
  color: #ffe3c9;
  font-size: 12px;
  text-align: left;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  animation: floatUp .5s ease both;
}
.unlock-banner:hover { border-color: rgba(255, 178, 122, .6); }
.ub-ico { font-size: 15px; }
.ub-text { flex: 1; line-height: 1.35; }
.ub-arrow { opacity: .6; font-size: 16px; }
@keyframes floatUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- 聊天区 ---------- */
.chat {
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(8, 22, 32, .86), rgba(6, 18, 26, .94));
  backdrop-filter: blur(10px);
}

.chat-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.chat-head strong { font-weight: 600; }
.chat-head-note {
  margin-left: auto;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.dot-live {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(53, 214, 192, .6);
  animation: livePulse 2.4s infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(53, 214, 192, .55); }
  70%  { box-shadow: 0 0 0 7px rgba(53, 214, 192, 0); }
  100% { box-shadow: 0 0 0 0 rgba(53, 214, 192, 0); }
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.messages::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb {
  background: rgba(140, 220, 255, .16);
  border-radius: 8px;
}
.messages::-webkit-scrollbar-thumb:hover { background: rgba(140, 220, 255, .28); }

.msg {
  display: flex;
  gap: 8px;
  max-width: 92%;
  animation: msgIn .28s ease both;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg .avatar {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 14px;
  background: linear-gradient(180deg, rgba(53, 214, 192, .3), rgba(53, 214, 192, .1));
  border: 1px solid rgba(53, 214, 192, .3);
}
/* 角色头像 */
.msg.fish .avatar {
  font-size: 0;
  background-image: url(../assets/char/avatar.png);
  background-size: cover;
  background-position: center;
}
.msg.user .avatar {
  background: linear-gradient(180deg, rgba(255, 178, 122, .3), rgba(255, 178, 122, .1));
  border-color: rgba(255, 178, 122, .32);
}

.bubble {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.62;
  word-break: break-word;
  white-space: pre-wrap;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--line);
  color: var(--ink);
}
.msg.fish .bubble { border-top-left-radius: 4px; }
.msg.user { flex-direction: row-reverse; margin-left: auto; }
.msg.user .bubble {
  background: linear-gradient(180deg, rgba(53, 214, 192, .18), rgba(53, 214, 192, .1));
  border-color: rgba(53, 214, 192, .26);
  border-top-right-radius: 4px;
}
.msg.system .bubble {
  background: rgba(255, 178, 122, .08);
  border-color: rgba(255, 178, 122, .24);
  color: #ffd9b8;
  font-size: 12.5px;
}

.bubble .cursor {
  display: inline-block;
  width: 2px; height: 13px;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--accent);
  animation: caret .9s steps(1) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* 思考中 */
.thinking { display: flex; gap: 4px; padding: 4px 2px; }
.thinking i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .35;
  animation: bounce 1.2s infinite;
}
.thinking i:nth-child(2) { animation-delay: .15s; }
.thinking i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .3; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* 空状态：压到最紧凑，别把聊天区占满 */
.empty-card {
  margin: 4px 2px 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, .025);
  text-align: center;
}
.empty-card .big { font-size: 22px; margin-bottom: 6px; }
.empty-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 6px;
  border: 1px solid rgba(140, 220, 255, .3);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.empty-card h3 { font-size: 13.5px; margin-bottom: 4px; }
.empty-card p { font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.empty-card .btn { margin-top: 10px; padding: 8px 18px; font-size: 12.5px; }

.suggest-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 2px 10px;
}
.suggest {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--ink-2);
  font-size: 11.5px;
  padding: 5px 10px;
  border-radius: 999px;
}
.suggest:hover { border-color: rgba(53, 214, 192, .45); color: var(--ink); }

/* ---------- 输入框 ---------- */
.composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--line);
  background: rgba(5, 16, 23, .6);
}

#input {
  flex: 1 1 auto;
  resize: none;
  max-height: 132px;
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .04);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.5;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}
#input::placeholder { color: var(--muted); }
#input:focus {
  border-color: rgba(53, 214, 192, .55);
  box-shadow: 0 0 0 3px rgba(53, 214, 192, .1);
}
#input:disabled { opacity: .5; }

#send {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid rgba(53, 214, 192, .5);
  background: linear-gradient(180deg, rgba(53, 214, 192, .38), rgba(53, 214, 192, .18));
  color: #eafffb;
  font-size: 13px;
  font-weight: 600;
  transition: all .16s ease;
}
#send:hover:not(:disabled) { background: rgba(53, 214, 192, .45); }
#send:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- 免责 ---------- */
/* 主界面只留一行极小的提示，完整文案在「设置 → 免责声明」里 */
.mini-legal {
  flex: 0 0 auto;
  padding: 5px 14px calc(6px + env(safe-area-inset-bottom));
  font-size: 9.5px;
  line-height: 1.4;
  letter-spacing: .1px;
  color: rgba(150, 172, 190, .55);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-top: 1px solid rgba(255, 255, 255, .04);
}

/* 设置里的完整免责条款 */
.legal-text p {
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
  margin-bottom: 8px;
}
.legal-text b {
  color: var(--ink-2);
  font-weight: 600;
  margin-right: 4px;
}

.disclaimers {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 18px;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  background: rgba(4, 13, 19, .8);
}
.disclaimers p {
  font-size: 10.5px;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.disclaimers b {
  color: var(--ink-2);
  font-weight: 600;
  margin-right: 4px;
}

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 8, 12, .72);
  backdrop-filter: blur(6px);
  animation: fadeIn .18s ease both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  width: min(560px, 100%);
  max-height: min(86dvh, 760px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, #0c2130, #081a25);
  box-shadow: var(--shadow);
  animation: popIn .22s cubic-bezier(.2, .9, .3, 1.1) both;
  overflow: hidden;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 15px; font-weight: 600; }

.modal-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(140, 220, 255, .16); border-radius: 8px; }

.modal-foot {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: rgba(4, 13, 19, .5);
}

/* ---------- 表单 ---------- */
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: .2px;
}
.field-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-hint {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--muted);
}
.danger-hint { color: rgba(255, 150, 150, .75); }

input[type="text"], input[type="password"], .select {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .28);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
/* 只有横排的时候才拉伸填满剩余宽度 */
.field-row > input { flex: 1 1 200px; width: auto; }
input[type="text"]:focus, input[type="password"]:focus, .select:focus {
  border-color: rgba(53, 214, 192, .55);
  box-shadow: 0 0 0 3px rgba(53, 214, 192, .1);
}
.select { cursor: pointer; }
.select option { background: #0b1d29; color: var(--ink); }

.switch-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.switch-row > div { flex: 1 1 auto; display: flex; flex-direction: column; gap: 6px; }
.field-label[for="f-tts"] { margin: 0; }

.switch {
  appearance: none;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid var(--line-strong);
  position: relative;
  cursor: pointer;
  transition: background .2s ease;
  margin-top: 2px;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #9fb6c6;
  transition: transform .2s cubic-bezier(.2, .9, .3, 1.2), background .2s ease;
}
.switch:checked { background: rgba(53, 214, 192, .35); border-color: rgba(53, 214, 192, .6); }
.switch:checked::after { transform: translateX(18px); background: var(--accent); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.test-result { font-size: 11.5px; }
.test-result.ok { color: var(--accent); }
.test-result.err { color: var(--danger); }
.test-result.wait { color: var(--muted); }

/* ---------- 导入预览 ---------- */
.import-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
}
.stat .k { font-size: 10.5px; color: var(--muted); margin-bottom: 4px; }
.stat .v { font-size: 16px; font-weight: 600; color: var(--ink); }
.stat .v.small { font-size: 12.5px; font-weight: 500; }

.preview-lines {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, .25);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-2);
  max-height: 180px;
  overflow-y: auto;
}
.preview-lines .who { color: var(--accent); margin-right: 6px; }
.preview-lines .who.user { color: var(--warm); }

.import-warn {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 107, 107, .4);
  background: rgba(255, 107, 107, .1);
  color: #ffd2d2;
  font-size: 12.5px;
  line-height: 1.7;
}
.import-warn b { color: #ff9b9b; }
.import-ok {
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(53, 214, 192, .32);
  background: var(--accent-dim);
  color: #c9f7ef;
  font-size: 12.5px;
  line-height: 1.7;
}

/* ---------- 广告 ---------- */
.ad-card { width: min(460px, 100%); }

.ad-stage {
  position: relative;
  padding: 34px 20px 30px;
  text-align: center;
  background:
    radial-gradient(120% 100% at 50% -20%, rgba(255, 214, 130, .32), transparent 60%),
    linear-gradient(180deg, #4a3520, #2a1d12);
  overflow: hidden;
}
.ad-brand { font-size: 20px; font-weight: 800; color: #ffe9c9; letter-spacing: 1px; }
.ad-slogan { margin-top: 6px; font-size: 12px; color: rgba(255, 233, 201, .65); }
.ad-art {
  margin-top: 18px;
  font-size: 54px;
  animation: adBounce 1.8s ease-in-out infinite;
}
@keyframes adBounce {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-10px) rotate(4deg); }
}
.ad-badge {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .45);
  color: rgba(255, 255, 255, .7);
  letter-spacing: 1px;
}

.ad-progress {
  height: 3px;
  background: rgba(255, 255, 255, .08);
}
.ad-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--warm), #ffd9a8);
  transition: width .3s linear;
}

.ad-foot { align-items: center; justify-content: space-between; }
.ad-timer { font-size: 12px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  left: 50%;
  top: 72px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink);
  background: rgba(12, 33, 48, .95);
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .4);
  animation: toastIn .24s ease both;
  max-width: 82vw;
  text-align: center;
}
.toast.err { border-color: rgba(255, 107, 107, .5); color: #ffd2d2; }
.toast.ok { border-color: rgba(53, 214, 192, .5); color: #c9f7ef; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.toast.out { animation: toastOut .2s ease both; }
@keyframes toastOut {
  to { opacity: 0; transform: translateY(-6px); }
}

/* ---------- 开启页 ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: radial-gradient(120% 80% at 50% 6%, #123c52 0%, #071a26 45%, #030a10 100%);
  transition: opacity .55s ease, visibility .55s;
}
.splash.is-gone { opacity: 0; visibility: hidden; pointer-events: none; }

.splash-glow {
  position: absolute;
  left: 50%;
  top: 40%;
  width: min(620px, 92vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(90, 200, 255, .22), transparent 62%);
  filter: blur(20px);
  animation: splashGlow 5s ease-in-out infinite alternate;
}
@keyframes splashGlow {
  from { opacity: .55; transform: translate(-50%, -50%) scale(.94); }
  to   { opacity: 1;   transform: translate(-50%, -50%) scale(1.06); }
}

.splash-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 24px calc(20px + env(safe-area-inset-bottom));
  text-align: center;
  animation: splashIn .7s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes splashIn {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* 动画素材槽位：有视频就播视频，没有就用头像 */
.splash-art {
  /* 默认不显示。开场媒体由 .splash-bg 负责，
     头像只在「动画播完、退回取名页」时才由 showSplashForm() 放出来 */
  display: none;
  height: min(36dvh, 290px);
  align-items: flex-end;
  justify-content: center;
  margin-bottom: 6px;
}
.splash-art img,
.splash-art video {
  max-height: 100%;
  max-width: 80vw;
  object-fit: contain;
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, .55));
}
.splash-avatar {
  width: min(34dvh, 270px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  animation: charFloat 5s ease-in-out infinite;
}

.splash-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 6px;
  text-shadow: 0 4px 24px rgba(53, 214, 192, .35);
}
.splash-sub { font-size: 13px; color: var(--muted); }

.splash-name {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
  width: min(320px, 82vw);
}
.splash-name label { font-size: 12px; color: var(--ink-2); }
.splash-name input {
  width: 100%;
  height: 48px;
  text-align: center;
  font-size: 16px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .3);
  color: var(--ink);
  outline: none;
  font-family: inherit;
}
.splash-name input:focus {
  border-color: rgba(53, 214, 192, .6);
  box-shadow: 0 0 0 3px rgba(53, 214, 192, .12);
}
.splash-name-hint { font-size: 10.5px; color: var(--muted); }

.splash-enter {
  margin-top: 20px;
  padding: 13px 48px;
  font-size: 15px;
  border-radius: 999px;
  letter-spacing: 1px;
}

.splash-legal {
  margin-top: 20px;
  font-size: 10.5px;
  line-height: 1.7;
  color: rgba(185, 206, 222, .5);
  max-width: 88vw;
}

.splash-hint { display: none; }

/* 开屏声音开关（默认静音，用户点了才出声） */
.splash-sound {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 5;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(0, 0, 0, .42);
  backdrop-filter: blur(8px);
  color: #e6f3fa;
  font-size: 12px;
  letter-spacing: .3px;
  transition: border-color .18s ease, background .18s ease;
}
.splash-sound:hover { border-color: rgba(255, 255, 255, .45); }
.splash-sound.is-on {
  border-color: rgba(53, 214, 192, .6);
  color: #d8fbf5;
  background: rgba(53, 214, 192, .18);
}

/* 开屏播放中：铺满 + 底部压暗，提示可跳过 */
.splash.is-cover .splash-hint {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  color: rgba(220, 235, 245, .55);
  letter-spacing: .3px;
}
.splash.is-cover .splash-legal { margin-top: 8px; }

/* ---------- 开屏媒体层 ---------- */
/* 单独一层、直接挂在 .splash 下：放进带动画的 .splash-inner 里会让
   position:fixed 被动画层捕获，视频只能挤出一个小框 */
.splash-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}
.splash-bg img,
.splash-bg video {
  display: block;
  max-width: 82vw;
  max-height: 42dvh;
  object-fit: contain;
  filter: drop-shadow(0 18px 32px rgba(0, 0, 0, .55));
}

/* 开屏：半屏模式（手机用，不裁切）——媒体在上，文字在下 */
.splash:not(.is-cover) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.splash:not(.is-cover) .splash-bg {
  position: static;
  width: 100%;
  height: 38dvh;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.splash:not(.is-cover) .splash-bg img,
.splash:not(.is-cover) .splash-bg video {
  max-width: 88vw;
  max-height: 100%;
  margin: 0;
  border-radius: 14px;
}

/* ---------- 开屏：全屏铺满模式（横屏动画素材） ---------- */
.splash.is-cover { background: #04070b; }
.splash.is-cover .splash-glow { display: none; }
.splash.is-cover .splash-art { display: none; }

.splash.is-cover .splash-bg img,
.splash.is-cover .splash-bg video {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  margin: 0;
  filter: none;
}

/* 底部压暗，保证名字和按钮能看清 */
.splash.is-cover::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(3, 7, 12, .12) 0%,
    rgba(3, 7, 12, .38) 48%,
    rgba(3, 7, 12, .88) 82%,
    rgba(3, 7, 12, .96) 100%
  );
}

.splash.is-cover .splash-inner {
  position: relative;
  z-index: 2;
  align-self: end;
  padding-bottom: max(26px, 5vh);
  animation-delay: .45s;
}
.splash.is-cover .splash-title { font-size: 26px; margin-top: 2px; }
.splash.is-cover .splash-sub { font-size: 12px; opacity: .8; }
.splash.is-cover .splash-name { margin-top: 14px; }
.splash.is-cover .splash-enter { margin-top: 16px; padding: 11px 44px; font-size: 14px; }
.splash.is-cover .splash-legal { margin-top: 14px; }

/* 声音开关的样式统一在上面「开屏声音开关」那一块，这里不要再写一份
   —— 曾经这里有一条 position:fixed 的旧规则，和上面的 absolute 叠加，
   四个边全被撑开，按钮变成了覆盖整屏的圆角大框。 */

/* ---------- 动作库 ---------- */
.actions-card {
  width: min(760px, 100%);
  height: min(86dvh, 820px);
}

.actions-count {
  margin-left: auto;
  margin-right: 8px;
  font-size: 11px;
  color: var(--muted);
}

.actions-bar {
  flex: 0 0 auto;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.actions-bar input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(0, 0, 0, .28);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}
.actions-bar input:focus {
  border-color: rgba(53, 214, 192, .55);
  box-shadow: 0 0 0 3px rgba(53, 214, 192, .1);
}

.action-cats {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}
.action-cats::-webkit-scrollbar { display: none; }

.cat-tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
  color: var(--ink-2);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.cat-tab .n { opacity: .45; font-size: 10px; margin-left: 4px; }
.cat-tab.active {
  color: var(--accent);
  border-color: rgba(53, 214, 192, .55);
  background: var(--accent-dim);
}

.action-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.action-list::-webkit-scrollbar { width: 8px; }
.action-list::-webkit-scrollbar-thumb { background: rgba(140, 220, 255, .16); border-radius: 8px; }

.action-group-title {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 8px;
  letter-spacing: .5px;
}
.action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.act {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .035);
  color: var(--ink-2);
  font-size: 12.5px;
  padding: 8px 13px;
  border-radius: 10px;
  transition: all .15s ease;
}
.act:hover {
  color: var(--ink);
  border-color: rgba(53, 214, 192, .5);
  background: rgba(53, 214, 192, .1);
}
.act:active { transform: scale(.97); }
.act.is-playing {
  color: var(--accent);
  border-color: rgba(53, 214, 192, .6);
  background: var(--accent-dim);
}
.act.is-locked { color: var(--muted); }
.act.is-locked::after { content: " 🔒"; font-size: 10px; opacity: .6; }
.act-empty {
  color: var(--muted);
  font-size: 12.5px;
  padding: 24px 0;
  text-align: center;
}

@media (max-width: 560px) {
  .actions-card { height: 92dvh; }
  .action-list { padding: 12px 12px 16px; }
  .act { font-size: 12px; padding: 7px 11px; }
}
@media (max-width: 860px) {
  .layout {
    grid-template-columns: 1fr;
    /* 鱼缸 40% → 34%，把高度让给聊天 */
    grid-template-rows: minmax(150px, 34dvh) minmax(0, 1fr);
  }
  .chat { border-left: none; border-top: 1px solid var(--line); }
  .brand-text span { display: none; }
  .pill { display: none; }
  .pill-lock { display: inline-block; }

  .stage-hud { left: 10px; top: 10px; gap: 6px; }
  .chip { padding: 6px 10px; font-size: 11.5px; }
  .stage-foot { display: none; }

  /* 建议词压成一行横滑，别占两行高度 */
  .suggest-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
  }
  .suggest-row::-webkit-scrollbar { display: none; }
  .suggest { flex: 0 0 auto; }

  .unlock-banner {
    left: 10px;
    right: 10px;
    bottom: 8px;
    max-width: none;
    padding: 8px 12px;
    font-size: 11px;
  }
  .ub-text {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  /* 角色站在广告条上方 */
  .char-stage { padding-bottom: 12%; }

  .disclaimers {
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  }
  .disclaimers p { font-size: 10px; -webkit-line-clamp: 2; }

  .composer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .splash-title { font-size: 26px; }
}

@media (max-width: 560px) {
  .topbar { height: 52px; padding: 0 10px; gap: 6px; }
  .brand h1 { font-size: 15px; }
  .brand-avatar { width: 24px; height: 24px; }
  .topbar-right { gap: 4px; }
  .topbar .btn { padding: 7px 9px; font-size: 11.5px; }

  /* 16px 是为了避免 iOS 聚焦输入框时自动放大页面 */
  #input { font-size: 16px; }
  .msg { max-width: 96%; }
  .bubble { font-size: 13px; }

  .empty-card { padding: 12px; }
  .empty-card .empty-avatar { width: 42px; height: 42px; }
  .empty-card h3 { font-size: 13px; }
  .empty-card p { font-size: 11.5px; }

  .scene-pop { grid-template-columns: repeat(4, 1fr); gap: 8px; width: calc(100% - 20px); left: 10px; }
  .modal-card { max-height: 92dvh; }
  .splash-art { height: min(30dvh, 210px); }
  .splash-title { font-size: 23px; }
  .splash-sub { font-size: 12px; }
  .splash-enter { padding: 12px 40px; font-size: 14px; }
}

/* 很窄的屏幕才落到单列，不然底部文案太高 */
@media (max-width: 380px) {
  .disclaimers { grid-template-columns: 1fr; }
}

/* 横屏手机：把鱼缸收窄一点，别把聊天挤没了 */
@media (max-height: 500px) and (orientation: landscape) {
  .layout { grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: 1fr; }
  .chat { border-left: 1px solid var(--line); border-top: none; }
  .disclaimers { display: none; }
  .char-stage { padding-bottom: 4%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .messages { scroll-behavior: auto; }
}

/* ---------- 场景选择器（已停用，只保留 caret 样式给动作库按钮） ---------- */
.chip .caret { font-size: 9px; opacity: .6; }

/* ---------- WebGL 不可用时的兜底 ---------- */
.webgl-fallback {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}
.wf-fish {
  font-size: 64px;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .45));
  animation: floaty 4.5s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-14px) rotate(3deg); }
}
.webgl-fallback span {
  font-size: 12px;
  color: var(--muted);
  max-width: 260px;
  text-align: center;
  line-height: 1.6;
}

/* ============================================================
   导航 + 三个视图（互动 / 聊天 / 设置）
   ============================================================ */

.app {
  flex-direction: row;
}

/* ---------- 导航（桌面在左，手机在底） ---------- */
.nav {
  flex: 0 0 208px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 12px 12px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(9, 23, 33, .98), rgba(6, 17, 25, .99));
  z-index: 30;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 16px;
}
.nav-brand .brand-avatar { width: 36px; height: 36px; }
.nav-brand h1 { font-size: 15.5px; font-weight: 650; }
.nav-brand .brand-text span { font-size: 10px; color: var(--muted); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  position: relative;
  font-family: inherit;
  transition: background .16s ease, color .16s ease;
}
.nav-item .nav-ico { font-size: 17px; opacity: .5; line-height: 1; }
.nav-item:hover { background: rgba(255, 255, 255, .04); }
.nav-item.on { background: rgba(53, 214, 192, .12); color: #7fe9da; }
.nav-item.on .nav-ico { opacity: 1; }
.nav-item.on::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  border-radius: 0 3px 3px 0;
  background: #4fd8c4;
}

.nav-foot { margin-top: auto; padding: 8px 6px 2px; }
.nav-foot .mini-legal {
  border-top: none;
  padding: 0;
  text-align: left;
  white-space: normal;
  font-size: 9.5px;
  line-height: 1.6;
}

/* ---------- 视图容器 ---------- */
.views {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  position: relative;
}
.view {
  display: none;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
}
.view.is-on { display: flex; }

#view-stage .stage { flex: 1 1 auto; min-height: 0; }
#view-chat .chat { flex: 1 1 auto; border-left: none; position: relative; }

/* 设置页 */
#view-settings { overflow-y: auto; padding: 22px 26px 36px; }
.page-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 20px;
}
.page-head h2 { font-size: 19px; font-weight: 650; }
.page-head-note { font-size: 11px; color: var(--muted); }
.page-body { max-width: 620px; }
.page-save { margin-top: 24px; }

/* 聊天页里的角色（同一份 DOM 搬过来） */
.chat-pet {
  position: absolute;
  right: 20px;
  bottom: 4px;
  width: 190px;
  height: 238px;
  pointer-events: none;
  z-index: 3;
}
.chat-pet .char-stage { padding-bottom: 0; }
.chat-pet .char-stage::before { display: none; }
.chat-pet .char-crop { height: 100%; }

/* ---------- 手机：导航挪到底部 ---------- */
@media (max-width: 860px) {
  .app { flex-direction: column-reverse; }

  .nav {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 0;
    padding: 0 0 env(safe-area-inset-bottom);
    border-right: none;
    border-top: 1px solid var(--line);
  }
  .nav-brand, .nav-foot { display: none; }
  .nav-item {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 9px 0 7px;
    border-radius: 0;
    font-size: 10.5px;
    text-align: center;
  }
  .nav-item .nav-ico { font-size: 19px; }
  .nav-item.on { background: transparent; }
  .nav-item.on::before {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 26px;
    height: 2px;
    border-radius: 0 0 2px 2px;
  }

  #view-settings { padding: 16px 14px 28px; }
  .chat-pet { width: 148px; height: 185px; right: 6px; bottom: 2px; }
}

/* 整屏鱼缸里角色别太大：60% 在窄条里合适，在整屏里会顶满 */
#view-stage .char-crop { height: 46%; }

/* 聊天正文区：消息滚动，角色浮在上面不挡输入框 */
.chat-body {
  flex: 1 1 auto;
  min-height: 0;
  position: relative;
  display: flex;
}
.chat-body .messages { flex: 1 1 auto; min-height: 0; }

/* 设置页：分组之间要有呼吸，弹窗里靠 modal-body 的 padding，页面里得自己给 */
#view-settings .field-group { margin-bottom: 24px; }
#view-settings .field-group:last-of-type { margin-bottom: 0; }
#view-settings .field-label { display: block; margin-bottom: 7px; }

/* 宽屏上消息列别拉满，居中更好看，也不会钻到角色底下 */
@media (min-width: 861px) {
  .chat-body { justify-content: center; }
  .chat-body .messages { max-width: 860px; width: 100%; }
  #view-settings .page-body { max-width: 680px; }
}

/* 输入框两端对齐上面的消息列（背景和分割线仍然通栏） */
@media (min-width: 861px) {
  .composer {
    padding-left: max(34px, calc((100% - 860px) / 2));
    padding-right: max(34px, calc((100% - 860px) / 2));
  }
}

/* 角色显示尺寸：素材只有 640 宽，放太大会糊。
   手机上 34%（约 287px），桌面上 40% */
#view-stage .char-crop { height: 34%; }
@media (min-width: 861px) {
  #view-stage .char-crop { height: 40%; }
}

/* 点了动作之后不要冒出一个亮边框，只换文字色 + 淡淡底色 */
.act {
  -webkit-tap-highlight-color: transparent;
}
.act:focus { outline: none; }
.act.is-playing {
  border-color: var(--line);
  background: rgba(53, 214, 192, .16);
  color: var(--accent);
}

/* ============================================================
   起始页（接住第一次点击，解锁声音权限）
   ============================================================ */
.intro {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 70% 50% at 50% 38%, rgba(30, 90, 120, .35), transparent 70%),
    linear-gradient(180deg, #071a26, #04101a 60%, #020a11);
  transition: opacity .45s ease;
  cursor: pointer;
}
.intro.is-gone { opacity: 0; pointer-events: none; }

.intro-glow {
  position: absolute;
  width: min(520px, 120vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(72, 190, 220, .22), transparent 65%);
  filter: blur(30px);
  animation: introPulse 5s ease-in-out infinite;
}
@keyframes introPulse {
  0%, 100% { transform: scale(1); opacity: .75; }
  50% { transform: scale(1.08); opacity: 1; }
}

.intro-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 24px;
  animation: introIn .7s cubic-bezier(.2, .8, .3, 1) both;
}
@keyframes introIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.intro-avatar {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(140, 220, 255, .35);
  box-shadow: 0 16px 46px rgba(0, 0, 0, .55), 0 0 0 6px rgba(72, 190, 220, .08);
  margin-bottom: 20px;
}
.intro-name {
  font-size: 26px;
  font-weight: 680;
  letter-spacing: 1px;
  color: #eaf6fc;
}
.intro-sub {
  margin-top: 8px;
  font-size: 13px;
  color: #8fb0c4;
  letter-spacing: .4px;
}
.intro-enter {
  margin-top: 34px;
  padding: 14px 42px;
  border-radius: 999px;
  border: 1px solid rgba(53, 214, 192, .45);
  background: rgba(53, 214, 192, .14);
  color: #c9f7ee;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: 1px;
  animation: introBreath 2.6s ease-in-out infinite;
}
@keyframes introBreath {
  0%, 100% { box-shadow: 0 0 0 0 rgba(53, 214, 192, .22); }
  50% { box-shadow: 0 0 0 10px rgba(53, 214, 192, 0); }
}
.intro-legal {
  margin-top: 30px;
  font-size: 10.5px;
  line-height: 1.7;
  color: rgba(150, 175, 192, .55);
  max-width: 300px;
}

/* 起始页必须在开屏页之上（.splash 是 400） */
.intro { z-index: 500; }

/* 起始页两个入口：有声 / 静音 */
.intro-actions {
  display: flex;
  gap: 10px;
  margin-top: 34px;
  flex-wrap: wrap;
  justify-content: center;
}
.intro-btn {
  padding: 13px 26px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .05);
  color: #cfe2ee;
  font-size: 14px;
  font-family: inherit;
  letter-spacing: .5px;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .12s ease;
}
.intro-btn:active { transform: scale(.97); }
.intro-btn.primary {
  border-color: rgba(53, 214, 192, .5);
  background: rgba(53, 214, 192, .16);
  color: #c9f7ee;
  animation: introBreath 2.6s ease-in-out infinite;
}
.intro-btn.primary:hover { background: rgba(53, 214, 192, .24); }
.intro-btn:hover { border-color: rgba(255, 255, 255, .32); }

/* 聊天页：角色不能被拖到内容区外面（不然会跑到左侧导航底下）
   拖动时先裁掉溢出部分，松手时会自动推回可见范围 */
#view-chat { overflow: hidden; }
