:root {
  --bg: #0a1211;
  --panel: #12201e;
  --text: #e7f4f1;
  --muted: #8aa8a2;
  --line: #27403b;
  --accent: #0f766e;
  --accent-2: #14b8a6;
  --danger: #f87171;
  --warn: #fbbf24;
  --word: #5eead4;
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--accent-2); }
code { font-size: 0.85em; color: var(--muted); }
#app { max-width: 720px; margin: 0 auto; padding: 0 16px 32px; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 0;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
}
.brand {
  font-weight: 700; letter-spacing: 0.02em; color: var(--text); text-decoration: none;
}
.top-actions { display: flex; align-items: center; gap: 8px; }
.quota {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
}
.view { min-height: 60vh; }
.shelf-tabs {
  display: flex; gap: 8px; margin: 12px 0 14px;
}
.shelf-tab {
  flex: 1; border: 1px solid var(--line); background: transparent; color: var(--muted);
  border-radius: 12px; padding: 10px; font: inherit; cursor: pointer;
}
.shelf-tab.on {
  color: var(--text); border-color: var(--accent-2); background: rgba(20, 184, 166, 0.12);
}
.shelf {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 10px;
}
.shelf-item {
  border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,0.03);
  overflow: hidden;
}
.shelf-item a {
  display: block; padding: 12px 14px; color: inherit; text-decoration: none;
}
.shelf-top { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted);
}
.badge.ok { color: #4ade80; border-color: rgba(74,222,128,0.35); }
.badge.fav { color: #fbbf24; border-color: rgba(251,191,36,0.35); }
.shelf-title { font-weight: 700; line-height: 1.35; margin-bottom: 4px; }
.shelf-meta { font-size: 12px; color: var(--muted); }
.prog {
  margin-top: 8px; height: 6px; border-radius: 999px; background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.prog i {
  display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.read-prog {
  position: sticky; top: 96px; z-index: 13;
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px; padding: 6px 0;
  background: var(--bg);
}
.read-prog-track {
  flex: 1; height: 6px; border-radius: 999px;
  background: rgba(255,255,255,0.06); overflow: hidden;
}
.read-prog-track i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.read-prog span { font-size: 12px; color: var(--muted); min-width: 36px; text-align: right; }
.article h1, .article h2, .article h3 { line-height: 1.3; }
.article pre {
  overflow: auto; padding: 10px; border-radius: 10px;
  background: rgba(0,0,0,0.25); border: 1px solid var(--line);
  font-size: 0.9rem;
}
.article code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.import-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.import-hint { margin: 8px 0 0; font-size: 12px; line-height: 1.45; }
.foot {
  margin-top: 28px; padding-bottom: var(--safe-b);
  color: var(--muted); font-size: 13px; text-align: center;
}
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin: 12px 0;
}
h1 { font-size: 1.35rem; margin: 8px 0 12px; }
h2 { font-size: 1.05rem; margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
input, textarea, button {
  font: inherit; border-radius: 12px; border: 1px solid var(--line);
  background: #0d1816; color: var(--text); padding: 12px 14px;
}
input, textarea { width: 100%; }
textarea { min-height: 140px; resize: vertical; }
button {
  background: var(--accent); border-color: transparent; color: #fff;
  font-weight: 600; cursor: pointer;
}
button.ghost {
  background: transparent; border-color: var(--line); color: var(--text); font-weight: 500;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }
.msg { margin-top: 10px; font-size: 14px; color: var(--warn); }
.msg.err { color: var(--danger); }
.msg.ok { color: #4ade80; }
.list { list-style: none; padding: 0; margin: 0; }
.list li {
  border-top: 1px solid var(--line); padding: 12px 0;
}
.list li:first-child { border-top: 0; }
.list a { color: var(--text); text-decoration: none; font-weight: 600; }
.list .meta { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.read-toolbar {
  position: sticky; top: 52px; z-index: 15;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 0 8px; background: var(--bg);
}
.read-status {
  position: sticky; top: 100px; z-index: 14;
  margin: 0 0 10px; padding: 10px 12px;
  border-radius: 12px; background: rgba(15, 118, 110, 0.18);
  border: 1px solid var(--line); line-height: 1.45;
}
.read-status[hidden] { display: none !important; }
.article {
  font-size: 1.05rem; line-height: 1.75;
}
.article p { margin: 0 0 1em; }
.article .wxt-word {
  color: #042f2e;
  background: #5eead4;
  border-radius: 4px;
  padding: 0 3px;
  cursor: pointer;
  font-weight: 600;
}
.article .wxt-gloss {
  color: var(--accent-2); font-size: 0.92em; margin: 0 0.2em 0 0.05em;
}
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: #10221f; border-top: 1px solid var(--line);
  border-radius: 18px 18px 0 0; padding: 16px 16px calc(16px + var(--safe-b));
  box-shadow: 0 -12px 40px rgba(0,0,0,0.35);
  transform: translateY(110%); transition: transform 0.2s ease;
}
.sheet.open { transform: translateY(0); }
.sheet h3 { margin: 0 0 6px; font-size: 1.15rem; }
.sheet .actions { display: flex; gap: 8px; margin-top: 12px; }
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 30;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.backdrop.open { opacity: 1; pointer-events: auto; }
@media (min-width: 800px) {
  .sheet { left: 50%; right: auto; width: 420px; transform: translate(-50%, 110%); }
  .sheet.open { transform: translate(-50%, 0); }
}

/* Feature billing modal（对齐资讯采集） */
.fb-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: flex-end; justify-content: center;
}
.fb-modal.hidden { display: none; }
.fb-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }
.fb-panel {
  position: relative; z-index: 1; width: min(520px, 100%);
  max-height: min(92vh, 760px); overflow: auto;
  background: #10221f; color: var(--text);
  border: 1px solid var(--line); border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  box-shadow: 0 -16px 48px rgba(0,0,0,0.4);
}
.fb-x {
  position: absolute; top: 10px; right: 12px;
  border: 0; background: transparent; color: var(--muted);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.fb-title { margin: 0 0 8px; font-size: 17px; font-weight: 700; padding-right: 28px; }
.fb-desc { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.fb-status {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--line);
  font-size: 13px; line-height: 1.5;
}
.fb-status .ok { color: #34d399; }
.fb-status .bad { color: #f87171; }
.fb-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.fb-btn {
  appearance: none; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; background: transparent; color: var(--text);
  font: inherit; cursor: pointer;
}
.fb-btn.primary { background: var(--accent); border-color: transparent; color: #042f2e; font-weight: 700; }
.fb-btn.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.fb-btn.ghost { background: rgba(255,255,255,0.04); }
.fb-btn.sm { padding: 6px 10px; font-size: 12px; }
.fb-recharge {
  width: 100%; margin-top: 12px; display: flex; align-items: center; gap: 10px;
  text-align: left; border: 1px solid rgba(45, 212, 191, 0.35);
  background: rgba(45, 212, 191, 0.08); color: var(--text);
  border-radius: 14px; padding: 12px 14px; cursor: pointer; font: inherit;
}
.fb-recharge-text { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.fb-recharge-text strong { font-size: 14px; }
.fb-recharge-text small { color: var(--muted); font-size: 12px; }
.fb-recharge-arrow { font-size: 22px; color: var(--accent); }
.fb-balance {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; padding: 10px 12px;
  border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--line);
}
.fb-balance-label { font-size: 12px; color: var(--muted); }
.fb-balance-val { font-size: 20px; font-weight: 700; color: var(--accent); }
.fb-pay-tabs { display: flex; gap: 8px; margin: 10px 0; }
.fb-pay-tab {
  flex: 1; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px; background: transparent; color: var(--muted); cursor: pointer; font: inherit;
}
.fb-pay-tab.on { border-color: var(--accent); color: var(--text); background: rgba(45,212,191,0.1); }
.fb-qr-box { text-align: center; margin-bottom: 14px; }
.fb-qr-box img {
  width: min(220px, 70vw); height: auto; border-radius: 12px;
  background: #fff; padding: 8px;
}
.fb-qr-hint { margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.fb-sub { margin: 4px 0 8px; font-size: 13px; }
.fb-skus { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fb-sku {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.03); color: var(--text); cursor: pointer; text-align: left; font: inherit;
}
.fb-sku:hover { border-color: var(--accent); }
.fb-sku-name { font-size: 13px; font-weight: 600; }
.fb-sku-price { font-size: 14px; color: var(--accent); font-weight: 700; }
.fb-codes {
  margin-top: 12px; padding: 10px; border-radius: 10px;
  background: rgba(255,255,255,0.04); border: 1px dashed var(--line);
}
.fb-codes-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.fb-codes pre { margin: 0; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.fb-empty { font-size: 13px; color: var(--muted); padding: 8px; }
.fb-view.hidden { display: none; }
body.fb-modal-open { overflow: hidden; }

.study-toast-box {
  position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 10001; display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.study-toast {
  background: #0f172a; color: #fff; padding: 10px 14px; border-radius: 10px;
  font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.study-toast.ok { background: #059669; }
.study-toast.err { background: #dc2626; }

@media (min-width: 640px) {
  .fb-modal { align-items: center; }
  .fb-panel { border-radius: 18px; }
}
