:root {
  /* Desaturated Editorial Blue-Slate & Aged-Brass Palette (calm, high text contrast) */
  --ink: #efe7d4;
  --ink-dim: #aeb7c0;
  --ink-faint: rgba(218, 222, 226, 0.54);
  --gold: #c6ab6d;
  --gold-bright: #e6d19c;
  --gold-line: rgba(198, 171, 109, 0.48);
  --gold-line-soft: rgba(198, 171, 109, 0.22);
  --panel: rgba(17, 25, 36, 0.96);
  --panel-2: rgba(27, 39, 54, 0.96);
  --seal: #8f473e;
  --jade: #6fa18e;
  --sky: #78a3ba;
  --amber: #c49c64;
  --violet: #9e8cb2;
  --good: #93b87e;
  --bad: #c98675;
  --warn: #cbb07a;

  /* Typography */
  --serif: "Palatino Linotype", "Songti SC", "Noto Serif SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Noto Sans SC", "Hiragino Sans GB", sans-serif;

  /* Unified Apple-calibrated motion grammar */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 90ms;
  --t-fast: 150ms;
  --t-ui: 220ms;
  --t-drawer: 280ms;

  --topbar-base-h: 40px;
  --topbar-h: var(--topbar-base-h);
  --dock-w: 432px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #162939;
  color: var(--ink);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  user-select: none;
}

.hex-canvas {
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  width: 100vw;
  height: calc(100vh - var(--topbar-h));
  display: block;
  cursor: grab;
  touch-action: none;
}
.hex-canvas.grabbing { cursor: grabbing; }
.hex-canvas.pointer { cursor: pointer; }

.civ-panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-line);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65), 0 8px 24px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 235, 190, 0.08);
  border-radius: 6px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.atlas-almanac {
  width: min(680px, calc(100% - 24px));
  max-height: min(740px, calc(100dvh - 28px));
  padding: 16px;
  color: var(--ink);
  background: var(--panel);
}
.atlas-almanac[open] { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 12px; }
.atlas-almanac::backdrop { background: #08111ab8; }
.atlas-almanac header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.atlas-almanac h2, .atlas-almanac h3 { margin: 0; font-family: var(--serif); color: var(--gold-bright); }
.atlas-almanac nav { display: flex; flex-wrap: wrap; gap: 5px; }
.atlas-almanac nav [aria-current] { background: #876a37; color: #fff3d5; }
.atlas-almanac section { overflow: auto; overscroll-behavior: contain; line-height: 1.55; padding: 8px; }
.atlas-almanac dl { display: grid; gap: 8px; }
.atlas-almanac dt { font-weight: 700; }
.atlas-almanac dd { margin: 0 0 6px; color: var(--ink-dim); }
.atlas-almanac a { color: var(--gold-bright); text-underline-offset: 3px; }

/* ==================== TOP BAR (responsive 1440 / 1040 / 390px) ==================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: var(--topbar-base-h);
  z-index: 30;
  background: linear-gradient(180deg, #222e3b, #17202b);
  border-bottom: 1px solid rgba(181, 160, 116, 0.55);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.48), inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.tb-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--topbar-base-h);
  padding: 0 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  background: none;
  padding: 2px 5px 2px 2px;
  border-radius: 5px;
  cursor: pointer;
  flex: none;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.brand:hover { background: rgba(201, 164, 92, 0.12); border-color: rgba(201, 164, 92, 0.35); }
.brand:active { transform: scale(0.96); }

.brand-emblem {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9c5349, #6b342e);
  border: 1px solid var(--gold-bright);
  color: #f4eee0;
  font-weight: 700;
  font-size: 12.5px;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4);
  flex: none;
}

.brand-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.11em;
  color: var(--gold-bright);
  white-space: nowrap;
}

.preview-tag {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--ink-dim);
  background: rgba(201, 164, 92, 0.12);
  border: 1px solid rgba(201, 164, 92, 0.32);
  white-space: nowrap;
}

.yields {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-width: 0;
  margin-left: 4px;
}

.yield-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.yield-chip:hover {
  background: rgba(201, 164, 92, 0.16);
  border-color: rgba(201, 164, 92, 0.42);
}
.yield-chip:active { transform: scale(0.96); }
.y-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  flex: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
.y-ico svg { width: 15px; height: 15px; display: block; }
.yield-chip .y-dot {
  width: 6.5px;
  height: 6.5px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 5px currentColor;
}
.yield-chip .y-lbl { font-size: 10px; color: var(--ink-dim); font-weight: 500; }

/* Compact national yields dropdown (shown at <= 1280px including 1040px & 390px!) */
.yields-compact-wrap {
  position: relative;
  display: none;
  flex: none;
}
.tb-btn.yields-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 0 8px;
  white-space: nowrap;
}
.yt-narrow { display: none; }
.yt-caret { font-size: 10px; color: var(--gold-bright); transition: transform var(--t-fast) var(--ease-out); }
.yields-trigger[aria-expanded="true"] .yt-caret { transform: rotate(180deg); }

.yields-popover {
  position: absolute;
  top: 34px;
  left: 0;
  width: 320px;
  max-width: calc(100vw - 20px);
  padding: 10px 12px;
  z-index: 45;
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.yields-popover.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.yp-head {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.yp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.yp-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 5px;
  border: 1px solid rgba(201, 164, 92, 0.26);
  background: rgba(8, 14, 22, 0.56);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.yp-item:hover { border-color: var(--gold-bright); background: rgba(201, 164, 92, 0.14); }
.yp-lbl { font-size: 10.5px; color: var(--ink-dim); display: flex; align-items: center; gap: 5px; }
.yp-val { font-size: 13.5px; font-weight: 700; }
.yp-src { font-size: 10px; color: var(--ink-faint); }
.yp-foot { margin-top: 8px; font-size: 10.5px; color: var(--ink-dim); line-height: 1.45; }

.spacer { flex: 1; min-width: 2px; }

/* Mode Switcher inside Topbar */
.mode-seg {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 2px;
  border-radius: 5px;
  background: rgba(8, 14, 21, 0.56);
  border: 1px solid rgba(201, 164, 92, 0.34);
  flex: none;
}
.seg-thumb {
  position: absolute;
  top: 2px;
  left: 0;
  height: 22px;
  border-radius: 3px;
  background: linear-gradient(180deg, rgba(201, 164, 92, 0.34), rgba(145, 112, 48, 0.24));
  border: 1px solid rgba(236, 208, 142, 0.62);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  transition: transform var(--t-ui) var(--ease-out), width var(--t-ui) var(--ease-out);
  pointer-events: none;
}
.seg-btn {
  position: relative;
  z-index: 1;
  border: none;
  background: transparent;
  color: var(--ink-dim);
  height: 22px;
  padding: 0 10px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.seg-btn:hover { color: var(--ink); }
.seg-btn:active { transform: scale(0.96); }
.seg-btn.active { color: var(--gold-bright); }

/* Search Input in Topbar */
.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 7px;
  width: 178px;
  min-width: 110px;
  border-radius: 5px;
  background: rgba(8, 14, 21, 0.65);
  border: 1px solid rgba(201, 164, 92, 0.36);
  transition: width var(--t-ui) var(--ease-out), border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.search-box:focus-within {
  width: 224px;
  border-color: var(--gold-bright);
  background: rgba(8, 14, 21, 0.92);
}
.search-box .ic { color: var(--ink-dim); flex: none; }
.search-box input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-size: 12px;
  font-family: inherit;
}
.search-box input::placeholder { color: rgba(181, 168, 137, 0.62); }
.search-kbd {
  flex: none;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
  border-radius: 3px;
  border: 1px solid rgba(201, 164, 92, 0.35);
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.04);
}

.search-dropdown {
  position: absolute;
  top: 34px;
  right: 0;
  width: 286px;
  max-width: calc(100vw - 20px);
  max-height: 310px;
  overflow-y: auto;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold);
  border-radius: 6px;
  padding: 5px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.62);
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
  z-index: 46;
}
.search-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink);
  transition: background var(--t-press) var(--ease-out);
}
.search-item:hover, .search-item.kb-active {
  background: rgba(201, 164, 92, 0.22);
  color: var(--gold-bright);
}
.search-item .sub { font-size: 11px; color: var(--ink-dim); white-space: nowrap; }

.tb-buttons { display: flex; gap: 4px; flex: none; }
#btn-utilities { display: none; }
#utility-menu {
  position: fixed;
  top: calc(var(--topbar-h) + 6px);
  right: 8px;
  z-index: 34;
  display: grid;
  gap: 4px;
  padding: 6px;
}
#utility-menu[hidden] { display: none; }
#utility-menu .tb-btn { justify-content: flex-start; min-height: 36px; padding: 4px 10px; }
#share-address {
  width: 100%;
  padding: 6px;
  margin-top: 4px;
  border: 1px solid var(--gold-line);
  border-radius: 4px;
  background: #182431;
  color: var(--ink);
  font: inherit;
  font-size: 11px;
}
.tb-btn {
  display: inline-grid;
  place-items: center;
  height: 28px;
  min-width: 28px;
  padding: 0 7px;
  border-radius: 4px;
  border: 1px solid rgba(201, 164, 92, 0.42);
  background: linear-gradient(180deg, #32465c, #1d2b3b);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), filter var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.tb-btn.tb-text { font-size: 11.5px; padding: 0 8px; white-space: nowrap; }
.tb-btn.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 0 8px;
  white-space: nowrap;
  color: var(--gold-bright);
  border-color: rgba(181, 160, 116, 0.56);
}
.tb-btn:hover { border-color: var(--gold-bright); filter: brightness(1.12); color: var(--gold-bright); }
.tb-btn:active { transform: scale(0.94); }

/* ==================== TOP-LEFT FOCUS BADGE ==================== */
.focus-badge {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  left: 12px;
  z-index: 22;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 6px 10px 6px 9px;
  background: linear-gradient(180deg, rgba(28, 37, 47, 0.94), rgba(19, 26, 35, 0.95));
  border: 1px solid var(--gold-line);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.42);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity var(--t-ui) var(--ease-out), transform var(--t-ui) var(--ease-out);
}
.fb-row { display: inline-flex; align-items: center; gap: 7px; }
.fb-note { font-size: 10px; color: var(--ink-dim); letter-spacing: 0.02em; padding-left: 17px; }
.focus-badge.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.fb-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  flex: none;
}
.fb-title {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
}
.fb-sub { font-size: 11px; color: var(--ink-dim); }
.fb-close {
  border: 1px solid rgba(201, 164, 92, 0.35);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink-dim);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
  transition: color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.fb-close:hover { color: var(--gold-bright); border-color: var(--gold-bright); }

/* ==================== CURSOR-FOLLOWING TOOLTIP ==================== */
.tooltip {
  position: fixed;
  z-index: 45;
  pointer-events: none;
  max-width: 320px;
  padding: 7px 10px;
  border-radius: 6px;
  background: rgba(13, 21, 31, 0.96);
  border: 1px solid rgba(201, 164, 92, 0.62);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 235, 190, 0.08);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.48;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 110ms var(--ease-out), transform 110ms var(--ease-out);
}
.tooltip.visible {
  opacity: 1;
  transform: scale(1);
}
.tooltip b { color: var(--gold-bright); font-family: var(--serif); font-weight: 700; }
.tooltip .muted { color: var(--ink-dim); }
.tooltip .tip-hint { display: block; margin-top: 2px; font-size: 11px; color: rgba(236, 208, 142, 0.78); }

/* ==================== BOTTOM-RIGHT CIV LENS RIBBON + IN-PLACE SOURCE POPOVER ==================== */
.lens-area {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 22;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-width: calc(100vw - 254px);
  transition: transform var(--t-drawer) var(--ease-out), max-width var(--t-drawer) var(--ease-out);
}
body.inspector-open .lens-area {
  transform: translateX(calc(-1 * var(--dock-w)));
  max-width: calc(100vw - var(--dock-w) - 254px);
}

.legend-popover {
  width: 440px;
  max-width: min(440px, calc(100vw - 24px));
  padding: 10px 12px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink);
  display: none;
}
.legend-popover.open {
  display: block;
  animation: dockEnter var(--t-fast) var(--ease-out);
}
.lp-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--serif);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 6px;
}
.lp-close {
  border: 1px solid rgba(201, 164, 92, 0.35);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink-dim);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
}
.lp-close:hover { color: var(--gold-bright); border-color: var(--gold-bright); }
.lp-row { margin: 3px 0; color: var(--ink-dim); }
.lp-row b { color: var(--ink); font-weight: 600; }

.legend-bar {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 5px 9px;
  font-size: 11.5px;
  color: var(--ink-dim);
  max-width: 100%;
}
.legend-bar strong { color: var(--gold-bright); font-weight: 600; }

.info-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(201, 164, 92, 0.44);
  background: rgba(201, 164, 92, 0.12);
  color: var(--gold-bright);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.info-pill-btn:hover, .info-pill-btn[aria-expanded="true"] {
  background: rgba(201, 164, 92, 0.26);
  border-color: var(--gold-bright);
}

.lens-dock {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 5px 6px;
  max-width: 100%;
  border-color: rgba(206, 176, 112, 0.56);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.72), 0 10px 26px rgba(0, 0, 0, 0.54), inset 0 1px 0 rgba(255, 236, 186, 0.12);
}
.lens-dock.entering {
  animation: dockEnter var(--t-ui) var(--ease-out);
}
@keyframes dockEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.lens-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid rgba(198, 171, 109, 0.28);
  background: linear-gradient(180deg, rgba(30, 44, 60, 0.72), rgba(16, 25, 36, 0.85));
  color: var(--ink-dim);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.lens-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  opacity: 0.88;
  flex: none;
}
.lens-ico svg { width: 13px; height: 13px; display: block; }
.lens-btn:hover {
  background: linear-gradient(180deg, rgba(58, 72, 88, 0.78), rgba(28, 39, 52, 0.92));
  border-color: rgba(226, 198, 136, 0.62);
  color: var(--ink);
}
.lens-btn:active { transform: scale(0.95); }
.lens-btn.active {
  background: linear-gradient(180deg, rgba(132, 105, 48, 0.92), rgba(76, 58, 24, 0.96));
  border-color: var(--gold-bright);
  color: #fff6de;
  box-shadow: inset 0 1px 0 rgba(255, 240, 192, 0.34), 0 0 10px rgba(216, 184, 108, 0.22);
}
.lens-btn.active .lens-ico { opacity: 1; color: #ffe7a8; }
.lens-btn.accent.active {
  background: linear-gradient(180deg, #b83d2e, #86261b);
  border-color: #f3c87a;
  color: #fff6e6;
}
.lens-btn.subtle {
  background: transparent;
  border-color: transparent;
  padding: 0 7px;
  color: rgba(181, 168, 137, 0.72);
}
.lens-btn.subtle:hover { background: rgba(255, 255, 255, 0.06); color: var(--ink); }
.lens-btn.subtle.on {
  border-color: rgba(201, 164, 92, 0.45);
  background: rgba(201, 164, 92, 0.14);
  color: var(--gold-bright);
}
.lens-btn .cnt { font-size: 10.5px; opacity: 0.78; }
.lens-btn .batch-tag {
  font-size: 9.5px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(201, 164, 92, 0.16);
  color: var(--gold-bright);
  font-weight: 500;
}

.dock-divider {
  width: 1px;
  height: 18px;
  background: rgba(201, 164, 92, 0.28);
  margin: 0 2px;
}

.legend-strip { display: inline-flex; align-items: center; gap: 6px; }
.grad-bar { width: 104px; height: 7px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.22); }
.lens-histogram { display: inline-flex; align-items: center; gap: 4px; }
.lens-histogram-bars { display: inline-flex; align-items: stretch; height: 24px; gap: 1px; touch-action: pan-y; }
.lens-histogram-bars button {
  position: relative;
  width: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: crosshair;
}
.lens-histogram-bars button::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--bin-height);
  border-radius: 2px 2px 0 0;
  background: var(--bin-color);
}
.lens-histogram-bars button:disabled { opacity: .26; cursor: default; }
.lens-histogram-bars button:is(:hover, :focus-visible, [aria-pressed="true"])::after {
  box-shadow: inset 0 0 0 1px var(--ink);
}
.lens-histogram [hidden] { display: none; }
.lens-picker { width: min(365px, calc(100vw - 20px)); padding: 12px; }
.lens-picker[hidden] { display: none; }
.lens-picker-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.lens-picker-grid .lens-btn { height: auto; min-height: 50px; flex-direction: column; align-items: flex-start; text-align: left; padding: 5px 8px; }
.lens-picker-grid small { color: var(--ink-dim); font-size: 10px; white-space: normal; }
.swatch-row { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.swatch { display: inline-flex; align-items: center; gap: 4px; }
.swatch i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.4); }

/* ==================== BOTTOM-LEFT PANORAMIC CIV MINIMAP ==================== */
.minimap-wrap {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 21;
  padding: 5px;
  cursor: crosshair;
  border: 1.5px solid rgba(206, 176, 112, 0.62);
  border-radius: 7px;
  background: linear-gradient(180deg, #243446, #131e2b);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.78), 0 12px 28px rgba(0, 0, 0, 0.56), inset 0 1px 0 rgba(255, 238, 192, 0.14);
  transition: opacity var(--t-ui) var(--ease-out);
}
.minimap-wrap canvas {
  display: block;
  border-radius: 4px;
  border: 1px solid rgba(198, 171, 109, 0.28);
}
.minimap-toggle { display: none; }
.iw-lb-summary-row { display: grid; gap: 4px; padding: 8px; font-size: 12px; }
body.advisor-docked .lens-area {
  right: calc(var(--advisor-width) + 12px);
  max-width: calc(100vw - var(--advisor-width) - 24px);
  transform: none;
}
#transport-attribution {
  position: fixed;
  left: 16px;
  bottom: 2px;
  z-index: 22;
  color: var(--ink);
  font-size: 9px;
  padding: 0 4px;
  background: #182735;
}
.ml-toggle-row:disabled { opacity: .56; cursor: default; }

/* ==================== DOCKED RIGHT SPLIT-SCREEN CITY VIEW ==================== */
.cv-dock {
  position: fixed;
  top: var(--topbar-h);
  right: 0;
  bottom: 0;
  width: var(--dock-w);
  max-width: 100vw;
  z-index: 25;
  display: flex;
  flex-direction: column;
  background: radial-gradient(120% 42% at 50% 0%, rgba(50, 66, 82, 0.36), transparent 65%), linear-gradient(180deg, #1d2733, #141c26);
  border-left: 1.5px solid rgba(181, 160, 116, 0.48);
  box-shadow: -2px 0 0 rgba(10, 14, 19, 0.85), -10px 0 28px rgba(0, 0, 0, 0.46), inset 1px 0 0 rgba(255, 240, 208, 0.06);
  color: var(--ink);
  transform: translateX(102%);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--t-drawer) var(--ease-out), opacity var(--t-ui) var(--ease-out);
  overscroll-behavior: contain;
}
.cv-dock.open {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.cv-head {
  position: relative;
  flex: none;
  padding: 12px 16px 10px 18px;
  background: linear-gradient(180deg, rgba(255, 235, 190, 0.06), rgba(0, 0, 0, 0.08));
  border-bottom: 1px solid var(--gold-line-soft);
}
.cv-ribbon {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  background: linear-gradient(180deg, var(--accent-sc, #c9a45c), rgba(16, 25, 36, 0.9));
  box-shadow: 1px 0 0 rgba(236, 208, 142, 0.35);
}
.cv-close {
  position: absolute;
  top: 10px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(201, 164, 92, 0.48);
  background: rgba(0, 0, 0, 0.34);
  color: var(--ink-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transition: color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.cv-close:hover { color: var(--gold-bright); border-color: var(--gold-bright); }
.cv-close:active { transform: scale(0.92); }

.cv-title-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-right: 34px;
}
.cv-crest {
  flex: none;
  width: 44px;
  height: 48px;
  display: grid;
  place-items: center;
  position: relative;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(180deg, #f0d48c, #8a6d34);
}
.cv-crest::before {
  content: "";
  position: absolute;
  inset: 2.5px;
  clip-path: inherit;
  background: radial-gradient(circle at 50% 28%, var(--accent-sc, #3b6f9c), #132131);
}
.cv-crest span {
  position: relative;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 16px;
  color: #fff8e8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.cv-kind {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.cv-name {
  margin: 1px 0 0;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--gold-bright);
  text-shadow: 0 1px 0 #0b0e14;
}
.cv-sub {
  font-size: 11.5px;
  color: var(--ink-dim);
  margin-top: 2px;
}

.cv-tabs {
  flex: none;
  display: flex;
  overflow-x: auto;
  gap: 3px;
  padding: 6px 10px;
  background: linear-gradient(180deg, #1b2939, #131e2c);
  border-bottom: 1px solid var(--gold-line);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

/* 2-Step USACiv City Summary <-> 7-Hex City View CTA Bar */
.cv-cta-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(24, 36, 50, 0.94), rgba(14, 22, 32, 0.96));
  border-bottom: 1px solid var(--gold-line);
}
.cv-enter-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 5px;
  border: 1px solid #f0d794;
  background: linear-gradient(180deg, #d7b76e 0%, #b38d42 54%, #95702e 100%);
  color: #131a22;
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 0 rgba(255, 245, 214, 0.38);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 248, 224, 0.55);
  cursor: pointer;
  transition: filter var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.cv-enter-btn:hover {
  filter: brightness(1.08);
  box-shadow: 0 3px 14px rgba(215, 183, 110, 0.36), inset 0 1px 0 rgba(255, 248, 224, 0.72);
}
.cv-enter-btn:active { transform: scale(0.985); }
.cv-enter-sub {
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(19, 26, 34, 0.8);
  text-shadow: none;
  white-space: nowrap;
}
.cv-enter-arrow {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1;
  font-weight: 800;
}
.cv-exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid rgba(230, 209, 156, 0.52);
  background: rgba(198, 171, 109, 0.14);
  color: var(--gold-bright);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.cv-exit-btn:hover {
  background: rgba(198, 171, 109, 0.26);
  border-color: var(--gold-bright);
}
.cv-exit-btn:active { transform: scale(0.97); }
.cv-cta-hint {
  font-size: 10.5px;
  color: var(--ink-dim);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cv-tab {
  flex: 1 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 5px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-dim);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.cv-tab:hover { color: var(--gold-bright); border-color: rgba(201, 164, 92, 0.3); }
.cv-tab.on {
  color: var(--gold-bright);
  background: linear-gradient(180deg, rgba(201, 164, 92, 0.24), rgba(201, 164, 92, 0.08));
  border-color: rgba(236, 208, 142, 0.62);
}

.cv-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 15px 20px;
}
.cv-scroll.swapping {
  animation: bodySwap 180ms var(--ease-out);
}
@keyframes bodySwap {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.cv-scroll::-webkit-scrollbar { width: 6px; }
.cv-scroll::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.2); }
.cv-scroll::-webkit-scrollbar-thumb { background: rgba(201, 164, 92, 0.35); border-radius: 3px; }

/* Section Heading with Scope Tag + Gold Hairline */
.cv-sec-h {
  margin: 14px 0 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--serif);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
}
.cv-sec-h:first-child { margin-top: 2px; }
.cv-sec-h::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-line), transparent);
}
.scope-tag {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 3px;
  white-space: nowrap;
}
.scope-tag.city { background: rgba(92, 195, 242, 0.18); color: #8ad6fa; border: 1px solid rgba(92, 195, 242, 0.38); }
.scope-tag.prov { background: rgba(201, 164, 92, 0.18); color: var(--gold-bright); border: 1px solid rgba(201, 164, 92, 0.38); }
.scope-tag.hex { background: rgba(76, 194, 156, 0.16); color: #84dfc0; border: 1px solid rgba(76, 194, 156, 0.36); }

/* 2-Column Medallion Metric Cards — ZERO truncation on numbers! */
.cv-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 10px;
}
.cv-tile {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 5px;
  background: rgba(14, 21, 29, 0.54);
  border: 1px solid rgba(181, 160, 116, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.04);
  min-width: 0;
}
.cv-tile.span-2 { grid-column: 1 / -1; }
.cv-medallion {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 2px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-bright);
  background: rgba(181, 160, 116, 0.10) !important;
  border: 1px solid rgba(181, 160, 116, 0.28);
  box-shadow: none;
}

/* Landmark Breadcrumb & District Strip inside Right Panel */
.lm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 14px;
  background: rgba(15, 22, 31, 0.85);
  border-bottom: 1px solid var(--gold-line-soft);
}
.lm-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid rgba(181, 160, 116, 0.42);
  background: rgba(181, 160, 116, 0.10);
  color: var(--gold-bright);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.lm-back:hover { background: rgba(181, 160, 116, 0.22); border-color: var(--gold-bright); }
.lm-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 4px 0 10px;
}
.lm-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid rgba(181, 160, 116, 0.28);
  background: rgba(14, 21, 29, 0.56);
  color: var(--ink-dim);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.lm-chip:hover { border-color: var(--gold-bright); color: var(--ink); }
.lm-chip.on {
  border-color: var(--gold-bright);
  background: rgba(181, 160, 116, 0.20);
  color: var(--gold-bright);
}
.cv-tile-body { min-width: 0; flex: 1; }
.cv-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.cv-tile-lbl {
  font-size: 11px;
  color: var(--ink-dim);
  line-height: 1.3;
}
.cv-tile-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin-top: 2px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.cv-tile-val.muted-val { color: var(--ink-dim); font-weight: 600; font-size: 12.5px; }
.cv-tile-sub {
  font-size: 10.5px;
  color: var(--ink-dim);
  line-height: 1.35;
  margin-top: 2px;
}
.cv-badge {
  flex: none;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.cv-badge.hi { background: rgba(127, 191, 63, 0.22); color: #b5e67f; border: 1px solid rgba(159, 215, 106, 0.35); }
.cv-badge.lo { background: rgba(240, 138, 106, 0.16); color: #f2a288; border: 1px solid rgba(240, 138, 106, 0.3); }
.cv-badge.gold { background: rgba(201, 164, 92, 0.2); color: var(--gold-bright); border: 1px solid rgba(201, 164, 92, 0.38); }
.cv-badge.warn { background: rgba(244, 184, 96, 0.2); color: #ffd48a; border: 1px solid rgba(244, 184, 96, 0.45); }

/* Inline Collapsible Source / Scope Notes right where needed */
.cv-meta-details {
  margin: 6px 0 10px;
  border-radius: 5px;
  border: 1px solid rgba(201, 164, 92, 0.22);
  background: rgba(8, 14, 22, 0.42);
  font-size: 11px;
  color: var(--ink-dim);
}
.cv-meta-details summary {
  padding: 6px 9px;
  cursor: pointer;
  color: var(--gold-bright);
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cv-meta-details summary::-webkit-details-marker { display: none; }
.cv-meta-details summary::after { content: "▾"; font-size: 10px; color: var(--gold); }
.cv-meta-details[open] summary::after { content: "▴"; }
.cv-meta-body {
  padding: 0 9px 8px;
  line-height: 1.55;
  border-top: 1px dashed rgba(201, 164, 92, 0.18);
  padding-top: 6px;
}
.cv-meta-body div { margin: 2px 0; }
.cv-meta-body b { color: var(--ink); font-weight: 600; }

/* Clickable Channel / Resource Rows */
.cv-list { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.cv-row-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 5px;
  background: rgba(8, 14, 22, 0.48);
  border: 1px solid rgba(201, 164, 92, 0.24);
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.cv-row-btn:hover {
  border-color: var(--gold-bright);
  background: rgba(201, 164, 92, 0.14);
}
.cv-row-btn:active { transform: scale(0.99); }
.cv-row-btn .rb-main { min-width: 0; }
.cv-row-btn .rb-t { font-size: 12.5px; font-weight: 600; color: var(--gold-bright); }
.cv-row-btn .rb-s { font-size: 11px; color: var(--ink-dim); margin-top: 1px; }
.cv-row-btn .rb-v { flex: none; font-size: 12px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.cv-row-btn .rb-v.out { color: var(--amber); }
.cv-row-btn .rb-v.in { color: var(--jade); }
.cv-row-btn .rb-v.rail { color: var(--sky); }

/* Mini Bar Rows */
.mini-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  margin: 5px 0;
  color: var(--ink);
}
.mini-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  overflow: hidden;
}
.mini-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #4393b8, #70d2f0);
  transition: width 320ms var(--ease-out);
}
.mini-bar-fill.warm { background: linear-gradient(90deg, #c98636, #f0c96e); }
.mini-bar-fill.jade { background: linear-gradient(90deg, #2d8a6e, #67d8b3); }

/* COMPARE Peer Provinces Table */
.cv-cmp-note { font-size: 11px; color: var(--ink-dim); margin: 0 0 8px; line-height: 1.45; }
.cv-cmp-table { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.cv-cmp-table th {
  text-align: left;
  padding: 4px 5px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--gold-line-soft);
}
.cv-cmp-table th.num, .cv-cmp-table td.num { text-align: right; }
.cv-cmp-row {
  cursor: pointer;
  border-bottom: 1px solid rgba(201, 164, 92, 0.12);
  transition: background var(--t-fast) var(--ease-out);
}
.cv-cmp-row:hover { background: rgba(201, 164, 92, 0.14); }
.cv-cmp-row.self { background: rgba(76, 194, 156, 0.12); }
.cv-cmp-row td { padding: 7px 5px; vertical-align: middle; }
.cmp-city { font-family: var(--serif); font-weight: 700; color: var(--gold-bright); font-size: 12.5px; }
.cmp-prov { font-size: 10px; color: var(--ink-dim); display: block; }
.cmp-bar { height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); margin-top: 3px; overflow: hidden; }
.cmp-bar i { display: block; height: 100%; border-radius: 2px; background: var(--sky); }
.cv-cmp-row.self .cmp-bar i { background: var(--jade); }

/* Chips & Heritage Search */
.partner-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.p-chip {
  border: 1px solid rgba(201, 164, 92, 0.34);
  background: rgba(8, 14, 22, 0.55);
  color: var(--ink);
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.p-chip:hover { border-color: var(--gold-bright); background: rgba(201, 164, 92, 0.16); color: var(--gold-bright); }
.p-chip:active { transform: scale(0.95); }
.tag-chip {
  display: inline-block;
  border: 1px solid rgba(201, 164, 92, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-dim);
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
}

.her-filter {
  width: 100%;
  padding: 7px 10px;
  border-radius: 5px;
  border: 1px solid rgba(201, 164, 92, 0.38);
  background: rgba(8, 14, 22, 0.72);
  color: var(--ink);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  margin-bottom: 8px;
}
.her-filter:focus { border-color: var(--gold-bright); }
.her-filter::placeholder { color: rgba(181, 168, 137, 0.6); }

.her-list { display: flex; flex-direction: column; gap: 5px; }
.her-row {
  background: rgba(8, 14, 22, 0.48);
  border: 1px solid rgba(201, 164, 92, 0.2);
  border-radius: 5px;
  padding: 7px 9px;
  transition: border-color 140ms ease, background 140ms ease;
}
.her-row.her-locatable { cursor: pointer; }
.her-row.her-locatable:hover,
.her-row.her-locatable:focus-visible {
  background: rgba(24, 34, 52, 0.78);
  border-color: rgba(226, 188, 112, 0.65);
  outline: none;
}
.her-row.her-locatable.active {
  background: rgba(58, 44, 18, 0.56);
  border-color: #f0d080;
  box-shadow: 0 0 0 1px rgba(240, 208, 128, 0.35);
}
.her-row-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.her-loc-pill {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  border: 1px solid rgba(201, 164, 92, 0.36);
  background: rgba(201, 164, 92, 0.12);
  color: #ebd08c;
}
.her-loc-pill.exact {
  border-color: rgba(134, 222, 178, 0.55);
  background: rgba(34, 94, 72, 0.42);
  color: #c8fae0;
}
.her-loc-pill.county {
  border-color: rgba(226, 188, 112, 0.52);
  background: rgba(74, 56, 20, 0.42);
  color: #f4dca0;
}
.her-loc-pill.city {
  border-color: rgba(126, 198, 240, 0.5);
  background: rgba(24, 58, 86, 0.45);
  color: #cceaff;
}
.her-loc-pill.prov {
  border-color: rgba(176, 168, 192, 0.34);
  background: rgba(46, 42, 62, 0.4);
  color: #cec4dd;
}
.her-row-t { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.her-row-m { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }

.more-btn {
  width: 100%;
  padding: 7px 10px;
  margin-top: 4px;
  border-radius: 5px;
  border: 1px solid rgba(201, 164, 92, 0.45);
  background: rgba(201, 164, 92, 0.12);
  color: var(--gold-bright);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.more-btn:hover { background: rgba(201, 164, 92, 0.24); }

.cv-source {
  font-size: 10.5px;
  color: var(--ink-faint);
  line-height: 1.5;
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid rgba(201, 164, 92, 0.16);
}

/* ==================== INSPECTOR VISUAL WIDGETS (.iw-*) ==================== */
.cv-scroll { overflow-x: hidden; }

.iw-card {
  margin: 8px 0 10px;
  padding: 9px 10px;
  border-radius: 6px;
  background: rgba(11, 18, 26, 0.56);
  border: 1px solid rgba(198, 171, 109, 0.24);
  box-shadow: inset 0 1px 0 rgba(255, 240, 210, 0.04);
  min-width: 0;
}

.iw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 7px;
  min-width: 0;
}
.iw-title {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gold-bright);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iw-head-right {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
}
.iw-tick-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 9.5px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.iw-tick-sample {
  display: inline-block;
  width: 2px;
  height: 9px;
  border-radius: 1px;
  background: var(--gold-bright);
}
.iw-muted-inline {
  font-size: 10.5px;
  color: var(--ink-dim);
  white-space: nowrap;
}

/* KPI Strip (Cluster Telemetry) */
.iw-kpi-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-bottom: 8px;
}
.iw-kpi {
  padding: 6px 8px;
  border-radius: 5px;
  background: rgba(18, 28, 39, 0.65);
  border: 1px solid rgba(198, 171, 109, 0.16);
  min-width: 0;
}
.iw-kpi-lbl { font-size: 10px; color: var(--ink-dim); line-height: 1.3; }
.iw-kpi-val {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
  line-height: 1.25;
}
.iw-kpi-val small { font-size: 10.5px; font-weight: 600; color: var(--ink-dim); }
.iw-kpi-sub { font-size: 10px; color: var(--ink-dim); margin-top: 2px; }
.iw-delta { font-style: normal; font-weight: 700; }
.iw-delta.hi { color: var(--good); }
.iw-delta.lo { color: var(--bad); }

/* Stacked Horizontal Bars & Legends */
.iw-stack-wrap { min-width: 0; }
.iw-stack-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10.5px;
  color: var(--ink-dim);
  margin-bottom: 4px;
}
.iw-callout-pill {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(196, 156, 100, 0.18);
  border: 1px solid rgba(196, 156, 100, 0.42);
  color: var(--gold-bright);
  white-space: nowrap;
}
.iw-callout-pill b { color: var(--ink); }

.iw-stack-bar {
  display: flex;
  width: 100%;
  height: 10px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  gap: 1px;
}
.iw-stack-bar.iw-age-bar { height: 15px; }
.iw-stack-bar.iw-slim-bar { height: 8px; }

.iw-seg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(13, 20, 29, 0.92);
  white-space: nowrap;
  overflow: hidden;
}
.seg-urban { background: #c4846a; }
.seg-crop { background: #c9b06b; }
.seg-forest { background: #5e967c; }
.seg-other { background: #556b7d; }
.seg-age0 { background: #73a6c2; }
.seg-age15 { background: #6fa690; }
.seg-age60 { background: #cba262; }
.seg-ug { background: #c9ab67; }
.seg-voc { background: #64998a; }
.seg-dom { background: #6494b0; }
.seg-hk { background: #c8a866; }
.seg-intl { background: #6fb298; }
.seg-gold { background: #e6d19c; }
.seg-jade { background: #7ec7ac; }
.seg-edu-col { background: #d6ba78; }
.seg-edu-hs { background: #74a9c4; }
.seg-edu-jh { background: #6aa18c; }
.seg-edu-pri { background: #9c8aad; }
.seg-edu-oth { background: #4c5e6e; }
.seg-lu-res { background: #c9a66b; }
.seg-lu-ind { background: #b57b66; }
.seg-lu-grn { background: #679f87; }
.seg-lu-oth { background: #5a7288; }

.iw-edu-wrap {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(198, 171, 109, 0.18);
}
.iw-mf-pill {
  display: inline-block;
  color: var(--ink-dim);
  white-space: nowrap;
}
.iw-scope-note {
  margin-top: 6px;
  font-size: 9.5px;
  color: var(--ink-faint);
  line-height: 1.4;
}

.iw-legend-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 10px;
  margin-top: 5px;
  font-size: 10.5px;
  color: var(--ink-dim);
}
.iw-leg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.iw-leg i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex: none;
}
.iw-leg b { color: var(--ink); font-weight: 600; }

/* Demographics Bottom Split (Sex Ratio + Schooling) */
.iw-demo-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 8px;
}
.iw-mini-box {
  padding: 6px 8px;
  border-radius: 5px;
  background: rgba(18, 28, 39, 0.62);
  border: 1px solid rgba(198, 171, 109, 0.16);
  min-width: 0;
}
.iw-mini-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 5px;
}
.iw-mini-lbl { font-size: 10px; color: var(--ink-dim); white-space: nowrap; }
.iw-mini-val { font-size: 12px; font-weight: 700; color: var(--gold-bright); white-space: nowrap; }
.iw-mini-sub { font-size: 9.5px; color: var(--ink-dim); margin-top: 4px; line-height: 1.3; }

/* Benchmark Track with Crisp Vertical National-Average Tick Mark */
.iw-tick-track {
  position: relative;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: visible;
}
.iw-tick-base {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: rgba(210, 218, 226, 0.28);
  z-index: 1;
}
.iw-tick-fill {
  position: relative;
  height: 100%;
  border-radius: 999px;
  z-index: 2;
  transition: width 280ms var(--ease-out);
}
.iw-tick-fill.jade { background: linear-gradient(90deg, #3c7d68, #7bc7ab); }
.iw-tick-fill.gold { background: linear-gradient(90deg, #9d8042, #e4cc92); }
.iw-tick-fill.sky { background: linear-gradient(90deg, #3f7899, #7ac0e0); }
.iw-tick-fill.amber { background: linear-gradient(90deg, #a6763c, #deb26c); }
.iw-tick-fill.warn { background: linear-gradient(90deg, #b87e3c, #f0c272); }
.iw-tick-fill.muted { background: rgba(168, 178, 188, 0.42); }

.iw-nat-tick {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  transform: translateX(-1px);
  border-radius: 1px;
  background: var(--gold-bright);
  box-shadow: 0 0 0 1px rgba(10, 16, 24, 0.85), 0 0 6px rgba(230, 209, 156, 0.45);
  z-index: 3;
}

/* Urban Infrastructure Benchmark Rows */
.iw-bench-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.iw-bench-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.iw-bench-lbl {
  font-size: 11px;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.iw-bench-val {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 68px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.iw-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}
.iw-micro-chip {
  font-size: 10px;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(198, 171, 109, 0.2);
  border-radius: 4px;
  padding: 2px 6px;
}

.iw-metro-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  background: rgba(24, 37, 52, 0.65);
  border: 1px solid rgba(120, 163, 186, 0.3);
}
.iw-metro-left { display: flex; align-items: center; gap: 7px; min-width: 0; }
.iw-metro-ico {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: rgba(120, 163, 186, 0.16);
  color: #93c8e2;
  flex: none;
}
.iw-metro-ico svg { width: 13px; height: 13px; }
.iw-metro-t { font-size: 10px; color: var(--ink-dim); }
.iw-metro-v { font-size: 11.5px; color: var(--ink); margin-top: 1px; }
.iw-metro-v b { color: var(--gold-bright); }

/* Higher-Ed Collapsible Representative Universities */
.iw-uni-details {
  margin-top: 7px;
  border-top: 1px dashed rgba(198, 171, 109, 0.2);
  padding-top: 6px;
}
.iw-uni-details summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-bright);
  padding: 2px 0;
}
.iw-uni-details summary::-webkit-details-marker { display: none; }
.iw-uni-details summary::after { content: "▾"; font-size: 10px; color: var(--gold); }
.iw-uni-details[open] summary::after { content: "▴"; }
.iw-uni-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.iw-uni-chip {
  font-size: 10.5px;
  color: var(--ink);
  background: rgba(22, 33, 46, 0.78);
  border: 1px solid rgba(198, 171, 109, 0.26);
  border-radius: 4px;
  padding: 2px 7px;
}

/* Logistics Hub 6-Slot Badges & MIIT Clusters */
.iw-hub-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.iw-hub-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 600;
  min-width: 0;
}
.iw-hub-pill.active {
  background: rgba(198, 171, 109, 0.16);
  border: 1px solid rgba(230, 209, 156, 0.52);
  color: var(--gold-bright);
}
.iw-hub-pill.dim {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(174, 183, 192, 0.45);
}
.iw-hub-ico { display: inline-flex; flex: none; width: 13px; height: 13px; }
.iw-hub-ico svg { width: 13px; height: 13px; }
.iw-hub-lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iw-hub-chk { display: inline-flex; flex: none; width: 11px; height: 11px; color: var(--good); }
.iw-hub-chk svg { width: 11px; height: 11px; }

.iw-cluster-chips-wrap {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed rgba(198, 171, 109, 0.2);
}
.iw-mini-hdr { font-size: 10.5px; color: var(--ink-dim); margin-bottom: 2px; }
.iw-miit-chip {
  font-size: 10.5px;
  color: #e6d19c;
  background: rgba(196, 156, 100, 0.14);
  border: 1px solid rgba(198, 171, 109, 0.36);
  border-radius: 4px;
  padding: 2px 7px;
}

/* CEADs 2020 42-Sector Specialization 2-Column Grid (×LQ) */
.iw-sector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.iw-sec-tile {
  padding: 6px 7px;
  border-radius: 5px;
  background: rgba(18, 28, 39, 0.66);
  border: 1px solid rgba(198, 171, 109, 0.18);
  min-width: 0;
}
.iw-sec-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 3px;
}
.iw-sec-name {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iw-lq-badge {
  flex: none;
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  white-space: nowrap;
}
.iw-lq-badge.hi {
  background: rgba(127, 191, 63, 0.22);
  color: #b7e883;
  border: 1px solid rgba(159, 215, 106, 0.4);
}
.iw-lq-badge.gold {
  background: rgba(201, 164, 92, 0.2);
  color: var(--gold-bright);
  border: 1px solid rgba(201, 164, 92, 0.42);
}
.iw-lq-badge.neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-dim);
  border: 1px solid rgba(255, 255, 255, 0.14);
}
.iw-sec-nums {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
}
.iw-sec-share { font-size: 12.5px; font-weight: 700; color: var(--gold-bright); }
.iw-sec-va { font-size: 10px; color: var(--ink-dim); white-space: nowrap; }
.iw-sec-track { height: 5px; }

/* Inline SVG Spark-Bars & Urbanization Sparkline */
.iw-svg-chart {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.iw-svg-val { font-size: 9px; fill: var(--ink-dim); font-weight: 600; }
.iw-svg-val.hi { fill: var(--gold-bright); font-weight: 700; }
.iw-svg-yr { font-size: 9.5px; fill: var(--ink-dim); }
.iw-svg-yr.hi { fill: var(--gold-bright); font-weight: 700; }
.iw-svg-axis { font-size: 8.5px; fill: var(--ink-faint); }

.iw-balance-box {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px dashed rgba(198, 171, 109, 0.2);
}
.iw-balance-hdr, .iw-pair-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 10.5px;
  color: var(--ink-dim);
  margin-bottom: 4px;
}
.iw-dual-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 74px;
  align-items: center;
  gap: 6px;
  margin: 4px 0;
}
.iw-dual-lbl { font-size: 10px; color: var(--ink-dim); white-space: nowrap; }
.iw-dual-val { font-size: 11px; font-weight: 700; color: var(--ink); text-align: right; white-space: nowrap; }
.iw-dual-val.out { color: var(--amber); }
.iw-dual-val.in { color: var(--jade); }

/* Aviation Split Card */
.iw-air-block {
  padding: 6px 0;
  border-bottom: 1px dashed rgba(198, 171, 109, 0.16);
}
.iw-air-block:first-of-type { padding-top: 0; }
.iw-air-block:last-of-type { border-bottom: none; padding-bottom: 2px; }
.iw-air-name-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}
.iw-air-name { font-size: 11.5px; color: var(--ink); font-weight: 700; }
.iw-air-metric { margin-bottom: 5px; }
.iw-air-metric:last-child { margin-bottom: 0; }
.iw-air-mlbl {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 10px;
  color: var(--ink-dim);
  margin-bottom: 3px;
}
.iw-air-legend { margin-top: 6px; }

/* Mapped Sites Clickable Rows */
.iw-site-list { display: flex; flex-direction: column; gap: 5px; }
.iw-site-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: 5px;
  background: rgba(16, 24, 34, 0.72);
  border: 1px solid rgba(198, 171, 109, 0.22);
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.iw-site-row:hover {
  border-color: var(--gold-bright);
  background: rgba(198, 171, 109, 0.14);
}
.iw-site-row:active { transform: scale(0.99); }
.iw-site-med {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid rgba(198, 171, 109, 0.3);
  background: rgba(198, 171, 109, 0.1);
  color: var(--gold-bright);
}
.iw-site-med svg { width: 13px; height: 13px; }
.iw-site-med.sky { color: #8ad0ee; border-color: rgba(120, 163, 186, 0.42); background: rgba(120, 163, 186, 0.15); }
.iw-site-med.jade { color: #82d4b8; border-color: rgba(111, 161, 142, 0.42); background: rgba(111, 161, 142, 0.15); }
.iw-site-med.amber { color: #e2b878; border-color: rgba(196, 156, 100, 0.42); background: rgba(196, 156, 100, 0.15); }
.iw-site-med.violet { color: #c4b0dd; border-color: rgba(158, 140, 178, 0.42); background: rgba(158, 140, 178, 0.15); }
.iw-site-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.iw-site-t {
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-bright);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iw-site-s {
  font-size: 10px;
  color: var(--ink-dim);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iw-site-right {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
}
.iw-site-cap {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.iw-site-chev {
  font-size: 15px;
  line-height: 1;
  color: var(--gold);
}

/* 2-Tab Compare Card & Inline Multi-Column Bars */
.iw-cmp-head { flex-wrap: wrap; gap: 6px; }
.iw-tab-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 4px;
  background: rgba(8, 14, 21, 0.65);
  border: 1px solid rgba(198, 171, 109, 0.3);
}
.iw-tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-dim);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.iw-tab-btn:hover { color: var(--ink); }
.iw-tab-btn.on {
  color: var(--gold-bright);
  background: rgba(198, 171, 109, 0.22);
  border-color: rgba(230, 209, 156, 0.5);
}
.iw-cmp-table th, .iw-cmp-table td { padding: 5px 4px; font-size: 11px; }
.iw-cmp-delta { font-weight: 700; white-space: nowrap; }
.cmp-bar i.bar-sky { background: var(--sky); }
.cmp-bar i.bar-gold { background: var(--gold); }
.cmp-bar i.bar-jade { background: var(--jade); }
.cmp-bar i.bar-violet { background: var(--violet); }
.cv-cmp-row.self .cmp-bar i { filter: brightness(1.18); }

/* Time Machine Paired Comparison & Provincial Delta */
.iw-pair-block { margin-bottom: 8px; }
.iw-pair-block:last-of-type { margin-bottom: 6px; }
.iw-pop-delta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 5px;
  background: rgba(18, 28, 39, 0.68);
  border: 1px solid rgba(198, 171, 109, 0.18);
  font-size: 10.5px;
  color: var(--ink-dim);
}
.iw-pop-delta-strip b { color: var(--ink); font-weight: 700; }
.iw-urb-delta-grid { display: flex; flex-direction: column; gap: 8px; }
.iw-urb-delta-row { min-width: 0; }
.iw-urb-nums { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink); white-space: nowrap; }

/* Desktop Topbar Yield Leaderboard Popover */
.yield-leaderboard-popover {
  position: fixed;
  top: calc(var(--topbar-h) + 6px);
  left: 14px;
  width: 332px;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  z-index: 46;
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.yield-leaderboard-popover.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.iw-lb-pop { min-width: 0; }
.iw-lb-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.iw-lb-title {
  font-family: var(--serif);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.04em;
}
.iw-lb-headline {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 2px;
}
.iw-lb-sub {
  font-size: 10.5px;
  color: var(--ink-dim);
  margin: 4px 0 8px;
  line-height: 1.4;
}
.iw-lb-sec-lbl {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin: 7px 0 4px;
}
.iw-lb-list { display: flex; flex-direction: column; gap: 3px; }
.iw-lb-row {
  display: grid;
  grid-template-columns: 24px 76px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: rgba(10, 17, 25, 0.56);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.iw-lb-row:hover {
  border-color: rgba(230, 209, 156, 0.55);
  background: rgba(198, 171, 109, 0.16);
}
.iw-lb-rank { font-size: 10.5px; font-weight: 700; color: var(--gold); }
.iw-lb-name {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.iw-lb-bar {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.iw-lb-bar i { display: block; height: 100%; border-radius: 999px; }
.iw-lb-bar i.bar-sky { background: var(--sky); }
.iw-lb-bar i.bar-gold { background: var(--gold); }
.iw-lb-bar i.bar-amber { background: var(--amber); }
.iw-lb-bar i.bar-jade { background: var(--jade); }
.iw-lb-bar i.bar-violet { background: var(--violet); }
.iw-lb-val { font-size: 11px; font-weight: 700; color: var(--gold-bright); white-space: nowrap; text-align: right; }

.iw-lb-actions { margin-top: 9px; }
.iw-lb-lens-btn {
  width: 100%;
  padding: 6px 9px;
  border-radius: 4px;
  border: 1px solid rgba(198, 171, 109, 0.48);
  background: rgba(198, 171, 109, 0.15);
  color: var(--gold-bright);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.iw-lb-lens-btn:hover { background: rgba(198, 171, 109, 0.28); border-color: var(--gold-bright); }
.iw-lb-src {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid rgba(198, 171, 109, 0.16);
  font-size: 9.5px;
  color: var(--ink-faint);
  line-height: 1.4;
}

/* ==================== HERO RANK MEDALS & PROVINCE CITIES LIST ==================== */
.iw-medals-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0 4px;
}
.iw-medal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px 5px;
  border-radius: 6px;
  background: rgba(11, 18, 26, 0.54);
  border: 1px solid rgba(198, 171, 109, 0.22);
  text-align: center;
  min-width: 0;
}
.iw-medal-ring {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 2px solid var(--gold);
  background: radial-gradient(circle at 35% 28%, rgba(230, 209, 156, 0.22), rgba(14, 22, 32, 0.92));
  box-shadow: inset 0 1px 2px rgba(255, 244, 212, 0.25), 0 2px 6px rgba(0, 0, 0, 0.4);
}
.iw-medal.gold .iw-medal-ring {
  border-color: #ecd18a;
  background: radial-gradient(circle at 35% 28%, rgba(236, 209, 138, 0.36), rgba(84, 62, 22, 0.86));
  color: #fff6dc;
}
.iw-medal.jade .iw-medal-ring {
  border-color: #7cc4aa;
  background: radial-gradient(circle at 35% 28%, rgba(111, 161, 142, 0.34), rgba(24, 54, 46, 0.88));
  color: #e4faf1;
}
.iw-medal.azure .iw-medal-ring {
  border-color: #78a3ba;
  background: radial-gradient(circle at 35% 28%, rgba(120, 163, 186, 0.28), rgba(22, 38, 52, 0.88));
  color: #e0f1fa;
}
.iw-medal-rank {
  font-family: var(--serif);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.iw-medal-meta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  max-width: 100%;
  min-width: 0;
}
.iw-medal-lbl {
  font-size: 10px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.iw-medal-scope {
  font-size: 8.5px;
  font-weight: 700;
  padding: 0 3.5px;
  border-radius: 2.5px;
  line-height: 1.35;
  flex: none;
}
.iw-medal-scope.city {
  background: rgba(92, 195, 242, 0.18);
  color: #8ad6fa;
  border: 1px solid rgba(92, 195, 242, 0.36);
}
.iw-medal-scope.prov {
  background: rgba(201, 164, 92, 0.18);
  color: var(--gold-bright);
  border: 1px solid rgba(201, 164, 92, 0.38);
}

.iw-prov-city-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: 5px;
  background: rgba(16, 24, 34, 0.72);
  border: 1px solid rgba(198, 171, 109, 0.22);
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.iw-prov-city-row:hover {
  border-color: var(--gold-bright);
  background: rgba(198, 171, 109, 0.15);
}
.iw-prov-city-row:active { transform: scale(0.99); }
.iw-pc-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 9px;
  color: var(--ink-dim);
  background: rgba(120, 163, 186, 0.14);
  border: 1px solid rgba(120, 163, 186, 0.36);
}
.iw-pc-badge.cap {
  font-size: 11px;
  color: var(--gold-bright);
  background: rgba(198, 171, 109, 0.2);
  border-color: rgba(230, 209, 156, 0.56);
}
.iw-pc-role {
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-dim);
  margin-left: 4px;
}

/* ==================== TOPBAR UTIL BUTTONS & SHARE / MAP-LAYERS / HELP OVERLAYS ==================== */
.tb-btn.tb-icon-util {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  padding: 0;
  font-size: 13px;
  color: var(--gold-bright);
}
.tb-btn.tb-icon-util svg { display: block; }

.share-popover {
  position: fixed;
  top: calc(var(--topbar-h) + 6px);
  right: 12px;
  width: 306px;
  max-width: calc(100vw - 24px);
  padding: 10px 12px;
  z-index: 48;
  opacity: 0;
  transform: translateY(-6px) scale(0.985);
  pointer-events: none;
  transition: opacity var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}
.share-popover.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.sh-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.sh-action-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 5px;
  border: 1px solid rgba(198, 171, 109, 0.32);
  background: rgba(10, 17, 25, 0.66);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), transform var(--t-press) var(--ease-out);
}
.sh-action-btn:hover {
  border-color: var(--gold-bright);
  background: rgba(198, 171, 109, 0.16);
}
.sh-action-btn:active { transform: scale(0.99); }
.sh-action-btn.copied {
  border-color: rgba(147, 184, 126, 0.65);
  background: rgba(111, 161, 142, 0.18);
}
.sh-ico {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--gold-bright);
  background: rgba(198, 171, 109, 0.14);
  border: 1px solid rgba(198, 171, 109, 0.32);
}
.sh-action-btn.copied .sh-ico { color: var(--good); border-color: rgba(147, 184, 126, 0.5); }
.sh-ico svg { width: 14px; height: 14px; }
.sh-txt { display: flex; flex-direction: column; min-width: 0; }
.sh-t { font-size: 12px; font-weight: 600; color: var(--gold-bright); }
.sh-action-btn.copied .sh-t { color: var(--good); }
.sh-s { font-size: 10px; color: var(--ink-dim); margin-top: 1px; line-height: 1.35; }
.sh-foot {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(198, 171, 109, 0.16);
  font-size: 9.5px;
  color: var(--ink-faint);
}

/* Map N Layers Toggle Popover (inside #lens-area) */
.map-layers-popover {
  width: 286px;
  max-width: min(286px, calc(100vw - 24px));
  padding: 10px 11px;
  display: none;
}
.map-layers-popover.open {
  display: block;
  animation: dockEnter var(--t-fast) var(--ease-out);
}
.ml-count-tag {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-dim);
  padding: 1px 5px;
  margin-left: 4px;
  border-radius: 999px;
  background: rgba(198, 171, 109, 0.14);
  border: 1px solid rgba(198, 171, 109, 0.3);
}
.ml-list { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.ml-toggle-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 5px;
  border: 1px solid rgba(198, 171, 109, 0.18);
  background: rgba(10, 17, 25, 0.56);
  color: var(--ink-dim);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.ml-toggle-row:hover {
  border-color: rgba(230, 209, 156, 0.5);
  color: var(--ink);
}
.ml-toggle-row.on {
  border-color: rgba(230, 209, 156, 0.42);
  background: rgba(198, 171, 109, 0.13);
  color: var(--ink);
}
.ml-ico {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, 0.04);
}
.ml-toggle-row.on .ml-ico { color: var(--gold-bright); background: rgba(198, 171, 109, 0.16); }
.ml-ico svg { width: 13px; height: 13px; }
.ml-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ml-lbl { font-size: 11.5px; font-weight: 600; line-height: 1.25; }
.ml-sub { font-size: 9.5px; color: var(--ink-faint); line-height: 1.25; margin-top: 1px; }
.ml-switch {
  position: relative;
  width: 28px;
  height: 15px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  flex: none;
  transition: background var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.ml-toggle-row.on .ml-switch {
  background: rgba(111, 161, 142, 0.45);
  border-color: var(--jade);
}
.ml-knob {
  position: absolute;
  top: 1.5px;
  left: 1.5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink-dim);
  transition: transform var(--t-fast) var(--ease-out), background var(--t-fast) var(--ease-out);
}
.ml-toggle-row.on .ml-knob {
  transform: translateX(13px);
  background: #e6f7ef;
}
.ml-provenance-note {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid rgba(198, 171, 109, 0.2);
  font-size: 9.5px;
  line-height: 1.4;
  color: var(--ink-dim);
}
.ml-provenance-note strong {
  color: var(--gold-bright);
  font-weight: 600;
}

/* Keyboard & Map Controls Help Modal */
.help-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 14, 22, 0.68);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-ui) var(--ease-out);
}
.help-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.help-modal {
  position: relative;
  width: 640px;
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 16px 18px;
  transform: translateY(6px) scale(0.985);
  transition: transform var(--t-ui) var(--ease-out);
}
.help-modal-backdrop.open .help-modal {
  transform: translateY(0) scale(1);
}
.hm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gold-line-soft);
}
.hm-kicker {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
}
.hm-title {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-bright);
}
.hm-close { position: static; flex: none; }
.hm-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}
.hm-sec-h {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--gold-bright);
  margin: 0 0 7px;
}
.hm-col .hm-sec-h:not(:first-child) { margin-top: 12px; }
.hm-list { display: flex; flex-direction: column; gap: 5px; }
.hm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--ink-dim);
}
.hm-kbd {
  flex: none;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--gold-bright);
  background: rgba(198, 171, 109, 0.12);
  border: 1px solid rgba(198, 171, 109, 0.34);
  white-space: nowrap;
}
.hm-desc { text-align: right; color: var(--ink); font-size: 11px; }
.hm-click-row {
  padding: 5px 7px;
  border-radius: 4px;
  background: rgba(10, 17, 25, 0.54);
  border: 1px solid rgba(198, 171, 109, 0.16);
  font-size: 11px;
  line-height: 1.4;
}
.hm-click-row b { display: block; color: var(--gold-bright); font-weight: 600; }
.hm-click-row span { color: var(--ink-dim); font-size: 10.5px; }
.hm-modes { display: flex; flex-direction: column; gap: 6px; }
.hm-mode-card {
  padding: 6px 8px;
  border-radius: 5px;
  background: rgba(10, 17, 25, 0.58);
  border: 1px solid rgba(198, 171, 109, 0.22);
}
.hm-mode-t { font-size: 11.5px; font-weight: 700; color: var(--gold-bright); }
.hm-mode-d { font-size: 10.5px; color: var(--ink-dim); margin-top: 2px; line-height: 1.4; }
.hm-note {
  margin-top: 10px;
  padding: 7px 9px;
  border-radius: 5px;
  background: rgba(111, 161, 142, 0.1);
  border: 1px solid rgba(111, 161, 142, 0.3);
  font-size: 10.5px;
  color: var(--ink-dim);
  line-height: 1.45;
}

/* ==================== BOOT CURTAIN ==================== */
.boot-curtain {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 42%, #1d354d, #0d1824);
  transition: opacity 320ms var(--ease-out), transform 320ms var(--ease-out);
}
.boot-curtain.done { opacity: 0; transform: scale(1.015); pointer-events: none; }
.boot-inner { text-align: center; }
.boot-seal { width: 44px; height: 44px; font-size: 20px; margin: 0 auto 10px; }
.boot-title { font-family: var(--serif); font-size: 22px; font-weight: 700; letter-spacing: 0.14em; color: var(--gold-bright); }
.boot-sub { font-size: 12.5px; color: var(--ink-dim); margin-top: 6px; }

/* ==================== RESPONSIVE BREAKPOINTS (1440 / 1280 / 1200 / 1040 / 900 / 390px) ==================== */
@media (max-width: 1560px) {
  .tb-row-main { gap: 6px; padding: 0 8px; }
  .yields { gap: 3px; margin-left: 2px; }
  .yield-chip { font-size: 11.5px; padding: 2px 4px; gap: 3.5px; }
  .y-ico, .y-ico svg { width: 14px; height: 14px; }
  .search-box { width: 144px; }
  .search-box:focus-within { width: 188px; }
  .seg-btn { padding: 0 8px; }
}

@media (max-width: 1480px) {
  .brand-title { display: none; }
  .tb-row-main { gap: 5px; padding: 0 8px; }
  .yields { gap: 2px; margin-left: 0; }
  .yield-chip { font-size: 11px; padding: 2px 3.5px; gap: 3px; }
  .y-ico, .y-ico svg { width: 13.5px; height: 13.5px; }
  .search-box { width: 118px; }
  .search-box:focus-within { width: 164px; }
  .seg-btn { padding: 0 7px; font-size: 11.5px; }
  .tb-buttons { gap: 3px; }
  .tb-btn { min-width: 26px; padding: 0 6px; }
}

@media (max-width: 1360px) {
  .search-box { width: 128px; min-width: 108px; }
  .search-box:focus-within { width: 152px; }
  .yields { display: none; }
  .yields-compact-wrap { display: inline-flex; }
  .search-kbd { display: none; }
}

@media (max-width: 1120px) {
  :root { --dock-w: 396px; }
  .seg-btn { padding: 0 6px; font-size: 11px; }
  .tb-btn { min-width: 24px; padding: 0 5px; font-size: 12px; }
  .tb-btn.tb-text { font-size: 10.5px; padding: 0 5px; }
  .tb-btn.lang-btn { font-size: 10.5px; padding: 0 5px; }
  .tb-btn.tb-icon-util { width: 25px; }
  .minimap-wrap { left: 12px; bottom: 12px; }
  #minimap-canvas { width: 164px; height: 120px; }
  .lens-area {
    left: auto;
    right: 12px;
    bottom: 12px;
    align-items: flex-end;
    max-width: calc(100vw - 196px);
  }
  body.inspector-open .lens-area {
    transform: translateX(calc(-1 * var(--dock-w)));
    max-width: calc(100vw - var(--dock-w) - 196px);
  }
}

/* Compact national reports trigger for tablets and narrow desktop windows */
@media (max-width: 1039px) {
  .yields-compact-wrap { display: inline-flex; }
  .yt-wide { display: none; }
  .yt-narrow { display: inline; }
  .tb-btn.yields-trigger { padding: 0 6px; min-width: 24px; gap: 0; }
}

@media (max-width: 860px) {
  .tb-btn.tb-icon-util { display: none; }
  #btn-utilities { display: inline-flex; }
  .search-box { width: 110px; }
  .preview-tag { font-size: 9px; padding: 1px 4px; }
}

@media (max-width: 760px) {
  .yields { display: none; }
  .yields-compact-wrap { display: inline-flex; }
  .yt-wide { display: none; }
  .yt-narrow { display: inline; }
  .tb-btn.yields-trigger { padding: 0 6px; gap: 3px; }
}

/* Narrow mobile (e.g. 390×844): clean 2-row topbar with ZERO clipped buttons in BOTH ZH & EN */
@media (max-width: 720px) {
  :root {
    --topbar-base-h: 74px;
    --dock-w: 100vw;
  }
  .tb-row-main {
    flex-wrap: wrap;
    row-gap: 5px;
    column-gap: 4px;
    padding: 5px 6px 6px;
  }
  .brand { padding: 1px 1px; gap: 3px; }
  .brand-emblem { width: 22px; height: 22px; font-size: 11.5px; }
  .preview-tag { font-size: 9px; padding: 1px 4px; }
  .spacer { display: none; }
  .yields-compact-wrap { order: 2; }
  .tb-btn.yields-trigger { height: 26px; padding: 0 5px; font-size: 10.5px; gap: 2px; }
  .yields-popover {
    position: fixed;
    top: 38px;
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }
  .search-box {
    order: 3;
    flex: 1 1 64px;
    width: auto;
    min-width: 58px;
    height: 26px;
    padding: 0 5px;
    gap: 3px;
  }
  .search-box input { font-size: 11.5px; }
  .search-box:focus-within { width: auto; }
  .search-kbd { display: none; }
  .tb-buttons { order: 4; gap: 3px; }
  .tb-btn { height: 26px; min-width: 24px; padding: 0 5px; font-size: 12.5px; }
  .tb-btn.tb-text { font-size: 10.5px; padding: 0 5px; white-space: nowrap; }
  .tb-btn.lang-btn { font-size: 10px; padding: 0 5px; gap: 1px; white-space: nowrap; }
  .tb-btn.tb-icon-util { display: none; }
  .hm-body { grid-template-columns: 1fr; gap: 10px; }
  .iw-medals-row { gap: 4px; margin: 6px 0 3px; }
  .iw-medal { padding: 4px 2px; }
  .iw-medal-ring { width: 28px; height: 28px; }
  .iw-medal-rank { font-size: 11px; }
  .iw-medal-lbl { font-size: 9.5px; }
  .mode-seg {
    order: 5;
    flex: 1 0 100%;
    height: 28px;
    justify-content: space-between;
  }
  .seg-btn { flex: 1; padding: 0 3px; font-size: 11px; }
  .search-dropdown {
    position: fixed;
    top: calc(var(--topbar-h) + 4px);
    left: 8px;
    right: 8px;
    width: auto;
    max-width: none;
  }
  .lens-btn { height: 26px; padding: 0 6px; font-size: 11px; }
  .legend-bar { font-size: 10.5px; padding: 4px 7px; gap: 5px; }

  /* Split-screen bottom sheet on narrow/portrait mobile so 7-hex 3D models remain visible above! */
  body.inspector-open .lens-area,
  body.inspector-open .minimap-wrap,
  body.inspector-open .focus-badge {
    opacity: 0;
    pointer-events: none;
  }
  .cv-dock {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: var(--mobile-sheet-h, 47vh);
    border-left: none;
    border-top: 1.5px solid rgba(181, 160, 116, 0.56);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -2px 0 rgba(10, 14, 19, 0.86), 0 -10px 28px rgba(0, 0, 0, 0.54);
    transform: translateY(104%);
  }
  .cv-dock::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 3.5px;
    border-radius: 999px;
    background: rgba(230, 209, 156, 0.42);
    z-index: 4;
    pointer-events: none;
  }
  .cv-dock.open {
    transform: translateY(0);
  }
  .cv-head { padding: 14px 12px 7px 14px; }
  .cv-close { top: 10px; right: 10px; width: 26px; height: 26px; font-size: 15px; }
  .cv-title-row { gap: 8px; padding-right: 30px; }
  .cv-crest { width: 32px; height: 35px; }
  .cv-crest span { font-size: 12.5px; }
  .cv-kind { font-size: 9px; letter-spacing: 0.1em; }
  .cv-name { font-size: 16px; }
  .cv-sub { font-size: 10.5px; }
  .cv-tabs { padding: 4px 8px; gap: 2px; }
  .cv-tab { padding: 4px 3px; font-size: 11px; }
  .cv-cta-bar { padding: 6px 10px; gap: 6px; }
  .cv-enter-btn { padding: 6px 10px; font-size: 12px; }
  .cv-enter-sub { font-size: 9.5px; }
  .cv-exit-btn { padding: 3px 8px; font-size: 10.5px; }
  .cv-cta-hint { font-size: 9.5px; }
  .cv-scroll { padding: 8px 11px 16px; }
  .cv-sec-h { margin: 8px 0 5px; font-size: 11.5px; }
  .lm-bar { padding: 5px 11px; }
  .lm-back { font-size: 10.5px; padding: 2px 7px; }
  .lm-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 4px;
    margin: 2px 0 6px;
    padding-bottom: 2px;
  }
  .lm-strip::-webkit-scrollbar { display: none; }
  .lm-chip { flex: none; padding: 3px 7px; font-size: 10.5px; white-space: nowrap; }
  .cv-tiles { grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
  .cv-tile { padding: 6px 7px; gap: 6px; }
  .cv-medallion { width: 22px; height: 22px; font-size: 11px; }
  .cv-tile-lbl { font-size: 10px; }
  .cv-tile-val { font-size: 13px; line-height: 1.22; overflow-wrap: anywhere; }
  .cv-tile-sub { font-size: 9.5px; line-height: 1.3; }

  /* Compact inspector widgets inside 390px split bottom sheet (zero horizontal overflow) */
  .iw-card { padding: 7px 8px; margin: 6px 0 8px; }
  .iw-title { font-size: 11px; }
  .iw-kpi-strip { gap: 5px; }
  .iw-kpi { padding: 5px 6px; }
  .iw-kpi-val { font-size: 12.5px; }
  .iw-demo-split { gap: 5px; }
  .iw-mini-box { padding: 5px 6px; }
  .iw-bench-row { grid-template-columns: 74px minmax(0, 1fr) auto; gap: 6px; }
  .iw-bench-lbl { font-size: 10px; }
  .iw-bench-val { min-width: 58px; font-size: 10.5px; }
  .iw-hub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .iw-hub-pill { padding: 3px 5px; font-size: 9.5px; gap: 3px; }
  .iw-sector-grid { gap: 5px; }
  .iw-sec-tile { padding: 5px 6px; }
  .iw-sec-name { font-size: 10px; }
  .iw-sec-share { font-size: 11.5px; }
  .iw-dual-row { grid-template-columns: 40px minmax(0, 1fr) 64px; gap: 5px; }
  .iw-site-row { padding: 5px 7px; gap: 6px; }
  .iw-site-med { width: 22px; height: 22px; }
  .iw-site-t { font-size: 11px; }
  .iw-site-cap { font-size: 10.5px; }
  .iw-cmp-table th, .iw-cmp-table td { padding: 4px 3px; font-size: 10px; }
  .iw-tab-btn { padding: 2px 6px; font-size: 10px; }
  .iw-pop-delta-strip { flex-wrap: wrap; font-size: 10px; }
}

/* 390px mobile chrome ergonomics: maximize map viewport height */
@media (max-width: 640px) {
  #btn-zoom-in, #btn-zoom-out { display: none; }
  #transport-attribution { left: 8px; bottom: 62px; }
  body.inspector-open #transport-attribution { bottom: calc(var(--mobile-sheet-h) + 4px); }
  .minimap-wrap { display: none; }
  .minimap-toggle {
    display: inline-flex;
    position: fixed;
    z-index: 21;
    left: 8px;
    bottom: 82px;
    min-height: 34px;
  }
  .minimap-wrap.minimap-open { display: block; left: 8px; bottom: 122px; }
  body.inspector-open .minimap-toggle { display: none; }
  .lens-area {
    left: 6px;
    right: 6px;
    bottom: 6px;
    gap: 4px;
    max-width: calc(100vw - 12px);
    align-items: stretch;
  }
  #context-dock {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--gold-line) transparent;
    touch-action: pan-x;
    padding: 4px 5px;
    gap: 4px;
    width: 100%;
  }
  #context-dock.touch-drag { touch-action: pan-y pinch-zoom; }
  #context-dock .lens-btn,
  #context-dock .dock-divider {
    flex: none;
  }
  #context-dock #btn-unesco-register,
  #context-dock [data-tog="cities"] { order: -1; }
  #legend-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 3px 7px;
    gap: 5px;
    font-size: 10px;
    line-height: 1.25;
    width: fit-content;
    max-width: 100%;
    white-space: nowrap;
  }
  #legend-bar::-webkit-scrollbar { display: none; }
  #legend-bar .swatch-row { flex-wrap: nowrap; gap: 5px; }
  #legend-bar .grad-bar { width: 64px; height: 6px; }
  #legend-bar .info-pill-btn { flex: none; font-size: 9.5px; padding: 1px 6px; }
  #legend-bar #legend-info-btn { order: -1; }
}

@media (max-width: 330px) {
  .cv-tiles { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.city-context-card {
  position: relative;
  display: grid;
  gap: 5px;
  margin: 0 0 14px;
  padding: 11px 38px 12px 14px;
  border: 1px solid #536658;
  border-left: 3px solid #a7c4a4;
  border-radius: 7px;
  color: #cdd8cb;
  background: linear-gradient(112deg, #253933, #182630 90%);
  font-size: 12px;
  line-height: 1.4;
}
.city-context-card strong { color: #f5ecd3; font-size: 14px; }
.city-context-card a { color: #b8e0ca; }
.city-context-caption { color: #b2cfb3; font-size: 10px; letter-spacing: .08em; }
.city-context-sub { font-size: 11px; color: var(--ink-dim); }
.city-context-card--landmark {
  padding: 11px 12px 12px;
  border-color: rgba(230, 209, 156, 0.45);
  border-left: 3px solid var(--gold-bright, #e6d19c);
  background: linear-gradient(145deg, rgba(30, 44, 54, 0.96), rgba(18, 29, 38, 0.98));
}
.city-context-lm-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding-right: 28px;
}
.lm-inline-back {
  padding: 3px 8px;
  border: 1px solid rgba(230, 209, 156, 0.46);
  border-radius: 999px;
  background: rgba(24, 38, 48, 0.85);
  color: var(--gold-bright, #e6d19c);
  font-size: 10.5px;
  cursor: pointer;
}
.lm-inline-back:hover { background: rgba(45, 65, 76, 0.92); }
.lm-strip--inline { margin: 4px 0 6px; }
.city-context-lm-body { margin-top: 2px; }
.city-context-clear {
  position: absolute;
  top: 6px;
  right: 7px;
  min-width: 28px;
  min-height: 28px;
  border: 1px solid #60786a;
  border-radius: 50%;
  background: #182a29;
  color: #ecedda;
  cursor: pointer;
}
.city-context-clear:hover { border-color: var(--gold-bright, #e6d19c); background: #263f3c; }

/* City View Top Headline KPI Strip */
.cv-head-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 5px;
  margin-top: 8px;
}
.cv-hkpi {
  display: grid;
  gap: 1px;
  padding: 5px 7px;
  border: 1px solid rgba(198, 171, 109, 0.24);
  border-radius: 5px;
  background: rgba(11, 20, 28, 0.56);
  min-width: 0;
}
.cv-hkpi-lbl { font-size: 9.5px; color: var(--ink-dim); line-height: 1.2; }
.cv-hkpi-val {
  font-size: 12.5px;
  color: var(--gold-bright, #e6d19c);
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cv-hkpi-scope { font-size: 9px; color: #9cb8af; line-height: 1.2; }
.cv-dock.cv-dragging { transition: none !important; }
@media (max-width: 720px) {
  .cv-head-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; margin-top: 6px; }
  .cv-hkpi { padding: 4px 6px; }
  .cv-hkpi-val { font-size: 11.5px; }
}

[data-fieldbook-station][aria-pressed="true"], [data-fieldbook-site][aria-pressed="true"] {
  outline: 1px solid #d2c58b;
  outline-offset: -2px;
}
.heritage-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.heritage-filters input { flex: 1 1 155px; min-width: 0; }
.heritage-filters select { flex: 0 0 auto; width: auto; }
.her-row-m a { color: #b8d7c1; text-underline-offset: 2px; }
