:root {
  color-scheme: dark;
  --ink: #10191d;
  --panel: #172226;
  --cream: #f5ede0;
  --muted: #d2c9b9;
  --gold: #ebc682;
  --line: #806b49;
  --serif: "Noto Serif SC", "Songti SC", SimSun, serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; background: var(--ink); color: var(--cream); font: 16px/1.65 var(--sans); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
svg { width: 1em; height: 1em; flex: none; }
h1, h2, h3, p, ul { margin: 0; }
h1, h2, h3 { font-family: var(--serif); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #ffdf9d; outline-offset: 4px; }
.wrap { width: min(1210px, calc(100% - 80px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; z-index: 3; top: 12px; left: 12px; background: var(--ink); padding: 8px 16px; transform: translateY(-170%); }
.skip:focus { transform: none; }

.header { background: #10171a; border-bottom: 1px solid #534737; }
.header-inner, .footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 15px; padding-block: 8px; font: 700 24px/1.1 var(--serif); white-space: nowrap; }
.brand svg { color: var(--gold); width: 43px; height: 43px; }
.brand span { border-left: 1px solid var(--line); padding-left: 15px; }
.brand small { display: block; color: var(--gold); font-size: 13px; letter-spacing: .22em; margin-top: 4px; }
.header nav { display: flex; align-items: stretch; gap: clamp(22px, 4.5vw, 66px); align-self: stretch; font: 700 18px/1.3 var(--serif); }
.header nav a { position: relative; display: grid; align-items: center; padding-inline: 6px; }
.header nav a:hover, .header nav a[aria-current] { color: var(--gold); }
.header nav a[aria-current]::after { content: ''; position: absolute; inset: auto 0 5px; height: 2px; background: var(--gold); }

.hero { min-height: 437px; display: grid; align-items: center; border-bottom: 1px solid #65563f; background: linear-gradient(90deg, #10171af0 0%, #10171ace 25%, transparent 60%), url('citadel.jpg') center 29% / cover #141e22; }
.hero-content { padding-block: 40px 45px; }
.hero h1 { font-size: clamp(50px, 5.3vw, 76px); line-height: 1.08; letter-spacing: .045em; }
.hero h1 em { color: var(--gold); font-style: normal; }
.ornament { width: min(355px, 87%); height: 10px; margin: 18px 0 10px; display: flex; align-items: center; }
.ornament::before, .ornament::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--line)); }
.ornament::after { transform: scaleX(-1); }
.ornament i { width: 7px; height: 7px; border: 1px solid var(--gold); transform: rotate(45deg); margin: 0 4px; }
.hero p { max-width: 410px; color: var(--cream); font-size: 17px; line-height: 1.75; }
.actions { display: flex; flex-wrap: wrap; gap: 13px 22px; margin-top: 24px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 8px 22px; border: 1px solid var(--gold); border-radius: 5px; font: 700 18px/1.3 var(--serif); }
.button.gold { background: linear-gradient(125deg, #e9bd73, #f4d69c); color: #18130d; }
.button.outline { background: #11191bdc; color: var(--gold); }
.button:hover { box-shadow: 0 0 0 2px #ebc68260; }

.directory { padding: 17px 0 38px; background: linear-gradient(180deg, var(--ink) 6%, #10191df2 46%, #10191de6), url('citadel.jpg') center bottom / cover var(--ink); }
.section-title { display: flex; align-items: center; justify-content: center; gap: 20px; color: #f2d6a4; font-size: clamp(27px, 3vw, 37px); }
.section-title::before, .section-title::after { content: ''; width: clamp(28px, 8vw, 100px); height: 1px; background: linear-gradient(90deg, transparent, var(--line)); }
.section-title::after { transform: scaleX(-1); }
.filterbar { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 9px 0 21px; }
.filters { display: flex; flex: 1; gap: clamp(5px, 2vw, 20px); border-bottom: 1px solid #62563f; padding-bottom: 6px; }
.filters button { border: 1px solid transparent; border-radius: 5px; padding: 6px clamp(9px, 3vw, 29px); background: transparent; color: var(--cream); }
.filters button:hover { border-color: var(--line); }
.filters button[aria-pressed="true"] { background: var(--gold); color: #18130d; }
.search { display: flex; align-items: center; gap: 11px; width: min(100%, 355px); min-height: 41px; border: 1px solid #8b806a; border-radius: 6px; background: #162126; color: var(--cream); padding-inline: 13px; }
.search:focus-within { border-color: var(--gold); }
.search input { width: 100%; min-width: 0; background: transparent; color: var(--cream); border: 0; padding: 6px 0; }
.search input::placeholder { color: #c6bfaf; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 19px 22px; padding: 0; margin-top: 18px; list-style: none; }
.card { position: relative; min-width: 0; display: flex; background: linear-gradient(140deg, #1b282c, #141e22 70%); border: 1px solid var(--line); border-radius: 8px; }
.card::before, .card::after { content: ''; position: absolute; inset: 4px auto auto 4px; width: 10px; height: 10px; border: solid #b39a6b; border-width: 1px 0 0 1px; border-radius: 3px 0 0; pointer-events: none; }
.card::after { inset: auto 4px 4px auto; transform: rotate(180deg); }
.card a { display: grid; align-content: start; justify-items: center; text-align: center; width: 100%; min-height: 167px; padding: 16px 21px 19px; border-radius: inherit; }
.card:hover, .card:focus-within { border-color: var(--gold); background: #213035; }
.card svg { width: 38px; height: 38px; color: var(--gold); }
.card h3 { color: #f2d6a4; font-size: 24px; line-height: 1.35; margin: 5px 0 4px; }
.card h3::after { content: ''; height: 1px; display: block; background: linear-gradient(90deg, transparent, var(--line), transparent); margin-top: 4px; }
.card p { max-width: 290px; font-size: 14px; color: var(--muted); }
.empty { text-align: center; padding: 35px 15px; background: var(--panel); border: 1px solid var(--line); }
.empty button { margin-left: 10px; background: none; border: 0; color: var(--gold); text-decoration: underline; }
.version-note { color: var(--muted); font-size: 14px; margin-top: 25px; }
.footer { border-top: 1px solid #534737; background: #10171a; font-size: 13px; color: var(--muted); }
.footer-inner { padding-block: 19px; }
.footer a:hover { color: var(--gold); text-decoration: underline; }

.article-hero { padding: 28px 0 36px; background: linear-gradient(90deg, #10191df5, #10191d80), url('citadel.jpg') center 34% / cover; border-bottom: 1px solid #534737; }
.breadcrumbs { display: flex; gap: 12px; color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.breadcrumbs a { color: var(--gold); }
.article-hero h1 { font-size: clamp(31px, 4.4vw, 53px); line-height: 1.23; max-width: 930px; }
.article-hero p { margin-top: 12px; color: var(--muted); }
.reading { display: grid; grid-template-columns: minmax(190px, 255px) minmax(0, 880px); gap: clamp(24px, 4vw, 55px); padding-block: 34px 52px; }
.toc { position: sticky; top: 20px; padding: 19px; background: var(--panel); border: 1px solid #605039; border-radius: 6px; }
.toc h2 { color: var(--gold); font-size: 19px; margin-bottom: 8px; }
.toc ul, .related ul { list-style: none; padding: 0; }
.toc a { display: block; padding-block: 4px; font-size: 15px; }
.toc a:hover, .breadcrumbs a:hover { text-decoration: underline; color: var(--gold); }
.prose section + section { margin-top: 14px; }
.prose section { border: 1px solid #605039; border-radius: 6px; padding: 14px clamp(13px, 2vw, 22px) 16px; background: #152025; }
.prose h2 { color: var(--gold); font-size: 24px; line-height: 1.35; margin-bottom: 10px; }
.prose p { line-height: 1.88; }
.references a { color: var(--gold); text-decoration: underline; text-underline-offset: 4px; }
.checklist { margin-top: 14px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
.checklist fieldset { border: 0; margin: 0; padding: 0; }
.checklist label { display: flex; align-items: center; gap: 10px; min-height: 37px; cursor: pointer; }
.checklist input { accent-color: var(--gold); width: 17px; height: 17px; flex: none; }
.progress { color: var(--muted); font-size: 14px; }
.related { margin-top: 25px; }
.related ul { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.related a { display: flex; justify-content: space-between; align-items: center; padding: 10px 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; }
.related a:hover { color: var(--gold); }

@media (max-width: 850px) {
  .wrap { width: calc(100% - 44px); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .header nav { gap: 15px; font-size: 16px; }
  .filterbar { gap: 12px; }
  .search { width: min(42%, 355px); }
}

@media (max-width: 620px) {
  .wrap { width: calc(100% - 32px); }
  .header-inner { display: block; }
  .brand { width: fit-content; }
  .header nav { gap: 3px; justify-content: space-between; }
  .header nav a { min-height: 42px; }
  .header nav a[aria-current]::after { bottom: 0; }
  .hero { min-height: 355px; background-position: 59% center; }
  .hero h1 { font-size: clamp(41px, 11vw, 58px); }
  .hero p { font-size: 15px; max-width: 300px; }
  .hero-content { padding-block: 31px; }
  .actions { gap: 10px; }
  .button { padding-inline: 14px; min-height: 44px; font-size: 16px; }
  .filterbar { flex-direction: column; align-items: stretch; }
  .filters { justify-content: space-around; }
  .filters button { min-height: 42px; }
  .search { width: 100%; }
  .grid { gap: 11px; }
  .card a { padding: 12px 10px; min-height: 160px; }
  .card h3 { font-size: 21px; }
  .card p { font-size: 13px; }
  .footer-inner { flex-wrap: wrap; gap: 5px 15px; }
  .reading { display: block; padding-top: 20px; }
  .toc { position: static; margin-bottom: 24px; }
}
