:root {
  --color-primary: #a8000f;
  --color-primary-dark: #7f0b14;
  --color-primary-muted: #991d27;
  --color-bg: #f9f7f3;
  --color-white: #ffffff;
  --color-surface-dark: #484848;
  --color-surface-tint: #f1eae0;
  --color-border-light: #e2d7c2;
  --color-beige: #cfc7bc;
  --color-text: #3a3a3a;
  --color-text-dark: #000000;
  --color-text-inverse: #f9f7f3;
  --color-text-muted: #a09050;
  --font-display: "STKaiti", "Kaiti SC", "KaiTi", "BiauKai", "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius-xxs: 4px;
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-full: 50px;
  --shadow-card: rgba(0, 0, 0, 0.15) -4px 4px 4px 0;
  --shadow-card-hover: rgba(0, 0, 0, 0.25) -6px 6px 6px 0;
  --ease: cubic-bezier(0.33, 1, 0.68, 1);
  --side-space: 60px;
  --max-width: 1200px;
}

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
}

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

a { color: var(--color-text); text-decoration: underline; text-decoration-color: var(--color-beige); transition: color 0.2s ease-out, text-decoration-color 0.2s ease-out; }
a:hover { color: var(--color-primary); text-decoration-color: var(--color-primary); }

h1, h2 { font-family: var(--font-display); font-weight: 400; line-height: 1.2; margin: 0 0 16px; color: var(--color-text-dark); }
h1 { font-size: 42px; }
h2 { font-size: 32px; }
h3 { font-size: 24px; font-weight: 500; line-height: 1.3; margin: 0 0 12px; }
h4 { font-size: 18px; font-weight: 500; line-height: 1.3; margin: 0 0 8px; }
p { margin: 0 0 16px; }
ul, ol { margin: 0 0 16px; padding-left: 24px; }
li { margin-bottom: 8px; }
small, .small { font-size: 14px; }
.caption { font-size: 12px; color: var(--color-text-muted); }
code { font-family: var(--font-mono); font-size: 14px; background: var(--color-surface-tint); padding: 2px 6px; border-radius: var(--radius-xxs); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 var(--side-space); }

.skip-link { position: absolute; left: -9999px; top: 8px; background: var(--color-primary); color: var(--color-text-inverse); padding: 8px 16px; border-radius: var(--radius-xxs); z-index: 8000; }
.skip-link:focus { left: 8px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 5000;
  background: var(--color-surface-dark);
  color: var(--color-text-inverse);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 24px; }
.logo {
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--color-text-inverse);
  text-decoration: none;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.logo:hover { color: var(--color-text-inverse); opacity: 0.85; }
.logo::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 0 3px rgba(168, 0, 15, 0.3); }
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  color: var(--color-text-inverse);
  text-decoration: none;
  padding: 8px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-xxs);
  transition: opacity 0.4s;
}
.site-nav a:hover { opacity: 0.6; color: var(--color-text-inverse); }
.site-nav a[aria-current="page"] { color: #ffb3b8; font-weight: 500; }
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid rgba(249, 247, 243, 0.4);
  border-radius: var(--radius-xxs);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
}
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--color-text-inverse); transition: transform 0.3s var(--ease), opacity 0.3s; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sections */
.section { padding: 56px 0; }
.section-alt { background: var(--color-surface-tint); }
.container.section { padding-left: var(--side-space); padding-right: var(--side-space); }
.section-head { max-width: 760px; margin-bottom: 32px; }
.section-head p { color: var(--color-text); }
.eyebrow { display: inline-block; font-size: 12px; letter-spacing: 2px; color: var(--color-primary); text-transform: uppercase; margin-bottom: 8px; }

/* Hero */
.hero { padding: 64px 0 48px; background: linear-gradient(180deg, var(--color-white) 0%, var(--color-bg) 100%); border-bottom: 1px solid var(--color-border-light); }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; }
.hero h1 { margin-bottom: 20px; }
.hero h1 em { font-style: normal; color: var(--color-primary); }
.hero-lead { font-size: 18px; max-width: 640px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 24px; padding: 0; list-style: none; font-size: 14px; }
.hero-meta li { margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.hero-meta li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-primary); }
.hero-panel {
  background: var(--color-surface-dark);
  color: var(--color-text-inverse);
  border-radius: var(--radius-sm);
  padding: 24px;
  box-shadow: var(--shadow-card);
}
.hero-panel h2 { color: var(--color-text-inverse); font-size: 24px; margin-bottom: 12px; }
.hero-panel ol { margin: 0; padding-left: 20px; }
.hero-panel li { margin-bottom: 12px; }
.hero-panel li:last-child { margin-bottom: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 24px;
  font-size: 16px;
  font-family: var(--font-body);
  text-decoration: none;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease), opacity 0.3s var(--ease), transform 0.3s var(--ease);
}
.btn-primary { background: var(--color-primary); color: var(--color-text-inverse); }
.btn-primary:hover { background: var(--color-primary-dark); color: var(--color-text-inverse); opacity: 0.92; }
.btn-primary:active { opacity: 0.8; }
.btn-ghost { background: transparent; color: var(--color-text); border-color: var(--color-text); }
.btn-ghost:hover { background: var(--color-text); color: var(--color-text-inverse); }
.btn-dark { background: var(--color-surface-dark); color: var(--color-text-inverse); border-radius: var(--radius-sm); }
.btn-dark:hover { background: var(--color-text-dark); color: var(--color-text-inverse); transform: translateY(-2px); }
.btn-sm { min-height: 40px; padding: 8px 16px; font-size: 14px; }

/* Notice */
.notice { background: var(--color-white); border: 1px solid var(--color-border-light); border-left: 4px solid var(--color-primary); border-radius: var(--radius-xs); padding: 16px 20px; display: flex; gap: 16px; align-items: flex-start; }
.notice strong { color: var(--color-primary); white-space: nowrap; }
.notice p { margin: 0; }

/* Cards */
.card {
  background: var(--color-bg);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-card);
  padding: 24px;
  transition: box-shadow 0.5s var(--ease);
}
.card:hover { box-shadow: var(--shadow-card-hover); }
.card-white { background: var(--color-white); }
.card h3 { margin-bottom: 8px; }
.card p:last-child { margin-bottom: 0; }
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Mirror list */
.mirror-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 24px; padding: 0; list-style: none; font-size: 14px; }
.mirror-legend li { margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.mirror-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; list-style: none; padding: 0; margin: 0; }
.mirror-list li { margin: 0; }
.mirror-card {
  background: var(--color-white);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-card);
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  transition: box-shadow 0.5s var(--ease), transform 0.5s var(--ease);
}
.mirror-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.mirror-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mirror-index { font-family: var(--font-display); font-size: 24px; color: var(--color-primary); line-height: 1; }
.mirror-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.tag { font-size: 12px; padding: 4px 8px; border-radius: var(--radius-xxs); background: var(--color-surface-tint); color: var(--color-text); }
.tag-red { background: var(--color-primary); color: var(--color-text-inverse); }
.tag-dark { background: var(--color-surface-dark); color: var(--color-text-inverse); }
.mirror-host { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: var(--color-text-dark); word-break: break-all; }
.mirror-url { font-family: var(--font-mono); font-size: 13px; color: var(--color-text-muted); word-break: break-all; }
.mirror-note { font-size: 14px; margin: 0; color: var(--color-text); flex: 1; }
.mirror-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; border-top: 1px solid var(--color-border-light); }
.mirror-actions .caption { margin: 0; }
.no-copy, .no-copy * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.steps li { margin: 0; counter-increment: step; background: var(--color-white); border-radius: var(--radius-xs); padding: 24px; box-shadow: var(--shadow-card); position: relative; }
.steps li::before { content: counter(step, decimal-leading-zero); font-family: var(--font-display); font-size: 32px; color: var(--color-primary); display: block; margin-bottom: 8px; }
.steps h3 { font-size: 20px; }
.steps p { margin: 0; font-size: 14px; }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.checklist li { margin: 0; background: var(--color-white); border-radius: var(--radius-xs); padding: 16px 20px 16px 48px; position: relative; border: 1px solid var(--color-border-light); }
.checklist li::before { content: ""; position: absolute; left: 18px; top: 22px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--color-primary); }
.checklist strong { display: block; margin-bottom: 4px; }
.checklist p { margin: 0; font-size: 14px; }

/* Glossary */
.glossary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0; }
.glossary div { background: var(--color-bg); border-radius: var(--radius-xs); padding: 16px 20px; border: 1px solid var(--color-border-light); }
.glossary dt { font-weight: 500; color: var(--color-text-dark); margin-bottom: 4px; }
.glossary dt span { font-family: var(--font-mono); font-size: 13px; color: var(--color-text-muted); margin-left: 8px; }
.glossary dd { margin: 0; font-size: 14px; }

/* Accordion */
.faq-list { width: 100%; }
.faq-list details { background: var(--color-white); border: 1px solid var(--color-border-light); border-radius: var(--radius-xs); margin-bottom: 12px; overflow: hidden; }
.faq-list summary { cursor: pointer; padding: 16px 20px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 44px; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; font-size: 20px; color: var(--color-primary); flex-shrink: 0; transition: transform 0.3s var(--ease); }
.faq-list details[open] summary::after { transform: rotate(45deg); }
.faq-list details > div { padding: 0 20px 16px; font-size: 15px; }
.faq-list details > div p:last-child { margin-bottom: 0; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--color-border-light); }
.timeline li { margin: 0 0 20px; padding-left: 24px; position: relative; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--color-primary); }
.timeline time { display: block; font-size: 13px; color: var(--color-text-muted); margin-bottom: 4px; }
.timeline p { margin: 0; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--color-white); border-radius: var(--radius-xs); overflow: hidden; font-size: 15px; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--color-border-light); text-align: left; vertical-align: top; }
th { background: var(--color-surface-tint); font-weight: 500; }
tr:last-child td { border-bottom: none; }

/* Inner page */
.page-head { padding: 40px 0 24px; background: var(--color-white); border-bottom: 1px solid var(--color-border-light); }
.breadcrumb { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.breadcrumb li { margin: 0; display: inline-flex; align-items: center; gap: 8px; }
.breadcrumb li + li::before { content: "/"; color: var(--color-beige); }
.page-head h1 { margin-bottom: 8px; }
.page-meta { font-size: 14px; color: var(--color-text-muted); margin: 0; }
.article { width: 100%; }
.article h2 { font-size: 28px; margin-top: 40px; }
.article h2:first-child { margin-top: 0; }
.article h3 { font-size: 20px; margin-top: 28px; }
.article .callout { background: var(--color-surface-tint); border-radius: var(--radius-xs); padding: 16px 20px; margin: 20px 0; }
.article .callout p:last-child { margin-bottom: 0; }
.article-nav { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--color-border-light); display: flex; flex-wrap: wrap; gap: 12px; }

/* Go page */
.go-wrap { min-height: 60vh; display: flex; align-items: center; padding: 48px 0; }
.go-card { max-width: 560px; margin: 0 auto; background: var(--color-white); border-radius: var(--radius-sm); box-shadow: var(--shadow-card); padding: 32px; text-align: center; }
.go-card h1 { font-size: 32px; margin-bottom: 8px; }
.go-card .go-host { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--color-primary); background: var(--color-surface-tint); padding: 12px 16px; border-radius: var(--radius-xs); margin: 20px 0; word-break: break-all; }
.go-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 24px 0 16px; }
.go-tips { text-align: left; font-size: 14px; margin: 0; padding-left: 20px; }
.go-tips li { margin-bottom: 4px; }
.go-invalid { display: none; }
.no-js .go-invalid { display: block; }
.no-js .go-valid { display: none; }
#allowlist { margin: 16px 0 0; padding: 0; list-style: none; text-align: left; font-size: 14px; columns: 2; }
#allowlist li { margin: 0 0 4px; break-inside: avoid; }

/* Footer */
.site-footer { background: var(--color-surface-dark); color: var(--color-text-inverse); margin-top: 56px; }
.site-footer a { color: var(--color-text-inverse); text-decoration: none; opacity: 0.85; }
.site-footer a:hover { opacity: 1; color: var(--color-text-inverse); text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.5fr; gap: 32px; padding-top: 48px; padding-bottom: 32px; }
.footer-logo { font-family: var(--font-display); font-size: 26px; margin-bottom: 12px; }
.site-footer h3 { font-size: 16px; font-weight: 500; margin-bottom: 12px; color: var(--color-text-inverse); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 8px; }
.site-footer p { font-size: 14px; opacity: 0.85; }
.footer-bottom { border-top: 1px solid rgba(249, 247, 243, 0.15); padding-top: 20px; padding-bottom: 24px; font-size: 13px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.footer-bottom p { margin: 0; }
#ad-slot:empty { display: none; }
#ad-slot { padding: 16px var(--side-space); background: var(--color-text-dark); text-align: center; }

.to-top { position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px; border-radius: 50%; background: var(--color-primary); color: var(--color-text-inverse); border: none; cursor: pointer; box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); opacity: 0; visibility: hidden; transition: opacity 0.3s ease-out, visibility 0.3s; z-index: 10; font-size: 18px; }
.to-top.is-visible { opacity: 1; visibility: visible; }

/* Responsive */
@media (max-width: 1023px) {
  :root { --side-space: 24px; }
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-surface-dark);
    padding: 8px var(--side-space) 16px;
    gap: 0;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0.3s;
    z-index: 7000;
  }
  .site-nav.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .site-nav a { padding: 12px 0; border-bottom: 1px solid rgba(249, 247, 243, 0.1); }
  .hero-grid { grid-template-columns: 1fr; }
  .grid-3, .grid-4, .mirror-list, .glossary { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 767px) {
  :root { --side-space: 16px; }
  h1 { font-size: 32px; }
  h2 { font-size: 26px; }
  h3 { font-size: 20px; }
  .hero { padding: 40px 0 32px; }
  .hero-lead { font-size: 16px; }
  .section { padding: 40px 0; }
  .grid-2, .grid-3, .grid-4, .mirror-list, .glossary, .steps, .checklist { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .notice { flex-direction: column; gap: 4px; }
  .go-card { padding: 24px 20px; }
  #allowlist { columns: 1; }
  .article h2 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
