/* =========================================================
   小安 · 薰衣草玻璃设计系统（对话应用）
   ========================================================= */
:root {
  --serif: "Noto Serif SC", Georgia, "Songti SC", serif;
  --sans: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont,
    "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --lav-400: #a18dff;
  --lav-500: #8b6ef0;
  --lav-600: #7551dd;
  --lav-700: #623bbd;
  --grad-primary: linear-gradient(135deg, #8b6ef0, #7551dd);
  --grad-ava: linear-gradient(135deg, #8b6ef0, #4a8c70);
  --shadow-soft: 0 10px 40px -12px rgba(98, 76, 168, 0.28);
  --shadow-glow: 0 0 52px -14px rgba(161, 141, 255, 0.55);

  --r-4xl: 32px;
  --r-3xl: 24px;
  --r-2xl: 16px;
  --r-xl: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rail-w: 280px;
  --danger: #c0564b;
}

[data-theme="light"] {
  color-scheme: light;
  --page: #fbf9f6;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-brd: rgba(255, 255, 255, 0.7);
  --inner: rgba(255, 255, 255, 0.55);
  --ink: #1f2433;
  --ink-soft: #3a4156;
  --ink-muted: #6b7388;
  --hair: rgba(31, 36, 51, 0.07);
  --sage: #4a8c70;
  --bubble-ai: #f5f1ea;
  --bubble-ai-tx: #3a4156;
  --chip-bg: #f6f5ff;
  --chip-tx: #623bbd;
  --chip-brd: #eeebff;
  --hover: rgba(139, 110, 240, 0.07);
  --shadow-card: 0 24px 60px -24px rgba(31, 36, 51, 0.22);
  --aurora-1: rgba(161, 141, 255, 0.35);
  --aurora-2: rgba(103, 168, 139, 0.28);
  --aurora-3: rgba(192, 181, 255, 0.3);
  --grid-line: rgba(98, 76, 168, 0.05);
  --code-bg: #2c2842;
}

[data-theme="dark"] {
  color-scheme: dark;
  --page: #100e1c;
  --glass-bg: rgba(32, 28, 55, 0.6);
  --glass-brd: rgba(255, 255, 255, 0.08);
  --inner: rgba(255, 255, 255, 0.035);
  --ink: #ece9fb;
  --ink-soft: #c6c2e4;
  --ink-muted: #8f8ab0;
  --hair: rgba(255, 255, 255, 0.08);
  --sage: #7cc0a1;
  --bubble-ai: rgba(255, 255, 255, 0.06);
  --bubble-ai-tx: #d8d5ee;
  --chip-bg: rgba(139, 110, 240, 0.15);
  --chip-tx: #c0b5ff;
  --chip-brd: rgba(139, 110, 240, 0.28);
  --hover: rgba(139, 110, 240, 0.14);
  --shadow-card: 0 30px 70px -30px rgba(0, 0, 0, 0.65);
  --aurora-1: rgba(139, 110, 240, 0.24);
  --aurora-2: rgba(74, 140, 112, 0.2);
  --aurora-3: rgba(160, 141, 255, 0.16);
  --grid-line: rgba(200, 190, 255, 0.045);
  --code-bg: #1a1730;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--page);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}
::selection {
  background: rgba(161, 141, 255, 0.28);
}

/* ---------- 背景 ---------- */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--page);
  overflow: hidden;
}
.aurora {
  position: absolute;
  inset: -20%;
  background: radial-gradient(60% 60% at 20% 20%, var(--aurora-1), transparent 60%),
    radial-gradient(50% 50% at 80% 10%, var(--aurora-2), transparent 60%),
    radial-gradient(60% 60% at 60% 90%, var(--aurora-3), transparent 60%);
  animation: aurora-drift 24s var(--ease) infinite alternate;
}
@keyframes aurora-drift {
  to {
    transform: translate3d(3%, 2%, 0) scale(1.08);
  }
}
.grid-faint {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 46px 46px;
}

/* ---------- 骨架 ---------- */
.shell {
  display: flex;
  gap: 18px;
  height: 100dvh;
  padding: 18px;
}

/* ---------- 侧栏 ---------- */
.rail {
  width: var(--rail-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-4xl);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 6px 22px;
}
.rail-logo {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--grad-ava);
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}
.rail-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex: 1;
  min-width: 0;
}
.rail-title b {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.24rem;
  color: var(--ink);
  letter-spacing: 0.04em;
}
.rail-title i {
  font-style: normal;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  color: var(--ink-muted);
  text-transform: uppercase;
}
.rail-brand .rail-close {
  display: none;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-soft);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), filter 0.3s;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  filter: brightness(1.03);
}
.rail-new {
  width: 100%;
}

.rail-nav {
  flex: 1;
  min-height: 0;
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden; /* 整块不滚动；只有上方历史区内部滚动 */
}
/* 滚动区：近期对话 + 测试项。内容少时按内容高度（多余空间留到底部），内容多时收缩并内部滚动。 */
.rail-scroll {
  flex: 0 1 auto;
  min-height: 96px;
  overflow-y: auto;
  scrollbar-width: thin;
  padding-right: 2px;
}
.rail-scroll::-webkit-scrollbar {
  width: 6px;
}
.rail-scroll::-webkit-scrollbar-thumb {
  background: var(--hair);
  border-radius: 6px;
}
/* 疗愈小工具：常驻底部，只占自身自然高度、不随历史滚动，始终可见 */
.rail-tools {
  flex: 0 0 auto;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--hair);
}
.rail-h {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0 10px 8px;
}
.rail-h:not(:first-child) {
  margin-top: 22px;
}
.rail-list {
  list-style: none;
}
.rail-tool {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: var(--r-xl);
  font-size: 0.9rem;
  color: var(--ink-soft);
  text-align: left;
  transition: background 0.22s, color 0.22s, padding-left 0.25s var(--ease);
}
.rail-tool:hover {
  background: var(--hover);
  color: var(--ink);
  padding-left: 15px;
}
.tool-ic {
  color: var(--lav-600);
  display: flex;
  flex-shrink: 0;
}
[data-theme="dark"] .tool-ic {
  color: var(--lav-400);
}
.rail-priv {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 8px 2px;
  font-size: 0.76rem;
  color: var(--ink-muted);
}
.rail-priv svg {
  color: var(--sage);
}

/* ---------- 历史会话项 ---------- */
.conv-item {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: var(--r-xl);
  margin-bottom: 2px;
  transition: background 0.18s;
}
.conv-item:hover {
  background: var(--hover);
}
.conv-item.active {
  background: var(--chip-bg);
}
.conv-item-main {
  flex: 1;
  min-width: 0;
  text-align: left;
  padding: 9px 11px;
}
.conv-item-title {
  font-size: 0.9rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-item.active .conv-item-title {
  color: var(--chip-tx);
  font-weight: 500;
}
.conv-item-time {
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: 1px;
}
.conv-item-del {
  flex: 0 0 auto;
  width: 32px;
  color: var(--ink-muted);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
}
.conv-item:hover .conv-item-del {
  opacity: 1;
}
.conv-item-del:hover {
  color: var(--danger);
  background: rgba(192, 86, 75, 0.12);
}
.conv-empty {
  color: var(--ink-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 16px 0;
}
@media (hover: none) {
  .conv-item-del {
    opacity: 0.6;
  }
}

/* ---------- 主对话卡片 ---------- */
.chat-card {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-4xl);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  overflow: hidden;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--hair);
  background: var(--inner);
}
.chat-ava {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--grad-ava);
  box-shadow: var(--shadow-soft);
  flex-shrink: 0;
}
.ava-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #67a88b;
  border: 2px solid var(--page);
  animation: live 2.6s ease-in-out infinite;
}
@keyframes live {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(103, 168, 139, 0.4);
  }
  60% {
    box-shadow: 0 0 0 6px rgba(103, 168, 139, 0);
  }
}
.chat-meta {
  flex: 1;
  min-width: 0;
}
.chat-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}
.chat-status {
  font-size: 0.76rem;
  color: var(--sage);
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-xl);
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  transition: background 0.22s, color 0.22s, transform 0.2s;
  flex-shrink: 0;
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}
.icon-btn:active {
  transform: scale(0.94);
}
.menu {
  display: none;
}
.ic-moon {
  display: none;
}
[data-theme="dark"] .ic-sun {
  display: none;
}
[data-theme="dark"] .ic-moon {
  display: block;
}

/* ---------- 消息区 ---------- */
.msgs {
  flex: 1;
  overflow-y: auto;
  padding: 26px 24px 8px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
}
.msgs::-webkit-scrollbar {
  width: 8px;
}
.msgs::-webkit-scrollbar-thumb {
  background: var(--hair);
  border-radius: 8px;
}

.row {
  display: flex;
  gap: 10px;
  max-width: 768px;
  width: 100%;
  margin: 0 auto;
  align-items: flex-start;
  animation: rise 0.5s var(--ease) both;
}
.row.user {
  flex-direction: row-reverse;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.avatar {
  display: none;
}
.msg-col {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  min-width: 0;
}
.row.user .msg-col {
  align-items: flex-end;
}
.row.bot .msg-col {
  align-items: flex-start;
}
.bubble {
  max-width: 100%;
  padding: 13px 17px;
  border-radius: var(--r-3xl);
  font-size: 0.96rem;
  line-height: 1.75;
  word-break: break-word;
}
.row.bot .bubble {
  background: var(--bubble-ai);
  color: var(--bubble-ai-tx);
  border-top-left-radius: 7px;
}
.row.user .bubble {
  background: var(--grad-primary);
  color: #fff;
  border-top-right-radius: 7px;
  box-shadow: var(--shadow-soft);
}
.bubble.error {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f3cfca;
  box-shadow: none;
}

/* 打字指示 / 光标 */
.typing {
  display: inline-flex;
  gap: 6px;
  padding: 4px 2px;
}
.typing span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lav-400);
  animation: typing 1.4s infinite ease-in-out both;
}
.typing span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing span:nth-child(3) {
  animation-delay: 0.4s;
}
@keyframes typing {
  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}
.caret::after {
  content: "▌";
  margin-left: 1px;
  color: var(--lav-500);
  animation: caret 1s steps(1) infinite;
}
@keyframes caret {
  50% {
    opacity: 0;
  }
}

/* ---------- 消息内 Markdown ---------- */
.bubble p + p {
  margin-top: 10px;
}
.bubble h1,
.bubble h2,
.bubble h3,
.bubble h4,
.bubble h5,
.bubble h6 {
  margin: 12px 0 6px;
  line-height: 1.4;
  font-weight: 700;
  font-family: var(--serif);
}
.bubble > :first-child {
  margin-top: 0;
}
.bubble h1 {
  font-size: 1.2rem;
}
.bubble h2 {
  font-size: 1.1rem;
}
.bubble h3 {
  font-size: 1rem;
}
.bubble h4,
.bubble h5,
.bubble h6 {
  font-size: 0.96rem;
}
.bubble ul,
.bubble ol {
  margin: 6px 0;
  padding-left: 22px;
}
.bubble li {
  margin: 3px 0;
}
.bubble blockquote {
  margin: 8px 0;
  padding: 4px 12px;
  border-left: 3px solid var(--lav-400);
  background: var(--hover);
  border-radius: 0 8px 8px 0;
}
.row.user .bubble blockquote {
  border-left-color: rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.14);
}
.bubble code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(139, 110, 240, 0.13);
  padding: 1px 6px;
  border-radius: 6px;
}
.row.user .bubble code {
  background: rgba(255, 255, 255, 0.22);
}
.bubble pre {
  margin: 8px 0;
  padding: 12px 14px;
  background: var(--code-bg);
  color: #e7e3fb;
  border-radius: var(--r-2xl);
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.6;
}
.bubble pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  color: inherit;
  white-space: pre;
  font-size: inherit;
}
.bubble a {
  color: var(--lav-600);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.row.user .bubble a {
  color: #fff;
}
[data-theme="dark"] .bubble a {
  color: var(--lav-400);
}
.bubble hr {
  border: none;
  border-top: 1px solid var(--hair);
  margin: 12px 0;
}
.bubble del {
  opacity: 0.7;
}
.bubble .table-wrap {
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--hair);
  border-radius: var(--r-xl);
}
.bubble table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
}
.bubble th,
.bubble td {
  border-bottom: 1px solid var(--hair);
  border-right: 1px solid var(--hair);
  padding: 7px 11px;
  text-align: left;
}
.bubble tr th:last-child,
.bubble tr td:last-child {
  border-right: none;
}
.bubble tbody tr:last-child td {
  border-bottom: none;
}
.bubble thead th {
  background: var(--chip-bg);
  color: var(--chip-tx);
  font-weight: 600;
}

/* ---------- 消息操作栏 ---------- */
.act-bar {
  display: flex;
  gap: 2px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.row:hover .act-bar {
  opacity: 1;
}
.row.user .act-bar {
  justify-content: flex-end;
}
.act-btn {
  width: 28px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
  transition: background 0.15s, color 0.15s;
}
.act-btn:hover {
  background: var(--hover);
  color: var(--lav-600);
}
.act-btn.active-like {
  color: var(--lav-600);
}
.act-btn.active-dislike,
.act-btn.speaking {
  color: var(--lav-600);
}
@media (hover: none) {
  .act-bar {
    opacity: 0.75;
  }
}

/* ---------- 附件 chips ---------- */
.att-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.att-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.76rem;
  padding: 4px 9px;
  border-radius: 9px;
  background: var(--chip-bg);
  color: var(--chip-tx);
  border: 1px solid var(--chip-brd);
}
.row.user .att-chip {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.32);
}
.attachments {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 24px 0;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}
.att-chip.pending {
  background: var(--inner);
  color: var(--ink-soft);
  border-color: var(--hair);
}
.att-chip.loading {
  opacity: 0.7;
}
.att-chip.error {
  background: #fdecea;
  color: var(--danger);
  border-color: #f3cfca;
}
.att-rm {
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  font-size: 15px;
  line-height: 1;
  padding: 0 1px;
  margin-left: 1px;
}

/* ---------- 系统提示 ---------- */
.notice {
  align-self: center;
  max-width: 620px;
  background: rgba(240, 180, 60, 0.12);
  border: 1px solid rgba(240, 180, 60, 0.3);
  color: #96702a;
  font-size: 0.82rem;
  padding: 9px 15px;
  border-radius: var(--r-2xl);
  text-align: center;
}
[data-theme="dark"] .notice {
  color: #e6c98a;
}

/* ---------- 建议胶囊 ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 24px 12px;
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}
.chips.hide {
  display: none;
}
.chip {
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  color: var(--chip-tx);
  font-size: 0.82rem;
  font-weight: 500;
  transition: transform 0.25s var(--ease), filter 0.25s;
}
.chip:hover {
  transform: translateY(-2px);
  filter: brightness(0.98);
}
[data-theme="dark"] .chip:hover {
  filter: brightness(1.15);
}

/* ---------- 输入 ---------- */
.composer {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--hair);
  max-width: 820px;
  margin: 0 auto;
  width: 100%;
}
.compose-icon {
  color: var(--ink-muted);
}
.compose-icon:hover {
  background: var(--hover);
  color: var(--lav-600);
}
#mic-btn.recording {
  color: var(--danger);
  background: rgba(192, 86, 75, 0.12);
}
.composer-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 0.98rem;
  line-height: 1.6;
  padding: 9px 8px;
  resize: none;
  max-height: 150px;
  font-family: inherit;
}
.composer-input::placeholder {
  color: var(--ink-muted);
}
.composer-send {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--r-xl);
  background: var(--lav-500);
  color: #fff;
  display: grid;
  place-items: center;
  transition: transform 0.3s var(--ease), background 0.25s;
}
.composer-send:hover {
  background: var(--lav-600);
  transform: translateY(-1px);
}
.composer-send:active {
  transform: scale(0.94);
}
.composer-send.is-stop {
  background: var(--danger);
}
.disclaimer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--ink-muted);
  padding: 0 24px 14px;
  max-width: 760px;
  margin: 0 auto;
}

/* ---------- 编辑框 ---------- */
.edit-area {
  width: min(520px, 74vw);
  box-sizing: border-box;
  border: 1px solid var(--lav-400);
  border-radius: var(--r-2xl);
  padding: 10px 13px;
  font-family: inherit;
  font-size: 0.96rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  background: var(--page);
  color: var(--ink);
  box-shadow: 0 0 0 3px rgba(139, 110, 240, 0.14);
}
.edit-btns {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.row.user .edit-btns {
  justify-content: flex-end;
}
.edit-save {
  background: var(--lav-500);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
  font-size: 0.82rem;
}
.edit-save:hover {
  background: var(--lav-600);
}
.edit-cancel {
  background: transparent;
  color: var(--ink-muted);
  border: 1px solid var(--hair);
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
  font-size: 0.82rem;
}
.edit-cancel:hover {
  background: var(--hover);
}

/* ---------- 语音引擎下拉（测试开关） ---------- */
.tts-select {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--glass-brd);
  background: var(--chip-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.84rem;
  outline: none;
  cursor: pointer;
}
.tts-select:focus {
  border-color: var(--lav-400);
}

/* ---------- 广场（社区） ---------- */
.plaza-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 0.84rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.plaza-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--lav-500);
}
.plaza-entry {
  margin-top: 8px;
}
.plaza-card {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}
.plaza-compose {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.plaza-nick {
  width: 170px;
  box-sizing: border-box;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-brd);
  background: var(--chip-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.86rem;
  outline: none;
}
.plaza-nick:focus {
  border-color: var(--lav-400);
}
.plaza-list {
  text-align: left;
  margin-top: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plaza-post {
  border: 1px solid var(--hair);
  border-radius: 16px;
  padding: 12px 14px;
  background: var(--chip-bg);
}
.plaza-post-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.plaza-nick-tag {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink);
}
.plaza-time {
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-left: auto;
}
.plaza-body {
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.plaza-cmts {
  margin-top: 10px;
  border-top: 1px solid var(--hair);
  padding-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plaza-cmt {
  font-size: 0.84rem;
  color: var(--ink-soft);
  line-height: 1.5;
  word-break: break-word;
}
.plaza-cmt b {
  color: var(--ink);
  font-weight: 600;
}
.plaza-cmt-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.plaza-cmt-input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--glass-brd);
  background: var(--page);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.84rem;
  outline: none;
}
.plaza-cmt-input:focus {
  border-color: var(--lav-400);
}
.plaza-cmt-send {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  border: none;
  background: var(--grad-primary);
  color: #fff;
  font-size: 0.82rem;
  cursor: pointer;
}
.plaza-empty {
  font-size: 0.86rem;
  color: var(--ink-muted);
  text-align: center;
  padding: 20px;
}

/* ---------- 右侧目录 ---------- */
.toc {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 35;
  display: flex;
  align-items: center;
}
.toc-handle {
  width: 24px;
  height: 64px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  border-right: none;
  border-radius: 12px 0 0 12px;
  display: grid;
  place-items: center;
  color: var(--lav-500);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(18px);
  cursor: pointer;
}
.toc-panel {
  position: absolute;
  right: 24px;
  top: 50%;
  transform: translateY(-50%) translateX(12px);
  width: 232px;
  max-height: 72vh;
  overflow-y: auto;
  background: var(--glass-bg);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(24px) saturate(1.3);
  padding: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, transform 0.2s;
}
.toc:hover .toc-panel,
.toc:focus-within .toc-panel,
.toc.open .toc-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0);
}
.toc.open .toc-handle {
  color: var(--lav-600);
  background: var(--hover);
}
.toc-title {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 2px 6px 8px;
}
.toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc-item {
  text-align: left;
  color: var(--ink-soft);
  font-size: 0.84rem;
  padding: 7px 9px;
  border-radius: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s, color 0.15s;
}
.toc-item:hover {
  background: var(--hover);
  color: var(--lav-600);
}
.toc-empty {
  font-size: 0.76rem;
  color: var(--ink-muted);
  padding: 8px;
  text-align: center;
}

/* ---------- 遮罩 ---------- */
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(20, 16, 40, 0.35);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.25s;
}
.scrim.show {
  display: block;
  opacity: 1;
}

/* ---------- 呼吸练习 ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s var(--ease);
}
.modal.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 40, 0.4);
  backdrop-filter: blur(8px);
}
.modal-card {
  position: relative;
  width: min(440px, 90vw);
  padding: 40px 34px 34px;
  text-align: center;
  background: var(--page);
  border: 1px solid var(--glass-brd);
  border-radius: var(--r-4xl);
  box-shadow: var(--shadow-card);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.5s var(--ease);
}
.modal.open .modal-card {
  transform: none;
}
.modal-x {
  position: absolute;
  top: 14px;
  right: 14px;
}
.modal-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--lav-600);
  font-weight: 500;
  margin-bottom: 8px;
}
[data-theme="dark"] .modal-eyebrow {
  color: var(--lav-400);
}
.modal-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 28px;
}
.breathe-stage {
  position: relative;
  width: 210px;
  height: 210px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
}
.breathe-ring {
  position: absolute;
  inset: 0;
  margin: auto;
  border-radius: 50%;
  border: 1px solid rgba(139, 110, 240, 0.22);
}
.breathe-ring.r1 {
  width: 210px;
  height: 210px;
}
.breathe-ring.r2 {
  width: 155px;
  height: 155px;
}
.breathe-core {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: var(--grad-primary);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 0.98rem;
  font-weight: 500;
  box-shadow: var(--shadow-glow);
  transition: transform 4s ease-in-out;
}
.breathe-core.inhale,
.breathe-core.hold {
  transform: scale(1.62);
}
.breathe-core.exhale {
  transform: scale(1);
}
.breathe-hint {
  font-size: 0.92rem;
  color: var(--ink-soft);
  min-height: 1.4em;
  margin-bottom: 24px;
}

/* ---------- 引导冥想 ---------- */
.med-voice {
  position: absolute;
  top: 14px;
  left: 14px;
  color: var(--lav-600);
}
.med-voice .ic-voice-off {
  display: none;
}
.med-voice.muted {
  color: var(--ink-muted);
}
.med-voice.muted .ic-voice-on {
  display: none;
}
.med-voice.muted .ic-voice-off {
  display: block;
}
.med-stage {
  position: relative;
  width: 210px;
  height: 210px;
  margin: 4px auto 18px;
  display: grid;
  place-items: center;
}
.med-orb {
  position: relative;
  z-index: 2;
  width: 150px;
  height: 150px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--grad-primary);
  box-shadow: var(--shadow-glow);
  border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%;
  animation: medMorph 16s ease-in-out infinite;
}
.med-stage.running .med-orb {
  animation: medMorph 16s ease-in-out infinite, medBreathe 10s ease-in-out infinite;
}
@keyframes medMorph {
  0%,
  100% {
    border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%;
  }
  33% {
    border-radius: 58% 42% 45% 55% / 42% 58% 42% 58%;
  }
  66% {
    border-radius: 48% 52% 60% 40% / 55% 45% 55% 45%;
  }
}
@keyframes medBreathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.09);
  }
}
.med-ring {
  position: absolute;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 1.5px solid rgba(139, 110, 240, 0.4);
  opacity: 0;
}
.med-stage.running .med-ring {
  animation: medRipple 5s ease-out infinite;
}
.med-ring.d2 {
  animation-delay: 1.6s;
}
.med-ring.d3 {
  animation-delay: 3.2s;
}
@keyframes medRipple {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(2.05);
    opacity: 0;
  }
}
[data-theme="dark"] .med-ring {
  border-color: rgba(159, 208, 184, 0.4);
}
.med-count {
  font-size: 1.65rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.med-opts {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 10px;
}
.med-opts:last-of-type {
  margin-bottom: 20px;
}
.med-label {
  font-size: 0.74rem;
  color: var(--ink-muted);
  flex: none;
  width: 30px;
  text-align: right;
}
.med-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.med-chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  color: var(--chip-tx);
  font-size: 0.82rem;
  font-weight: 500;
  transition: transform 0.2s var(--ease), filter 0.2s;
}
.med-chip.active {
  background: var(--grad-primary);
  color: #fff;
  border-color: transparent;
}
.med-chip:hover {
  transform: translateY(-1px);
}

/* ---------- 心情日记 ---------- */
.modal-card-lg {
  width: min(480px, 92vw);
}
.jr-moods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
}
.jr-mood {
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 500;
  transition: transform 0.2s var(--ease), filter 0.2s;
}
.jr-mood:hover {
  transform: translateY(-1px);
}
.jr-mood.active {
  color: #fff;
  border-color: transparent;
}
.jr-text {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--glass-brd);
  border-radius: 16px;
  background: var(--chip-bg);
  color: var(--ink);
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  margin-bottom: 14px;
  text-align: left;
  transition: border-color 0.2s;
}
.jr-text:focus {
  border-color: var(--lav-400);
}
.jr-list {
  text-align: left;
  margin-top: 20px;
  max-height: 34vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.jr-entry {
  border: 1px solid var(--hair);
  border-radius: 14px;
  padding: 10px 12px;
  background: var(--chip-bg);
}
.jr-entry-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.jr-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.jr-mood-tag {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
}
.jr-date {
  font-size: 0.72rem;
  color: var(--ink-muted);
  margin-left: auto;
}
.jr-del {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 1.1rem;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.jr-del:hover {
  background: var(--hover);
  color: var(--danger);
}
.jr-body {
  font-size: 0.88rem;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
}
.jr-empty {
  font-size: 0.82rem;
  color: var(--ink-muted);
  text-align: center;
  padding: 14px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translate(-50%, 18px);
  background: var(--ink);
  color: var(--page);
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s, transform 0.4s var(--ease);
  z-index: 80;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .shell {
    padding: 0;
    gap: 0;
  }
  .rail {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    height: 100dvh;
    width: 286px;
    border-radius: 0 var(--r-4xl) var(--r-4xl) 0;
    transform: translateX(-104%);
    transition: transform 0.42s var(--ease);
  }
  .rail.open {
    transform: none;
  }
  .rail-brand .rail-close {
    display: grid;
  }
  .chat-card {
    border-radius: 0;
    border: none;
  }
  .menu {
    display: grid;
  }
  /* 手机端：目录靠上一点，避开输入框；点击展开 */
  .toc {
    top: 40%;
  }
  .toc-panel {
    width: min(232px, 78vw);
    max-height: 60vh;
  }
}
@media (max-width: 600px) {
  .msg-col {
    max-width: 88%;
  }
  .msgs,
  .chips,
  .composer,
  .attachments {
    padding-left: 16px;
    padding-right: 16px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.05ms !important;
  }
}

/* ---------- 移动端 App 化体验 ---------- */
html {
  -webkit-text-size-adjust: 100%;
}
* {
  -webkit-tap-highlight-color: transparent;
}
body {
  overscroll-behavior: none;
}
.msgs {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
@media (max-width: 980px) {
  /* iOS 安全区（刘海 / 底部横条） */
  .chat-head {
    padding-top: max(15px, env(safe-area-inset-top));
  }
  .rail {
    padding-top: max(22px, env(safe-area-inset-top));
    padding-bottom: max(22px, env(safe-area-inset-bottom));
  }
  .disclaimer {
    padding-bottom: max(14px, calc(env(safe-area-inset-bottom) + 6px));
  }
}
@media (max-width: 600px) {
  /* 防止 iOS 聚焦输入框时页面自动放大：字号需 ≥ 16px */
  .composer-input {
    font-size: 16px;
  }
  /* 登录弹窗输入框同理 */
  .login-input {
    font-size: 16px;
  }
}

/* ---------- 账号 / 登录 ---------- */
.rail-account {
  margin-top: 14px;
}
.rail-login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--r-xl);
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  color: var(--chip-tx);
  font-size: 0.88rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.22s, transform 0.22s var(--ease), box-shadow 0.22s;
}
.rail-login-btn:hover {
  background: var(--hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}
.rail-account-hint {
  margin-top: 7px;
  padding: 0 4px;
  font-size: 0.72rem;
  color: var(--ink-muted);
  text-align: center;
}
.rail-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-xl);
  border: 1px solid var(--hair);
  background: var(--inner);
}
.rail-user-ava {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: var(--serif);
  font-size: 0.9rem;
  background: var(--grad-ava);
  box-shadow: var(--shadow-soft);
}
.rail-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.rail-user-info b {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-user-info i {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--sage);
}
.rail-logout {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.rail-logout:hover {
  background: var(--hover);
  color: var(--danger);
}

/* 登录弹窗表单 */
.login-form {
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.login-label {
  font-size: 0.78rem;
  color: var(--ink-muted);
  padding-left: 2px;
}
.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-brd);
  background: var(--chip-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}
.login-input:focus {
  border-color: var(--lav-400);
}
.login-code-row {
  display: flex;
  gap: 10px;
}
.login-code-row .login-input {
  flex: 1;
}
.login-code-btn {
  flex-shrink: 0;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  color: var(--chip-tx);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.login-code-btn:hover:not(:disabled) {
  background: var(--hover);
}
.login-code-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.login-hint {
  min-height: 18px;
  font-size: 0.78rem;
  color: var(--sage);
  padding-left: 2px;
}
.login-hint.error {
  color: var(--danger);
}
.login-submit {
  width: 100%;
  margin-top: 2px;
}
.login-agreement {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--ink-muted);
  line-height: 1.5;
}
.login-agreement svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--sage);
}
.login-agreement strong {
  color: var(--ink-soft);
  font-weight: 600;
}

/* ---------- 游客对话同步 banner ---------- */
.sync-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 16px 0;
  padding: 10px 14px;
  border-radius: var(--r-xl);
  background: var(--chip-bg);
  border: 1px solid var(--chip-brd);
  font-size: 0.86rem;
  color: var(--ink-soft);
  animation: syncIn 0.4s var(--ease);
}
.sync-banner[hidden] {
  display: none;
}
@keyframes syncIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.sync-banner-ic {
  display: flex;
  flex-shrink: 0;
  color: var(--lav-500);
}
.sync-banner-text {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
}
.sync-banner-text b {
  color: var(--lav-600);
  font-weight: 600;
}
[data-theme="dark"] .sync-banner-text b {
  color: var(--lav-400);
}
.sync-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.sync-banner-go {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s var(--ease), filter 0.2s;
}
.sync-banner-go:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}
.sync-banner-go:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}
.sync-banner-dismiss {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.sync-banner-dismiss:hover {
  background: var(--hover);
  color: var(--ink);
}
@media (max-width: 600px) {
  .sync-banner {
    flex-wrap: wrap;
  }
  .sync-banner-text {
    flex-basis: calc(100% - 28px);
  }
  .sync-banner-actions {
    margin-left: auto;
  }
}

/* =========================================================
   合规组件（A 组）+ 会员额度（B 组）样式
   ========================================================= */

/* ---------- AI 身份显著标识（常驻条） ---------- */
/* ---------- AI 身份提示（首次进入弹一次，轻量可关闭；非常驻横幅） ---------- */
.ai-notice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 16px 0;
  padding: 9px 38px 9px 12px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--lav-700);
  background: linear-gradient(90deg, rgba(139, 110, 240, 0.12), rgba(139, 110, 240, 0.06));
  border: 1px solid var(--hair);
  border-radius: 12px;
}
.ai-notice[hidden] {
  display: none;
}
.ai-notice svg {
  flex-shrink: 0;
  color: var(--lav-600);
}
.ai-notice b {
  font-weight: 700;
}
.ai-notice-x {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.ai-notice-x:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}
[data-theme="dark"] .ai-notice {
  color: var(--lav-400);
  background: linear-gradient(90deg, rgba(139, 110, 240, 0.2), rgba(139, 110, 240, 0.08));
}
[data-theme="dark"] .ai-notice-x:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- 未成年保护模式（侧栏状态条，可退出；不再顶部挂横幅） ---------- */
.minor-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(74, 140, 112, 0.1);
  color: var(--sage);
}
.minor-bar[hidden] {
  display: none;
}
.minor-bar svg {
  flex-shrink: 0;
}
.minor-bar-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.minor-bar-info b {
  font-weight: 700;
  font-size: 0.78rem;
}
.minor-bar-info i {
  font-style: normal;
  font-size: 0.7rem;
  opacity: 0.82;
}
.minor-exit {
  margin-left: auto;
  flex-shrink: 0;
  padding: 4px 11px;
  border: 1px solid currentColor;
  background: transparent;
  color: var(--sage);
  border-radius: 999px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.2s;
}
.minor-exit:hover {
  background: rgba(74, 140, 112, 0.16);
}

/* ---------- 危机干预卡片（显眼但不惊吓，暖色调） ---------- */
.crisis-card {
  margin-top: 10px;
  width: min(100%, 540px);
  border: 1.5px solid rgba(200, 137, 75, 0.45);
  background: linear-gradient(180deg, rgba(200, 137, 75, 0.12), rgba(200, 137, 75, 0.05));
  border-radius: var(--r-2xl);
  padding: 14px 16px;
  box-shadow: 0 8px 28px -14px rgba(200, 137, 75, 0.5);
  animation: rise 0.5s var(--ease) both;
}
.crisis-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  color: #b3702f;
  font-weight: 700;
  font-size: 0.98rem;
}
.crisis-head svg {
  color: #c8894b;
  flex-shrink: 0;
}
.crisis-card p {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.6;
}
.crisis-lines {
  list-style: none;
  margin: 8px 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.crisis-lines li {
  font-size: 0.92rem;
  color: var(--ink);
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}
.crisis-lines li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c8894b;
}
.crisis-lines b {
  color: #b3702f;
  font-weight: 700;
  font-size: 1.02em;
}
.crisis-foot {
  margin-top: 8px;
  font-size: 0.86rem;
  color: var(--ink-muted);
}
[data-theme="dark"] .crisis-head,
[data-theme="dark"] .crisis-lines b {
  color: #e6b483;
}
[data-theme="dark"] .crisis-card {
  border-color: rgba(224, 168, 106, 0.4);
}

/* ---------- 额度用尽卡片（温柔，不报错） ---------- */
.quota-card {
  align-self: center;
  max-width: 460px;
  width: 100%;
  margin: 6px auto;
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  border-radius: var(--r-2xl);
  padding: 16px 18px;
  text-align: center;
  animation: rise 0.5s var(--ease) both;
}
.quota-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--lav-700);
  font-weight: 700;
  font-size: 0.96rem;
}
.quota-head svg {
  color: var(--lav-600);
}
.quota-card p {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.6;
}
.quota-btn {
  margin-top: 12px;
  padding: 8px 20px;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #fff;
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s var(--ease), filter 0.2s;
}
.quota-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}
/* 会员充值弹窗 */
.mb-plans { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.mb-plan {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border: 1px solid var(--chip-brd); border-radius: 14px;
  background: var(--chip-bg); cursor: pointer; text-align: left; width: 100%;
  transition: 0.15s;
}
.mb-plan:hover { border-color: var(--lav-400); transform: translateY(-1px); }
.mb-plan .mb-name { font-weight: 600; }
.mb-plan .mb-sub { font-size: 0.78rem; color: var(--ink-soft); margin-top: 2px; }
.mb-plan .mb-price { font-size: 1.05rem; font-weight: 700; color: var(--lav-500); white-space: nowrap; }
.mb-pay { margin-top: 10px; text-align: center; }
.mb-pay img { width: 200px; height: 200px; border-radius: 12px; border: 1px solid var(--chip-brd); }
.mb-pay .mb-confirm {
  margin-top: 10px; padding: 9px 22px; border-radius: 999px;
  background: var(--grad-primary); color: #fff; font-size: 0.9rem; border: none; cursor: pointer;
}
[data-theme="dark"] .quota-head {
  color: var(--lav-400);
}

/* ---------- 年龄确认弹窗 ---------- */
.age-desc {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 22px;
}
.age-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.age-actions .btn-primary {
  width: 100%;
}
.age-minor-btn {
  width: 100%;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--chip-brd);
  background: var(--chip-bg);
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.age-minor-btn:hover {
  background: var(--hover);
}

/* ---------- 用户协议 / 隐私政策弹窗 ---------- */
.legal-card {
  display: flex;
  flex-direction: column;
  max-height: 86vh;
  text-align: left;
}
.legal-card .modal-eyebrow,
.legal-card .modal-title {
  text-align: left;
}
.legal-body {
  overflow-y: auto;
  text-align: left;
  margin-top: 2px;
  padding-right: 6px;
}
.legal-body h4 {
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
  margin: 16px 0 6px;
}
.legal-body p {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.7;
  margin-bottom: 6px;
}
.legal-body b {
  color: var(--ink);
  font-weight: 600;
}
.legal-body .legal-updated {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* ---------- 登录同意勾选 + 内联链接按钮 ---------- */
.login-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.5;
  cursor: pointer;
}
.login-consent input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--lav-500);
  cursor: pointer;
}
.link-btn {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--lav-600);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover {
  color: var(--lav-700);
}
[data-theme="dark"] .link-btn {
  color: var(--lav-400);
}

/* ---------- 侧栏法务入口 ---------- */
.rail-legal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 8px 2px;
  font-size: 0.74rem;
  color: var(--ink-muted);
}
.rail-legal-link {
  color: var(--ink-muted);
  font-size: 0.74rem;
  font-family: inherit;
  cursor: pointer;
  transition: color 0.2s;
}
.rail-legal-link:hover {
  color: var(--lav-600);
  text-decoration: underline;
}

/* ---------- 防沉迷休息提醒 ---------- */
.rest-desc {
  font-size: 0.94rem;
  color: var(--ink-soft);
  line-height: 1.7;
  margin-bottom: 24px;
}

/* ---------- 会员标识 ---------- */
.vip-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #e0a86a, #c8894b);
  vertical-align: middle;
}

/* ---------- 页脚备案号（ICP + 公安联网备案）---------- */
.beian {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
  text-align: center;
  font-size: 0.68rem;
  line-height: 1.5;
  color: var(--ink-muted);
  padding: 0 24px 14px;
  max-width: 760px;
  margin: -6px auto 0;
}
.beian:empty {
  display: none;
}
.beian a {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.beian a:hover {
  color: var(--lav-600);
  text-decoration: underline;
}
.beian .beian-sep {
  opacity: 0.5;
}
.beian svg {
  flex-shrink: 0;
  opacity: 0.85;
}
@media (max-width: 900px) {
  .beian {
    padding-bottom: max(14px, calc(env(safe-area-inset-bottom) + 6px));
  }
}

/* ---------- 账号区：注销账号并删除数据 ---------- */
.rail-del-acc {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--r-xl);
  border: 1px solid transparent;
  background: none;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.76rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.rail-del-acc:hover {
  color: var(--danger);
  border-color: #f3cfca;
  background: rgba(192, 86, 75, 0.08);
}

/* ---------- 注销账号二次确认弹窗 ---------- */
.delacc-desc {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.7;
  margin: 4px 0 22px;
}
.delacc-desc b {
  color: var(--danger);
  font-weight: 600;
}
.delacc-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.delacc-confirm {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--r-xl);
  border: 1px solid var(--danger);
  background: rgba(192, 86, 75, 0.1);
  color: var(--danger);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.delacc-confirm:hover {
  background: rgba(192, 86, 75, 0.18);
}
.delacc-cancel {
  width: 100%;
}

/* ---------- 广场：帖子/评论操作（举报 / 删除）---------- */
.plaza-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
}
.plaza-act,
.plaza-cmt-act {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--glass-brd);
  background: var(--page);
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.plaza-act:hover,
.plaza-cmt-act:hover {
  background: var(--hover);
}
.plaza-del:hover {
  color: var(--danger);
  border-color: #f3cfca;
}
.plaza-cmt {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
}
.plaza-cmt-body {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}
.plaza-cmt-acts {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}
.plaza-cmt-act {
  padding: 2px 8px;
  font-size: 0.68rem;
}
