:root {
  --font-heading: "Noto Serif SC", Georgia, "Songti SC", serif;
  --font-body: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --font-accent: "JetBrains Mono", "SFMono-Regular", Consolas, "Courier New", monospace;
  --crimson: #A6192E;
  --gold: #D4A017;
  --navy: #1B3A5B;
  --porcelain: #FDFBF7;
  --stone: #ECEAE3;
  --ink: #1A1A1A;
  --cyan: #00E5FF;
  --violet: #7B2D8E;
  --sand: #E8D3A9;
  --dark-overlay: rgba(0,0,0,0.6);
  --header-h: 76px;
  --shadow-soft: 0 2px 8px rgba(26,26,26,0.06);
  --shadow-lift: 0 12px 28px rgba(26,26,26,0.12);
}

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

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

body {
  margin: 0;
  padding-top: var(--header-h);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink);
  background: var(--porcelain);
}

body::before,
body::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  width: 4px;
  z-index: 150;
  pointer-events: none;
  background: linear-gradient(180deg, var(--crimson) 0%, var(--gold) 55%, var(--navy) 100%);
}

body::before { left: 0; }
body::after { right: 0; }

@media (max-width: 1023px) {
  body::before,
  body::after { width: 0; }
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 900;
  line-height: 1.18;
  color: var(--navy);
  margin: 0 0 1rem;
  text-wrap: balance;
}

h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
h2 { font-size: clamp(2rem, 3.5vw, 3rem); }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.2rem; }

p {
  margin: 0 0 1.25rem;
  line-height: 1.85;
}

a {
  color: var(--navy);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--crimson);
}

::selection {
  background: var(--gold);
  color: var(--navy);
}

:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 300;
  background: var(--navy);
  color: var(--porcelain);
  padding: 0.85rem 1.4rem;
  font-family: var(--font-accent);
  font-size: 0.85rem;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}

.skip-link:focus {
  left: 0;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: clamp(3rem, 7vw, 6rem) 0;
}

.section--dark {
  background: var(--navy);
  color: var(--porcelain);
}

.section--dark h1,
.section--dark h2,
.section--dark h3 {
  color: var(--porcelain);
}

.section--paper {
  background: var(--stone);
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(253, 251, 247, 0.94);
  border-bottom: 4px solid var(--crimson);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.header-progress {
  position: absolute;
  left: 0;
  bottom: -4px;
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, var(--crimson) 0%, var(--gold) 40%, var(--cyan) 100%);
  z-index: 2;
  pointer-events: none;
}

.header-progress::after {
  content: "";
  position: absolute;
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.7);
}

.header-inner {
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--navy);
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--crimson) 50%, var(--navy) 50%);
  border: 2px solid var(--gold);
  border-radius: 4px;
  position: relative;
  transform: rotate(-2deg);
  display: inline-block;
  flex: 0 0 auto;
}

.brand-mark::after {
  content: "幻";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--porcelain);
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 0.85rem;
}

.brand-name {
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
}

.quick-search {
  display: inline-block;
  position: relative;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--navy);
  border-radius: 50%;
  background: transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.quick-search::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 7px;
  width: 12px;
  height: 12px;
  border: 2px solid var(--navy);
  border-radius: 50%;
}

.quick-search::after {
  content: "";
  position: absolute;
  top: 20px;
  left: 20px;
  width: 8px;
  height: 2px;
  background: var(--navy);
  transform: rotate(45deg);
  transform-origin: left center;
  border-radius: 2px;
}

.quick-search:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.35);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  color: var(--navy);
  font-family: var(--font-body);
  transition: border-color 0.2s;
}

.nav-toggle:hover {
  border-color: var(--crimson);
}

.nav-toggle-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 20px;
}

.nav-toggle-line {
  height: 2px;
  width: 100%;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-toggle-label {
  font-size: 0.875rem;
  font-weight: 500;
}

.primary-nav {
  margin-left: auto;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 0.25rem;
}

.nav-item > a {
  display: inline-block;
  padding: 0.5rem 0.8rem;
  text-decoration: none;
  color: var(--navy);
  font-size: 0.925rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.nav-item > a:hover {
  color: var(--crimson);
  border-bottom-color: var(--crimson);
}

.nav-item > a[aria-current="page"] {
  color: var(--crimson);
  border-bottom-color: var(--gold);
  background: linear-gradient(180deg, transparent 78%, rgba(212, 160, 23, 0.18) 78%);
}

/* Footer */
.site-footer {
  position: relative;
  background: var(--navy);
  color: var(--porcelain);
  padding: 3.5rem 2rem 1.6rem;
  border-top: 6px solid var(--crimson);
}

.site-footer::before {
  content: "◆";
  position: absolute;
  top: -0.85rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--porcelain);
  color: var(--gold);
  font-size: 0.85rem;
  line-height: 1;
  padding: 0.4rem 0.6rem;
  border-radius: 2px;
  border: 1px solid var(--gold);
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1.3fr;
  gap: 2.8rem;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 1.5rem;
  color: var(--porcelain);
  text-decoration: none;
}

.footer-logo::before {
  content: "";
  width: 20px;
  height: 20px;
  background: var(--gold);
  border-radius: 2px;
  transform: rotate(45deg);
  box-shadow: 0 0 0 2px var(--crimson);
}

.footer-description {
  margin-top: 1rem;
  font-size: 0.9rem;
  line-height: 1.85;
  color: rgba(253, 251, 247, 0.78);
}

.trust-marks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.trust-mark {
  font-family: var(--font-accent);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 0.32rem 0.7rem;
  border: 1px solid rgba(212, 160, 23, 0.75);
  border-radius: 20px;
  color: var(--gold);
  background: rgba(212, 160, 23, 0.08);
}

.footer-heading {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--gold);
  margin: 0 0 1.1rem;
  padding-bottom: 0.5rem;
  position: relative;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-heading::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1.8rem;
  height: 2px;
  background: var(--crimson);
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.footer-links a {
  color: rgba(253, 251, 247, 0.85);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.footer-links a:hover {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(253, 251, 247, 0.85);
}

.contact-label {
  display: block;
  font-family: var(--font-accent);
  font-size: 0.72rem;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin-bottom: 0.12rem;
}

.contact-note {
  margin-top: 1rem;
  font-size: 0.8rem;
  color: rgba(253, 251, 247, 0.6);
  border-left: 2px solid var(--gold);
  padding-left: 0.75rem;
  line-height: 1.6;
}

.footer-bottom {
  max-width: 1200px;
  margin: 2.6rem auto 0;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(253, 251, 247, 0.16);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: rgba(253, 251, 247, 0.62);
}

.copyright,
.icp {
  font-family: var(--font-accent);
  font-size: 0.8rem;
}

/* Shared components */
.main-content {
  min-height: 70vh;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.6rem;
  border-radius: 4px;
  border: 2px solid transparent;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.btn-primary {
  background: var(--crimson);
  color: var(--porcelain);
  border-color: var(--crimson);
}

.btn-primary:hover {
  background: #8E1426;
  border-color: #8E1426;
  box-shadow: 0 8px 18px rgba(166, 25, 46, 0.28);
  transform: translateY(-1px);
  color: var(--porcelain);
}

.btn-secondary {
  background: transparent;
  color: var(--navy);
  border-color: var(--navy);
}

.btn-secondary:hover {
  background: var(--navy);
  color: var(--porcelain);
}

.btn-ghost {
  background: transparent;
  color: var(--porcelain);
  border-color: rgba(253, 251, 247, 0.55);
}

.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(0, 229, 255, 0.06);
}

.card {
  background: var(--porcelain);
  border: 1px solid var(--stone);
  border-radius: 8px;
  padding: 1.6rem;
  box-shadow: var(--shadow-soft);
  transition: box-shadow 0.25s, transform 0.25s;
}

.card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-2px);
}

.card--tint {
  border-left: 6px solid var(--crimson);
}

.card--archive {
  background: var(--sand);
  border: 1px solid var(--gold);
  border-radius: 2px;
}

.paper {
  position: relative;
  background: var(--porcelain);
  border: 1px solid var(--stone);
  box-shadow: var(--shadow-soft);
  padding: 1.6rem;
}

.paper::before {
  content: "";
  position: absolute;
  top: -4px;
  left: -4px;
  width: 18px;
  height: 18px;
  border-top: 3px solid var(--crimson);
  border-left: 3px solid var(--crimson);
}

.tag {
  display: inline-block;
  padding: 0.3rem 0.7rem;
  font-family: var(--font-accent);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: var(--stone);
  color: var(--navy);
  border-radius: 3px;
}

.tag--red { background: var(--crimson); color: var(--porcelain); }
.tag--gold { background: var(--gold); color: var(--ink); }
.tag--blue { background: var(--navy); color: var(--porcelain); }
.tag--violet { background: var(--violet); color: var(--porcelain); }

.index-number {
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--gold);
  letter-spacing: 0.1em;
}

.index-number::after {
  content: " /";
  color: var(--crimson);
}

.data-number {
  font-family: var(--font-accent);
  font-weight: 700;
  font-size: clamp(2.2rem, 4vw, 3rem);
  color: var(--crimson);
  line-height: 1;
}

.data-number small {
  font-size: 1rem;
  font-weight: 500;
  color: var(--navy);
  margin-left: 0.35rem;
}

.breadcrumb {
  list-style: none;
  margin: 0 0 2rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.875rem;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 0.4rem;
  color: var(--gold);
}

.breadcrumb a {
  color: var(--navy);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--crimson);
}

.breadcrumb [aria-current="page"] {
  color: var(--crimson);
  font-weight: 600;
}

.image-frame {
  position: relative;
  background: var(--stone);
  overflow: hidden;
  border: 1px solid var(--stone);
}

.image-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-frame--ratio-4-3 { aspect-ratio: 4 / 3; }
.image-frame--ratio-16-9 { aspect-ratio: 16 / 9; }
.image-frame--ratio-1-1 { aspect-ratio: 1 / 1; }

.image-frame--bw {
  filter: grayscale(1) contrast(1.1);
}

.image-frame--tint::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(166, 25, 46, 0.22), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.data-grid {
  display: grid;
  gap: 1.2rem;
}

.data-grid--2 { grid-template-columns: repeat(2, 1fr); }
.data-grid--3 { grid-template-columns: repeat(3, 1fr); }
.data-grid--4 { grid-template-columns: repeat(4, 1fr); }

.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.2rem;
}

.bento .bento-main { grid-column: span 8; grid-row: span 2; }
.bento .bento-side { grid-column: span 4; grid-row: span 1; }
.bento .bento-fill { grid-column: span 6; grid-row: span 1; }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  border-bottom: 2px solid var(--stone);
}

.tab {
  padding: 0.6rem 1.2rem;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  font-family: var(--font-body);
  font-size: 0.925rem;
  cursor: pointer;
  color: var(--navy);
  transition: color 0.2s, background 0.2s;
}

.tab:hover {
  color: var(--crimson);
}

.tab[aria-selected="true"] {
  background: var(--porcelain);
  border-color: var(--stone);
  position: relative;
  top: 2px;
  color: var(--crimson);
  font-weight: 700;
}

/* Responsive */
@media (max-width: 1023px) {
  :root { --header-h: 68px; }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.2rem;
  }
}

@media (max-width: 800px) {
  :root { --header-h: 62px; }

  .header-inner {
    padding: 0 1rem;
    gap: 0.5rem;
  }

  .brand-name {
    font-size: 1.1rem;
  }

  .brand-mark {
    width: 30px;
    height: 30px;
  }

  .quick-search {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .header-tools {
    margin-left: auto;
  }

  .primary-nav {
    margin-left: 0;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--porcelain);
    border-bottom: 4px solid var(--crimson);
    box-shadow: var(--shadow-lift);
    padding: 1.2rem 1.5rem 1.6rem;
    display: block;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
  }

  .primary-nav[data-open="true"] {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-list {
    flex-direction: column;
    gap: 0.25rem;
  }

  .nav-item > a {
    display: block;
    padding: 0.75rem 0.25rem;
    font-size: 1rem;
    border-bottom: 1px solid var(--stone);
  }

  .nav-item > a[aria-current="page"] {
    background: none;
    border-bottom-color: var(--gold);
  }

  .site-footer {
    padding: 2.8rem 1.2rem 1.4rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-bottom {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 600px) {
  .data-grid--2,
  .data-grid--3,
  .data-grid--4 {
    grid-template-columns: 1fr;
  }

  .bento .bento-main,
  .bento .bento-side,
  .bento .bento-fill {
    grid-column: span 12;
  }

  .container {
    padding: 0 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

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