/* SGCiv UI shell (Worker C). Original 4X-genre chrome: lacquered panels, antique-gold trim, parchment ink.
   System fonts only. No external assets. */

:root {
  --sg-font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sg-font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sg-bg: #0b141c;
  --sg-panel: #12202c;
  --sg-panel-2: #1a2c3b;
  --sg-border: #3a4f5f;
  --sg-ink: #f1e6cb;
  --sg-ink-dim: #b7ab90;
  --sg-gold: #d4a94f;
  --sg-gold-2: #f0cf7a;
  --sg-teal: #4fb3a9;
  --sg-danger: #e0604f;
  --sg-radius: 10px;
  --sg-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --y-gold: #f0c040;
  --y-production: #e8743b;
  --y-science: #4cc3e6;
  --y-culture: #b07be0;
  --y-food: #7cc35a;
  --y-faith: #d9dee8;

  /* derived (Worker C internal) */
  --c-lacquer: linear-gradient(180deg, rgba(27, 45, 60, .97) 0%, rgba(16, 29, 40, .97) 55%, rgba(12, 22, 31, .98) 100%);
  --c-lacquer-solid: linear-gradient(180deg, #1b2d3c 0%, #101d28 60%, #0c161f 100%);
  --c-trim: linear-gradient(90deg, rgba(212, 169, 79, 0) 0%, #d4a94f 18%, #f0cf7a 50%, #d4a94f 82%, rgba(212, 169, 79, 0) 100%);
  --c-gold-grad: linear-gradient(180deg, #f6dc92 0%, #d4a94f 48%, #9c7631 100%);
  --c-inner: inset 0 1px 0 rgba(240, 207, 122, .18), inset 0 0 0 1px rgba(212, 169, 79, .08);
  --c-line: rgba(212, 169, 79, .22);
  --c-line-soft: rgba(241, 230, 203, .08);
  --c-hover: rgba(240, 207, 122, .09);
  --topbar-h: 56px;
  --gap: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #15344a 0%, #0e2232 45%, var(--sg-bg) 100%);
  color: var(--sg-ink);
  font: 14px/1.4 var(--sg-font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button { font: inherit; color: inherit; }
a { color: var(--sg-gold-2); }
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; display: block; }

/* ---------------------------------------------------------------- B7 roots + B8 z-order */
#app, #map-wrap { position: fixed; inset: 0; }
#map-wrap { z-index: 0; }
#map { display: block; width: 100%; height: 100%; touch-action: none; }
#ext-root, #ui-root { position: fixed; inset: 0; pointer-events: none; }
#ext-root { z-index: 30; }
#ui-root { z-index: 40; }
/* #ui-root children inherit pointer-events: none; interactive surfaces opt back in. */
#ui-root .interactive, #ui-root button, #ui-root input, #ui-root a, #ui-root label, #ui-root select { pointer-events: auto; }
#ui-root .panel:not(.open) button { pointer-events: none; }

#minimap-wrap {
  position: fixed;
  z-index: 35;
  right: var(--gap);
  bottom: var(--gap);
  width: 208px;
  height: 138px;
  padding: 4px;
  border-radius: 8px;
  background: var(--c-lacquer-solid);
  border: 1px solid rgba(212, 169, 79, .55);
  box-shadow: var(--sg-shadow), var(--c-inner);
  transition: opacity .2s ease;
}
#minimap { width: 100%; height: 100%; display: block; border-radius: 5px; background: #0d2433; }

.z-panel { z-index: 40; }
.z-chrome { z-index: 50; }
.z-tooltip { z-index: 60; }
.z-modal { z-index: 80; }
.z-toast { z-index: 90; }

/* ---------------------------------------------------------------- shared atoms */
.lacquer {
  background: var(--c-lacquer);
  border: 1px solid rgba(212, 169, 79, .5);
  box-shadow: var(--sg-shadow), var(--c-inner);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.trim-top { position: relative; }
.trim-top::before {
  content: "";
  position: absolute;
  left: 10%; right: 10%; top: -1px;
  height: 2px;
  background: var(--c-trim);
  border-radius: 2px;
  pointer-events: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(212, 169, 79, .35);
  background: linear-gradient(180deg, rgba(42, 64, 82, .9), rgba(22, 37, 50, .9));
  color: var(--sg-ink);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: border-color .15s, background .15s, color .15s, transform .08s;
}
.btn:hover { border-color: var(--sg-gold); color: var(--sg-gold-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .chip:focus-visible, .lens-btn:focus-visible, .linkish:focus-visible, .tab:focus-visible, .band:focus-visible {
  outline: 2px solid var(--sg-gold-2);
  outline-offset: 2px;
}
.btn.is-active {
  background: var(--c-gold-grad);
  color: #1d1406;
  border-color: #f6dc92;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 0 14px rgba(240, 207, 122, .35);
}
.btn.icon-only { width: 36px; padding: 0; }
.btn.primary { background: var(--c-gold-grad); color: #1d1406; border-color: #f6dc92; }
.btn.primary:hover { color: #000; }
.btn .ico { width: 18px; height: 18px; }

kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(212, 169, 79, .4);
  border-bottom-width: 2px;
  background: rgba(0, 0, 0, .25);
  color: var(--sg-gold-2);
  font: 600 11px/1.3 var(--sg-font-ui);
  text-align: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 999px;
  font: 700 10px/1.6 var(--sg-font-ui);
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge.k-city { color: var(--sg-gold-2); }
.badge.k-station { color: #8fd3ff; }
.badge.k-pa { color: #c6b6f0; }
.badge.k-subzone { color: #9fd6a0; }
.badge.k-wonder { color: #ffb37a; }
.badge.k-region { color: #e0c9a0; }

.code-chip {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border-radius: 4px;
  font: 700 10.5px/17px var(--sg-font-ui);
  color: #fff;
  background: #555;
  letter-spacing: .02em;
}

.linkish {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sg-gold-2);
  cursor: pointer;
  text-align: left;
  font-weight: 600;
}
.linkish:hover { text-decoration: underline; text-underline-offset: 3px; }

.eyebrow {
  font: 700 10.5px/1.2 var(--sg-font-ui);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--sg-gold);
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(20, 35, 48, .98), rgba(11, 21, 30, .96));
  border-bottom: 1px solid rgba(212, 169, 79, .55);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .45), inset 0 -1px 0 rgba(0, 0, 0, .6);
  pointer-events: auto;
  z-index: 52; /* chrome tier (B8); sits over the dock so its popovers never hide behind it */
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 3px;
  background: var(--c-trim);
  opacity: .55;
  pointer-events: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding-right: 4px;
  cursor: pointer;
  border: 0;
  background: none;
}
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1; text-align: left; }
.brand-name {
  font: 700 21px/1 var(--sg-font-display);
  letter-spacing: .06em;
  background: var(--c-gold-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-sub { font: 600 9.5px/1.2 var(--sg-font-ui); letter-spacing: .2em; text-transform: uppercase; color: var(--sg-ink-dim); margin-top: 3px; }

.yields { display: flex; align-items: center; gap: 4px; flex: none; }
.ychip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 10px 0 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .28);
  border: 1px solid var(--c-line-soft);
  cursor: help;
  white-space: nowrap;
  position: relative;
}
.ychip:hover { border-color: rgba(212, 169, 79, .45); background: rgba(0, 0, 0, .4); }
.ychip .yico {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .25), rgba(0, 0, 0, .25));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
}
.ychip .yico .ico { width: 15px; height: 15px; }
.ychip .yval { font: 700 13.5px/1 var(--sg-font-ui); font-variant-numeric: tabular-nums; }
.ychip .ysub, .ychip .yshort { font: 600 9px/1 var(--sg-font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--sg-ink-dim); }
.ychip .yshort { display: none; letter-spacing: .06em; }

.topbar .spacer { flex: 1 1 auto; min-width: 0; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.top-actions .sep { width: 1px; height: 24px; background: var(--c-line); margin: 0 4px; }

/* hover tip for chrome (yields, buttons) */
.tip {
  position: fixed;
  max-width: 280px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #0a131b;
  border: 1px solid rgba(212, 169, 79, .5);
  color: var(--sg-ink);
  font-size: 12.5px;
  line-height: 1.4;
  box-shadow: var(--sg-shadow);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .12s, transform .12s;
}
.tip.show { opacity: 1; transform: none; }
.tip b { color: var(--sg-gold-2); }
.tip .muted { color: var(--sg-ink-dim); }

/* ---------------------------------------------------------------- search */
.search {
  position: relative;
  flex: 0 1 340px;
  min-width: 180px;
}
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(212, 169, 79, .35);
  transition: border-color .15s, box-shadow .15s;
}
.search-field:focus-within { border-color: var(--sg-gold); box-shadow: 0 0 0 3px rgba(212, 169, 79, .18); }
.search-field .ico { color: var(--sg-gold); width: 17px; height: 17px; }
.search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: none;
  color: var(--sg-ink);
  font: 500 14px var(--sg-font-ui);
}
.search-field input::-webkit-search-cancel-button, .search-field input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-field input::placeholder { color: var(--sg-ink-dim); opacity: .85; }
.search-close { display: none; }
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: max(100%, 420px);
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--sg-radius);
  display: none;
}
.search.open .search-results { display: block; }
.sr-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.sr-item .sr-ico {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid var(--c-line-soft);
  color: var(--sg-gold-2);
}
.sr-item .sr-ico .ico { width: 17px; height: 17px; }
.sr-item .sr-main { min-width: 0; }
.sr-item .sr-label { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-item .sr-label mark { background: none; color: var(--sg-gold-2); }
.sr-item .sr-sub { font-size: 12px; color: var(--sg-ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; gap: 4px; align-items: center; }
.sr-item .sr-right { display: flex; gap: 4px; align-items: center; }
.sr-item.active, .sr-item:hover { background: var(--c-hover); box-shadow: inset 0 0 0 1px rgba(212, 169, 79, .35); }
.sr-empty { padding: 14px 12px; color: var(--sg-ink-dim); }
.sr-hint { display: flex; gap: 12px; padding: 8px 10px 4px; border-top: 1px solid var(--c-line-soft); margin-top: 4px; color: var(--sg-ink-dim); font-size: 11.5px; }

/* ---------------------------------------------------------------- popovers (layers, share) */
.popover {
  position: absolute;
  top: calc(var(--topbar-h) + 8px);
  right: 12px;
  width: 300px;
  max-height: calc(100vh - var(--topbar-h) - 24px);
  overflow-y: auto;
  padding: 12px;
  border-radius: var(--sg-radius);
  display: none;
  pointer-events: auto;
}
.popover.open { display: block; animation: pop .14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.popover h3 {
  margin: 0 0 8px;
  font: 700 15px/1.2 var(--sg-font-display);
  color: var(--sg-gold-2);
  letter-spacing: .03em;
}
.popover .pop-sec + .pop-sec { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--c-line-soft); }
.toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  min-height: 34px;
}
.toggle:hover { background: var(--c-hover); }
.toggle .ico { color: var(--sg-gold); }
.toggle .t-label { flex: 1; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle .sw {
  width: 32px; height: 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .4);
  border: 1px solid var(--sg-border);
  position: relative;
  transition: background .15s, border-color .15s;
  flex: none;
}
.toggle .sw::after {
  content: "";
  position: absolute;
  left: 2px; top: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--sg-ink-dim);
  transition: transform .15s, background .15s;
}
.toggle input:checked + .sw { background: rgba(212, 169, 79, .35); border-color: var(--sg-gold); }
.toggle input:checked + .sw::after { transform: translateX(14px); background: var(--sg-gold-2); }
.toggle input:focus-visible + .sw { outline: 2px solid var(--sg-gold-2); outline-offset: 2px; }
.share-url {
  display: flex; gap: 6px; margin: 6px 0 10px;
}
.share-url input {
  flex: 1; min-width: 0;
  height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  border: 1px solid var(--sg-border);
  background: rgba(0, 0, 0, .35);
  color: var(--sg-ink-dim);
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
}
.share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pop-note { margin: 8px 0 0; font-size: 12px; color: var(--sg-ink-dim); }

/* ---------------------------------------------------------------- dock + legend */
.dock-wrap {
  position: absolute;
  bottom: var(--gap);
  left: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.legend {
  width: min(560px, 100%);
  padding: 10px 14px 10px;
  border-radius: var(--sg-radius);
  pointer-events: auto;
}
.legend-head { display: flex; align-items: baseline; gap: 10px; }
.legend-title { font: 700 16px/1.2 var(--sg-font-display); color: var(--sg-gold-2); letter-spacing: .02em; }
.legend-unit { color: var(--sg-ink-dim); font-size: 12px; }
.legend-head .grow { flex: 1; }
.legend-head .btn { min-height: 26px; height: 26px; padding: 0 8px; font-size: 11.5px; }
.legend-desc { margin: 3px 0 6px; color: var(--sg-ink-dim); font-size: 12.5px; }
.hist { display: flex; align-items: flex-end; gap: 3px; height: 46px; margin-top: 4px; }
.band {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  position: relative;
}
.band .bar {
  border-radius: 3px 3px 0 0;
  min-height: 2px;
  opacity: .85;
  transition: opacity .15s, filter .15s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.band .cnt {
  position: absolute;
  left: 0; right: 0;
  text-align: center;
  font: 600 10px/1 var(--sg-font-ui);
  color: var(--sg-ink-dim);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.band:hover .bar { opacity: 1; filter: brightness(1.15); }
.hist.filtering .band:not(.on) .bar { opacity: .22; }
.band.on .bar { opacity: 1; box-shadow: 0 0 0 1.5px var(--sg-gold-2), 0 0 10px rgba(240, 207, 122, .5); }
.band.null-band { flex: 0 0 34px; margin-left: 8px; }
.band.null-band .bar, .sw-null {
  background: repeating-linear-gradient(135deg, #59606a 0 3px, #2a3038 3px 6px) !important;
}
.scale { display: flex; gap: 3px; height: 10px; margin-top: 3px; }
.scale .sc { flex: 1 1 0; border-radius: 2px; }
.scale .sc.null-sc { flex: 0 0 34px; margin-left: 8px; }
.ticks { position: relative; height: 16px; margin-top: 3px; font: 600 10.5px/16px var(--sg-font-ui); color: var(--sg-ink-dim); font-variant-numeric: tabular-nums; }
.ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.ticks span.first { transform: none; }
.ticks span.last { transform: translateX(-100%); }
.legend-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 11.5px; color: var(--sg-ink-dim); }
.legend-foot .filter-note { color: var(--sg-gold-2); }
.legend-more { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--c-line-soft); font-size: 12px; color: var(--sg-ink-dim); display: none; }
.legend.expanded .legend-more { display: block; }
.legend-more p { margin: 0 0 6px; }
.legend-more .note { color: #e8cf9a; }
.legend-more ul { margin: 0; padding-left: 16px; }
.terrain-key { display: flex; flex-wrap: wrap; gap: 4px 11px; margin-top: 6px; }
.terrain-key .tk { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--sg-ink); }
.terrain-key .tk i { width: 14px; height: 12px; display: inline-block; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }

.dock {
  display: flex;
  align-items: stretch;
  gap: 6px;
  max-width: 100%;
  min-height: 64px;
  padding: 7px 8px;
  border-radius: 14px;
  pointer-events: auto;
}
.dock .lens-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 58px;
  padding: 4px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  color: var(--sg-ink-dim);
  font: 650 11px/1.1 var(--sg-font-ui);
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.dock .lens-btn .ico { width: 20px; height: 20px; }
.dock .lens-btn:hover { color: var(--sg-ink); background: var(--c-hover); }
.dock .lens-btn.is-active {
  color: #1d1406;
  background: var(--c-gold-grad);
  border-color: #f6dc92;
  box-shadow: 0 0 12px rgba(240, 207, 122, .35);
}
.dock .group {
  display: flex;
  align-items: stretch;
  border-radius: 10px;
  border: 1px solid var(--c-line-soft);
  background: rgba(0, 0, 0, .2);
  overflow: hidden;
}
.dock .group.has-active { border-color: rgba(212, 169, 79, .5); }
.dock .group-head {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 70px;
  padding: 4px 10px;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--sg-ink);
  font: 700 10px/1.1 var(--sg-font-ui);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.dock .group-head .ico { width: 20px; height: 20px; color: var(--sg-gold); }
.dock .group-head:hover { background: var(--c-hover); }
.dock .group.open .group-head { background: rgba(212, 169, 79, .12); color: var(--sg-gold-2); }
.dock .group-lenses { display: none; align-items: center; gap: 2px; padding: 0 4px; border-left: 1px solid var(--c-line); }
.dock .group.open .group-lenses { display: flex; }
.dock .group-lenses .lens-btn { min-width: 0; padding: 6px 9px; font-size: 11.5px; }
.dock .lens-btn .sw-mini { width: 26px; height: 5px; border-radius: 3px; }
.dock .mobile-only { display: none; }


/* ---------------------------------------------------------------- compact dock (mobile, or a narrow free span) */
.dock.compact { min-height: 56px; padding: 6px; border-radius: 12px; flex-wrap: wrap; justify-content: space-between; align-items: center; width: min(560px, 100%); }
.dock.compact .desktop-only { display: none; }
.dock.compact .mobile-only { display: inline-flex; }
.dock.compact .m-picker.mobile-only { display: none; }
.dock.compact .m-current {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid rgba(212, 169, 79, .4);
  background: rgba(0, 0, 0, .25);
  cursor: pointer;
  text-align: left;
}
.dock.compact .m-current .ico { color: var(--sg-gold); }
.dock.compact .m-current .m-txt { flex: 1; min-width: 0; }
.dock.compact .m-current .m-group { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--sg-gold); font-weight: 700; }
.dock.compact .m-current .m-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dock.compact .m-legend-btn { width: 44px; height: 44px; min-height: 44px; margin-left: 6px; }
.dock.compact.picker-open .m-picker.mobile-only { display: block; flex: 1 0 100%; max-height: 52vh; max-height: 52dvh; overflow-y: auto; margin-top: 6px; }
.m-picker .mp-group { margin-top: 10px; }
.m-picker .mp-title { display: flex; align-items: center; gap: 6px; font: 700 10.5px/1 var(--sg-font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--sg-gold); margin: 4px 2px 6px; }
.m-picker .mp-title .ico { width: 15px; height: 15px; }
.m-picker .mp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.dock .m-picker .lens-btn { flex-direction: row; justify-content: flex-start; gap: 8px; min-height: 44px; padding: 0 10px; font-size: 12.5px; border: 1px solid var(--c-line-soft); background: rgba(0, 0, 0, .2); white-space: normal; text-align: left; color: var(--sg-ink); }
.dock .m-picker .lens-btn .sw-mini { width: 18px; height: 10px; flex: none; }
.dock .m-picker .lens-btn.is-active { background: var(--c-gold-grad); color: #1d1406; }
.dock-wrap.compact .legend { width: min(560px, 100%); }

/* ---------------------------------------------------------------- side panel */
.panel {
  position: absolute;
  top: calc(var(--topbar-h) + 10px);
  right: var(--gap);
  bottom: calc(var(--gap) + 138px + 10px);
  width: 380px;
  display: flex;
  flex-direction: column;
  border-radius: var(--sg-radius);
  pointer-events: auto;
  transform: translateX(calc(100% + 24px));
  opacity: 0;
  visibility: hidden;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .18s, visibility 0s .22s;
}
.panel.open { transform: none; opacity: 1; visibility: visible; transition: transform .22s cubic-bezier(.2, .8, .2, 1), opacity .18s; }
.panel-grip { display: none; }
.panel-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 0 14px; scrollbar-width: thin; scrollbar-color: rgba(212, 169, 79, .4) transparent; }
/* Compact header that appears once the card scrolls: rows slide under a full-width opaque strip
   instead of under the close button alone. */
.panel-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 52px;
  z-index: 1;
  display: flex; align-items: center;
  padding: 0 60px 0 16px;
  background: #182a38;
  border-bottom: 1px solid rgba(212, 169, 79, .35);
  border-radius: var(--sg-radius) var(--sg-radius) 0 0;
  box-shadow: 0 6px 12px -8px rgba(0, 0, 0, .6);
  font: 700 15px/1.2 var(--sg-font-display);
  color: var(--sg-gold-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s;
}
.panel.scrolled .panel-bar { opacity: 1; }
.panel-close {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 2;
  width: 32px; height: 32px; min-height: 32px;
  border-radius: 50%;
  /* Opaque, so scrolled rows hide behind it instead of reading through it. */
  background: #182a38;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}

.card-head {
  position: relative;
  padding: 16px 52px 14px 16px;
  border-bottom: 1px solid var(--c-line);
  background:
    radial-gradient(ellipse at 0% 0%, rgba(212, 169, 79, .18), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, .03), transparent);
  border-radius: var(--sg-radius) var(--sg-radius) 0 0;
}
.card-head .kind-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.card-title {
  margin: 0;
  font: 700 25px/1.12 var(--sg-font-display);
  letter-spacing: .01em;
  color: var(--sg-ink);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .4);
}
.card-sub { margin-top: 4px; color: var(--sg-ink-dim); font-size: 13px; }

/* city banner header */
.city-banner {
  position: relative;
  margin: 14px 14px 0;
  padding: 14px 16px 16px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(0, 0, 0, .12)),
    linear-gradient(135deg, #3a2a10 0%, #6b4e1c 45%, #3a2a10 100%);
  border: 1px solid #c9a050;
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .25), inset 0 0 0 4px rgba(240, 207, 122, .35), 0 6px 16px rgba(0, 0, 0, .4);
}
.city-banner .cb-row { display: flex; align-items: center; gap: 12px; }
.pop-badge {
  flex: none;
  width: 54px; height: 54px;
  border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #2b4a63, #0f2231);
  border: 2px solid #f0cf7a;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, .4), 0 4px 10px rgba(0, 0, 0, .5);
  font: 800 15px/1 var(--sg-font-ui);
  color: #fff;
}
.pop-badge small { font: 700 8px/1 var(--sg-font-ui); letter-spacing: .12em; color: var(--sg-gold-2); margin-top: 3px; text-transform: uppercase; }
.city-banner .card-title { font-size: 26px; color: #fff4d8; }
.city-banner .card-sub { color: #e8d6ad; }
.tier-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(240, 207, 122, .6);
  color: var(--sg-gold-2);
  font: 700 10px/1.7 var(--sg-font-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.tier-pill.plain { color: #e8d6ad; border-color: rgba(232, 214, 173, .35); }
.statline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 14px 0; }
.stat {
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .25);
  border: 1px solid var(--c-line-soft);
}
.stat .s-label { font-size: 11px; color: var(--sg-ink-dim); letter-spacing: .04em; }
.stat .s-val { font: 700 18px/1.25 var(--sg-font-ui); font-variant-numeric: tabular-nums; }
.stat .s-note { font-size: 11px; color: var(--sg-ink-dim); margin-top: 2px; }

.sec { margin: 16px 14px 0; }
.sec-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  font: 700 13px/1.2 var(--sg-font-display);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sg-gold);
}
.sec-head::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(212, 169, 79, .5), transparent); }
.sec-note { font-size: 12px; color: var(--sg-ink-dim); margin: 6px 0 0; }

.yrow { display: grid; grid-template-columns: 22px minmax(0, 1fr) 112px 30px; align-items: center; gap: 10px; padding: 5px 0; }
.yrow .ico { width: 19px; height: 19px; }
.yrow .y-label { font-size: 12.5px; font-weight: 600; }
.yrow .y-label { min-width: 0; }
.yrow .y-label small { display: block; font-size: 11px; font-weight: 500; color: var(--sg-ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ytrack { height: 8px; border-radius: 4px; background: rgba(0, 0, 0, .4); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); overflow: hidden; }
.ytrack i { display: block; height: 100%; border-radius: 4px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35); }
.yrow .y-val { font: 700 13px/1 var(--sg-font-ui); text-align: right; font-variant-numeric: tabular-nums; }
.yrow .y-raw { grid-column: 3 / 5; font-size: 11px; color: var(--sg-ink-dim); margin-top: -3px; cursor: help; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.districts { display: flex; flex-direction: column; gap: 6px; }
.district {
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(212, 169, 79, .1), rgba(0, 0, 0, .15));
  border: 1px solid rgba(212, 169, 79, .25);
}
.district .d-ico {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  background: var(--c-gold-grad);
  color: #241805;
}
.district .d-ico .ico { width: 19px; height: 19px; }
.district .d-label { font-weight: 700; }
.district .d-detail { font-size: 11.5px; color: var(--sg-ink-dim); }
.district .d-lq { font: 800 13px/1 var(--sg-font-ui); color: var(--sg-gold-2); text-align: right; }
.district .d-lq small { display: block; font-size: 9px; color: var(--sg-ink-dim); letter-spacing: .1em; margin-top: 2px; }

.cit-group + .cit-group { margin-top: 12px; }
.cit-title { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.cit-title small { font-weight: 500; color: var(--sg-ink-dim); font-size: 11px; }
.crow { display: grid; grid-template-columns: minmax(0, 1fr) 96px 38px; gap: 8px; align-items: center; padding: 2.5px 0; font-size: 12px; }
.crow .c-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--sg-ink); }
.crow .c-track { position: relative; height: 9px; border-radius: 3px; background: rgba(0, 0, 0, .4); }
.crow .c-track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; }
.crow .c-track b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #fff; border-radius: 1px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }
.crow .c-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.crow.over .c-val { color: var(--sg-gold-2); }
.cit-legend { display: flex; gap: 12px; align-items: center; font-size: 11px; color: var(--sg-ink-dim); margin-top: 6px; }
.cit-legend i { display: inline-block; width: 12px; height: 8px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.cit-legend b { display: inline-block; width: 2px; height: 11px; background: #fff; vertical-align: middle; margin-right: 4px; }
.headline {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-left: 3px solid var(--sg-gold);
  background: rgba(212, 169, 79, .08);
  border-radius: 0 6px 6px 0;
  font: italic 14px/1.4 var(--sg-font-display);
  color: #f6e8c6;
}

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.kv .kv-item {
  padding: 7px 9px;
  border-radius: 7px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--c-line-soft);
  min-width: 0;
}
.kv .kv-label { font-size: 11px; color: var(--sg-ink-dim); display: flex; gap: 5px; align-items: center; min-width: 0; white-space: nowrap; }
.kv .kv-label .kv-text { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.kv .kv-label .inh { flex: none; }
.kv .kv-val { font: 700 14.5px/1.3 var(--sg-font-ui); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv .kv-item.wide { grid-column: 1 / -1; }
.kv .inh, .sec-title-row .inh { font: 700 8.5px/1.5 var(--sg-font-ui); padding: 0 4px; border-radius: 3px; background: rgba(79, 179, 169, .2); color: var(--sg-teal); letter-spacing: .06em; }
.sec-title-row { display: inline-flex; align-items: center; gap: 6px; }
.rows { display: flex; flex-direction: column; }
.rows .r { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--c-line-soft); font-size: 13px; }
.rows .r:last-child { border-bottom: 0; }
.rows .r .rk { color: var(--sg-ink-dim); }
.rows .r .rv { font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35); }
.hexsw { display: inline-block; width: 14px; height: 12px; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }

.list { display: flex; flex-direction: column; gap: 4px; }
.list-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .2);
  border: 1px solid var(--c-line-soft);
  cursor: pointer;
  text-align: left;
}
.list-item:hover { border-color: rgba(212, 169, 79, .45); background: var(--c-hover); }
.list-item .ico { color: var(--sg-gold); }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-label { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 11.5px; color: var(--sg-ink-dim); }
.list-item .li-right { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(212, 169, 79, .35);
  background: rgba(0, 0, 0, .25);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
}
.chip:hover { border-color: var(--sg-gold); color: var(--sg-gold-2); }
.chip .ico { width: 15px; height: 15px; color: var(--sg-gold); }
.callout {
  margin: 12px 14px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(79, 179, 169, .1);
  border: 1px solid rgba(79, 179, 169, .35);
  color: #cfeee9;
  font-size: 12.5px;
  display: flex; gap: 8px;
}
.callout .ico { color: var(--sg-teal); margin-top: 1px; }
.callout.warn { background: rgba(224, 96, 79, .1); border-color: rgba(224, 96, 79, .4); color: #f6d4cc; }
.callout.warn .ico { color: var(--sg-danger); }
.callout.gold { background: rgba(212, 169, 79, .1); border-color: rgba(212, 169, 79, .4); color: #f4e3bb; }
.callout.gold .ico { color: var(--sg-gold-2); }
.rule-box {
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .25);
  border: 1px dashed rgba(212, 169, 79, .45);
  font-size: 13px;
}
.bonus { display: flex; flex-wrap: wrap; gap: 6px; }
.bonus .bchip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 6px; border-radius: 999px; background: rgba(0, 0, 0, .3); border: 1px solid var(--c-line-soft); font-weight: 700; font-size: 12.5px; }
.bonus .bchip .ico { width: 16px; height: 16px; }
.mini-yields { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-yields > span { display: inline-flex; align-items: center; gap: 3px; font-weight: 700; font-size: 12.5px; padding: 2px 7px 2px 4px; border-radius: 999px; background: rgba(0, 0, 0, .3); }
.mini-yields .ico { width: 15px; height: 15px; }
.loading { color: var(--sg-ink-dim); font-size: 12.5px; padding: 6px 0; }

/* ---------------------------------------------------------------- hover tooltip */
.hovertip {
  position: absolute;
  left: 0; top: 0;
  min-width: 190px;
  max-width: 280px;
  padding: 9px 11px;
  border-radius: 9px;
  background: rgba(9, 17, 24, .95);
  border: 1px solid rgba(212, 169, 79, .55);
  box-shadow: var(--sg-shadow);
  pointer-events: none;
  opacity: 0;
  transition: opacity .1s;
  will-change: transform;
}
.hovertip.show { opacity: 1; }
.hovertip .ht-title { font: 700 14.5px/1.2 var(--sg-font-display); color: var(--sg-ink); }
.hovertip .ht-sub { font-size: 11.5px; color: var(--sg-ink-dim); margin-top: 1px; }
.hovertip .ht-row { display: flex; align-items: center; gap: 7px; margin-top: 6px; font-size: 12px; }
.hovertip .ht-lens { margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--c-line-soft); display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
.hovertip .ht-lens b { font-size: 14px; color: var(--sg-gold-2); font-variant-numeric: tabular-nums; }
.hovertip .ht-city { margin-top: 6px; font-size: 11.5px; color: var(--sg-gold-2); font-weight: 700; display: flex; align-items: center; gap: 5px; }
.hovertip .ht-city .ico { width: 14px; height: 14px; }

/* ---------------------------------------------------------------- modal (Almanac) */
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 12, .62);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  pointer-events: auto;
}
.scrim.open { display: flex; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: min(980px, 100%);
  height: min(760px, 100%);
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: var(--c-lacquer-solid);
}
.modal-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px 0;
}
.modal-head .m-title { font: 700 26px/1.1 var(--sg-font-display); color: var(--sg-gold-2); letter-spacing: .04em; }
.modal-head .m-sub { color: var(--sg-ink-dim); font-size: 12.5px; margin-top: 3px; }
.modal-head .grow { flex: 1; }
.tabs { display: flex; gap: 2px; padding: 12px 14px 0; border-bottom: 1px solid var(--c-line); overflow-x: auto; scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: none;
  color: var(--sg-ink-dim);
  cursor: pointer;
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
}
.tab .ico { width: 16px; height: 16px; }
.tab:hover { color: var(--sg-ink); }
.tab.is-active {
  color: var(--sg-gold-2);
  background: rgba(212, 169, 79, .1);
  border-color: var(--c-line);
  box-shadow: inset 0 2px 0 var(--sg-gold);
}
.modal-body { flex: 1; overflow-y: auto; padding: 18px 20px 26px; scrollbar-width: thin; scrollbar-color: rgba(212, 169, 79, .4) transparent; }
.modal-body h2 { font: 700 20px/1.2 var(--sg-font-display); color: var(--sg-ink); margin: 0 0 6px; }
.modal-body h3 { font: 700 15px/1.25 var(--sg-font-display); color: var(--sg-gold-2); margin: 0 0 4px; letter-spacing: .02em; }
.modal-body p { margin: 0 0 10px; color: #e6dcc2; line-height: 1.55; }
.modal-body .lead { color: var(--sg-ink-dim); margin-bottom: 14px; }
.alm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.alm-card {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .22);
  border: 1px solid var(--c-line-soft);
}
.alm-card .ac-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.alm-card .ac-head .ico { width: 20px; height: 20px; }
.alm-card p { font-size: 13px; margin: 0 0 6px; }
.alm-card .meta { font-size: 11.5px; color: var(--sg-ink-dim); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.alm-card .meta code { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: #cbbf9f; word-break: break-all; }
.alm-card ul { margin: 4px 0 0; padding-left: 16px; font-size: 12.5px; color: #e6dcc2; }
.alm-group-title { margin: 18px 0 8px; }
.alm-group-title:first-child { margin-top: 0; }
.disclosure {
  display: flex; gap: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(240, 192, 64, .16), rgba(240, 192, 64, .04));
  border: 1px solid rgba(240, 192, 64, .55);
}
.disclosure .ico { width: 28px; height: 28px; color: var(--y-gold); }
.disclosure h3 { color: var(--y-gold); }
.disclosure p { margin: 0; }
.src-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.src-table th { text-align: left; font: 700 10.5px/1.2 var(--sg-font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--sg-gold); padding: 8px 8px; border-bottom: 1px solid var(--c-line); position: sticky; top: -18px; background: #101d28; }
.src-table td { padding: 8px 8px; border-bottom: 1px solid var(--c-line-soft); vertical-align: top; color: #e6dcc2; }
.src-table td code { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: #cbbf9f; word-break: break-all; }
.src-table .used { color: var(--sg-ink-dim); }
.src-cards { display: none; }
.keys-table { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; align-items: center; max-width: 560px; }
.keys-table .kk { display: flex; gap: 4px; flex-wrap: wrap; }
.count-pill { display: inline-block; padding: 0 8px; border-radius: 999px; background: rgba(212, 169, 79, .15); color: var(--sg-gold-2); font: 700 11px/1.7 var(--sg-font-ui); margin-left: 6px; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: absolute; left: 50%; top: calc(var(--topbar-h) + 14px); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  padding: 9px 14px;
  border-radius: 999px;
  background: #0a131b;
  border: 1px solid rgba(212, 169, 79, .6);
  color: var(--sg-ink);
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--sg-shadow);
  animation: toast-in .18s ease-out;
}
.toast.err { border-color: var(--sg-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- responsive: medium widths */
@media (max-width: 1600px) {
  .ychip .ysub { display: none; }
  .ychip .yshort { display: inline; }
  .ychip { padding-right: 9px; }
}
@media (max-width: 1500px) {
  .top-actions kbd { display: none; }
}
@media (max-width: 1180px) {
  .top-actions .lbl { display: none; }
  .top-actions .btn:not(.icon-only) { padding: 0 9px; }
  .search { flex-basis: 240px; }
}
@media (max-width: 980px) {
  .yields .ychip { padding-right: 8px; }
  .brand-sub { display: none; }
}

/* ---------------------------------------------------------------- responsive: mobile (< 760px) */
@media (max-width: 759.98px) {
  :root { --topbar-h: 96px; --gap: 8px; }
  .topbar {
    flex-wrap: wrap;
    align-content: flex-start;
    gap: 0 6px;
    padding: 6px 8px 0;
    padding-top: max(6px, env(safe-area-inset-top));
  }
  .brand { order: 1; height: 44px; gap: 7px; }
  .brand-mark { width: 30px; height: 30px; }
  .brand-name { font-size: 18px; }
  .brand-sub { display: none; }
  .topbar .spacer { order: 2; }
  .top-actions { order: 4; gap: 4px; }
  .top-actions .sep { display: none; }
  .top-actions .btn { width: 38px; height: 40px; min-height: 40px; padding: 0; }
  .top-actions .lbl, .top-actions kbd { display: none; }
  .yields {
    order: 5;
    flex: 1 0 100%;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 4px;
    padding: 4px 0 6px;
  }
  .ychip { height: 34px; padding: 0 4px; justify-content: center; gap: 4px; min-width: 0; }
  .ychip .yico { width: 18px; height: 18px; }
  .ychip .yico .ico { width: 13px; height: 13px; }
  .yields .ychip { padding: 0 3px; gap: 3px; }
  .ychip .yval { font-size: 11.5px; overflow: visible; white-space: nowrap; letter-spacing: -.01em; }
  .ychip .yshort { display: none; }
  /* Touch: 44 px hit areas without changing the drawn size. */
  .top-actions .btn, .search .search-field, .ychip, .chip, .src-cards a { position: relative; }
  .top-actions .btn::after, .search:not(.open) .search-field::after, .ychip::after {
    content: ""; position: absolute; left: 50%; top: 50%; width: max(100%, 44px); height: 44px; transform: translate(-50%, -50%);
  }
  .chip { min-height: 44px; }
  .src-cards a { display: inline-flex; align-items: center; min-height: 44px; }

  .search { order: 3; flex: none; min-width: 0; position: static; }
  .search .search-field { width: 38px; height: 40px; padding: 0; justify-content: center; border-radius: 8px; cursor: pointer; background: linear-gradient(180deg, rgba(42, 64, 82, .9), rgba(22, 37, 50, .9)); }
  .search .search-field input, .search .search-field kbd { display: none; }
  .search.open { position: absolute; left: 0; right: 0; top: 0; height: var(--topbar-h); padding: 8px; background: #0e1a24; z-index: 5; }
  .search.open .search-field { width: 100%; height: 44px; padding: 0 6px 0 12px; justify-content: flex-start; border-radius: 999px; cursor: text; background: rgba(0, 0, 0, .35); }
  .search.open .search-field input { display: block; font-size: 16px; }
  .search.open .search-close { display: inline-flex; width: 34px; height: 34px; min-height: 34px; }
  .search-results { position: fixed; top: calc(var(--topbar-h) + 4px); left: 8px; right: 8px; width: auto; max-height: calc(100dvh - var(--topbar-h) - 24px); }
  .sr-item { min-height: 50px; }
  .sr-hint { display: none; }

  .popover { left: 8px; right: 8px; width: auto; }

  #minimap-wrap { width: 128px; height: 86px; right: 8px; bottom: 76px; padding: 3px; }
  body.ui-sheet-open #minimap-wrap, body.ui-mode-ext #minimap-wrap, body.ui-legend-open #minimap-wrap { opacity: 0; pointer-events: none; }

  .dock-wrap { left: 0; right: 0; width: auto !important; transform: none !important; bottom: 0; padding: 0 8px max(8px, env(safe-area-inset-bottom)); gap: 6px; align-items: stretch; }
  .legend { width: 100% !important; padding: 9px 12px; }
  .legend-head { flex-wrap: wrap; row-gap: 0; }
  .legend-head .legend-unit { order: 4; flex-basis: 100%; }
  .legend-desc { font-size: 12px; }

  .panel {
    top: auto;
    left: 0; right: 0; bottom: 0;
    width: auto;
    bottom: calc(66px + env(safe-area-inset-bottom));
    max-height: calc(60dvh - 66px);
    height: calc(60dvh - 66px);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .panel.open { transform: translateY(var(--drag, 0px)); }
  .panel.dragging { transition: none; }
  .panel-grip {
    display: flex; justify-content: center; align-items: center;
    height: 22px; flex: none;
    cursor: grab;
    touch-action: none;
  }
  .panel-grip::before { content: ""; width: 42px; height: 5px; border-radius: 3px; background: rgba(241, 230, 203, .35); }
  .btn.icon-only.panel-close { top: 27px; width: 44px; height: 44px; min-height: 44px; }
  .panel-bar { top: 22px; height: 54px; border-radius: 0; }
  .card-head { border-radius: 0; padding-top: 6px; }
  .city-banner { margin-top: 4px; }

  .scrim { padding: 0; align-items: stretch; }
  .modal { width: 100%; height: 100%; border-radius: 0; }
  .modal-head { padding: 12px 12px 0; padding-top: max(12px, env(safe-area-inset-top)); }
  .modal-head .m-title { font-size: 22px; }
  .modal-body { padding: 14px 14px 30px; }
  .alm-grid { grid-template-columns: 1fr; }
  .src-table { display: none; }
  .src-cards { display: grid; gap: 8px; }
  .keys-table { grid-template-columns: auto 1fr; }

  body.ui-mode-ext .dock-wrap, body.ui-mode-ext .panel { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
