/* ============================================================
   群像剧场 — 清新学院风
   移动优先：375px 单列（状态面板为底部抽屉）
   ≥1024px：桌面双栏（左聊天 + 右状态栏，顶部导航）
   ============================================================ */

:root {
  --bg: #f7f5ef;            /* 米白底 */
  --bg-soft: #eef4f3;       /* 浅青底 */
  --card: #ffffff;
  --ink: #2f3a3f;
  --ink-soft: #6b7a80;
  --line: #e6e2d6;
  --accent: #3f8f8b;        /* 青绿主色 */
  --accent-deep: #2e6f6c;
  --accent-soft: #e3efee;
  --user-bubble: #cfe7e3;
  --user-ink: #20403c;
  --danger: #c25549;
  --warn: #c68a3f;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 3px rgba(47, 58, 63, 0.06);
  --shadow-md: 0 6px 24px rgba(47, 58, 63, 0.10);
  --topbar-h: 56px;
  --tabs-h: 54px;
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3, h4, p, ul, dl, dd, dt { margin: 0; }
ul { padding: 0; list-style: none; }
button { font-family: inherit; }
a { color: var(--accent-deep); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 16px;
  color: var(--accent-deep);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.brand .icon { width: 22px; height: 22px; }
.page-title {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- 导航标签：移动端底部 tab ---------- */
.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  border-top: 1px solid var(--line);
}
.tabs a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.15s ease;
}
.tabs a .icon { width: 22px; height: 22px; }
.tabs a.active { color: var(--accent-deep); font-weight: 600; }
.tabs a:active { transform: translateY(1px); }

/* ---------- 主视图 ---------- */
.view {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 14px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 20px);
}
.view:has(.scene-layout) {
  max-width: none;
  padding: 0;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.page-head h2 { font-size: 20px; font-weight: 700; }
.page-sub { color: var(--ink-soft); font-size: 13px; margin-top: 3px; }

.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  margin: 22px 0 10px;
}
.section-title:first-child { margin-top: 0; }
.section-count { font-size: 12px; font-weight: 400; color: var(--ink-soft); }

/* ---------- 卡片 / 列表 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.stack { display: flex; flex-direction: column; gap: 12px; }

.empty {
  text-align: center;
  padding: 52px 16px;
  color: var(--ink-soft);
}
.empty .icon { width: 46px; height: 46px; opacity: 0.45; margin-bottom: 10px; }
.empty p { font-size: 14px; }

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 90px 0;
  color: var(--ink-soft);
  font-size: 14px;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-card { border-color: #ecd3cf; }
.error-card p { color: var(--danger); font-size: 14px; margin-bottom: 12px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn .icon { width: 17px; height: 17px; }
.btn:hover { background: var(--accent-deep); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.ghost {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}
.btn.ghost:hover { background: var(--bg-soft); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: #a8443a; }
.btn.danger-ghost {
  background: transparent;
  color: var(--danger);
}
.btn.danger-ghost:hover { background: #f9ece9; }
.btn.block { width: 100%; }
.btn.loading .icon { animation: spin 0.9s linear infinite; }

.icon-btn {
  width: 36px; height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--bg-soft); color: var(--accent-deep); }
.icon-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.icon {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---------- 徽章 / 标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  white-space: nowrap;
}
.badge.mute { background: #eeece3; color: var(--ink-soft); }
.badge.warn { background: #f6ecdc; color: #93662a; }
.badge.off { background: #f1efea; color: #a5a093; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip.static {
  cursor: default;
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-deep);
  padding: 4px 12px;
  font-size: 13px;
}

/* ---------- 表单 ---------- */
.input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: #b3ada0; }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63, 143, 139, 0.15);
}
textarea.input { resize: vertical; min-height: 76px; line-height: 1.6; }
.field { margin-bottom: 14px; }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.field-check input { width: 17px; height: 17px; accent-color: var(--accent); }
.hint { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; }
.form-row { display: flex; gap: 10px; }
.form-row > * { flex: 1; }
.btn-row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed;
  top: calc(var(--topbar-h) + 10px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  background: #37474c;
  color: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  text-align: center;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.25s ease both;
}
.toast.toast-error { background: var(--danger); }
.toast.leave { opacity: 0; transform: translateY(-6px); transition: all 0.3s ease; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
}

/* ---------- 模态 ---------- */
dialog.modal {
  border: none;
  border-radius: 16px;
  padding: 0;
  width: min(92vw, 560px);
  max-height: 84dvh;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}
dialog.modal::backdrop {
  background: rgba(38, 50, 54, 0.42);
  backdrop-filter: blur(2px);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.confirm-text { font-size: 14.5px; line-height: 1.7; }

/* ============================================================
   场景页
   ============================================================ */
.scene-layout {
  display: grid;
  grid-template-columns: 1fr;
  height: calc(100vh - var(--topbar-h) - var(--tabs-h) - env(safe-area-inset-bottom));
  height: calc(100dvh - var(--topbar-h) - var(--tabs-h) - env(safe-area-inset-bottom));
}
.chat-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-width: 780px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 12px 0;
}

/* 场景头 */
.scene-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 14px;
}
.scene-head-info { flex: 1; min-width: 0; }
.scene-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink);
  line-height: 1.5;
}
.scene-line .icon { width: 15px; height: 15px; color: var(--accent); }
.scene-line + .scene-line { margin-top: 2px; }
.scene-line span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scene-head-badges { margin-top: 8px; }

/* 消息列表 */
.msg-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 2px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
}
.msg {
  display: flex;
  max-width: 84%;
  animation: msg-in 0.28s ease both;
}
.msg-bot { align-self: flex-start; }
.msg-user { align-self: flex-end; }
.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.msg-bot .bubble {
  background: var(--card);
  border: 1px solid var(--line);
  border-top-left-radius: 6px;
}
.msg-user .bubble {
  background: var(--user-bubble);
  color: var(--user-ink);
  border-top-right-radius: 6px;
}
.bubble-text {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.bubble.streaming .bubble-text::after {
  content: "▍";
  margin-left: 2px;
  color: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
}
.bubble-error {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #ecd3cf;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.6;
}
.msg-empty-tip { color: var(--ink-soft); font-size: 13.5px; }

/* 输入区（贴底 + 安全区） */
.composer {
  flex: none;
  padding: 6px 0 max(10px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 72%, transparent);
}
.composer-bar {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 7px 7px 7px 15px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.composer-bar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63, 143, 139, 0.13);
}
.composer-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
  padding: 6px 0;
  max-height: 120px;
}
.composer-input::placeholder { color: #b3ada0; }
.send-btn {
  width: 40px; height: 40px;
  flex: none;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.send-btn .icon { width: 19px; height: 19px; }

/* 状态面板：桌面为右栏；移动端为底部抽屉 */
.state-panel {
  background: var(--card);
}
.panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-deep);
}
.panel-title .icon { width: 18px; height: 18px; }
.panel-sec { margin-top: 14px; }
.panel-sec > h3 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.kv {
  display: flex;
  gap: 10px;
  font-size: 13.5px;
  line-height: 1.7;
}
.kv dt { color: var(--ink-soft); flex: none; }
.kv dd { min-width: 0; word-break: break-word; }
.p-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 13px;
  margin: 0 6px 6px 0;
}
.p-chip .stage {
  font-size: 11px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(46, 111, 108, 0.16);
}
.thread-row {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 13.5px;
  padding: 5px 0;
  border-bottom: 1px dashed var(--line);
  flex-wrap: wrap;
}
.thread-row:last-child { border-bottom: none; }
.thread-status {
  width: 7px; height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  align-self: center;
}
.thread-status.paused { background: var(--warn); }
.thread-status.done { background: #c2beb2; }
.thread-progress { color: var(--ink-soft); font-size: 12.5px; flex-basis: 100%; padding-left: 14px; }
.fact-mini {
  font-size: 13px;
  padding: 4px 0 4px 14px;
  position: relative;
  line-height: 1.55;
}
.fact-mini::before {
  content: "";
  position: absolute;
  left: 0; top: 0.85em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.budget-row { display: flex; flex-wrap: wrap; gap: 6px; }
.budget-cell {
  padding: 3px 10px;
  border-radius: 9px;
  background: var(--bg-soft);
  font-size: 12px;
  color: var(--ink);
}
.budget-cell b { color: var(--accent-deep); font-weight: 600; }
.panel-empty { font-size: 13px; color: #a5a093; }

/* 移动端抽屉形态 */
@media (max-width: 1023.98px) {
  .state-panel {
    position: fixed;
    left: 0; right: 0;
    bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
    z-index: 70;
    max-height: 64dvh;
    overflow-y: auto;
    padding: 16px 18px calc(16px + env(safe-area-inset-bottom));
    border: none;
    border-top: 1px solid var(--line);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 30px rgba(47, 58, 63, 0.14);
    transform: translateY(105%);
    transition: transform 0.28s ease;
  }
  body.drawer-open .state-panel { transform: none; }
}
#drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  background: rgba(38, 50, 54, 0.35);
  border: none;
  padding: 0;
  width: 100%;
  cursor: pointer;
}
body.drawer-open #drawer-mask { display: block; }
@media (min-width: 1024px) {
  #state-drawer-btn, #drawer-mask { display: none !important; }
}

/* 空状态：开新场景引导 */
.empty-scene {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 18px 20px;
  text-align: center;
  animation: msg-in 0.3s ease both;
}
.empty-hero .icon {
  width: 56px; height: 56px;
  color: var(--accent);
  opacity: 0.55;
}
.empty-scene h2 { font-size: 19px; margin: 12px 0 6px; }
.empty-scene > .hint { font-size: 14px; }
.new-scene {
  margin-top: 22px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.new-scene h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

/* ============================================================
   名册页
   ============================================================ */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 12px;
}
.char-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px;
  cursor: pointer;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.char-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #d6e5e2;
}
.char-top { display: flex; align-items: center; gap: 11px; }
.char-avatar {
  width: 42px; height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 18px;
  font-weight: 700;
}
.char-name { font-size: 15.5px; font-weight: 700; }
.char-brief {
  margin-top: 9px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.profile-sec { margin-bottom: 14px; }
.profile-sec:last-child { margin-bottom: 0; }
.profile-sec h3 {
  font-size: 12.5px;
  color: var(--ink-soft);
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.profile-sec p { font-size: 14px; line-height: 1.7; white-space: pre-wrap; }

.rel-list { display: flex; flex-direction: column; gap: 8px; }
.rel-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 11px 14px;
}
.rel-pair { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.rel-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-soft); }
.rel-time { margin-left: auto; font-size: 12px; color: #a5a093; }

/* ============================================================
   世界书页
   ============================================================ */
.entry-list { display: flex; flex-direction: column; gap: 12px; }
.entry {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  transition: opacity 0.2s ease;
}
.entry.disabled { opacity: 0.55; background: #faf9f4; }
.entry-main { min-width: 0; }
.entry-content {
  margin-top: 9px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}
.entry-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.entry-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.entry-actions .btn {
  padding: 6px 11px;
  font-size: 13px;
  border-radius: 10px;
}

/* ============================================================
   时间线页（场景卡流）
   ============================================================ */
.tl-list { display: flex; flex-direction: column; gap: 14px; }
.scard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  animation: msg-in 0.25s ease both;
}
.scard-head {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.scard-summary { margin-top: 11px; font-size: 14px; line-height: 1.75; }
.scard-sub {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--ink-soft);
  margin: 14px 0 6px;
}
.fact-list li,
.rel-change-list li {
  position: relative;
  padding: 3px 0 3px 15px;
  font-size: 13.5px;
  line-height: 1.65;
}
.fact-list li::before,
.rel-change-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.85em;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.rel-change-arrow {
  color: var(--accent-deep);
  font-weight: 600;
  font-size: 12.5px;
  margin-left: 6px;
}
.rel-why { color: var(--ink-soft); font-size: 12.5px; margin-left: 6px; }
.scard-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: #a5a093;
}
.modal-body .scard {
  border: none;
  box-shadow: none;
  padding: 0;
}

/* ============================================================
   设置页
   ============================================================ */
.settings-list { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.settings-card h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.settings-card h2 .icon { width: 18px; height: 18px; color: var(--accent); }
.kv-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-size: 14px;
}
.kv-list dt { color: var(--ink-soft); }
.kv-list dd { word-break: break-all; }

/* ============================================================
   桌面双栏 ≥1024px
   ============================================================ */
@media (min-width: 1024px) {
  .topbar { padding: 0 22px; }
  .page-title { text-align: left; }
  .tabs {
    position: sticky;
    top: var(--topbar-h);
    bottom: auto;
    height: 46px;
    padding: 0 22px;
    justify-content: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: none;
    border-bottom: 1px solid var(--line);
  }
  .tabs a {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 7px;
    padding: 0 16px;
    height: 100%;
    font-size: 14px;
    border-radius: 0;
    box-shadow: inset 0 -2px 0 transparent;
    transition: color 0.15s ease, box-shadow 0.15s ease;
  }
  .tabs a .icon { width: 18px; height: 18px; }
  .tabs a.active { box-shadow: inset 0 -2px 0 var(--accent); }
  .view { padding-bottom: 48px; }

  .scene-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 18px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 18px 22px;
    height: calc(100vh - var(--topbar-h) - 46px);
    height: calc(100dvh - var(--topbar-h) - 46px);
  }
  .chat-col { padding: 0; max-width: none; }
  .state-panel {
    align-self: start;
    position: static;
    transform: none;
    max-height: calc(100dvh - var(--topbar-h) - 46px - 36px);
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 16px;
    transition: none;
  }
  .view:has(.scene-layout) { padding: 0; }
}

/* 动画偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
