/* ============================================================
   闁告劕鍚嬪Σ锕€霉?鐠?濮掓稑瀚〒銈嗙▕鐎ｎ喚鎼?闁炽儲鏌￠埀?AI 闁轰焦婢橀悺褎绂?   閻熸瑥妫滈～搴ㄦ晬濮橆厾绠掗柤瑙勫絻閻秵锛?/ 闁哄棙鐗曢崢?/ 闁哄唲鍛季闁?/ 闁哄牐浜悥鐐寸▔鎼淬劌绗夐梺?   ============================================================ */

:root {
  --ink: #0d0b09;
  --ink-2: #16120f;
  --ink-3: #1e1813;
  --paper: #efe3cb;
  --paper-dim: #c9b695;
  --muted: #94836b;
  --gold: #c9a86a;
  --gold-soft: rgba(201, 168, 106, .28);
  --red: #b6402b;
  --red-bright: #cd5539;
  --serif: "Songti SC", "STSong", "STZhongsong", "SimSun", "Noto Serif SC", serif;
  --kai: "Kaiti SC", "STKaiti", "KaiTi", "FangSong", "STFangsong", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; }
::selection { background: rgba(182, 64, 43, .55); color: #fff4e2; }

:focus-visible {
  outline: 2px solid rgba(205, 85, 57, .85);
  outline-offset: 3px;
}

/* ---------- 闁煎啿鏈▍?---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1100px 780px at 20% 24%, rgba(190, 138, 74, .10), transparent 62%),
    radial-gradient(900px 700px at 86% 82%, rgba(126, 43, 27, .10), transparent 66%),
    linear-gradient(180deg, #0f0c09 0%, #0b0907 60%, #0d0b09 100%);
}

.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(201, 168, 106, .035) 0 1px,
    transparent 1px 34px
  );
  mask-image: radial-gradient(120% 90% at 40% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(120% 90% at 40% 30%, #000 0%, transparent 78%);
  opacity: .7;
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: opacity;
}
.glow-a {
  width: 56vw; height: 56vw;
  left: -8vw; top: -10vw;
  background: radial-gradient(circle, rgba(201, 158, 92, .13), transparent 65%);
  animation: glowDrift 18s ease-in-out infinite alternate;
}
.glow-b {
  width: 42vw; height: 42vw;
  right: -6vw; bottom: -12vw;
  background: radial-gradient(circle, rgba(150, 52, 32, .12), transparent 66%);
  animation: glowDrift 24s ease-in-out infinite alternate-reverse;
}

.notes .note {
  position: absolute;
  color: rgba(201, 168, 106, .30);
  font-family: var(--serif);
  line-height: 1;
  animation: drift var(--dur, 26s) linear infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

.grain {
  position: absolute;
  inset: -50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E");
  opacity: .05;
  mix-blend-mode: overlay;
}

/* ---------- 濡ょ姰鍔嶉悘?---------- */

.app {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 620px;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(20px, 4vw, 54px);
  border-bottom: 1px solid rgba(201, 168, 106, .10);
  background: linear-gradient(180deg, rgba(13, 11, 9, .92), rgba(13, 11, 9, .38));
  backdrop-filter: blur(10px);
  animation: fadeDown .8s var(--ease) both;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.seal {
  width: 44px; height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  writing-mode: vertical-rl;
  font-family: var(--kai);
  font-size: 15px;
  line-height: 1.02;
  letter-spacing: .04em;
  color: #f8e9cf;
  background: linear-gradient(145deg, #bd4530, #8d2a1b);
  border-radius: 4px;
  box-shadow:
    inset 0 0 0 1px rgba(255, 240, 214, .30),
    inset 0 0 12px rgba(60, 10, 4, .35),
    0 5px 16px rgba(120, 30, 18, .35);
  transform: rotate(-2.5deg);
}

.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .12em;
  color: #f2e6cf;
  white-space: nowrap;
}
.brand-text h1 .dot { margin: 0 .42em; color: var(--gold); font-weight: 400; }
.brand-text h1 em {
  font-style: normal;
  font-size: .82em;
  color: var(--gold);
  letter-spacing: .18em;
}
.brand-text p {
  margin: 4px 0 0;
  font-size: 10.5px;
  letter-spacing: .22em;
  color: var(--muted);
  white-space: nowrap;
}

.tools { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border: 1px solid rgba(201, 168, 106, .20);
  border-radius: 999px;
  font-size: 11.5px;
  letter-spacing: .08em;
  color: var(--paper-dim);
  background: rgba(255, 255, 255, .015);
  transition: color .2s, border-color .2s, background .2s, transform .2s;
}
.tool svg { opacity: .8; }
.tool:hover {
  color: #f4e7cd;
  border-color: rgba(201, 168, 106, .48);
  background: rgba(201, 168, 106, .07);
  transform: translateY(-1px);
}
.tool.on {
  color: #f3dfb8;
  border-color: rgba(201, 168, 106, .46);
  background: rgba(201, 168, 106, .09);
}
.tool.muted { color: var(--muted); border-color: rgba(201, 168, 106, .12); }
.tool.muted svg { opacity: .4; }
.tool.muted .tool-label { opacity: .65; }

/* ---------- 濞戞捁顕х粩椋庝沪閳?---------- */

.layout {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1420px;
  min-height: 0;
  margin: 0 auto;
  padding: clamp(18px, 3.2vh, 38px) clamp(20px, 4vw, 54px) clamp(18px, 3vh, 32px);
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(430px, 1.1fr);
  gap: clamp(26px, 4vw, 64px);
  align-items: stretch;
}

/* ---------- 鐎归潻缂氶弲鍫曟晬濮橆厽娈堕悗娑欍仦濮?---------- */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.6vh, 26px);
  min-height: 0;
  animation: fadeUp .9s .12s var(--ease) both;
}

.stage-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 0;
}

.halo {
  position: absolute;
  left: 50%;
  top: 46%;
  width: min(620px, 54vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(214, 170, 104, .19), rgba(214, 170, 104, .05) 44%, transparent 68%);
  filter: blur(18px);
  pointer-events: none;
  animation: haloPulse 9s ease-in-out infinite;
}

.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 clamp(8px, 1.4vh, 14px);
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: .42em;
  color: rgba(201, 168, 106, .72);
  text-indent: .42em;
  white-space: nowrap;
}
.kicker span {
  display: block;
  width: 34px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201, 168, 106, .48));
}
.kicker span:last-child {
  background: linear-gradient(90deg, rgba(201, 168, 106, .48), transparent);
}

.portrait-shell {
  --pw: clamp(210px, min(29vw, 40vh), 392px);
  position: relative;
  width: var(--pw);
  aspect-ratio: 4 / 5;
  border-radius: 999px 999px 16px 16px;
  transform-style: preserve-3d;
  transform:
    perspective(1000px)
    rotateY(calc(var(--mx, 0) * 3.2deg))
    rotateX(calc(var(--my, 0) * -2.6deg));
  transition: transform .5s var(--ease);
  will-change: transform;
}

.portrait {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  --open: 0;
  background: #191410;
  box-shadow:
    0 34px 70px -24px rgba(0, 0, 0, .92),
    0 0 0 1px rgba(201, 168, 106, .24),
    0 0 46px rgba(201, 158, 92, .10),
    inset 0 0 70px rgba(0, 0, 0, .55);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 26%;
  filter: sepia(.44) saturate(.82) contrast(1.06) brightness(.93);
  transform: scale(1.015);
  animation: breathe 13s ease-in-out infinite;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity .45s ease;
}

/* 预渲染整脸口型视频：与照片同一裁切与色调，播放时替换静帧 */
.portrait-video {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 26%;
  filter: sepia(.5) saturate(.8) contrast(1.08) brightness(.87);
  transform: scale(1.015);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .45s ease;
  background: #191410;
}
.portrait.is-video .portrait-video { opacity: 1; visibility: visible; }
.portrait.is-video img { opacity: 0; }
.portrait.is-video .mouth-rig { display: none; }

.portrait::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(255, 238, 205, .16);
  border-radius: 999px 999px 9px 9px;
  pointer-events: none;
  z-index: 2;
}

/* ---------- 鍙ｅ瀷锛氬彔鍦ㄧ収鐗囦笂鐨勪竴灞傚井鍨嬪紑鍙ｏ紝涓嶄笂绉诲儚绱?---------- */
.mouth-rig {
  position: absolute;
  left: 0;
  top: 0;
  width: 90px;
  height: 44px;
  pointer-events: none;
  opacity: 0;
  z-index: 1;
  transform: scale(1.015);
  animation: breathe 13s ease-in-out infinite;
  transition: opacity .25s linear;
}
.mouth-rig.is-on { opacity: 1; }
.m-gap {
  position: absolute;
  left: 20%;
  width: 60%;
  top: 45%;
  height: 22%;
  transform-origin: 50% 6%;
  transform: scaleY(calc(0.05 + var(--open) * 0.95));
  border-radius: 50% 50% 46% 46% / 92% 92% 8% 8%;
  background:
    linear-gradient(to bottom, rgba(250, 241, 223, .32) 0%, rgba(196, 164, 120, .18) 22%, rgba(30, 15, 8, .88) 36%, rgba(16, 8, 4, .92) 70%, rgba(22, 11, 6, .8) 100%);
  box-shadow:
    inset 0 1px 2px -1px rgba(0, 0, 0, .7),
    inset 0 -2px 2px -1px rgba(255, 226, 183, .28);
  opacity: calc(var(--open) * 1.05);
  filter: blur(.3px);
}
@media (prefers-reduced-motion: reduce) { .mouth-rig { animation: none; } }
.portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(62% 40% at 50% 16%, rgba(255, 219, 160, .16), transparent 72%),
    radial-gradient(ellipse at 50% 42%, transparent 52%, rgba(11, 8, 5, .62) 100%),
    linear-gradient(180deg, rgba(60, 34, 14, .04) 0%, transparent 42%, rgba(13, 10, 7, .50) 100%);
  z-index: 1;
}

.portrait-light {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(52% 38% at 50% 42%, rgba(255, 214, 150, .30), transparent 70%);
  mix-blend-mode: screen;
  transition: opacity .55s;
}
body.speaking .portrait-light {
  opacity: 1;
  animation: lightBreathe 2.6s ease-in-out infinite;
}

.portrait-seal {
  position: absolute;
  right: -14px;
  bottom: 30px;
  z-index: 4;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  writing-mode: vertical-rl;
  font-family: var(--kai);
  font-size: 14px;
  line-height: 1.04;
  letter-spacing: .04em;
  color: #f8e9cf;
  background: linear-gradient(150deg, #bb4530, #8b2a1b);
  border-radius: 3px;
  transform: rotate(4deg);
  box-shadow:
    inset 0 0 0 1px rgba(255, 240, 214, .26),
    0 8px 20px -6px rgba(0, 0, 0, .7);
  opacity: .92;
}

.portrait-shell::before {
  content: "";
  position: absolute;
  inset: -11px;
  border: 1px solid rgba(201, 168, 106, .26);
  border-radius: 999px 999px 26px 26px;
  pointer-events: none;
}
.portrait-shell::after {
  content: "";
  position: absolute;
  inset: -20px;
  border: 1px solid rgba(201, 168, 106, .09);
  border-radius: 999px 999px 34px 34px;
  pointer-events: none;
}

.speaking-ring {
  position: absolute;
  inset: -30px;
  z-index: 0;
  border: 1px solid rgba(205, 85, 57, 0);
  border-radius: 999px 999px 40px 40px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
}
body.speaking .speaking-ring {
  opacity: 1;
  border-color: rgba(205, 85, 57, .16);
  animation: ring 2.8s ease-out infinite;
}

.caption {
  position: relative;
  margin-top: clamp(14px, 2.4vh, 24px);
  text-align: center;
  max-width: min(460px, 92%);
}

.cap-name {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(24px, 2.5vw, 31px);
  font-weight: 600;
  letter-spacing: .26em;
  text-indent: .26em;
  color: #f4e7cf;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .6);
}
.cap-meta {
  margin: 6px 0 0;
  font-size: 10px;
  letter-spacing: .26em;
  color: var(--muted);
  text-indent: .26em;
}
.cap-quote {
  margin: 12px 0 0;
  font-family: var(--kai);
  font-size: 12.5px;
  line-height: 1.85;
  letter-spacing: .06em;
  color: rgba(201, 168, 106, .86);
  transition: opacity .35s, transform .35s;
}
.cap-live {
  position: absolute;
  left: 50%;
  width: min(100%, 420px);
  transform: translate(-50%, 6px);
  top: 60px;
  margin: 0;
  padding: 0 14px;
  font-family: var(--kai);
  font-size: 12.5px;
  line-height: 1.85;
  letter-spacing: .05em;
  text-align: center;
  color: #eedfc4;
  opacity: 0;
  transition: opacity .4s, transform .4s;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  pointer-events: none;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .85);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.caption.is-live .cap-quote { opacity: 0; transform: translateY(-4px); }
.caption.is-live .cap-live { opacity: 1; transform: translate(-50%, 0); }

.viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 24px;
  width: min(240px, 56%);
  margin-top: clamp(8px, 1.4vh, 14px);
  opacity: 0;
  transition: opacity .4s;
}
.viz i {
  width: 2px;
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(180deg, #e6c691, #b6402b);
  opacity: .72;
  transition: height .35s var(--ease);
}
body.speaking .viz { opacity: 1; }
body.speaking .viz i {
  height: var(--h, 40%);
  animation: level var(--d, .8s) ease-in-out infinite alternate;
  animation-delay: var(--delay, 0s);
}

/* 妤犵偟顥愰妴?*/
.timeline {
  display: flex;
  width: min(100%, 470px);
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(201, 168, 106, .16);
}
.timeline li { flex: 1 1 0; min-width: 0; }

.timeline button {
  position: relative;
  width: 100%;
  padding: 13px 4px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  transition: color .2s;
}
.timeline button::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: rgba(201, 168, 106, .34);
  transition: background .2s, box-shadow .2s, transform .2s;
}
.timeline .yr {
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: .06em;
  color: rgba(201, 168, 106, .82);
  transition: color .2s;
}
.timeline .lb {
  font-size: 9.5px;
  letter-spacing: .08em;
  white-space: nowrap;
}
.timeline button:hover { color: var(--paper); }
.timeline button:hover::before {
  background: var(--red-bright);
  box-shadow: 0 0 10px rgba(205, 85, 57, .8);
  transform: scale(1.4);
}
.timeline button:hover .yr { color: #f2dfb6; }

/* ---------- 闁告瑥鍘栭弲鍫曟晬濮橆剦鍤犻悹?---------- */

.chat {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid rgba(201, 168, 106, .16);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(32, 25, 20, .88) 0%, rgba(19, 15, 12, .92) 100%);
  box-shadow:
    0 44px 90px -46px rgba(0, 0, 0, 1),
    inset 0 1px 0 rgba(255, 245, 225, .045);
  backdrop-filter: blur(12px);
  overflow: hidden;
  animation: fadeUp .9s .24s var(--ease) both;
}
.chat::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(120% 70% at 18% 0%, rgba(201, 168, 106, .055), transparent 52%);
}

/* 亲口讲述：三条预渲染片段 */
.clips {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px clamp(16px, 2.2vw, 24px);
  border-bottom: 1px solid rgba(201, 168, 106, .09);
  background: linear-gradient(180deg, rgba(201, 168, 106, .04), transparent);
}
.clips-label {
  font-size: 10px;
  letter-spacing: .2em;
  color: rgba(201, 168, 106, .58);
  white-space: nowrap;
}
.clip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(201, 168, 106, .26);
  background: rgba(255, 235, 205, .03);
  color: rgba(239, 227, 203, .82);
  font-family: inherit;
  font-size: 11.5px;
  letter-spacing: .04em;
  cursor: pointer;
  transition: border-color .25s, background .25s, color .25s;
}
.clip:hover {
  border-color: rgba(201, 168, 106, .55);
  background: rgba(201, 168, 106, .10);
  color: var(--paper);
}
.clip.is-on {
  border-color: rgba(201, 168, 106, .75);
  background: rgba(201, 168, 106, .16);
  color: var(--gold);
}
.clip svg { opacity: .8; }
.clips-note {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: .07em;
  color: rgba(239, 227, 203, .32);
  white-space: nowrap;
}
.clip-tag {
  margin-top: 10px;
  font-size: 10.5px;
  letter-spacing: .04em;
  color: rgba(201, 168, 106, .55);
}

.chat-head {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px clamp(16px, 2.2vw, 24px) 15px;
  border-bottom: 1px solid rgba(201, 168, 106, .11);
}
.chat-title h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18.5px;
  font-weight: 600;
  letter-spacing: .16em;
  color: #f3e6cd;
}
.chat-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--muted);
}
.live-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #7fa86b;
  box-shadow: 0 0 8px rgba(127, 168, 107, .9);
  animation: dotPulse 2.6s ease-in-out infinite;
}
.dot-sep { opacity: .5; }

.chat-side { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

.chat-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
  opacity: .5;
}
.chat-wave i {
  width: 2px;
  height: 4px;
  border-radius: 2px;
  background: var(--gold);
  transition: height .3s;
}
body.speaking .chat-wave { opacity: 1; }
body.speaking .chat-wave i {
  animation: level .82s ease-in-out infinite alternate;
}
.chat-wave i:nth-child(2) { animation-delay: .12s; }
.chat-wave i:nth-child(3) { animation-delay: .24s; }
.chat-wave i:nth-child(4) { animation-delay: .36s; }
.chat-wave i:nth-child(5) { animation-delay: .48s; }

.stop-btn {
  font-size: 10.5px;
  letter-spacing: .1em;
  color: var(--paper-dim);
  border: 1px solid rgba(205, 85, 57, .35);
  background: rgba(205, 85, 57, .08);
  border-radius: 999px;
  padding: 5px 11px;
  transition: .2s;
}
.stop-btn:hover { color: #ffe9d2; background: rgba(205, 85, 57, .18); }

.messages {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(16px, 2.4vh, 24px) clamp(16px, 2.2vw, 24px) 40px;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2.2vh, 22px);
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 168, 106, .22) transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 26px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 26px), transparent 100%);
}
.messages::-webkit-scrollbar { width: 6px; }
.messages::-webkit-scrollbar-track { background: transparent; }
.messages::-webkit-scrollbar-thumb {
  background: rgba(201, 168, 106, .18);
  border-radius: 3px;
}

.msg {
  display: flex;
  gap: 11px;
  animation: msgIn .5s var(--ease) both;
}
.msg-u {
  justify-content: flex-end;
  padding-left: 12%;
}

.avatar-sm {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-family: var(--kai);
  font-size: 14px;
  color: #f8e9cf;
  background: linear-gradient(150deg, #b6402b, #83271a);
  box-shadow:
    inset 0 0 0 1px rgba(255, 240, 214, .24),
    0 4px 12px -3px rgba(0, 0, 0, .6);
  transform: rotate(-2deg);
  user-select: none;
}

.bubble { min-width: 0; max-width: 100%; }

.msg-a .bubble { flex: 1 1 auto; }

.who {
  margin-bottom: 5px;
  font-family: var(--serif);
  font-size: 10px;
  letter-spacing: .26em;
  color: rgba(201, 168, 106, .8);
}

.text {
  font-size: 14.5px;
  line-height: 1.92;
  letter-spacing: .012em;
  color: #e9dcc3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-a .text { color: #e9dcc3; }
.msg-u .text { color: #f6ead3; }

.msg-u .bubble {
  padding: 10px 15px;
  border-radius: 14px 14px 4px 14px;
  background: linear-gradient(150deg, rgba(201, 168, 106, .16), rgba(201, 168, 106, .07));
  border: 1px solid rgba(201, 168, 106, .2);
  box-shadow: 0 8px 20px -14px rgba(0, 0, 0, .8);
}
.msg-u .text { font-size: 14px; line-height: 1.75; }

/* ---------- 家书卡片 ---------- */
.letter {
  position: relative;
  margin: 2px 0 4px 46px;
  padding: 20px 22px 16px;
  border-radius: 4px 14px 14px 14px;
  background:
    radial-gradient(ellipse at 18% 0%, rgba(233, 214, 178, .12), transparent 62%),
    linear-gradient(165deg, rgba(58, 45, 31, .92), rgba(34, 26, 18, .96));
  border: 1px solid rgba(201, 168, 106, .26);
  border-left: 2px solid rgba(201, 168, 106, .5);
  box-shadow: 0 18px 40px -28px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 240, 210, .06);
  animation: rise .5s cubic-bezier(.2, .7, .3, 1) both;
}
.letter::after {
  content: "";
  position: absolute;
  inset: 6px 6px auto auto;
  width: 26px;
  height: 26px;
  border-top: 1px solid rgba(201, 168, 106, .3);
  border-right: 1px solid rgba(201, 168, 106, .3);
  border-radius: 0 3px 0 0;
  pointer-events: none;
}
.letter-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 14px;
}
.letter-title {
  font-family: var(--kai);
  font-size: 17px;
  letter-spacing: .18em;
  color: #f0ddb6;
}
.letter-meta {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .14em;
  color: rgba(201, 168, 106, .72);
}
.letter-body p {
  margin: 0 0 11px;
  font-family: var(--kai);
  font-size: 14.5px;
  line-height: 1.95;
  letter-spacing: .015em;
  color: #e6d5b6;
  text-indent: 1.4em;
}
.letter-body p:last-child { margin-bottom: 2px; }
.letter-body .letter-salute { text-indent: 0; font-size: 16px; color: #f2e2c2; letter-spacing: .1em; }
.letter-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(201, 168, 106, .16);
}
.letter-read {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(201, 168, 106, .38);
  background: rgba(201, 168, 106, .1);
  color: #f0ddb6;
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .1em;
  cursor: pointer;
  transition: background .25s ease, border-color .25s ease, color .25s ease;
}
.letter-read:hover { background: rgba(201, 168, 106, .2); border-color: rgba(201, 168, 106, .6); }
.letter-read:focus-visible { outline: 2px solid rgba(201, 168, 106, .7); outline-offset: 3px; }
.letter-hint {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .08em;
  color: rgba(233, 214, 178, .42);
}
@media (max-width: 640px) {
  .letter { margin-left: 0; padding: 16px 16px 14px; }
  .letter-body p { font-size: 14px; line-height: 1.9; }
}

.caret {
  display: inline-block;
  width: 1px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -.14em;
  background: var(--gold);
  animation: caretBlink .9s steps(1) infinite;
}

.dots { display: inline-flex; gap: 4px; padding: 6px 0; }
.dots i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold);
  opacity: .3;
  animation: dotBounce 1.2s infinite;
}
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }

.suggest-wrap {
  position: relative;
  flex: 0 0 auto;
  padding: 6px clamp(12px, 2vw, 22px) 2px;
}
.suggest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding: 0 2px;
  font-size: 9.5px;
  letter-spacing: .2em;
  color: rgba(148, 131, 107, .85);
}
.shuffle {
  font-size: 10px;
  letter-spacing: .08em;
  color: rgba(201, 168, 106, .72);
  padding: 3px 2px;
  transition: color .2s;
}
.shuffle:hover { color: #f1ddb6; }

.suggests {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 34px;
}

.chip {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid rgba(201, 168, 106, .19);
  border-radius: 999px;
  background: rgba(201, 168, 106, .035);
  color: var(--paper-dim);
  font-size: 12px;
  letter-spacing: .01em;
  text-align: left;
  transition: color .18s, border-color .18s, background .18s, transform .18s;
  animation: chipIn .4s var(--ease) both;
}
.chip::before {
  content: "";
  flex: 0 0 auto;
  width: 4px; height: 4px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--red-bright);
  opacity: .8;
}
.chip:hover {
  color: #f7ecd7;
  border-color: rgba(201, 168, 106, .48);
  background: rgba(201, 168, 106, .09);
  transform: translateY(-1px);
}

.composer {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 10px clamp(12px, 2vw, 20px) 0;
  padding: 8px 9px 8px 15px;
  border: 1px solid rgba(201, 168, 106, .18);
  border-radius: 15px;
  background: rgba(0, 0, 0, .3);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.composer:focus-within {
  border-color: rgba(201, 168, 106, .46);
  background: rgba(0, 0, 0, .38);
  box-shadow: 0 0 0 3px rgba(201, 168, 106, .055);
}

#input {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 118px;
  padding: 8px 0 6px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: #f4e8d0;
  font-size: 14px;
  line-height: 1.6;
  caret-color: var(--gold);
}
#input::placeholder { color: rgba(148, 131, 107, .72); }

.send {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffe9d2;
  background: linear-gradient(150deg, #c64d33, #962f1e);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 210, .25),
    0 8px 20px -8px rgba(198, 77, 51, .85);
  transition: transform .18s, filter .18s, opacity .18s;
}
.send:hover { transform: translateY(-1px); filter: brightness(1.08); }
.send:active { transform: translateY(0); }
.send:disabled { opacity: .38; cursor: default; transform: none; filter: none; }

.fineprint {
  flex: 0 0 auto;
  margin: 0;
  padding: 10px clamp(16px, 2.2vw, 24px) 14px;
  font-size: 9.5px;
  line-height: 1.65;
  letter-spacing: .02em;
  color: rgba(148, 131, 107, .72);
}

/* ---------- 婵☆垪鍓濋埀?---------- */

.modal {
  width: min(560px, calc(100vw - 36px));
  max-height: min(92vh, 860px);
  padding: 0;
  border: 1px solid rgba(201, 168, 106, .26);
  border-radius: 18px;
  color: var(--paper);
  background:
    radial-gradient(120% 60% at 20% 0%, rgba(201, 168, 106, .07), transparent 60%),
    #17120e;
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, .9);
  overflow: hidden;
}
/* 鎵撳紑鏃剁敤绾靛悜 flex锛氭爣棰樺浐瀹氥€佸唴瀹规粴鍔ㄣ€佹寜閽父椹诲簳閮?*/
.modal[open] { display: flex; flex-direction: column; }
.modal::backdrop {
  background: rgba(5, 4, 3, .74);
  backdrop-filter: blur(5px);
}
.modal[open] { animation: modalIn .35s var(--ease) both; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px 12px;
  border-bottom: 1px solid rgba(201, 168, 106, .12);
}
.modal-head h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: .1em;
  color: #f3e6cd;
}
.optional {
  margin-left: 6px;
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: .16em;
  color: var(--gold);
  border: 1px solid rgba(201, 168, 106, .3);
  border-radius: 999px;
  padding: 2px 7px;
  vertical-align: 2px;
}
.modal-x {
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  transition: .2s;
}
.modal-x:hover { color: var(--paper); background: rgba(255, 255, 255, .05); }

.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 16px 24px 18px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.85;
  color: #d9cab0;
  scrollbar-width: thin;
}
.modal-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px 18px;
  border-top: 1px solid rgba(201, 168, 106, .12);
  background: #17120e;
}
.modal-lead {
  margin: 0 0 18px;
  font-family: var(--kai);
  font-size: 14px;
  line-height: 1.9;
  color: #eadcc1;
}
.modal-body h4 {
  margin: 20px 0 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2em;
  color: var(--gold);
}
.modal-body p { margin: 0 0 10px; }
.modal-foot {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid rgba(201, 168, 106, .12);
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--muted);
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 18px;
  font-size: 13px;
  color: #e9dcc3;
  cursor: pointer;
  user-select: none;
}
.switch input {
  appearance: none;
  -webkit-appearance: none;
  width: 36px;
  height: 20px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid rgba(201, 168, 106, .3);
  background: rgba(0, 0, 0, .32);
  position: relative;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.switch input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #8d7c63;
  transition: transform .2s var(--ease), background .2s;
}
.switch input:checked {
  background: rgba(182, 64, 43, .75);
  border-color: rgba(205, 85, 57, .55);
}
.switch input:checked::after { transform: translateX(16px); background: #ffe7c8; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 11px; }
.field label {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--gold);
}
.field input {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid rgba(201, 168, 106, .2);
  border-radius: 8px;
  background: rgba(0, 0, 0, .3);
  color: var(--paper);
  font-size: 12.5px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus {
  border-color: rgba(201, 168, 106, .5);
  box-shadow: 0 0 0 3px rgba(201, 168, 106, .06);
}
.field select {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid rgba(201, 168, 106, .2);
  border-radius: 8px;
  background: rgba(0, 0, 0, .3);
  color: var(--paper);
  font-size: 12.5px;
  font-family: var(--sans);
  outline: none;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.field select:focus {
  border-color: rgba(201, 168, 106, .5);
  box-shadow: 0 0 0 3px rgba(201, 168, 106, .06);
}
.field select option { background: #17120d; color: var(--paper); }

.field .val {
  float: right;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--paper);
  opacity: .8;
  font-variant-numeric: tabular-nums;
}

/* 浣庢矇 / 璇€?婊戝潡锛氱粏杞ㄣ€侀帍閲戞笎灞傘€侀摐閽辩矖缁嗙殑鍦嗛挳 */
.field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 18px;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: pointer;
}
.field input[type="range"]:focus { box-shadow: none; }
.field input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(to right, rgba(182, 64, 43, .65), rgba(201, 168, 106, .6));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
}
.field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  margin-top: -5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9c4, #c9a86a 62%, #8d6f3c);
  border: 1px solid rgba(20, 12, 6, .8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55);
}
.field input[type="range"]::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(to right, rgba(182, 64, 43, .65), rgba(201, 168, 106, .6));
}
.field input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9c4, #c9a86a 62%, #8d6f3c);
  border: 1px solid rgba(20, 12, 6, .8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .55);
}

.setting-group + .setting-group {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(201, 168, 106, .14);
}
.group-head {
  margin-bottom: 12px;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: .16em;
  color: #f0e2c8;
}
.group-head .optional { vertical-align: 3px; }
.note {
  margin: 4px 0 18px;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--muted);
}

.actions { display: flex; align-items: center; gap: 10px; }
.btn-primary, .btn-ghost {
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: .1em;
  transition: .2s;
}
.btn-primary {
  color: #ffe9d2;
  background: linear-gradient(150deg, #c04a31, #93301f);
  box-shadow: 0 8px 20px -10px rgba(192, 74, 49, .9);
}
.btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost {
  color: var(--paper-dim);
  border: 1px solid rgba(201, 168, 106, .22);
}
.btn-ghost:hover { color: var(--paper); border-color: rgba(201, 168, 106, .45); }

/* ---------- 闁圭粯鍔楅妵?---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 90;
  max-width: calc(100vw - 36px);
  padding: 10px 18px;
  border: 1px solid rgba(201, 168, 106, .3);
  border-radius: 999px;
  background: rgba(28, 22, 17, .96);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .55);
  color: #efe2c9;
  font-size: 12px;
  letter-spacing: .03em;
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity .28s, transform .28s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 闁告柣鍔嶉弲?---------- */

@keyframes fadeDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes msgIn { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes chipIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }

@keyframes breathe {
  0%, 100% { transform: scale(1.015); }
  50% { transform: scale(1.035); }
}
@keyframes haloPulse {
  0%, 100% { opacity: .78; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.045); }
}
@keyframes lightBreathe {
  0%, 100% { opacity: .55; }
  50% { opacity: 1; }
}
@keyframes ring {
  0% { transform: scale(.985); opacity: .9; }
  70% { opacity: .18; }
  100% { transform: scale(1.03); opacity: 0; }
}
@keyframes level {
  0% { height: 3px; }
  100% { height: var(--h, 70%); }
}
@keyframes drift {
  0% { transform: translate3d(0, 18px, 0) rotate(0deg); opacity: 0; }
  12% { opacity: .55; }
  82% { opacity: .35; }
  100% { transform: translate3d(26px, -110px, 0) rotate(14deg); opacity: 0; }
}
@keyframes glowDrift {
  from { opacity: .55; transform: translate3d(0, 0, 0) scale(1); }
  to { opacity: .95; transform: translate3d(4vw, 3vh, 0) scale(1.1); }
}
@keyframes dotPulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes dotBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .3; }
  30% { transform: translateY(-3px); opacity: .95; }
}
@keyframes caretBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* ---------- 闁煎浜埀顒€鍊哥花?---------- */

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: minmax(280px, .78fr) minmax(400px, 1.22fr);
    gap: 30px;
  }
  .portrait-shell { --pw: clamp(200px, min(27vw, 36vh), 330px); }
  .brand-text h1 em { display: none; }
  .brand-text h1 .dot { display: none; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; }
  .layout {
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    gap: 22px;
  }
  .stage { padding-bottom: 4px; }
  .portrait-shell { --pw: clamp(168px, 42vw, 236px); }
  .halo { width: min(460px, 96vw); top: 40%; }
  .cap-quote { display: none; }
  .cap-live {
    position: static;
    width: auto;
    transform: none;
    margin-top: 10px;
    padding: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .caption.is-live .cap-quote { display: none; }
  .caption.is-live .cap-live { transform: none; }
  .viz { margin-top: 8px; height: 20px; }
  .chat {
    min-height: 520px;
    height: min(72vh, 640px);
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .seal { width: 38px; height: 38px; font-size: 13px; }
  .brand-text h1 { font-size: 17px; letter-spacing: .08em; }
  .brand-text p { font-size: 8.5px; letter-spacing: .14em; margin-top: 3px; }
  .tool { padding: 8px; border-radius: 50%; }
  .tool-label { display: none; }
  .layout { padding-left: 14px; padding-right: 14px; }
  .portrait-shell { --pw: min(52vw, 210px); }
  .cap-name { font-size: 23px; }
  .cap-meta { font-size: 9px; letter-spacing: .16em; }
  .timeline .lb { font-size: 8.5px; letter-spacing: .02em; }
  .timeline .yr { font-size: 12px; }
  .chat { height: min(74vh, 600px); min-height: 470px; border-radius: 16px; }
  .chat-head { padding: 14px 16px 12px; }
  .chat-title h2 { font-size: 16px; }
  .chat-sub { font-size: 9px; }
  .messages { padding: 16px 15px 34px; gap: 18px; }
  .text { font-size: 14px; line-height: 1.88; }
  .clips { padding: 9px 15px; gap: 6px; }
  .clips-label { display: none; }
  .clip { flex: 1 1 0; min-width: 0; justify-content: center; padding: 5px 6px; font-size: 11px; }
  .clips-note { display: none; }
  .msg-u { padding-left: 4%; }
  .msg-u .bubble { max-width: 92%; }
  .cap-live { font-size: 12px; }
  .fineprint { font-size: 9px; padding-bottom: 12px; }
  .modal-body { padding: 16px 18px 20px; }
  .modal-head { padding: 16px 18px 12px; }
}

@media (max-height: 760px) and (min-width: 901px) {
  .portrait-shell { --pw: clamp(190px, min(26vw, 34vh), 300px); }
  .cap-quote { display: none; }
  .kicker { margin-bottom: 8px; }
  .viz { margin-top: 8px; height: 18px; }
  .caption { margin-top: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .portrait img { animation: none; }
}

