:root {
  --dsp-red: #d01818;
  --dsp-blue: #1242a3;
  --ink: #202124;
  --muted: #5c6670;
  --line: #d6dbe0;
  --wash: #f4f6f8;
  --soft-blue: #eaf0fa;
  --serif: "Noto Serif SC", "STZhongsong", "华文中宋", "Songti SC", serif;
  --sans: "Microsoft YaHei", "Noto Sans SC", Arial, sans-serif;
  --page-width: 1240px;
}

* { box-sizing: border-box; }
html { background: #fff; color: var(--ink); font-family: var(--sans); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button, select, a { -webkit-tap-highlight-color: transparent; }
a { color: #174e91; text-decoration: underline; text-underline-offset: .18em; }
a:hover { color: var(--dsp-red); }
.wrap { width: min(var(--page-width), calc(100% - 48px)); margin-inline: auto; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: #fff; }
.skip-link:focus { top: 10px; }

.site-header { background: #f8f9fa; border-bottom: 1px solid #cfd4da; }
.masthead { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-block: 16px; }
.brand { display: inline-flex; align-items: center; gap: 18px; color: var(--ink); text-decoration: none; min-width: 0; }
.brand-flag { width: 74px; height: 48px; object-fit: cover; border: 1px solid #757575; background: #fff; flex: 0 0 auto; }
.brand-copy { display: grid; grid-template-columns: max-content max-content; align-items: baseline; gap: 7px 16px; font-family: var(--serif); line-height: 1.05; }
.brand-country, .brand-government { display: contents; }
.brand-country b { font-size: 27px; font-weight: 600; }
.brand-government b { font-size: 19px; font-weight: 400; }
.brand-country span, .brand-government span { font-family: "Times New Roman", Times, serif; font-size: 19px; letter-spacing: .035em; }
.brand-country span { font-size: 21px; }
.brand-country i, .brand-government i { font-family: "Times New Roman", Times, serif; font-style: italic; font-size: 1.06em; font-weight: 400; }
.brand-copy b, .brand-copy span { white-space: nowrap; }
.header-tools { display: flex; align-items: center; gap: 10px; }
.language-label { color: #454c53; font-size: 14px; }
#language-select { min-width: 138px; border: 1px solid #8a929a; border-radius: 2px; background: #fff; padding: 9px 32px 9px 10px; color: #202124; }
.mobile-menu-toggle { display: none; border: 1px solid #69727b; background: white; padding: 9px 13px; color: #202124; }
.flag-rule { display: flex; height: 3px; border-block: 1px solid #b8bec5; }
.flag-rule span:nth-child(1) { flex: 34; background: #fff; }
.flag-rule span:nth-child(2) { flex: 6; background: var(--dsp-blue); }
.flag-rule span:nth-child(3) { flex: 60; background: var(--dsp-red); }
.primary-nav { background: #fff; border-bottom: 1px solid var(--line); }
.nav-inner { display: flex; align-items: stretch; gap: 2px; min-height: 51px; }
.nav-item { position: relative; display: flex; align-items: stretch; }
.nav-link, .nav-trigger { display: inline-flex; align-items: center; gap: 8px; padding: 0 13px; color: #202124; border: 0; border-bottom: 3px solid transparent; background: transparent; text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; cursor: pointer; }
.nav-link:hover, .nav-trigger:hover, .nav-item:focus-within > .nav-trigger { color: var(--dsp-red); border-bottom-color: var(--dsp-red); }
.nav-item.contains-active > .nav-trigger { color: #163f76; border-bottom-color: var(--dsp-blue); }
.nav-caret { font-size: 10px; color: #69727b; }
.nav-dropdown { display: none; position: absolute; z-index: 30; top: calc(100% - 1px); left: 0; min-width: 230px; padding: 8px 0; background: #fff; border: 1px solid #cdd3d9; box-shadow: 0 8px 18px #18212a20; }
.nav-item.open .nav-dropdown { display: grid; }
.nav-dropdown a { padding: 10px 16px; color: #26323d; text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.nav-dropdown a:hover, .nav-dropdown a.active { background: #f2f5f8; color: #143e78; border-left-color: var(--dsp-blue); }

.main-content { min-height: calc(100vh - 248px); padding-block: 34px 68px; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 24px; color: #5c6670; font-size: 13px; }
.breadcrumbs a { color: #315f91; }
.breadcrumbs .crumb-sep { color: #89919a; }
.page-heading { border-bottom: 1px solid var(--line); margin-bottom: 28px; padding-bottom: 19px; }
.page-heading.hell-region-heading { position: relative; border-bottom-color: transparent; }
.page-heading.hell-region-heading::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: linear-gradient(to right, var(--dsp-red) 0 34%, var(--dsp-blue) 34% 40%, var(--dsp-red) 40% 100%); content: ""; }
.page-heading h1 { margin: 0 0 9px; color: #1d2630; font-family: var(--serif); font-size: clamp(28px, 3vw, 38px); font-weight: 600; line-height: 1.24; }
.page-heading p { max-width: 820px; margin: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.eyebrow { margin: 0 0 8px; color: var(--dsp-blue); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 0 0 14px; font-family: var(--serif); font-size: 23px; font-weight: 600; }
.section-title small { color: #6c747d; font: 13px var(--sans); }
.home-hero { position: relative; overflow: hidden; min-height: 350px; display: flex; flex-direction: column; justify-content: center; padding: 39px 42px 36px; background: linear-gradient(115deg, #f1f4f8 0%, #fff 71%); border-left: 5px solid var(--dsp-red); }
.home-hero:after { content: ""; position: absolute; right: -65px; bottom: -155px; width: 440px; height: 250px; border: 1px solid #d9dee4; border-radius: 50%; transform: rotate(-22deg); pointer-events: none; }
.home-hero h1 { position: relative; z-index: 1; max-width: 55%; margin: 0; font-family: var(--serif); font-size: clamp(31px, 4vw, 48px); font-weight: 600; letter-spacing: .025em; }
.home-hero p { position: relative; z-index: 1; max-width: 780px; margin: 0; color: #45515d; font-size: 17px; line-height: 1.9; }
.home-hero .hero-emblem { position: absolute; z-index: 0; top: 50%; right: 2.5%; display: grid; width: 55%; height: 100%; place-items: center; transform: translateY(-50%); pointer-events: none; }
.home-hero .hero-emblem img { display: block; width: 100%; height: 100%; max-height: 350px; object-fit: contain; }
.entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-top: 25px; }
.entry-card { display: flex; min-height: 125px; flex-direction: column; justify-content: space-between; padding: 18px 19px; border: 1px solid #d6dbe0; border-top: 3px solid var(--dsp-blue); background: #fff; color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.entry-card:nth-child(3n+1) { border-top-color: var(--dsp-red); }
.entry-card:hover { transform: translateY(-2px); border-color: #929eaa; box-shadow: 0 6px 18px #14202b12; }
.entry-card strong { font: 600 19px var(--serif); }
.entry-card span { margin-top: 12px; color: #59636d; font-size: 14px; line-height: 1.5; }
.entry-card .card-arrow { align-self: flex-end; color: var(--dsp-blue); font-size: 22px; line-height: 1; }
.notice-panel { margin-top: 24px; border: 1px solid #d8dde2; border-left: 4px solid var(--dsp-blue); padding: 16px 18px; color: #53606b; background: #fff; }
.notice-panel strong { color: #26323d; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr); gap: 24px; align-items: start; }
.panel { border: 1px solid var(--line); background: #fff; padding: 21px; }
.panel h2, .panel h3 { margin-top: 0; font-family: var(--serif); }
.panel p { color: #4f5b66; line-height: 1.75; }
.flag-display { display: grid; place-items: center; padding: 22px; background: #f3f5f7; border: 1px solid #e0e4e8; }
.flag-display img { width: min(100%, 540px); height: auto; border: 1px solid #222; }
.flag-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 15px; }
.color-chip { display: flex; align-items: center; gap: 8px; padding: 9px; border: 1px solid #dfe3e7; font-size: 13px; }
.color-chip i { display: block; width: 24px; height: 24px; border: 1px solid #90969b; }
.asset-card { border: 1px solid #d7dce1; background: #fff; padding: 16px; }
.asset-card img { display: block; max-width: 100%; height: auto; margin-inline: auto; }
.asset-card h2, .asset-card h3 { margin: 12px 0 5px; font: 600 18px var(--serif); }
.asset-card p { color: var(--muted); line-height: 1.65; margin: 4px 0; }
.asset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.historic-asset { background: #f6f7f8; }
.historic-asset img { max-height: 480px; object-fit: contain; }
.document-placeholder { display: flex; min-height: 150px; align-items: center; justify-content: center; border: 1px dashed #a9b2ba; background: #f8f9fa; color: #5c6670; text-align: center; padding: 24px; }
.document-placeholder strong { display: block; margin-bottom: 8px; color: #28343e; font: 600 19px var(--serif); }

.data-table-wrap { overflow-x: auto; border: 1px solid #d7dce1; }
table.data-table { width: 100%; border-collapse: collapse; min-width: 520px; background: #fff; }
.data-table th { padding: 13px 15px; color: #fff; background: #284c78; font-weight: 600; text-align: left; }
.data-table td { padding: 13px 15px; border-top: 1px solid #d9dee3; vertical-align: top; }
.data-table tbody tr:nth-child(even) { background: #f6f8fa; }
.data-table td:first-child { font-weight: 600; }
.status-muted { color: #727b84; font-size: 13px; }
.directory-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 17px; }
.directory-tools input { flex: 1 1 260px; min-height: 43px; border: 1px solid #818b95; padding: 9px 12px; }
.directory-tools select { min-height: 43px; border: 1px solid #818b95; padding: 9px 32px 9px 12px; background: white; }
.directory-count { color: #606a74; font-size: 13px; }
.directory-list { display: grid; gap: 8px; }
.directory-row { display: grid; grid-template-columns: minmax(180px, .9fr) minmax(180px, 1fr); gap: 14px; padding: 13px 15px; border: 1px solid #dce1e5; background: #fff; }
.directory-row[hidden] { display: none; }
.directory-row strong { font-family: var(--serif); }
.directory-row span { color: #59636d; }
.empty-result { padding: 24px; background: #f6f8fa; color: #59636d; text-align: center; }
.category-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.category-link { display: flex; align-items: center; justify-content: space-between; padding: 15px; border: 1px solid #d5dbe1; color: #23313d; text-decoration: none; font-weight: 600; }
.category-link:hover { border-color: var(--dsp-blue); background: #f5f8fc; }

.version-viewer { border: 1px solid #cbd2d9; background: #f6f7f8; }
.viewer-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid #cdd3d9; background: #fff; }
.viewer-toolbar strong { margin-right: auto; color: #26323d; font-size: 14px; }
.viewer-button { min-width: 38px; min-height: 36px; border: 1px solid #a6afb8; background: #fff; color: #26323d; cursor: pointer; }
.viewer-button:hover { background: #edf2f7; border-color: #5e6c78; }
.version-picker { display: flex; align-items: center; gap: 7px; margin-left: 8px; }
.version-picker select { max-width: min(360px, 58vw); min-height: 36px; border: 1px solid #a6afb8; padding: 6px 30px 6px 9px; background: #fff; }
.viewer-stage { height: min(75vh, 820px); min-height: 460px; overflow: hidden; position: relative; touch-action: none; cursor: grab; background: #e7ebef; }
.viewer-stage.dragging { cursor: grabbing; }
.viewer-stage img { position: absolute; top: 50%; left: 50%; max-width: none; max-height: none; user-select: none; pointer-events: none; transform-origin: center; }
.viewer-caption { display: flex; justify-content: space-between; gap: 12px; padding: 9px 13px; border-top: 1px solid #d4d9de; background: #fff; color: #58636e; font-size: 13px; }
.version-bar { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding: 10px 12px; border-top: 1px solid #cbd2d9; background: #fff; }
.version-pill { flex: 0 0 auto; border: 1px solid #c3cbd3; padding: 8px 12px; background: #fff; color: #34424e; cursor: pointer; }
.version-pill.active { border-color: var(--dsp-blue); background: #eaf0fa; color: #133f7a; font-weight: 700; }
.graph-shell { border: 1px solid #cbd2d9; background: #fafbfc; }
.graph-caption { padding: 11px 14px; background: #fff; border-bottom: 1px solid #d5dbe1; color: #56616c; font-size: 13px; }
.graph-viewport { height: min(75vh, 900px); min-height: 520px; overflow: hidden; position: relative; touch-action: none; cursor: grab; background: #fff; }
.graph-viewport.dragging { cursor: grabbing; }
.graph-viewport svg { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; }
.graph-link { fill: none; stroke: #737b82; stroke-width: 2.2; }
.graph-node { cursor: default; transform-box: fill-box; transform-origin: center; transition: filter .12s, transform .12s; }
.graph-node:hover { filter: drop-shadow(0 3px 4px #1b2b3a35); transform: scale(1.07); }
.graph-node .flag-frame { fill: #fff; stroke: #222; stroke-width: 2; }
.graph-node .node-label { fill: #343b41; font-family: var(--serif); font-size: 22px; text-anchor: middle; }
.graph-node .region-label { font-size: 24px; }
.graph-node .org-box { fill: #fff; stroke: #727a82; stroke-width: 1.8; }
.graph-node .org-label { fill: #26313b; font-family: var(--serif); font-size: 21px; text-anchor: middle; }
.graph-node .leaf-label { fill: #26313b; font-family: var(--serif); font-size: 22px; text-anchor: middle; }
.svg-html-label { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; overflow: visible; overflow-wrap: anywhere; color: #26313b; font: 600 17px var(--serif); line-height: 1.2; text-align: center; }
.svg-html-label.node-label { font-size: 15px; line-height: 1.1; }
.svg-html-label.leaf-label { display: flex; align-items: flex-start; color: #26313b; font: 20px var(--serif); line-height: 1.2; text-align: center; }
.graph-node:hover .flag-frame, .graph-node:hover .org-box { stroke: var(--dsp-red); stroke-width: 4; }
.graph-node:hover .node-label, .graph-node:hover .org-label, .graph-node:hover .leaf-label { fill: var(--dsp-red); color: var(--dsp-red); font-weight: 700; }
.graph-node:focus .flag-frame, .graph-node:focus .org-box { stroke: var(--dsp-red); stroke-width: 4; }
.graph-node:focus .node-label, .graph-node:focus .org-label, .graph-node:focus .leaf-label { fill: var(--dsp-red); color: var(--dsp-red); font-weight: 700; }
.chart-title { fill: #283640; font: 600 26px var(--serif); }
.graph-note { fill: #5e6872; font: 17px var(--sans); }
.alphabet-sheet { display: grid; grid-template-columns: repeat(13, minmax(48px, 1fr)); gap: 8px; margin-top: 16px; }
.alphabet-cell { display: grid; justify-items: center; align-content: center; gap: 4px; min-height: 96px; border: 1px solid #d7dce1; background: #fff; }
.alphabet-glyph { display: block; width: 42px; height: 39px; background-image: url("assets/villager-alphabet.png"); background-repeat: no-repeat; }
.alphabet-cell small { color: #66717b; font-size: 12px; }
.native-glyph { display: inline-block; width: 1.05em; height: .98em; vertical-align: -.16em; background-image: url("assets/villager-alphabet.png"); background-repeat: no-repeat; background-size: 13.805em 2.659em; }
.native-run { display: inline; white-space: normal; }
.script-demo { min-height: 54px; padding: 13px; border: 1px solid #d7dce1; background: #fbfbfb; font-size: 24px; letter-spacing: .02em; overflow-wrap: anywhere; }
.icon-flag { width: 30px; height: 20px; vertical-align: middle; border: 1px solid #555; object-fit: cover; margin-right: 8px; }
.inline-note { margin-top: 18px; padding: 13px 15px; border-left: 3px solid var(--dsp-blue); background: #f3f6fa; color: #4c5964; line-height: 1.65; }
.link-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.link-list a { padding: 14px 4px; border-bottom: 1px solid var(--line); font-weight: 600; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; align-items: center; min-height: 92px; color: #58616a; font-size: 13px; }
.site-footer { border-top: 4px solid var(--dsp-red); background: #f4f5f6; }
.footer-mark { display: flex; align-items: center; gap: 10px; color: #303940; font: 600 15px var(--serif); }
.footer-mark img { width: 34px; height: 22px; object-fit: cover; border: 1px solid #454545; }
.external-frame-note { padding: 20px; border: 1px dashed #aab2ba; color: #505b65; background: #f7f8f9; line-height: 1.7; }
.external-frame-note strong { color: #26333f; }
.frame-placeholder { display: flex; align-items: center; justify-content: center; gap: 10px; height: 360px; margin-top: 17px; border: 1px solid #c9d0d7; background: linear-gradient(135deg, #edf1f4, #fff); color: #73808c; font: 600 19px var(--serif); }
.frame-placeholder span + span { display: grid; place-items: center; width: 52px; height: 52px; border: 1px solid #b8c0c8; color: var(--dsp-blue); }
.current-map img { display: block; width: 100%; height: auto; }
.map-fallback { max-width: 100%; }
.page-meta { display: inline-flex; align-items: center; gap: 7px; margin: 0 0 14px; padding: 6px 10px; border: 1px solid #d2d8de; background: #f8f9fa; color: #4e5b67; font-size: 13px; }
.page-meta b { color: #243441; }
.subsection { margin-top: 28px; }
.history-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.history-image-card { border: 1px solid #d6dce1; padding: 12px; background: #f8f9fa; }
.history-image-card img { display: block; max-width: 100%; max-height: 300px; margin: auto; object-fit: contain; }
.history-image-card strong { display: block; margin: 9px 0 3px; font-family: var(--serif); }
.history-image-card span { color: #69737c; font-size: 13px; }
.subnav-inline { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 22px; }
.subnav-inline a { border: 1px solid #ccd3d9; padding: 8px 12px; text-decoration: none; background: #fff; }
.subnav-inline a.active { color: #173e73; border-color: #7d95b3; background: #f0f4f9; font-weight: 700; }

@media (hover: hover) and (pointer: fine) {
  .nav-item:hover .nav-dropdown { display: grid; }
}

@media (max-width: 1040px) {
  .nav-inner { overflow-x: auto; }
  .nav-link, .nav-trigger { padding-inline: 10px; }
  .content-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .wrap { width: min(100% - 28px, var(--page-width)); }
  .masthead { min-height: 88px; gap: 10px; padding-block: 11px; }
  .brand { gap: 10px; }
  .brand-flag { width: 54px; height: 35px; }
  .brand-copy { column-gap: 7px; }
  .brand-country b { font-size: 20px; }
  .brand-government b { font-size: 16px; }
  .brand-country span { font-size: 16px; }
  .brand-government span { font-size: 14px; }
  .header-tools { gap: 6px; }
  .language-label { display: none; }
  #language-select { min-width: 100px; width: 112px; font-size: 13px; padding: 8px 24px 8px 7px; }
  .mobile-menu-toggle { display: inline-block; }
  .primary-nav { display: none; }
  .primary-nav.mobile-open { display: block; }
  .nav-inner { width: 100%; display: grid; overflow: visible; padding: 5px 14px 12px; }
  .nav-item { display: grid; }
  .nav-link, .nav-trigger { justify-content: space-between; min-height: 43px; width: 100%; border-bottom: 1px solid #e0e4e8; padding-inline: 4px; }
  .nav-dropdown { position: static; min-width: 0; padding: 0 0 6px 10px; border: 0; box-shadow: none; }
  .nav-dropdown a { padding: 9px 12px; }
  .main-content { padding-block: 23px 46px; min-height: calc(100vh - 215px); }
  .page-heading { margin-bottom: 20px; }
  .page-heading p { font-size: 15px; }
  .home-hero { min-height: 0; padding: 27px 23px; }
  .home-hero h1 { max-width: 100%; }
  .home-hero .hero-emblem { display: none; }
  .home-hero p { font-size: 15px; }
  .entry-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .entry-card { min-height: 117px; padding: 14px; }
  .entry-card strong { font-size: 16px; }
  .entry-card span { font-size: 12px; }
  .asset-grid, .history-images { grid-template-columns: 1fr; }
  .flag-facts { grid-template-columns: 1fr; }
  .category-list { grid-template-columns: 1fr; }
  .directory-row { grid-template-columns: 1fr; gap: 5px; }
  .viewer-stage { min-height: 380px; height: 68vh; }
  .viewer-caption { flex-direction: column; }
  .alphabet-sheet { grid-template-columns: repeat(6, 1fr); }
  .footer-inner { align-items: flex-start; flex-direction: column; justify-content: center; padding-block: 18px; gap: 8px; }
}
@media (max-width: 420px) {
  .brand { gap: 7px; }
  .brand-flag { width: 44px; height: 29px; }
  .brand-country b { font-size: 17px; }
  .brand-government b { font-size: 14px; }
  .brand-country span { font-size: 13px; }
  .brand-government span { font-size: 12px; }
  #language-select { min-width: 80px; width: 92px; }
  .mobile-menu-toggle { padding: 8px 9px; font-size: 13px; }
  .entry-grid { grid-template-columns: 1fr; }
}
