/* Hide protected pages until auth gate passes.
   Early boot skips this when session cache is warm (avoids tab switch flash). */
html.wa-gate-pending body {
  visibility: hidden;
}

/* Ensure [hidden] wins over component display: rules (e.g. .btn-primary). */
[hidden] {
  display: none !important;
}

/* Site-wide ICP 备案 footer (injected on subpages) */
.wa-beian {
  margin-top: 28px;
  padding: 18px 16px 28px;
  text-align: center;
  font: 12px/1.6 "DM Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #64748b;
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  background: transparent;
}
.wa-beian a {
  color: #64748b;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.wa-beian a:hover {
  color: #0f766e;
  border-bottom-color: rgba(15, 118, 110, 0.35);
}
.wa-beian .wa-beian-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
}
.wa-beian .wa-beian-icp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  letter-spacing: 0.02em;
}
.wa-beian .wa-beian-icp img {
  width: 15px;
  height: 15px;
  object-fit: contain;
  flex: 0 0 auto;
  display: block;
}

.wa-auth-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: "DM Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.wa-auth-bar .wa-auth-loading {
  font-size: 12px;
  opacity: 0.55;
}
.wa-auth-bar .wa-auth-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #cbd5e1;
  max-width: 160px;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.wa-auth-bar .wa-auth-user img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.wa-auth-bar .wa-auth-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wa-auth-pop { position: relative; }
.wa-auth-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 80;
  min-width: 168px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  color: #0f172a;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}
.wa-auth-menu[hidden] { display: none; }
.wa-auth-menu a[hidden],
.wa-auth-menu button[hidden] { display: none !important; }
.wa-auth-menu a,
.wa-auth-menu button {
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.wa-auth-menu a:hover,
.wa-auth-menu button:hover { background: rgba(15, 23, 42, 0.06); }
html[data-theme="dark"] .wa-auth-menu {
  background: #121a2b;
  color: #e8eef7;
  border-color: rgba(255, 255, 255, 0.08);
}
html[data-theme="dark"] .wa-auth-menu a:hover,
html[data-theme="dark"] .wa-auth-menu button:hover { background: rgba(255, 255, 255, 0.06); }
.wa-auth-bar a.wa-auth-btn,
.wa-auth-bar button.wa-auth-btn {
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
}
.wa-auth-bar a.wa-auth-btn:hover,
.wa-auth-bar button.wa-auth-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
  color: #fff;
}
.wa-auth-bar a.wa-auth-btn.primary {
  background: linear-gradient(135deg, #2dd4bf, #38bdf8);
  color: #042f2e;
  border: none;
  font-weight: 700;
}

.wa-auth-bar.light .wa-auth-user {
  color: #475569;
}
.wa-auth-bar.light a.wa-auth-btn,
.wa-auth-bar.light button.wa-auth-btn {
  border-color: #dce4eb;
  background: var(--wa-paper);
  color: #15202b;
}
.wa-auth-bar.light a.wa-auth-btn:hover,
.wa-auth-bar.light button.wa-auth-btn:hover {
  background: var(--wa-soft);
  color: #0f172a;
}
.wa-auth-bar.light a.wa-auth-btn.primary {
  background: linear-gradient(135deg, #0d9488, #0284c7);
  color: #fff;
  border: none;
}

/* 顶栏在暗色主题下仍带 .light（为浅色导航写的），必须改回浅字 */
html[data-theme="dark"] .wa-auth-bar.light .wa-auth-user {
  color: var(--wa-ink, #e8eef7);
}
html[data-theme="dark"] .wa-auth-bar.light a.wa-auth-btn,
html[data-theme="dark"] .wa-auth-bar.light button.wa-auth-btn {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: var(--wa-ink, #e8eef7);
}
html[data-theme="dark"] .wa-auth-bar.light a.wa-auth-btn:hover,
html[data-theme="dark"] .wa-auth-bar.light button.wa-auth-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}
html[data-theme="dark"] .wa-auth-bar.light a.wa-auth-btn.primary {
  background: linear-gradient(135deg, #2dd4bf, #38bdf8);
  color: #042f2e;
}

.wa-auth-banner {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--wa-warn-bg);
  border: 1px solid var(--wa-warn-border);
  color: var(--wa-warn-ink);
  font-size: 13px;
}
.wa-auth-banner.show {
  display: block;
}
.wa-auth-banner.wa-auth-banner--readonly {
  position: sticky;
  top: 0;
  z-index: 50;
  margin: 0;
  padding: 8px 14px;
  border-width: 0 0 1px;
  border-radius: 0;
  text-align: center;
}
.wa-auth-banner a {
  color: #b45309;
  font-weight: 700;
}

/* Home login prompt */
#wa-login-prompt {
  display: none;
  margin: 0 0 22px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
  color: #fde68a;
  font-size: 14px;
  animation: wa-prompt-in 0.45s ease both;
}
#wa-login-prompt.show {
  display: block;
}
#wa-login-prompt a {
  color: #5eead4;
  font-weight: 700;
}
@keyframes wa-prompt-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
