/* p/a base styles (theme tokens are provided by html[data-theme]) */
:root {
  /* Default theme: calm (deep blue) */
  color-scheme: dark;
  --bg: #0b1220;
  --panel: #0f172a;
  --panel2: #111c33;
  --border: #22314d;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --warn: #fbbf24;
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.35);

  /* Tool accent colors (aligned with demo.html) */
  --ma1: #f59e0b;
  --ma2: #60a5fa;
  --ma3: #34d399;
  --rise: #f87171;
  --fall: #34d399;
}

/* Deep black */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0e12;
  --panel: #12161d;
  --panel2: #181d26;
  --border: #252b36;
  --text: #e8eaed;
  --muted: #8b949e;
  --accent: #60a5fa;
  --warn: #e6b422;
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);

  --ma1: #ff8000;
  --ma2: #0080ff;
  --ma3: #00c853;
  --rise: #f03a52;
  --fall: #00b578;
}

/* Blue/white */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --panel2: #f1f4f9;
  --border: #d9e1ee;
  --text: #111827;
  --muted: #4b5563;
  --accent: #1d4ed8;
  --warn: #b45309;
  --shadow-md: 0 10px 30px rgba(17, 24, 39, 0.06);

  --ma1: #c2410c;
  --ma2: #1d4ed8;
  --ma3: #047857;
  --rise: #dc2626;
  --fall: #059669;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* Prevent Huawei/UC system font boosting from blowing up mobile form layout */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
/* 仅桌面预留滚动条槽；手机默认 auto，避免华为把布局算得更宽导致右侧裁切 */
html { scrollbar-gutter: auto; }
@media (min-width: 981px) and (pointer: fine) {
  html { scrollbar-gutter: stable; }
}
body {
  overflow-y: auto;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  position: relative;
}
html.vp-narrow-fix,
html.vp-narrow-fix body {
  overflow-x: hidden !important;
  max-width: 100% !important;
}
body {
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Anchor jumps under sticky header (e.g. /account.html#vip) */
html { scroll-padding-top: 78px; }
.card[id] { scroll-margin-top: 78px; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 16px; }
.page-main { min-height: 60vh; }

.wrap { max-width: 980px; margin: 0 auto; padding: 18px 16px 26px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-md);
  margin-top: 12px;
}

h1 { margin: 0 0 8px; font-size: 18px; color: var(--text); }
p { margin: 8px 0; color: var(--muted); line-height: 1.6; }
code { background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 8px; }

.row { display:flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.row > * { flex: 0 0 auto; }
input {
  width: min(360px, 100%);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  outline: none;
}
input:focus { border-color: rgba(96,165,250,.65); }

.btns { display:flex; flex-wrap: wrap; gap:10px; margin-top: 14px; }
a.btn, button.btn {
  display:inline-block;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  color:var(--text);
  text-decoration:none;
  background: var(--panel);
  cursor: pointer;
}
.btn.primary { border-color: rgba(96,165,250,.55); background: rgba(96,165,250,.14); }
.btn:disabled { opacity:.55; cursor:not-allowed; }
.status { margin-top: 10px; color: var(--muted); font-size: 12px; min-height: 18px; }
.kv { margin-top: 12px; display:flex; flex-wrap: wrap; gap: 10px 18px; color: var(--muted); }
.kv b { color: var(--text); font-weight: 700; }
.kv[hidden] { display: none !important; }

/* Variants (align with main site button naming) */
.btn-ghost { background: transparent; }
.btn-primary { background: var(--accent); color: #fff; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.05); }

.topbar {
  display:flex; align-items:center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px;
}
.brand { display:flex; align-items:center; gap: 10px; text-decoration:none; color: var(--text); }
.mark {
  width: 30px; height: 30px; border-radius: 10px;
  display:inline-flex; align-items:center; justify-content:center;
  background: rgba(96,165,250,.14);
  border: 1px solid rgba(96,165,250,.25);
  font-weight: 900;
  color: var(--accent);
}
.top-actions { display:flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.hint {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.25);
  background: rgba(245, 158, 11, 0.10);
  color: var(--warn);
  font-size: 12px;
  line-height: 1.55;
}

/* —— Header / Footer (align with main site structure) —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 60px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  box-sizing: border-box;
}
.header-inner {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  width: 100%;
  /* 与 .container 同宽居中；勿写 max-width:100%，否则会盖掉 1140 把导航撑满屏 */
  max-width: 1140px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
  min-width: 0;
}
.brand-text { font-size: 15px; font-weight: 700; line-height: 1.35; }
.brand-text-short { display: none; }
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 900;
  background: rgba(96,165,250,.14);
  border: 1px solid rgba(96,165,250,.25);
  color: var(--accent);
  flex: 0 0 auto;
}
/* 主题切换已下线：全站锁定深蓝，避免顶栏被 select 撑开 */
#theme-select.select-mini { display: none !important; }
.auth-actions {
  display: none;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  min-width: 0;
  flex: 0 1 auto;
}
.nav-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
}
.nav-main a {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.nav-main a:hover { color: var(--text); background: rgba(96,165,250,.10); }
.nav-main a.is-active { color: var(--accent); background: rgba(96,165,250,.16); }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* Header action controls: prevent layout shift across pages */
.header-actions .select-mini,
.header-actions a.btn,
.header-actions button.btn {
  height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  display: inline-flex;
  align-items: center;
  line-height: 1;
  white-space: nowrap;
}
.header-actions .select-mini {
  /* keep native select readable while matching button height */
  line-height: 34px;
}

/* Header buttons: lock visuals regardless of tool.css/demo.css */
.site-header a.btn,
.site-header button.btn {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  text-decoration: none;
}
.site-header a.btn:hover,
.site-header button.btn:hover {
  border-color: rgba(96,165,250,.65);
  filter: brightness(1.04);
}
.site-header .btn-ghost {
  background: transparent;
}
.site-header .btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
}
/* 游客顶栏：登录淡蓝描边次级；免费注册实心亮蓝主入口 */
.site-header a.btn-auth-login {
  border-color: rgba(96, 165, 250, 0.55) !important;
  background: rgba(96, 165, 250, 0.12) !important;
  color: #93c5fd !important;
}
.site-header a.btn-auth-login:hover {
  border-color: #60a5fa !important;
  background: rgba(96, 165, 250, 0.22) !important;
  color: #bfdbfe !important;
  filter: none;
}
.site-header a.btn-auth-register {
  background: #60a5fa !important;
  border-color: #3b82f6 !important;
  color: #fff !important;
  box-shadow: none !important;
  font-weight: 700;
}
.site-header a.btn-auth-register:hover {
  background: #93c5fd !important;
  border-color: #60a5fa !important;
  filter: none;
}
@media (max-width: 860px) {
  .container { padding-left: 10px; padding-right: 10px; }
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    /* 仍保持 1140 居中；窄屏靠 .container 左右 padding，勿撑满视口 */
  }
  .header-inner > * { min-width: 0; }
  .brand-text-full { display: none; }
  .brand-text-short { display: inline; }
  .brand { gap: 6px; }
  .brand-mark { width: 30px; height: 30px; }
  .menu-toggle {
    width: 36px;
    height: 36px;
    flex: 0 0 auto;
  }
  .header-actions {
    gap: 6px;
    flex-wrap: nowrap;
    justify-self: end;
    max-width: 100%;
  }
  .header-actions a.btn,
  .header-actions button.btn {
    height: 30px;
    padding-left: 8px;
    padding-right: 8px;
    font-size: 12px;
  }
  .auth-actions { gap: 4px; }
}
@media (max-width: 380px) {
  .header-actions a.btn,
  .header-actions button.btn {
    height: 28px;
    padding-left: 6px;
    padding-right: 6px;
    font-size: 11px;
  }
  .brand-text-short { font-size: 13px; }
}

/* Small select in header (theme switch) */
.select-mini {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  outline: none;
  max-width: 160px;
}
.select-mini:focus { border-color: rgba(96,165,250,.65); }

.menu-toggle {
  position: relative;
  z-index: 135;
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}
@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; justify-self: end; }
  .nav-main {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 30px rgba(0,0,0,.35);
    z-index: 200;
  }
  .nav-main.is-open { display: flex; }
  .nav-main { z-index: 200; max-height: calc(100vh - 60px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .nav-main a { padding: 12px 14px; font-size: 15px; }
}

.site-footer {
  margin-top: 22px;
  padding: 22px 0 16px;
  border-top: 1px solid var(--border);
  background: var(--panel2);
  color: var(--muted);
  font-size: 13px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 22px;
}
@media (max-width: 860px), (max-device-width: 860px) {
  .footer-grid { grid-template-columns: 1fr 1fr; max-width: 100%; min-width: 0; }
  .footer-col { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  .footer-title { overflow-wrap: anywhere; word-break: break-word; }
  .site-footer { max-width: 100%; overflow-x: clip; box-sizing: border-box; }
  .wrap { max-width: 100%; box-sizing: border-box; }
  .card { max-width: 100%; box-sizing: border-box; }
}
@media (max-width: 420px), (max-device-width: 420px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-title { font-weight: 900; color: var(--text); margin-bottom: 10px; }
.footer-col a { display: block; padding: 5px 0; color: var(--muted); }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; }

/* Utility */
.mt-2 { margin-top: 8px; }

