/* ═══ 账号助手 · 手机端 ═══ */
:root {
  --bg: #0d1117;
  --bg-2: #141a22;
  --card: #1a2230;
  --card-2: #212b3d;
  --line: #2a3648;
  --text: #e6ecf5;
  --text-2: #9aa7bd;
  --text-3: #5f6b80;
  --accent: #4f8cff;
  --accent-2: #6ea8ff;
  --green: #3fb950;
  --red: #f47067;
  --yellow: #d29922;
  --radius: 14px;
  --tabbar-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
}
[data-theme="paper"] {
  --bg: #f6f3ec;
  --bg-2: #efeae0;
  --card: #fffdf8;
  --card-2: #f3eee4;
  --line: #e2dccd;
  --text: #2b2620;
  --text-2: #6d6558;
  --text-3: #a39a89;
  --accent: #3a6fd8;
  --accent-2: #5b8def;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  height: 100%; height: 100dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
  font-size: 15px; line-height: 1.55;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea { font: inherit; color: var(--text); }
a { color: var(--accent-2); }
svg { display: block; }
[hidden] { display: none !important; }

/* ─── 登录 ─── */
.login-view {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px 24px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.login-logo { width: 72px; height: 72px; margin: 0 auto 4px; border-radius: 18px; overflow: hidden; }
.login-logo img { width: 100%; height: 100%; }
.login-card h1 { text-align: center; font-size: 22px; letter-spacing: .5px; }
.login-sub { text-align: center; color: var(--text-3); font-size: 13px; margin-top: -8px; }
.login-hint { text-align: center; font-size: 13px; color: var(--text-2); }
.login-advanced { font-size: 13px; color: var(--text-3); }
.login-advanced summary { cursor: pointer; padding: 6px 0; }
.login-advanced .field { margin-top: 8px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-2); }
.field input {
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 16px; outline: none; width: 100%;
}
.field input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 10px; font-size: 15px; font-weight: 600;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.block { width: 100%; padding: 13px; }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; }
.form-error { color: var(--red); font-size: 13px; text-align: center; }

/* ─── 主框架 ─── */
#appView { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  border-bottom: 1px solid var(--line); background: var(--bg);
  flex-shrink: 0;
}
.topbar-title { font-size: 17px; font-weight: 700; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  color: var(--text-2); border: 1px solid var(--line); background: var(--card);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:active { background: var(--card-2); }

.page-host { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 14px 14px calc(var(--tabbar-h) + var(--safe-b) + 14px); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; background: var(--bg-2); border-top: 1px solid var(--line);
  flex-shrink: 0; z-index: 20;
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--text-3); font-size: 11px; padding: 6px 0;
}
.tab svg { width: 23px; height: 23px; }
.tab.active { color: var(--accent-2); }

/* ─── 通用组件 ─── */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}
.card h3 { font-size: 15px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.card h3 .more { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 400; }
.muted { color: var(--text-2); font-size: 13px; }
.tiny { color: var(--text-3); font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; background: var(--card-2); color: var(--text-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.green { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.badge.red { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.badge.yellow { color: var(--yellow); border-color: color-mix(in srgb, var(--yellow) 40%, transparent); }
.badge.blue { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-2 .card { margin-bottom: 0; }

.skeleton {
  border-radius: var(--radius); background: var(--card);
  min-height: 88px; margin-bottom: 12px; position: relative; overflow: hidden;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 6%, transparent), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%);} to { transform: translateX(100%);} }

.empty {
  text-align: center; padding: 48px 20px; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty svg { width: 40px; height: 40px; opacity: .4; }

.section-title { font-size: 13px; color: var(--text-3); font-weight: 600; margin: 18px 4px 10px; letter-spacing: .5px; }

/* ─── 总览页 ─── */
.lic-card { display: flex; align-items: center; gap: 14px; }
.lic-badge {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7a5cff);
  display: grid; place-items: center; font-size: 20px; font-weight: 800; color: #fff;
}
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 4px; }
.quick-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 4px; border-radius: 12px; background: var(--card);
  border: 1px solid var(--line); font-size: 12px; color: var(--text-2);
}
.quick-btn svg { width: 22px; height: 22px; color: var(--accent-2); }

.topic-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.topic-item:last-child { border-bottom: 0; }
.topic-rank {
  width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--card-2); color: var(--text-2);
}
.topic-rank.top { background: var(--accent); color: #fff; }
.topic-body { flex: 1; min-width: 0; }
.topic-title { font-size: 14px; font-weight: 600; line-height: 1.4; }
.topic-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ─── 资讯页 ─── */
.seg {
  display: flex; background: var(--bg-2); border-radius: 10px; padding: 3px;
  margin-bottom: 14px; border: 1px solid var(--line);
}
.seg button {
  flex: 1; padding: 8px 0; border-radius: 8px; font-size: 14px; color: var(--text-2);
}
.seg button.active { background: var(--card); color: var(--text); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.daily-lead { border-left: 3px solid var(--accent); padding-left: 12px; margin-bottom: 14px; }
.daily-lead h3 { font-size: 17px; line-height: 1.4; margin-bottom: 6px; }
.daily-sec { margin-bottom: 14px; }
.daily-sec h4 { font-size: 13px; color: var(--accent-2); margin-bottom: 8px; }
.news-item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.news-item:last-child { border-bottom: 0; }
.news-item .t { font-size: 14px; font-weight: 600; line-height: 1.45; }
.news-item .s { font-size: 12.5px; color: var(--text-2); margin-top: 4px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: box; overflow: hidden; }
.news-item .m { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

/* ─── 模型榜页 ─── */
.board-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 4px; scrollbar-width: none; }
.board-tabs::-webkit-scrollbar { display: none; }
.board-tab {
  flex-shrink: 0; padding: 7px 14px; border-radius: 999px; font-size: 13px;
  background: var(--card); border: 1px solid var(--line); color: var(--text-2);
}
.board-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-no {
  width: 28px; height: 28px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: var(--card-2); color: var(--text-2);
}
.rank-no.r1 { background: linear-gradient(135deg,#f5c518,#e8890c); color: #fff; }
.rank-no.r2 { background: linear-gradient(135deg,#c0c6d0,#8b93a3); color: #fff; }
.rank-no.r3 { background: linear-gradient(135deg,#d08a4e,#a05e2c); color: #fff; }
.rank-info { flex: 1; min-width: 0; }
.rank-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-org { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.rank-score { text-align: right; flex-shrink: 0; }
.rank-score b { font-size: 16px; display: block; }
.rank-score span { font-size: 11px; color: var(--text-3); }

/* ─── 商城页 ─── */
.prod-card { padding: 0; overflow: hidden; }
.prod-head { padding: 16px 16px 10px; }
.prod-tags { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.prod-title { font-size: 16px; font-weight: 700; }
.prod-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.prod-price-row { display: flex; align-items: baseline; gap: 10px; margin-top: 10px; }
.prod-price { font-size: 22px; font-weight: 800; color: var(--accent-2); }
.prod-price small { font-size: 12px; color: var(--text-3); font-weight: 400; }
.prod-meta { display: flex; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.prod-foot { padding: 10px 16px 14px; border-top: 1px solid var(--line); }
.order-card { padding: 14px 16px; }
.order-no { font-family: ui-monospace, monospace; font-size: 12px; color: var(--text-3); }

/* ─── 我的页 ─── */
.me-head { display: flex; align-items: center; gap: 14px; padding: 8px 4px 18px; }
.me-avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7a5cff);
  display: grid; place-items: center; color: #fff; font-size: 22px; font-weight: 800;
}
.me-name { font-size: 17px; font-weight: 700; }
.menu-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line);
}
.menu-item:last-child { border-bottom: 0; }
.menu-item:active { background: var(--card-2); }
.menu-item svg { width: 20px; height: 20px; color: var(--text-2); flex-shrink: 0; }
.menu-item .grow { font-size: 15px; }
.menu-item .val { font-size: 13px; color: var(--text-3); }
.menu-item .chev { color: var(--text-3); font-size: 18px; }

/* ─── 底部抽屉 ─── */
.sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40;
  display: flex; align-items: flex-end;
}
.sheet {
  width: 100%; max-height: 82dvh; overflow-y: auto;
  background: var(--bg-2); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(20px + var(--safe-b));
  animation: sheet-up .25s ease;
}
@keyframes sheet-up { from { transform: translateY(30%); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet h3 { font-size: 16px; margin-bottom: 14px; }
.sheet .field { margin-bottom: 12px; }
.sheet textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; min-height: 90px; resize: vertical; outline: none; font-size: 14px;
}
.sheet textarea:focus { border-color: var(--accent); }

/* ─── Toast ─── */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px);
  transform: translateX(-50%);
  background: var(--card-2); border: 1px solid var(--line); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: 13px; z-index: 60;
  box-shadow: 0 6px 24px rgba(0,0,0,.35); max-width: 86vw; text-align: center;
}
.toast.err { border-color: color-mix(in srgb, var(--red) 50%, transparent); color: var(--red); }

.pull-hint { text-align: center; color: var(--text-3); font-size: 12px; padding: 4px 0 10px; }

@media (min-width: 640px) {
  .page-host { max-width: 640px; margin: 0 auto; width: 100%; }
  .login-card { max-width: 420px; }
}
