/* ==================================================================
   甜甜·梦游记录 · 手机 PWA 设计系统
   ------------------------------------------------------------------
   1. 设计令牌 / 深浅主题
   2. 基础重置与应用外壳
   3. 通用组件：按钮 / 表单 / 徽章 / 弹层 / toast / 骨架屏
   4. 页面：世界图鉴 / 对话 / 创世 / 搜索 / 草稿 / 设置 / 调试
   5. 响应式与无障碍

   视觉母题：π/4 旋转正方形（菱形）。图标全部为内联 SVG，不依赖外部资源。
   ================================================================== */

/* ========== 1. 设计令牌 ========== */

:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-hand: "LXGW WenKai", "LXGW WenKai TC", "KaiTi", "STKaiti", "Kaiti SC", "Songti SC",
    "Noto Serif CJK SC", cursive, serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, "Liberation Mono", monospace;

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 28px;

  --touch: 44px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --dur-fast: 0.16s;
  --dur: 0.24s;
  --ease: cubic-bezier(0.2, 0.9, 0.25, 1);

  --font-size: 15px;
  --line-height: 1.6;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b14;
  --bg-2: #101321;
  --bg-elev: #161a2c;
  --fg: #eef0ff;
  --fg-soft: #cdd2ea;
  --fg-muted: #98a0c2;
  --fg-faint: #6d769b;

  --card: rgba(23, 27, 46, 0.86);
  --card-solid: #171b2e;
  --card-hover: rgba(32, 37, 60, 0.92);
  --composer-bg: rgba(23, 27, 46, 0.94);
  --toast-bg: rgba(26, 30, 50, 0.96);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.17);

  --primary: #8b5cf6;
  --primary-strong: #7c3aed;
  --accent: #a78bfa;
  --accent-2: #22d3ee;
  --accent-3: #f472b6;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.13);
  --danger: #fb7185;
  --danger-strong: #e11d48;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --info: #60a5fa;
  --info-soft: rgba(96, 165, 250, 0.14);
  --violet: #c4b5fd;
  --violet-soft: rgba(167, 139, 250, 0.16);
  --green: #34d399;
  --green-strong: #059669;

  --shadow-card: 0 10px 32px rgba(0, 0, 0, 0.3);
  --shadow-float: 0 18px 48px rgba(0, 0, 0, 0.48);
  --shadow-c: 0 0 0 1px rgba(255, 255, 255, 0.05);

  --aurora-1: rgba(139, 92, 246, 0.30);
  --aurora-2: rgba(34, 211, 238, 0.16);
  --aurora-3: rgba(244, 114, 182, 0.18);
  --overlay: rgba(4, 5, 12, 0.66);
  --skel-base: rgba(255, 255, 255, 0.06);
  --skel-shine: rgba(255, 255, 255, 0.13);

  --theme-color: #090b14;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f6fc;
  --bg-2: #ffffff;
  --bg-elev: #ffffff;
  --fg: #1b2036;
  --fg-soft: #353c59;
  --fg-muted: #68708f;
  --fg-faint: #99a0b8;

  --card: rgba(255, 255, 255, 0.9);
  --card-solid: #ffffff;
  --card-hover: #ffffff;
  --composer-bg: rgba(255, 255, 255, 0.97);
  --toast-bg: rgba(30, 34, 56, 0.95);
  --line: rgba(27, 32, 54, 0.09);
  --line-strong: rgba(27, 32, 54, 0.17);

  --primary: #7c3aed;
  --primary-strong: #6d28d9;
  --accent: #7c3aed;
  --accent-2: #0891b2;
  --accent-3: #db2777;
  --ok: #059669;
  --ok-soft: rgba(5, 150, 105, 0.12);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.12);
  --danger: #e11d48;
  --danger-strong: #be123c;
  --danger-soft: rgba(225, 29, 72, 0.1);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.1);
  --violet: #6d28d9;
  --violet-soft: rgba(124, 58, 237, 0.12);
  --green: #059669;
  --green-strong: #047857;

  --shadow-card: 0 10px 28px rgba(46, 50, 90, 0.09);
  --shadow-float: 0 22px 54px rgba(38, 42, 78, 0.2);
  --shadow-c: 0 0 0 1px rgba(27, 32, 54, 0.03);

  --aurora-1: rgba(139, 92, 246, 0.18);
  --aurora-2: rgba(8, 145, 178, 0.10);
  --aurora-3: rgba(219, 39, 119, 0.10);
  --overlay: rgba(24, 27, 48, 0.45);
  --skel-base: rgba(27, 32, 54, 0.07);
  --skel-shine: rgba(27, 32, 54, 0.12);

  --theme-color: #f5f6fc;
}

/* ========== 2. 基础重置与应用外壳 ========== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: var(--font-size);
  line-height: var(--line-height);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 背景极光（纯 CSS，无外部图片） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--bg);
}

body::after {
  content: "";
  position: fixed;
  inset: -18%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(38% 32% at 12% 0%, var(--aurora-1), transparent 70%),
    radial-gradient(30% 26% at 92% 12%, var(--aurora-2), transparent 72%),
    radial-gradient(34% 30% at 70% 100%, var(--aurora-3), transparent 70%);
  filter: blur(6px);
}

body.is-locked {
  overflow: hidden;
}

h1, h2, h3, h4, p, ul, ol, pre {
  margin: 0;
}

ul, ol {
  padding-left: 1.1em;
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
}

svg {
  display: block;
  flex: none;
}

.icon {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 6px;
}

.muted {
  color: var(--fg-muted);
}

.small {
  font-size: 12px;
}

.link-btn {
  background: none;
  border: none;
  padding: 6px 2px;
  color: var(--accent);
  font-size: 12.5px;
  cursor: pointer;
  min-height: 32px;
}

.link-btn:hover {
  text-decoration: underline;
}

#app {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}

/* 顶部状态栏 */
.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(8px + var(--safe-t)) calc(14px + var(--safe-r)) 8px calc(14px + var(--safe-l));
  position: relative;
  z-index: 20;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
  opacity: 0.7;
}

.topbar__brand {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.brand-logo {
  width: 26px;
  height: 26px;
  margin: 5px 6px 5px 5px;
  flex: none;
  border-radius: 8px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.45);
  display: grid;
  place-items: center;
  position: relative;
}

.brand-logo::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.55), transparent 46%);
  opacity: 0.5;
}

.brand-logo__inner {
  width: 9px;
  height: 9px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 2px;
  opacity: 0.9;
}

.brand-text {
  min-width: 0;
}

.brand-title {
  font-family: var(--font-hand);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  background: linear-gradient(100deg, var(--fg), var(--accent) 60%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.brand-sub {
  font-size: 10.5px;
  color: var(--fg-muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg-soft);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast);
}

.theme-btn:active {
  transform: scale(0.92);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--fg-soft);
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color var(--dur-fast);
}

.status-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fg-faint);
  flex: none;
}

.status-pill.is-online {
  border-color: rgba(52, 211, 153, 0.4);
}

.status-pill.is-online .status-pill__dot {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  animation: pulse-ok 2.4s infinite;
}

.status-pill.is-offline .status-pill__dot {
  background: var(--warn);
}

.status-pill.is-offline {
  border-color: rgba(251, 191, 36, 0.4);
}

.status-pill.is-warn {
  border-color: rgba(251, 113, 133, 0.5);
}

.status-pill.is-warn .status-pill__dot {
  background: var(--danger);
}

.banners {
  flex: 0 0 auto;
  padding: 0 calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  position: relative;
  z-index: 18;
}

.banners:not([hidden]) {
  padding-top: 2px;
  padding-bottom: 2px;
}

.view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  position: relative;
  z-index: 2;
}

body[data-route="chat"] .view {
  overflow: hidden;
}

/* 底部导航 */
.tabbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 5px calc(8px + var(--safe-r)) calc(5px + var(--safe-b)) calc(8px + var(--safe-l));
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 82%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  position: relative;
  z-index: 20;
}

body[data-route="chat"] .tabbar {
  display: none;
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  border-radius: 14px;
  color: var(--fg-muted);
  text-decoration: none;
  position: relative;
  transition: color var(--dur-fast), background var(--dur-fast);
}

.tab:active {
  background: var(--line);
}

.tab.is-active {
  color: var(--accent);
  background: linear-gradient(180deg, transparent, var(--violet-soft));
}

.tab__icon {
  display: grid;
  place-items: center;
  height: 24px;
  transition: transform var(--dur-fast) var(--ease);
}

.tab.is-active .tab__icon {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 8px rgba(167, 139, 250, 0.55));
}

.tab__label {
  font-size: 10.5px;
  line-height: 1.1;
  letter-spacing: 0.03em;
}

.tab__dot {
  width: 4px;
  height: 4px;
  margin-top: 1px;
  border-radius: 1px;
  transform: rotate(45deg);
  background: currentColor;
  opacity: 0;
  transition: opacity var(--dur-fast);
}

.tab.is-active .tab__dot {
  opacity: 1;
}

/* 启动屏 */
.boot {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background:
    radial-gradient(60% 45% at 50% 30%, var(--aurora-1), transparent 70%),
    var(--bg);
  transition: opacity 0.3s var(--ease);
}

.boot--out {
  opacity: 0;
  pointer-events: none;
}

.boot__mark {
  position: relative;
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
}

.boot__diamond {
  position: absolute;
  width: 58px;
  height: 58px;
  border: 2px solid var(--accent);
  border-radius: 14px;
  transform: rotate(45deg);
  animation: boot-spin 3.4s linear infinite;
  box-shadow: 0 0 30px rgba(167, 139, 250, 0.35);
}

.boot__diamond--inner {
  width: 30px;
  height: 30px;
  border-color: var(--accent-2);
  border-radius: 8px;
  animation: boot-spin 2.2s linear infinite reverse;
}

.boot__title {
  font-family: var(--font-hand);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(100deg, var(--fg), var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.boot__hint {
  font-size: 12px;
  color: var(--fg-muted);
  letter-spacing: 0.18em;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 4000;
  padding: 14px;
  border-radius: 14px;
  background: var(--danger);
  color: #fff;
  text-align: center;
}

/* ========== 3. 通用组件 ========== */

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch);
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--fg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast), background var(--dur-fast);
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.btn__icon {
  display: grid;
  place-items: center;
}

.btn--sm {
  min-height: 38px;
  padding: 0 12px;
  font-size: 12.5px;
  border-radius: 10px;
}

.btn--block {
  width: 100%;
}

.btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.3);
}

.btn--green {
  border-color: transparent;
  background: linear-gradient(135deg, var(--green), var(--green-strong));
  color: #fff;
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.28);
}

.btn--danger {
  border-color: rgba(251, 113, 133, 0.4);
  background: var(--danger-soft);
  color: var(--danger);
}

.btn--danger-solid {
  border-color: transparent;
  background: linear-gradient(135deg, var(--danger), var(--danger-strong));
  color: #fff;
}

.btn--ghost {
  border-color: transparent;
  background: transparent;
  color: var(--fg-soft);
}

.btn--ghost:hover {
  background: var(--line);
}

.btn.is-busy {
  pointer-events: none;
  opacity: 0.8;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-soft);
  cursor: pointer;
  transition: background var(--dur-fast), transform var(--dur-fast);
}

.icon-btn:active {
  transform: scale(0.92);
}

.icon-btn:hover {
  background: var(--line);
}

/* --- 声明式分隔 / 页面容器 --- */
.page {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  padding: 10px calc(14px + var(--safe-r)) calc(28px + var(--safe-b)) calc(14px + var(--safe-l));
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin: 4px 0 14px;
}

.page-head__titles {
  min-width: 0;
}

.page-title {
  font-family: var(--font-hand);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  background: linear-gradient(100deg, var(--fg), var(--accent) 75%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--fg-muted);
}

.page-head__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: none;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 10px;
}

.toolbar__label {
  font-size: 12px;
  color: var(--fg-muted);
  flex: none;
}

.list-status {
  margin: 10px 0;
  font-size: 12px;
  color: var(--fg-muted);
}

.list-status:empty {
  display: none;
}

.list-status__text {
  display: block;
  padding: 2px 2px;
}

/* --- 表单 --- */
.input {
  width: 100%;
  min-height: var(--touch);
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--bg-elev);
  color: var(--fg);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  -webkit-appearance: none;
  appearance: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--violet-soft);
}

.input::placeholder {
  color: var(--fg-faint);
}

.textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.6;
}

.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-muted) 50%),
    linear-gradient(135deg, var(--fg-muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.code-area {
  font-family: var(--font-mono);
  font-size: 12.5px;
  min-height: 240px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  min-width: 0;
}

.field__label {
  font-size: 12.5px;
  color: var(--fg-soft);
  font-weight: 500;
}

.field__hint {
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.45;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid {
  display: flex;
  flex-direction: column;
}

.form-errors {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}

.form-error {
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 7px 10px;
}

.form-hint {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 8px;
}

.form-actions {
  margin-top: 8px;
}

.input-with-suffix {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-with-suffix .input {
  padding-right: 48px;
}

.input-suffix-btn {
  position: absolute;
  right: 2px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
}

/* 开关 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  cursor: pointer;
  user-select: none;
}

.switch__input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch__track {
  width: 46px;
  height: 27px;
  border-radius: 999px;
  background: var(--line-strong);
  position: relative;
  transition: background var(--dur);
  flex: none;
}

.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: transform var(--dur) var(--ease);
}

.switch__input:checked + .switch__track {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.switch__input:checked + .switch__track .switch__thumb {
  transform: translateX(19px);
}

.switch__input:focus-visible + .switch__track {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.switch__label {
  font-size: 13.5px;
  color: var(--fg-soft);
}

/* 滑杆 */
.range {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--touch);
}

.range__input {
  flex: 1;
  accent-color: var(--primary);
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--line-strong);
  border-radius: 999px;
  outline: none;
}

.range__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--accent), var(--primary));
  border: 2px solid var(--bg-2);
  box-shadow: 0 3px 10px rgba(124, 58, 237, 0.4);
  cursor: pointer;
}

.range__input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--primary);
  border: 2px solid var(--bg-2);
  cursor: pointer;
}

.range__value {
  min-width: 42px;
  text-align: center;
  font-size: 13px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* 分段控件 */
.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

.segmented::-webkit-scrollbar {
  display: none;
}

.segmented--block {
  display: flex;
  width: 100%;
}

.segmented__item {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  padding: 0 13px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12.5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}

.segmented__item.is-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.26);
}

/* --- 徽章 / chips --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 7px;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}

.badge--neutral {
  color: var(--fg-muted);
  background: var(--line);
}

.badge--ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(52, 211, 153, 0.25);
}

.badge--warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.25);
}

.badge--danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.28);
}

.badge--info {
  color: var(--info);
  background: var(--info-soft);
  border-color: rgba(96, 165, 250, 0.25);
}

.badge--violet {
  color: var(--violet);
  background: var(--violet-soft);
  border-color: rgba(167, 139, 250, 0.3);
}

.badge__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chips--sm {
  gap: 5px;
}

.chips--tags {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0 8px;
  margin-bottom: 2px;
}

.chips--tags::-webkit-scrollbar,
.chips--filters::-webkit-scrollbar {
  display: none;
}

.chips--filters {
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 2px 0;
  margin-bottom: 4px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg-soft);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  flex: none;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}

.chip.is-active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.chip--static {
  cursor: default;
  min-height: 26px;
  padding: 1px 9px;
  font-size: 11px;
  background: var(--line);
  border-color: transparent;
  color: var(--fg-muted);
}

.chip--xs {
  min-height: 22px;
  padding: 0 7px;
  font-size: 10.5px;
}

.chip__count {
  font-size: 10px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

.keyword-chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--violet-soft);
  color: var(--violet);
  font-size: 11px;
}

.stat-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--fg-muted);
}

.stat-chip strong {
  font-size: 14px;
  color: var(--accent);
}

/* --- 提示条 --- */
.notice-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.45;
  border: 1px solid transparent;
  margin: 6px 0;
}

.notice-bar__icon {
  display: grid;
  place-items: center;
  flex: none;
}

.notice-bar__text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.notice-bar__action {
  flex: none;
  border: none;
  background: transparent;
  color: currentColor;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
  padding: 8px 4px;
  cursor: pointer;
  min-height: 36px;
}

.notice-bar--warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.22);
}

.notice-bar--danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(251, 113, 133, 0.25);
}

.notice-bar--info {
  color: var(--info);
  background: var(--info-soft);
  border-color: rgba(96, 165, 250, 0.22);
}

.notice-bar--ok {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: rgba(52, 211, 153, 0.22);
}

/* --- 空状态 / 错误 / 加载 --- */
.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 40px 24px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--line-strong);
  background: color-mix(in srgb, var(--card) 60%, transparent);
  margin: 16px 0;
}

.empty-state__icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  transform: rotate(45deg);
  color: var(--accent);
  background: var(--violet-soft);
  border: 1px solid rgba(167, 139, 250, 0.28);
  margin-bottom: 6px;
}

.empty-state__icon svg {
  transform: rotate(-45deg);
}

.empty-state__title,
.error-state__title {
  font-family: var(--font-hand);
  font-size: 17px;
  font-weight: 700;
}

.empty-state__desc,
.error-state__desc {
  font-size: 12.5px;
  color: var(--fg-muted);
  max-width: 320px;
}

.error-state__icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--danger);
  background: var(--danger-soft);
}

.error-state .btn {
  margin-top: 6px;
}

.loading-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 32px 16px;
  color: var(--fg-muted);
  font-size: 13px;
}

.spinner {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex: none;
}

.spinner--sm {
  width: 15px;
  height: 15px;
  border-width: 2px;
}

/* 骨架屏 */
.skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skeleton {
  border-radius: 8px;
  background: linear-gradient(100deg, var(--skel-base) 25%, var(--skel-shine) 42%, var(--skel-base) 60%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

.skeleton-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
}

.skeleton--title {
  height: 16px;
  width: 46%;
  margin-bottom: 12px;
}

.skeleton--line {
  height: 11px;
  width: 100%;
  margin-bottom: 8px;
}

.skeleton--line.short {
  width: 68%;
}

.skeleton--chips {
  height: 20px;
  width: 42%;
  margin-top: 12px;
  border-radius: 999px;
}

.skeleton-chat {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.skeleton-msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 78%;
}

.skeleton-msg.right {
  align-self: flex-end;
  align-items: flex-end;
}

.skeleton--bubble {
  width: 260px;
  max-width: 100%;
  height: 64px;
  border-radius: 16px;
}

/* --- toast --- */
.toast-root {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(78px + var(--safe-b));
  z-index: 2500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(560px, 100%);
  padding: 10px 14px;
  border-radius: 13px;
  background: var(--toast-bg);
  color: #f4f6ff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow-float);
  font-size: 12.5px;
  line-height: 1.45;
  animation: toast-in 0.22s var(--ease);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.toast--out {
  animation: toast-out 0.2s ease forwards;
}

.toast__icon {
  display: grid;
  place-items: center;
  flex: none;
}

.toast__text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast__action {
  flex: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 12px;
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  min-height: 32px;
}

.toast--info .toast__icon {
  color: #93c5fd;
}

.toast--success .toast__icon {
  color: #6ee7b7;
}

.toast--warn .toast__icon {
  color: #fcd34d;
}

.toast--error .toast__icon {
  color: #fda4af;
}

/* --- 遮罩 / 底部弹层 / 对话框 --- */
.modal-root {
  position: relative;
  z-index: 1200;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--overlay);
  opacity: 0;
  transition: opacity 0.2s ease;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.overlay.is-open {
  opacity: 1;
}

.overlay--closing {
  opacity: 0;
}

.overlay--dialog {
  align-items: center;
  padding: calc(18px + var(--safe-t)) 18px calc(18px + var(--safe-b));
}

.sheet {
  width: 100%;
  max-width: 660px;
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  border-radius: 24px 24px 0 0;
  border: 1px solid var(--line-strong);
  border-bottom: none;
  background: var(--bg-2);
  box-shadow: 0 -18px 60px rgba(0, 0, 0, 0.45);
  transform: translateY(100%);
  transition: transform 0.26s var(--ease);
  padding-bottom: var(--safe-b);
  position: relative;
}

.overlay.is-open .sheet {
  transform: translateY(0);
}

.sheet--full {
  height: 92dvh;
  max-height: 92dvh;
}

.sheet__grab {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 8px auto 2px;
  flex: none;
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 16px 10px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.sheet__titles {
  min-width: 0;
}

.sheet__title {
  font-family: var(--font-hand);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}

.sheet__subtitle {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--fg-muted);
}

.sheet__close {
  margin: -4px -6px 0 0;
}

.sheet__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 16px calc(20px + var(--safe-b));
  overscroll-behavior: contain;
}

.sheet__actions {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px calc(12px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}

.sheet__actions:empty,
.sheet__actions[hidden] {
  display: none;
}

.sheet__actions .btn {
  flex: 1 1 130px;
}

.dialog {
  width: 100%;
  max-width: 400px;
  border-radius: 22px;
  border: 1px solid var(--line-strong);
  background: var(--bg-2);
  box-shadow: var(--shadow-float);
  padding: 18px 18px calc(16px + var(--safe-b));
  transform: scale(0.94);
  opacity: 0;
  transition: transform 0.22s var(--ease), opacity 0.18s ease;
}

.overlay.is-open .dialog {
  transform: scale(1);
  opacity: 1;
}

.dialog__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.dialog__badge {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--violet-soft);
  flex: none;
}

.dialog__badge.is-danger {
  color: var(--danger);
  background: var(--danger-soft);
}

.dialog__title {
  font-family: var(--font-hand);
  font-size: 18px;
  font-weight: 700;
}

.dialog__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialog__message {
  font-size: 13.5px;
  color: var(--fg-soft);
  overflow-wrap: anywhere;
}

.dialog__hint {
  font-size: 11.5px;
  color: var(--warn);
}

.dialog__count {
  font-variant-numeric: tabular-nums;
}

.dialog__actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.dialog__actions .btn {
  flex: 1;
}

/* --- 操作菜单 --- */
.action-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.action-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}

.action-item:hover,
.action-item:active {
  background: var(--line);
}

.action-item.is-danger {
  color: var(--danger);
}

.action-item__icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--violet-soft);
  color: var(--accent);
  flex: none;
}

.action-item.is-danger .action-item__icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.action-item__main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.action-item__main strong {
  font-size: 14px;
  font-weight: 500;
}

.action-item__main small {
  font-size: 11.5px;
  color: var(--fg-muted);
}

/* --- 键值 / JSON / 进度 --- */
.kv-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kv-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
}

.kv-item__key {
  color: var(--fg-muted);
  flex: none;
}

.kv-item__value {
  color: var(--fg-soft);
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
}

.kv-paragraph {
  font-size: 13px;
  color: var(--fg-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-block {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: auto;
  max-height: 46dvh;
  padding: 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 70%, var(--card));
  border: 1px solid var(--line);
  color: var(--fg-soft);
  margin: 8px 0;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.progress__track {
  flex: 1;
  height: 7px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width var(--dur) var(--ease);
}

.progress__label {
  font-size: 11px;
  color: var(--fg-muted);
  flex: none;
}

/* --- 数据表格 --- */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--line);
  margin-top: 8px;
}

.data-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 11.5px;
}

.data-table th,
.data-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data-table th {
  color: var(--fg-muted);
  font-weight: 500;
  background: var(--line);
  position: sticky;
  top: 0;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr.is-fail td {
  color: var(--danger);
}

/* 高亮命中 */
.hl {
  font-style: normal;
  background: linear-gradient(transparent 52%, var(--violet-soft) 52%);
  color: var(--accent);
  border-radius: 2px;
  padding: 0 1px;
}

em {
  font-style: normal;
}

/* 菱形母题 */
.diamond-mark {
  display: inline-block;
  position: relative;
  flex: none;
  border-radius: 4px;
  transform: rotate(45deg);
  border: 1.5px solid var(--accent);
  background: linear-gradient(135deg, var(--violet-soft), transparent);
  margin: 2px 4px;
}

.diamond-mark__dot {
  position: absolute;
  inset: 32%;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.75;
}

/* ========== 4. 页面 ========== */

/* ---------- 4.1 世界图鉴 ---------- */

.world-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.world-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 15px 15px 13px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast), background var(--dur-fast);
  overflow: hidden;
}

.world-card::before {
  content: "";
  position: absolute;
  left: -14px;
  top: -14px;
  width: 48px;
  height: 48px;
  transform: rotate(45deg);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--violet-soft), transparent);
  pointer-events: none;
}

.world-card:active {
  transform: scale(0.985);
  border-color: var(--line-strong);
}

.world-card__top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.world-card__name {
  flex: 1;
  min-width: 0;
  font-family: var(--font-hand);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-card__summary {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.world-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
  font-size: 10.5px;
  color: var(--fg-muted);
}

.world-card__stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.world-card__time {
  margin-left: auto;
  color: var(--fg-faint);
}

/* 世界详情 */
.world-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.world-detail__summary {
  font-size: 13.5px;
  color: var(--fg-soft);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.world-detail__stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 9px 4px;
  border-radius: 12px;
  background: var(--line);
  border: 1px solid transparent;
}

.stat-box strong {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.stat-box span {
  font-size: 10px;
  color: var(--fg-muted);
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.detail-section__title {
  font-family: var(--font-hand);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--fg-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-section__title::before {
  content: "";
  width: 8px;
  height: 8px;
  transform: rotate(45deg);
  border-radius: 2px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  flex: none;
}

.rule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.rule-item {
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}

.rule-item__key {
  font-size: 10.5px;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.rule-item__value {
  margin-top: 2px;
  font-size: 12px;
  color: var(--fg-soft);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.bullet-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bullet-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: var(--fg-soft);
  line-height: 1.55;
}

.bullet-dot {
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 1px;
  transform: rotate(45deg);
  background: var(--accent);
  flex: none;
}

.bullet-item--secret .bullet-dot {
  background: var(--danger);
}

.bullet-item--secret {
  color: var(--danger);
  opacity: 0.9;
}

.char-list,
.foreshadow-list,
.memory-list,
.window-mini-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.char-card {
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.char-card__top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.char-card__name {
  font-family: var(--font-hand);
  font-size: 15px;
  flex: 1;
  min-width: 0;
}

.char-card__identity {
  font-size: 12px;
  color: var(--fg-soft);
  overflow-wrap: anywhere;
}

.char-card__style,
.char-card__rel,
.char-card__taboo {
  font-size: 11.5px;
  color: var(--fg-muted);
  overflow-wrap: anywhere;
}

.char-card__taboo {
  color: var(--danger);
  opacity: 0.85;
}

.foreshadow-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.foreshadow-item__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.foreshadow-item__detail,
.foreshadow-item__due {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.foreshadow-item__due {
  color: var(--warn);
  opacity: 0.85;
}

.memory-item {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.memory-item__top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
}

.memory-item__imp {
  font-size: 10.5px;
  color: var(--warn);
}

.memory-item__content {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.window-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 54px;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}

.window-mini:active {
  background: var(--line);
}

.window-mini__arrow {
  margin-left: auto;
  color: var(--fg-muted);
}

.window-mini__name {
  font-size: 14px;
  font-weight: 500;
}

.window-mini__sum {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--fg-muted);
}

/* ---------- 4.2 对话页 ---------- */

.chat-page {
  height: 100%;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
}

.window-tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px calc(8px + var(--safe-r)) 6px calc(8px + var(--safe-l));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-2) 55%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  position: relative;
  z-index: 10;
}

.window-tabs__scroll {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
}

.window-tabs__scroll::-webkit-scrollbar {
  display: none;
}

.window-tab {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  min-width: 76px;
  min-height: 46px;
  padding: 5px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg-muted);
  cursor: pointer;
  position: relative;
  transition: border-color var(--dur-fast), color var(--dur-fast), background var(--dur-fast);
}

.window-tab.is-active {
  color: var(--fg);
  border-color: rgba(167, 139, 250, 0.55);
  background: linear-gradient(160deg, var(--violet-soft), var(--card));
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.16);
}

.window-tab.is-active::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  transform: rotate(45deg);
  background: var(--accent-2);
}

.window-tab__title {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window-tab__world {
  font-size: 9.5px;
  color: var(--fg-faint);
  line-height: 1.3;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.window-tab__badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 9.5px;
  display: grid;
  place-items: center;
}

.window-tabs__empty {
  font-size: 11.5px;
  color: var(--fg-faint);
  padding: 12px;
}

.window-tabs__add,
.window-tabs__more {
  width: 40px;
  height: 40px;
  min-width: 40px;
}

.chat-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: 12px calc(12px + var(--safe-r)) 10px calc(12px + var(--safe-l));
  scrollbar-width: thin;
}

.chat-loadmore {
  display: flex;
  justify-content: center;
  padding: 4px 0 10px;
}

.chat-anchor {
  height: 4px;
}

.msg-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 34px 18px;
}

.chat-hero__mark {
  margin-bottom: 6px;
  animation: float-soft 4s ease-in-out infinite;
}

.chat-hero__title {
  font-family: var(--font-hand);
  font-size: 20px;
  font-weight: 700;
  background: linear-gradient(100deg, var(--fg), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.chat-hero__desc {
  font-size: 12.5px;
  color: var(--fg-muted);
  max-width: 300px;
}

.chat-hero__prompts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}

.prompt-chip {
  max-width: 100%;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg-soft);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.prompt-chip:active {
  border-color: var(--accent);
}

/* 消息 */
.msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 100%;
  animation: msg-in 0.24s var(--ease);
}

.msg--user {
  flex-direction: row-reverse;
}

.msg__avatar {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  margin-top: 2px;
  font-size: 11px;
  font-weight: 600;
}

.msg--user .msg__avatar {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  border-radius: 9px;
}

.msg--assistant .msg__avatar {
  background: var(--card);
  border: 1px solid var(--line);
}

.msg__main {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  max-width: calc(100% - 42px);
}

.msg--user .msg__main {
  align-items: flex-end;
}

.msg--assistant .msg__main {
  align-items: flex-start;
}

.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}

.msg--assistant .bubble {
  background: var(--card);
  border: 1px solid var(--line);
  border-top-left-radius: 5px;
  color: var(--fg);
}

.msg--user .bubble {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  border-top-right-radius: 5px;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.22);
}

.bubble--error {
  border-color: rgba(251, 113, 133, 0.4);
  background: color-mix(in srgb, var(--danger-soft) 55%, var(--card));
}

.bubble__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(251, 113, 133, 0.35);
  color: var(--danger);
  font-size: 12.5px;
  line-height: 1.5;
}

.bubble__error svg {
  margin-top: 2px;
}

.stream-cursor {
  display: inline-block;
  width: 7px;
  height: 1.02em;
  margin-left: 2px;
  vertical-align: -0.12em;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  animation: cursor-blink 1s steps(2, start) infinite;
}

.msg__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  color: var(--fg-faint);
  padding: 0 3px;
}

.msg__finish.is-warn {
  color: var(--warn);
}

.msg__finish.is-error {
  color: var(--danger);
}

.msg__model {
  opacity: 0.8;
}

.msg__status {
  font-size: 10.5px;
  color: var(--accent-2);
  padding: 0 3px;
}

.msg__extras {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  max-width: 100%;
}

.msg--user .msg__extras {
  justify-content: flex-end;
}

.msg__pending-tag {
  font-size: 10.5px;
  color: var(--accent);
  background: var(--violet-soft);
  padding: 2px 8px;
  border-radius: 6px;
}

.msg__retry {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-muted);
  padding: 2px;
}

.memory-hits__toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px dashed rgba(167, 139, 250, 0.45);
  background: transparent;
  color: var(--accent);
  font-size: 10.5px;
  cursor: pointer;
}

.memory-hits__chevron {
  display: grid;
  place-items: center;
  transition: transform var(--dur-fast);
}

.memory-hits__chevron.is-open {
  transform: rotate(180deg);
}

.memory-hits__list {
  display: none;
  flex-wrap: wrap;
  gap: 5px;
  padding-top: 3px;
}

.memory-hits__list.is-open {
  display: flex;
}

.memory-hits__static {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--fg-faint);
  padding: 2px 4px;
}

.hit-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px solid rgba(167, 139, 250, 0.35);
  background: var(--violet-soft);
  color: var(--accent);
  font-size: 10.5px;
  cursor: pointer;
  max-width: 100%;
}

.hit-chip__title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}

.hit-chip__score {
  font-size: 9px;
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.notice-line {
  width: 100%;
  font-size: 11px;
  color: var(--fg-muted);
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--line);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.notice-line--warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.notice-line--info {
  color: var(--info);
  background: var(--info-soft);
}

.notice-line--error {
  color: var(--danger);
  background: var(--danger-soft);
}

/* 红绿按钮（拇指区） */
.fate-bar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  padding: 7px calc(12px + var(--safe-r)) 7px calc(12px + var(--safe-l));
  position: relative;
  z-index: 8;
}

.fate-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast), box-shadow var(--dur-fast);
  position: relative;
  overflow: hidden;
}

.fate-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.22), transparent 55%);
  pointer-events: none;
}

.fate-btn--red {
  background: linear-gradient(135deg, var(--danger), var(--danger-strong));
  box-shadow: 0 8px 22px rgba(225, 29, 72, 0.3);
}

.fate-btn--green {
  background: linear-gradient(135deg, var(--green), var(--green-strong));
  box-shadow: 0 8px 22px rgba(5, 150, 105, 0.3);
}

.fate-btn:active {
  transform: scale(0.97);
}

.fate-btn:disabled {
  opacity: 0.45;
  filter: grayscale(0.4);
  cursor: not-allowed;
}

.fate-btn__icon {
  display: grid;
  place-items: center;
}

.fate-btn__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  text-align: left;
}

.fate-btn__text strong {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.fate-btn__text small {
  font-size: 9.5px;
  opacity: 0.82;
  font-weight: 400;
}

.fate-btn.is-running {
  animation: pulse-danger 0.9s ease-in-out infinite;
}

.fate-btn.is-success {
  animation: success-flash 1s ease;
}

/* 熔断面板 / 结果 */
.fate-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fate-panel__lead {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.6;
}

.fate-option {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  padding: 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}

.fate-option:active {
  transform: scale(0.99);
}

.fate-option__icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  flex: none;
}

.fate-option--context .fate-option__icon {
  color: var(--accent);
  background: var(--violet-soft);
}

.fate-option--world .fate-option__icon {
  color: var(--danger);
  background: var(--danger-soft);
}

.fate-option--world {
  border-color: rgba(251, 113, 133, 0.32);
}

.fate-option__main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.fate-option__main strong {
  font-size: 14px;
}

.fate-option__main small {
  font-size: 11.5px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.fate-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.fate-result__message {
  font-size: 13.5px;
  color: var(--fg-soft);
  line-height: 1.6;
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--violet-soft);
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.fate-result__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.fate-result__col {
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--card);
}

.fate-result__col h4 {
  font-size: 12.5px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.fate-result__col h4::before {
  content: "";
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: currentColor;
  border-radius: 1px;
}

.fate-result__col--cleared h4 {
  color: var(--danger);
}

.fate-result__col--kept h4 {
  color: var(--ok);
}

.fate-result__col ul {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11.5px;
  color: var(--fg-soft);
}

/* 输入区 */
.composer {
  flex: 0 0 auto;
  padding: 4px calc(10px + var(--safe-r)) calc(8px + var(--safe-b)) calc(10px + var(--safe-l));
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--bg) 75%, transparent) 40%);
  position: relative;
  z-index: 9;
}

.composer__box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 15px;
  border-radius: 24px;
  border: 1px solid var(--line-strong);
  background: var(--composer-bg);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.16);
}

.composer__input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 150px;
  padding: 11px 0;
  border: none;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  resize: none;
  outline: none;
}

.composer__input::placeholder {
  color: var(--fg-faint);
}

.composer__send {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--primary-strong));
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.35);
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast);
}

.composer__send:active {
  transform: scale(0.92);
}

.composer__send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.composer__send.is-stop {
  background: linear-gradient(135deg, var(--danger), var(--danger-strong));
  animation: pulse-danger 1.2s infinite;
}

.composer__hint {
  display: flex;
  justify-content: center;
  padding-top: 4px;
}

.composer__hint-text {
  font-size: 9.5px;
  color: var(--fg-faint);
  letter-spacing: 0.02em;
}

.chat-page.is-offline .fate-btn {
  filter: grayscale(0.65);
}

/* ---------- 4.3 创世通道 ---------- */

.mode-picker {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mode-picker__lead {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.6;
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 15px 13px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  min-height: 132px;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur-fast);
}

.mode-card::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -18px;
  width: 54px;
  height: 54px;
  transform: rotate(45deg);
  border-radius: 12px;
  border: 1px solid currentColor;
  opacity: 0.16;
}

.mode-card:active {
  transform: scale(0.98);
}

.mode-card__icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--line);
  margin-bottom: 2px;
}

.mode-card--violet {
  color: var(--violet);
}

.mode-card--violet .mode-card__icon {
  background: var(--violet-soft);
}

.mode-card--cyan {
  color: var(--accent-2);
}

.mode-card--cyan .mode-card__icon {
  background: rgba(34, 211, 238, 0.13);
}

.mode-card--pink {
  color: var(--accent-3);
}

.mode-card--pink .mode-card__icon {
  background: rgba(244, 114, 182, 0.13);
}

.mode-card--amber {
  color: var(--warn);
}

.mode-card--amber .mode-card__icon {
  background: var(--warn-soft);
}

.mode-card__title {
  font-family: var(--font-hand);
  font-size: 16px;
  font-weight: 700;
  color: var(--fg);
}

.mode-card__desc {
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.mode-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 4px 8px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 12px;
  cursor: pointer;
}

.mode-back:hover {
  background: var(--line);
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.template-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
}

.template-card.is-active {
  border-color: rgba(167, 139, 250, 0.6);
  background: linear-gradient(160deg, var(--violet-soft), var(--card));
}

.template-card__radio {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex: none;
  border-radius: 5px;
  border: 2px solid var(--line-strong);
  transform: rotate(45deg);
  position: relative;
}

.template-card.is-active .template-card__radio {
  border-color: var(--accent);
}

.template-card.is-active .template-card__radio::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 2px;
  background: var(--accent);
}

.template-card__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.template-card__name {
  font-size: 14.5px;
  font-weight: 600;
}

.template-card__summary {
  font-size: 11.5px;
  color: var(--fg-muted);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.question-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
}

.question__theme {
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.question__text {
  font-family: var(--font-hand);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.5;
}

.question__hint {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}

.question__actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.import-draft {
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.import-draft__head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hand);
  font-size: 17px;
}

.import-draft__summary {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.json-details {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--fg-muted);
}

.json-details summary {
  cursor: pointer;
  padding: 6px 0;
  color: var(--accent);
}

/* ---------- 4.4 搜索 ---------- */

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 13px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  margin: 10px 0;
}

.search-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--violet-soft);
}

.search-bar__icon {
  color: var(--fg-muted);
  display: grid;
  place-items: center;
  flex: none;
}

.search-bar__input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  border: none;
  background: transparent;
  color: var(--fg);
  font-family: inherit;
  font-size: 14.5px;
  outline: none;
}

.search-bar__input::-webkit-search-cancel-button {
  display: none;
}

.search-bar__clear {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
}

.search-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}

.search-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.search-filter > span {
  font-size: 10.5px;
  color: var(--fg-muted);
  padding-left: 3px;
}

.search-filter .select {
  min-height: 40px;
  font-size: 12.5px;
  padding: 8px 30px 8px 10px;
}

.search-mode-hint {
  margin: 6px 0;
}

.search-mode-hint .muted {
  font-size: 11.5px;
  line-height: 1.5;
  display: block;
  padding: 2px 3px;
}

.search-result-meta {
  margin: 8px 0;
}

.search-summary {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
}

.search-summary__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12.5px;
}

.search-summary__row .muted {
  font-size: 11.5px;
}

.search-summary__keywords {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  font-size: 11px;
}

.search-summary__hint {
  font-size: 11px;
  line-height: 1.5;
}

.search-results {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 10px;
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  padding: 13px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur-fast), transform var(--dur-fast);
}

.search-result:active {
  transform: scale(0.99);
  border-color: var(--accent);
}

.search-result__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.search-result__index {
  font-size: 10px;
  opacity: 0.7;
}

.search-result__score {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--accent-2);
  font-variant-numeric: tabular-nums;
}

.search-result__title {
  font-family: var(--font-hand);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.search-result__summary {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.search-detail__block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.search-detail__block h4 {
  font-size: 12.5px;
  color: var(--fg-muted);
  margin-bottom: 5px;
}

.search-detail__text {
  font-size: 13px;
  color: var(--fg-soft);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.search-history {
  margin-top: 18px;
}

.search-history__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.search-history__title {
  font-size: 13px;
  color: var(--fg-soft);
  font-weight: 600;
}

.search-history__empty {
  font-size: 11.5px;
  padding: 4px 2px;
}

.search-idle {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 30px 18px;
}

.search-idle__mark {
  margin-bottom: 4px;
  animation: float-soft 4s ease-in-out infinite;
}

.search-idle__title {
  font-family: var(--font-hand);
  font-size: 20px;
  font-weight: 700;
}

.search-idle__desc {
  font-size: 12.5px;
  color: var(--fg-muted);
  max-width: 320px;
  line-height: 1.6;
}

.search-idle__stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 8px 0 4px;
}

.search-idle__hint {
  font-size: 11px;
  line-height: 1.55;
  max-width: 340px;
}

/* ---------- 4.5 草稿箱 ---------- */

.draft-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.draft-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 8px;
}

.draft-group__head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0 2px;
  padding-left: 2px;
}

.draft-group__head .muted {
  font-size: 11px;
}

.draft-group__desc {
  font-size: 10.5px;
  color: var(--fg-faint);
  margin-left: auto;
}

.draft-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 14px;
  border-radius: 15px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  background: var(--card);
}

.draft-card--ok {
  border-left-color: var(--ok);
}

.draft-card--warn {
  border-left-color: var(--warn);
}

.draft-card--danger {
  border-left-color: var(--danger);
}

.draft-card--info {
  border-left-color: var(--info);
}

.draft-card--violet {
  border-left-color: var(--accent);
}

.draft-card--neutral {
  border-left-color: var(--line-strong);
}

.draft-card__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.draft-card__time {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--fg-faint);
}

.draft-card__body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.draft-card__title {
  font-family: var(--font-hand);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.draft-card__preview {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.draft-card__meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: var(--fg-faint);
  flex-wrap: wrap;
}

.draft-card__error {
  font-size: 11px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 8px;
  padding: 6px 9px;
  overflow-wrap: anywhere;
}

.draft-card__review-line {
  font-size: 11px;
  color: var(--accent);
}

.draft-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding-top: 3px;
}

.draft-view {
  display: flex;
  flex-direction: column;
}

.draft-view__content {
  max-height: none;
}

/* 复核面板 */
.review-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review-panel__summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--line);
  font-size: 12px;
}

.review-panel__group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-panel__title {
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.review-panel__title::before {
  content: "";
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  border-radius: 1px;
  background: currentColor;
}

.review-panel__title--hard {
  color: var(--danger);
}

.review-panel__title--soft {
  color: var(--warn);
}

.issue-card {
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.issue-card--hard {
  border-color: rgba(251, 113, 133, 0.3);
  background: color-mix(in srgb, var(--danger-soft) 40%, var(--card));
}

.issue-card--soft {
  border-color: rgba(251, 191, 36, 0.28);
  background: color-mix(in srgb, var(--warn-soft) 35%, var(--card));
}

.issue-card__head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  flex-wrap: wrap;
}

.issue-card__location,
.issue-card__reason,
.issue-card__suggestion {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--fg-muted);
  overflow-wrap: anywhere;
}

.issue-card__suggestion {
  color: var(--fg-soft);
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.review-actions .btn {
  flex: 1 1 44%;
}

/* ---------- 4.6 设置 ---------- */

.settings-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-card);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.settings-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.settings-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-hand);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--fg-soft);
}

.settings-card__head .settings-card__title {
  margin-bottom: 0;
}

.settings-card__title svg {
  color: var(--accent);
}

.settings-card__desc {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.55;
  margin-bottom: 8px;
}

.settings-subtitle {
  font-size: 12.5px;
  color: var(--fg-soft);
  font-weight: 600;
  margin: 10px 0 6px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.settings-actions .btn--block {
  flex: 1 1 100%;
}

.settings-switch-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 2px;
}

.health-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.status-light {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  min-width: 0;
}

.status-light__dot {
  width: 9px;
  height: 9px;
  margin-top: 4px;
  border-radius: 2px;
  transform: rotate(45deg);
  flex: none;
  background: var(--fg-faint);
}

.status-light--ok .status-light__dot {
  background: var(--ok);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
}

.status-light--bad .status-light__dot {
  background: var(--danger);
  box-shadow: 0 0 10px rgba(251, 113, 133, 0.55);
}

.status-light--pending .status-light__dot {
  background: var(--warn);
  animation: pulse-ok 1.4s infinite;
}

.status-light__main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.status-light__label {
  font-size: 10.5px;
  color: var(--fg-muted);
}

.status-light__text {
  font-size: 12px;
  color: var(--fg-soft);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.status-light__detail {
  font-size: 10px;
  color: var(--fg-faint);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.gateway-line {
  margin-top: 10px;
}

.gateway-line:empty {
  display: none;
}

.gateway-line__row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 11.5px;
}

.gen-notice:empty {
  display: none;
}

.local-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.about-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.about-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.about-brand strong {
  font-family: var(--font-hand);
  font-size: 16px;
}

.about-note {
  margin-top: 10px;
  line-height: 1.55;
}

.version-foot {
  text-align: center;
  font-size: 10.5px;
  color: var(--fg-faint);
  padding: 22px 0 10px;
  letter-spacing: 0.04em;
}

.backup-result {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ---------- 4.7 调试端 ---------- */

.debug-status,
.debug-hardware,
.debug-models,
.debug-ollama,
.debug-quick,
.debug-logs {
  min-width: 0;
}

.debug-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.debug-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  min-width: 0;
}

.debug-stat__label {
  font-size: 10.5px;
  color: var(--fg-muted);
}

.debug-stat__value {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.debug-stat--danger {
  border-color: rgba(251, 113, 133, 0.4);
}

.debug-stat--danger .debug-stat__value {
  color: var(--danger);
}

.debug-stat .progress {
  margin-top: 2px;
}

.debug-stat .progress__track {
  height: 5px;
}

.loaded-models {
  margin-top: 12px;
}

.debug-models {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.model-card {
  padding: 12px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.model-card.is-loaded {
  border-color: rgba(52, 211, 153, 0.45);
  background: color-mix(in srgb, var(--ok-soft) 40%, var(--card));
}

.model-card__head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.model-card__name {
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.model-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 10.5px;
  color: var(--fg-muted);
}

.model-card__meta > * {
  white-space: nowrap;
}

.model-card__actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.debug-ollama__actions,
.debug-quick__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.debug-log-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.debug-log-actions .select {
  min-height: 38px;
  font-size: 12px;
  padding: 6px 28px 6px 9px;
}

/* ========== 5. 响应式 / 动效 / 无障碍 ========== */

@media (min-width: 560px) {
  .world-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mode-grid {
    grid-template-columns: 1fr 1fr;
  }

  .health-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .local-stats {
    grid-template-columns: repeat(6, 1fr);
  }

  .field-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 760px) {
  .page {
    padding-top: 18px;
  }

  .page-title {
    font-size: 27px;
  }

  .chat-page {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }

  .sheet {
    border-radius: 24px;
    margin-bottom: 4dvh;
    border-bottom: 1px solid var(--line-strong);
    max-height: 84dvh;
  }

  .overlay--sheet {
    align-items: center;
    padding: 16px;
  }

  .sheet--full {
    height: 84dvh;
    max-height: 84dvh;
  }

  .sheet__actions {
    padding-bottom: 12px;
  }

  .toast-root {
    bottom: 34px;
  }

  body[data-route="chat"] .tabbar {
    display: none;
  }
}

@media (max-width: 380px) {
  .brand-sub {
    max-width: 38vw;
  }

  .page {
    padding-left: calc(11px + var(--safe-l));
    padding-right: calc(11px + var(--safe-r));
  }

  .status-pill {
    padding: 0 10px;
    font-size: 11.5px;
  }

  .fate-result__grid {
    grid-template-columns: 1fr;
  }

  .rule-grid {
    grid-template-columns: 1fr;
  }

  .health-grid {
    grid-template-columns: 1fr;
  }

  .debug-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 381px) and (max-width: 430px) {
  .health-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* 动效 */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -80% 0;
  }
}

@keyframes cursor-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0.1;
  }
}

@keyframes pulse-ok {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.45);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(52, 211, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}

@keyframes pulse-danger {
  0%,
  100% {
    filter: brightness(1);
    transform: scale(1);
  }
  50% {
    filter: brightness(1.18);
    transform: scale(1.015);
  }
}

@keyframes success-flash {
  0% {
    filter: brightness(1);
  }
  30% {
    filter: brightness(1.6);
  }
  100% {
    filter: brightness(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes boot-spin {
  to {
    transform: rotate(405deg);
  }
}

@keyframes float-soft {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 滚动条（桌面） */
.view::-webkit-scrollbar,
.chat-scroll::-webkit-scrollbar,
.sheet__body::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.view::-webkit-scrollbar-thumb,
.chat-scroll::-webkit-scrollbar-thumb,
.sheet__body::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

/* --- 细节补齐（严格对齐 JS 中使用的类名） --- */
.btn__label {
  display: inline-block;
  white-space: nowrap;
}

.bubble__text {
  display: inline;
}

.bubble--streaming {
  position: relative;
}

.msg__meta-item {
  font-size: 10.5px;
  color: var(--fg-faint);
}

.msg__time,
.msg__tokens {
  font-variant-numeric: tabular-nums;
}

.status-pill__text {
  font-weight: 500;
  line-height: 1;
}

/* 页面级修饰（保留钩子，便于后续按页微调） */
.page--worlds,
.page--search,
.page--drafts,
.page--settings,
.page--debug {
  position: relative;
}



/* ---------- 人格档案（AI 分析） ---------- */
.persona-analysis { margin-top: 4px; }
.persona-analysis__title { font-size: 13px; margin: 10px 0 6px; color: var(--fg); }
.persona-analysis .settings-divider { border: 0; border-top: 1px solid var(--line); margin: 14px 0 10px; }
.persona-answer {
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg-2) 70%, transparent);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.9;
  white-space: pre-wrap;
  color: var(--fg);
}
.persona-answer:empty { display: none; }
.persona-profile {
  margin: 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--bg-2) 70%, transparent);
  border: 1px solid var(--line);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.95;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--fg);
}

/* ==================================================================
   人物设定 · AI 一键填入（粘贴文字 → 提取 → 追问）
   ================================================================== */

.persona-import {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.persona-import__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-soft);
}

.persona-import .textarea {
  min-height: 96px;
}

.persona-extract {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.persona-extract__summary {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--violet-soft);
  border: 1px solid rgba(167, 139, 250, 0.25);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--fg-soft);
}

.persona-extract__summary strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--accent);
}

.persona-extract__summary p {
  margin: 0;
}

.persona-extract__section-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-soft);
}

.persona-extract__fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.persona-extract__questions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.persona-question {
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.persona-question__field {
  font-size: 10.5px;
  letter-spacing: 0.3px;
  color: var(--accent);
}

.persona-question__text {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--fg-soft);
}

.persona-question .muted {
  margin: 3px 0 0;
}

/* ==================================================================
   C 端登录门槛（账号 / 密码）
   ================================================================== */

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 0%, rgba(139, 92, 246, 0.30), transparent 46%),
    radial-gradient(circle at 86% 18%, rgba(34, 211, 238, 0.16), transparent 42%),
    var(--bg);
}

.auth-gate__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%);
}

.auth-gate__card {
  position: relative;
  width: min(370px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 24px 22px;
  border-radius: 26px;
  background: var(--card-solid);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-float);
}

.auth-gate__logo {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  margin: 0 auto 2px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #161a3c, #1d1030);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 10px 26px rgba(139, 92, 246, 0.30);
}
.auth-gate__logo i {
  position: absolute;
  width: 27px;
  height: 27px;
  border: 2px solid #a78bfa;
  border-radius: 5px;
  transform: rotate(45deg);
  opacity: 0.9;
}
.auth-gate__logo b {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #c4b5fd, #8b5cf6);
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.7);
}

.auth-gate__title {
  margin: 0;
  text-align: center;
  font-size: 22px;
  letter-spacing: 1px;
  background: linear-gradient(90deg, #c4b5fd, #67e8f9 55%, #f9a8d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-gate__sub {
  margin: 0 0 4px;
  text-align: center;
  font-size: 12.5px;
  color: var(--fg-muted);
}

.auth-gate__form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-gate__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-gate__label {
  font-size: 12px;
  color: var(--fg-muted);
}
.auth-gate .input {
  height: 46px;
  border-radius: 13px;
  font-size: 15px;
  letter-spacing: 0.3px;
}

.auth-gate__error {
  min-height: 18px;
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--danger);
}

.auth-gate .btn--block {
  height: 46px;
  border-radius: 13px;
  font-size: 15px;
}

.auth-gate__hint {
  margin: 2px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: var(--fg-faint);
  text-align: center;
}
.auth-gate__tabs {
  display: flex;
  gap: 8px;
  margin: 2px 0 2px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-elev);
}
.auth-gate__tab {
  flex: 1;
  height: 36px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--fg-muted);
  font-size: 13.5px;
  cursor: pointer;
}
.auth-gate__tab.is-on {
  background: var(--card-solid);
  color: var(--fg);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

