/* =========================================================
 * MemzStore App 端 · 样式
 * 深色 Epic 风格 / 移动端优先 / 全屏 PWA
 * ========================================================= */
:root {
  --bg: #0b0b0d;
  --bg-2: #101014;
  --surface: #15151a;
  --card: #1b1b21;
  --card-2: #23232b;
  --line: #2a2a33;
  --line-soft: #222229;
  --text: #f4f4f6;
  --muted: #9899a3;
  --muted-2: #6f707a;
  --white: #ffffff;
  --ok: #45d6a0;
  --warn: #f2c14e;
  --danger: #ff5f6d;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .5);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --app-width: 520px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); }
body {
  background: radial-gradient(900px 420px at 50% -180px, #1a1a22 0%, var(--bg) 62%) no-repeat, var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button { font-family: inherit; cursor: pointer; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
svg { display: block; }
code, pre { font-family: ui-monospace, Consolas, "Courier New", monospace; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.danger-text { color: var(--danger); }
.eyebrow {
  display: inline-block; font-size: 10px; letter-spacing: .24em;
  text-transform: uppercase; color: var(--muted-2); margin-bottom: 6px;
}

/* ---------- 应用外壳 ---------- */
.app-shell {
  position: relative;
  max-width: var(--app-width);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
@media (min-width: 560px) {
  .app-shell {
    border-left: 1px solid var(--line-soft);
    border-right: 1px solid var(--line-soft);
    background: rgba(11, 11, 13, .55);
  }
}

/* ---------- 顶栏 ---------- */
.appbar {
  position: sticky; top: 0; z-index: 60;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(11, 11, 13, .9);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line-soft);
}
.appbar-inner { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--white); color: #0b0b0d;
  display: grid; place-items: center;
  font-weight: 900; font-size: 18px; letter-spacing: -.04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-line { display: flex; align-items: center; gap: 7px; }
.brand-line b { font-size: 15px; letter-spacing: -.02em; white-space: nowrap; }
.app-tag {
  font-size: 9px; letter-spacing: .1em; padding: 2px 6px; border-radius: 999px;
  background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18);
  color: #e8e8ee; white-space: nowrap;
}
.brand-text i { font-style: normal; font-size: 8px; letter-spacing: .28em; color: var(--muted-2); margin-top: 3px; }
.appbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.conn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 9px; white-space: nowrap;
}
.conn-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); }
.conn.on { color: #b9f0dc; border-color: rgba(69, 214, 160, .35); }
.conn.on .conn-dot { background: var(--ok); box-shadow: 0 0 7px rgba(69, 214, 160, .8); }
.conn.off { color: #f3d48c; border-color: rgba(242, 193, 78, .35); }
.conn.off .conn-dot { background: var(--warn); }
.conn.pending .conn-dot { background: var(--muted-2); animation: pulse 1.2s infinite; }
.user-btn {
  background: var(--white); color: #101014;
  border: 1px solid var(--white); border-radius: 999px;
  padding: 7px 14px; font-size: 12px; font-weight: 700;
  max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-btn.logged { background: #1d1d24; color: var(--text); border-color: #3a3a46; font-weight: 500; }
.user-btn:active { opacity: .8; }

/* ---------- 主视图 ---------- */
.view {
  flex: 1;
  padding: 16px 14px calc(92px + env(safe-area-inset-bottom));
  min-height: 60vh;
}
.page-head { padding: 4px 0 16px; }
.page-head h1 { font-size: 24px; letter-spacing: -.03em; line-height: 1.25; }
.page-head p { font-size: 12px; color: var(--muted); margin-top: 6px; }
.loading { padding: 56px 10px; text-align: center; color: var(--muted-2); font-size: 12px; letter-spacing: .08em; }
.loading::before {
  content: ""; display: block; width: 20px; height: 20px; margin: 0 auto 12px;
  border: 2px solid #2c2c36; border-top-color: #d8d8e0; border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ---------- 基础控件 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 9px; border: 1px solid transparent; padding: 10px 16px;
  font-size: 13px; font-weight: 600; transition: background .16s, border-color .16s, opacity .16s;
  background: transparent; color: var(--text); white-space: nowrap;
}
.btn.primary { background: var(--white); color: #101014; }
.btn.primary:active { background: #dedee4; }
.btn.light { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .16); color: #fff; }
.btn.light:active { background: rgba(255, 255, 255, .2); }
.btn.ghost { border-color: var(--line); color: var(--text); }
.btn.ghost:active { background: rgba(255, 255, 255, .05); }
.btn.danger { background: rgba(255, 95, 109, .14); border-color: rgba(255, 95, 109, .4); color: #ff9aa3; }
.btn.wide { width: 100%; }
.btn.small { padding: 6px 11px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted-2); font-size: 11px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.input, .select, .textarea {
  width: 100%; background: #101015; border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px; color: var(--text);
  font-size: 13px; outline: none; transition: border-color .16s;
  -webkit-appearance: none; appearance: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: #50505c; }
.textarea { min-height: 92px; resize: vertical; line-height: 1.7; }
.select {
  background-image: linear-gradient(45deg, transparent 50%, #8a8a95 50%), linear-gradient(135deg, #8a8a95 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}
.check { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--muted); margin: 4px 0 14px; }
.check input { accent-color: #fff; width: 16px; height: 16px; margin-top: 1px; flex: none; }
.hint { font-size: 11px; color: var(--muted-2); line-height: 1.7; }
.code-box {
  background: #0c0c10; border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 13px; font-family: ui-monospace, Consolas, monospace;
  font-size: 13px; letter-spacing: .06em; margin: 7px 0 12px;
  word-break: break-all; color: #e6e6ee;
}

/* ---------- 提示条 ---------- */
.banner {
  display: flex; flex-direction: column; gap: 8px;
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px;
  font-size: 12px; line-height: 1.75; border: 1px solid transparent;
}
.banner b { font-size: 13px; }
.banner.info { background: rgba(255, 255, 255, .04); border-color: var(--line); color: var(--muted); }
.banner.warn { background: rgba(242, 193, 78, .07); border-color: rgba(242, 193, 78, .28); color: #f3d48c; }
.banner.error { background: rgba(255, 95, 109, .08); border-color: rgba(255, 95, 109, .3); color: #ffb3ba; }
.banner .btn { align-self: flex-start; margin-top: 2px; }

/* ---------- 商城 ---------- */
.searchbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.searchbar .input { padding-left: 12px; }
.chips {
  display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 14px; font-size: 12px; transition: all .16s;
}
.chip.active { background: var(--white); color: #101014; border-color: var(--white); font-weight: 600; }
.list-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted-2); margin-bottom: 10px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.fig-card {
  background: var(--card); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  transition: transform .16s, background .16s;
}
.fig-card:active { transform: scale(.985); background: var(--card-2); }
.fig-cover { position: relative; aspect-ratio: 16 / 11; overflow: hidden; }
.fig-body { padding: 10px 11px 11px; }
.fig-title { font-size: 13px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig-sub { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-size: 10px; color: var(--muted-2); }
.tag-free { color: #dfe0e6; background: rgba(255, 255, 255, .08); padding: 1px 8px; border-radius: 999px; font-size: 10px; }

.cover {
  position: relative; width: 100%; height: 100%;
  background: linear-gradient(145deg, var(--ca, #1b2a4a), var(--cb, #3f6fd8));
  display: grid; place-items: center; overflow: hidden;
}
.cover-glyph {
  position: relative; z-index: 2; font-size: 34px; font-weight: 900;
  letter-spacing: -.05em; color: rgba(255, 255, 255, .94);
  text-shadow: 0 10px 26px rgba(0, 0, 0, .35); user-select: none;
}
.cover-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .08) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000 0%, transparent 78%);
}
.cover::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, .34));
}
.cover-badge {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  background: rgba(8, 8, 10, .6); border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px; padding: 2px 9px; font-size: 10px; color: #fff;
  backdrop-filter: blur(6px);
}
.cover-lg .cover-glyph { font-size: 54px; }

.skeleton .fig-cover, .sk-cover { background: linear-gradient(100deg, #1a1a20 20%, #23232b 40%, #1a1a20 60%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.sk-line { height: 9px; border-radius: 5px; background: #23232b; margin: 7px 0; }
.sk-line.w70 { width: 70%; }
.sk-line.w40 { width: 40%; }

.empty {
  text-align: center; color: var(--muted); padding: 42px 16px;
  font-size: 13px; line-height: 2;
}
.empty.big { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 54px 18px; }
.empty .btn { margin-top: 10px; }

/* ---------- 详情 ---------- */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--muted);
  font-size: 12px; padding: 0; margin-bottom: 12px;
}
.detail-cover { position: relative; height: 190px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-soft); }
.detail-cover .cover-glyph { font-size: 58px; }
.detail-head { padding: 14px 0 4px; }
.detail-head h1 { font-size: 24px; letter-spacing: -.03em; line-height: 1.25; }
.detail-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; color: var(--muted-2); font-size: 11px; }
.detail-desc { color: #c9c9d1; font-size: 13px; line-height: 1.9; white-space: pre-wrap; margin-top: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 10px; color: var(--muted); }
.detail-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.kv { margin-top: 16px; border-top: 1px solid var(--line-soft); }
.kv-row { display: flex; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.kv-row b { color: var(--text); font-weight: 500; text-align: right; }
.section-title { font-size: 14px; margin: 22px 0 10px; }

/* ---------- 我的库 ---------- */
.lib-list { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
.lib-card {
  display: flex; gap: 11px; align-items: center;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 10px;
}
.lib-cover { width: 64px; height: 64px; border-radius: 9px; overflow: hidden; flex: none; }
.lib-cover .cover-glyph { font-size: 20px; }
.lib-meta { flex: 1; min-width: 0; }
.lib-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-sub { font-size: 10px; color: var(--muted-2); margin-top: 2px; }
.offline-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; color: #a7f0d4; border: 1px solid rgba(69, 214, 160, .35);
  background: rgba(69, 214, 160, .08); border-radius: 999px; padding: 1px 7px; margin-top: 4px;
}
.lib-actions { display: flex; flex-direction: column; gap: 5px; flex: none; }

.account-card {
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.account-top { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--white); color: #111; display: grid; place-items: center;
  font-weight: 800; font-size: 17px;
}
.account-name { font-size: 14px; font-weight: 650; }
.account-sub { font-size: 11px; color: var(--muted); }
.quota-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.quota {
  background: #101014; border: 1px solid var(--line-soft);
  border-radius: 9px; padding: 9px 10px; display: flex; flex-direction: column;
}
.quota b { font-size: 14px; letter-spacing: -.02em; }
.quota span { font-size: 9px; color: var(--muted-2); margin-top: 1px; }
.settings-block { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 12px; }
.settings-block h3 { font-size: 12px; margin-bottom: 8px; color: var(--muted); font-weight: 500; }

/* ---------- 上传 ---------- */
.seg { display: flex; gap: 4px; background: #101014; border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.seg-btn {
  flex: 1; background: transparent; border: none; color: var(--muted);
  border-radius: 8px; padding: 7px 4px; font-size: 12px;
}
.seg-btn.active { background: #26262f; color: var(--text); font-weight: 600; }
.file-drop {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  padding: 20px 12px; text-align: center; cursor: pointer; margin-bottom: 8px;
  background: rgba(255, 255, 255, .015);
}
.file-drop:active { border-color: #51515e; }
.file-drop .file-title { font-size: 13px; font-weight: 600; }
.file-drop .file-hint { font-size: 10px; color: var(--muted-2); }
.file-info { font-size: 11px; color: var(--muted); margin: 4px 0 10px; word-break: break-all; }
.netdisk-hint { font-size: 11px; line-height: 1.7; margin: -4px 0 10px; color: var(--muted-2); }
.netdisk-hint.bad { color: #ff9aa3; }
.netdisk-hint.good { color: #a7f0d4; }
.success-card {
  background: rgba(69, 214, 160, .06); border: 1px solid rgba(69, 214, 160, .3);
  border-radius: var(--radius); padding: 14px; margin-bottom: 14px;
}
.success-card b { color: #a7f0d4; font-size: 14px; }
.success-card p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.success-card .row { margin-top: 10px; }

/* ---------- AI 工坊 ---------- */
.ai-usage {
  display: flex; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 11px; color: var(--muted);
  margin-bottom: 6px;
}
.ai-usage b { color: var(--text); font-size: 12px; }
.project-list { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.project-list::-webkit-scrollbar { display: none; }
.project-chip {
  flex: none; background: #121217; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px; font-size: 11px; color: var(--muted); max-width: 150px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.project-chip.active { background: var(--white); color: #101014; border-color: var(--white); font-weight: 600; }
.chat {
  display: flex; flex-direction: column; gap: 9px;
  min-height: 220px; max-height: 52vh; overflow-y: auto;
  padding: 12px 2px; margin-top: 10px;
}
.chat-empty { margin: auto; text-align: center; font-size: 12px; color: var(--muted-2); line-height: 1.9; }
.msg {
  max-width: 90%; border-radius: 14px; padding: 9px 12px;
  font-size: 12.5px; line-height: 1.75; white-space: pre-wrap;
  word-break: break-word; align-self: flex-start;
}
.msg.user { align-self: flex-end; background: var(--white); color: #111; border-bottom-right-radius: 4px; }
.msg.ai { background: var(--card); border: 1px solid var(--line-soft); border-bottom-left-radius: 4px; }
.msg.error { background: rgba(255, 95, 109, .1); border: 1px solid rgba(255, 95, 109, .32); color: #ffb3ba; }
.msg.typing { color: var(--muted); letter-spacing: .12em; }
.code-block { margin-top: 8px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #0c0c10; max-width: 100%; }
.code-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 9px; background: #131319; border-bottom: 1px solid var(--line-soft);
  font-size: 10px; color: var(--muted-2);
}
.code-head .row { gap: 6px; }
.code-body { margin: 0; padding: 10px; max-height: 190px; overflow: auto; font-size: 11px; line-height: 1.6; color: #cfd3e0; white-space: pre; }
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
.chat-input-row .textarea { min-height: 46px; max-height: 120px; }
.chat-input-row .btn { flex: none; padding: 11px 16px; }

/* ---------- 调试 ---------- */
.debug-note {
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 11px;
  color: var(--muted); line-height: 1.8; margin-bottom: 12px;
}
.draft-bar { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.draft-bar .select { flex: 1; min-width: 0; }
.draft-bar .input { flex: 1; min-width: 0; }
.editor-head { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 6px; font-size: 11px; color: var(--muted-2); }
.code-editor {
  width: 100%; min-height: 210px; resize: vertical;
  background: #0c0c10; border: 1px solid var(--line); border-radius: 10px;
  color: #d9dbe5; padding: 11px; font-family: ui-monospace, Consolas, monospace;
  font-size: 12px; line-height: 1.65; outline: none; tab-size: 2;
}
.code-editor:focus { border-color: #4c4c58; }
.preview-frame {
  width: 100%; height: 240px; border: 1px solid var(--line);
  border-radius: 10px; background: #000; margin-top: 8px;
}
.debug-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.debug-actions .btn.wide-span { grid-column: 1 / -1; }

/* ---------- 底部 Tab ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 70;
  max-width: var(--app-width); margin: 0 auto;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(15, 15, 19, .95);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-top: 1px solid var(--line-soft);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; color: var(--muted-2);
  font-size: 9.5px; letter-spacing: .02em; padding: 4px 0; border-radius: 9px;
  transition: color .16s;
}
.tab svg { width: 21px; height: 21px; }
.tab.active { color: var(--white); }
.tab:active { color: #cfcfd8; }

/* ---------- Toast / 模态框 ---------- */
#toastRoot {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 300;
  display: flex; flex-direction: column; gap: 7px; align-items: center;
  pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  background: #1e1e25; color: var(--text); border: 1px solid #35353f;
  border-radius: 10px; padding: 9px 16px; font-size: 12.5px;
  box-shadow: var(--shadow); opacity: 0; transform: translateY(8px);
  transition: opacity .22s, transform .22s; max-width: 92vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: rgba(255, 95, 109, .45); color: #ffb3ba; }
.toast.ok { border-color: rgba(69, 214, 160, .4); color: #a7f0d4; }

#modalRoot { position: fixed; inset: 0; z-index: 200; pointer-events: none; display: none; }
#modalRoot.open { display: block; }
.modal-backdrop {
  position: absolute; inset: 0; background: rgba(4, 4, 6, .7);
  backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 0; pointer-events: auto; animation: fadeIn .18s ease;
}
.modal {
  width: 100%; max-width: var(--app-width); max-height: 88vh;
  display: flex; flex-direction: column;
  background: #17171c; border: 1px solid #303039;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .55);
  animation: slideUp .22s cubic-bezier(.2, .9, .3, 1.1);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (min-width: 560px) {
  .modal-backdrop { align-items: center; padding: 20px; }
  .modal { border-radius: 16px; animation: popIn .2s ease; max-height: 84vh; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 10px; }
.modal-head h3 { font-size: 16px; }
.modal-x { background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; }
.modal-body { padding: 4px 18px 14px; overflow-y: auto; font-size: 13px; color: #c9c9d1; }
.modal-body p { margin-bottom: 8px; }
.modal-body h4 { font-size: 15px; color: var(--text); margin: 4px 0 8px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px 16px; border-top: 1px solid var(--line-soft); flex-wrap: wrap;
}
.modal.danger { border-color: rgba(255, 95, 109, .38); }
.agreement-summary { background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.agreement-summary .eyebrow { color: var(--muted); }
.list { margin: 4px 0 6px 18px; font-size: 12px; color: #c9c9d1; }
.list li { margin-bottom: 4px; }
.steps { margin: 4px 0 6px 18px; font-size: 12px; color: #c9c9d1; }
.steps li { margin-bottom: 4px; }

/* ---------- 全屏运行 ---------- */
.runner {
  position: fixed; inset: 0; z-index: 250;
  display: flex; flex-direction: column;
  background: #050507;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
.runner-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line-soft);
  background: rgba(15, 15, 19, .96);
}
.runner-back, .runner-reload {
  background: #1d1d25; border: 1px solid #34343e;
  border-radius: 999px; padding: 5px 12px; font-size: 11px; color: var(--text);
}
.runner-title { flex: 1; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.runner-frame { flex: 1; width: 100%; border: 0; background: #000; }
.runner-note { text-align: center; font-size: 10px; color: var(--muted-2); padding: 6px 10px 10px; }

/* ---------- 动画 ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 120% 0; } 100% { background-position: -40% 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

@media (max-width: 359px) {
  .brand-line b { font-size: 13px; }
  .app-tag { display: none; }
  .conn { padding: 3px 7px; }
  .grid { gap: 9px; }
}
