:root {
  --brand: #c8102e;
  --brand-dark: #a00d25;
  --brand-light: #ff3b5c;
  --accent: #ff8a3d;
  --accent-2: #7b5cff;
  --bg: #f7f5f8;
  --bg-alt: #ffffff;
  --bg-soft: #efeaf2;
  --text: #1d1a22;
  --text-soft: #55505e;
  --text-muted: #8a8393;
  --border: rgba(29, 26, 34, 0.1);
  --card-bg: rgba(255, 255, 255, 0.72);
  --card-border: rgba(255, 255, 255, 0.65);
  --shadow-sm: 0 2px 8px rgba(29, 26, 34, 0.06);
  --shadow-md: 0 10px 30px rgba(29, 26, 34, 0.1);
  --shadow-lg: 0 24px 60px rgba(29, 26, 34, 0.16);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --grad-banner: linear-gradient(135deg, #c8102e 0%, #7b5cff 55%, #ff8a3d 100%);
  --grad-soft: linear-gradient(135deg, rgba(200, 16, 46, 0.12), rgba(123, 92, 255, 0.12));
  --header-h: 72px;
  --maxw: 1180px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #ff4d68;
    --brand-dark: #e6334f;
    --brand-light: #ff7a8f;
    --accent: #ffa15c;
    --accent-2: #9b82ff;
    --bg: #0e0c12;
    --bg-alt: #16131c;
    --bg-soft: #1d1925;
    --text: #f2eef6;
    --text-soft: #c3bccd;
    --text-muted: #8d8599;
    --border: rgba(242, 238, 246, 0.12);
    --card-bg: rgba(30, 26, 40, 0.62);
    --card-border: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
    --grad-banner: linear-gradient(135deg, #7a0a1c 0%, #3a2a8a 55%, #8a4a12 100%);
    --grad-soft: linear-gradient(135deg, rgba(255, 77, 104, 0.14), rgba(155, 130, 255, 0.14));
  }
}

*,
*::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: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(200, 16, 46, 0.1), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(123, 92, 255, 0.1), transparent 60%),
    radial-gradient(800px 600px at 50% 100%, rgba(255, 138, 61, 0.08), transparent 60%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

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

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

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

h1 {
  font-size: clamp(1.75rem, 4.2vw, 2.75rem);
  line-height: 1.25;
}

h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  position: relative;
  padding-bottom: 0.55em;
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 64px;
  height: 4px;
  border-radius: 999px;
  background: var(--grad-banner);
}

h3 {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--text);
}

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

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ============ HEADER ============ */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s var(--ease), background 0.3s var(--ease);
}

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

.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 6px clamp(14px, 4vw, 32px);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.topbar span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar span:first-child {
  color: var(--brand);
  font-weight: 600;
}

#site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px clamp(14px, 4vw, 32px);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.logo svg {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(200, 16, 46, 0.35);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.logo:hover svg {
  transform: rotate(-6deg) scale(1.06);
  box-shadow: 0 10px 24px rgba(200, 16, 46, 0.5);
}

.logo:hover {
  color: var(--brand);
}

#site-header nav ul {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
}

#site-header nav ul li a {
  display: inline-block;
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  border-radius: 999px;
  position: relative;
  transition: color 0.25s var(--ease), background 0.25s var(--ease),
    transform 0.25s var(--ease);
}

#site-header nav ul li a::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 0;
  height: 2px;
  border-radius: 999px;
  background: var(--grad-banner);
  transform: translateX(-50%);
  transition: width 0.3s var(--ease);
}

#site-header nav ul li a:hover,
#site-header nav ul li a:focus-visible {
  color: var(--brand);
  background: var(--grad-soft);
  transform: translateY(-1px);
}

#site-header nav ul li a:hover::after {
  width: 40%;
}

/* ============ MAIN LAYOUT ============ */
main {
  display: block;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 48px) clamp(14px, 4vw, 32px) 0;
}

main > section {
  margin-bottom: clamp(28px, 5vw, 56px);
  padding: clamp(22px, 4vw, 44px);
  background: var(--card-bg);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.7s var(--ease) both;
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease),
    border-color 0.4s var(--ease);
}

main > section::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--grad-banner);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
  pointer-events: none;
}

main > section:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(200, 16, 46, 0.25);
}

main > section:hover::before {
  opacity: 1;
}

main > section:nth-child(2) { animation-delay: 0.05s; }
main > section:nth-child(3) { animation-delay: 0.1s; }
main > section:nth-child(4) { animation-delay: 0.15s; }
main > section:nth-child(5) { animation-delay: 0.2s; }
main > section:nth-child(6) { animation-delay: 0.25s; }

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

/* ============ HERO ============ */
#hero {
  background: var(--grad-banner);
  background-size: 200% 200%;
  border: none;
  color: #fff;
  border-radius: var(--radius-xl);
  padding: clamp(32px, 6vw, 72px) clamp(22px, 5vw, 56px);
  box-shadow: var(--shadow-lg);
  animation: heroGradient 14s ease infinite, fadeUp 0.8s var(--ease) both;
  isolation: isolate;
}

#hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 300px at 85% 15%, rgba(255, 255, 255, 0.22), transparent 60%),
    radial-gradient(500px 260px at 10% 90%, rgba(255, 255, 255, 0.14), transparent 60%);
  z-index: -1;
  pointer-events: none;
}

#hero::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -10%;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 0 40px rgba(255, 255, 255, 0.05);
  z-index: -1;
  pointer-events: none;
  animation: floatOrb 9s ease-in-out infinite;
}

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

@keyframes floatOrb {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(18px) scale(1.05); }
}

#hero h1 {
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
  max-width: 22ch;
}

#hero p {
  color: rgba(255, 255, 255, 0.92);
  max-width: 72ch;
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
}

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

#hero a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ============ TYPOGRAPHY IN SECTIONS ============ */
section h3 {
  margin-top: 1.4em;
  padding-left: 14px;
  position: relative;
}

section h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.28em;
  width: 5px;
  height: 1em;
  border-radius: 999px;
  background: var(--grad-banner);
}

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

section p {
  max-width: 78ch;
}

/* ============ ARTICLE CARDS ============ */
#articles {
  display: flex;
  flex-direction: column;
}

#articles h2,
#articles > p {
  flex: 0 0 auto;
}

#articles article {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: clamp(16px, 2.6vw, 24px);
  margin-bottom: 14px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease);
  position: relative;
  overflow: hidden;
}

#articles article::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--grad-banner);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.4s var(--ease);
}

#articles article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: rgba(200, 16, 46, 0.3);
}

#articles article:hover::before {
  transform: scaleY(1);
}

#articles article h3 {
  margin: 0 0 2px;
  padding-left: 0;
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  transition: color 0.25s var(--ease);
}

#articles article h3::before {
  display: none;
}

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

#articles article p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-soft);
}

#articles article p:first-of-type {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

#articles article a {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
  background: var(--grad-banner);
  background-size: 160% 160%;
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(200, 16, 46, 0.3);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease),
    background-position 0.4s var(--ease);
}

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

#articles article a:hover,
#articles article a:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  background-position: 100% 50%;
  box-shadow: 0 8px 22px rgba(200, 16, 46, 0.45);
}

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

/* ============ FAQ ============ */
#faq h3 {
  cursor: pointer;
  padding: 14px 18px 14px 40px;
  margin: 0 0 8px;
  font-size: 1rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease),
    transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}

#faq h3::before {
  content: "Q";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  font-weight: 900;
  color: #fff;
  background: var(--grad-banner);
  border-radius: 6px;
  height: auto;
  aspect-ratio: 1;
  border-radius: 6px;
}

#faq h3:hover {
  background: var(--grad-soft);
  border-color: rgba(200, 16, 46, 0.3);
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

#faq h3 + p {
  margin: 0 0 16px;
  padding: 0 18px 4px 40px;
  font-size: 0.94rem;
  animation: fadeUp 0.5s var(--ease) both;
}

/* ============ CONTACT ============ */
#contact p {
  position: relative;
  padding: 12px 16px 12px 44px;
  margin: 0 0 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

#contact p::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--grad-banner);
  box-shadow: 0 0 0 4px rgba(200, 16, 46, 0.14);
}

#contact p:hover {
  transform: translateX(4px);
  border-color: rgba(200, 16, 46, 0.3);
  box-shadow: var(--shadow-sm);
}

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

#sitemap ul li a,
#links ul li a {
  display: inline-block;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: color 0.3s var(--ease), background 0.3s var(--ease),
    border-color 0.3s var(--ease), transform 0.3s var(--ease),
    box-shadow 0.3s var(--ease);
}

#sitemap ul li a:hover,
#links ul li a:hover,
#sitemap ul li a:focus-visible,
#links ul li a:focus-visible {
  color: #fff;
  background: var(--grad-banner);
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(200, 16, 46, 0.3);
}

/* ============ LEGAL ============ */
#legal h2 {
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  margin-top: 1.6em;
}

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

#legal h2::after {
  width: 40px;
  height: 3px;
}

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

/* ============ HOWTO ============ */
#howto h3 {
  margin-top: 1.2em;
}

/* ============ FOOTER ============ */
footer {
  margin-top: clamp(32px, 6vw, 72px);
  padding: clamp(28px, 5vw, 52px) clamp(14px, 4vw, 32px);
  background: var(--grad-banner);
  background-size: 180% 180%;
  animation: heroGradient 16s ease infinite;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  position: relative;
  overflow: hidden;
}

footer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(700px 300px at 50% 0%, rgba(255, 255, 255, 0.16), transparent 65%);
  pointer-events: none;
}

footer p {
  position: relative;
  margin: 0 auto 8px;
  max-width: 80ch;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.9);
}

footer p:first-child {
  font-weight: 700;
  font-size: 0.98rem;
  color: #fff;
}

footer p:last-child {
  margin-bottom: 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.72);
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  #site-header nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  #site-header nav ul {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  #site-header nav ul::-webkit-scrollbar {
    display: none;
  }

  #site-header nav ul li a {
    white-space: nowrap;
    font-size: 0.85rem;
    padding: 7px 11px;
  }

  .topbar {
    justify-content: center;
    text-align: center;
  }

  .topbar span {
    white-space: normal;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
    line-height: 1.7;
  }

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

  #hero {
    border-radius: var(--radius-lg);
    padding: 28px 20px;
  }

  #hero::after {
    width: 220px;
    height: 220px;
    top: -30%;
    right: -20%;
  }

  #hero h1 {
    max-width: none;
  }

  section h3 {
    padding-left: 12px;
  }

  #articles article {
    padding: 16px;
  }

  #articles article a {
    width: 100%;
    justify-content: center;
  }

  #faq h3 {
    padding: 12px 14px 12px 36px;
  }

  #faq h3 + p {
    padding: 0 14px 4px 36px;
  }

  #contact p {
    padding: 10px 14px 10px 40px;
  }

  #sitemap ul li a,
  #links ul li a {
    padding: 7px 14px;
    font-size: 0.85rem;
  }

  footer p {
    font-size: 0.82rem;
  }
}

@media (max-width: 400px) {
  .logo span {
    display: none;
  }

  .logo svg {
    width: 36px;
    height: 36px;
  }
}

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

  main > section,
  #hero {
    opacity: 1;
    transform: none;
  }
}

::selection {
  background: rgba(200, 16, 46, 0.28);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  ::selection {
    background: rgba(255, 77, 104, 0.35);
    color: #fff;
  }
}

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

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

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

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

/* ============ SCROLL REVEAL SUPPORT ============ */
@supports (animation-timeline: view()) {
  main > section {
    animation: revealSection linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 30%;
  }

  @keyframes revealSection {
    from {
      opacity: 0;
      transform: translateY(32px) scale(0.985);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
}

/* ============ PRINT ============ */
@media print {
  #site-header,
  footer,
  #links,
  #sitemap {
    display: none;
  }

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

  main > section {
    box-shadow: none;
    border: 1px solid #ccc;
    background: #fff;
    animation: none;
  }

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