/* ============================================================
   世界遗产足迹 · World Heritage Footprints
   Aesthetic: 典藏图鉴 — ink-black atlas, gold foil, serif display
   ============================================================ */

:root {
  --ink-0: #0b0f16;          /* page deepest */
  --ink-1: #101623;          /* panel */
  --ink-2: #1a2233;          /* raised */
  --ink-3: #242e42;          /* hover */
  --hairline: rgba(212, 190, 140, .16);
  --hairline-strong: rgba(212, 190, 140, .34);
  --gold: #d4af6a;
  --gold-bright: #ecd39a;
  --paper: #e9e4d8;          /* primary text */
  --paper-dim: #9aa0ab;      /* secondary text */
  --paper-faint: #6a7078;
  --c-cultural: #e2b25e;
  --c-natural: #7fb98a;
  --c-mixed: #b48ce0;
  --danger: #e0654f;
  --serif-latin: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --serif: "Cormorant Garamond", "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  --shadow-panel: 0 18px 50px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  --sidebar-w: 348px;
  --z-ui: 1000;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; }

body {
  background: var(--ink-0);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* archival grain over everything */
body::after {
  content: "";
  position: fixed; inset: 0;
  z-index: 4000;
  pointer-events: none;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: rgba(212, 175, 106, .35); }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-thumb { background: #2a3346; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a465e; }

/* ---------------- map ---------------- */
#map {
  position: fixed; inset: 0;
  background: var(--ink-0);
  z-index: 1;
}
.leaflet-container { background: var(--ink-0); font-family: var(--serif); }
.leaflet-control-attribution {
  background: rgba(11, 15, 22, .72) !important;
  color: var(--paper-faint) !important;
  font-size: 10px !important;
  padding: 2px 8px;
}
.leaflet-control-attribution a { color: #8b8f98 !important; }
.leaflet-bar a {
  background: var(--ink-1) !important;
  color: var(--gold) !important;
  border: 1px solid var(--hairline) !important;
}
.leaflet-bar a:hover { background: var(--ink-3) !important; }
.leaflet-tile-pane { filter: saturate(.82) brightness(.96); }

/* ---------------- brand ---------------- */
.brand {
  position: fixed; top: 18px; left: 18px;
  z-index: var(--z-ui);
  width: var(--sidebar-w);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px 10px 12px;
  background: linear-gradient(160deg, rgba(16, 22, 35, .92), rgba(11, 15, 22, .86));
  border: 1px solid var(--hairline);
  border-radius: 4px;
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(10px);
}
.brand-mark {
  width: 30px; height: 30px; flex: none;
  background: linear-gradient(135deg, var(--gold-bright), var(--gold) 55%, #a8853f);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  box-shadow: 0 0 18px rgba(212, 175, 106, .45);
}
.brand-text h1 {
  font-size: 17px; font-weight: 600; letter-spacing: .14em;
  color: var(--paper); line-height: 1.15;
}
.brand-sub {
  display: block;
  font-family: var(--serif-latin);
  font-size: 8.5px; letter-spacing: .32em;
  color: var(--gold);
  opacity: .85;
  margin-top: 2px;
}

/* ---------------- top actions ---------------- */
.top-actions {
  position: fixed; top: 18px; right: 18px;
  z-index: var(--z-ui);
  display: flex; gap: 8px;
  transition: right .42s cubic-bezier(.22, .9, .3, 1);
}
body.drawer-open .top-actions { right: 444px; }
.ghost-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: linear-gradient(160deg, rgba(16, 22, 35, .92), rgba(11, 15, 22, .86));
  border: 1px solid var(--hairline);
  border-radius: 4px;
  color: var(--paper-dim);
  font-family: var(--serif); font-size: 13px; letter-spacing: .08em;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: color .18s, border-color .18s;
}
.ghost-btn:hover { color: var(--gold-bright); border-color: var(--hairline-strong); }
.lang-btn {
  min-width: 48px; min-height: 34px; padding: 7px 10px;
  background: linear-gradient(145deg, var(--gold-bright), var(--gold));
  border: 1px solid rgba(255, 233, 180, .78);
  border-radius: 4px;
  color: #201708;
  font-family: var(--serif-latin), "Songti SC", "STSong", serif;
  font-size: 14px; font-weight: 700; letter-spacing: .1em;
  cursor: pointer;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .38), inset 0 1px rgba(255, 255, 255, .34);
  text-shadow: 0 1px rgba(255, 244, 211, .32);
  transition: filter .18s, transform .18s, box-shadow .18s;
}
.lang-btn:hover { filter: brightness(1.08); box-shadow: 0 5px 16px rgba(0, 0, 0, .46), inset 0 1px rgba(255, 255, 255, .38); }
.lang-btn:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.lang-btn:active { transform: translateY(1px); }

/* ---------------- sidebar ---------------- */
#sidebar {
  position: fixed; top: 76px; bottom: 18px; left: 18px;
  width: var(--sidebar-w);
  z-index: calc(var(--z-ui) - 1);
  display: flex; flex-direction: column;
  background: linear-gradient(175deg, rgba(14, 19, 30, .94) 0%, rgba(10, 14, 21, .96) 100%);
  border: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  border-radius: 4px;
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(12px);
  transition: transform .38s cubic-bezier(.22, .9, .3, 1), opacity .38s;
}
#sidebar.hidden { transform: translateX(calc(-100% - 26px)); opacity: 0; pointer-events: none; }

#sideToggle {
  position: fixed; top: 76px; left: 366px;
  z-index: var(--z-ui);
  width: 26px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(16, 22, 35, .94), rgba(11, 15, 22, .9));
  border: 1px solid var(--hairline); border-left: none;
  border-radius: 0 4px 4px 0;
  color: var(--gold);
  cursor: pointer;
  transition: left .38s cubic-bezier(.22, .9, .3, 1), color .18s;
}
#sideToggle:hover { color: var(--gold-bright); }
#sideToggle.closed { left: 18px; }
#sideToggle.closed svg { transform: rotate(180deg); }
#sideToggle svg { transition: transform .3s; }

/* stats block */
.stats {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--hairline);
  background:
    radial-gradient(120px 60px at 88% 0%, rgba(212, 175, 106, .1), transparent 70%);
}
.stats-frac { display: flex; align-items: baseline; gap: 4px; }
.stats-frac em {
  font-family: var(--serif-latin);
  font-style: normal; font-weight: 500;
  font-size: 42px; line-height: 1;
  color: var(--gold-bright);
  font-variant-numeric: lining-nums;
}
.stats-frac i { color: var(--paper-faint); font-size: 26px; font-style: normal; }
.stats-frac span { color: var(--paper-dim); font-size: 18px; font-family: var(--serif-latin); }
.stats-frac label {
  margin-left: auto;
  font-size: 11px; letter-spacing: .3em;
  color: var(--paper-dim);
}
.stats-bars { margin-top: 12px; display: grid; gap: 6px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 11px; }
.bar-cat { width: 34px; letter-spacing: .18em; color: var(--paper-dim); flex: none; }
.bar-row b {
  font-family: var(--serif-latin); font-weight: 600; font-size: 13px;
  color: var(--paper); min-width: 52px; text-align: right;
  font-variant-numeric: lining-nums;
}
.bar {
  flex: 1; height: 3px;
  background: rgba(255, 255, 255, .07);
  border-radius: 2px; overflow: hidden;
}
.bar i {
  display: block; height: 100%; width: 0;
  border-radius: 2px;
  transition: width .7s cubic-bezier(.22, .9, .3, 1);
}
.c-cultural .bar-i, #barCultural { background: linear-gradient(90deg, #8a6a34, var(--c-cultural)); }
#barNatural { background: linear-gradient(90deg, #4c7a56, var(--c-natural)); }
#barMixed { background: linear-gradient(90deg, #6f5398, var(--c-mixed)); }
.stats-foot { margin-top: 10px; font-size: 12px; color: var(--paper-dim); letter-spacing: .06em; }
.stats-foot b { color: var(--gold); font-family: var(--serif-latin); font-size: 15px; }

/* search */
.search-wrap {
  position: relative;
  margin: 12px 14px 8px;
}
.search-wrap > svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--paper-faint); pointer-events: none;
}
#search {
  width: 100%;
  padding: 9px 40px 9px 34px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  color: var(--paper);
  font-family: var(--serif); font-size: 14px;
  letter-spacing: .04em;
  outline: none;
  transition: border-color .2s, background .2s;
}
#search:focus { border-color: var(--hairline-strong); background: rgba(255, 255, 255, .07); }
#search::-webkit-search-cancel-button { display: none; }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0;
  border: 1px solid transparent; border-radius: 50%;
  background: rgba(255, 255, 255, .04); color: var(--paper-faint); cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.search-clear svg { display: block; }
.search-clear:hover { color: var(--paper); border-color: var(--hairline); background: rgba(255, 255, 255, .1); }
.search-clear:focus-visible { outline: 1px solid var(--gold); outline-offset: 1px; }
.search-clear[hidden] { display: none; }

/* filters */
.filters { padding: 0 14px 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 12px;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  color: var(--paper-dim);
  font-family: var(--serif); font-size: 12.5px; letter-spacing: .12em;
  cursor: pointer;
  transition: all .18s;
}
.chip:hover { color: var(--paper); border-color: var(--hairline-strong); }
.chip.active { color: var(--ink-0); background: var(--gold); border-color: var(--gold); }
.chip.ci-c.active { background: var(--c-cultural); border-color: var(--c-cultural); }
.chip.ci-n.active { background: var(--c-natural); border-color: var(--c-natural); }
.chip.ci-m.active { background: var(--c-mixed); border-color: var(--c-mixed); }
.chip.ci-d.active { background: var(--danger); border-color: var(--danger); color: #fff; }
.chip.ci-v.active { background: var(--gold); border-color: var(--gold); color: #221806; }
.chip.ci-w.active { background: var(--gold-bright); border-color: var(--gold-bright); color: #221806; }

.select-row { display: flex; gap: 6px; margin-top: 8px; }
.select-row select {
  flex: 1; min-width: 0;
  padding: 5px 6px;
  background: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  color: var(--paper-dim);
  font-family: var(--serif); font-size: 12px;
  outline: none;
  cursor: pointer;
}
.select-row select:focus { border-color: var(--hairline-strong); color: var(--paper); }
.select-row option { background: var(--ink-1); color: var(--paper); }
.result-line {
  margin-top: 8px;
  font-size: 11.5px; color: var(--paper-faint); letter-spacing: .1em;
}

/* list */
.list { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 8px 10px; overscroll-behavior: contain; }
.item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, .045);
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.item:hover { background: rgba(212, 175, 106, .07); }
.item.sel { background: rgba(212, 175, 106, .12); }
.item-pin { flex: none; width: 11px; height: 11px; position: relative; }
.item-txt { flex: 1; min-width: 0; }
.item-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 14px; color: var(--paper); letter-spacing: .03em;
  overflow: hidden;
  line-height: 1.35;
}
.item-meta {
  display: block;
  font-size: 11px; color: var(--paper-faint); letter-spacing: .06em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 1px;
}
.item-star {
  display: none;
  flex: none;
  color: var(--gold);
  font-size: 13px;
  line-height: 1;
}
.item.want .item-star { display: inline-block; }
.item-year {
  flex: none;
  font-family: var(--serif-latin); font-size: 13px; font-weight: 500;
  color: var(--paper-dim);
  font-variant-numeric: lining-nums;
}
.item.visited .item-year { color: var(--gold); }
.item.visited .item-name::after {
  content: "✓";
  margin-left: 6px; font-size: 11px; color: var(--gold);
}
.empty { padding: 40px 20px; text-align: center; color: var(--paper-faint); font-size: 13px; letter-spacing: .15em; }

/* ---------------- pins ---------------- */
.pinwrap { display: block; position: relative; width: 100%; height: 100%; }
.pinwrap.selected::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid var(--gold-bright);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(10, 14, 21, .86), 0 0 10px 2px rgba(242, 211, 126, .58);
  animation: selectedpulse 2.1s ease-out infinite;
  pointer-events: none;
}
.pinwrap.selected .pin {
  border-color: var(--paper);
  box-shadow: 0 0 0 1px var(--ink-0), 0 0 0 2px var(--paper);
  opacity: 1;
  transform: scale(1.2);
  z-index: 1;
}
.pinwrap.selected .pin.sh-diamond { transform: rotate(45deg) scale(1.14); }
.pinwrap.selected .pin.sh-hex { transform: scale(1.17); }
.pinwrap.want::after {
  content: "★";
  position: absolute; top: -10px; right: -11px;
  font-size: 10px; line-height: 1;
  color: var(--gold-bright);
  text-shadow: 0 0 3px rgba(0, 0, 0, .9), 0 0 2px rgba(0, 0, 0, .9);
  pointer-events: none;
}
.pin {
  display: block; width: 100%; height: 100%;
  position: relative;
  background: var(--ink-2);
  border: 1.5px solid var(--pc, #888);
  opacity: .92;
  transition: transform .15s;
}
.pin.sh-diamond { transform: rotate(45deg); border-radius: 1px; }
.pin.sh-circle { border-radius: 50%; }
.pin.sh-hex { clip-path: polygon(25% 3%, 75% 3%, 98% 50%, 75% 97%, 25% 97%, 2% 50%); border: none; background: linear-gradient(160deg, var(--ink-3), var(--ink-1)); box-shadow: inset 0 0 0 1.5px var(--pc, #888); }
.pin.on { background: var(--pc); border-color: transparent; box-shadow: 0 0 10px 1px color-mix(in srgb, var(--pc) 65%, transparent); }
.pin.on::after {
  content: ""; position: absolute; inset: 3px;
  border-radius: 50%;
  background: rgba(11, 15, 22, .55);
}
.pin.sh-diamond.on::after { inset: 4px; }
.pin.sh-hex.on::after { inset: 4px; }
.pin.dz::before {
  content: ""; position: absolute; inset: -5px;
  border: 1px solid var(--danger); border-radius: 50%;
  animation: dzpulse 2.2s ease-out infinite;
}
@keyframes selectedpulse {
  0% { opacity: .86; transform: scale(.82); }
  68% { opacity: 0; transform: scale(1.18); }
  100% { opacity: 0; transform: scale(1.18); }
}
@keyframes dzpulse {
  0% { transform: scale(.6); opacity: .9; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}
.pin:hover { transform: scale(1.35); }
.pin.sh-diamond:hover { transform: rotate(45deg) scale(1.3); }

/* clusters */
.clu {
  background: radial-gradient(circle at 38% 32%, rgba(42, 52, 72, .95), rgba(16, 22, 35, .95));
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .5), inset 0 0 12px rgba(212, 175, 106, .12);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold-bright);
  font-family: var(--serif-latin); font-weight: 600;
  font-variant-numeric: lining-nums;
  backdrop-filter: blur(2px);
  transition: transform .15s;
}
.clu:hover { transform: scale(1.08); }
.clu.gold { border-color: rgba(212, 175, 106, .6); }
.clu span { font-size: 13px; letter-spacing: 0; }

/* ---------------- legend ---------------- */
.legend {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 14px;
  z-index: var(--z-ui);
  display: flex; gap: 16px;
  padding: 7px 16px;
  background: rgba(11, 15, 22, .82);
  border: 1px solid var(--hairline);
  border-radius: 3px;
  backdrop-filter: blur(8px);
}
.legend span { display: flex; align-items: center; gap: 6px; }
.legend em { font-style: normal; font-size: 11px; color: var(--paper-dim); letter-spacing: .1em; }
.lg-dot.want { background: transparent; color: var(--gold-bright); font-size: 12px; line-height: 1; width: auto; height: auto; display: inline; }
.lg-dot { width: 9px; height: 9px; display: inline-block; }
.lg-dot.c-cultural { background: var(--c-cultural); transform: rotate(45deg); }
.lg-dot.c-natural { background: var(--c-natural); border-radius: 50%; }
.lg-dot.c-mixed { background: var(--c-mixed); clip-path: polygon(25% 3%, 75% 3%, 98% 50%, 75% 97%, 25% 97%, 2% 50%); }
.lg-dot.visited { background: var(--gold); border-radius: 50%; }
.lg-dot.dz { background: transparent; border: 1px solid var(--danger); border-radius: 50%; }

/* ---------------- drawer ---------------- */
#drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 420px; max-width: 92vw;
  z-index: calc(var(--z-ui) + 100);
  display: flex; flex-direction: column;
  background: linear-gradient(178deg, #131a29 0%, #0c111b 100%);
  border-left: 1px solid var(--hairline);
  box-shadow: -24px 0 60px rgba(0, 0, 0, .6);
  transform: translateX(105%);
  transition: transform .42s cubic-bezier(.22, .9, .3, 1);
  visibility: hidden;
}
#drawer.open { transform: translateX(0); visibility: visible; }
#drawerClose {
  position: absolute; top: 14px; right: 14px;
  z-index: 5;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(11, 15, 22, .78);
  border: 1px solid var(--hairline);
  border-radius: 50%;
  color: var(--paper-dim);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: color .18s, border-color .18s;
}
#drawerClose:hover { color: var(--gold-bright); border-color: var(--hairline-strong); }

.drawer-media {
  position: relative;
  height: 250px; flex: none;
  background: var(--ink-1);
  overflow: hidden;
}
.drawer-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(12, 17, 27, .92) 100%);
  pointer-events: none;
}
#dImg {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .6s;
}
#dImg.ready { opacity: 1; }
.media-fallback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(200px 140px at 70% 30%, rgba(212, 175, 106, .14), transparent 70%),
    repeating-linear-gradient(45deg, rgba(255,255,255,.022) 0 2px, transparent 2px 14px),
    linear-gradient(160deg, var(--ink-2), var(--ink-0));
}
.media-fallback span {
  font-family: var(--serif);
  font-size: 84px; font-weight: 600;
  color: rgba(212, 175, 106, .22);
  line-height: 1;
}
/* wax seal */
.seal {
  position: absolute; right: 18px; bottom: 14px;
  z-index: 4;
  width: 86px; height: 86px;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
  background:
    radial-gradient(circle at 36% 30%, rgba(255, 235, 190, .5), transparent 42%),
    radial-gradient(circle at 50% 50%, #b98f45, #8f6a2e 72%, #6e5220 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .55), inset 0 0 0 2px rgba(255, 240, 205, .35), inset 0 0 18px rgba(60, 40, 8, .55);
  transform: rotate(-11deg);
  color: #241a08;
}
.seal::before {
  content: ""; position: absolute; inset: 7px;
  border: 1px dashed rgba(46, 32, 8, .55);
  border-radius: 50%;
}
.seal-txt { font-size: 15px; font-weight: 700; letter-spacing: .3em; text-indent: .3em; }
.seal-date { font-family: var(--serif-latin); font-size: 11px; letter-spacing: .06em; }
.seal.pop { animation: seelpop .55s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes seelpop {
  0% { transform: rotate(-30deg) scale(2.4); opacity: 0; }
  60% { transform: rotate(-9deg) scale(.94); opacity: 1; }
  100% { transform: rotate(-11deg) scale(1); }
}

.drawer-body {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 18px 22px 12px;
  overscroll-behavior: contain;
}
#dNameZh, .d-name-en, .d-desc, .d-chip { overflow-wrap: anywhere; }
.d-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.d-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2.5px 10px;
  border: 1px solid var(--hairline);
  border-radius: 2px;
  font-size: 11.5px; letter-spacing: .12em;
  color: var(--paper-dim);
}
.d-chip b { font-weight: 400; }
.d-chip.cat { color: var(--cc, var(--gold)); border-color: color-mix(in srgb, var(--cc, var(--gold)) 45%, transparent); }
.d-chip.danger-chip { color: #ff9a88; border-color: rgba(224, 101, 79, .5); }
#dNameZh {
  font-size: 24px; font-weight: 600; letter-spacing: .06em;
  line-height: 1.35;
  color: var(--paper);
}
.d-name-en {
  margin-top: 4px;
  font-family: var(--serif-latin);
  font-size: 14.5px; font-style: italic; font-weight: 400;
  color: var(--gold);
  opacity: .9;
  line-height: 1.4;
}
.d-desc {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
  font-size: 14px; line-height: 1.85;
  color: #c9c4b8;
  letter-spacing: .02em;
  text-align: justify;
}

.drawer-foot {
  flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--hairline);
  background: rgba(10, 14, 21, .8);
  backdrop-filter: blur(8px);
}
.want-btn {
  flex: none;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  color: var(--paper-dim);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.want-btn:hover { color: var(--gold-bright); border-color: var(--hairline-strong); }
.want-btn.on {
  color: var(--gold-bright);
  border-color: var(--hairline-strong);
  background: rgba(212, 175, 106, .14);
}
.want-btn.on svg { fill: var(--gold); }
.undo-btn {
  flex: none;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(224, 101, 79, .08);
  border: 1px solid rgba(224, 101, 79, .38);
  border-radius: 3px;
  color: #f09a8b;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.undo-btn:hover { color: #ffd1c8; border-color: rgba(224, 101, 79, .7); background: rgba(224, 101, 79, .16); }
.undo-btn:focus-visible { outline: 2px solid var(--paper); outline-offset: 2px; }
.check-btn {
  flex: 1;
  white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 14px;
  background: linear-gradient(160deg, var(--gold-bright), var(--gold) 60%, #b08c46);
  border: none; border-radius: 3px;
  color: #221806;
  font-family: var(--serif); font-size: 15px; font-weight: 700; letter-spacing: .2em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(212, 175, 106, .25);
  transition: filter .18s, transform .1s;
}
.check-btn.done { font-size: 13px; letter-spacing: .14em; }
.check-btn:hover { filter: brightness(1.08); }
.check-btn:active { transform: scale(.985); }
.check-btn.done {
  background: linear-gradient(160deg, rgba(212, 175, 106, .16), rgba(212, 175, 106, .08));
  box-shadow: inset 0 0 0 1px var(--hairline-strong);
  color: var(--gold-bright);
}
.link-btn {
  flex: none;
  padding: 11px 14px;
  display: inline-flex; align-items: center;
  border: 1px solid var(--hairline);
  border-radius: 3px;
  color: var(--paper-dim);
  font-size: 13px; letter-spacing: .1em;
  text-decoration: none;
  transition: color .18s, border-color .18s;
  white-space: nowrap;
}
.link-btn:hover { color: var(--gold-bright); border-color: var(--hairline-strong); }

/* ---------------- toast ---------------- */
#toast {
  position: fixed; left: 50%; bottom: 64px;
  transform: translate(-50%, 16px);
  z-index: 4500;
  padding: 10px 22px;
  background: linear-gradient(160deg, rgba(20, 26, 40, .96), rgba(12, 16, 25, .96));
  border: 1px solid var(--hairline-strong);
  border-radius: 3px;
  color: var(--gold-bright);
  font-size: 13.5px; letter-spacing: .12em;
  box-shadow: var(--shadow-panel);
  opacity: 0;
  pointer-events: none;
  transition: opacity .3s, transform .3s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- responsive ---------------- */
@media (max-width: 760px) {
  .brand { top: 12px; left: 12px; width: calc(100vw - 212px); min-width: 0; padding: 8px 10px; }
  .brand-text { min-width: 0; }
  .brand-text h1 { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-sub { display: none; }
  .top-actions { top: 12px; right: 12px; gap: 6px; }
  .ghost-btn { width: 34px; height: 34px; justify-content: center; padding: 0; }
  .ghost-btn span { display: none; }
  .lang-btn { min-width: 42px; min-height: 34px; padding: 7px 8px; }
  #sidebar {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: 68dvh; max-height: 68dvh;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid var(--hairline);
    transform: none;
  }
  #sidebar.hidden { transform: translateY(110%); opacity: 0; }
  #sideToggle { top: auto; bottom: 68dvh; left: 50%; transform: translateX(-50%); width: 46px; height: 26px; border-radius: 4px 4px 0 0; border: 1px solid var(--hairline); border-bottom: none; transition: bottom .38s cubic-bezier(.22,.9,.3,1); }
  #sideToggle.closed { left: 50%; bottom: 12px; }
  #sideToggle svg { transform: rotate(-90deg); }
  #sideToggle.closed svg { transform: rotate(90deg); }
  .stats { padding: 10px 14px 9px; }
  #drawer { width: 100vw; max-width: 100vw; }
  .legend { bottom: auto; top: 64px; left: auto; right: 12px; transform: none; flex-direction: column; gap: 8px; padding: 10px 12px; }
  .stats-frac em { font-size: 30px; }
  .stats-bars { margin-top: 7px; gap: 4px; }
  .stats-foot { margin-top: 7px; }
  .search-wrap { margin: 8px 12px 6px; }
  .filters { padding: 0 12px 6px; }
  .list { padding-top: 2px; }
}
