/*
 * ELU 0.7 Globe System
 *
 * This stylesheet ports the designer handoff's HUD language around the
 * production globe.gl renderer. Renderer, country geometry, and data remain
 * owned by js/globe.js; this file owns the instrument surface only.
 */

body.globe-mode {
  --hud-bg: rgba(7, 13, 22, .92);
  --hud-bg-strong: rgba(6, 11, 18, .97);
  --hud-cell: rgba(255, 255, 255, .035);
  --hud-cell-hover: rgba(78, 205, 196, .09);
  --hud-border: rgba(123, 232, 208, .2);
  --hud-border-strong: rgba(123, 232, 208, .42);
  --hud-divider: rgba(255, 255, 255, .08);
  --hud-divider-soft: rgba(255, 255, 255, .045);
  --hud-muted: rgba(210, 224, 224, .62);
  --hud-faint: rgba(210, 224, 224, .62);
  --hud-shadow: 0 16px 42px rgba(0, 0, 0, .28);
  --hud-shadow-strong: 0 18px 54px rgba(0, 0, 0, .42), 0 0 0 1px rgba(123, 232, 208, .025);
  --hud-nav-bg: rgba(6, 11, 18, .9);
  --hud-trajectory-bg: rgba(78, 205, 196, .035);
  --hud-grid: rgba(255, 255, 255, .1);
  --hud-today: rgba(255, 255, 255, .28);
  --globe-dock-inset: 24px;
  --globe-dock-gap: 12px;
  --globe-dock-height: 86px;
  --globe-back-height: 54px;
  --globe-back-lift: 16px;
  --globe-back-width: clamp(260px, 31vw, 470px);
}

/* The globe remains an instrument, but the shared theme control must still
   have a real effect when the homepage is in its old-money light mode. */
html[data-theme="light"] body.globe-mode,
body.globe-mode[data-theme="light"] {
  --glow: rgba(31, 94, 70, .22);
  --glass-bg: rgba(255, 255, 255, .50);
  --glass-bg-hi: rgba(255, 255, 255, .72);
  --glass-border: rgba(31, 94, 70, .18);
  --glass-hi: rgba(255, 255, 255, .60);
  --bg: #f3efe6;
  --bg2: #faf7f0;
  --bg3: #ede7d9;
  --teal: #1f5e46;
  --mint: #26694f;
  --ocean: #3a6d5c;
  --deep: #c9bfa6;
  --leaf: #3f7d54;
  --amber: #9a7b3f;
  --warn: #9a3b2c;
  --text: #20302a;
  --text2: #5a6158;
  --text3: #9a9584;
  --border: rgba(31, 94, 70, .20);
  --border-hi: rgba(31, 94, 70, .42);
  --hud-bg: rgba(250, 247, 240, .94);
  --hud-bg-strong: rgba(255, 253, 248, .98);
  --hud-cell: rgba(237, 231, 217, .62);
  --hud-cell-hover: rgba(31, 94, 70, .10);
  --hud-border: rgba(31, 94, 70, .26);
  --hud-border-strong: rgba(31, 94, 70, .46);
  --hud-divider: rgba(31, 94, 70, .14);
  --hud-divider-soft: rgba(31, 94, 70, .08);
  --hud-muted: rgba(32, 48, 42, .78);
  --hud-faint: rgba(32, 48, 42, .78);
  --hud-shadow: 0 16px 38px rgba(62, 49, 25, .14);
  --hud-shadow-strong: 0 18px 48px rgba(62, 49, 25, .16), 0 0 0 1px rgba(31, 94, 70, .04);
  --hud-nav-bg: rgba(255, 253, 248, .96);
  --hud-trajectory-bg: rgba(31, 94, 70, .04);
  --hud-grid: rgba(31, 94, 70, .15);
  --hud-today: rgba(32, 48, 42, .34);
  color-scheme: only light;
}

html[data-theme="light"] body.globe-mode #globeViz {
  background:
    radial-gradient(circle at 50% 48%, rgba(98, 203, 177, .28), transparent 42%),
    radial-gradient(circle at 50% 42%, #f8f5eb, #dfe9e3 58%, #c4d7d0);
}

html[data-theme="light"] body.globe-mode #topbar {
  opacity: 1;
  transition: none;
  background: linear-gradient(180deg, rgba(255, 253, 248, .98), rgba(243, 239, 230, .94));
  border-bottom: 1px solid rgba(31, 94, 70, .16);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, .58), 0 10px 26px rgba(62, 49, 25, .08);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

html[data-theme="light"] body.globe-mode .hex-legend {
  border-color: rgba(31, 94, 70, .22);
  background: rgba(250, 247, 240, .92);
  color: var(--text2);
}

body.globe-mode #topbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

#globe-evidence-browse {
  min-height: 32px;
  padding: 6px 11px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}

#globe-evidence-browse .browse-label-short { display: none; }

@media (max-width: 480px) {
  body.globe-mode #topbar {
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }

  body.globe-mode #topbar .logo {
    flex: 0 0 24px;
    width: 24px;
    gap: 0;
  }

  body.globe-mode #topbar .logo .brand-wordmark,
  body.globe-mode #topbar .logo .brand-subtitle,
  body.globe-mode #topbar .logo .brand-sep {
    display: none;
  }

  body.globe-mode #topbar .topbar-actions { gap: 6px; }

  #globe-evidence-browse {
    min-height: 44px;
    padding: 6px 10px;
    letter-spacing: 1.2px;
  }

  #globe-evidence-browse .browse-label-full { display: none; }
  #globe-evidence-browse .browse-label-short { display: inline; }

  body.globe-mode #globe-theme-toggle {
    width: 44px;
    height: 44px;
  }
}

body.globe-fallback-active #globe-evidence-browse {
  display: none;
}

@keyframes elu-hud-in {
  from { opacity: 0; transform: translateY(14px); filter: blur(5px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes elu-card-in {
  from { opacity: 0; transform: translateX(26px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}

body.globe-mode #topbar { animation: elu-hud-in .7s cubic-bezier(.22,.61,.36,1) .15s both; }
body.globe-mode #elu-country-rank-rail { animation: elu-hud-in .7s cubic-bezier(.22,.61,.36,1) .3s both; }
body.globe-mode .hex-legend { animation: elu-hud-in .7s cubic-bezier(.22,.61,.36,1) .35s both; }

#globe-theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid var(--hud-border);
  border-radius: 50%;
  background: var(--hud-cell);
  color: var(--hud-muted);
  cursor: pointer;
  padding: 0;
  transition: color .2s, border-color .2s, transform .2s, background .2s;
}

#globe-theme-toggle:hover,
#globe-theme-toggle:focus-visible {
  border-color: var(--mint);
  background: var(--hud-cell-hover);
  color: var(--mint);
  outline: none;
  transform: translateY(-1px);
}

#globe-theme-toggle .ic-moon { display: none; }
[data-theme="light"] #globe-theme-toggle .ic-sun { display: none; }
[data-theme="light"] #globe-theme-toggle .ic-moon { display: block; }

/* The two signals stay independent: pledge status colours the card's hero
   and actual trajectory, while CAT colours only its rating badge. */
[data-status="over"] {
  --st: var(--warn);
  --st-bg: rgba(255, 84, 58, .08);
  --st-bd: rgba(255, 84, 58, .30);
}
[data-status="on"] {
  --st: var(--leaf);
  --st-bg: rgba(46, 204, 113, .08);
  --st-bd: rgba(46, 204, 113, .28);
}
[data-status="notarget"] {
  --st: var(--amber);
  --st-bg: rgba(212, 165, 116, .08);
  --st-bd: rgba(212, 165, 116, .30);
}
[data-status="nodata"] {
  --st: var(--text2);
  --st-bg: var(--hud-cell);
  --st-bd: var(--hud-border);
}

.cat-crit, .cat-high { --cat: var(--warn); }
.cat-insuf { --cat: var(--amber); }
.cat-almost { --cat: var(--leaf); }
.cat-compat { --cat: var(--teal); }
.cat-unknown { --cat: var(--text2); }

body:not(.globe-mode) #hex-country-tooltip,
body:not(.globe-mode) #elu-country-rank-rail,
body:not(.globe-mode) #elu-country-card-wrap,
body:not(.globe-mode) #globe-loading,
body:not(.globe-mode) #globe-fallback {
  display: none !important;
}

/* Loading state: visible while the vendored renderer and country layer arrive. */
#globe-loading {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}

#globe-loading.is-visible {
  opacity: 1;
  visibility: visible;
}

.elu-loading-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 196px;
  padding: 12px 15px;
  border: 1px solid var(--hud-border);
  border-radius: 3px;
  background: var(--hud-bg-strong);
  box-shadow: var(--hud-shadow);
  color: var(--mint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.25px;
  line-height: 1.4;
  text-transform: uppercase;
}

.elu-loading-mark {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(123, 232, 208, .3);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: elu-globe-spin .9s linear infinite;
}

@keyframes elu-globe-spin { to { transform: rotate(360deg); } }

/* Non-WebGL evidence route. This region is a direct child of body so it is
   never trapped beneath #globeViz or the opaque Foundation sections. */
#globe-fallback[hidden] { display: none !important; }

body.globe-fallback-active #globeViz {
  pointer-events: none !important;
}

body.globe-fallback-active #globe-loading,
body.globe-fallback-active #elu-country-rank-rail,
body.globe-fallback-active #elu-country-card-wrap,
body.globe-fallback-active #hex-country-tooltip,
body.globe-fallback-active .hex-legend,
body.globe-fallback-active #globe-back-btn {
  display: none !important;
}

#globe-fallback {
  position: fixed;
  inset: 54px 0 0;
  z-index: 60;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 26px clamp(12px, 3vw, 38px) 96px;
  background: var(--bg);
  color: var(--text);
  pointer-events: auto;
}

.elu-fallback-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.elu-fallback-header,
.elu-fallback-evidence {
  border: 1px solid var(--hud-border);
  border-radius: 4px;
  background: var(--hud-bg-strong);
  box-shadow: var(--hud-shadow);
}

.elu-fallback-header {
  padding: clamp(20px, 4vw, 34px);
}

.elu-fallback-eyebrow {
  margin: 0 0 8px;
  color: var(--mint);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.elu-fallback-header h2 {
  margin: 0;
  color: var(--text);
  font-family: var(--display);
  font-size: clamp(30px, 5vw, 50px);
  font-weight: 400;
  line-height: 1.05;
}

.elu-fallback-reason {
  margin: 14px 0 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}

.elu-fallback-boundary {
  max-width: 880px;
  margin: 10px 0 0;
  color: var(--hud-muted);
  font-size: 12px;
  line-height: 1.65;
}

.elu-fallback-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.elu-fallback-actions .glass-btn {
  min-height: 44px;
  white-space: normal;
}

.elu-fallback-evidence {
  margin-top: 14px;
  padding: clamp(16px, 3vw, 24px);
}

.elu-fallback-evidence-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.elu-fallback-evidence h3,
.elu-fallback-evidence h4 {
  color: var(--mint);
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: .8px;
}

.elu-fallback-evidence h3 {
  margin: 0;
  font-size: 13px;
}

#globe-fallback-summary {
  margin: 7px 0 0;
  color: var(--hud-muted);
  font-size: 11px;
  line-height: 1.5;
}

.elu-fallback-search {
  display: grid;
  flex: 0 1 340px;
  gap: 6px;
  color: var(--hud-muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .65px;
  text-transform: uppercase;
}

.elu-fallback-search input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--hud-border);
  border-radius: 3px;
  background: var(--hud-cell);
  color: var(--text);
  font: 14px/1.35 var(--body);
}

.elu-fallback-search input:focus-visible,
#globe-fallback button:focus-visible,
#globe-fallback a:focus-visible,
#globe-fallback [tabindex="-1"]:focus-visible {
  border-color: var(--mint);
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

.elu-fallback-results {
  min-height: 18px;
  margin: 10px 0 6px;
  color: var(--hud-muted);
  font-size: 10px;
}

.elu-fallback-grid {
  display: grid;
  grid-template-columns: minmax(250px, .72fr) minmax(0, 1.28fr);
  gap: 12px;
  min-height: 430px;
}

.elu-fallback-list-panel,
.elu-fallback-detail {
  min-width: 0;
  border: 1px solid var(--hud-divider);
  border-radius: 3px;
  background: var(--hud-cell);
}

.elu-fallback-list-panel {
  max-height: 560px;
  overflow: auto;
  scrollbar-width: thin;
}

#globe-fallback-country-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.elu-fallback-country-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 8px 11px;
  border: 0;
  border-bottom: 1px solid var(--hud-divider-soft);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.elu-fallback-country-row:hover,
.elu-fallback-country-row:focus-visible,
.elu-fallback-country-row[aria-current="true"] {
  background: var(--hud-cell-hover);
}

.elu-fallback-country-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.elu-fallback-country-name small,
.elu-fallback-country-state {
  display: block;
  margin-top: 3px;
  color: var(--hud-muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .35px;
}

.elu-fallback-country-state {
  align-self: center;
  margin: 0;
  text-align: right;
}

.elu-fallback-country-state.is-gap { color: var(--hud-muted); }

.elu-fallback-detail {
  padding: clamp(16px, 3vw, 24px);
  overflow: auto;
}

.elu-fallback-detail h3 {
  color: var(--text);
  font-family: var(--display);
  font-size: clamp(25px, 4vw, 36px);
  letter-spacing: .2px;
}

.elu-fallback-detail h4 {
  margin: 20px 0 8px;
  font-size: 10px;
  text-transform: uppercase;
}

.elu-fallback-detail p,
.elu-fallback-detail li {
  color: var(--hud-muted);
  font-size: 12px;
  line-height: 1.6;
}

.elu-fallback-detail ul {
  margin: 0;
  padding-left: 20px;
}

.elu-fallback-detail-value {
  margin: 12px 0 0;
  color: var(--text) !important;
}

.elu-fallback-detail-value strong {
  color: #f2b36f;
  font-family: var(--mono);
  font-size: clamp(20px, 4vw, 29px);
  font-weight: 500;
}

.elu-fallback-detail-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  margin-top: 9px;
  padding: 5px 8px;
  border: 1px solid var(--hud-border);
  border-radius: 999px;
  color: var(--hud-muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: .6px;
  text-transform: uppercase;
}

.elu-fallback-table-wrap {
  max-width: 100%;
  margin-top: 12px;
  overflow-x: auto;
}

.elu-fallback-detail table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 10px;
}

.elu-fallback-detail caption {
  padding: 0 0 7px;
  color: var(--hud-muted);
  text-align: left;
}

.elu-fallback-detail th,
.elu-fallback-detail td {
  padding: 7px 8px;
  border-top: 1px solid var(--hud-divider);
  color: var(--text);
  text-align: left;
  white-space: nowrap;
}

.elu-fallback-source a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--teal);
}

.elu-fallback-back-to-list {
  min-height: 44px;
  margin-top: 18px;
  padding: 9px 12px;
  border: 1px solid var(--hud-border);
  border-radius: 3px;
  background: transparent;
  color: var(--teal);
  font: 11px/1.3 var(--body);
  cursor: pointer;
}

html[data-theme="light"] body.globe-mode .elu-fallback-detail-value strong {
  color: #6b3d00;
}

@media (max-width: 760px) {
  #globe-fallback { padding: 16px 10px 90px; }
  .elu-fallback-evidence-head { display: grid; }
  .elu-fallback-search { width: 100%; }
  .elu-fallback-grid { grid-template-columns: 1fr; }
  .elu-fallback-list-panel { max-height: 270px; }
}

@media (prefers-reduced-motion: reduce) {
  #globe-fallback,
  #globe-fallback * {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }
}

/* Ranked rail: worst gap first, outside #globeViz by design. */
#elu-country-rank-rail {
  position: fixed;
  top: 72px;
  bottom: calc(var(--globe-dock-inset) + var(--globe-dock-height) + 12px);
  left: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 218px;
  max-height: none;
  overflow: hidden;
  border: 1px solid var(--hud-border);
  border-radius: 3px;
  background: var(--hud-bg);
  box-shadow: var(--hud-shadow);
  backdrop-filter: blur(12px);
  color: var(--text);
}

.elu-rank-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px 8px;
  border-bottom: 1px solid var(--hud-divider);
}

.elu-rank-title {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1.3px;
  text-transform: uppercase;
}

.elu-rank-subtitle {
  margin-top: 3px;
  color: var(--hud-faint);
  font-size: 9px;
}

.elu-rank-toggle {
  width: 23px;
  height: 23px;
  border: 1px solid var(--hud-border);
  border-radius: 2px;
  background: transparent;
  color: var(--teal);
  cursor: pointer;
  font-size: 11px;
}

.elu-rank-toggle:hover,
.elu-rank-toggle:focus-visible {
  border-color: var(--mint);
  outline: none;
}

.elu-rank-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  scrollbar-width: thin;
}

#elu-country-rank-rail.is-collapsed { bottom: auto; }

#elu-country-rank-rail.is-collapsed .elu-rank-list,
#elu-country-rank-rail.is-collapsed .elu-rank-subtitle {
  display: none;
}

.elu-rank-row {
  display: grid;
  grid-template-columns: 21px 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 5px 10px;
  border: 0;
  border-bottom: 1px solid var(--hud-divider-soft);
  background: transparent;
  color: var(--hud-muted);
  font-family: var(--body);
  text-align: left;
  cursor: pointer;
}

.elu-rank-row:hover,
.elu-rank-row:focus-visible,
.elu-rank-row.is-active {
  background: var(--hud-cell-hover);
  color: var(--text);
  outline: none;
}

.elu-rank-number,
.elu-rank-gap {
  color: var(--hud-faint);
  font-family: var(--mono);
  font-size: 8px;
}

.elu-rank-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
}

.elu-rank-code { display: none; }

.elu-rank-gap { color: var(--hud-muted); }
.elu-rank-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--hud-faint); }
.elu-rank-dot.is-red { background: #ff786d; box-shadow: 0 0 7px rgba(255, 120, 109, .35); }
.elu-rank-dot.is-green { background: #63dc8b; box-shadow: 0 0 7px rgba(99, 220, 139, .3); }
.elu-rank-dot.is-amber { background: var(--amber); }
.elu-rank-dot.is-magnitude { background: linear-gradient(135deg,#5b4a97,#f6913a); box-shadow:0 0 7px rgba(246,145,58,.28); }
.elu-rank-dot.is-gap { background:repeating-linear-gradient(135deg,#91a0ac 0 2px,transparent 2px 4px); border:1px solid #aeb9c1; }
.elu-rank-gap-heading { margin:0; padding:9px 10px; border-top:1px solid var(--hud-divider); border-bottom:1px solid var(--hud-divider-soft); color:var(--hud-muted); font-family:var(--mono); font-size:8px; font-weight:500; letter-spacing:1px; text-transform:uppercase; }
.elu-rank-disclosure,.elu-rank-unmapped { padding:7px 10px; color:var(--hud-muted); font-size:9px; line-height:1.4; }
.elu-rank-unmapped { border-bottom:1px solid var(--hud-divider-soft); }

/* Selected dashboard: the v0.7 461px docked card. */
#hex-country-tooltip {
  z-index: 1000;
  border-radius: 3px;
  background: var(--hud-bg);
  border-color: var(--hud-border);
  box-shadow: var(--hud-shadow-strong);
}

#hex-country-tooltip.selected {
  width: min(461px, calc(100vw - 124px)) !important;
  max-height: min(78vh, 700px);
  padding: 14px 15px 13px;
  border-color: var(--hud-border-strong);
  background: var(--hud-bg-strong);
  box-shadow: var(--hud-shadow-strong);
  animation: elu-card-in .5s cubic-bezier(.22,.61,.36,1);
}

#hex-country-tooltip.selected .tt-topline {
  align-items: center;
  min-height: 27px;
  margin-bottom: 5px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hud-divider);
}

#hex-country-tooltip.selected .tt-country {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: .15px;
}

#hex-country-tooltip.selected .tt-detail {
  color: var(--hud-muted);
  font-size: 10px;
}

#hex-country-tooltip[data-status] .tt-pill {
  color: var(--st);
  border-color: var(--st-bd);
  background: var(--st-bg);
}

#hex-country-tooltip[data-status] .tt-gap {
  border-color: var(--st-bd);
  background: var(--st-bg);
}

#hex-country-tooltip[data-status] .tt-gap-line {
  color: var(--st);
}

#hex-country-tooltip .tt-cat {
  border-color: var(--cat) !important;
  background: var(--hud-cell) !important;
  background: color-mix(in srgb, var(--cat) 9%, transparent) !important;
}

#hex-country-tooltip .tt-cat-dot {
  background: var(--cat) !important;
}

/* Selected card is mounted between two sibling arrows, matching the handoff
   and keeping the controls out of the card's scrollable content. */
#elu-country-card-wrap {
  position: fixed;
  top: 64px;
  right: 24px;
  bottom: 96px;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

#elu-country-card-wrap #hex-country-tooltip {
  position: relative !important;
  inset: auto !important;
  z-index: auto;
  width: min(461px, calc(100vw - 124px)) !important;
  max-width: calc(100vw - 124px);
  max-height: 100% !important;
  overflow-y: auto;
  transform: none;
  pointer-events: auto;
}

@keyframes elu-country-card-swipe-cue {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0); }
  24% { transform: translate3d(-7px, 0, 0) rotate(-.35deg); }
  50% { transform: translate3d(6px, 0, 0) rotate(.3deg); }
  72% { transform: translate3d(-2px, 0, 0) rotate(-.1deg); }
}

#elu-country-card-wrap .tt-nav {
  position: relative !important;
  inset: auto !important;
  flex: 0 0 auto;
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  border: 1px solid var(--cell-bd);
  border-radius: 50% !important;
  background: var(--glass-bg);
  color: var(--text2);
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  opacity: .7;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: none;
  transition: opacity .2s, color .15s, border-color .15s, transform .15s;
}

#elu-country-card-wrap .tt-nav:hover,
#elu-country-card-wrap .tt-nav:focus-visible {
  border-color: var(--teal);
  color: var(--teal);
  opacity: 1;
  outline: none;
  transform: scale(1.08);
}

#hex-country-tooltip .tt-pill {
  border-radius: 2px;
  letter-spacing: .9px;
}

#hex-country-tooltip .tt-status-magnitude { color:#f2b36f; border-color:rgba(242,179,111,.38); background:rgba(117,76,151,.16); }
#hex-country-tooltip .tt-candidate { margin-top:8px; padding:7px 8px; border:1px solid rgba(242,179,111,.34); background:rgba(117,76,151,.14); color:#f7c58d; font-family:var(--mono); font-size:8px; letter-spacing:.55px; line-height:1.4; text-transform:uppercase; }
#hex-country-tooltip .tt-close { min-width:44px; min-height:44px; }
#hex-country-tooltip .tt-factual h3 { margin:12px 0 5px; color:var(--mint); font-family:var(--mono); font-size:9px; letter-spacing:1px; text-transform:uppercase; }
#hex-country-tooltip .tt-factual-value { color:var(--text2); font-size:11px; }
#hex-country-tooltip .tt-factual-value strong { color:#f2b36f; font-family:var(--mono); font-size:20px; }
#hex-country-tooltip .tt-factual-value span { color:var(--hud-faint); }
#hex-country-tooltip .elu-trajectory-current.is-magnitude { stroke:#f2a553; stroke-width:2; fill:none; }
#hex-country-tooltip .elu-trajectory-point { fill:#fff1dc; stroke:#704f9d; stroke-width:1.2; }
#hex-country-tooltip .elu-chart-axis { fill:var(--text2); font-family:var(--mono); font-size:7px; }
#hex-country-tooltip .tt-chart-data { margin-top:8px; color:var(--text2); font-size:10px; }
#hex-country-tooltip .tt-chart-data summary { min-height:44px; display:flex; align-items:center; color:var(--teal); cursor:pointer; }
#hex-country-tooltip .tt-chart-data table { width:100%; border-collapse:collapse; font-family:var(--mono); font-size:9px; }
#hex-country-tooltip .tt-chart-data caption { padding:5px; color:var(--hud-muted); text-align:left; }
#hex-country-tooltip .tt-chart-data th,#hex-country-tooltip .tt-chart-data td { padding:4px 5px; border-top:1px solid var(--hud-divider-soft); text-align:left; }
#hex-country-tooltip .tt-source,#hex-country-tooltip .tt-limit { margin-top:8px; color:var(--text2); font-size:10px; line-height:1.45; }
#hex-country-tooltip .tt-source a { display:inline-flex; align-items:center; min-height:44px; color:var(--teal); }
#hex-country-tooltip :focus-visible,#elu-country-rank-rail :focus-visible { outline:2px solid var(--mint); outline-offset:2px; }

#hex-country-tooltip.selected .tt-gap {
  border-radius: 3px;
  background: var(--hud-cell);
}

#hex-country-tooltip.selected .tt-grid4 {
  gap: 6px;
  margin-top: 9px;
}

#hex-country-tooltip.selected .tt-grid4 > div,
#hex-country-tooltip.selected .tt-momentum > div {
  border-radius: 3px;
  background: var(--hud-cell);
}

#hex-country-tooltip.selected .tt-nav {
  width: 26px;
  height: 86px;
  border-radius: 2px;
  background: var(--hud-nav-bg);
}

#hex-country-tooltip.selected .tt-hint {
  padding-top: 6px;
  border-top: 1px solid var(--hud-divider-soft);
  color: var(--hud-muted);
  opacity: 1;
}

/* v0.7 trajectory panel inserted by GlobeModule._renderCountryMetrics. */
.elu-trajectory {
  margin-top: 10px;
  padding: 9px 10px 8px;
  border: 1px solid var(--hud-border);
  border-radius: 3px;
  background: var(--hud-trajectory-bg);
}

.elu-trajectory-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.elu-trajectory-title {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.elu-trajectory-note {
  color: var(--hud-faint);
  font-size: 9px;
}

.elu-trajectory svg {
  display: block;
  width: 100%;
  height: 54px;
  overflow: visible;
  shape-rendering: geometricPrecision;
}

.elu-trajectory-grid { stroke: var(--hud-grid); stroke-width: .7; }
.elu-trajectory-target { fill: none; stroke: var(--teal); stroke-width: 1.6; stroke-dasharray: 3 3; opacity: .65; }
.elu-trajectory-current { fill: none; stroke: var(--st); stroke-width: 1.6; }
.elu-trajectory-current.is-red { stroke: var(--warn); }
.elu-trajectory-current.is-green { stroke: var(--leaf); }
.elu-trajectory-current.is-amber { stroke: var(--amber); }
.elu-trajectory-marker { fill: var(--st); stroke: var(--hud-bg-strong); stroke-width: 1; }
.elu-trajectory-marker.is-red { fill: var(--warn); }
.elu-trajectory-marker.is-green { fill: var(--leaf); }
.elu-trajectory-today { stroke: var(--hud-today); stroke-width: .8; stroke-dasharray: 1.5 2; vector-effect: non-scaling-stroke; }
.elu-trajectory-years { display: flex; justify-content: space-between; margin-top: -1px; color: var(--hud-muted); font-family: var(--mono); font-size: 8px; letter-spacing: .55px; line-height: 1; }
.elu-trajectory-empty { color: var(--hud-faint); font-size: 10px; line-height: 1.4; }
.elu-trajectory-legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--hud-faint); font-size: 8px; }
.elu-trajectory-legend span { display: inline-flex; align-items: center; gap: 5px; }
.elu-trajectory-legend span::before { content: ''; width: 14px; border-top: 2px solid var(--hud-faint); }
.elu-trajectory-legend span:first-child::before { border-color: var(--warn); }
.elu-trajectory-legend span:first-child.is-green::before { border-color: var(--leaf); }
.elu-trajectory-legend span:last-child::before { border-top-style: dashed; border-color: var(--teal); }
.elu-trajectory-today-key::before { border-top-style: dotted !important; border-color: var(--hud-today) !important; }
.elu-trajectory-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.elu-trajectory-chip { padding: 4px 7px; border: 1px solid var(--cell-bd); border-radius: 20px; color: var(--hud-muted); font-family: var(--mono); font-size: 8px; line-height: 1; }
.elu-trajectory-chip.is-red { border-color: var(--st-bd); background: var(--st-bg); color: var(--warn); }
.elu-trajectory-chip.is-green { border-color: rgba(46, 204, 113, .28); background: rgba(46, 204, 113, .08); color: var(--leaf); }

/* Bottom utility dock: evidence context sits beside the exit action instead
   of consuming a second layer of the globe or colliding with the rank rail. */
body.globe-mode .hex-legend {
  left: calc(var(--globe-dock-inset) + var(--globe-back-width) + var(--globe-dock-gap));
  right: var(--globe-dock-inset);
  bottom: var(--globe-dock-inset);
  z-index: 60;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: center;
  gap: 7px 14px;
  min-height: var(--globe-dock-height);
  padding: 10px 14px;
  border-color: var(--hud-border);
  border-radius: 3px;
  background: var(--hud-bg);
  box-shadow: var(--hud-shadow);
}

body.globe-mode .hex-legend-row {
  min-width: 0;
  color: var(--text2);
  line-height: 1.25;
}

body.globe-mode .hex-legend-note {
  grid-column: 1 / -1;
  max-width: none;
  margin: 0;
  padding-top: 6px;
  border-top-color: var(--hud-divider);
  color: var(--text2);
  line-height: 1.3;
}

body.globe-mode #globe-back-btn {
  left: var(--globe-dock-inset);
  z-index: 200;
  bottom: calc(var(--globe-dock-inset) + var(--globe-back-lift));
  width: var(--globe-back-width);
  min-height: var(--globe-back-height);
  padding: 10px 14px;
  border-color: var(--border-hi);
  background: var(--bg2);
  color: var(--teal);
  overflow: hidden;
  font-size: 10px;
  letter-spacing: 1.7px;
  white-space: nowrap;
  transform: none;
  animation: elu-hud-in .7s cubic-bezier(.22,.61,.36,1) .55s both;
}

html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-close,
html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-watch {
  border-color: var(--hud-border);
  background: var(--hud-cell);
}

html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-grid4 > div,
html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-momentum > div,
html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-chip,
html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-proj {
  border-color: var(--hud-divider);
}

html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-divergence,
html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-ndc,
html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-proj {
  background: var(--hud-cell);
}

html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-status-magnitude,
html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-candidate,
html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-factual-value strong {
  color: #6b3d00;
}
html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-candidate {
  border-color: #81521d;
  background: #f4e7d4;
}
html[data-theme="light"] body.globe-mode #hex-country-tooltip .elu-trajectory-current.is-magnitude { stroke: #7a4300; }

html[data-theme="light"] body.globe-mode #hex-country-tooltip .tt-ctg-supply {
  border-top-color: var(--hud-divider);
}

@media (max-width: 900px) {
  body.globe-mode {
    --globe-dock-inset: 12px;
    --globe-dock-gap: 10px;
    --globe-back-width: clamp(230px, 32vw, 300px);
  }

  #elu-country-rank-rail { left: 12px; }
  #elu-country-card-wrap {
    bottom: calc(var(--globe-dock-inset) + var(--globe-dock-height) + 10px);
  }
  #hex-country-tooltip.selected {
    width: min(461px, calc(100vw - 54px)) !important;
  }
}

@media (max-width: 800px) {
  #elu-country-rank-rail {
    display: block !important;
    top: 60px;
    bottom: calc(var(--globe-dock-inset) + var(--globe-dock-height) + 10px);
    left: 8px;
    width: 72px;
    max-height: none;
    backdrop-filter: blur(10px);
  }

  .elu-rank-head {
    justify-content: center;
    padding: 8px 5px 7px;
    text-align: center;
  }

  .elu-rank-head > div { min-width: 0; }
  .elu-rank-title { font-size: 7px; letter-spacing: .8px; }
  .elu-rank-subtitle,
  .elu-rank-toggle { display: none; }

  .elu-rank-list {
    height: calc(100% - 50px);
    max-height: none;
  }

  #elu-country-rank-rail.is-collapsed .elu-rank-list { display: block; }

  .elu-rank-row {
    grid-template-columns: 15px 6px minmax(0, 1fr);
    gap: 4px;
    min-height: 44px;
    padding: 5px;
  }

  .elu-rank-name,
  .elu-rank-gap { display: none; }

  .elu-rank-code {
    display: block;
    min-width: 0;
    overflow: hidden;
    color: var(--hud-muted);
    font-family: var(--mono);
    font-size: 8px;
    letter-spacing: .4px;
    white-space: nowrap;
  }
}

@media (max-width: 720px) {
  body.globe-mode {
    --globe-dock-inset: 14px;
    --globe-dock-height: 46px;
    --globe-back-height: 46px;
    --globe-back-lift: 0px;
    --globe-back-width: calc(100vw - 28px);
  }

  #elu-country-card-wrap .tt-nav,
  body.globe-mode .hex-legend {
    display: none !important;
  }

  body.globe-mode #globe-back-btn {
    transform: none;
    padding: 9px 13px;
    font-size: 10px;
    letter-spacing: 1.35px;
  }

  #hex-country-tooltip.selected {
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    height: auto;
    padding: 12px 12px 10px;
    transform: none;
  }

  /* Mobile deck motion: a one-time affordance on entry, then short travel and
     a soft settle when the user commits or cancels a horizontal swipe. */
  #elu-country-card-wrap #hex-country-tooltip.tt-swipe-cue {
    animation: elu-country-card-swipe-cue .72s cubic-bezier(.22,.61,.36,1) .38s 1 both;
  }

  #elu-country-card-wrap #hex-country-tooltip.tt-motion-ready {
    animation: none !important;
  }

  #elu-country-card-wrap #hex-country-tooltip.tt-dragging,
  #elu-country-card-wrap #hex-country-tooltip.tt-snap,
  #elu-country-card-wrap #hex-country-tooltip.tt-fly-left,
  #elu-country-card-wrap #hex-country-tooltip.tt-fly-right,
  #elu-country-card-wrap #hex-country-tooltip.tt-enter-left,
  #elu-country-card-wrap #hex-country-tooltip.tt-enter-right {
    will-change: transform, opacity;
  }

  #elu-country-card-wrap #hex-country-tooltip.tt-snap {
    transition: transform .28s cubic-bezier(.22,.61,.36,1), opacity .22s ease;
  }

  #elu-country-card-wrap #hex-country-tooltip.tt-fly-left {
    transition: transform .22s cubic-bezier(.4,0,.2,1), opacity .18s ease;
    transform: translate3d(-135px, 3px, 0) rotate(-2deg) !important;
  }

  #elu-country-card-wrap #hex-country-tooltip.tt-fly-right {
    transition: transform .22s cubic-bezier(.4,0,.2,1), opacity .18s ease;
    transform: translate3d(135px, 3px, 0) rotate(2deg) !important;
  }

  #elu-country-card-wrap #hex-country-tooltip.tt-enter-left {
    transform: translate3d(-22px, 2px, 0) rotate(-.6deg) !important;
  }

  #elu-country-card-wrap #hex-country-tooltip.tt-enter-right {
    transform: translate3d(22px, 2px, 0) rotate(.6deg) !important;
  }

  #hex-country-tooltip.selected .tt-country { font-size: 16px; }
  #hex-country-tooltip.selected .tt-grid4 { grid-template-columns: repeat(2, 1fr); }
  #hex-country-tooltip.selected .tt-nav { display: none; }
  #hex-country-tooltip.selected .tt-hint { padding-bottom: 1px; }

  /* Preserve the card's usable scroll area inside the 60/78px HUD bands. */
  #hex-country-tooltip.selected > * { max-width: 100%; }
  #hex-country-tooltip.selected .tt-ndc { max-height: 68px; overflow: auto; }

  #elu-country-card-wrap {
    left: 90px;
    right: 10px;
    top: 60px;
    bottom: 78px;
    align-items: flex-end;
  }

  #elu-country-card-wrap #hex-country-tooltip {
    width: 100% !important;
    max-width: none;
  }
}

@media (max-width: 480px) {
  #elu-country-rank-rail {
    left: 6px;
    width: 50px;
  }

  .elu-rank-title { font-size: 0; }
  .elu-rank-title::after {
    content: '2023';
    font-size: 7px;
    letter-spacing: .8px;
  }

  .elu-rank-row {
    grid-template-columns: 6px minmax(0, 1fr);
    gap: 5px;
    padding: 5px 4px;
  }

  .elu-rank-number { display: none; }
  .elu-rank-code { font-size: 8px; letter-spacing: .2px; }

  #elu-country-card-wrap {
    left: 64px;
    right: 8px;
  }

  /* Keep the essential country name and Close control on their own row.
     The review-status badge moves below them so its intrinsic text width
     cannot collapse the heading at the 320/375px production breakpoints. */
  #hex-country-tooltip.selected .tt-topline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: start;
    gap: 6px 8px;
  }

  #hex-country-tooltip.selected .tt-country {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #hex-country-tooltip.selected .tt-pill {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: start;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  #hex-country-tooltip.selected .tt-close {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    width: 44px;
    height: 44px;
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .elu-loading-mark { animation: none; }
  body.globe-mode #topbar,
  body.globe-mode #elu-country-rank-rail,
  body.globe-mode .hex-legend,
  body.globe-mode #globe-back-btn,
  #hex-country-tooltip.selected { animation: none; }
  #globe-loading,
  #hex-country-tooltip { transition: none !important; }
  #elu-country-card-wrap #hex-country-tooltip.tt-swipe-cue { animation: none !important; }
  #elu-country-card-wrap #hex-country-tooltip.tt-fly-left,
  #elu-country-card-wrap #hex-country-tooltip.tt-fly-right,
  #elu-country-card-wrap #hex-country-tooltip.tt-enter-left,
  #elu-country-card-wrap #hex-country-tooltip.tt-enter-right {
    transform: none !important;
    opacity: 1 !important;
  }
}
