:root {
  color-scheme: dark;
  --black: #080806;
  --black-soft: #11100c;
  --gold: #d6a846;
  --gold-bright: #f2cf78;
  --gold-pale: #f7e5b0;
  --line: rgba(214, 168, 70, 0.27);
  --text: #f3ead4;
  --muted: #bcae91;
  --dim: #81786a;
  --red: #8f3428;
  --green: #88b99d;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
}

body:not(.is-localized) .guide-shell {
  opacity: 0;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 55% -10%, rgba(148, 98, 26, 0.24), transparent 40%),
    linear-gradient(145deg, #16130d 0%, #060606 56%, #100d08 100%);
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
}

button,
a,
input { font: inherit; }

button { color: inherit; }

.page-atmosphere {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.52;
  background-image:
    linear-gradient(90deg, transparent 49.8%, rgba(225, 182, 84, 0.035) 50%, transparent 50.2%),
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.012) 3px 4px);
}

.guide-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1640px, calc(100vw - 34px));
  height: calc(100dvh - 34px);
  margin: 17px auto;
  overflow: hidden;
  border: 1px solid var(--gold);
  background:
    linear-gradient(115deg, rgba(214, 168, 70, 0.055), transparent 28%),
    var(--black);
  box-shadow:
    0 0 0 4px #211707,
    0 0 0 5px rgba(226, 182, 78, 0.72),
    0 24px 80px rgba(0, 0, 0, 0.62),
    inset 0 0 70px rgba(0, 0, 0, 0.78);
}

.guide-shell::before,
.guide-shell::after {
  content: "";
  position: absolute;
  z-index: 4;
  left: 34px;
  right: 34px;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.guide-shell::before { top: 8px; }
.guide-shell::after { bottom: 8px; }

.corner {
  position: absolute;
  z-index: 6;
  width: 34px;
  height: 34px;
  pointer-events: none;
}

.corner::before,
.corner::after {
  content: "";
  position: absolute;
  background: var(--gold-bright);
  box-shadow: 0 0 8px rgba(214, 168, 70, 0.22);
}

.corner::before { width: 28px; height: 2px; }
.corner::after { width: 2px; height: 28px; }
.corner-nw { top: 8px; left: 8px; }
.corner-ne { top: 8px; right: 8px; transform: rotate(90deg); }
.corner-se { right: 8px; bottom: 8px; transform: rotate(180deg); }
.corner-sw { left: 8px; bottom: 8px; transform: rotate(270deg); }

.guide-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 96px;
  padding: 18px 34px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(103, 64, 15, 0.17), transparent 42%);
}

.guide-heading,
.header-meta,
.scope-pill,
.guide-footer {
  display: flex;
  align-items: center;
}

.guide-heading { gap: 15px; }

.guide-heading p,
.index-heading p,
.entry-kicker,
.search-box label {
  margin: 0;
  color: var(--gold);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.guide-heading h1 {
  margin: 2px 0 0;
  color: var(--gold-pale);
  font-family: STKaiti, KaiTi, "Microsoft YaHei", serif;
  font-size: clamp(28px, 2vw, 38px);
  letter-spacing: 0.12em;
  line-height: 1;
}

.seal {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--gold-pale);
  border: 1px solid var(--gold);
  background: #641d18;
  font-family: STKaiti, KaiTi, serif;
  font-size: 26px;
  font-weight: 900;
  transform: rotate(-2deg);
}

.header-meta {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.scope-pill,
.version-pill,
.community-link,
.close-link {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.scope-pill { gap: 8px; }

.scope-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(136, 185, 157, 0.75);
}

.community-link,
.close-link {
  color: var(--text);
  transition: 150ms ease;
}

.community-link:hover,
.community-link:focus-visible,
.close-link:hover,
.close-link:focus-visible {
  color: var(--gold-pale);
  border-color: var(--gold);
  background: rgba(214, 168, 70, 0.09);
}

.guide-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.05fr) minmax(540px, 3fr);
  min-height: 0;
}

.category-panel,
.entry-index,
.entry-view {
  min-width: 0;
  min-height: 0;
}

.category-panel {
  display: flex;
  flex-direction: column;
  padding: 21px 16px 18px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.search-box {
  padding: 0 6px 15px;
  border-bottom: 1px solid var(--line);
}

.search-box label {
  display: block;
  margin-bottom: 9px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(214, 168, 70, 0.32);
  background: rgba(0, 0, 0, 0.42);
}

.search-field span { color: var(--gold); font-size: 19px; }

.search-field input {
  width: 100%;
  height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.search-field input::placeholder { color: var(--dim); }

.category-nav {
  display: grid;
  gap: 4px;
  margin: 14px 0;
  overflow: auto;
  scrollbar-color: rgba(214, 168, 70, 0.36) transparent;
  scrollbar-width: thin;
}

.category-button {
  position: relative;
  display: grid;
  grid-template-columns: 27px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: 150ms ease;
}

.category-icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  color: var(--gold);
  border: 1px solid rgba(214, 168, 70, 0.35);
  font-family: STKaiti, KaiTi, serif;
}

.category-copy { font-size: 13px; }
.category-button small { color: var(--dim); font-size: 10px; }

.category-button:hover,
.category-button:focus-visible {
  color: var(--text);
  border-color: rgba(214, 168, 70, 0.25);
  background: rgba(214, 168, 70, 0.055);
}

.category-button.is-active {
  color: var(--gold-pale);
  border-color: rgba(214, 168, 70, 0.48);
  background: linear-gradient(90deg, rgba(139, 83, 18, 0.23), rgba(214, 168, 70, 0.035));
}

.category-button.is-active::before {
  content: "";
  position: absolute;
  left: -1px;
  width: 3px;
  height: 72%;
  background: var(--gold-bright);
}

.manual-note {
  padding: 12px;
  border-top: 1px solid var(--line);
  color: var(--dim);
}

.manual-note strong { color: var(--gold); font-size: 11px; }
.manual-note p { margin: 5px 0 0; font-size: 11px; line-height: 1.65; }

.entry-index {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.012);
}

.index-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 76px;
  padding: 17px 19px 14px;
  border-bottom: 1px solid var(--line);
}

.index-heading h2 {
  margin: 3px 0 0;
  color: var(--gold-pale);
  font-family: STKaiti, KaiTi, serif;
  font-size: 21px;
}

.index-heading > span { color: var(--dim); font-size: 11px; }

.entry-list {
  overflow: auto;
  scrollbar-color: rgba(214, 168, 70, 0.4) transparent;
  scrollbar-width: thin;
}

.entry-card {
  display: grid;
  grid-template-columns: 31px 1fr;
  gap: 11px;
  width: 100%;
  padding: 14px 17px;
  border: 0;
  border-bottom: 1px solid rgba(214, 168, 70, 0.14);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: 150ms ease;
}

.entry-card:hover,
.entry-card:focus-visible { background: rgba(214, 168, 70, 0.055); }

.entry-card.is-active {
  background: linear-gradient(90deg, rgba(117, 63, 14, 0.28), rgba(214, 168, 70, 0.04));
  box-shadow: inset 3px 0 var(--gold-bright);
}

.entry-mark {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--gold);
  border: 1px solid rgba(214, 168, 70, 0.38);
  font-family: STKaiti, KaiTi, serif;
}

.entry-card-copy { display: grid; gap: 4px; }
.entry-card strong { color: var(--text); font-size: 13px; }
.entry-card small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.entry-view {
  padding: 27px 34px 42px;
  overflow: auto;
  scrollbar-color: rgba(214, 168, 70, 0.42) transparent;
  scrollbar-width: thin;
}

.entry-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.entry-kicker { margin-bottom: 7px; }

.entry-title-row h2 {
  margin: 0;
  color: var(--gold-pale);
  font-family: STKaiti, KaiTi, "Microsoft YaHei", serif;
  font-size: clamp(27px, 2.2vw, 40px);
  line-height: 1.2;
}

.entry-seal {
  display: grid;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  place-items: center;
  color: #f9dca0;
  border: 1px solid #b96f50;
  background: #6f2119;
  font-family: STKaiti, KaiTi, serif;
  font-size: 20px;
  transform: rotate(2deg);
}

.entry-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 17px 0 0;
}

.entry-tags span {
  padding: 4px 8px;
  color: var(--muted);
  border: 1px solid rgba(214, 168, 70, 0.2);
  font-size: 10px;
}

.entry-lead {
  margin: 22px 0 25px;
  padding: 17px 19px;
  color: #dfcfad;
  border-left: 3px solid var(--gold);
  background: linear-gradient(90deg, rgba(214, 168, 70, 0.095), transparent 78%);
  font-size: 14px;
  line-height: 1.9;
}

.guide-media {
  margin: 0 0 27px;
  border: 1px solid rgba(214, 168, 70, 0.35);
  background: #050504;
}

.media-button {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: #050504;
  cursor: zoom-in;
}

.media-button img {
  display: block;
  width: 100%;
  max-height: 430px;
  object-fit: contain;
  transition: transform 220ms ease, filter 220ms ease;
}

.media-button:hover img { transform: scale(1.012); filter: brightness(1.06); }

.media-zoom {
  position: absolute;
  right: 12px;
  bottom: 10px;
  padding: 6px 9px;
  color: var(--gold-pale);
  border: 1px solid rgba(214, 168, 70, 0.65);
  background: rgba(5, 5, 4, 0.88);
  font-size: 10px;
}

.guide-media figcaption {
  padding: 10px 13px;
  color: var(--muted);
  border-top: 1px solid rgba(214, 168, 70, 0.24);
  font-size: 11px;
  line-height: 1.6;
}

.guide-section {
  margin-top: 27px;
  padding-top: 23px;
  border-top: 1px solid rgba(214, 168, 70, 0.2);
}

.guide-section h3,
.related-section h3 {
  margin: 0 0 12px;
  color: var(--gold-bright);
  font-family: STKaiti, KaiTi, serif;
  font-size: 21px;
}

.guide-section > p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.85;
}

.detail-list { display: grid; gap: 9px; margin-top: 13px; }

.detail-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.23fr) minmax(0, 1fr);
  gap: 15px;
  padding: 12px 14px;
  border: 1px solid rgba(214, 168, 70, 0.12);
  background: rgba(255, 255, 255, 0.018);
}

.detail-row strong { color: #ebca84; font-size: 12px; }
.detail-row p { margin: 0; color: #d4c6a8; font-size: 12px; line-height: 1.75; }

.related-section {
  margin-top: 30px;
  padding: 20px;
  border: 1px solid rgba(214, 168, 70, 0.22);
  background: rgba(214, 168, 70, 0.035);
}

.related-links { display: flex; flex-wrap: wrap; gap: 8px; }

.related-links button {
  padding: 7px 10px;
  color: var(--muted);
  border: 1px solid rgba(214, 168, 70, 0.3);
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.related-links button:hover,
.related-links button:focus-visible { color: var(--gold-pale); border-color: var(--gold); }

.guide-footer {
  justify-content: flex-end;
  gap: 20px;
  min-height: 42px;
  padding: 8px 34px;
  color: var(--dim);
  border-top: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.42);
  font-size: 10px;
}

.guide-footer button {
  padding: 5px 10px;
  border: 1px solid rgba(214, 168, 70, 0.25);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.guide-footer button:hover,
.guide-footer button:focus-visible { color: var(--gold-pale); border-color: var(--gold); }

.loading-state,
.error-state,
.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 220px;
  color: var(--dim);
  text-align: center;
}

.loading-state span,
.error-state > span {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 12px;
  color: var(--gold);
  border: 1px solid var(--line);
  font-family: STKaiti, KaiTi, serif;
  font-size: 24px;
}

.empty-state strong,
.error-state strong { color: var(--gold-pale); }
.empty-state p,
.error-state p { margin: 7px 0; font-size: 12px; }

.image-dialog {
  width: min(94vw, 1500px);
  max-width: none;
  padding: 12px;
  border: 1px solid var(--gold);
  background: #060605;
  color: var(--text);
  box-shadow: 0 25px 100px rgba(0, 0, 0, 0.85);
}

.image-dialog::backdrop { background: rgba(0, 0, 0, 0.84); }

.image-dialog img {
  display: block;
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
}

.image-dialog p { margin: 10px 42px 2px 4px; color: var(--muted); font-size: 12px; }

.dialog-close {
  position: absolute;
  z-index: 2;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--gold);
  background: rgba(5, 5, 4, 0.88);
  color: var(--gold-pale);
  font-size: 22px;
  cursor: pointer;
}

body.is-embedded .guide-shell {
  width: calc(100vw - 22px);
  height: calc(100dvh - 22px);
  margin: 11px auto;
}

@media (max-width: 1100px) {
  .guide-layout { grid-template-columns: 205px 250px minmax(480px, 1fr); }
  .guide-header { padding-inline: 24px; }
}

@media (max-width: 840px) {
  body { overflow: auto; }
  .guide-shell { height: auto; min-height: 100dvh; margin: 0 auto; }
  .guide-header { align-items: flex-start; flex-direction: column; }
  .header-meta { justify-content: flex-start; }
  .guide-layout { display: block; }
  .category-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .category-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 300px; }
  .manual-note { display: none; }
  .entry-index { max-height: 340px; border-right: 0; border-bottom: 1px solid var(--line); }
  .entry-view { min-height: 650px; }
}

@media (max-width: 580px) {
  .guide-shell { width: 100%; border-inline: 0; }
  .guide-header,
  .entry-view { padding-inline: 19px; }
  .category-nav { grid-template-columns: 1fr 1fr; }
  .detail-row { grid-template-columns: 1fr; gap: 5px; }
  .entry-title-row { gap: 12px; }
  .entry-seal { width: 46px; height: 46px; font-size: 16px; }
}
