*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 112px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 0.16rem);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  outline: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

img {
  max-width: 100%;
  display: block;
}

ul,
ol {
  list-style: none;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: #c9ced8;
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: #b3b9c6;
}

/* ===== 居中内容区 ===== */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--wrap-pad);
  padding-right: var(--wrap-pad);
}

.main {
  padding-top: var(--nav-h);
  min-height: 100vh;
}

/* ===== 导航 ===== */
.navbar {
  height: var(--nav-h);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
  width: 100%;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.navbar-inner {
  height: 100%;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 var(--nav-side-pad);
  display: flex;
  align-items: center;
  gap: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  flex-shrink: 0;
}

.brand-logo-img {
  display: block;
  height: 0.44rem;
  width: auto;
  max-width: 2.6rem;
  object-fit: contain;
}

.brand-logo {
  width: 0.36rem;
  height: 0.36rem;
  border-radius: var(--radius-sm);
  background: var(--cta-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: var(--fs-xl);
}

.brand-name {
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--text);
}

.brand-sub {
  font-size: 0.11rem;
  color: var(--text-3);
  margin-top: 0.02rem;
}

.nav-links {
  display: flex;
  gap: 0.06rem;
  flex: 1;
  min-width: 0;
  margin-left: 0.2rem;
}

.nav-link {
  padding: 0.08rem 0.16rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  font-weight: 500;
  color: var(--text-2);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.08rem;
  flex-shrink: 0;
  padding-left: 0.16rem;
}

.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.theme-panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.1rem);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.1rem;
  gap: 0.08rem;
  box-shadow: var(--shadow-md);
  z-index: 120;
  flex-wrap: wrap;
  width: 1.6rem;
  justify-content: flex-start;
}

.theme-panel.open {
  display: flex;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.08rem 0.18rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.4;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.nav-btn-primary {
  background: var(--accent);
  color: #fff;
}

.nav-btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(var(--accent-rgb), 0.28);
}

.nav-btn-outline {
  background: #fff;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}

.nav-btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.06rem;
  padding: 0.07rem 0.1rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-2);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.icon-btn:hover {
  background: var(--bg);
  color: var(--accent);
}

.icon-btn i {
  font-size: 0.18rem;
}

.theme-dot {
  width: 0.24rem;
  height: 0.24rem;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease);
}

.theme-dot:hover {
  transform: scale(1.12);
}

.theme-dot.active {
  border-color: var(--text);
}

.theme-dot.indigo {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
}
.theme-dot.blue {
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
}
.theme-dot.sky {
  background: linear-gradient(135deg, #0284c7, #38bdf8);
}
.theme-dot.teal {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
}
.theme-dot.emerald {
  background: linear-gradient(135deg, #059669, #34d399);
}
.theme-dot.violet {
  background: linear-gradient(135deg, #7c3aed, #c084fc);
}
.theme-dot.rose {
  background: linear-gradient(135deg, #e11d48, #fb7185);
}
.theme-dot.orange {
  background: linear-gradient(135deg, #ea580c, #f59e0b);
}
.theme-dot.slate {
  background: linear-gradient(135deg, #475569, #94a3b8);
}

.mobile-menu-btn {
  display: none;
}

.mobile-drawer {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0.16rem clamp(0.2rem, 3vw, 0.4rem) 0.2rem;
  z-index: 99;
  box-shadow: var(--shadow-md);
}

.mobile-drawer[hidden] {
  display: none !important;
}

.mobile-nav {
  display: flex;
  flex-direction: column;
  gap: 0.04rem;
}

.mobile-nav .nav-link {
  padding: 0.12rem 0.14rem;
}

.mobile-actions {
  display: flex;
  gap: 0.1rem;
  margin-top: 0.14rem;
  padding-top: 0.14rem;
  border-top: 1px solid var(--border);
}

.mobile-actions .nav-btn {
  flex: 1;
  justify-content: center;
  display: inline-flex;
}

/* ===== 通用组件 ===== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.06rem;
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-sm);
  padding: 0.1rem 0.2rem;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent2);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(var(--accent-rgb), 0.28);
}

.btn-secondary {
  background: #fff;
  color: var(--text-2);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

.btn-sm {
  padding: 0.06rem 0.12rem;
  font-size: var(--fs-xs);
}

.pill {
  display: inline-flex;
  align-items: center;
  font-size: var(--fs-xs);
  font-weight: 600;
  padding: 0.03rem 0.1rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  line-height: 1.5;
}

.pill-blue {
  color: var(--blue);
  background: var(--blue-bg);
}
.pill-green {
  color: #047857;
  background: var(--green-bg);
}
.pill-orange {
  color: #c2620a;
  background: var(--orange-bg);
}
.pill-purple {
  color: #6d28d9;
  background: var(--purple-bg);
}
.pill-teal {
  color: #0d9488;
  background: var(--teal-bg);
}
.pill-red {
  background: #fef2f2;
  color: #ef4444;
}

.page-header {
  /* 与内容区底边距对称，工具页顶/底节奏一致 */
  padding: calc(var(--section-y) / 2) 0 0;
}

.page-header-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 0.24rem;
  gap: 0.16rem;
  flex-wrap: wrap;
}

.page-title {
  font-size: var(--fs-4xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.page-title i {
  color: var(--accent);
  font-size: 0.3rem;
}

.page-desc {
  font-size: var(--fs-md);
  color: var(--text-3);
  margin-top: 0.08rem;
  line-height: 1.6;
}

.content {
  width: 100%;
  padding-bottom: calc(var(--section-y) / 2);
}

.section-head {
  text-align: center;
  margin-bottom: 0.48rem;
}

.section-tag {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.1rem;
}

.section-title {
  font-size: var(--fs-5xl);
  font-weight: 800;
  color: var(--text);
  line-height: var(--lh-title);
  letter-spacing: -0.025em;
}

.section-desc {
  font-size: var(--fs-base);
  color: var(--text-3);
  margin-top: 0.12rem;
  max-width: 7.2rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.75;
}

/* 页脚 */
.footer {
  background: #0f1428;
  padding: 0.56rem clamp(0.24rem, 3vw, 0.48rem) 0.28rem;
  width: 100%;
}

.footer-inner {
  display: grid;
  grid-template-columns: 2.4fr 1fr 1.2fr;
  gap: 0.48rem;
  width: 100%;
  max-width: none;
}

.footer-brand {
  font-size: var(--fs-base);
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.14rem;
  display: flex;
  align-items: center;
  gap: 0.06rem;
}

.footer-logo-img {
  display: block;
  height: 0.44rem;
  width: auto;
  max-width: 2.8rem;
  object-fit: contain;
}

.footer-desc {
  font-size: var(--fs-md);
  color: rgba(255, 255, 255, 0.48);
  line-height: 1.8;
  max-width: 3.8rem;
}

.footer-col-title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.62);
  margin-bottom: 0.16rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.footer-link {
  font-size: var(--fs-md);
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.1rem;
  transition: color var(--dur-fast) var(--ease);
  display: block;
  line-height: 1.5;
}

.footer-link:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 0.4rem;
  padding-top: 0.2rem;
  text-align: center;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.32);
  letter-spacing: 0.02em;
}

.toast {
  position: fixed;
  bottom: 0.32rem;
  left: 50%;
  transform: translateX(-50%) translateY(0.2rem);
  background: var(--primary);
  color: #fff;
  padding: 0.12rem 0.24rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 600;
  opacity: 0;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease-out);
  z-index: 200;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}

.toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 返回顶部 ===== */
.back-to-top {
  --scroll-p: 0%;
  position: fixed;
  right: max(0.24rem, env(safe-area-inset-right, 0px));
  bottom: max(0.28rem, calc(env(safe-area-inset-bottom, 0px) + 0.2rem));
  z-index: 90;
  width: 0.48rem;
  height: 0.48rem;
  padding: 0.03rem;
  border-radius: 50%;
  color: var(--accent);
  background: conic-gradient(var(--accent) var(--scroll-p), var(--border) 0);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(0.12rem) scale(0.92);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease-out),
    visibility var(--dur), box-shadow var(--dur) var(--ease);
}

.back-to-top-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #fff;
  color: inherit;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.back-to-top i {
  font-size: 0.2rem;
  line-height: 1;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.back-to-top.is-visible:hover {
  color: #fff;
  box-shadow: var(--shadow-accent);
  transform: translateY(-0.04rem) scale(1.04);
}

.back-to-top.is-visible:hover .back-to-top-inner {
  background: var(--cta-grad);
}

.back-to-top.is-visible:active {
  transform: translateY(0) scale(0.96);
}

.back-to-top:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top,
  .back-to-top-inner,
  .toast,
  .nav-btn,
  .btn,
  .nav-link {
    transition: none;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* 响应式 */
@media (max-width: 1100px) {
  .nav-links {
    display: none;
    margin-left: 0;
  }
  .mobile-menu-btn {
    display: inline-flex;
  }
  .hide-md {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .hide-sm {
    display: none !important;
  }
  .back-to-top {
    width: 0.48rem;
    height: 0.48rem;
    right: max(0.16rem, env(safe-area-inset-right, 0px));
    bottom: max(0.2rem, calc(env(safe-area-inset-bottom, 0px) + 0.16rem));
  }
  .back-to-top i {
    font-size: 0.2rem;
  }
  .brand-logo-img {
    height: 0.36rem;
  }
  .footer {
    padding-top: 0.4rem;
  }
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 0.32rem;
  }
  .section-title {
    font-size: 0.26rem;
  }
  .page-title {
    font-size: var(--fs-3xl);
  }
  .page-header {
    padding-top: calc(var(--section-y) / 2);
  }
  :root {
    --wrap-pad: 0.18rem;
    --section-y: 0.56rem;
  }
}

@media (max-width: 480px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}
