/* ============================================================
   灵光 Studio · 设计系统
   ============================================================ */
:root {
  --bg: #06070d;
  --bg-soft: #0a0c16;
  --panel: rgba(255, 255, 255, 0.042);
  --panel-2: rgba(255, 255, 255, 0.065);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1fa;
  --text-2: #b9c0d6;
  --muted: #7f88a3;
  --indigo: #7b6cff;
  --blue: #4d9dff;
  --cyan: #37d8e0;
  --green: #34d399;
  --red: #ff6b81;
  --amber: #f5b544;
  --grad: linear-gradient(135deg, #7b6cff 0%, #4d9dff 55%, #37d8e0 100%);
  --grad-soft: linear-gradient(135deg, rgba(123, 108, 255, 0.18), rgba(55, 216, 224, 0.12));
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.85);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* 极光背景 */
.aurora {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.aurora::before, .aurora::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: .5;
}
.aurora::before {
  width: 62vw; height: 62vw; left: -18vw; top: -24vw;
  background: radial-gradient(circle at 30% 30%, rgba(123, 108, 255, .55), transparent 62%);
}
.aurora::after {
  width: 55vw; height: 55vw; right: -14vw; bottom: -22vw;
  background: radial-gradient(circle at 60% 40%, rgba(55, 216, 224, .4), transparent 62%);
}
.aurora i {
  position: absolute; width: 40vw; height: 40vw; left: 40%; top: 10%;
  border-radius: 50%; filter: blur(110px); opacity: .3;
  background: radial-gradient(circle, rgba(77, 157, 255, .6), transparent 65%);
}
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--blue); text-decoration: none; }
::selection { background: rgba(123, 108, 255, .4); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.11); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.2); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   登录页
   ============================================================ */
#login {
  position: relative; z-index: 2; height: 100%;
  display: grid; grid-template-columns: 1.05fr 0.95fr; align-items: center;
  max-width: 1180px; margin: 0 auto; padding: 0 48px; gap: 64px;
}
#login.hidden { display: none; }

.brand-row { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.logo {
  width: 42px; height: 42px; border-radius: 13px; background: var(--grad);
  display: grid; place-items: center; box-shadow: 0 10px 30px -8px rgba(77, 157, 255, .7);
  position: relative; overflow: hidden;
}
.logo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255,255,255,.55), transparent 55%);
  mix-blend-mode: overlay;
}
.logo svg { width: 22px; height: 22px; }
.brand-name { font-size: 17px; font-weight: 650; letter-spacing: .3px; }
.brand-name span { color: var(--muted); font-weight: 450; margin-left: 8px; font-size: 13px; letter-spacing: 0; }

.hero h1 {
  font-size: 46px; line-height: 1.18; font-weight: 700; letter-spacing: -1.2px; margin-bottom: 20px;
}
.hero h1 em {
  font-style: normal;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--text-2); font-size: 15.5px; max-width: 430px; line-height: 1.75; }

.caps { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 30px; }
.cap {
  display: flex; align-items: center; gap: 8px; padding: 9px 15px 9px 12px;
  border-radius: 999px; background: var(--panel); border: 1px solid var(--line);
  font-size: 13px; color: var(--text-2); backdrop-filter: blur(12px);
}
.cap svg { width: 15px; height: 15px; opacity: .8; }
.cap-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

/* 二维码卡片 */
.qr-card {
  background: linear-gradient(165deg, rgba(255,255,255,.09), rgba(255,255,255,.028));
  border: 1px solid var(--line-strong); border-radius: 26px; padding: 28px;
  box-shadow: var(--shadow); backdrop-filter: blur(22px); position: relative;
}
.qr-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.qr-title { font-size: 15.5px; font-weight: 620; }
.qr-badge {
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px; font-weight: 550;
  background: rgba(52, 211, 153, .12); color: var(--green); border: 1px solid rgba(52,211,153,.28);
  display: flex; align-items: center; gap: 6px;
}
.qr-badge.warn { background: rgba(245,181,68,.12); color: var(--amber); border-color: rgba(245,181,68,.3); }
.qr-badge.dead { background: rgba(255,107,129,.12); color: var(--red); border-color: rgba(255,107,129,.3); }

.qr-stage {
  position: relative; width: 100%; aspect-ratio: 1; max-width: 260px; margin: 0 auto 18px;
  border-radius: 20px; background: #fff; padding: 13px; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,.5), 0 20px 50px -24px rgba(0,0,0,.9);
}
.qr-stage img { width: 100%; height: 100%; display: block; }

.scanline {
  position: absolute; left: 8%; right: 8%; height: 2px; top: 0;
  background: linear-gradient(90deg, transparent, #4d9dff, #37d8e0, transparent);
  box-shadow: 0 0 14px 2px rgba(77,157,255,.85); border-radius: 2px;
  animation: scan 2.4s cubic-bezier(.5,0,.5,1) infinite;
}
@keyframes scan {
  0% { transform: translateY(8px); opacity: 0; }
  12% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translateY(238px); opacity: 0; }
}
.qr-stage.done .scanline { display: none; }
.qr-stage .veil {
  position: absolute; inset: 0; display: grid; place-items: center; gap: 10px;
  background: rgba(255,255,255,.94); color: #0b0d18; font-weight: 620; font-size: 14px;
  flex-direction: column; text-align: center; padding: 20px;
}
.qr-stage .veil svg { width: 46px; height: 46px; color: var(--green); }
.qr-stage .veil small { font-weight: 450; color: #5b6478; font-size: 12px; }

.qr-status { text-align: center; font-size: 13px; color: var(--text-2); min-height: 22px; }
.qr-status b { color: var(--cyan); font-weight: 600; }

/* 配对码 */
.pair-box {
  margin-top: 16px; padding: 13px 14px; border-radius: 14px;
  background: rgba(123, 108, 255, .07); border: 1px dashed rgba(123, 108, 255, .35);
  text-align: center;
}
.pair-label { font-size: 11px; color: var(--muted); letter-spacing: .4px; margin-bottom: 6px; }
.pair-code {
  font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: 7px;
  color: #fff; text-indent: 7px;
  background: var(--grad); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.pair-tip { font-size: 10.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.pair-tip b { color: var(--text-2); font-weight: 500; }
.qr-note {
  margin-top: 12px; font-size: 10.5px; line-height: 1.65; color: #f0b96a;
  background: rgba(245, 181, 68, .08); border: 1px solid rgba(245, 181, 68, .22);
  border-radius: 10px; padding: 9px 11px;
}

.qr-steps { display: flex; gap: 6px; margin-top: 18px; }
.step {
  flex: 1; text-align: center; font-size: 11.5px; color: var(--muted);
  padding: 9px 4px; border-radius: 10px; background: rgba(255,255,255,.03);
  border: 1px solid transparent; transition: .25s;
}
.step.on { color: var(--text); background: var(--grad-soft); border-color: rgba(123,108,255,.3); }
.step i { display: block; font-style: normal; font-size: 10px; opacity: .55; margin-bottom: 2px; }

.qr-actions { margin-top: 18px; display: flex; flex-direction: column; gap: 9px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 12px; font-size: 13.5px; font-weight: 560;
  transition: .18s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 12px 26px -12px rgba(77,157,255,.9); }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-ghost { background: var(--panel); border: 1px solid var(--line); color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-strong); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; filter: none !important; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 12.5px; border-radius: 9px; }

.copy-link {
  margin-top: 14px; font-size: 11.5px; color: var(--muted); text-align: center;
  word-break: break-all; line-height: 1.5;
}
.copy-link b { color: var(--text-2); cursor: pointer; font-weight: 500; }
.copy-link b:hover { color: var(--cyan); }

/* ============================================================
   应用主框架
   ============================================================ */
#app { position: relative; z-index: 2; height: 100%; display: flex; }
#app.hidden { display: none; }

.sidebar {
  width: 236px; flex: 0 0 236px; border-right: 1px solid var(--line);
  background: rgba(8, 10, 18, .6); backdrop-filter: blur(20px);
  display: flex; flex-direction: column; padding: 20px 14px 14px;
}
.side-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.side-brand .logo { width: 34px; height: 34px; border-radius: 11px; }
.side-brand .logo svg { width: 18px; height: 18px; }
.side-brand div { font-size: 14.5px; font-weight: 640; letter-spacing: .2px; }
.side-brand div span { display: block; font-size: 10.5px; color: var(--muted); font-weight: 450; letter-spacing: .4px; }

.nav-label { font-size: 10.5px; color: var(--muted); letter-spacing: 1.1px; padding: 0 10px; margin: 8px 0 8px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 11px;
  border-radius: 11px; color: var(--text-2); font-size: 13.5px; font-weight: 500;
  width: 100%; text-align: left; transition: .16s; margin-bottom: 2px; position: relative;
}
.nav-item svg { width: 17px; height: 17px; opacity: .75; flex: 0 0 17px; }
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.active { background: var(--grad-soft); color: #fff; }
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--grad);
}

.side-foot { margin-top: auto; padding-top: 14px; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 13px;
  background: var(--panel); border: 1px solid var(--line);
}
.avatar {
  width: 32px; height: 32px; border-radius: 10px; background: var(--grad); flex: 0 0 32px;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; letter-spacing: .5px;
}
.user-meta { min-width: 0; flex: 1; }
.user-meta b { display: block; font-size: 12.5px; font-weight: 570; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 10.5px; color: var(--muted); }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted);
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.icon-btn svg { width: 15px; height: 15px; }

/* 主区 */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 62px; flex: 0 0 62px; display: flex; align-items: center; gap: 14px;
  padding: 0 26px; border-bottom: 1px solid var(--line);
}
.topbar h2 { font-size: 15.5px; font-weight: 620; letter-spacing: .1px; }
.topbar h2 small { font-weight: 450; color: var(--muted); font-size: 12.5px; margin-left: 9px; }
.topbar .spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px;
  border-radius: 999px; font-size: 11.5px; color: var(--text-2);
  background: var(--panel); border: 1px solid var(--line); font-weight: 500;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 7px var(--green); }
.chip.warn .dot { background: var(--amber); box-shadow: 0 0 7px var(--amber); }

.view { flex: 1; min-height: 0; display: none; flex-direction: column; }
.view.active { display: flex; }

/* ============================================================
   对话
   ============================================================ */
.chat-scroll { flex: 1; overflow-y: auto; padding: 26px 0 10px; }
.chat-inner { max-width: 780px; margin: 0 auto; padding: 0 26px; }

.welcome { text-align: center; padding: 8vh 0 0; }
.welcome .halo {
  width: 74px; height: 74px; margin: 0 auto 22px; border-radius: 24px; background: var(--grad);
  display: grid; place-items: center; box-shadow: 0 20px 60px -18px rgba(77,157,255,.85);
  animation: float 5s ease-in-out infinite;
}
.welcome .halo svg { width: 34px; height: 34px; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.welcome h3 { font-size: 24px; font-weight: 660; letter-spacing: -.4px; margin-bottom: 8px; }
.welcome p { color: var(--muted); font-size: 13.5px; }
.suggests { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 30px; }
.suggest {
  text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--line); transition: .18s; color: var(--text-2);
}
.suggest:hover { background: var(--panel-2); border-color: var(--line-strong); transform: translateY(-2px); color: var(--text); }
.suggest b { display: block; font-size: 13px; font-weight: 580; margin-bottom: 3px; color: var(--text); }
.suggest span { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

.msg { display: flex; gap: 13px; margin-bottom: 22px; animation: rise .3s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.msg .who {
  width: 28px; height: 28px; border-radius: 9px; flex: 0 0 28px; display: grid;
  place-items: center; font-size: 10.5px; font-weight: 700; margin-top: 2px;
}
.msg.user .who { background: rgba(255,255,255,.09); color: var(--text-2); }
.msg.ai .who { background: var(--grad); color: #fff; }
.msg .body { min-width: 0; flex: 1; }
.msg .name { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; display: flex; align-items: center; gap: 8px; }
.msg.user .content {
  background: rgba(255,255,255,.055); border: 1px solid var(--line);
  padding: 11px 15px; border-radius: 14px 14px 14px 4px; white-space: pre-wrap; word-break: break-word;
}
.msg.ai .content { padding-top: 2px; }

.md { font-size: 14.2px; line-height: 1.78; color: var(--text-2); word-break: break-word; }
.md > *:first-child { margin-top: 0; }
.md h1, .md h2, .md h3, .md h4 { color: var(--text); font-weight: 640; margin: 20px 0 9px; line-height: 1.4; }
.md h3 { font-size: 15px; }
.md h2 { font-size: 16.5px; }
.md p { margin: 10px 0; }
.md strong { color: var(--text); font-weight: 620; }
.md em { color: var(--text-2); }
.md ul, .md ol { margin: 10px 0 10px 4px; padding-left: 18px; }
.md li { margin: 5px 0; }
.md li::marker { color: var(--indigo); }
.md code {
  font-family: var(--mono); font-size: 12.3px; background: rgba(123,108,255,.15);
  padding: 2px 6px; border-radius: 5px; color: #c3bfff; border: 1px solid rgba(123,108,255,.18);
}
.md pre {
  background: rgba(0,0,0,.4); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; overflow-x: auto; margin: 12px 0;
}
.md pre code { background: none; border: none; padding: 0; color: #cfd6ea; font-size: 12.5px; line-height: 1.65; }
.md blockquote {
  border-left: 2px solid var(--indigo); padding: 2px 0 2px 14px; margin: 12px 0;
  color: var(--muted); font-size: 13.3px;
}
.md hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.md a { color: var(--blue); }
.md table { border-collapse: collapse; margin: 12px 0; font-size: 13px; width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 7px 11px; text-align: left; }
.md th { background: rgba(255,255,255,.05); color: var(--text); font-weight: 580; }

.cursor {
  display: inline-block; width: 7px; height: 15px; background: var(--cyan);
  vertical-align: -2px; margin-left: 2px; border-radius: 1px; animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.thinking { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.thinking .pulse { display: flex; gap: 3px; }
.thinking .pulse i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--indigo);
  animation: bounce 1.2s ease-in-out infinite;
}
.thinking .pulse i:nth-child(2) { animation-delay: .15s; }
.thinking .pulse i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* 输入区 */
.composer-wrap { padding: 10px 26px 20px; }
.composer {
  max-width: 780px; margin: 0 auto; background: rgba(255,255,255,.05);
  border: 1px solid var(--line-strong); border-radius: 18px; padding: 8px 8px 8px 16px;
  display: flex; align-items: flex-end; gap: 10px; transition: .2s;
  box-shadow: 0 18px 44px -26px rgba(0,0,0,.9);
}
.composer:focus-within { border-color: rgba(123,108,255,.55); box-shadow: 0 0 0 4px rgba(123,108,255,.1), 0 18px 44px -26px rgba(0,0,0,.9); }
.composer textarea {
  flex: 1; background: none; border: none; outline: none; resize: none;
  padding: 9px 0; max-height: 168px; line-height: 1.6; font-size: 14px; color: var(--text);
}
.composer textarea::placeholder { color: var(--muted); }
.send-btn {
  width: 38px; height: 38px; border-radius: 12px; background: var(--grad); color: #fff;
  display: grid; place-items: center; flex: 0 0 38px; transition: .18s;
}
.send-btn:hover { filter: brightness(1.12); }
.send-btn:disabled { opacity: .35; cursor: not-allowed; }
.send-btn svg { width: 17px; height: 17px; }
.composer-hint { max-width: 780px; margin: 9px auto 0; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }

/* ============================================================
   生图 / 生视频
   ============================================================ */
.panel-scroll { flex: 1; overflow-y: auto; }
.panel-inner { max-width: 1000px; margin: 0 auto; padding: 26px; }

.create-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; backdrop-filter: blur(14px);
}
.create-card textarea {
  width: 100%; min-height: 84px; background: rgba(0,0,0,.25); border: 1px solid var(--line);
  border-radius: 13px; padding: 13px 15px; outline: none; resize: vertical; line-height: 1.65;
  transition: .18s; font-size: 14px;
}
.create-card textarea:focus { border-color: rgba(123,108,255,.55); box-shadow: 0 0 0 3px rgba(123,108,255,.09); }
.create-card textarea::placeholder { color: var(--muted); }

.opt-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.opt-label { font-size: 11.5px; color: var(--muted); margin-right: 2px; }
.pill {
  height: 30px; padding: 0 13px; border-radius: 9px; font-size: 12.5px; color: var(--text-2);
  background: rgba(255,255,255,.04); border: 1px solid var(--line); transition: .15s; font-weight: 500;
}
.pill:hover { border-color: var(--line-strong); color: var(--text); }
.pill.on { background: var(--grad-soft); border-color: rgba(123,108,255,.5); color: #fff; }
.create-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.create-foot .spacer { flex: 1; }
.create-foot .note { font-size: 11.5px; color: var(--muted); }

.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-top: 22px; }
.result-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  position: relative; animation: rise .35s ease;
}
.result-card .thumb {
  aspect-ratio: 1; background: rgba(0,0,0,.35); position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.result-card .thumb img, .result-card .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.result-card.wide { grid-column: span 2; }
.result-card.wide .thumb { aspect-ratio: 16/9; }
.result-card .cap { padding: 11px 13px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.result-card .cap b { display: block; color: var(--text-2); font-weight: 520; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.skeleton {
  position: absolute; inset: 0;
  background: linear-gradient(110deg, rgba(255,255,255,.03) 8%, rgba(255,255,255,.09) 22%, rgba(255,255,255,.03) 36%);
  background-size: 220% 100%; animation: shimmer 1.5s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }
.sk-label {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 10px;
  align-items: center; justify-content: center; font-size: 12px; color: var(--muted);
}
.bar { width: 60%; height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--grad); transition: width .3s; border-radius: 3px; }
.err-box {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; text-align: center;
  color: var(--red); font-size: 12px; line-height: 1.6;
}

.act-row { position: absolute; top: 9px; right: 9px; display: flex; gap: 6px; opacity: 0; transition: .18s; }
.result-card:hover .act-row { opacity: 1; }
.act-row button {
  width: 29px; height: 29px; border-radius: 8px; background: rgba(6,8,14,.72); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15); display: grid; place-items: center; color: #dfe4f2;
}
.act-row button:hover { background: rgba(123,108,255,.85); }
.act-row svg { width: 14px; height: 14px; }

.empty {
  text-align: center; padding: 56px 20px; color: var(--muted); font-size: 13px;
  border: 1px dashed var(--line); border-radius: 16px; margin-top: 22px;
}
.empty svg { width: 34px; height: 34px; opacity: .35; margin-bottom: 12px; }

/* 历史 */
.hist-list { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }
.hist-item {
  display: flex; align-items: center; gap: 13px; padding: 12px 15px; border-radius: 13px;
  background: var(--panel); border: 1px solid var(--line); transition: .15s;
}
.hist-item:hover { border-color: var(--line-strong); background: var(--panel-2); }
.hist-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 34px; display: grid; place-items: center;
  background: var(--grad-soft); color: var(--cyan);
}
.hist-icon svg { width: 16px; height: 16px; }
.hist-main { flex: 1; min-width: 0; }
.hist-main b { display: block; font-size: 13px; font-weight: 540; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-main span { font-size: 11px; color: var(--muted); }
.tag { font-size: 11px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.ok { color: var(--green); border-color: rgba(52,211,153,.3); background: rgba(52,211,153,.08); }
.tag.bad { color: var(--red); border-color: rgba(255,107,129,.3); background: rgba(255,107,129,.08); }
.tag.run { color: var(--amber); border-color: rgba(245,181,68,.3); background: rgba(245,181,68,.08); }

/* 设置 */
.set-grid { display: grid; gap: 14px; margin-top: 20px; }
.set-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.set-card h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.set-card h4 svg { width: 15px; height: 15px; opacity: .6; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 12.8px; border-bottom: 1px solid rgba(255,255,255,.05); }
.kv:last-child { border-bottom: none; }
.kv span { color: var(--muted); flex: 0 0 auto; }
.kv b { font-weight: 520; color: var(--text-2); font-family: var(--mono); font-size: 12px; text-align: right; word-break: break-all; }
.hint { font-size: 11.8px; color: var(--muted); line-height: 1.7; margin-top: 10px; }
.hint code { font-family: var(--mono); background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: 4px; color: #c3bfff; }

/* ============================================================
   账号池 / API 密钥 / 文档
   ============================================================ */
.page-lead {
  display: flex; align-items: flex-start; gap: 20px; padding: 2px 0 20px;
  border-bottom: 1px solid var(--line); margin-bottom: 20px;
}
.page-lead > div { flex: 1; min-width: 0; }
.page-lead h3 { font-size: 17px; font-weight: 640; letter-spacing: -.2px; margin-bottom: 6px; }
.page-lead p { font-size: 12.8px; color: var(--muted); line-height: 1.7; max-width: 640px; }
.page-lead .btn { flex: 0 0 auto; }

.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.acct-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 17px 18px; transition: .18s; position: relative; overflow: hidden;
}
.acct-card:hover { border-color: var(--line-strong); background: var(--panel-2); }
.acct-card.active { border-color: rgba(123,108,255,.45); background: linear-gradient(160deg, rgba(123,108,255,.12), rgba(55,216,224,.05)); }
.acct-card.active::after {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--grad);
}
.acct-top { display: flex; align-items: center; gap: 11px; }
.acct-top .avatar { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; font-size: 13px; }
.acct-meta { flex: 1; min-width: 0; }
.acct-meta b { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-meta span { font-size: 11px; color: var(--muted); }
.acct-rename {
  width: 100%; background: rgba(0,0,0,.35); border: 1px solid rgba(123,108,255,.55);
  border-radius: 8px; padding: 3px 8px; outline: none; font-size: 13.5px; font-weight: 600; color: var(--text);
}
.acct-note {
  margin-top: 11px; font-size: 11.5px; color: var(--text-2); background: rgba(255,255,255,.04);
  border-radius: 9px; padding: 7px 10px; line-height: 1.6; word-break: break-word;
}
.acct-stats { display: flex; gap: 8px; margin-top: 13px; }
.acct-stats div {
  flex: 1; background: rgba(0,0,0,.22); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 9px; text-align: center;
}
.acct-stats b { display: block; font-size: 13px; font-weight: 640; font-family: var(--mono); }
.acct-stats span { font-size: 10px; color: var(--muted); }
.acct-actions { display: flex; gap: 7px; margin-top: 13px; }
.acct-actions button {
  height: 31px; padding: 0 11px; border-radius: 9px; font-size: 12px; font-weight: 520;
  background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--text-2);
  display: inline-flex; align-items: center; gap: 6px; transition: .15s;
}
.acct-actions button svg { width: 13px; height: 13px; }
.acct-actions button:hover { background: var(--panel-2); color: var(--text); border-color: var(--line-strong); }
.acct-actions button.primary { background: var(--grad); color: #fff; border-color: transparent; }
.acct-actions button.primary:hover { filter: brightness(1.1); }
.acct-actions button.danger:hover { color: var(--red); border-color: rgba(255,107,129,.45); background: rgba(255,107,129,.1); }
.acct-actions .spacer { flex: 1; }

.key-form {
  background: var(--panel); border: 1px solid var(--line-strong); border-radius: 16px;
  padding: 16px 18px; margin-bottom: 16px; animation: rise .25s ease;
}
.kf-row { display: flex; gap: 14px; flex-wrap: wrap; }
.kf-field { flex: 1; min-width: 200px; }
.kf-field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 6px; }
.kf-field input, .kf-field select {
  width: 100%; height: 38px; background: rgba(0,0,0,.3); border: 1px solid var(--line);
  border-radius: 10px; padding: 0 12px; outline: none; font-size: 13px;
}
.kf-field select { appearance: none; cursor: pointer; }
.kf-field input:focus, .kf-field select:focus { border-color: rgba(123,108,255,.55); }
.kf-foot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.kf-foot .spacer { flex: 1; }
.kf-foot .note { font-size: 11px; color: var(--muted); }

.key-fresh {
  background: linear-gradient(160deg, rgba(52,211,153,.13), rgba(55,216,224,.05));
  border: 1px solid rgba(52,211,153,.35); border-radius: 16px; padding: 16px 18px; margin-bottom: 16px;
  animation: rise .25s ease;
}
.kf-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--green); margin-bottom: 11px; }
.kf-title svg { width: 16px; height: 16px; }
.kf-key { display: flex; align-items: center; gap: 10px; }
.kf-key code {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 12.8px; background: rgba(0,0,0,.45);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; word-break: break-all; color: #d5e7ff;
}
.kf-tip { font-size: 11.5px; color: var(--text-2); margin-top: 10px; line-height: 1.7; }
.kf-tip code { font-family: var(--mono); background: rgba(255,255,255,.08); padding: 1px 6px; border-radius: 5px; color: #c3bfff; }

.key-list { display: flex; flex-direction: column; gap: 9px; }
.key-row {
  display: flex; align-items: center; gap: 13px; padding: 13px 16px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); transition: .15s;
}
.key-row:hover { border-color: var(--line-strong); background: var(--panel-2); }
.key-row.off { opacity: .55; }
.key-icon {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--grad-soft); color: var(--cyan);
}
.key-icon svg { width: 17px; height: 17px; }
.key-main { flex: 1; min-width: 0; }
.key-main b { display: block; font-size: 13px; font-weight: 570; margin-bottom: 2px; }
.key-main code {
  font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: .3px;
  background: rgba(255,255,255,.05); padding: 1px 6px; border-radius: 5px;
}
.key-acct { font-size: 11.5px; color: var(--text-2); max-width: 130px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-stat { font-size: 11px; color: var(--muted); text-align: right; min-width: 92px; line-height: 1.5; }
.key-stat b { display: block; color: var(--text-2); font-weight: 560; font-family: var(--mono); }
.key-ops { display: flex; gap: 6px; }
.key-ops button {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--muted);
  border: 1px solid transparent; transition: .15s;
}
.key-ops button:hover { background: rgba(255,255,255,.08); color: var(--text); border-color: var(--line); }
.key-ops button.danger:hover { color: var(--red); background: rgba(255,107,129,.1); }
.key-ops svg { width: 14px; height: 14px; }

/* 文档 */
.doc { max-width: 820px; }
.doc h4 { font-size: 14.5px; font-weight: 620; margin: 26px 0 10px; display: flex; align-items: center; gap: 9px; }
.doc h4 .idx {
  width: 22px; height: 22px; border-radius: 7px; background: var(--grad-soft); border: 1px solid rgba(123,108,255,.3);
  display: grid; place-items: center; font-size: 11px; color: #c3bfff; font-family: var(--mono);
}
.doc p { font-size: 12.8px; color: var(--text-2); line-height: 1.75; margin-bottom: 10px; }
.doc p code, .doc li code {
  font-family: var(--mono); font-size: 12px; background: rgba(123,108,255,.14);
  border: 1px solid rgba(123,108,255,.18); padding: 1px 6px; border-radius: 5px; color: #c3bfff;
}
.doc-ul { margin: 8px 0 12px; padding-left: 18px; }
.doc-ul li { font-size: 12.8px; color: var(--text-2); line-height: 1.8; }
.doc-ul li::marker { color: var(--indigo); }

.code-block { position: relative; margin: 12px 0 18px; }
.code-block pre {
  background: rgba(0,0,0,.42); border: 1px solid var(--line); border-radius: 13px;
  padding: 15px 16px; overflow-x: auto;
}
.code-block code { font-family: var(--mono); font-size: 12.2px; line-height: 1.7; color: #cfd6ea; white-space: pre; }
.code-block .cb-head {
  display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: var(--muted);
  letter-spacing: .8px; text-transform: uppercase; margin-bottom: 7px;
}
.code-block .cb-head .lang { color: var(--cyan); }
.code-block .cb-copy {
  position: absolute; top: 10px; right: 10px; height: 26px; padding: 0 10px; border-radius: 7px;
  font-size: 11px; color: var(--text-2); background: rgba(255,255,255,.06);
  border: 1px solid var(--line); opacity: 0; transition: .15s;
}
.code-block:hover .cb-copy { opacity: 1; }
.code-block .cb-copy:hover { background: rgba(123,108,255,.3); color: #fff; }

.ep-table { width: 100%; border-collapse: collapse; margin: 12px 0 18px; font-size: 12.3px; }
.ep-table th, .ep-table td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
.ep-table th { background: rgba(255,255,255,.05); color: var(--text); font-weight: 580; font-size: 11.5px; }
.ep-table td { color: var(--text-2); }
.ep-table code { font-family: var(--mono); font-size: 11.8px; color: #c3bfff; }
.ep-table .m { font-family: var(--mono); font-size: 10.5px; padding: 2px 7px; border-radius: 5px; font-weight: 600; }
.ep-table .m.get { background: rgba(52,211,153,.14); color: var(--green); }
.ep-table .m.post { background: rgba(77,157,255,.16); color: var(--blue); }

.doc-note {
  font-size: 11.8px; line-height: 1.75; color: #f0b96a; background: rgba(245,181,68,.08);
  border: 1px solid rgba(245,181,68,.22); border-radius: 11px; padding: 11px 13px; margin: 12px 0 18px;
}
.doc-note b { color: #ffd08a; }
.doc-note code { background: rgba(245,181,68,.14); border-color: rgba(245,181,68,.24); color: #ffd08a; font-family: var(--mono); font-size: 11.5px; padding: 1px 5px; border-radius: 4px; }

/* 登录页「添加账号」横幅 */
.add-banner {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 16px;
  padding: 10px 13px; border-radius: 12px; font-size: 11.5px;
  background: rgba(123,108,255,.12); border: 1px solid rgba(123,108,255,.35);
}
.add-banner[hidden] { display: none; }
.add-banner b { font-size: 12px; color: #cdc7ff; font-weight: 600; }
.add-banner span { color: var(--text-2); flex: 1; min-width: 140px; line-height: 1.5; }
.add-banner button { font-size: 11.5px; color: var(--muted); text-decoration: underline; }
.add-banner button:hover { color: var(--text); }

/* 桥接设备卡片 */
.bridge-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(160deg, rgba(123, 108, 255, 0.09), rgba(55, 216, 224, 0.04));
  padding: 14px 16px;
  margin-bottom: 16px;
}
.bd-head { display: flex; align-items: center; gap: 12px; }
.bd-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: 0 0 auto;
}
.bd-dot.on { background: var(--green); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.14); }
.bd-dot.bad { background: var(--red); }
.bd-dot.run { background: var(--amber); animation: bdPulse 1.6s infinite; }
@keyframes bdPulse { 50% { opacity: 0.35; } }
.bd-meta { flex: 1; min-width: 0; }
.bd-meta b { display: block; font-size: 13.5px; font-weight: 600; }
.bd-meta span { font-size: 11.5px; color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.bd-code {
  margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.bd-code-num {
  font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: 0.22em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-left: 0.22em;
}
.bd-code-tip { font-size: 11.5px; color: var(--muted); text-align: center; line-height: 1.7; }

/* toast */
#toast {
  position: fixed; bottom: 28px; left: 50%; transform: translate(-50%, 20px); z-index: 99;
  background: rgba(16,19,30,.96); border: 1px solid var(--line-strong); color: var(--text);
  padding: 11px 20px; border-radius: 12px; font-size: 13px; backdrop-filter: blur(16px);
  opacity: 0; pointer-events: none; transition: .25s; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 9px;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast svg { width: 15px; height: 15px; color: var(--green); }

/* 绑定页（手机端） */
.bind-page {
  position: relative; z-index: 2; min-height: 100%; display: flex; align-items: center;
  justify-content: center; padding: 24px;
}
.bind-card {
  width: 100%; max-width: 380px; background: linear-gradient(170deg, rgba(255,255,255,.09), rgba(255,255,255,.03));
  border: 1px solid var(--line-strong); border-radius: 24px; padding: 30px 24px;
  box-shadow: var(--shadow); text-align: center; backdrop-filter: blur(24px);
}
.bind-card .logo { margin: 0 auto 18px; width: 52px; height: 52px; border-radius: 16px; }
.bind-card .logo svg { width: 26px; height: 26px; }
.bind-card h1 { font-size: 19px; font-weight: 650; margin-bottom: 8px; letter-spacing: -.2px; }
.bind-card .sub { font-size: 13px; color: var(--muted); line-height: 1.65; }
.scope-list { text-align: left; margin: 22px 0 6px; display: grid; gap: 8px; }
.scope {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 11px;
  background: rgba(255,255,255,.045); border: 1px solid var(--line); font-size: 12.8px;
}
.scope svg { width: 16px; height: 16px; color: var(--cyan); flex: 0 0 16px; }
.scope span { color: var(--muted); font-size: 11px; margin-left: auto; }
.bind-card .field { margin-top: 18px; text-align: left; }
.bind-card .field label { font-size: 11.5px; color: var(--muted); display: block; margin-bottom: 6px; }
.bind-card input {
  width: 100%; height: 42px; background: rgba(0,0,0,.3); border: 1px solid var(--line);
  border-radius: 11px; padding: 0 13px; outline: none; font-size: 13px; font-family: var(--mono);
}
.bind-card input:focus { border-color: rgba(123,108,255,.55); }
.bind-actions { display: grid; gap: 9px; margin-top: 22px; }
.bind-done { padding: 14px 0; }
.bind-done svg { width: 58px; height: 58px; color: var(--green); margin-bottom: 14px; }

/* 响应式 */
@media (max-width: 980px) {
  #login { grid-template-columns: 1fr; gap: 34px; padding: 40px 24px; overflow-y: auto; height: 100%; align-content: center; }
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 14px; }
  .caps { margin-top: 20px; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; width: 100%; flex: none; height: 62px;
    flex-direction: row; padding: 0 8px; border-right: none; border-top: 1px solid var(--line);
    z-index: 20; background: rgba(8,10,18,.94); align-items: center;
  }
  .side-brand, .nav-label, .side-foot { display: none !important; }
  .sidebar nav { display: flex; width: 100%; justify-content: flex-start; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: 0 0 auto; width: auto; min-width: 58px; flex-direction: column; gap: 3px; height: 52px; font-size: 10px; justify-content: center; padding: 0 6px; }
  .nav-item svg { width: 18px; height: 18px; }
  .nav-item.active::before { display: none; }
  .main { padding-bottom: 62px; }
  .topbar { padding: 0 16px; height: 56px; flex-basis: 56px; }
  .chat-inner, .panel-inner, .composer-wrap { padding-left: 16px; padding-right: 16px; }
  .suggests { grid-template-columns: 1fr; }
  .result-card.wide { grid-column: span 1; }
  .welcome { padding-top: 4vh; }
  .page-lead { flex-direction: column; gap: 12px; }
  .page-lead .btn { width: 100%; }
  .acct-grid { grid-template-columns: 1fr; }
  .key-row { flex-wrap: wrap; }
  .key-stat { text-align: left; min-width: 0; }
  .key-acct { max-width: none; }
}
