/* ========== 天穹骑士 · 灵能力工房 ========== */
:root {
  --bg-0: #05070d;
  --bg-1: #0a1020;
  --bg-2: #10182c;
  --panel: rgba(12, 18, 34, 0.78);
  --panel-solid: #0d1426;
  --border: rgba(120, 190, 255, 0.18);
  --border-strong: rgba(90, 210, 255, 0.45);
  --text: #e8f3ff;
  --text-dim: #8aa0bd;
  --cyan: #45e0ff;
  --cyan-2: #7cf0ff;
  --blue: #2b7cff;
  --gold: #d4b26a;
  --gold-2: #f0d58a;
  --silver: #c8d4e8;
  --danger: #ff6b7a;
  --ok: #4dffb5;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --sidebar-w: 280px;
  --topbar-h: 68px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: radial-gradient(1200px 700px at 20% 0%, #132044 0%, var(--bg-0) 55%);
  overflow: hidden;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }

/* ===== 背景特效 ===== */
.bg-fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: float 12s ease-in-out infinite;
}
.orb-a {
  width: 420px; height: 420px;
  left: -80px; top: -60px;
  background: radial-gradient(circle, rgba(69,224,255,.55), transparent 70%);
}
.orb-b {
  width: 520px; height: 520px;
  right: -120px; bottom: -80px;
  background: radial-gradient(circle, rgba(43,124,255,.4), transparent 70%);
  animation-delay: -4s;
}
.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(100,180,255,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100,180,255,.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}
.wave-pattern {
  position: absolute;
  right: 0; bottom: 0;
  width: 50%; height: 50%;
  opacity: 0.08;
  background:
    radial-gradient(circle at 80% 80%, transparent 20%, rgba(69,224,255,.3) 21%, transparent 22%) 0 0 / 80px 80px,
    radial-gradient(circle at 80% 80%, transparent 35%, rgba(212,178,106,.25) 36%, transparent 37%) 0 0 / 120px 120px;
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(30px) scale(1.05); }
}

/* ===== 布局 ===== */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  height: 100dvh;
}
.app.sidebar-collapsed {
  grid-template-columns: 1fr;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 14px;
  background: linear-gradient(180deg, rgba(10,16,32,.97), rgba(8,12,24,.94));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(16px);
  min-width: 0;
  z-index: 30;
  transition: transform .25s ease;
}
.app.sidebar-collapsed .sidebar {
  display: none;
}

.brand {
  display: grid;
  grid-template-columns: 42px 1fr 40px;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 6px;
  min-width: 0;
}
.brand-mark {
  width: 42px; height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, #1a2744, #0b1224);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px rgba(69,224,255,.25);
  flex-shrink: 0;
}
.brand-gem {
  width: 14px; height: 14px;
  border-radius: 4px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, var(--cyan-2), var(--blue));
  box-shadow: 0 0 12px var(--cyan);
}
.brand-text {
  min-width: 0;
}
.brand-text h1 {
  margin: 0;
  font-size: 15px;
  letter-spacing: .08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: linear-gradient(90deg, var(--silver), var(--cyan-2), var(--gold-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: .16em;
}
.brand-collapse {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  flex-shrink: 0;
}

.btn-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, rgba(69,224,255,.2), rgba(43,124,255,.25));
  color: var(--cyan-2);
  font-weight: 600;
  transition: .2s ease;
  box-shadow: inset 0 0 0 1px rgba(69,224,255,.25), 0 8px 24px rgba(20,80,160,.25);
}
.btn-new:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px rgba(69,224,255,.45), 0 10px 28px rgba(20,80,160,.35);
}

.chat-list-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.section-label {
  font-size: 11px;
  letter-spacing: .18em;
  color: var(--text-dim);
  padding: 4px 8px 8px;
  text-transform: uppercase;
}
.chat-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 2px;
}
.chat-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  transition: .15s ease;
  cursor: pointer;
}
.chat-item-main { min-width: 0; }
.chat-item:hover { background: rgba(69,224,255,.06); color: var(--text); }
.chat-item.active {
  background: linear-gradient(135deg, rgba(69,224,255,.12), rgba(212,178,106,.08));
  border-color: rgba(69,224,255,.28);
  color: var(--text);
}
.chat-item .title {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item .meta {
  font-size: 11px;
  opacity: .7;
  margin-top: 2px;
}
.chat-item .del {
  opacity: .55;
  border: none;
  background: transparent;
  color: var(--danger);
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: .15s ease;
}
.chat-item:hover .del,
.chat-item.active .del { opacity: 1; }
.chat-item .del:hover { background: rgba(255,107,122,.14); color: #ff8b97; }

.sidebar-footer {
  display: flex;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  align-items: center;
}
.config-status {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.02);
  font-size: 12px;
  color: var(--text-dim);
}
.config-status #configStatusText {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.config-status 
/* 全站今日字数配额芯片 */
.quota-chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 148px;
  max-width: min(250px, 48vw);
  padding: 8px 12px 8px 10px;
  border-radius: 16px;
  border: 1px solid rgba(90, 210, 255, 0.35);
  background:
    linear-gradient(145deg, rgba(18, 36, 68, 0.92), rgba(8, 14, 28, 0.88));
  box-shadow:
    0 0 0 1px rgba(69,224,255,.06) inset,
    0 8px 22px rgba(0, 0, 0, 0.28),
    0 0 18px rgba(69, 224, 255, 0.08);
  overflow: hidden;
}
.quota-chip-glow {
  position: absolute;
  inset: -40% auto auto -20%;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(69,224,255,.22), transparent 70%);
  pointer-events: none;
}
.quota-chip-icon {
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--cyan-2);
  background: linear-gradient(145deg, rgba(69,224,255,.16), rgba(43,124,255,.12));
  border: 1px solid rgba(69,224,255,.28);
  box-shadow: 0 0 12px rgba(69,224,255,.15);
  flex-shrink: 0;
}
.quota-chip-body {
  position: relative;
  z-index: 1;
  min-width: 0;
  flex: 1;
}
.quota-chip-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.quota-chip .quota-label {
  font-size: 10px;
  letter-spacing: .16em;
  font-weight: 700;
  color: var(--cyan-2);
  text-transform: uppercase;
}
.quota-chip .quota-pct {
  font-size: 11px;
  font-weight: 800;
  color: var(--gold-2);
  font-variant-numeric: tabular-nums;
}
.quota-chip-nums {
  font-size: 12px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quota-chip-bar {
  margin-top: 5px;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  overflow: hidden;
}
.quota-chip-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #45e0ff, #2b7cff 55%, #f0d58a);
  box-shadow: 0 0 8px rgba(69,224,255,.45);
  transition: width .3s ease;
}
.quota-chip.warn {
  border-color: rgba(240,213,138,.5);
  box-shadow:
    0 0 0 1px rgba(240,213,138,.08) inset,
    0 8px 22px rgba(0,0,0,.28),
    0 0 16px rgba(240,213,138,.12);
}
.quota-chip.warn .quota-pct { color: var(--gold-2); }
.quota-chip.warn .quota-chip-bar i {
  background: linear-gradient(90deg, #f0d58a, #ffb347);
}
.quota-chip.danger {
  border-color: rgba(255,107,122,.55);
  box-shadow:
    0 0 0 1px rgba(255,107,122,.1) inset,
    0 8px 22px rgba(0,0,0,.28),
    0 0 16px rgba(255,107,122,.14);
}
.quota-chip.danger .quota-pct { color: var(--danger); }
.quota-chip.danger .quota-chip-bar i {
  background: linear-gradient(90deg, #ff8a6a, #ff6b7a);
}

.status-dot { flex-shrink: 0; }

.sidebar-backdrop {
  display: none;
}

/* ===== 主区 ===== */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: var(--topbar-h);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(8,12,22,.55);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 5;
}
.topbar-side {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.topbar-left { justify-content: flex-start; }
.topbar-right { justify-content: flex-end; }
.topbar-center {
  min-width: 0;
  text-align: center;
}
.topbar-center h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 桌面：侧栏常显时，顶栏菜单键改为「展开侧栏」仅在 collapsed 时有用 */
.topbar-menu { display: none; }
.app.sidebar-collapsed .topbar-menu { display: grid; }

.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #666;
  box-shadow: 0 0 0 4px rgba(100,100,100,.15);
  flex-shrink: 0;
}
.status-dot.ok {
  background: var(--ok);
  box-shadow: 0 0 0 4px rgba(77,255,181,.15), 0 0 12px rgba(77,255,181,.45);
}
.status-dot.warn {
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(212,178,106,.15);
}
.btn-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.btn-icon:hover {
  color: var(--cyan);
  border-color: var(--border-strong);
}

.stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: 0;
  position: relative;
}

/* 骑士立绘：仅上下浮动 + 轻柔边缘光 */
.hero-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 18px 12px 24px;
  border-right: 1px solid var(--border);
  background:
    linear-gradient(180deg, transparent, rgba(5,8,16,.55)),
    radial-gradient(ellipse at 50% 72%, rgba(69,224,255,.06), transparent 62%);
  position: relative;
  overflow: hidden;
}
.hero-frame {
  position: relative;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 3/4.2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
}
.hero-glow {
  position: absolute;
  inset: 22% 18% 8%;
  background: radial-gradient(ellipse at center, rgba(69,224,255,.16), transparent 72%);
  filter: blur(14px);
  opacity: .55;
  pointer-events: none;
  z-index: 0;
}
.hero-img {
  position: relative;
  z-index: 1;
  height: 100%;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(69,224,255,.35)) drop-shadow(0 10px 18px rgba(0,0,0,.45));
  user-select: none;
  animation: knight-float 4.5s ease-in-out infinite;
  will-change: transform;
  transform-origin: center bottom;
}
@keyframes knight-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.hero-energy {
  display: none;
}
.hero-caption {
  position: relative;
  z-index: 2;
  text-align: center;
  margin-top: 8px;
  padding: 0 8px;
}
.hero-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--gold-2);
  border: 1px solid rgba(212,178,106,.4);
  background: rgba(212,178,106,.08);
  margin-bottom: 8px;
}
.hero-caption p {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
}

/* 手机背景立绘：桌面隐藏 */
.mobile-hero-bg { display: none; }

/* 对话面板 */
.chat-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(180deg, rgba(8,12,22,.2), rgba(8,12,22,.55));
  position: relative;
}
.messages {
  flex: 1;
  overflow: auto;
  padding: 22px 24px 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  position: relative;
  z-index: 1;
}

.msg {
  display: flex;
  gap: 12px;
  max-width: min(780px, 100%);
  animation: msg-in .28s ease;
}
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.assistant { align-self: flex-start; }
.msg.system {
  align-self: center;
  max-width: 520px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid rgba(69,224,255,.35);
  background: radial-gradient(circle at 50% 30%, #1a2744, #0b1220 70%);
  box-shadow: 0 0 0 2px rgba(69,224,255,.08), 0 4px 12px rgba(0,0,0,.35);
  position: relative;
}
/* 骑士对话头像：裁切头盔区域，不显示全身 */
.avatar.avatar-knight img,
.msg.assistant .avatar img {
  position: absolute;
  left: 50%;
  top: -2%;
  width: 250%;
  height: auto;
  max-width: none;
  /* 整体略向右微调 */
  transform: translateX(calc(-50% + 4%));
  object-fit: cover;
  object-position: 48% top;
  pointer-events: none;
  user-select: none;
}
.avatar.user-av {
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-2);
  background: linear-gradient(145deg, #24304a, #121a2c);
  border-radius: 50%;
}

.bubble {
  padding: 12px 14px;
  border-radius: 16px;
  line-height: 1.65;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  position: relative;
}
.msg.assistant .bubble {
  background: linear-gradient(160deg, rgba(20,32,56,.92), rgba(12,20,38,.88));
  border: 1px solid rgba(69,224,255,.22);
  box-shadow: 0 8px 24px rgba(0,0,0,.25), inset 0 1px 0 rgba(255,255,255,.04);
  border-top-left-radius: 6px;
}
.msg.user .bubble {
  background: linear-gradient(160deg, rgba(43,100,200,.45), rgba(20,50,110,.55));
  border: 1px solid rgba(120,180,255,.28);
  border-top-right-radius: 6px;
}
.msg.system .bubble {
  background: rgba(212,178,106,.08);
  border: 1px dashed rgba(212,178,106,.35);
  color: var(--text-dim);
  text-align: center;
  font-size: 13px;
}

.bubble .tag-op {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  color: var(--cyan);
  background: rgba(69,224,255,.1);
  border: 1px solid rgba(69,224,255,.25);
}

.typing {
  display: inline-flex;
  gap: 5px;
  padding: 4px 2px;
}
.typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  opacity: .4;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* 输入区 */
.composer {
  padding: 10px 18px 16px;
  border-top: 1px solid var(--border);
  background: rgba(8,12,22,.7);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
}
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.quick-chips button {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(69,224,255,.22);
  background: rgba(69,224,255,.06);
  color: var(--cyan-2);
  font-size: 12px;
  transition: .15s ease;
}
.quick-chips button:hover {
  background: rgba(69,224,255,.14);
  border-color: rgba(69,224,255,.4);
}
.composer-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(16,24,44,.9), rgba(10,16,30,.95));
  box-shadow: inset 0 0 0 1px rgba(69,224,255,.05), 0 10px 30px rgba(0,0,0,.25);
}
.composer-form:focus-within {
  border-color: rgba(69,224,255,.45);
  box-shadow: 0 0 0 3px rgba(69,224,255,.1), 0 10px 30px rgba(0,0,0,.25);
}
#userInput {
  width: 100%;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  min-height: 44px;
  max-height: 160px;
  padding: 10px 8px;
  line-height: 1.5;
  color: var(--text);
}
#userInput::placeholder { color: #5d7394; }
.btn-send {
  width: 46px; height: 46px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(145deg, var(--cyan), var(--blue));
  color: #041018;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(43,124,255,.35);
  transition: .15s ease;
}
.btn-send:hover { transform: translateY(-1px) scale(1.02); }
.btn-send:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}
.composer-hint {
  margin: 8px 4px 0;
  font-size: 11px;
  color: #5d7394;
  text-align: center;
}

/* 空状态欢迎 */
.welcome {
  margin: auto;
  max-width: 480px;
  text-align: center;
  padding: 24px 16px;
}
.welcome h3 {
  margin: 0 0 8px;
  font-size: 22px;
  background: linear-gradient(90deg, var(--silver), var(--cyan-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome p {
  margin: 0 0 18px;
  color: var(--text-dim);
  line-height: 1.7;
  font-size: 14px;
}
.welcome-cards {
  display: grid;
  gap: 10px;
  text-align: left;
}
.welcome-cards button {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  text-align: left;
  transition: .15s ease;
}
.welcome-cards button:hover {
  border-color: rgba(69,224,255,.4);
  background: rgba(69,224,255,.08);
}
.welcome-cards strong {
  display: block;
  color: var(--cyan-2);
  font-size: 13px;
  margin-bottom: 4px;
}
.welcome-cards span {
  font-size: 12px;
  color: var(--text-dim);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 80;
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(12,18,34,.95);
  border: 1px solid rgba(69,224,255,.35);
  color: var(--text);
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: msg-in .2s ease;
}
.toast[hidden] { display: none !important; }

/* 滚动条 */
.messages::-webkit-scrollbar,
.chat-list::-webkit-scrollbar { width: 8px; }
.messages::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb {
  background: rgba(69,224,255,.18);
  border-radius: 8px;
}

/* ===== 响应式：平板 / 手机 ===== */
@media (max-width: 960px) {
  .app {
    grid-template-columns: 1fr;
  }
  .app.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    box-shadow: 20px 0 50px rgba(0,0,0,.45);
    display: flex !important;
  }
  .app.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(2,4,12,.55);
    backdrop-filter: blur(2px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .app.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar-backdrop[hidden] { display: none; }
  .app.sidebar-open .sidebar-backdrop[hidden] { display: block; }

  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 10px 12px;
  }
  .topbar-menu { display: grid !important; }
  .brand-collapse { display: grid; }

  .topbar-center h2 { font-size: 15px; }
  .topbar-sub { font-size: 11px; }

  .stage { grid-template-columns: 1fr; }

  /* 独立立绘栏隐藏，改为对话区背景 */
  .hero-panel { display: none; }

  .mobile-hero-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
  }
  .mobile-hero-bg img {
    position: relative;
    left: auto;
    bottom: auto;
    height: min(62vh, 520px);
    width: auto;
    max-width: min(86%, 360px);
    object-fit: contain;
    object-position: center center;
    opacity: 0.2;
    filter: drop-shadow(0 0 5px rgba(69,224,255,.28));
    animation: mobile-knight-float 4.5s ease-in-out infinite;
    will-change: transform;
    transform-origin: center center;
  }
  @keyframes mobile-knight-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
  }
  .chat-panel {
    background: linear-gradient(180deg, rgba(6,10,20,.72), rgba(6,10,20,.88));
  }
  .msg.assistant .bubble,
  .msg.user .bubble {
    backdrop-filter: blur(6px);
  }
  .welcome {
    background: rgba(8,12,22,.35);
    border-radius: 16px;
    backdrop-filter: blur(4px);
  }
}

@media (max-width: 560px) {
  .topbar { min-height: 60px; padding: 8px 10px; }
  .topbar-center h2 { font-size: 13px; }
  .topbar-sub {
    display: block !important;
    font-size: 11px;
    margin-top: 1px;
    color: var(--cyan-2);
    letter-spacing: .04em;
    font-weight: 600;
  }
  .messages { padding: 14px 12px 10px; }
  .composer { padding: 10px 12px 14px; }
  .btn-icon { width: 36px; height: 36px; }
  .mobile-hero-bg img {
    opacity: 0.2;
    height: min(58vh, 420px);
    max-width: min(88%, 320px);
  }
  .quick-chips { gap: 6px; }
  .quick-chips button { font-size: 11px; padding: 5px 10px; }
}


/* 系统减少动效时降级 */
@media (prefers-reduced-motion: reduce) {
  .hero-panel::before,
  .hero-panel::after,
  .hero-frame,
  .hero-glow,
  .hero-img,
  .hero-energy,
  .hero-caption,
  .hero-badge,
  .mobile-hero-bg img,
  .orb {
    animation: none !important;
  }
}


@media (min-width: 961px) {
  .topbar-right { min-width: 0; }
}
