:root {
  --bg: #0a0a0f;
  --panel: #12121a;
  --panel-2: #191922;
  --line: #262633;
  --text: #ececf1;
  --muted: #8b8b9c;
  --cyan: #25f4ee;
  --pink: #fe2c55;
  --grad: linear-gradient(120deg, #25f4ee, #7b61ff 45%, #fe2c55);
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; cursor: pointer; }

/* ---------- 背景光斑 ---------- */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.bg-orbs i {
  position: absolute;
  width: 46vmax; height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .22;
  animation: float 18s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.bg-orbs i:nth-child(1) { background: #25f4ee; top: -16vmax; left: -12vmax; }
.bg-orbs i:nth-child(2) { background: #fe2c55; bottom: -20vmax; right: -14vmax; }
.bg-orbs i:nth-child(3) { background: #7b61ff; top: 30%; left: 55%; }

@keyframes float {
  0%, 100% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(4vmax,-4vmax,0) scale(1.12); }
}

/* ---------- 登录页 ---------- */
.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  min-height: 100dvh;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: rgba(18,18,26,.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px 28px 22px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.8);
  animation: rise .45s cubic-bezier(.2,.7,.3,1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.brand { text-align: center; }
.logo { display: inline-flex; filter: drop-shadow(0 6px 18px rgba(254,44,85,.35)); }
.brand h1 {
  margin: 12px 0 6px;
  font-size: 24px;
  letter-spacing: .5px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand .sub { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.stage { margin: 26px 0 18px; min-height: 300px; display: grid; place-items: center; }

.qr-frame {
  width: 232px; height: 232px;
  border-radius: 18px;
  background: #fff;
  padding: 10px;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.qr-frame img { width: 100%; height: 100%; display: block; border-radius: 10px; object-fit: contain; }

.skeleton {
  background: linear-gradient(100deg, #1e1e2a 25%, #2a2a3a 37%, #1e1e2a 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.skeleton-wrap { text-align: center; }
.skeleton-wrap .qr-frame { margin: 0 auto; }

.hint { color: var(--muted); font-size: 13px; margin: 16px 0 0; text-align: center; line-height: 1.6; }

.status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--cyan); margin-right: 6px;
  box-shadow: 0 0 0 0 rgba(37,244,238,.6);
  animation: pulse 1.8s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(37,244,238,.55); }
  70% { box-shadow: 0 0 0 9px rgba(37,244,238,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,244,238,0); }
}

.notice {
  border: 1px solid rgba(254,44,85,.32);
  background: rgba(254,44,85,.07);
  border-radius: 14px;
  padding: 16px 16px 14px;
  text-align: left;
  font-size: 13px;
  line-height: 1.68;
  color: #ffd9e2;
}
.notice b { color: #fff; display: block; margin-bottom: 6px; font-size: 13.5px; }
.notice code {
  background: rgba(0,0,0,.34);
  padding: 1px 5px; border-radius: 5px;
  font-size: 12px; font-family: ui-monospace, Menlo, Consolas, monospace;
  word-break: break-all;
}
.notice ul { margin: 8px 0 0; padding-left: 18px; color: #ffc2d0; }
.notice li { margin: 4px 0; }

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 13px;
  font-size: 12.5px;
  transition: .18s;
}
.ghost:hover { color: var(--text); border-color: #3b3b4d; background: var(--panel-2); }

.link { color: var(--muted); font-size: 12px; text-decoration: none; }
.link:hover { color: var(--cyan); }

/* ---------- 助手页 ---------- */
.app-page { display: flex; flex-direction: column; height: 100dvh; }

.app-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(18,18,26,.8);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  position: sticky; top: 0; z-index: 10;
}
.app-head .title { font-weight: 600; font-size: 15px; }
.app-head .badge {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.app-head .badge.live { color: #6ef2c1; border-color: rgba(110,242,193,.35); background: rgba(110,242,193,.08); }
.app-head .badge.demo { color: #ffd166; border-color: rgba(255,209,102,.35); background: rgba(255,209,102,.08); }
.app-head .spacer { flex: 1; }

.chat {
  flex: 1;
  overflow-y: auto;
  padding: 26px 18px 12px;
  scroll-behavior: smooth;
}
.chat-inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }

.msg { display: flex; gap: 11px; animation: fade .25s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg.user { flex-direction: row-reverse; }

.avatar {
  flex: 0 0 32px; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; font-size: 13px; font-weight: 600;
  background: var(--panel-2); border: 1px solid var(--line);
}
.msg.assistant .avatar { background: var(--grad); color: #0a0a0f; border: 0; }
.msg.user .avatar { background: #2a2a3a; }

.bubble {
  max-width: min(640px, 78%);
  padding: 12px 15px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.assistant .bubble { background: var(--panel); border: 1px solid var(--line); border-top-left-radius: 6px; }
.msg.user .bubble { background: linear-gradient(135deg, #2a2a3a, #22222e); border-top-right-radius: 6px; }

.bubble code {
  background: rgba(0,0,0,.4); padding: 1.5px 5px; border-radius: 5px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px;
}
.bubble strong { color: #fff; }

.reasoning {
  margin-bottom: 9px;
  padding: 9px 12px;
  border-left: 2px solid #3b3b4d;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
  border-radius: 0 8px 8px 0;
  background: rgba(255,255,255,.018);
}
.reasoning summary { cursor: pointer; color: #6b6b80; font-size: 12px; user-select: none; }

.tool-chip {
  display: inline-flex; align-items: center; gap: 7px;
  margin: 6px 0;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(37,244,238,.07);
  border: 1px solid rgba(37,244,238,.22);
  color: #8ff8f4;
}
.tool-chip.running .spinner {
  width: 11px; height: 11px; border-radius: 50%;
  border: 1.6px solid rgba(143,248,244,.3); border-top-color: #25f4ee;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.tool-chip.done { color: #6ef2c1; border-color: rgba(110,242,193,.25); background: rgba(110,242,193,.06); }
.tool-chip.mock { color: #ffd166; border-color: rgba(255,209,102,.25); background: rgba(255,209,102,.06); }

.cards { display: grid; gap: 9px; margin: 11px 0 4px; }
.card {
  padding: 11px 13px;
  border-radius: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.55;
}
.card .row1 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card .name { color: #fff; font-weight: 500; }
.card .stat { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.card a { color: var(--cyan); text-decoration: none; font-size: 11.5px; }

.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%; background: var(--muted);
  animation: bounce 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

/* 输入区 */
.composer {
  border-top: 1px solid var(--line);
  padding: 14px 18px 18px;
  background: rgba(10,10,15,.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.composer-inner { max-width: 780px; margin: 0 auto; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 11px; }
.chip {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  transition: .18s;
}
.chip:hover { color: var(--text); border-color: #3b3b4d; transform: translateY(-1px); }

.input-row {
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 8px 8px 14px;
  transition: border-color .18s;
}
.input-row:focus-within { border-color: rgba(37,244,238,.4); }

#input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.6;
  resize: none;
  max-height: 160px;
  padding: 7px 0;
}
#input::placeholder { color: #5c5c70; }

#send {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  border: 0; border-radius: 11px;
  background: var(--grad);
  color: #0a0a0f;
  display: grid; place-items: center;
  transition: .18s;
}
#send:disabled { opacity: .35; cursor: not-allowed; }
#send:not(:disabled):hover { transform: scale(1.05); }

.foot-note { margin: 9px 0 0; text-align: center; color: #4e4e60; font-size: 11.5px; }

.hidden { display: none !important; }

@media (max-width: 560px) {
  .login-card { padding: 28px 20px 18px; }
  .stage { min-height: 260px; }
  .qr-frame { width: 208px; height: 208px; }
  .bubble { max-width: 84%; font-size: 14px; }
  .chat { padding: 18px 12px 8px; }
  .composer { padding: 12px 12px 14px; }
}
