* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg1: #05081a;
  --bg2: #0a0e26;
  --bg3: #10163c;
  --accent: #7c5cff;
  --accent2: #36d1dc;
  --grad: linear-gradient(135deg, #7c5cff, #36d1dc);
  --glass: rgba(255, 255, 255, 0.06);
  --glass2: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.10);
  --text: #e8ecff;
  --muted: #9aa3c7;
  --ok: #7cffb2;
  --warn: #ffd479;
  --cyan: #36d1dc;
  --magenta: #ff4fd8;
  --mono: ui-monospace, Menlo, Consolas, "Cascadia Mono", monospace;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg1);
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
}

.bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(1000px 680px at 16% 6%, rgba(124, 92, 255, 0.24), transparent 62%),
    radial-gradient(900px 560px at 88% 94%, rgba(54, 209, 220, 0.18), transparent 62%),
    radial-gradient(600px 420px at 74% 12%, rgba(255, 79, 216, 0.10), transparent 60%),
    linear-gradient(160deg, var(--bg1), var(--bg2) 55%, var(--bg3));
}
/* HUD 网格 + 扫描线（纯视觉，不挡交互） */
.bg::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(124, 92, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 92, 255, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0.92), transparent 76%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0.92), transparent 76%);
  animation: gridDrift 22s linear infinite;
}
.bg::after {
  content: ""; position: absolute; left: 0; right: 0; top: -30%; height: 160%;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.016) 0px, rgba(255, 255, 255, 0.016) 1px, transparent 1px, transparent 3px);
  animation: scanMove 9s linear infinite;
}
@keyframes gridDrift { to { background-position: 42px 42px; } }
@keyframes scanMove { from { transform: translateY(-20%); } to { transform: translateY(20%); } }

#stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

/* ---------- 顶栏（全息 HUD） ---------- */
.topbar {
  position: relative; z-index: 2;
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  background: rgba(8, 11, 28, 0.62);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid rgba(124, 92, 255, 0.28);
  box-shadow: 0 1px 0 rgba(54, 209, 220, 0.14), 0 10px 30px rgba(0, 0, 0, 0.35);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(124, 92, 255, 0.7), rgba(54, 209, 220, 0.7), transparent);
  filter: blur(0.5px); pointer-events: none;
}
.brand {
  position: relative; font-weight: 800; font-size: 19px; letter-spacing: 2px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 22px rgba(124, 92, 255, 0.35);
  animation: brandFlicker 6s ease-in-out infinite;
}
@keyframes brandFlicker {
  0%, 100% { opacity: 1; transform: none; }
  92% { opacity: 1; }
  93% { opacity: .72; transform: translateX(1px); }
  94% { opacity: 1; transform: translateX(-1px); }
  96% { opacity: .92; transform: none; }
}
.brand .sub { font-size: 11px; color: var(--muted); margin-left: 6px; font-weight: 400; letter-spacing: 1px; -webkit-text-fill-color: var(--muted); }
.status-pill {
  margin-left: auto; font-size: 12px; color: var(--muted);
  background: rgba(124, 92, 255, 0.12); padding: 6px 14px; border-radius: 999px;
  border: 1px solid rgba(124, 92, 255, 0.35);
  letter-spacing: .5px; font-family: var(--mono);
  box-shadow: 0 0 14px rgba(124, 92, 255, 0.15), inset 0 0 8px rgba(124, 92, 255, 0.08);
  text-shadow: 0 0 8px rgba(124, 92, 255, 0.5);
}
.icon-btn {
  background: var(--glass); border: 1px solid var(--border);
  color: var(--text); width: 36px; height: 36px; border-radius: 10px; font-size: 16px;
  cursor: pointer; transition: background .2s, transform .2s, box-shadow .2s;
}
.icon-btn:hover { background: var(--glass2); transform: translateY(-1px); box-shadow: 0 0 14px rgba(124, 92, 255, 0.3); }

/* ---------- 主舞台 ---------- */
.stage {
  position: relative; z-index: 1;
  flex: 1 1 auto; min-height: 0;
  width: 100%; max-width: 840px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 16px 6px; gap: 12px; overflow: hidden;
}

/* orb 能量核心（待机/聆听/说话三态分明） */
.orb-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 2px; flex: 0 0 auto; }
.orb { position: relative; width: 100px; height: 100px; display: grid; place-items: center; }
.orb .core {
  width: 64px; height: 64px; border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, #c9b6ff 0%, var(--accent) 52%, #4526c9 100%);
  display: grid; place-items: center; font-weight: 800; font-size: 16px; letter-spacing: 1px;
  color: #fff; z-index: 3;
  box-shadow:
    0 0 40px rgba(124, 92, 255, 0.65),
    inset 0 0 18px rgba(255, 255, 255, 0.28),
    inset 0 -10px 24px rgba(69, 38, 201, 0.8);
  animation: breathe 4.2s ease-in-out infinite;
}
/* 核心能量环（conic 扫光，电影级全息感） */
.orb .core::before {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  padding: 2px;
  background: conic-gradient(from 0deg, transparent 0deg, rgba(54, 209, 220, 0.85) 60deg, transparent 120deg, transparent 200deg, rgba(124, 92, 255, 0.9) 260deg, transparent 320deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  animation: spin 4s linear infinite;
  pointer-events: none;
}
.orb .core::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.5), transparent 42%);
  pointer-events: none;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.06); filter: brightness(1.25); }
}
.orb .ring { position: absolute; border-radius: 50%; border: 1px solid rgba(124, 92, 255, 0.45); }
.orb .r1 { width: 82px; height: 82px; animation: pulse 3.2s ease-out infinite; }
.orb .r2 { width: 96px; height: 96px; animation: pulse 3.2s ease-out infinite 1.1s; }
.orb .r3 { width: 100px; height: 100px; border-style: dashed; opacity: .5; animation: spin 12s linear infinite; }
@keyframes pulse { 0% { transform: scale(0.88); opacity: .85; } 100% { transform: scale(1.35); opacity: 0; } }

/* 聆听态：青色核心 + 快节奏光环 */
.orb-wrap.listening .ring { border-color: var(--accent2); animation-duration: 1s; }
.orb-wrap.listening .core {
  background: radial-gradient(circle at 32% 30%, #b7f6ff, var(--accent2) 55%, #0b7a9e);
  box-shadow: 0 0 48px rgba(54, 209, 220, 0.8), inset 0 0 16px rgba(255, 255, 255, 0.32);
  animation-duration: 1.1s;
}
/* 说话态：核心亮白青 + 大范围辉光 */
.orb-wrap.speaking .ring { border-color: var(--accent2); animation-duration: 1.4s; }
/* 说话态：整个能量核心高频大幅伸缩（约 3.8Hz、±12%），配合高亮呼吸 */
.orb-wrap.speaking {
  animation: speakPulse 0.26s ease-in-out infinite;
}
@keyframes speakPulse {
  0%   { transform: scale(1); }
  20%  { transform: scale(1.12); }
  45%  { transform: scale(0.98); }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}
/* 说话时背景粒子整体亮度高频呼吸（canvas 之上加 filter，纯视觉、不挡交互） */
body.jarvis-speaking #stars { animation: starPulse 0.32s ease-in-out infinite; }
@keyframes starPulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.45); }
}
.orb-wrap.speaking .core {
  background: radial-gradient(circle at 32% 30%, #eafcff, var(--accent2) 48%, #0f9fc0);
  box-shadow: 0 0 64px rgba(54, 209, 220, 0.95), inset 0 0 20px rgba(255, 255, 255, 0.4);
  animation-duration: 0.8s;
}
.orb-wrap.speaking .orbit-p { animation-duration: 4.5s; }
.orb-wrap.listening .orbit-p .od { background: var(--accent); box-shadow: 0 0 12px rgba(124, 92, 255, 0.9); }
/* 思考态：紫色能量凝聚 + 光环节奏放缓 */
.orb-wrap.thinking .core {
  background: radial-gradient(circle at 32% 30%, #d7c9ff, var(--accent) 55%, #3a1f9e);
  box-shadow: 0 0 44px rgba(124, 92, 255, 0.85), inset 0 0 14px rgba(255, 255, 255, 0.3);
  animation-duration: 2.2s;
}
.orb-wrap.thinking .ring { animation-duration: 1.6s; }
.orb-wrap.thinking .orbit-p { animation-duration: 10s; }

.waveform { display: flex; gap: 4px; height: 18px; align-items: center; }
.waveform span { width: 4px; height: 6px; border-radius: 2px; background: var(--accent2); opacity: 0.4; box-shadow: 0 0 8px rgba(54, 209, 220, 0.7); }
.orb-wrap.speaking .waveform span { animation: bar 0.55s ease-in-out infinite; }
.orb-wrap.speaking .waveform span:nth-child(2) { animation-delay: .1s }
.orb-wrap.speaking .waveform span:nth-child(3) { animation-delay: .2s }
.orb-wrap.speaking .waveform span:nth-child(4) { animation-delay: .3s }
.orb-wrap.speaking .waveform span:nth-child(5) { animation-delay: .4s }
@keyframes bar { 0%, 100% { height: 6px; opacity: .4 } 50% { height: 18px; opacity: 1 } }
.hint { color: var(--muted); font-size: 12.5px; letter-spacing: .4px; text-shadow: 0 0 10px rgba(154, 163, 199, 0.35); }

/* orb 光环粒子（轨道环线 + 8 粒子） */
.orbit-p { position: absolute; inset: -12px; animation: spin 18s linear infinite; }
.orbit-p::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(54, 209, 220, 0.16); border-top-color: rgba(54, 209, 220, 0.75);
  filter: drop-shadow(0 0 6px rgba(54, 209, 220, 0.55));
}
.orbit-p .od {
  position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent2); box-shadow: 0 0 10px rgba(54, 209, 220, 0.9);
}
.orbit-p .od:nth-child(1) { transform: rotate(0deg) translateX(80px); }
.orbit-p .od:nth-child(2) { transform: rotate(45deg) translateX(80px); }
.orbit-p .od:nth-child(3) { transform: rotate(90deg) translateX(80px); }
.orbit-p .od:nth-child(4) { transform: rotate(135deg) translateX(80px); }
.orbit-p .od:nth-child(5) { transform: rotate(180deg) translateX(80px); }
.orbit-p .od:nth-child(6) { transform: rotate(225deg) translateX(80px); }
.orbit-p .od:nth-child(7) { transform: rotate(270deg) translateX(80px); }
.orbit-p .od:nth-child(8) { transform: rotate(315deg) translateX(80px); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 能力卡片（全息 HUD 状态条） ---------- */
.cap-cards {
  display: flex; gap: 10px; flex-wrap: wrap; justify-content: center;
  width: 100%; max-width: 840px; flex: 0 0 auto;
}
.cap-card {
  flex: 1 1 0; min-width: 0; position: relative; overflow: hidden;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(124, 92, 255, 0.28);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
  padding: 10px 14px; display: flex; flex-direction: column; gap: 3px;
  backdrop-filter: blur(8px); transition: border-color .3s, box-shadow .3s, transform .2s;
}
.cap-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(54, 209, 220, 0.8), transparent);
  opacity: .8;
}
.cap-card:hover { border-color: rgba(124, 92, 255, 0.7); box-shadow: 0 0 22px rgba(124, 92, 255, 0.3); transform: translateY(-2px); }
.cap-ico { font-size: 17px; filter: drop-shadow(0 0 6px rgba(124, 92, 255, 0.7)); }
.cap-t { font-size: 11px; color: var(--muted); font-weight: 700; letter-spacing: 1.5px; font-family: var(--mono); }
.cap-v { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 12px rgba(124, 92, 255, 0.25); }

/* ---------- 对话区（全息面板，独立滚动，不被遮挡） ---------- */
.transcript {
  width: 100%; max-width: 840px; flex: 1 1 auto; min-height: 120px; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 12px; padding: 10px 14px 18px;
  background: rgba(10, 13, 30, 0.32);
  border: 1px solid rgba(124, 92, 255, 0.16);
  border-radius: 14px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(54, 209, 220, 0.04);
  backdrop-filter: blur(4px);
}
.transcript::-webkit-scrollbar { width: 8px; }
.transcript::-webkit-scrollbar-thumb { background: rgba(124, 92, 255, 0.4); border-radius: 8px; border: 2px solid rgba(10, 13, 30, 0.6); }
.transcript::-webkit-scrollbar-track { background: transparent; }

.msg {
  max-width: 82%; padding: 11px 15px; border-radius: 16px; font-size: 15px; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word; position: relative;
  animation: rise .3s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg .who { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; letter-spacing: 1px; }
.msg.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 5px; box-shadow: 0 6px 22px rgba(124, 92, 255, 0.35), inset 0 0 14px rgba(255, 255, 255, 0.14); }
.msg.user .who { color: rgba(255, 255, 255, 0.8); text-align: right; }
.msg.assistant {
  align-self: flex-start; background: rgba(20, 26, 60, 0.75);
  border: 1px solid rgba(124, 92, 255, 0.3);
  border-bottom-left-radius: 5px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35), inset 0 0 20px rgba(124, 92, 255, 0.06);
  backdrop-filter: blur(6px);
}
/* 小玥消息顶部流光扫描（Jarvis 全息质感） */
.msg.assistant::before {
  content: ""; position: absolute; left: 8px; right: 8px; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(54, 209, 220, 0.85), transparent);
  opacity: .9; pointer-events: none;
}
/* 流式打字光标 */
.msg.assistant .typing::after {
  content: "▍"; margin-left: 2px; color: var(--accent2);
  animation: caretBlink .8s steps(2, start) infinite;
  text-shadow: 0 0 10px rgba(54, 209, 220, 0.9);
}
@keyframes caretBlink { 50% { opacity: 0; } }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: 12.5px; text-align: center; max-width: 92%; padding: 4px 8px; animation: none; letter-spacing: .3px; }

/* 确认卡片 */
.confirm-card {
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 200, 120, 0.4);
  border-radius: 14px; padding: 12px 14px; margin-top: 4px;
}
.cc-title { font-weight: 800; color: var(--warn); font-size: 14px; margin-bottom: 4px; }
.cc-desc { font-size: 13px; color: var(--text); margin-bottom: 8px; }
.cc-preview {
  white-space: pre-wrap; word-break: break-word; font-size: 12.5px; color: var(--muted);
  background: rgba(0, 0, 0, 0.28); border-radius: 10px; padding: 8px 10px; margin: 0 0 10px;
  max-height: 180px; overflow: auto; font-family: ui-monospace, Menlo, Consolas, monospace;
}
.cc-actions { display: flex; gap: 8px; }
.cc-ok, .cc-no { border: none; padding: 8px 14px; border-radius: 10px; font-size: 13px; cursor: pointer; font-weight: 700; }
.cc-ok { background: var(--grad); color: #fff; }
.cc-no { background: var(--glass); color: var(--muted); border: 1px solid var(--border); }
.cc-wait, .cc-done { font-size: 13px; color: var(--accent2); }

/* ---------- 示例 chips（全息胶囊） ---------- */
.chips {
  flex: 0 0 auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  padding: 2px 16px 6px; z-index: 2;
}
.chip {
  background: rgba(20, 26, 60, 0.55); border: 1px solid rgba(124, 92, 255, 0.35); color: var(--text);
  padding: 7px 16px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 0 10px rgba(124, 92, 255, 0.12);
}
.chip:hover { background: rgba(124, 92, 255, 0.3); transform: translateY(-2px); box-shadow: 0 0 18px rgba(124, 92, 255, 0.35); }

/* ---------- 底部输入栏（全息控制台，不遮挡对话） ---------- */
.controls {
  flex: 0 0 auto; position: relative; z-index: 2;
  display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(8, 11, 28, 0.95), rgba(8, 11, 28, 0.6));
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-top: 1px solid rgba(124, 92, 255, 0.3);
  box-shadow: 0 -1px 0 rgba(54, 209, 220, 0.12);
}
.mic-btn {
  background: linear-gradient(135deg, #7c5cff, #36d1dc); color: #fff; border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 12px 20px; border-radius: 14px; font-size: 15px; font-weight: 700; cursor: pointer; white-space: nowrap;
  box-shadow: 0 6px 22px rgba(124, 92, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform .15s, box-shadow .15s, filter .2s;
}
.mic-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(54, 209, 220, 0.45); filter: brightness(1.1); }
.mic-btn:active { transform: translateY(0); }
.mic-btn:disabled { opacity: .6; cursor: not-allowed; filter: grayscale(.4); }
.text-input {
  flex: 1; background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(124, 92, 255, 0.3); color: var(--text);
  padding: 12px 14px; border-radius: 14px; font-size: 15px; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.text-input:focus { border-color: rgba(54, 209, 220, 0.7); box-shadow: 0 0 0 3px rgba(54, 209, 220, 0.15), 0 0 18px rgba(54, 209, 220, 0.2); }
.text-input::placeholder { color: var(--muted); }
.send-btn { background: rgba(124, 92, 255, 0.16); border: 1px solid rgba(124, 92, 255, 0.4); color: var(--text); padding: 12px 20px; border-radius: 14px; cursor: pointer; transition: background .2s, box-shadow .2s, transform .15s; }
.send-btn:hover { background: rgba(124, 92, 255, 0.34); box-shadow: 0 0 16px rgba(124, 92, 255, 0.35); transform: translateY(-1px); }

/* ---------- 记忆面板（全息抽屉） ---------- */
.mem-panel {
  position: fixed; top: 0; right: 0; height: 100%; width: 320px; max-width: 86vw; z-index: 30;
  background: linear-gradient(180deg, rgba(16, 20, 44, 0.98), rgba(8, 11, 28, 0.98));
  border-left: 1px solid rgba(124, 92, 255, 0.35);
  transform: translateX(100%); transition: transform .3s ease; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.6), -2px 0 20px rgba(124, 92, 255, 0.14);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.mem-panel.open { transform: translateX(0); }
.mem-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; letter-spacing: 1.5px; font-family: var(--mono); text-shadow: 0 0 14px rgba(54, 209, 220, 0.5); }
.mem-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.mem-item {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(124, 92, 255, 0.28); padding: 10px 12px; border-radius: 12px; font-size: 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}
.mem-item .k { color: var(--accent2); font-size: 12px; letter-spacing: .5px; }
.mem-item .del { float: right; cursor: pointer; color: var(--muted); }
.mem-add { display: flex; flex-direction: column; gap: 8px; }
.mem-add input { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(124, 92, 255, 0.3); color: var(--text); padding: 10px; border-radius: 10px; outline: none; }
.mem-add input:focus { border-color: rgba(54, 209, 220, 0.6); box-shadow: 0 0 12px rgba(54, 209, 220, 0.2); }
.mem-add button { background: linear-gradient(135deg, #7c5cff, #36d1dc); color: #fff; border: none; padding: 10px; border-radius: 10px; cursor: pointer; box-shadow: 0 4px 14px rgba(124, 92, 255, 0.35); }
.mem-add button:hover { filter: brightness(1.1); }

/* ---------- 系统加载遮罩 ---------- */
#boot {
  position: fixed; inset: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(900px 600px at 30% 20%, rgba(124, 92, 255, 0.2), transparent 60%),
    radial-gradient(700px 500px at 80% 80%, rgba(54, 209, 220, 0.14), transparent 60%), #070a18;
  transition: opacity .45s ease, visibility .45s;
}
#boot.done { opacity: 0; visibility: hidden; }
.boot-box { width: min(320px, 76vw); text-align: center; }
.boot-title {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px; letter-spacing: 3px;
  color: var(--accent2); margin-bottom: 14px; text-shadow: 0 0 18px rgba(54, 209, 220, 0.8);
}
.boot-bar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--border); overflow: hidden; }
.boot-fill { height: 100%; width: 0%; border-radius: 999px; background: var(--grad); box-shadow: 0 0 16px rgba(124, 92, 255, 0.8); transition: width .12s linear; }
.boot-text { margin-top: 12px; font-size: 13px; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }

/* ---------- 访问鉴权登录层（美化） ---------- */
#loginOverlay {
  position: fixed; inset: 0; z-index: 1000;
  display: none; align-items: center; justify-content: center;
  background: rgba(5, 7, 18, 0.72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.login-box {
  width: min(360px, 86vw); text-align: center;
  background: rgba(18, 22, 48, 0.92); border: 1px solid var(--border);
  border-radius: 22px; padding: 34px 28px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 92, 255, 0.1), 0 0 60px rgba(124, 92, 255, 0.18);
  animation: rise .3s ease both;
}
.login-title {
  font-size: 22px; font-weight: 800; margin-bottom: 8px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.login-sub { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
#loginPass {
  width: 100%; background: var(--glass); border: 1px solid var(--border); color: var(--text);
  padding: 13px 14px; border-radius: 13px; font-size: 15px; outline: none; margin-bottom: 10px;
  text-align: center; letter-spacing: 2px;
}
#loginPass:focus { border-color: rgba(124, 92, 255, 0.6); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18); }
#loginPass::placeholder { color: var(--muted); letter-spacing: 0; }
.login-err { color: #ff8a8a; font-size: 12.5px; min-height: 16px; margin-bottom: 8px; }
#loginBtn {
  width: 100%; background: var(--grad); color: #fff; border: none;
  padding: 13px; border-radius: 13px; font-size: 15px; font-weight: 800; cursor: pointer;
  box-shadow: 0 8px 22px rgba(124, 92, 255, 0.35); transition: transform .15s, box-shadow .15s;
}
#loginBtn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(54, 209, 220, 0.4); }
#loginBtn:disabled { opacity: .6; cursor: not-allowed; }

/* ---------- 移动端适配 ---------- */
@media (max-width: 600px) {
  .topbar { padding: 12px 14px; }
  .brand { font-size: 16px; }
  .stage { padding: 10px 12px 4px; gap: 10px; }
  .orb { width: 76px; height: 76px; }
  .orb .core { width: 48px; height: 48px; font-size: 13px; }
  .orb .core::before { inset: -4px; }
  .orb .r1 { width: 62px; height: 62px; }
  .orb .r2 { width: 72px; height: 72px; }
  .orb .r3 { width: 76px; height: 76px; }
  .orbit-p { inset: -10px; }
  .orbit-p .od { width: 4px; height: 4px; }
  .orbit-p .od:nth-child(n) { transform: rotate(0deg) translateX(58px); }
  .cap-card { flex: 1 1 44%; }
  .cap-ico { font-size: 15px; }
  .cap-t { font-size: 10.5px; }
  .cap-v { font-size: 11.5px; }
  .transcript { padding: 8px 10px 14px; }
  .msg { font-size: 14.5px; max-width: 86%; }
  .controls { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); gap: 8px; }
  .mic-btn { padding: 11px 14px; font-size: 14px; }
  .text-input { padding: 11px 12px; font-size: 14px; }
  .send-btn { padding: 11px 14px; font-size: 14px; }
}

/* ---------- 减弱动画偏好：关掉高频/耗电动画，保证流畅 ---------- */
@media (prefers-reduced-motion: reduce) {
  .orb .core { animation: none; }
  .orb .core::before { animation-duration: 12s; }
  .orb .ring, .orbit-p { animation: none; }
  .orb-wrap.speaking { animation: none; }
  body.jarvis-speaking #stars { animation: none; }
  .waveform span { animation: none !important; }
  .msg.assistant .typing::after { animation: none; }
  .topbar::after { animation: none; }
  .brand { animation: none; }
  .bg::before, .bg::after { animation-duration: 40s; }
}
