:root {
  --primary: #1a5fb4;
  --primary-light: #3584e4;
  --primary-dark: #0d3d7a;
  --accent: #f6c344;
  --accent-soft: #ffd966;
  --bg: #f4f7fb;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.65);
  --bg-glass-strong: rgba(255, 255, 255, 0.82);
  --text: #1c2431;
  --text-soft: #4a5568;
  --text-muted: #6b7787;
  --border: rgba(26, 95, 180, 0.14);
  --border-strong: rgba(26, 95, 180, 0.28);
  --shadow-sm: 0 2px 8px rgba(13, 61, 122, 0.06);
  --shadow-md: 0 8px 28px rgba(13, 61, 122, 0.1);
  --shadow-lg: 0 18px 48px rgba(13, 61, 122, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --grad-hero: linear-gradient(135deg, #0d3d7a 0%, #1a5fb4 42%, #3584e4 72%, #5aa9f0 100%);
  --grad-accent: linear-gradient(120deg, #f6c344 0%, #ffd966 55%, #ffe9a8 100%);
  --grad-card: linear-gradient(160deg, rgba(255, 255, 255, 0.9) 0%, rgba(244, 247, 251, 0.72) 100%);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --maxw: 1180px;
  --header-h: 68px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #5aa9f0;
    --primary-light: #7cc0ff;
    --primary-dark: #1a5fb4;
    --accent: #f6c344;
    --accent-soft: #ffd966;
    --bg: #0b1220;
    --bg-elevated: #131c2e;
    --bg-glass: rgba(19, 28, 46, 0.62);
    --bg-glass-strong: rgba(19, 28, 46, 0.86);
    --text: #e8eef8;
    --text-soft: #b6c2d6;
    --text-muted: #8b9ab3;
    --border: rgba(90, 169, 240, 0.18);
    --border-strong: rgba(90, 169, 240, 0.36);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.62);
    --grad-hero: linear-gradient(135deg, #061024 0%, #0d3d7a 45%, #1a5fb4 78%, #2b7ad6 100%);
    --grad-card: linear-gradient(160deg, rgba(30, 42, 66, 0.9) 0%, rgba(19, 28, 46, 0.7) 100%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(53, 132, 228, 0.1) 0%, transparent 42%),
    radial-gradient(circle at 88% 22%, rgba(246, 195, 68, 0.09) 0%, transparent 38%),
    radial-gradient(circle at 50% 100%, rgba(26, 95, 180, 0.08) 0%, transparent 55%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.25s var(--ease);
}

a:hover,
a:focus-visible {
  color: var(--accent);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.35rem, 2.6vw, 1.9rem);
  position: relative;
  padding-left: 18px;
}

h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18em;
  bottom: 0.18em;
  width: 5px;
  border-radius: 4px;
  background: var(--grad-accent);
  box-shadow: 0 0 14px rgba(246, 195, 68, 0.5);
}

h3 {
  font-size: clamp(1.08rem, 1.9vw, 1.32rem);
  color: var(--primary);
}

p {
  margin: 0 0 1em;
  color: var(--text-soft);
}

ul,
ol {
  margin: 0 0 1.2em;
  padding-left: 1.4em;
  color: var(--text-soft);
}

li {
  margin-bottom: 0.5em;
}

li::marker {
  color: var(--primary-light);
}

strong {
  color: var(--text);
  font-weight: 700;
}

time {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  margin-bottom: 0.6em;
}

blockquote {
  margin: 1.2em 0;
  padding: 1em 1.3em;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--bg-glass);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow: var(--shadow-sm);
}

blockquote p {
  margin: 0;
  font-style: italic;
  color: var(--text);
}

/* ============ HEADER ============ */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass-strong);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

header > div {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

header > div > a {
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--text);
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  white-space: nowrap;
}

header > div > a::before {
  content: "🍍";
  font-size: 1.35rem;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(246, 195, 68, 0.45));
  transition: transform 0.4s var(--ease);
}

header > div > a:hover::before {
  transform: rotate(-12deg) scale(1.12);
}

header > div > a:hover {
  color: var(--primary);
}

nav[aria-label="主导航"] ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 0;
}

nav[aria-label="主导航"] li {
  margin: 0;
}

nav[aria-label="主导航"] a {
  display: inline-block;
  padding: 7px 13px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: 999px;
  transition: background 0.25s var(--ease), color 0.25s var(--ease),
    transform 0.25s var(--ease);
}

nav[aria-label="主导航"] a:hover {
  color: var(--primary);
  background: rgba(53, 132, 228, 0.12);
  transform: translateY(-2px);
}

/* ============ MAIN ============ */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ============ BREADCRUMB ============ */
nav[aria-label="面包屑导航"] {
  padding: 18px 0 6px;
}

nav[aria-label="面包屑导航"] ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

nav[aria-label="面包屑导航"] li {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

nav[aria-label="面包屑导航"] li + li::before {
  content: "›";
  margin-right: 8px;
  color: var(--text-muted);
  opacity: 0.7;
}

nav[aria-label="面包屑导航"] a {
  color: var(--primary);
  font-weight: 500;
}

nav[aria-label="面包屑导航"] [aria-current="page"] {
  color: var(--text-muted);
}

/* ============ HERO ============ */
#hero {
  position: relative;
  margin: 18px 0 42px;
  padding: clamp(30px, 5vw, 62px) clamp(22px, 4vw, 56px);
  border-radius: var(--radius-xl);
  background: var(--grad-hero);
  color: #fff;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  isolation: isolate;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 82% 18%, rgba(246, 195, 68, 0.28) 0%, transparent 42%),
    radial-gradient(circle at 12% 88%, rgba(255, 255, 255, 0.16) 0%, transparent 46%);
  z-index: -1;
}

#hero::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -12%;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 60px rgba(255, 255, 255, 0.04),
    0 0 0 130px rgba(255, 255, 255, 0.03);
  z-index: -1;
  animation: heroFloat 14s ease-in-out infinite;
}

@keyframes heroFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    transform: translate3d(-24px, 26px, 0) rotate(6deg);
  }
}

#hero h1 {
  color: #fff;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.22);
  max-width: 900px;
}

#hero p {
  color: rgba(255, 255, 255, 0.9);
  max-width: 78ch;
  font-size: clamp(0.95rem, 1.4vw, 1.06rem);
}

#hero p:last-child {
  margin-bottom: 0;
}

/* ============ IN-PAGE TOC ============ */
nav[aria-label="页内锚点导航"] {
  margin: 0 0 40px;
  padding: clamp(20px, 3vw, 30px);
  border-radius: var(--radius-lg);
  background: var(--grad-card);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  box-shadow: var(--shadow-md);
}

nav[aria-label="页内锚点导航"] h2 {
  font-size: 1.15rem;
  margin-bottom: 1em;
  padding-left: 16px;
}

nav[aria-label="页内锚点导航"] ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px 14px;
}

nav[aria-label="页内锚点导航"] li {
  margin: 0;
}

nav[aria-label="页内锚点导航"] a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.35);
  transition: all 0.28s var(--ease);
}

@media (prefers-color-scheme: dark) {
  nav[aria-label="页内锚点导航"] a {
    background: rgba(255, 255, 255, 0.04);
  }
}

nav[aria-label="页内锚点导航"] a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--grad-accent);
  transition: transform 0.28s var(--ease);
}

nav[aria-label="页内锚点导航"] a:hover {
  color: var(--primary);
  background: rgba(53, 132, 228, 0.12);
  border-color: var(--border-strong);
  transform: translateX(4px);
}

nav[aria-label="页内锚点导航"] a:hover::before {
  transform: scale(1.5);
}

/* ============ SECTIONS ============ */
section {
  margin: 0 0 40px;
  padding: clamp(22px, 3.4vw, 40px);
  border-radius: var(--radius-lg);
  background: var(--grad-card);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.7s var(--ease) both;
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease),
    border-color 0.35s var(--ease);
}

section:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

section > h2:first-child {
  margin-top: 0;
}

section h3 {
  margin-top: 1.7em;
}

section h3:first-of-type {
  margin-top: 0.4em;
}

/* ============ ARTICLES ============ */
#articles article {
  position: relative;
  padding: 20px 22px;
  margin: 0 0 16px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease);
  overflow: hidden;
}

#articles article::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--grad-accent);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}

#articles article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

#articles article:hover::after {
  opacity: 1;
}

#articles article h3 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--text);
  transition: color 0.28s var(--ease);
}

#articles article:hover h3 {
  color: var(--primary);
}

#articles article p:last-child {
  margin-bottom: 0;
}

#articles article a {
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

#articles article a::after {
  content: "→";
  transition: transform 0.28s var(--ease);
}

#articles article a:hover::after {
  transform: translateX(5px);
}

/* ============ FAQ ============ */
#faq h3 {
  padding: 14px 18px;
  margin: 0 0 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: rgba(53, 132, 228, 0.08);
  border: 1px solid var(--border);
  border-bottom: none;
  color: var(--text);
  font-size: 1.02rem;
  transition: background 0.28s var(--ease), color 0.28s var(--ease);
}

#faq h3:not(:first-of-type) {
  margin-top: 18px;
}

#faq h3 + p {
  margin: 0 0 0;
  padding: 16px 18px;
  background: var(--bg-glass);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: background 0.28s var(--ease);
}

#faq h3:hover {
  background: rgba(53, 132, 228, 0.16);
  color: var(--primary);
}

#faq h3:hover + p {
  background: var(--bg-glass-strong);
}

/* ============ HOWTO ============ */
#howto ol {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

#howto ol > li {
  counter-increment: step;
  position: relative;
  padding: 12px 16px 12px 56px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    border-color 0.3s var(--ease);
}

#howto ol > li::before {
  content: counter(step);
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 0.86rem;
  font-weight: 700;
  color: #0d3d7a;
  background: var(--grad-accent);
  box-shadow: 0 4px 12px rgba(246, 195, 68, 0.4);
}

#howto ol > li:hover {
  transform: translateX(5px);
  box-shadow: var(--shadow-sm);
  border-color: var(--border-strong);
}

#howto ul > li {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.25s var(--ease);
}

#howto ul > li:hover {
  background: rgba(53, 132, 228, 0.08);
}

/* ============ CONTACT LISTS ============ */
#contact ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

#contact ul li {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border);
  font-size: 0.92rem;
  transition: transform 0.28s var(--ease), border-color 0.28s var(--ease),
    box-shadow 0.28s var(--ease);
}

#contact ul li:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

#contact ul li a {
  font-weight: 500;
}

/* ============ FOOTER ============ */
footer {
  margin-top: 20px;
  padding: 34px 20px 40px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-glass);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
}

footer p {
  margin: 0 0 6px;
  font-size: 0.86rem;
  color: var(--text-muted);
}

footer p:last-child {
  margin-bottom: 0;
}

/* ============ SCROLL REVEAL ============ */
@supports (animation-timeline: view()) {
  section {
    animation: none;
    animation-timeline: view();
    animation-range: entry 0% entry 55%;
    animation-name: fadeUp;
    animation-duration: 1ms;
    animation-fill-mode: both;
  }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  header > div {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 12px 18px;
  }

  header > div > a {
    padding: 0;
  }

  nav[aria-label="主导航"] ul {
    gap: 2px;
  }

  nav[aria-label="主导航"] a {
    padding: 6px 10px;
    font-size: 0.84rem;
  }

  #hero {
    border-radius: var(--radius-lg);
  }
}

@media (max-width: 600px) {
  body {
    font-size: 15px;
  }

  main {
    padding: 0 14px 48px;
  }

  header > div {
    padding: 10px 14px;
  }

  nav[aria-label="主导航"] {
    width: 100%;
  }

  nav[aria-label="主导航"] ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  nav[aria-label="主导航"] ul::-webkit-scrollbar {
    display: none;
  }

  nav[aria-label="主导航"] a {
    white-space: nowrap;
  }

  nav[aria-label="页内锚点导航"] ul {
    grid-template-columns: 1fr;
  }

  section {
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }

  #hero {
    padding: 28px 20px;
    margin-bottom: 30px;
  }

  #articles article {
    padding: 16px;
  }

  #faq h3 {
    padding: 12px 14px;
    font-size: 0.96rem;
  }

  #faq h3 + p {
    padding: 14px;
    font-size: 0.92rem;
  }

  #howto ol > li {
    padding-left: 50px;
  }

  #contact ul {
    grid-template-columns: 1fr;
  }
}

/* ============ MOTION / PRINT ============ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  header,
  nav,
  footer,
  #hero::after {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  section {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}

/* ============ SELECTION / SCROLLBAR ============ */
::selection {
  background: rgba(246, 195, 68, 0.42);
  color: var(--text);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary-light), var(--primary));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  background-clip: padding-box;
}