:root {
  --primary: #c8102e;
  --primary-dark: #a00d25;
  --primary-light: #ff3b5c;
  --primary-glow: rgba(200, 16, 46, 0.35);
  --accent: #ff6b35;
  --accent-light: #ffab73;
  --bg: #f7f5f2;
  --bg-elevated: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.72);
  --bg-glass-strong: rgba(255, 255, 255, 0.88);
  --text: #1a1a2e;
  --text-secondary: #4a4a5a;
  --text-muted: #8a8a9a;
  --border: rgba(0, 0, 0, 0.08);
  --border-glass: rgba(255, 255, 255, 0.5);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-glow: 0 8px 32px var(--primary-glow);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --max-width: 1200px;
  --header-height: 72px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0d15;
    --bg-elevated: #16162a;
    --bg-glass: rgba(22, 22, 42, 0.72);
    --bg-glass-strong: rgba(22, 22, 42, 0.88);
    --text: #f0f0f5;
    --text-secondary: #b0b0c0;
    --text-muted: #707080;
    --border: rgba(255, 255, 255, 0.08);
    --border-glass: rgba(255, 255, 255, 0.1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --primary-glow: rgba(200, 16, 46, 0.5);
  }
}

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

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

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(200, 16, 46, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(255, 107, 53, 0.06), transparent);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition), opacity var(--transition);
  position: relative;
}

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

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

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}

h2 {
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  font-weight: 800;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  position: relative;
  display: inline-block;
}

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

section:hover > h2::after,
section:focus-within > h2::after {
  width: 80px;
}

h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  margin-bottom: 0.6rem;
  margin-top: 1.5rem;
  color: var(--text);
}

h3:first-child {
  margin-top: 0;
}

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

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

/* ===== HEADER ===== */
header {
  position: relative;
  padding: calc(var(--header-height) + 48px) 24px 64px;
  text-align: center;
  overflow: hidden;
  background: linear-gradient(135deg, #c8102e 0%, #8b0a1e 40%, #4a0510 100%);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  margin-bottom: 8px;
  box-shadow: var(--shadow-lg);
}

header::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255, 107, 53, 0.3), transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255, 59, 92, 0.25), transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.06), transparent 70%);
  pointer-events: none;
}

header::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

header h1 {
  position: relative;
  z-index: 1;
  background: linear-gradient(135deg, #ffffff, #ffd4dc);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  animation: fadeInUp 0.8s ease-out both;
}

header p {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.85);
  max-width: 760px;
  margin: 0 auto;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.8;
  animation: fadeInUp 0.8s ease-out 0.15s both;
}

/* ===== NAV ===== */
nav[aria-label="主导航"] {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border-glass);
  padding: 0 16px;
  margin-bottom: 32px;
  transition: background var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}

nav[aria-label="主导航"] ul {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  gap: 4px;
  padding: 10px 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

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

nav[aria-label="主导航"] a {
  display: block;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  transition: all var(--transition);
  position: relative;
}

nav[aria-label="主导航"] a:hover {
  color: var(--primary);
  background: rgba(200, 16, 46, 0.08);
  transform: translateY(-1px);
}

nav[aria-label="主导航"] a:active {
  transform: translateY(0) scale(0.97);
}

/* ===== BREADCRUMB ===== */
nav[aria-label="面包屑导航"] {
  max-width: var(--max-width);
  margin: 0 auto 32px;
  padding: 0 24px;
}

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

nav[aria-label="面包屑导航"] li {
  display: flex;
  align-items: center;
  gap: 8px;
}

nav[aria-label="面包屑导航"] li:not(:last-child)::after {
  content: '/';
  color: var(--text-muted);
  opacity: 0.5;
}

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

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

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

/* ===== SECTIONS ===== */
section {
  margin-bottom: 48px;
  padding: 32px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  animation: fadeInUp 0.6s ease-out both;
  animation-timeline: view();
  animation-range: entry 0% entry 30%;
}

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

section:target {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

/* ===== CULTURE LIST ===== */
#culture ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

#culture li {
  padding: 14px 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: transform var(--transition), box-shadow var(--transition);
}

#culture li:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}

/* ===== BLOCKQUOTE / REVIEWS ===== */
#reviews blockquote {
  position: relative;
  padding: 24px 24px 20px 56px;
  margin-bottom: 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}

#reviews blockquote::before {
  content: '\201C';
  position: absolute;
  left: 16px;
  top: 8px;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--primary);
  opacity: 0.25;
  font-family: Georgia, serif;
}

#reviews blockquote:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

#reviews blockquote p {
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

#reviews blockquote footer {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* ===== ARTICLES ===== */
#news article,
#articles article {
  padding: 20px;
  margin-bottom: 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

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

#news article h3,
#articles article h3 {
  margin-top: 0;
  transition: color var(--transition);
}

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

#news article p:first-of-type,
#articles article p:first-of-type {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

#news article a,
#articles article a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 8px;
}

#news article a::after,
#articles article a::after {
  content: '→';
  transition: transform var(--transition);
}

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

/* ===== FAQ ===== */
#faq h3 {
  padding: 14px 18px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-top: 12px;
  margin-bottom: 0;
  font-size: 0.95rem;
  cursor: pointer;
  position: relative;
  padding-right: 44px;
  transition: all var(--transition);
}

#faq h3::after {
  content: '+';
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--primary);
  transition: transform var(--transition);
}

#faq h3:hover {
  border-color: rgba(200, 16, 46, 0.3);
  background: rgba(200, 16, 46, 0.04);
}

#faq h3 + p {
  padding: 12px 18px 16px;
  margin-top: -4px;
  margin-bottom: 8px;
  background: var(--bg-elevated);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  border: 1px solid var(--border);
  border-top: none;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ===== HOWTO ===== */
#howto ul,
#howto ol {
  padding-left: 0;
  margin-bottom: 16px;
}

#howto ul li,
#howto ol li {
  position: relative;
  padding: 10px 16px 10px 44px;
  margin-bottom: 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: transform var(--transition), background var(--transition);
}

#howto ul li::before {
  content: '✓';
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary);
  font-weight: 700;
}

#howto ol {
  counter-reset: howto-step;
}

#howto ol li {
  counter-increment: howto-step;
  padding-left: 52px;
}

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

#howto ul li:hover,
#howto ol li:hover {
  transform: translateX(4px);
  background: rgba(200, 16, 46, 0.04);
}

/* ===== CONTACT ===== */
#contact p {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.92rem;
}

#contact p:last-child {
  border-bottom: none;
}

#contact a {
  font-weight: 600;
  word-break: break-all;
}

/* ===== SITEMAP & LINKS ===== */
#sitemap ul,
#links ul {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

#sitemap li a,
#links li a {
  display: block;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: all var(--transition);
}

#sitemap li a:hover,
#links li a:hover {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

/* ===== LEGAL ===== */
#legal h2 {
  font-size: 1.15rem;
  margin-top: 24px;
  margin-bottom: 0.75rem;
}

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

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

#legal p {
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ===== AUTHOR ===== */
#author p {
  font-size: 0.9rem;
  padding: 6px 0;
}

#author p:nth-child(1),
#author p:nth-child(2) {
  font-weight: 600;
  color: var(--text);
}

/* ===== FOOTER ===== */
footer {
  position: relative;
  padding: 40px 24px;
  text-align: center;
  background: linear-gradient(135deg, #1a1a2e, #0d0d15);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  overflow: hidden;
}

footer::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 0%, rgba(200, 16, 46, 0.15), transparent 50%),
    radial-gradient(circle at 70% 100%, rgba(255, 107, 53, 0.1), transparent 50%);
  pointer-events: none;
}

footer p {
  position: relative;
  z-index: 1;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.6);
}

footer p:first-child {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 0 var(--primary-glow);
  }
  50% {
    box-shadow: 0 0 0 12px transparent;
  }
}

/* Fallback for browsers without animation-timeline */
@supports not (animation-timeline: view()) {
  section {
    animation: fadeInUp 0.6s ease-out both;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }

  body {
    font-size: 15px;
  }

  header {
    padding: calc(var(--header-height) + 32px) 20px 48px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

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

  nav[aria-label="主导航"] a {
    padding: 7px 12px;
    font-size: 0.8rem;
  }

  nav[aria-label="面包屑导航"] {
    padding: 0 20px;
    margin-bottom: 24px;
  }

  main {
    padding: 0 16px 48px;
  }

  section {
    padding: 24px 20px;
    margin-bottom: 32px;
    border-radius: var(--radius-md);
  }

  h2::after {
    width: 36px;
    height: 3px;
  }

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

  #sitemap ul,
  #links ul {
    grid-template-columns: repeat(2, 1fr);
  }

  #reviews blockquote {
    padding: 20px 18px 16px 48px;
  }

  #reviews blockquote::before {
    font-size: 2.8rem;
    left: 12px;
  }

  footer {
    padding: 32px 20px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
}

@media (max-width: 480px) {
  header {
    padding: calc(var(--header-height) + 24px) 16px 40px;
  }

  header h1 {
    font-size: 1.35rem;
  }

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

  #sitemap ul,
  #links ul {
    grid-template-columns: 1fr;
  }

  #contact p {
    flex-direction: column;
    gap: 2px;
  }

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

/* ===== ACCESSIBILITY ===== */
@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;
  }
}

::selection {
  background: var(--primary);
  color: #fff;
}

::-moz-selection {
  background: var(--primary);
  color: #fff;
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(200, 16, 46, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(200, 16, 46, 0.5);
}

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

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

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