
/* 按钮重置：iOS 会给没写 background 的 button 画默认灰底和圆角，先全部清成透明 */
button {
  background: none;
  border: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
/* PLAIN-PAPER: 最朴素的信纸气泡，没有焦边 */
@font-face {
  font-family: "LXGW WenKai GB";
  src: url("assets/fonts/LXGWWenKaiGB-Regular.woff2?v=3") format("woff2"), url("assets/fonts/LXGWWenKaiGB-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "LXGW WenKai TC";
  src: url("assets/fonts/LXGWWenKaiTC-Regular.woff2?v=3") format("woff2"), url("assets/fonts/LXGWWenKaiTC-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Cinzel Decorative";
  src: url("assets/fonts/CinzelDecorative.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

/* 照片墙顶栏标题专用真粗体：只作用于标题，不碰别处的 Cinzel */
@font-face {
  font-family: "Cinzel Decorative Bold";
  src: url("assets/fonts/CinzelDecorative-Bold.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: "LXGW WenKai TC", "LXGW WenKai GB", "Noto Serif TC", "Songti TC", "PingFang TC", serif;
  --wine: #3d0814;
  --gold: #b99a5f;
  --cream: #f0e5cf;
  --kraft: #c7a67a;
  --ink: #31251f;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  overflow-x: hidden;
  background: var(--wine);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .12;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.95' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.32'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

button, textarea { font: inherit; }

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  width: 100%;
  max-width: 520px;
  height: 100dvh;
  margin: 0 auto;
  background: transparent;
}

.messages {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: max(28px, env(safe-area-inset-top)) 18px 22px;
  scrollbar-width: none;
}

.messages::-webkit-scrollbar { display: none; }

.empty-state {
  min-height: 100%;
}

.message-row {
  display: flex;
  align-items: flex-start;
  margin: 8px 0;
}

/* 换手的地方拉开：同一人连发保持紧凑 */
.message-row.user + .message-row.assistant,
.message-row.assistant + .message-row.user {
  margin-top: 30px;
}

/* THINKING 是浮在气泡上方的，会吃掉空隙：带思考的行，换手间距要加上那一行的高度 */
.message-row.user + .message-row.assistant.reasoning-margin {
  margin-top: 42px;
}

.message-row.has-time { margin-bottom: 26px; }

.message-row.paragraph-enter {
  animation: paragraph-fade-in .24s ease-out both;
}

@keyframes paragraph-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.message-row.user { justify-content: flex-end; }
.message-row.assistant { justify-content: flex-start; }

.message-avatar {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  overflow: hidden;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: var(--wine);
}

.assistant .message-avatar { margin-right: 8px; }
.user .message-avatar { margin-left: 8px; }

.message-avatar.avatar-placeholder {
  visibility: hidden;
  border-color: transparent;
}

.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bubble {
  position: relative;
  isolation: isolate;
  width: fit-content;
  max-width: 68%;
  padding: 0;
  border: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.62;
  overflow-wrap: anywhere;
  overflow: visible;
}

.user .bubble {
  --glass-top: rgba(240, 229, 207, .74);
  --glass-middle: rgba(225, 207, 178, .46);
  --glass-bottom: rgba(184, 157, 124, .28);
  --edge-top: rgba(125, 99, 68, .95);
  --edge-middle: rgba(94, 68, 45, .88);
  --edge-bottom: rgba(63, 42, 30, .80);
}

.assistant .bubble {
  --glass-top: rgba(199, 166, 122, .72);
  --glass-middle: rgba(177, 140, 96, .44);
  --glass-bottom: rgba(133, 96, 67, .26);
  --edge-top: rgba(118, 82, 48, .92);
  --edge-middle: rgba(88, 58, 34, .82);
  --edge-bottom: rgba(58, 37, 25, .72);
}

.bubble::before,
.bubble::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: 12px;
}

.bubble::before { display: none; }
.bubble::after { display: none; }
.paper-surface {
  position: relative;
  isolation: isolate;
  z-index: 2;
  width: fit-content;
  max-width: 100%;
  padding: 12px 16px;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='.08'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--glass-top) 0%, var(--glass-middle) 50%, var(--glass-bottom) 100%);
  background-blend-mode: soft-light, normal;
}

.paper-surface::before,
.paper-surface::after { display: none; }

.bubble-edge {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.bubble-edge path {
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.bubble-edge .edge-soft {
  stroke-width: 6;
  opacity: .34;
  filter: blur(1.15px);
}

.bubble-edge .edge-core {
  stroke-width: 1.2;
  opacity: .72;
}

.bubble-edge .edge-stop-top { stop-color: var(--edge-top); }
.bubble-edge .edge-stop-middle { stop-color: var(--edge-middle); }
.bubble-edge .edge-stop-bottom { stop-color: var(--edge-bottom); }

.assistant .paper-surface {
  padding-left: 24px;
  border-radius: 0;
}

.user .paper-surface {
  padding-right: 24px;
  border-radius: 0;
}

.assistant .paper-surface.long-bubble {
  --glass-middle: rgba(177, 140, 96, .50);
  --glass-bottom: rgba(133, 96, 67, .34);
  --edge-bottom: rgba(58, 37, 25, .76);
}

.user .paper-surface.long-bubble {
  --glass-middle: rgba(225, 207, 178, .52);
  --glass-bottom: rgba(184, 157, 124, .36);
  --edge-bottom: rgba(63, 42, 30, .84);
}

.paper-surface.single-line {
  min-height: 42px;
  padding-top: 11px;
  padding-bottom: 11px;
}

.paper-surface.single-line .message-content { line-height: 20px; }

.paper-surface.micro-bubble { min-width: 46px; }
.assistant .paper-surface.micro-bubble { padding-left: 14px; padding-right: 10px; }
.user .paper-surface.micro-bubble { padding-left: 10px; padding-right: 14px; }
.paper-surface.micro-bubble .message-content { text-align: center; }
.message-content,
.reasoning {
  position: relative;
  z-index: 1;
}

.message-content {
  white-space: pre-wrap;
}

.message-body {
  position: relative;
  width: fit-content;
  max-width: 100%;
}

.message-time {
  position: absolute;
  top: calc(100% + 6px);
  right: 6px;
  color: var(--cream);
  font-family: "LXGW WenKai TC", serif;
  font-size: 12px;
  line-height: 1;
  text-align: right;
  opacity: .55;
}

.message-time[hidden] { display: none; }

.reasoning {
  margin: 0 0 8px 2px;
  min-width: 0;
  max-width: 100%;
  contain: inline-size;
  overflow-wrap: anywhere;
  color: rgba(232, 218, 190, .80);
  font-size: .875em;
}

.reasoning[hidden] { display: none; }

.reasoning summary {
  display: flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  cursor: pointer;
  list-style: none;
  user-select: none;
  color: #c9a24b;
  font-family: "Cinzel Decorative", "Times New Roman", serif;
  font-size: .74rem;
  line-height: 1.2;
  letter-spacing: .07em;
}

.reasoning summary::-webkit-details-marker { display: none; }

.thinking-star {
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 1;
  transform: translateY(-1.5px);
  transition: opacity .18s ease;
}

.thinking-star path { vector-effect: non-scaling-stroke; }

.reasoning[open] .thinking-star { opacity: 1; }

.reasoning-text {
  padding-top: 5px;
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* 正在打字：三颗点，依次亮过去 */
.bubble.streaming .typing-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.bubble.streaming .typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(201, 162, 75, .8);
  opacity: .22;
  animation: dotWave 1.35s ease-in-out infinite;
}
.bubble.streaming .typing-dots i:nth-child(2) { animation-delay: .18s; }
.bubble.streaming .typing-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes dotWave {
  0%, 70%, 100% { opacity: .22; }
  35% { opacity: .95; }
}

@keyframes blink { 50% { opacity: 0; } }

.composer {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 34px 34px 36px;
  align-items: end;
  gap: 4px;
  margin: 0 10px 4px;
  padding: 7px;
  border: 1px solid rgb(185 154 95 / 65%);
  border-radius: 13px;
  background: rgb(45 5 15 / 82%);
  box-shadow: inset 0 4px 12px rgb(0 0 0 / 24%);
}

textarea {
  width: 100%;
  min-height: 34px;
  max-height: 132px;
  resize: none;
  border: 0;
  outline: 0;
  padding: 6px 8px;
  overflow-y: auto;
  color: #f4e9d4;
  background: transparent;
  line-height: 1.45;
}

textarea::placeholder { color: rgb(244 233 212 / 46%); }

.icon-button {
  display: grid;
  place-items: center;
  background: none;
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #d8c39a;
  background: transparent;
  cursor: pointer;
  font-family: system-ui, sans-serif;
  font-size: 22px;
  line-height: 1;
}

/* iOS 上 hover 会粘住，留下一个淡淡的圆：直接不给 hover 底色 */
.icon-button:hover { background: none; }
.icon-button:active { background: none; }
.icon-button:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.send-button {
  background: transparent;
}

.send-button:not(:disabled) {
  background: transparent;
}

.send-button:disabled { cursor: default; }
.send-button:hover { background: transparent; }

.send-button .tool-icon {
  opacity: .4;
  transition: opacity .16s ease;
}

.send-button:not(:disabled) .tool-icon { opacity: 1; }

.tool-icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-icon path { vector-effect: non-scaling-stroke; }

@media (min-width: 521px) {
  body { background: var(--wine); }
}

@media (max-width: 430px) {
  .composer {
    grid-template-columns: 30px minmax(0, 1fr) 28px 28px 30px;
    gap: 2px;
    margin: 0 6px max(8px, env(safe-area-inset-bottom));
    padding: 6px;
  }
  .messages {
    padding-left: 14px;
    padding-right: 14px;
  }
  .bubble {
    max-width: 68%;
  }
}


/* WATERMARK-START 背景只在内容区里，电脑上两边留空 */
body::after { display: none; }
.app-shell { position: relative; z-index: 1; overflow: hidden; background: #200609; }
.app-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("assets/img/frame-redgold.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
  filter: brightness(.55);
  opacity: 1;
  z-index: 0;
}
.messages, .composer { position: relative; z-index: 1; }
/* WATERMARK-END */









/* MISTY-CARD 雾面卡片：左右略不对称 + 透视模糊 */







/* VAR-START 侧边尾巴 v3 */
/* 尾巴：贴在上缘偏左/偏右，往外上方伸出，底边与气泡同色 */
/* VAR-END */

/* REASONING-OUT 思考移到气泡外：贴在气泡上方，浅色字压在背景上 */
.reasoning {
  margin: 0 0 8px 2px;
  color: rgba(232, 218, 190, .82);
  font-size: .88em;
}
.reasoning summary { color: #c9a24b; }
.reasoning-text {
  padding: 6px 12px 6px 10px;
  border-left: 1px solid rgba(185, 154, 95, .38);
  color: rgba(232, 218, 190, .78);
}
/* REASONING-OUT */








/* 已撤：空气泡隐藏会导致流式渲染异常 */







/* 从 fix.css 并回（原覆盖层，内容并入主文件） */
/* 覆盖用：把气泡恢复成原来那版毛玻璃 */
:root, .user .bubble, .assistant .bubble {
  --glass-top-a: 1;
}
.user .paper-surface { --glass-top: rgba(240, 229, 207, .74); --glass-middle: rgba(225, 207, 178, .46); --glass-bottom: rgba(184, 157, 124, .28); }
.assistant .paper-surface { --glass-top: rgba(199, 166, 122, .72); --glass-middle: rgba(177, 140, 96, .44); --glass-bottom: rgba(133, 96, 67, .26); }
.paper-surface::before {
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='.07'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--glass-top) 0%, var(--glass-middle) 50%, var(--glass-bottom) 100%) !important;
  background-size: auto, auto !important;
  background-attachment: scroll, scroll !important;
  background-blend-mode: soft-light, normal !important;
  filter: none !important;
  transform: none !important;
  opacity: 1 !important;
  -webkit-backdrop-filter: blur(7px) saturate(.82) !important;
  backdrop-filter: blur(7px) saturate(.82) !important;
}
.paper-surface {
  -webkit-backdrop-filter: blur(7px) saturate(.82) !important;
  backdrop-filter: blur(7px) saturate(.82) !important;
}


/* FIX-REASON-W 思考区宽度（曾被误删，这里固定住） */
.reasoning {
  width: min(66vw, 300px) !important;
  max-width: 66vw !important;
  contain: none !important;
}
.reasoning summary {
  white-space: nowrap !important;
  width: max-content !important;
  max-width: 100% !important;
}
.reasoning-text { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ACTIONS 停止键 / 复制 / 重新生成 */
.stop-icon { display: none; }
body.is-generating .plane-icon { display: none; }
body.is-generating .stop-icon { display: block; }

.msg-actions {
  display: flex;
  gap: 3px;               /* 设计稿：两钮之间 3px */
  margin: 4px 0 0 12px;   /* 距气泡左边 12px */
  opacity: .38;
  justify-content: flex-start;
  align-self: flex-start;
}
.user .msg-actions { align-self: flex-end; margin-right: 4px; }
.msg-actions button {
  width: 19px; height: 19px;
  padding: 0;
  border: 0;
  background: none;
  color: #c9a24b;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.msg-actions button svg { width: 13.5px; height: 13.5px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.msg-actions button:active { opacity: .7; }

.copy-toast {
  position: fixed;
  left: 50%; bottom: 96px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(30, 8, 14, .88);
  color: #e6d6b6;
  font-size: 12px;
  opacity: 0;
  transition: opacity .18s;
  pointer-events: none;
  z-index: 50;
}
.copy-toast.show { opacity: 1; }



.copy-popover {
  position: fixed;
  z-index: 60;
  width: 19px;
  height: 19px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c9a24b;
  opacity: .38;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .55));
}
.copy-popover svg { width: 13.5px; height: 13.5px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.copy-popover:active { opacity: .7; }



/* CROP 选图裁剪层 */
.msg-image {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border-radius: 10px;
  margin: 2px 0 6px;
}
.crop-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 2, 6, .92);
  display: flex;
  flex-direction: column;
}
.crop-stage {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
}
.crop-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.crop-rect {
  position: fixed;
  border: 1px solid rgba(201, 162, 75, .9);
  background: rgba(255, 240, 200, .08);
  pointer-events: auto;
  cursor: move;
  z-index: 81;
}
.crop-tip {
  text-align: center;
  color: rgba(230, 214, 182, .62);
  font-size: 12px;
  padding: 6px 0;
}
.crop-bar {
  display: flex;
  gap: 24px;
  justify-content: center;
  padding: 10px 0 max(16px, env(safe-area-inset-bottom));
}
.crop-bar button {
  padding: 9px 22px;
  border: 1px solid rgba(185, 154, 95, .55);
  border-radius: 10px;
  background: transparent;
  color: #d8bd82;
  font-family: "LXGW WenKai TC", serif;
  font-size: 14px;
}

.image-strip {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(64px + env(safe-area-inset-bottom));
  display: flex;
  gap: 8px;
  padding: 6px 0;
  overflow-x: auto;
  z-index: 5;
}
.image-thumb {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.image-thumb-pic {
  width: 56px; height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(185, 154, 95, .45);
}
.image-thumb-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.crop-rect { touch-action: none; }
.crop-handle {
  pointer-events: auto;
  position: absolute;
  width: 14px; height: 14px;
  background: rgba(201, 162, 75, .95);
  border-radius: 50%;
}
.crop-handle.nw { left: -7px; top: -7px; cursor: nwse-resize; }
.crop-handle.ne { right: -7px; top: -7px; cursor: nesw-resize; }
.crop-handle.sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.crop-handle.se { right: -7px; bottom: -7px; cursor: nwse-resize; }



.file-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 2px 0 7px;
  padding: 0 0 5px;
  border-bottom: 1px solid rgba(150, 128, 92, .35);
  color: #43301f;
  font-size: 13px;
  max-width: 100%;
}
.file-icon { display: grid; place-items: center; width: 15px; height: 15px; flex: 0 0 auto; }
.file-icon svg { width: 14px; height: 14px; fill: none; stroke: #6b5333; stroke-width: 1.5; stroke-linejoin: round; }
.file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { flex: 0 0 auto; color: rgba(67, 48, 31, .55); font-size: 12px; }
.message-content strong { font-weight: 700; }
.message-content em { font-style: italic; }
.message-content code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(60, 40, 20, .12);
  font-size: .94em;
}

.local-flag {
  width: 20px; height: 16px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: none;
  color: rgba(210, 190, 155, .40);
  cursor: pointer;
  transition: color .15s;
}
.local-flag svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.local-flag { color: #f0d9a8; }
.local-flag svg .cloud { fill: currentColor; stroke-width: 1.2; }
.local-flag svg .slash { opacity: 0; }
.local-flag.on { color: rgba(240, 217, 168, .30); }


.thumb-del { position: absolute; top: 0; right: 0; width: 18px; height: 18px; border: 0; border-radius: 0 6px 0 6px; background: rgba(20, 6, 10, .78); color: #e6d6b6; font-size: 13px; line-height: 1; cursor: pointer; }






/* 输入框下面的模型 / 思考 */
.chat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -10px 0 max(2px, env(safe-area-inset-bottom));
  line-height: 1;
  padding: 0 14px;
}
.chat-meta button {
  border: 0;
  background: none;
  padding: 0 2px;
  font-family: inherit;
  font-size: 11.5px;
  letter-spacing: .03em;
  color: rgba(238, 228, 208, .38);
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
  cursor: pointer;
}
.chat-meta button:first-child { width: fit-content; }
.chat-meta button:last-child { width: fit-content; }
.chat-meta button:hover { color: rgba(238, 228, 208, .55); }

.meta-sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 86px;
  width: fit-content; min-width: 150px;
  background: rgba(45, 5, 15, .82);
  border: 1px solid rgba(185, 154, 95, .4);
  border-radius: 12px;
  padding: 6px;
  z-index: 40;
}
.meta-sheet div {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: rgba(233, 220, 194, .82);
  cursor: pointer;
}
.meta-sheet div.on { background: rgba(185, 154, 95, .14); color: #e8cd96; }


/* 修正：模型 / 思考 压在底部，输入框留出它的位置 */
.app-shell { grid-template-rows: 1fr auto auto; }
.composer { margin: 0 10px max(30px, calc(env(safe-area-inset-bottom) + 22px)); }
.chat-meta {
  position: relative;
  left: 0;
  right: 0;
  bottom: auto;
  margin: -10px 0 max(2px, env(safe-area-inset-bottom));
  line-height: 1;
  z-index: 2;
  pointer-events: auto;
}
.chat-meta button { pointer-events: auto; }



/* ===== 導航（照 nav-v1 原樣搬過來） ===== */
.nav-edge { position: absolute; left: 0; top: 0; bottom: 0; width: 26px; z-index: 3; pointer-events: auto; cursor: pointer; }
.nav-rail, .nav-sessions {
  position: absolute; top: 0; bottom: 0;
  left: 0;
  width: min(72%, calc(100vh / 2.93));
  background: url("/assets/home/panel-frame-v5-trim.png") center / 100% 100% no-repeat;

  transform: translateX(-102%);
  transition: transform .52s cubic-bezier(.22, .61, .25, 1);
  color: #e8dcc4;
  display: flex; flex-direction: column;
  z-index: 70;
}
.nav-rail::before, .nav-sessions::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(20, 4, 8, .62);
  -webkit-mask: url("/assets/home/panel-mask.png") center / 100% 100% no-repeat;
  mask: url("/assets/home/panel-mask.png") center / 100% 100% no-repeat;
  z-index: 0;
}
.nav-rail > *, .nav-sessions > * { position: relative; z-index: 1; }.nav-rail { padding: 76px 16px 76px 30px; overflow: hidden; }
.nav-sessions {
  /* 装饰是随高度缩放的，边距也要按高度给，不能写死 76px */
  padding: calc(100svh * 0.105) 34px calc(100svh * 0.105) 34px;
  z-index: 71;
  transition-delay: .07s;
}
.nav-rail.open, .nav-sessions.open { transform: translateX(0); }
.nav-rail.gone { transform: translateX(-102%) !important; }

.nav-person { position: relative; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; border: 1px solid transparent; cursor: pointer; font-size: 15px; }
.nav-avatar { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(185, 154, 95, .6); object-fit: cover; }
.nav-add { opacity: .55; padding: 10px; cursor: pointer; }
.nav-plus { width: 28px; height: 28px; border-radius: 50%; border: 1px dashed rgba(185, 154, 95, .6); display: grid; place-items: center; color: #d8bd82; font-size: 15px; }

.nav-fixed { position: absolute; left: 5%; right: 5%; bottom: 118px; padding-top: 12px; border-top: 2px dashed rgba(185, 154, 95, .6); }
.nav-icon { position: absolute; bottom: 46px; transform: translateX(-50%); width: 56px; height: 56px; opacity: .85; cursor: pointer; }
#nav-gallery { left: 23%; }
#nav-settings { left: 75%; }
.wall-glyph { display: block; width: 100%; text-align: center; font-size: 22px; line-height: 56px; color: rgba(232, 218, 190, .82); }
.nav-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }

.nav-head { position: relative; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; min-height: 30px; }
.nav-head h2 { margin: 0; font-size: 15px; font-weight: 400; text-align: center; }
.nav-back, .nav-new { position: absolute; top: 0; border: 0; background: none; color: #e8cd96; width: 30px; height: 30px; line-height: 1; cursor: pointer; display: grid; place-items: center; }
.nav-back { left: -12px; font-size: 19px; }
.nav-new { right: -8px; font-size: 17px; }

.nav-list { flex: 1; overflow-y: auto; }
.nav-session { position: relative; padding: 10px 0; margin-bottom: 8px; cursor: pointer; }
.nav-session .t { display: inline-block; font-size: 15px; }
.nav-session .m { font-size: 12px; color: rgba(233, 220, 194, .48); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-session.active .t { color: #e8cd96; }

.nav-confirm { position: fixed; inset: 0; background: rgba(8, 2, 5, .6); display: grid; place-items: center; z-index: 90; }
.nav-confirm[hidden] { display: none; }
.nav-confirm-box { width: min(264px, 76vw); background: #24090e; border: 1px solid rgba(185, 154, 95, .45); border-radius: 14px; padding: 18px 16px 12px; text-align: center; }
.nav-confirm-box p { margin: 0 0 14px; font-size: 14px; color: #e8dcc4; line-height: 1.6; }
.nav-confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.nav-confirm-actions button { border: 1px solid rgba(185, 154, 95, .35); background: none; border-radius: 9px; padding: 9px 0; color: #e8dcc4; font-family: inherit; font-size: 14px; cursor: pointer; }
.nav-confirm-actions button[data-act="ok"] { color: #e0a08a; border-color: rgba(224, 160, 138, .45); }





















.nav-menu {
  position: fixed;
  z-index: 95;
  display: grid;
  min-width: 76px;
  display: grid;
  min-width: 76px;
  background: rgba(45, 5, 15, .82);
  border: 0;
  border-radius: 8px;
  overflow: hidden;
}
.nav-menu[hidden] { display: none; }
.nav-menu button + button { border-top: 1px solid rgba(185, 154, 95, .18); }
.nav-menu button {
  border: 0; background: none; color: rgba(232, 220, 196, .62);
  font-family: inherit; font-size: 11px; letter-spacing: .04em;
  padding: 4px 9px; cursor: pointer;
}
.nav-session .del, #nav-rail .nav-person .del {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%);
  height: 26px; padding: 0 9px;
  border: 0; border-radius: 7px;
  background: rgba(45, 5, 15, .82); color: #d8a894;
  font-family: inherit; font-size: 12px; letter-spacing: .04em;
  opacity: 0; pointer-events: none; transition: opacity .18s ease; cursor: pointer;
}
.nav-session.swiped .del, #nav-rail .nav-person.swiped .del { opacity: 1; pointer-events: auto; }
.nav-session.editing .t, #nav-rail .nav-person.editing .nav-name {
  outline: 1px solid rgba(185, 154, 95, .4);
  background: rgba(185, 154, 95, .10);
  border-radius: 5px; padding: 0 4px;
}
.nav-session.swiped .del { opacity: 1; pointer-events: auto; }
.nav-session.editing .t { outline: 1px solid rgba(185, 154, 95, .45); background: rgba(185, 154, 95, .12); border-radius: 6px; padding: 1px 6px; }











.rename-input {
  z-index: 300;
  background: rgba(45, 5, 15, .94);
  border: 1px solid rgba(185, 154, 95, .5);
  border-radius: 6px;
  color: #e8dcc4;
  font-family: inherit;
  font-size: 15px;
  padding: 0 6px;
  outline: none;
}

/* 输入框滚动条：桌面端会冒出来，藏掉 */
.composer textarea { scrollbar-width: none; }
.composer textarea::-webkit-scrollbar { width: 0; height: 0; }



/* THINKING 浮在气泡上方，不占位：这样气泡顶端=头像顶端，尖角才对得上 */
.reasoning-margin { margin-top: 30px; }

/* THINKING 浮在气泡上方，不占位：气泡顶端 = 头像顶端，尖角才对得上 */
.reasoning {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin: 0 0 4px 2px;
  z-index: 3;
  white-space: nowrap;
  display: block;
}

/* ===== <trace>「此刻」小卡片：挂在气泡外面，默认只露气味名 ===== */
.trace {
  margin: 3px 0 0 10px;
  max-width: 72%;
  opacity: .9;
}
.trace-head {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border: 0;
  background: none;
  color: rgba(201, 162, 75, .48);
  font-family: inherit;
  font-size: 10.5px;
  letter-spacing: .05em;
  cursor: pointer;
}
.trace-star { font-size: 8.5px; opacity: .5; }
.trace-name { font-style: italic; }
.trace-body {
  margin: 1px 0 0 5px;
  padding-left: 8px;
  border-left: 1px solid rgba(185, 154, 95, .18);
  color: rgba(232, 218, 190, .44);
  font-size: 11px;
  line-height: 1.6;
}
.trace-row { display: flex; gap: 10px; }
.trace-label { flex: 0 0 auto; color: rgba(201, 162, 75, .34); }
.trace-arrow, .trace-value { flex: 1 1 auto; }
.trace-rule {
  height: 1px;
  margin: 4px 0;
  background: rgba(185, 154, 95, .22);
}
.trace-free { font-style: italic; opacity: .85; }

/* ===== 语音条：椭圆；图标跟着自己那条气泡走，但比波形暗一档 ===== */
.voice-wrap {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
}
.voice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 40px;
  padding: 0 18px 0 16px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.voice-play {
  flex: 0 0 auto;
  width: 0;
  height: 0;
  border-left: 8px solid currentColor;
  border-top: 5.5px solid transparent;
  border-bottom: 5.5px solid transparent;
}
.voice-wave {
  flex: 0 0 auto;
  width: 58px;
  display: flex;
  align-items: center;
  gap: 2.5px;
  height: 24px;
}
.voice-wave i {
  display: block;
  width: 2px;
  border-radius: 2px;
  background: currentColor;
  opacity: .95;
}
.voice-time {
  flex: 0 0 auto;
  font-size: 13px;
  letter-spacing: .04em;
}

/* 你这边：米白气泡 + 压暗的古铜色图标 */
.role-user .voice-bar {
  border: 1px solid var(--edge-middle, rgba(125, 99, 68, .85));
  background: linear-gradient(180deg, var(--glass-top) 0%, var(--glass-middle) 50%, var(--glass-bottom) 100%);
  color: rgba(52, 34, 22, .92);
}
.role-user .voice-time { color: rgba(52, 34, 22, .82); }
.role-user .voice-note { color: rgba(240, 229, 207, .34); }

/* 他那边：暗金气泡 + 米白的图标 */
.role-assistant .voice-bar {
  border: 1px solid var(--edge-core, rgba(118, 82, 48, .75));
  background: linear-gradient(180deg, var(--glass-top) 0%, var(--glass-middle) 50%, var(--glass-bottom) 100%);
  color: rgba(52, 34, 22, .92);
}
.role-assistant .voice-time { color: rgba(52, 34, 22, .82); }
.role-assistant .voice-note { color: rgba(240, 229, 207, .34); }

.voice-note {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.voice-note svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.voice-note .paper { fill: currentColor; }
.voice-note .fold { fill: none; stroke: var(--glass-top, rgba(240,229,207,.9)); stroke-width: 1.2; }
.voice-note .line { fill: none; stroke: currentColor; stroke-width: 0; }

/* 语音转写的文字：没有框、没有底，直接落在背景上；折一行，点开看全文 */
.voice-transcript {
  position: relative;
  grid-column: 1 / -1;
  /* 跟 THINKING 的「T」对齐：星形图标 + 间距约 20px */
  margin: 0 0 4px 20px;
  width: 268px;            /* 对齐「那就好，害你白緊張半天，這機器真該打。」这一条的长度 */
  max-width: 78vw;
  max-width: 100%;
  color: rgba(232, 218, 190, .44);
  font-size: 12.5px;
  line-height: 1.65;
  cursor: pointer;
}
.voice-transcript[hidden] { display: none !important; }
.voice-transcript.collapsed .voice-transcript-body {
  /* 只露一行，不加省略号：超出的部分直接截掉 */
  display: block;
  max-height: 1.65em;
  overflow: hidden;
  white-space: nowrap;
}



/* ===== 上下跳转：平时藏，滑屏才出现 ===== */
.jump-buttons {
  position: absolute;
  right: 10px;
  bottom: calc(128px + env(safe-area-inset-bottom));
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 3px 0;
  border-radius: 999px;
  border: 1px solid rgba(185, 154, 95, .18);
  background: rgba(22, 6, 10, .34);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.jump-buttons.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.jump-buttons[hidden] { display: none; }
.jump-buttons button {
  width: 26px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  color: rgba(232, 218, 190, .40);
  font-size: 11px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}




/* 语音条与文字气泡对齐：左（他）内缩 24，右（你）内缩 24 */
.message-row.assistant .bubble > .voice-wrap { margin-left: 0; }
.message-row.user .bubble > .voice-wrap { margin-right: 0; }
.bubble > .voice-wrap { margin-top: 2px; margin-bottom: 2px; }


/* 语音条和下面文字气泡之间，用和普通气泡一致的间距 */
.bubble > .voice-wrap + .message-body { margin-top: 10px; }
.bubble > .voice-wrap + .paper-surface { margin-top: 10px; }
.reasoning + .voice-wrap { margin-top: 8px; }


/* 缓存命中：小字，不抢 */
.meta-cache {
  position: static;
  pointer-events: auto;
  margin-left: auto;
  font-size: 11.5px;
  color: rgba(238, 228, 208, .38);
  letter-spacing: .03em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
  cursor: pointer;
  white-space: nowrap;
}
.meta-cache.low { color: rgba(214, 150, 96, .72); }
.meta-cache[hidden] { display: none; }


/* 他那边：时间戳跟在 THINKING 后面，不再挂在气泡下 */
.reasoning summary .message-time {
  position: static;
  top: auto;
  right: auto;
  margin-left: 8px;
  font-size: 11px;
  line-height: 1.2;
  text-align: left;
  opacity: .55;
  letter-spacing: .02em;
}
.reasoning summary { flex-wrap: nowrap; }


/* 生成那个比复制再小一点 */
.msg-actions button[data-action="regenerate"] svg { width: 11.5px; height: 11.5px; }


/* 思考浮层 */
.reasoning-overlay {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(12, 3, 6, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.reasoning-card {
  width: min(92vw, 420px);
  max-height: 72vh;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  border: 1px solid rgba(185, 154, 95, .32);
  background: rgba(26, 7, 12, .92);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.reasoning-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  color: #c9a24b;
  font-family: "Cinzel Decorative", "Times New Roman", serif;
  font-size: 12px;
  letter-spacing: .08em;
  border-bottom: 1px solid rgba(185, 154, 95, .18);
}
.reasoning-card-close {
  border: 0;
  background: none;
  color: rgba(232, 218, 190, .6);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.reasoning-card-body {
  padding: 12px 14px 16px;
  overflow-y: auto;
  color: rgba(232, 218, 190, .78);
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre-wrap;
}


/* 缓存点开：明细浮在百分比上面，百分比不动 */
.cache-detail {
  position: absolute;
  right: 10px;
  bottom: calc(100% + 2px);
  max-width: 92vw;
  font-size: 10.5px;
  line-height: 1.4;
  color: rgba(238, 228, 208, .32);
  text-shadow: 0 1px 4px rgba(0, 0, 0, .6);
  white-space: nowrap;
  pointer-events: none;
}
.cache-detail[hidden] { display: none; }

/* 思考浮层收窄一点 */
.reasoning-card { width: min(86vw, 360px); }


/* 他那边没有思考时：时间放气泡上面，距左边 12px（和复制图标同一条线） */
.message-time.time-top {
  position: static;
  top: auto;
  right: auto;
  display: block;
  margin: 0 0 2px 12px;
  text-align: left;
  opacity: .55;
  font-size: 11px;
  line-height: 1.2;
}


/* 他那边的时间：和复制按钮同一条线（距气泡左边 12px），只出现在每条回复的最后一块 */
.message-row.assistant .message-time {
  right: auto;
  left: 12px;
  text-align: left;
}


/* 同一条回复内部的段与段之间，不要被“带时间”的下边距撑开 */
.message-row.assistant.has-time:has(+ .message-row.assistant) { margin-bottom: 0; }



/* 隐藏的时间不许被 .time-top 的 display:block 露出来 */
.message-time.time-top[hidden] { display: none !important; }



/* 语音文字框默认藏住（别被 display 覆盖） */
.voice-text[hidden] { display: none !important; }
/* 便签按钮不要自带底 */
.voice-note { background: none !important; border: 0 !important; }
.voice-note:active { opacity: .7; }


/* 语音消息：只留语音条本身，不要外面那层纸（用 class，兼容老 Safari） */
.paper-surface.voice-only {
  background: transparent !important;
  background-image: none !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  clip-path: none !important;
  overflow: visible !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  isolation: auto !important;
}
.paper-surface.voice-only > svg { display: none !important; }
.paper-surface.voice-only .message-content { margin: 0 !important; }


/* 播放中：三角换成暂停的两条竖线 */
.voice-wrap.playing .voice-play {
  width: 9px;
  height: 11px;
  border: 0;
  background:
    linear-gradient(currentColor, currentColor) left top / 3px 11px no-repeat,
    linear-gradient(currentColor, currentColor) right top / 3px 11px no-repeat;
}


/* 她的搜索面板 */
.search-overlay {
  position: fixed; inset: 0; z-index: 420;
  display: grid; place-items: center;
  padding: 14px;
  background: rgba(10, 3, 6, .6);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.search-card {
  width: min(96vw, 360px); max-height: 78vh;
  display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(185, 154, 95, .32);
  background: rgba(26, 7, 12, .95);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .55);
}
.search-head {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 10px 12px; color: #c9a24b;
  font-size: 12px; letter-spacing: .12em;
  border-bottom: 1px solid rgba(185, 154, 95, .18);
}
.search-head span { text-align: center; }
.search-close { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: rgba(232, 218, 190, .6); font-size: 15px; cursor: pointer; }
.search-form { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 12px; }
.search-form input, .search-form select, .search-form button {
  font-family: inherit; font-size: 12px;
  color: rgba(238, 228, 208, .86);
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(185, 154, 95, .28);
  border-radius: 8px; padding: 6px 8px;
}
.search-form .search-input { flex: 1 1 100%; text-align: center; }
.search-form input[type="date"] { flex: 1 1 32%; }
.search-form select { flex: 1 1 30%; }
.search-form .search-run { flex: 0 0 auto; color: #c9a24b; min-width: 34px; font-size: 14px; }
.search-count { padding: 0 12px 6px; font-size: 11px; color: rgba(232, 218, 190, .55); }
.search-results { overflow-y: auto; padding: 0 8px 10px; }
.search-hit {
  padding: 8px 10px; margin: 4px 0; border-radius: 10px;
  background: rgba(255, 255, 255, .035);
  border: 1px solid rgba(185, 154, 95, .12);
  cursor: pointer;
}
.search-hit-meta { font-size: 10.5px; color: rgba(232, 218, 190, .45); margin-bottom: 3px; }
.search-hit-body {
  font-size: 12.5px; line-height: 1.6; color: rgba(238, 228, 208, .8);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.search-hit.open .search-hit-body { display: block; -webkit-line-clamp: unset; }


/* 搜索按钮：跟标题栏其它按钮同一规格 */
.nav-search {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0; background: none; padding: 0;
  color: rgba(201, 162, 75, .78);
  cursor: pointer;
}
.nav-search:hover { color: #c9a24b; }
.nav-search svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }


/* 二级页里的搜索条：卡在标题行和列表之间，细一条，用边框压住 */
.nav-searchbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: calc(100% + 12px);
  margin: 2px 0 8px -6px;
  padding: 7px 6px;
  border: 0;
  border-top: 1px solid rgba(185, 154, 95, .22);
  border-bottom: 1px solid rgba(185, 154, 95, .22);
  background: rgba(255, 255, 255, .02);
  color: rgba(232, 218, 190, .55);
  font-family: "Cinzel Decorative", "Times New Roman", serif;
  font-size: 11px;
  letter-spacing: .16em;
  cursor: pointer;
}
.nav-searchbar:hover { color: #c9a24b; border-color: rgba(201, 162, 75, .45); }
.nav-searchbar svg {
  width: 13px; height: 13px;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round;
}


/* 图片上的收藏星 */
.img-holder { position: relative; display: inline-block; }
.img-pin {
  position: absolute; right: 6px; top: 6px;
  width: 24px; height: 24px; padding: 0;
  border: 0; background: none;
  color: rgba(240, 226, 196, .9);
  font-size: 15px; line-height: 1;
  cursor: pointer;
  opacity: .55;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .75);
  transition: opacity .18s, color .18s;
}
.img-holder:hover .img-pin { opacity: 1; }
.img-pin:active { color: #c9a24b; }



/* 停止打字后三颗点要消失 */
.bubble:not(.streaming) .typing-dots { display: none; }


/* 「他在想」：气泡外的三颗点，不套框 */
.thinking-dots {
  display: inline-flex;
  gap: 3.5px;
  position: absolute;
  left: 12px;
  top: 36px;            /* 对齐头像的下边（头像 40px） */
}
.thinking-dots i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(201, 162, 75, .85);
  opacity: .22;
  animation: dotWave 1.35s ease-in-out infinite;
}
.thinking-dots i:nth-child(2) { animation-delay: .18s; }
.thinking-dots i:nth-child(3) { animation-delay: .36s; }

/* 收藏墙：文件夹卡片 + 两列照片 */
.wall-overlay {
  position: fixed; inset: 0; z-index: 430;
  display: grid; place-items: center;
  padding: 14px;
  background: rgba(10, 3, 6, .62);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.wall-card {
  width: min(96vw, 420px); max-height: 82vh;
  display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden;
  border: 1px solid rgba(185, 154, 95, .3);
  background: rgba(26, 7, 12, .95);
  box-shadow: 0 16px 44px rgba(0, 0, 0, .55);
}
.wall-head {
  position: relative; display: flex; align-items: center; justify-content: center;
  padding: 10px 40px; color: #c9a24b;
  font-family: "Cinzel Decorative Bold", "Cinzel Decorative", serif; font-size: 12px; letter-spacing: .14em;
  border-bottom: 1px solid rgba(185, 154, 95, .16);
}
.wall-title { font-weight: 400; }
/* 中文标题走文楷真字库 + 描边加粗，跟英文粗体视觉对齐 */
.wall-title.han {
  font-family: "LXGW WenKai TC", "LXGW WenKai GB", serif;
  font-weight: 700;
  -webkit-text-stroke: .15px currentColor;
  letter-spacing: .14em;
}
.wall-back, .wall-close {
  position: absolute; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: #c9a24b;
  font-size: 15px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
/* 返回键视觉重心偏上，单独往下挪一点点 */
.wall-back { left: 10px; transform: translateY(calc(-50% + 2px)); }
.wall-close { right: 10px; }
/* 顶栏 + / ×：标题同款做旧金，带衬线收尾的加粗线条，整体略缩小 */
.wall-add, .wall-close { color: #c9a24b; }
.wall-ico { display: block; width: 13px; height: 13px; }
.wall-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 38px 40px 42px; }
/* margin:auto 让网格在面板里垂直居中；内容超出时自动退回顶部、可滚动 */
.wall-grid { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 40px; row-gap: 52px; margin: auto 0; }

/* 文件夹卡片：一整块 iOS 磨砂玻璃文件夹，耳朵和身子是同一个轮廓，没有接缝 */
.wall-folder {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 8px;
  align-items: stretch;
}
.wall-folder.drop .folder-shape { filter: drop-shadow(0 0 7px rgba(201,162,75,.9)); }

/* 外层只管阴影和悬浮；横长比例 1.25:1 */
.folder-shape {
  position: relative; width: 100%; aspect-ratio: 1.25 / 1;
  /* 第一层：贴轮廓的做旧金细线（与面板边框同款 #b99a5f）；第二层：原投影 */
  filter: drop-shadow(0 0 .7px rgba(185,154,95,.9)) drop-shadow(0 8px 18px rgba(0,0,0,.4));
  transition: filter .16s, transform .16s;
}
.wall-folder:hover .folder-shape { transform: translateY(-2px); filter: drop-shadow(0 0 .85px rgba(185,154,95,.95)) drop-shadow(0 12px 24px rgba(0,0,0,.5)); }

/* 统一底色：浅奶金色相（米白多、黄少）等比加深约一成，色相不变、黄味不加；四个共用 */
.folder-shape {
  --cream: 187, 171, 140;
}
/* 背板 + 左上标签：剪出台阶轮廓，磨砂重、接近实色（顶部露出一截） */
.folder-back {
  position: absolute; inset: 0;
  -webkit-clip-path: url(#folder-back-clip);
  clip-path: url(#folder-back-clip);
  background: rgba(var(--cream), .94);
  box-shadow: inset 0 1px 0 rgba(215,180,105,.55), inset 1px 0 0 rgba(215,180,105,.4);
  backdrop-filter: blur(13px) saturate(.9); -webkit-backdrop-filter: blur(13px) saturate(.9);
}
/* 前面板：叠在背板上，更透，边缘一圈同色细描边 */
.folder-front {
  position: absolute; left: 0; right: 0; top: 11%; bottom: 0;
  overflow: hidden;
  border-radius: 3px 3px 11px 11px;
  border: 1px solid rgba(215, 180, 105, .6);
  background: rgba(var(--cream), .30);
}
/* 玻璃后面的内容层：均匀暖奶底纹 + 细噪点，没有底部灰色渐变 */
.folder-inside {
  position: absolute; inset: 0;
  background-color: rgb(var(--cream));
  background-image: 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 type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}
/* 有照片就整张铺满：只留极淡朦胧纹理，不改变文件夹本色——保证四个文件夹同一套色值 */
.folder-photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
  filter: sepia(1) saturate(.4) brightness(1) contrast(1.6) blur(26px);
  opacity: .1;
  mix-blend-mode: soft-light;
}
/* 前面板的磨砂玻璃层：接近均匀的同色缎面，只留极淡上下差，不要上白下棕两截 */
.folder-glass {
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
    rgba(var(--cream), .18) 0%,
    rgba(var(--cream), .175) 50%,
    rgba(var(--cream), .17) 100%);
  backdrop-filter: blur(3px) saturate(1.02); -webkit-backdrop-filter: blur(3px) saturate(1.02);
  box-shadow: inset 0 1px 0 rgba(255, 240, 200, .12), inset 0 -1px 0 rgba(120, 84, 36, .06);
}
.wall-folder.drop .folder-glass { background: rgba(201,162,75,.4); }
/* 名字：前面板正中，渐变实字——上浅金、下深金棕，和 COLLECTION 标题同款金调 */
.wall-folder-name {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  /* 前面板从顶部 11% 起，面板光学中心比几何中心略低；下移让文字落在面板正中 */
  padding: 5.5% 10px 0; pointer-events: none;
  white-space: nowrap; overflow: hidden;
}
.wall-folder-ink {
  display: flex; align-items: center; justify-content: center;
  font-family: "Cinzel Decorative", "LXGW WenKai TC", serif;
  font-size: 19.5px; font-weight: 700;
  /* 渐变填充：上浅金 → 下深金棕；background-clip 让渐变只落在笔画上，边缘锐利 */
  background: linear-gradient(180deg, #c9a24b 0%, #6a471f 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  /* 只留一层 1px 极淡柔影 */
  text-shadow: 0 1px 1px rgba(58, 38, 16, .16);
}
/* 中文逐字 flex+gap：间距只在字间，末字后不留空，整体严格居中 */
.wall-folder-ink.han { gap: .30em; background: none; -webkit-background-clip: border-box; background-clip: border-box; }
/* 每个字各自走一遍浅金→深金棕，渐变完整落在笔画上 */
.wall-folder-ink.han > span {
  background: linear-gradient(180deg, #c9a24b 0%, #6a471f 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  /* 每个字占同样宽的格子并居中，字与字之间的空隙才真正相等 */
  display: inline-block;
  width: 1em;
  text-align: center;
}
/* Cinzel 字面偏小：英文与数字单独补字号，和中文字面视觉等高 */
.wall-folder-ink.latin { font-size: 23px; letter-spacing: .02em; }
.wall-folder-new {
  display: grid; place-items: center;
  height: 113px;
  margin-top: 9px;
  border: 1px dashed rgba(185, 154, 95, .3);
  border-radius: 8px;
  background: none;
  color: rgba(232, 218, 190, .55);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

/* 照片卡片 */
.wall-photo {
  position: relative; aspect-ratio: 1 / 1;
  border-radius: 8px; overflow: hidden;
  background: rgba(255, 255, 255, .04);
}
.wall-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wall-photo-del {
  position: absolute; right: 2px; top: 2px;
  width: 18px; height: 18px; padding: 0;
  border: 0; background: none;
  color: rgba(250, 244, 228, .96);
  font-size: 14px; line-height: 1; cursor: pointer;
  text-shadow: none;
}
.wall-empty { grid-column: 1 / -1; padding: 40px 10px; text-align: center; font-size: 12.5px; color: rgba(232, 218, 190, .5); }


/* 文件夹造型见上：小耳朵 + 磨砂主体，不再用 SVG */

/* 收藏时选文件夹 */
.folder-picker-overlay {
  position: fixed; inset: 0; z-index: 460;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(8, 2, 4, .6);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.folder-picker {
  width: min(92vw, 320px); max-height: 70vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(185, 154, 95, .3);
  background: rgba(26, 7, 12, .97);
}
.folder-picker-title {
  text-align: center; color: #c9a24b; font-size: 11.5px;
  letter-spacing: .12em; padding-bottom: 6px;
}
.folder-picker-item, .folder-picker-new, .folder-picker-cancel {
  width: 100%; text-align: center;
  padding: 9px 10px; border-radius: 9px;
  border: 1px solid rgba(185, 154, 95, .2);
  background: rgba(255, 255, 255, .03);
  color: rgba(238, 228, 208, .85);
  font-family: inherit; font-size: 12.5px; cursor: pointer;
}
.folder-picker-item:active, .folder-picker-new:active { background: rgba(201, 162, 75, .18); }
.folder-picker-new { border-style: dashed; color: rgba(232, 218, 190, .6); }
.folder-picker-cancel { border: 0; background: none; color: rgba(232, 218, 190, .45); }

/* 照片大图 */
.photo-viewer-overlay {
  position: fixed; inset: 0; z-index: 470;
  display: grid; place-items: center;
  padding: 16px;
  background: rgba(6, 2, 3, .82);
}
.photo-viewer { width: min(94vw, 420px); display: flex; flex-direction: column; gap: 10px; }
.photo-viewer img { width: 100%; max-height: 68vh; object-fit: contain; border-radius: 10px; }
.photo-viewer-actions { display: flex; gap: 8px; }
.photo-viewer-move {
  flex: 1; padding: 9px 10px; border-radius: 9px;
  border: 1px solid rgba(185, 154, 95, .28);
  background: rgba(26, 7, 12, .9); color: rgba(238, 228, 208, .85);
  font-family: inherit; font-size: 12.5px;
}
.photo-viewer-del {
  padding: 9px 12px; border-radius: 9px;
  border: 1px solid rgba(185, 154, 95, .28);
  background: rgba(255, 255, 255, .04); color: rgba(238, 228, 208, .8);
  font-family: inherit; font-size: 12.5px; cursor: pointer;
}

.wall-add {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  border: 0; background: none; color: #c9a24b;
  font-size: 15px; line-height: 1; cursor: pointer; padding: 2px 6px;
}
.wall-add[hidden] { display: none; }

.img-pin.on { color: #c9a24b; opacity: .95; }

.action-status {
  font-size: 10.5px;
  letter-spacing: .06em;
  color: rgba(201, 162, 75, .62);
  margin: 2px 0 4px 12px;
}

.wall-folder-ink.han.spaced { gap: .30em; }


/* 分割线上的收藏墙入口 */
.nav-fixed { display: flex; align-items: center; justify-content: center; }
.nav-wall-btn {
  position: relative;
  top: -6px;
  width: 26px; height: 26px;
  border: 0; border-radius: 50%;
  background: rgba(26, 8, 12, .92);
  color: rgba(232, 218, 190, .8);
  font-size: 13px; line-height: 1; cursor: pointer;
}
.nav-wall-btn:active { color: #c9a24b; }




/* 花体字（本地） */
@font-face {
  font-family: "Blackletter";
  src: url("/assets/fonts/UnifrakturMaguntia.ttf") format("truetype");
  font-display: swap;
}

.nav-extra {
  position: absolute;
  /* 对齐导航面板中线（与中间虚线同源），视觉上居中 */
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  top: calc(47% + 30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  width: max-content;
}
.nav-entry {
  position: relative;
  display: block;
  width: auto;
  text-align: center;
  white-space: nowrap;
  font-family: "Blackletter", "Cinzel Decorative", serif;
  /* 花体词宽约为字号的 4.36 倍；5.7vw 让词宽约占屏宽 1/4，电脑上按 app-shell 520px 封顶同比例 */
  font-size: min(5.7vw, 29.6px);
  letter-spacing: .05em;
  background: linear-gradient(180deg, #efd9a2 0%, #c2944a 52%, #7d551f 100%);
  -webkit-background-clip: text; background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  cursor: pointer;
}
.nav-entry:active { opacity: .75; }



/* 分界线：只有中间这一条，接在左右两个小装饰之间 */
.nav-divider-mid {
  position: absolute;
  left: 3%; right: 3%;
  /* 对齐左右边框菱形装饰的中间尖角（边框图里尖角在整图高度 47.3% 处） */
  top: 47.3%;
  border-top: 2px dashed rgba(185, 154, 95, .6);
  pointer-events: none;
}


  100% { transform: scale(1.25); opacity: 0; }
}

/* 等回复时浮在消息区的三个点 */
.thinking-dots.waiting {
  position: static;
  display: flex;
  gap: 4px;
  margin: 4px 0 6px 46px;
}

/* 长会话：不用玻璃模糊，改实色；Safari 模糊层数有上限，否则前面整片糊 */
html.heavy-history .bubble,
html.heavy-history .paper-surface {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html.heavy-history .paper-surface {
  background-color: rgba(232, 216, 189, .96) !important;
  background-blend-mode: normal !important;
  filter: none !important;
  -webkit-filter: none !important;
}

/* 试验：?flat=1 时把 SVG 现算噪声换成预算好的图（Safari 对大量 SVG 滤镜有上限） */
html.flat-noise .paper-surface,
html.flat-noise .bubble {
  background-image: url("/assets/noise/p08.png") !important;
}

/* 只有屏幕上看得到的气泡才加玻璃模糊：Safari 对同时存在的模糊层有上限，443 条会整片不画 */
.paper-surface.in-view {
  backdrop-filter: blur(7px) saturate(0.82);
  -webkit-backdrop-filter: blur(7px) saturate(0.82);
}

.wall-back svg, .wall-close svg, .wall-add svg { display: block; }
.wall-back, .wall-close, .wall-add { display: grid; place-items: center; }
/* hidden 必须赢过 display:grid，否则首页也会冒出返回键 */
.wall-back[hidden], .wall-close[hidden], .wall-add[hidden] { display: none !important; }

/* 关掉 iOS 原生的选中/长按选字/图片长按菜单：只留输入框 */
html, body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
img, svg, canvas { -webkit-user-drag: none; user-drag: none; }
textarea, input, [contenteditable="true"] {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.voice-transcript {
  position: relative;
  margin: 6px 0 0 12px;
  width: 22em;        /* 22 个中文字 */
  max-width: 78vw;
  color: rgba(232, 218, 190, .44);
  font-size: 12.5px;
  line-height: 1.65;
  cursor: pointer;
}
.voice-transcript-toggle {
  width: 18px; height: 18px; padding: 0;
  border: 0; background: none;
  color: rgba(201, 162, 75, .5);
  font-size: 12px; line-height: 1;
  cursor: pointer;
}
.voice-transcript-toggle.on { color: rgba(201, 162, 75, .85); }
/* 按住说话 */
.wave-button.recording { color: #c9a24b; transform: scale(1.08); }
.wave-button.listening { opacity: .5; }

/* 录音时的小面板 */
.rec-panel {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 5px 0 12px;
  border-radius: 999px;
  background: rgba(28, 8, 12, .82);
  color: rgba(240, 226, 196, .9);
  font-size: 12px;
  letter-spacing: .04em;
  white-space: nowrap;
  border: 1px solid rgba(185, 154, 95, .28);
}
.rec-panel .rec-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #c9a24b;
  animation: recBlink 1s ease-in-out infinite;
}
.rec-panel .rec-time { min-width: 30px; color: #c9a24b; font-variant-numeric: tabular-nums; }
.rec-panel .rec-hint {
  color: rgba(240, 226, 196, .5);
  font-size: 11px;
  white-space: nowrap;
}
.rec-panel.cancel { border-color: rgba(201, 162, 75, .55); }
.rec-panel.cancel .rec-hint { color: rgba(214, 186, 128, .8); }
@keyframes recBlink { 0%,100% { opacity: 1; } 50% { opacity: .25; } }

.rec-panel .rec-cancel {
  width: 17px;
  height: 17px;
  margin-right: 2px;
  padding: 0;
  border-radius: 50%;
  border: 1px dashed rgba(185, 154, 95, .5);
  background: none;
  color: rgba(185, 154, 95, .85);   /* 和圈一个颜色 */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.rec-panel.cancel .rec-cancel {
  border-color: rgba(201, 162, 75, .62);
  color: rgba(214, 186, 128, .85);
  background: rgba(201, 162, 75, .07);
}
.wave-button { touch-action: none; }

/* 自己这边的转写：宽度跟语音条一致，超过就折行加省略号 */
.message-row.user .voice-transcript {
  margin-left: 17px;    /* 对齐播放三角的左边线 */
  margin-right: 0;
}


/* 转写改用绝对定位：展开/收起都不推动任何东西 */
.message-body { position: relative; }
.voice-transcript {
  position: absolute;
  left: 17px;
  width: 22em;
  max-width: min(78vw, calc(100vw - 96px));
  overflow: hidden;
  z-index: 2;
}
.message-row.user .voice-transcript {
  bottom: 100%;
  margin: 0 0 4px;
}
.message-row.assistant .voice-transcript {
  top: 100%;
  margin: 4px 0 0;
}

/* 聊天区禁止横向拖动（转写是绝对定位，容易把页面撑宽） */
#messages {
  overflow-x: hidden;
  overscroll-behavior-x: none;
}
.voice-transcript { pointer-events: auto; }
.message-body { max-width: 100%; }

/* 展开时参与排版，把上下气泡推开 */
.voice-transcript.expanded {
  position: static;
  margin-top: 6px;
  margin-bottom: 6px;
  width: 22em;
  max-width: min(78vw, calc(100vw - 96px));
}
.voice-transcript.expanded .voice-transcript-body {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ===== 回憶：事件卡 ===== */
.memory-overlay {
  position: fixed;
  inset: 0;
  z-index: 440;
  display: grid;
  place-items: center;
  background: rgba(8, 2, 5, .82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.memory-panel {
  width: min(88vw, 380px);
  max-height: 78vh;
  display: flex;
  flex-direction: column;
  padding: 14px 14px 10px;
  border-radius: 18px;
  border: 1px solid rgba(185, 154, 95, .32);
  background: rgba(24, 8, 12, .92);
  color: rgba(240, 226, 196, .92);
}
.memory-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 10px;
}
.memory-title {
  font-family: "LXGW WenKai TC", "LXGW WenKai GB", serif;
  font-size: 15px;
  letter-spacing: .18em;
  color: rgba(201, 162, 75, .92);
}
.memory-close {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: rgba(201, 162, 75, .85);
  padding: 0;
  background: none;
  border: 0;
}
.memory-list {
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}
.memory-card { border-radius: 12px; border: 1px solid rgba(185, 154, 95, .18); }
.memory-card.open { border-color: rgba(185, 154, 95, .38); }
.memory-face {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: 0;
  text-align: left;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}
.memory-when {
  font-size: 11px;
  letter-spacing: .06em;
  color: rgba(201, 162, 75, .72);
  font-variant-numeric: tabular-nums;
}
.memory-hint {
  font-family: "LXGW WenKai TC", "LXGW WenKai GB", serif;
  font-size: 13.5px;
  color: rgba(240, 226, 196, .82);
}
.memory-back {
  padding: 0 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.memory-line { display: flex; gap: 8px; font-size: 12.5px; line-height: 1.6; }
.memory-key {
  flex: 0 0 auto;
  color: rgba(201, 162, 75, .7);
  font-size: 11px;
  letter-spacing: .08em;
  padding-top: 1px;
}
.memory-value { color: rgba(240, 226, 196, .8); }
.memory-empty {
  padding: 24px 0;
  text-align: center;
  font-size: 12.5px;
  color: rgba(240, 226, 196, .45);
}
