html, body {
  height: 100%;
  margin: 0;
  background: #000;
  font-family: var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
}

:root {
  --map-toc-panel-border: #2e2e2e;
  --map-toc-panel-bg: rgba(12, 12, 12, 0.86);
  --map-toc-panel-color: #fff;
  --map-toc-ui-font-family: var(--font-body, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  --map-toc-ui-font-weight: 700;
  --map-toc-title-font-family: var(--map-toc-ui-font-family);
  --map-toc-title-font-weight: 800;
  --map-toc-meta-font-family: var(--map-toc-ui-font-family);
  --map-toc-meta-font-weight: 400;
  --map-toc-meta-letter-spacing: 0.01em;
  --map-toc-control-border: #3d3d3d;
  --map-toc-control-border-strong: #6d6d6d;
  --map-toc-control-bg: rgba(0, 0, 0, 0.35);
  --map-toc-control-bg-soft: rgba(255, 255, 255, 0.05);
  --map-toc-control-bg-active: rgba(255, 255, 255, 0.16);
  --map-toc-control-bg-hover: rgba(255, 255, 255, 0.06);
  --map-toc-control-color: #fff;
  --map-toc-item-bg: rgba(255, 255, 255, 0.04);
  --map-toc-item-bg-hover: rgba(255, 255, 255, 0.09);
  --map-toc-placeholder: rgba(255, 255, 255, 0.62);
  --map-toc-focus-ring: rgba(255, 255, 255, 0.18);
  --map-toc-scrollbar-track: rgba(255, 255, 255, 0.04);
  --map-toc-scrollbar-thumb: rgba(255, 255, 255, 0.16);
  --map-toc-scrollbar-thumb-hover: rgba(255, 255, 255, 0.28);
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  z-index: 1;
}

#map-grain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  image-rendering: pixelated;
}

#map-stars {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* Right-center controls (zoom, gps). */
.map-controls {
  position: absolute;
  z-index: 20;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  pointer-events: none; /* allow map interactions around the control capsule */
}

.map-controls-stack {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ctl-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(20,20,20,0.92);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-weight: 800;
  font-size: 18px;
  line-height: 1;
  user-select: none;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.ctl-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.ctl-btn:hover {
  background: rgba(28,28,28,0.95);
  border-color: rgba(255,255,255,0.26);
  transform: translateY(-1px);
}

.ctl-btn:active {
  transform: translateY(0);
}

.map-attribution {
  position: absolute;
  z-index: 20;
  right: 12px;
  bottom: 10px;
  pointer-events: auto;
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}

.map-attribution a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
}

.map-attribution a:hover {
  color: #fff;
  text-decoration: underline;
}


.toc-panel {
  position: absolute;
  z-index: 12;
  top: 12px;
  bottom: 12px;
  left: 12px;
  width: min(360px, calc(100vw - 20px));
  border: 1px solid var(--map-toc-panel-border);
  border-radius: 12px;
  background: var(--map-toc-panel-bg);
  color: var(--map-toc-panel-color);
  overflow: visible;
  backdrop-filter: blur(4px);
  transition: transform 180ms ease;
  overscroll-behavior: contain;
  font-family: var(--map-toc-ui-font-family);
}

.toc-panel.toc-collapsed {
  transform: translateX(calc(-100% + 16px));
}

.toc-body {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  overscroll-behavior: contain;
}

.toc-body[hidden] {
  display: none;
}

.toc-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.toc-mode-btn {
  padding: 7px 10px;
  border: 1px solid var(--map-toc-control-border);
  border-radius: 8px;
  background: var(--map-toc-control-bg-soft);
  color: var(--map-toc-control-color);
  cursor: pointer;
  font-family: var(--map-toc-ui-font-family);
  font-weight: var(--map-toc-ui-font-weight);
}

.toc-mode-btn.is-active {
  background: var(--map-toc-control-bg-active);
  border-color: var(--map-toc-control-border-strong);
}

#toc-search,
#toc-category {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--map-toc-control-border);
  border-radius: 8px;
  background: var(--map-toc-control-bg);
  color: var(--map-toc-control-color);
  font-family: var(--map-toc-ui-font-family);
  font-weight: var(--map-toc-ui-font-weight);
}

#toc-search::placeholder,
#toc-category::placeholder {
  color: var(--map-toc-placeholder);
}

#toc-search:focus,
#toc-category:focus,
.toc-mode-btn:focus,
.toc-cat-btn:focus,
.toc-item:focus,
.toc-toggle:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--map-toc-focus-ring);
}

.toc-category-icons {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.toc-cat-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--map-toc-control-border);
  background: var(--map-toc-control-bg);
  color: var(--map-toc-control-color);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: var(--map-toc-ui-font-family);
  font-weight: var(--map-toc-ui-font-weight);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

.toc-cat-btn svg {
  width: 18px;
  height: 18px;
  display: block;
}

.toc-cat-btn:hover {
  background: var(--map-toc-control-bg-hover);
  border-color: var(--map-toc-control-border-strong);
  transform: translateY(-1px);
}

.toc-cat-btn:active {
  transform: translateY(0);
}

.toc-cat-btn:not(.is-on) {
  opacity: 0.35;
}

.toc-list {
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--map-toc-scrollbar-thumb) var(--map-toc-scrollbar-track);
}

.toc-list::-webkit-scrollbar,
.toc-body::-webkit-scrollbar {
  width: 10px;
}

.toc-list::-webkit-scrollbar-track,
.toc-body::-webkit-scrollbar-track {
  background: var(--map-toc-scrollbar-track);
  border-radius: 999px;
}

.toc-list::-webkit-scrollbar-thumb,
.toc-body::-webkit-scrollbar-thumb {
  background: var(--map-toc-scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.toc-list::-webkit-scrollbar-thumb:hover,
.toc-body::-webkit-scrollbar-thumb:hover {
  background: var(--map-toc-scrollbar-thumb-hover);
  background-clip: padding-box;
}

.toc-item {
  width: 100%;
  text-align: left;
  padding: 11px 12px;
  border: 1px solid var(--map-toc-control-border);
  border-radius: 8px;
  background: var(--map-toc-item-bg);
  color: var(--map-toc-control-color);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  min-height: 62px;
}

.toc-item-layout {
  display: block;
  position: relative;
  z-index: 1;
  min-height: 38px;
}

.toc-item-copy {
  min-width: 0;
}

.toc-item-art {
  position: absolute;
  top: -18px;
  right: -26px;
  bottom: -18px;
  width: 58%;
  background-repeat: no-repeat;
  background-position: right center;
  background-size: auto 135%;
  opacity: 0.18;
  pointer-events: none;
  mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 44%, rgba(0, 0, 0, 0.42) 68%, #000 90%);
  -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0) 44%, rgba(0, 0, 0, 0.42) 68%, #000 90%);
}

.toc-item strong {
  display: block;
  line-height: 1.2;
  font-family: var(--map-toc-title-font-family);
  font-weight: var(--map-toc-title-font-weight);
}

.toc-item:hover {
  background: var(--map-toc-item-bg-hover);
}

.toc-item small {
  display: block;
  margin-top: 4px;
  line-height: 1.25;
  opacity: 0.78;
  font-family: var(--map-toc-meta-font-family);
  font-weight: var(--map-toc-meta-font-weight);
  letter-spacing: var(--map-toc-meta-letter-spacing);
}

.toc-toggle {
  position: absolute;
  top: 50%;
  right: -28px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--map-toc-control-border);
  background: var(--map-toc-panel-bg);
  color: var(--map-toc-control-color);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.toc-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
  transition: transform 160ms ease;
}

/* When collapsed, point the chevron to the right. */
.toc-panel.toc-collapsed .toc-toggle svg {
  transform: rotate(180deg);
}

.toc-empty {
  padding: 8px 4px;
  font-size: 0.92rem;
  opacity: 0.75;
}

.area-uni-section {
  margin-top: 14px;
}

.area-uni-grid {
  display: grid;
  gap: 8px;
}

.area-uni-card {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(0,0,0,0.45);
  border-radius: 14px;
  background-image:
    radial-gradient(140px 120px at 20% 15%, rgba(255,255,255,0.22), rgba(255,255,255,0.00) 60%),
    radial-gradient(180px 140px at 85% 80%, rgba(0,0,0,0.22), rgba(0,0,0,0.00) 62%),
    linear-gradient(
      142deg,
      var(--uni-c1, #1b1b1b) 0%,
      var(--uni-c2, var(--uni-c1, #1b1b1b)) 60%,
      var(--uni-c1, #1b1b1b) 80%,
      var(--uni-c1, #1b1b1b) 100%
    );
  color: #fff;
  padding: 10px 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 120ms ease, border-color 120ms ease, filter 120ms ease;
}

.area-uni-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.10), rgba(0,0,0,0.34));
  pointer-events: none;
}

.area-uni-card > * {
  position: relative;
}

.area-uni-card:hover {
  border-color: rgba(255,255,255,0.18);
  filter: saturate(1.05) brightness(1.03);
}

.area-uni-card:active {
  transform: translateY(1px);
}

.area-uni-name {
  font-size: 15px;
  font-weight: 900;
  line-height: 1.15;
}

.area-uni-motto {
  margin-top: 2px;
  font-size: 13px;
  opacity: 0.92;
  line-height: 1.2;
}

@media (max-width: 768px) {
  .toc-panel {
    top: 12px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }
}

.hotspot-dom-marker {
  width: 56px;
  height: 56px;
  border: 0;
  padding: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  cursor: pointer;
}
