/* AI24X — 全局基础（与主题文件叠加，无第三方框架） */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* 避免「有/无纵向滚动条」时视口宽度变化，导致 sticky 顶栏左右轻微跳动 */
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
}

img {
  max-width: 100%;
  height: auto;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.page-main {
  flex: 1;
}

/* —— Header —— */
.site-topbar {
  display: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: var(--header-blur);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  white-space: nowrap;
}


.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 900;
  background: var(--accent);
  color: var(--accent-ink);
}

.nav-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 8px;
}

.nav-main a {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.nav-main a:hover {
  color: var(--text);
  background: var(--nav-hover-bg);
}

.nav-main a.is-active {
  color: var(--accent);
  background: var(--nav-active-bg);
}

/* 主导航里的「注册」高亮，避免远程/窄屏误以为没有入口 */
.nav-main a[href="register.html"] {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid transparent;
}
.nav-main a[href="register.html"]:hover {
  filter: brightness(1.06);
  color: var(--accent-ink);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.select-mini,
.btn {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.select-mini {
  padding: 7px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  max-width: 110px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

.btn-primary:hover {
  filter: brightness(1.06);
  color: var(--accent-ink);
}

.btn-ghost {
  background: transparent;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  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: 960px) {
  .header-inner {
    grid-template-columns: auto auto auto;
    grid-template-areas: "brand toggle actions";
  }

  .brand {
    grid-area: brand;
  }

  .menu-toggle {
    grid-area: toggle;
    display: inline-flex;
    justify-self: start;
  }

  .header-actions {
    grid-area: actions;
  }

  .nav-main {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 12px var(--gutter) 16px;
    background: var(--header-bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
  }

  .nav-main.is-open {
    display: flex;
  }

  .nav-main a {
    padding: 12px 14px;
  }

  .header-actions .select-mini.theme-select {
    display: none;
  }
}

/* —— Sections —— */
.section {
  padding: clamp(40px, 6vw, 72px) 0;
}

.section-tight {
  padding: clamp(28px, 4vw, 48px) 0;
}

/* 登录 / 注册：主内容区整体上移（仍保留可读留白） */
body[data-page="login"] .page-main > .section:first-child,
body[data-page="register"] .page-main > .section:first-child {
  padding-top: clamp(16px, 2.5vw, 32px);
  padding-bottom: clamp(28px, 4vw, 56px);
}

.hero {
  padding: clamp(48px, 8vw, 88px) 0;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.12;
  color: var(--hero-title, var(--text));
}

.hero .lead {
  margin: 16px 0 0;
  font-size: 1.125rem;
  color: var(--hero-lead, var(--muted));
  max-width: 42em;
}

.hero .lead strong {
  color: var(--hero-strong, var(--text));
}

.tag-row {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid var(--tag-border);
  background: var(--tag-bg);
  color: var(--tag-text);
}

.tag code {
  font-size: 0.75em;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--code-bg);
  border: 0;
}

.callout {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--callout-border);
  background: var(--callout-bg);
  color: var(--callout-text);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.callout strong {
  color: var(--callout-strong);
}

.callout code {
  background: var(--callout-code-bg);
  color: var(--callout-code-text);
  border: 0;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85em;
}

.hero-cta {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* 探索子导航：复用 .hero-cta 排版（标题/导语下方） */
.hero-cta.page-explore-cta {
  margin-top: 24px;
}

/* 非中文：整页先藏，等 i18n.apply 后再露（防闪中文；boot 内联同规则兜底） */
html.i18n-pending body {
  visibility: hidden !important;
}

/* 名模 / VIP / 价格 / 接入 / 注册 / 邀请：统一次级导航 */
.page-subnav {
  border-bottom: 1px solid var(--border, #d8e4ef);
  background: color-mix(in srgb, var(--surface, #fff) 88%, var(--bg, #f4f7fb));
}
.page-subnav-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
}
.page-subnav-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border, #d8e4ef);
  background: var(--surface, #fff);
  color: var(--muted, #64748b);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.page-subnav-link:hover {
  color: var(--text, #0f172a);
  border-color: color-mix(in srgb, var(--accent, #2563eb) 45%, var(--border, #d8e4ef));
}
.page-subnav-link.is-active {
  color: #fff;
  background: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
}
.page-subnav-link.is-active:hover {
  color: #fff;
}

.section h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--heading);
}

.section .sub {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--grid-gap);
  margin-top: 24px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--grid-gap);
  margin-top: 24px;
}

@media (min-width: 901px) {
  .console-help-sticky {
    position: sticky;
    top: 84px;
    align-self: start;
  }
}

/* 右侧客服浮钮 + 弹层 */
.sw-fab-wrap {
  position: fixed;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: calc(max(28px, env(safe-area-inset-bottom, 0px) + 12px) + var(--sw-kb, 0px));
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  transition: bottom 0.15s ease;
}
.sw-tip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: var(--card-shadow);
  font-size: 0.875rem;
  line-height: 1.35;
  position: relative;
  animation: sw-tip-in 0.28s ease;
}
.sw-tip::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: var(--card-bg);
  border-right: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
  transform: rotate(45deg);
}
.sw-tip-x {
  border: 0;
  background: transparent;
  color: var(--muted, #64748b);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 2px;
}
.sw-fab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 12px 16px 12px 14px;
  background: var(--accent, #2563eb);
  color: var(--accent-ink, #fff);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.sw-fab:hover,
.sw-fab:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
  outline: none;
}
.sw-fab[aria-expanded="true"] {
  background: var(--card-bg);
  color: var(--text);
}
.sw-fab-ico {
  flex: 0 0 auto;
  display: block;
}
.sw-fab-label {
  line-height: 1;
  letter-spacing: 0.02em;
}
.sw-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1190;
  background: rgba(15, 23, 42, 0.28);
}
.sw-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: calc(96px + env(safe-area-inset-bottom, 0px) + var(--sw-kb, 0px));
  z-index: 1210;
  width: min(400px, calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  max-height: calc(min(78vh, 640px) - var(--sw-kb, 0px));
  overflow: auto;
  margin: 0;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  animation: sw-panel-in 0.2s ease;
  transition: bottom 0.15s ease, max-height 0.15s ease;
  -webkit-overflow-scrolling: touch;
}
.sw-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sw-close {
  min-width: 36px;
  padding: 4px 10px;
  font-size: 1.25rem;
  line-height: 1;
}
.sw-ticket-box {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.sw-ticket-row {
  margin: 8px 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
@keyframes sw-tip-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes sw-panel-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (max-width: 600px) {
  .sw-fab-wrap {
    right: max(12px, env(safe-area-inset-right, 0px));
    bottom: calc(max(16px, env(safe-area-inset-bottom, 0px) + 8px) + var(--sw-kb, 0px));
  }
  .sw-fab {
    padding: 14px;
    border-radius: 50%;
    min-width: 48px;
    min-height: 48px;
    justify-content: center;
  }
  .sw-fab-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  .sw-tip {
    max-width: min(200px, calc(100vw - 88px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  }
  .sw-panel {
    right: max(8px, env(safe-area-inset-right, 0px));
    left: max(8px, env(safe-area-inset-left, 0px));
    width: auto;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px) + var(--sw-kb, 0px));
    max-height: calc(100dvh - 96px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--sw-kb, 0px));
  }
}

@media (max-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

.card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
}

.card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading);
}

.card p {
  margin: 10px 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.card ul {
  margin: 10px 0 0;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 0.9rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--grid-gap);
  margin-top: 24px;
}

@media (max-width: 900px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.stat-card {
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
}

.stat-label {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.stat-value {
  margin-top: 10px;
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--heading);
}

.stat-sub {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn-pay {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-pay .pay-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.list-clean {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft, rgba(148, 163, 184, 0.25));
  color: var(--text);
  font-size: 0.9375rem;
}

.list-item:last-child {
  border-bottom: 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.code-block {
  margin-top: 14px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--codeblock-border);
  background: var(--codeblock-bg);
  color: var(--codeblock-text);
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.input,
.textarea {
  width: 100%;
  max-width: 400px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9375rem;
}

.textarea {
  max-width: 100%;
  min-height: 100px;
  resize: vertical;
}

.form-hint {
  font-size: 0.8125rem;
  color: var(--muted);
  margin-top: 6px;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-top: 12px;
}

.alert-error {
  background: var(--alert-error-bg);
  color: var(--alert-error-text);
  border: 1px solid var(--alert-error-border);
}

.alert-success {
  background: var(--alert-ok-bg);
  color: var(--alert-ok-text);
  border: 1px solid var(--alert-ok-border);
}

/* 控制台等：支付弹窗打开时页顶消息易被挡住，用底部浮层补一眼 */
.ai24x-toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 10050;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.2);
  pointer-events: none;
}
.ai24x-toast[hidden] {
  display: none !important;
}
.ai24x-toast.is-error {
  background: var(--alert-error-bg);
  color: var(--alert-error-text);
  border: 1px solid var(--alert-error-border);
}
.ai24x-toast.is-ok {
  background: var(--alert-ok-bg);
  color: var(--alert-ok-text);
  border: 1px solid var(--alert-ok-border);
}

/* 登录 / 注册：手机号与邮箱切换 */
.auth-tabs {
  display: flex;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.auth-tabs button {
  flex: 1;
  padding: 12px 14px;
  border: none;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  min-height: 46px;
}
.auth-tabs button + button {
  border-left: 1px solid var(--border);
}
.auth-tabs button.is-active {
  background: var(--card-bg);
  color: var(--text);
  font-weight: 700;
}
.auth-field-hidden {
  display: none !important;
}

.form-row-sms {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.form-row-sms .grow {
  flex: 1;
  min-width: 140px;
}

/* 验证码输入与「获取验证码」同一行 */
.form-group-otp-inline .form-otp-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 10px;
  margin-top: 6px;
}
.form-group-otp-inline .form-otp-row .input {
  flex: 1;
  min-width: 0;
  max-width: none;
}
.form-group-otp-inline .form-otp-row .btn-otp-send {
  flex: 0 0 auto;
  white-space: nowrap;
  align-self: stretch;
  padding-left: 14px;
  padding-right: 14px;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 40px 0 24px;
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
  color: var(--footer-text);
  font-size: 0.875rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 800px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.footer-title {
  font-weight: 800;
  color: var(--footer-heading);
  margin-bottom: 10px;
}

.footer-col a {
  display: block;
  padding: 5px 0;
  color: var(--footer-link);
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Utility */
.mt-0 {
  margin-top: 0;
}
.mt-2 {
  margin-top: 8px;
}

/* 帮助中心：FAQ 卡片纵向间距（mt-2=8px 偏紧） */
body[data-page="help"] .help-stack {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  margin-top: 1.25rem;
}
body[data-page="help"] .help-stack > .card {
  margin-top: 0;
}
body[data-page="help"] .help-block-gap {
  margin-top: 2.5rem;
}
body[data-page="help"] #support {
  margin-bottom: 0.25rem;
}

.flex-gap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Lightweight modal card (console / auth) */
.ui-modal-root {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.ui-modal-root.is-open {
  display: flex;
}
.ui-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}
.ui-modal-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  background: var(--surface, #fff);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  padding: 20px 20px 16px;
}
.ui-modal-card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}
.ui-modal-card .ui-modal-sub {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}
.ui-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
.ui-modal-key {
  margin-top: 8px;
  padding: 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface, #fff));
  border: 1px dashed var(--border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
  line-height: 1.45;
}
