:root {
  --primary: #ff6b35;
  --primary-dark: #e55a2b;
  --primary-light: #ff8c5a;
  --secondary: #ffb347;
  --accent: #ff4757;
  --bg: #fef9f4;
  --bg-alt: #fff5ee;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --surface-glass-border: rgba(255, 255, 255, 0.45);
  --text: #2d2016;
  --text-secondary: #6b5d52;
  --text-muted: #9e9088;
  --border: rgba(255, 107, 53, 0.12);
  --shadow-sm: 0 2px 8px rgba(255, 107, 53, 0.06);
  --shadow-md: 0 8px 24px rgba(255, 107, 53, 0.10);
  --shadow-lg: 0 16px 48px rgba(255, 107, 53, 0.14);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition: 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #ff8c5a;
    --primary-dark: #ff6b35;
    --primary-light: #ffb347;
    --secondary: #ffc46b;
    --accent: #ff6b7a;
    --bg: #1a1410;
    --bg-alt: #221a14;
    --surface: #2a211a;
    --surface-glass: rgba(42, 33, 26, 0.78);
    --surface-glass-border: rgba(255, 140, 90, 0.15);
    --text: #f0e6de;
    --text-secondary: #c4b5a8;
    --text-muted: #8a7d72;
    --border: rgba(255, 140, 90, 0.12);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.4s ease, color 0.4s ease;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(255, 107, 53, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 20%, rgba(255, 179, 71, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse 70% 40% at 50% 100%, rgba(255, 107, 53, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

@media (prefers-color-scheme: dark) {
  body::before {
    background:
      radial-gradient(ellipse 80% 60% at 10% 0%, rgba(255, 140, 90, 0.05) 0%, transparent 60%),
      radial-gradient(ellipse 60% 50% at 90% 20%, rgba(255, 196, 107, 0.04) 0%, transparent 55%),
      radial-gradient(ellipse 70% 40% at 50% 100%, rgba(255, 107, 53, 0.03) 0%, transparent 60%);
  }
}

/* ========== HEADER ========== */
header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--surface-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--surface-glass-border);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

header:hover {
  box-shadow: var(--shadow-md);
}

nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

nav > a {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  white-space: nowrap;
  position: relative;
  transition: transform var(--transition), color var(--transition);
  flex-shrink: 0;
}

nav > a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 2px;
  transition: width var(--transition);
}

nav > a:hover {
  transform: scale(1.04);
}

nav > a:hover::after {
  width: 100%;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav ul li a {
  display: block;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition), transform var(--transition);
  white-space: nowrap;
}

nav ul li a:hover {
  color: var(--primary);
  background: rgba(255, 107, 53, 0.08);
  transform: translateY(-1px);
}

@media (prefers-color-scheme: dark) {
  nav ul li a:hover {
    background: rgba(255, 140, 90, 0.1);
  }
}

/* ========== MAIN ========== */
main {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

article {
  animation: fadeInUp 0.7s ease both;
}

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

/* ========== H1 BANNER ========== */
article > h1 {
  position: relative;
  margin: 32px 0 40px;
  padding: 64px 48px;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.35;
  color: #fff;
  letter-spacing: -0.02em;
  text-align: center;
  background: linear-gradient(135deg, #ff6b35 0%, #ff8c5a 25%, #ffb347 55%, #ff6b35 100%);
  background-size: 300% 300%;
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 60px rgba(255, 107, 53, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
  overflow: hidden;
  animation: bannerShift 8s ease infinite, fadeInUp 0.7s ease both;
}

article > h1::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.18) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 255, 255, 0.12) 0%, transparent 45%);
  animation: shimmer 6s ease-in-out infinite;
  pointer-events: none;
}

article > h1::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 40%;
  background: linear-gradient(to top, rgba(255, 107, 53, 0.3), transparent);
  pointer-events: none;
}

@keyframes bannerShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes shimmer {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(5%, 3%) rotate(3deg); }
}

/* ========== SECTIONS ========== */
section {
  margin-bottom: 48px;
  padding: 36px 40px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
  position: relative;
  overflow: hidden;
}

section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 0;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  border-radius: 0 0 4px 0;
  transition: height 0.5s ease;
}

section:hover::before {
  height: 100%;
}

section:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
  border-color: rgba(255, 107, 53, 0.2);
}

section:target {
  animation: targetPulse 0.6s ease;
}

@keyframes targetPulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(255, 107, 53, 0); }
  100% { box-shadow: var(--shadow-sm); }
}

/* ========== HEADINGS ========== */
h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.65rem);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  padding-bottom: 12px;
  position: relative;
  letter-spacing: -0.01em;
}

h2::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  transition: width var(--transition);
}

section:hover h2::after {
  width: 80px;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 10px;
  padding-left: 14px;
  position: relative;
  letter-spacing: -0.01em;
}

h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 18px;
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  border-radius: 2px;
}

h3:first-of-type {
  margin-top: 0;
}

/* ========== PARAGRAPHS & LISTS ========== */
p {
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

section > p:last-child {
  margin-bottom: 0;
}

ul,
ol {
  margin: 12px 0 16px;
  padding-left: 0;
  list-style: none;
}

ul li,
ol li {
  position: relative;
  padding: 8px 0 8px 28px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: color var(--transition), transform var(--transition);
}

ul li::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 16px;
  width: 8px;
  height: 8px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 50%;
  transition: transform var(--transition), box-shadow var(--transition);
}

ul li:hover {
  color: var(--text);
  transform: translateX(4px);
}

ul li:hover::before {
  transform: scale(1.4);
  box-shadow: 0 0 8px rgba(255, 107, 53, 0.5);
}

ol {
  counter-reset: step-counter;
}

ol li {
  counter-increment: step-counter;
  padding-left: 40px;
}

ol li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 8px;
  width: 26px;
  height: 26px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform var(--transition), box-shadow var(--transition);
}

ol li:hover {
  color: var(--text);
  transform: translateX(4px);
}

ol li:hover::before {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(255, 107, 53, 0.4);
}

/* ========== LINKS ========== */
a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

section a:not(nav a) {
  position: relative;
}

section a:not(nav a)::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--primary);
  transition: width var(--transition);
}

section a:not(nav a):hover::after {
  width: 100%;
}

/* ========== BLOCKQUOTE ========== */
blockquote {
  margin: 20px 0;
  padding: 20px 24px;
  background: var(--bg-alt);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  position: relative;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
}

blockquote::before {
  content: "\201C";
  position: absolute;
  top: 4px;
  left: 12px;
  font-size: 3rem;
  line-height: 1;
  color: var(--primary);
  opacity: 0.15;
  font-family: Georgia, serif;
}

blockquote:hover {
  background: rgba(255, 107, 53, 0.06);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

blockquote p {
  margin-bottom: 8px;
  font-style: italic;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}

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

/* ========== ARTICLE (NESTED) ========== */
section article {
  padding: 20px 24px;
  margin-bottom: 14px;
  background: var(--bg-alt);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

section article::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255, 107, 53, 0.03), transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

section article:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

section article:hover::after {
  opacity: 1;
}

section article h3 {
  margin-top: 0;
  font-size: 1rem;
}

section article h3::before {
  height: 14px;
}

section article p {
  font-size: 0.9rem;
  margin-bottom: 8px;
}

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

section article a {
  font-weight: 600;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap var(--transition), color var(--transition);
}

section article a::before {
  content: "→";
  transition: transform var(--transition);
}

section article a:hover::before {
  transform: translateX(3px);
}

section article a::after {
  display: none;
}

/* ========== FAQ ========== */
#faq h3 {
  cursor: default;
  padding: 14px 18px 14px 32px;
  margin: 8px 0 4px;
  background: var(--bg-alt);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

#faq h3::before {
  left: 14px;
  height: 16px;
}

#faq h3:hover {
  background: var(--surface);
  border-color: var(--border);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

#faq h3 + p {
  padding: 0 18px 12px 32px;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

/* ========== CONTACT ========== */
#contact p {
  padding: 6px 0;
  font-size: 0.95rem;
}

#contact p:first-of-type {
  margin-top: 4px;
}

/* ========== SITEMAP & LINKS ========== */
#sitemap ul,
#links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

#sitemap ul li,
#links ul li {
  padding: 0;
  margin: 0;
}

#sitemap ul li::before,
#links ul li::before {
  display: none;
}

#sitemap ul li a,
#links ul li a {
  display: inline-block;
  padding: 8px 16px;
  background: var(--bg-alt);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  border: 1px solid transparent;
  transition: all var(--transition);
}

#sitemap ul li a:hover,
#links ul li a:hover {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 107, 53, 0.3);
  border-color: transparent;
}

#sitemap ul li a::after,
#links ul li a::after {
  display: none;
}

/* ========== LEGAL ========== */
#legal h2 {
  font-size: 1.1rem;
  margin-top: 28px;
  margin-bottom: 12px;
}

#legal h2:first-of-type {
  margin-top: 0;
}

#legal h2::after {
  width: 32px;
  height: 2.5px;
}

#legal p {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ========== META INFO ========== */
#meta-info p {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 4px 0;
}

#meta-info p:first-of-type {
  margin-top: 4px;
}

/* ========== FOOTER ========== */
footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 40px 24px;
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--surface-glass-border);
  margin-top: 20px;
}

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

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

footer a {
  color: var(--primary);
  font-weight: 500;
  transition: color var(--transition), text-decoration var(--transition);
}

footer a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ========== SCROLL ANIMATIONS ========== */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

section {
  animation: fadeInUp 0.6s ease both;
}

section:nth-child(odd) {
  animation-name: slideInLeft;
}

section:nth-child(even) {
  animation-name: slideInRight;
}

section:nth-child(1) { animation-delay: 0.05s; }
section:nth-child(2) { animation-delay: 0.1s; }
section:nth-child(3) { animation-delay: 0.15s; }
section:nth-child(4) { animation-delay: 0.2s; }
section:nth-child(5) { animation-delay: 0.25s; }
section:nth-child(6) { animation-delay: 0.3s; }
section:nth-child(7) { animation-delay: 0.35s; }
section:nth-child(8) { animation-delay: 0.4s; }
section:nth-child(9) { animation-delay: 0.45s; }
section:nth-child(10) { animation-delay: 0.5s; }
section:nth-child(11) { animation-delay: 0.55s; }
section:nth-child(12) { animation-delay: 0.6s; }
section:nth-child(13) { animation-delay: 0.65s; }
section:nth-child(14) { animation-delay: 0.7s; }
section:nth-child(15) { animation-delay: 0.75s; }
section:nth-child(16) { animation-delay: 0.8s; }

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-alt);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--primary), var(--secondary));
  border-radius: 4px;
  transition: background var(--transition);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--bg-alt);
}

/* ========== SELECTION ========== */
::selection {
  background: rgba(255, 107, 53, 0.25);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  ::selection {
    background: rgba(255, 140, 90, 0.3);
  }
}

/* ========== FOCUS ========== */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 900px) {
  nav {
    height: auto;
    flex-direction: column;
    padding: 14px 20px;
    gap: 10px;
  }

  nav ul {
    justify-content: center;
    gap: 2px;
  }

  nav ul li a {
    padding: 5px 10px;
    font-size: 0.8rem;
  }

  article > h1 {
    padding: 48px 28px;
    margin: 24px 0 32px;
    border-radius: var(--radius-lg);
  }

  section {
    padding: 28px 24px;
    border-radius: var(--radius-md);
  }
}

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

  main {
    padding: 0 16px 60px;
  }

  nav {
    padding: 12px 16px;
  }

  nav > a {
    font-size: 1.15rem;
  }

  nav ul {
    gap: 0;
  }

  nav ul li a {
    padding: 4px 8px;
    font-size: 0.75rem;
  }

  article > h1 {
    padding: 36px 20px;
    margin: 16px 0 24px;
    border-radius: var(--radius-md);
    font-size: clamp(1.2rem, 5.5vw, 1.6rem);
  }

  section {
    padding: 22px 18px;
    margin-bottom: 28px;
    border-radius: var(--radius-md);
  }

  h2 {
    font-size: 1.15rem;
    margin-bottom: 16px;
  }

  h3 {
    font-size: 1rem;
    margin: 18px 0 8px;
  }

  p,
  ul li,
  ol li {
    font-size: 0.9rem;
  }

  section article {
    padding: 16px 18px;
  }

  section article h3 {
    font-size: 0.95rem;
  }

  blockquote {
    padding: 16px 18px;
  }

  #sitemap ul li a,
  #links ul li a {
    padding: 6px 12px;
    font-size: 0.8rem;
  }

  footer {
    padding: 28px 16px;
  }
}

@media (max-width: 380px) {
  nav ul li a {
    padding: 3px 6px;
    font-size: 0.7rem;
  }

  article > h1 {
    padding: 28px 16px;
  }

  section {
    padding: 18px 14px;
  }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  section,
  article,
  article > h1 {
    animation: none !important;
  }

  section:hover {
    transform: none;
  }

  section:hover::before {
    height: 0;
  }
}

/* ========== PRINT ========== */
@media print {
  header,
  footer {
    display: none;
  }

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

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

  article > h1 {
    background: #ff6b35;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}