/* ===== 主题变量：浅色（默认）与暗夜 ===== */
:root {
  color-scheme: light;
  --bg: #f4f6fa; --card: #fff; --text: #1d2433; --muted: #6b7486; --line: #e5e8ef;
  --field: #fafbfd; --hover: #f7f8fb; --row-hover: #f7f9ff; --chip: #f1f4fb; --btn-border-hover: #c9cfdb;
  --primary: #2f6bff; --primary-d: #1f54d6; --danger: #e5484d; --ok: #18a058;
  --top: #14213d; --shadow: 0 1px 3px rgba(20,33,61,.08);
  --warn-bg: #fff8e6; --warn-line: #f3dfa8; --warn-text: #7a5b00;
  --code-bg: #0f172a; --code-text: #e2e8f0;
  --radius: 12px;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1420; --card: #171e2d; --text: #e4e8f1; --muted: #949db0; --line: #2a3346;
  --field: #111827; --hover: #1f2738; --row-hover: #1c2536; --chip: #222b3d; --btn-border-hover: #3a4560;
  --primary: #4b7fff; --primary-d: #3a6af0; --danger: #ff6b70; --ok: #3ccf86;
  --top: #0a0f1a; --shadow: 0 1px 3px rgba(0,0,0,.4);
  --warn-bg: #2b2414; --warn-line: #4d3f1c; --warn-text: #e9c46a;
  --code-bg: #0a0f1a; --code-text: #e2e8f0;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); transition: background-color .2s, color .2s;
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Noto Sans", "Noto Sans Arabic", "Noto Sans Thai", Tahoma, sans-serif; }
a { color: var(--primary); }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ===== 顶栏 ===== */
.topbar { background: var(--top); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; padding: 14px 0; color: #fff; font-weight: 700; font-size: 18px; text-decoration: none; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.lang select { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; padding: 4px 6px; font-size: 13px; max-width: 150px; }
.lang option { color: #1d2433; background: #fff; }
.theme-btn { background: transparent; border: 1px solid rgba(255,255,255,.3); border-radius: 6px; width: 32px; height: 28px;
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.theme-btn:hover { background: rgba(255,255,255,.08); }
.theme-btn .i-sun, [data-theme="dark"] .theme-btn .i-moon { display: none; }
[data-theme="dark"] .theme-btn .i-sun { display: inline; }

/* ===== 卡片与地址 ===== */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin: 20px 0; padding: 20px; }
.hero { text-align: center; }
.label { margin: 0 0 8px; color: var(--muted); font-size: 15px; font-weight: 400; }
.addr-row { display: flex; gap: 8px; max-width: 560px; margin: 0 auto; }
.addr { flex: 1; min-width: 0; font-size: 20px; font-weight: 600; text-align: center; padding: 10px 12px; direction: ltr;
  border: 2px dashed var(--line); border-radius: 10px; background: var(--field); color: var(--text); }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--btn-border-hover); background: var(--hover); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ===== 收件箱 ===== */
.inbox-head, .inbox li { display: grid; grid-template-columns: 220px 1fr 150px; gap: 12px; }
.inbox-head { padding: 0 12px 10px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.time-col { text-align: end; }
.live { font-style: normal; color: var(--ok); font-size: 12px; margin-inline-start: 6px; }
.live b { font-weight: 500; }
.inbox { list-style: none; margin: 0; padding: 0; }
.inbox li { padding: 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.inbox li:hover { background: var(--row-hover); }
.inbox li.unseen .from, .inbox li.unseen .subj { font-weight: 700; }
.inbox .from, .inbox .subj { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox .prev { color: var(--muted); font-weight: 400; }
.inbox .time { color: var(--muted); font-size: 13px; text-align: end; }

.empty { text-align: center; padding: 48px 0; color: var(--muted); }
.empty p { margin: 12px 0 2px; }
.spinner { width: 36px; height: 36px; margin: 0 auto; border: 3px solid var(--line); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 邮件详情 ===== */
.msg-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.spacer { flex: 1; }
#msg-subject { margin: 8px 0; font-size: 20px; word-break: break-word; }
.msg-meta { color: var(--muted); font-size: 13px; padding-bottom: 12px; border-bottom: 1px solid var(--line); word-break: break-all; }
.msg-meta b { color: var(--text); font-weight: 600; }
.atts { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.atts a { display: inline-block; padding: 6px 10px; background: var(--chip); border-radius: 6px; font-size: 13px; color: var(--text); text-decoration: none; }
.img-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding: 8px 12px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); border-radius: 8px; font-size: 13px; }
.img-bar span { flex: 1; min-width: 200px; }
.msg-body { margin-top: 16px; }
/* 邮件本身按浅色设计，暗夜模式下仍放在白底框内显示，避免文字看不清 */
.msg-body iframe { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; color-scheme: light; }
.msg-body pre { white-space: pre-wrap; word-break: break-word; font: inherit; margin: 0; }

/* ===== 对话框 ===== */
dialog { border: none; border-radius: var(--radius); padding: 24px; width: min(460px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.3);
  background: var(--card); color: var(--text); }
dialog::backdrop { background: rgba(10,15,26,.5); }
dialog h3 { margin: 0 0 16px; }
.change-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; direction: ltr; }
.change-row input, .change-row select { padding: 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
  background: var(--field); color: var(--text); }
.change-row input { flex: 1; min-width: 0; }
.err { color: var(--danger); font-size: 13px; min-height: 1em; margin: 4px 0 12px; }
dialog .actions { justify-content: flex-end; }

/* ===== FAQ / 页脚 / 提示 ===== */
.faq h2 { font-size: 18px; margin: 0 0 8px; }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 0; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: var(--top); color: #fff;
  padding: 10px 18px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.show { opacity: 1; }
.foot { color: var(--muted); font-size: 12px; text-align: center; padding-bottom: 32px; }
.foot a { color: inherit; }

.notice { background: var(--warn-bg); border-bottom: 1px solid var(--warn-line); color: var(--warn-text); font-size: 14px; }
.notice .wrap { padding: 8px 16px; text-align: center; }
.ad { margin: 20px 0; text-align: center; overflow: hidden; }

/* ===== API 文档 ===== */
.docs h1 { margin-top: 0; font-size: 24px; }
.docs h2 { font-size: 18px; margin: 28px 0 8px; }
.docs pre { background: var(--code-bg); color: var(--code-text); padding: 14px 16px; border-radius: 8px; overflow-x: auto;
  font-size: 13px; line-height: 1.5; direction: ltr; text-align: left; }
.docs code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.docs td code { background: var(--chip); padding: 1px 6px; border-radius: 4px; }
.table-wrap { overflow-x: auto; }
.docs table { width: 100%; border-collapse: collapse; font-size: 14px; }
.docs th, .docs td { text-align: start; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.docs th { color: var(--muted); font-weight: 500; }

/* ===== 手机 ===== */
@media (max-width: 640px) {
  .inbox-head { display: none; }
  .inbox li { grid-template-columns: 1fr auto; }
  .inbox .from { grid-column: 1; }
  .inbox .time { grid-column: 2; grid-row: 1; }
  .inbox .subj { grid-column: 1 / -1; }
  .addr { font-size: 16px; }
  .brand { font-size: 16px; }
  .lang select { max-width: 110px; }
}

/* ===== SEO 文章 / 关键词 / 页脚导航 ===== */
.article h2 { font-size: 20px; margin: 0 0 10px; }
.article h3 { font-size: 16px; margin: 22px 0 8px; }
.article p, .article li { color: var(--muted); line-height: 1.75; }
.article p { margin: 0 0 10px; }
.article ul, .article ol { margin: 0; padding-inline-start: 22px; }
.article li { margin: 4px 0; }
.article a { color: var(--primary); text-decoration: none; }
.article a:hover { text-decoration: underline; }
.tags h2 { font-size: 16px; margin: 0 0 12px; }
.tags ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags a { display: inline-block; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13px;
  color: var(--text); text-decoration: none; background: var(--field); }
.tags a:hover { border-color: var(--primary); color: var(--primary); }
.site-foot { margin-top: 28px; background: var(--top); padding-top: 18px; }
.foot-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 28px; }
.foot-nav a { color: #cfd6e6; text-decoration: none; font-size: 14px; text-transform: uppercase; letter-spacing: .02em; }
.foot-nav a:hover { color: #fff; }
.site-foot .foot { color: #8f98ab; padding: 14px 16px 24px; margin: 14px auto 0; border-top: 1px solid rgba(255,255,255,.08); }

/* ===== V3：导航、价格页、会员中心 ===== */
.top-nav { display: flex; gap: 14px; margin-inline-end: 6px; }
.top-nav a { color: #cfd6e6; text-decoration: none; font-size: 14px; white-space: nowrap; }
.top-nav a:hover { color: #fff; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; direction: ltr; unicode-bidi: embed; }
.center { text-align: center; }
.right { text-align: end; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.row input, .stack input { flex: 1; min-width: 180px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--field); color: var(--text); font-size: 14px; }
.stack { display: grid; gap: 10px; max-width: 420px; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.vip { background: #f5b800; color: #3a2a00; }
.badge.free { background: var(--chip); color: var(--muted); }
.notice-box { background: var(--warn-bg); border: 1px solid var(--warn-line); color: var(--warn-text); border-radius: 8px;
  padding: 10px 14px; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; word-break: break-all; }
.notice-box.ok { background: rgba(24,160,88,.1); border-color: rgba(24,160,88,.35); color: var(--ok); }
.select { user-select: all; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: start; color: var(--muted); font-weight: 500; font-size: 13px; padding: 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.empty-text { text-align: center; color: var(--muted); padding: 32px 0; }

.pricing-head { text-align: center; margin: 32px 0 8px; }
.pricing-head h1 { margin: 0 0 8px; font-size: 28px; }
.pricing-head p { color: var(--muted); margin: 0; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.plan { text-align: center; margin: 0; padding: 28px 20px; border: 2px solid transparent; }
.plan.featured { border-color: var(--primary); }
.plan h2 { margin: 0 0 12px; font-size: 18px; }
.plan .price { font-size: 36px; font-weight: 700; }
.plan .per { color: var(--muted); font-size: 13px; margin: 6px 0 18px; }
.plan .btn { width: 100%; justify-content: center; }
.benefits h2 { font-size: 18px; margin: 0 0 12px; }
.benefits ul { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }

.auth { max-width: 400px; margin: 40px auto; }
.auth-tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.auth-tabs button { flex: 1; background: none; border: none; padding: 10px; cursor: pointer; color: var(--muted); font-size: 15px;
  border-bottom: 2px solid transparent; }
.auth-tabs button.on { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
#auth-form { display: grid; gap: 10px; }
#auth-form input { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--field); color: var(--text); font-size: 15px; }
#auth-form .btn { justify-content: center; }

.status { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.status-line { margin-top: 4px; font-size: 15px; }
.status-actions { display: flex; gap: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 8px 0 -8px; }
.tabs button { background: none; border: none; padding: 8px 14px; border-radius: 8px 8px 0 0; cursor: pointer; color: var(--muted); font-size: 14px; }
.tabs button.on { background: var(--card); color: var(--text); font-weight: 600; }
.dom-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.dom-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
table.dns { width: 100%; border-collapse: collapse; margin: 8px 0 10px; font-size: 13px; }
table.dns th, table.dns td { text-align: start; padding: 6px 8px; border: 1px solid var(--line); word-break: break-all; }
table.dns th { color: var(--muted); font-weight: 500; }
@media (max-width: 640px) { .topbar-in { flex-wrap: wrap; padding-bottom: 8px; } .top-actions { flex-wrap: wrap; } .top-nav { gap: 10px; } }

/* ===== USDT 付款面板 ===== */
.pay { border: 2px solid var(--primary); }
.pay h2 { font-size: 18px; margin: 0 0 14px; }
.pay-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.pay-box { background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 6px; justify-items: start; }
.pay-amount { font-size: 28px; direction: ltr; }
.pay-amount b { color: var(--primary); }
.pay-amount span { font-size: 15px; color: var(--muted); }
.pay-addr { font-size: 15px; word-break: break-all; background: none; padding: 0; }
.pay-notes { margin: 14px 0 0; padding-inline-start: 0; list-style: none; display: grid; gap: 4px; color: var(--muted); }
@media (max-width: 640px) { .pay-grid { grid-template-columns: 1fr; } }

/* ===== PWA ===== */
.install-btn { background: var(--primary); color: #fff; border: none; border-radius: 6px; height: 28px; padding: 0 10px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.install-btn:hover { background: var(--primary-d); }
.brand-logo { height: 30px; width: auto; max-width: 200px; object-fit: contain; display: block; }
@media (max-width: 640px) { .brand-logo { height: 26px; max-width: 140px; } }
.pwa-banner { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 30; width: min(480px, calc(100% - 24px));
  display: flex; gap: 12px; align-items: center; background: var(--card); color: var(--text); border: 1px solid var(--line);
  padding: 12px 10px 12px 12px; border-radius: 14px; box-shadow: 0 10px 32px rgba(0,0,0,.22);
  transform: translate(-50%, calc(100% + 40px)); opacity: 0; transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .35s; }
.pwa-banner.show { transform: translate(-50%, 0); opacity: 1; }
.pwa-banner img { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.pwa-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pwa-banner-text strong { font-size: 15px; }
.pwa-banner-text span { font-size: 13px; color: var(--muted); line-height: 1.4; }
.pwa-banner-go { flex: none; background: var(--primary); color: #fff; border: none; border-radius: 8px; height: 36px; padding: 0 14px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pwa-banner-go:hover { background: var(--primary-d); }
.pwa-banner-close { flex: none; align-self: flex-start; background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; padding: 0 4px; cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .pwa-banner { transition: opacity .2s; } }
.offline { min-height: 80vh; display: grid; place-items: center; text-align: center; }
.offline .card { max-width: 420px; }
.offline-icon { font-size: 48px; }
.offline h1 { font-size: 22px; margin: 8px 0; }
@media (max-width: 640px) { .install-btn span { display: none; } }
