:root {
  --bg: #0b1219;
  --glass: rgba(10, 17, 25, 0.72);
  --glass-strong: rgba(8, 14, 21, 0.88);
  --line: rgba(214, 196, 150, 0.22);
  --line-strong: rgba(217, 184, 119, 0.75);
  --gold: #d9b877;
  --gold-soft: #e8d3a4;
  --text: #eef1f3;
  --dim: #93a1ab;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans CJK SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 42%, rgba(0, 0, 0, 0) 62%, rgba(3, 7, 11, 0.26) 100%);
}

/* ---------- header ---------- */
.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px 11px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(9, 15, 22, 0.88), rgba(9, 15, 22, 0.5));
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

.seal {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 10px;
  border: 1px solid rgba(217, 184, 119, 0.55);
  display: grid;
  place-items: center;
  font: 700 13px/1 "Times New Roman", serif;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: radial-gradient(circle at 30% 25%, rgba(217, 184, 119, 0.22), rgba(217, 184, 119, 0.04) 70%);
}

.brand-text h1 {
  margin: 0;
  font: 700 20px/1.2 "Noto Serif CJK SC", "Source Han Serif SC", serif;
  letter-spacing: 0.14em;
}

.brand-text p {
  margin: 5px 0 0;
  font-size: 9px;
  letter-spacing: 0.17em;
  color: var(--dim);
}

.hud-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.35);
}

.group {
  display: flex;
  gap: 4px;
}

.chip {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 13px;
  font: 500 12px/1 "Noto Sans CJK SC", sans-serif;
  letter-spacing: 0.06em;
  color: var(--dim);
  background: transparent;
  cursor: pointer;
  transition: color 0.18s, background 0.18s, border-color 0.18s;
}

.chip:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.chip.active {
  color: #1a1408;
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 4px 14px rgba(217, 184, 119, 0.28);
}

.sep {
  width: 1px;
  height: 20px;
  background: var(--line);
}

/* ---------- landmark panel ---------- */
#panel {
  position: fixed;
  left: 24px;
  top: 100px;
  bottom: 76px;
  width: 286px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass);
  backdrop-filter: blur(14px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  transition: transform 0.35s ease, opacity 0.35s ease;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font: 700 15px/1 "Noto Serif CJK SC", serif;
  letter-spacing: 0.2em;
}

.panel-head h2::after {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  margin-top: 8px;
  background: var(--gold);
}

#panel-toggle {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: transparent;
  color: var(--dim);
  font-size: 11px;
  padding: 5px 9px;
  cursor: pointer;
}

#panel-toggle:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

#landmarks {
  list-style: none;
  margin: 0;
  padding: 6px 6px 10px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(217, 184, 119, 0.35) transparent;
}

#landmarks::-webkit-scrollbar {
  width: 5px;
}

#landmarks::-webkit-scrollbar-thumb {
  background: rgba(217, 184, 119, 0.32);
  border-radius: 4px;
}

#landmarks li {
  border-left: 2px solid transparent;
  border-radius: 9px;
  transition: background 0.18s, border-color 0.18s;
}

#landmarks li:hover {
  background: rgba(255, 255, 255, 0.045);
}

#landmarks li.active {
  background: rgba(217, 184, 119, 0.1);
  border-left-color: var(--gold);
}

#landmarks button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6.5px 10px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.li-name {
  font-size: 13px;
  letter-spacing: 0.06em;
  color: #e7ebee;
}

#landmarks li.active .li-name {
  color: var(--gold-soft);
}

.li-en {
  font-size: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.panel-footer {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--dim);
  line-height: 1.7;
}

.panel-footer p {
  margin: 0;
}

.panel-footer .motto {
  font-family: "Noto Serif CJK SC", serif;
  font-size: 11.5px;
  letter-spacing: 0.24em;
  color: var(--gold-soft);
}

.panel-footer .dim {
  opacity: 0.65;
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

body.panel-collapsed #panel {
  transform: translateX(-320px);
  opacity: 0;
  pointer-events: none;
}

/* ---------- detail card ---------- */
#card {
  position: fixed;
  right: 24px;
  bottom: 98px;
  width: 368px;
  z-index: 22;
  padding: 20px 22px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--glass-strong);
  backdrop-filter: blur(16px);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.45);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

#card::before {
  content: "";
  position: absolute;
  left: 22px;
  top: 0;
  width: 44px;
  height: 1px;
  background: var(--gold);
}

#card.hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

#card h3 {
  margin: 0 34px 2px 0;
  font: 700 20px/1.3 "Noto Serif CJK SC", serif;
  letter-spacing: 0.12em;
}

#card .en {
  margin: 0 0 12px;
  font: 600 9.5px/1.5 "Times New Roman", serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

#card p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.95;
  color: #c9d2d8;
  letter-spacing: 0.03em;
}

#card-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

#card-close:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

/* ---------- labels ---------- */
#labels {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

#labels.hidden {
  display: none;
}

.label {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 9px;
  border: 1px solid rgba(214, 196, 150, 0.28);
  border-radius: 999px;
  background: rgba(8, 14, 21, 0.72);
  backdrop-filter: blur(6px);
  color: #f2f4f5;
  cursor: pointer;
  white-space: nowrap;
  transform-origin: 50% 100%;
  pointer-events: auto;
  transition: opacity 0.25s, border-color 0.18s, background 0.18s;
  will-change: transform, opacity;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.label-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(217, 184, 119, 0.9);
  animation: pulse 2.6s ease-in-out infinite;
}

.label-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
  text-align: left;
}

.label-name {
  font-size: 12.5px;
  letter-spacing: 0.07em;
}

.label-en {
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.label:hover,
.label.active {
  border-color: var(--line-strong);
  background: rgba(17, 26, 37, 0.92);
}

.label.active .label-name {
  color: var(--gold-soft);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(217, 184, 119, 0.45);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(217, 184, 119, 0);
  }
}

/* ---------- footer hint ---------- */
#hint {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 21;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(12px);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--dim);
  white-space: nowrap;
  max-width: calc(100vw - 48px);
  overflow: hidden;
}

#hint span {
  position: relative;
}

#hint .keys {
  color: rgba(217, 184, 119, 0.8);
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

#stats {
  border-left: 1px solid var(--line);
  padding-left: 14px;
  color: rgba(232, 211, 164, 0.75);
}

/* ---------- loader ---------- */
#loader {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 38%, #17242f 0%, #070b10 68%);
  transition: opacity 0.9s ease, visibility 0.9s ease;
}

#loader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-inner {
  text-align: center;
  transform: translateY(-12px);
}

.loader-seal {
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  border: 1px solid rgba(217, 184, 119, 0.55);
  border-radius: 12px;
  display: grid;
  place-items: center;
  font: 700 15px/1 "Times New Roman", serif;
  letter-spacing: 0.08em;
  color: var(--gold);
  background: radial-gradient(circle at 30% 25%, rgba(217, 184, 119, 0.2), transparent 70%);
}

.loader-title {
  font: 700 26px/1.3 "Noto Serif CJK SC", serif;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  color: #f0e7d4;
}

.loader-en {
  margin-top: 8px;
  font-size: 8.5px;
  letter-spacing: 0.26em;
  color: var(--dim);
}

.loader-bar {
  width: 238px;
  height: 2px;
  margin: 26px auto 12px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  overflow: hidden;
}

.loader-bar i {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  animation: swipe 1.35s ease-in-out infinite;
}

@keyframes swipe {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(260%);
  }
}

.loader-sub {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  #panel {
    width: 250px;
  }
  .brand-text p {
    display: none;
  }
}

@media (max-width: 820px) {
  #panel {
    display: none;
  }
  .hud {
    padding: 12px 12px;
    flex-direction: column;
    gap: 8px;
  }
  .brand {
    padding: 8px 12px;
  }
  .brand-text h1 {
    font-size: 16px;
  }
  .hud-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .chip {
    padding: 7px 10px;
    font-size: 11px;
  }
  #card {
    left: 12px;
    right: 12px;
    width: auto;
    bottom: 76px;
  }
  #hint {
    font-size: 9.5px;
    gap: 8px;
    padding: 7px 12px;
    bottom: 10px;
  }
  #hint .keys,
  #stats {
    display: none;
  }
}

/* ---------- building directory ---------- */
.panel-tools {
  padding: 10px 10px 6px;
  border-bottom: 1px solid var(--line);
}

#building-search {
  width: 100%;
  box-sizing: border-box;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 12px;
  outline: none;
}

#building-search::placeholder {
  color: var(--dim);
}

#building-search:focus {
  border-color: var(--line-strong);
}

.cat-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.cat-chips button {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 7px;
  font-size: 10.5px;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
}

.cat-chips button.active {
  color: #1a1408;
  background: var(--gold);
}

.li-meta {
  font-size: 8px;
  letter-spacing: 0.06em;
  color: rgba(217, 184, 119, 0.72);
}

/* compact labels for named buildings */
.label.label-mini {
  padding: 2px 7px 2px 6px;
  gap: 5px;
  border-radius: 6px;
  background: rgba(8, 14, 21, 0.62);
  border-color: rgba(214, 196, 150, 0.16);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
}

.label.label-mini .label-dot {
  width: 4px;
  height: 4px;
  flex: 0 0 4px;
  animation: none;
}

.label.label-mini .label-name {
  font-size: 10.5px;
  letter-spacing: 0.03em;
}

.label.label-mini .label-en {
  display: none;
}

.label.cat-college .label-dot { background: #8ab4e8; }
.label.cat-canteen .label-dot { background: #e8b06a; }
.label.cat-sport .label-dot { background: #7cd6a2; }
.label.cat-dorm .label-dot { background: #c9a6e8; }
.label.cat-research .label-dot { background: #6fd3d0; }
.label.cat-service .label-dot { background: #c7c7c7; }
