/* Comercio Global — micrositio prototipo (Spatialnomics).
   Self-contained: no depende del CSS de la landing ni de pbg. The Abyss Palette. */

:root {
    --bg-abyss: #010208;
    --sapphire-depth: #0f172a;
    --titanium-pro: #3A6EA5;
    --titanium-bright: #6CA0D8;     /* tint legible de titanium para data-viz */
    --emerald-frontier: #10B981;
    --violet-ai: #7C3AED;
    --amber-anomaly: #FF9F00;
    --ruby-collapse: #E11D48;
    --battle-strong: #5BD6A8;   /* presencia fuerte (campo de batalla) */
    --focus-gold: #E2B23A;      /* elemento enfocado (seleccionado) */
    --glass-surface: rgba(255, 255, 255, 0.03);
    --line: rgba(255, 255, 255, 0.07);
    --text-primary: #FFFFFF;
    --text-secondary: #94a3b8;
    --text-faint: #5b677d;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-font-smoothing: antialiased; }
html, body {
    height: 100%; overflow: hidden;
    background: var(--bg-abyss);
    font-family: 'Inter', sans-serif; color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
#globe { position: fixed; inset: 0; z-index: 0; }
#globe canvas { display: block; }

/* ── Nav (espejo del chrome Spatialnomics) ───────────────────────────────── */
#nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 5%;
    background: rgba(1, 2, 8, 0.55); backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
}
#nav .logo {
    display: flex; align-items: center; text-decoration: none;
    font-family: 'Syne', sans-serif; font-weight: 400; font-size: 1.35rem;
    letter-spacing: 6px; text-transform: uppercase; color: var(--text-primary);
}
#nav .logo img { height: 46px; margin-right: 10px; filter: drop-shadow(0 0 8px rgba(16,185,129,0.4)); }
#nav .logo span { color: var(--emerald-frontier); }
#nav .breadcrumb {
    color: var(--text-secondary); letter-spacing: 2px; font-size: 0.78rem; margin-left: 4px;
}
#nav .breadcrumb b { color: var(--text-primary); font-weight: 700; }
.nav-right { display: flex; align-items: center; gap: 12px; }
.nav-tag {
    font-family: 'JetBrains Mono', monospace; font-size: 0.62rem; font-weight: 600;
    letter-spacing: 0.14em; color: var(--amber-anomaly);
    border: 1px solid rgba(255,159,0,0.35); background: rgba(255,159,0,0.08);
    padding: 4px 9px; border-radius: 6px;
}
.nav-share {
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; color: var(--text-secondary);
    background: rgba(255,255,255,0.05); border: 1px solid var(--line); border-radius: 8px;
    padding: 6px 11px; cursor: pointer; transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.nav-share:hover { color: var(--emerald-frontier); border-color: rgba(16,185,129,0.4); background: rgba(16,185,129,0.08); }

/* Toast (confirmación de "enlace copiado") */
.toast {
    position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%) translateY(8px);
    z-index: 40; background: rgba(7,11,22,0.95); border: 1px solid var(--line);
    color: var(--text-primary); font-size: 12px; padding: 9px 16px; border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.6); opacity: 0; pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Capa HUD (glassmorphism) ────────────────────────────────────────────── */
.hud {
    position: fixed; z-index: 20;
    background: rgba(7, 11, 22, 0.6);
    backdrop-filter: blur(14px) saturate(1.15);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
    border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 12px 44px rgba(0, 0, 0, 0.6);
}

/* Scrollbars (paleta Abyss) — finos, titanio translúcido, sin las barras blancas default */
.hud-br, .hud-bl, .help-card, .lp-kpi-pop {
    scrollbar-width: thin;
    scrollbar-color: rgba(108,160,216,0.45) transparent;
}
.hud-br::-webkit-scrollbar, .hud-bl::-webkit-scrollbar,
.help-card::-webkit-scrollbar, .lp-kpi-pop::-webkit-scrollbar { width: 9px; height: 9px; }
.hud-br::-webkit-scrollbar-track, .hud-bl::-webkit-scrollbar-track,
.help-card::-webkit-scrollbar-track, .lp-kpi-pop::-webkit-scrollbar-track { background: transparent; }
.hud-br::-webkit-scrollbar-thumb, .hud-bl::-webkit-scrollbar-thumb,
.help-card::-webkit-scrollbar-thumb, .lp-kpi-pop::-webkit-scrollbar-thumb {
    background: rgba(108,160,216,0.38); border-radius: 6px;
    border: 2px solid transparent; background-clip: padding-box;
}
.hud-br::-webkit-scrollbar-thumb:hover, .hud-bl::-webkit-scrollbar-thumb:hover,
.help-card::-webkit-scrollbar-thumb:hover, .lp-kpi-pop::-webkit-scrollbar-thumb:hover {
    background: rgba(108,160,216,0.62); background-clip: padding-box;
}
.hud-tl { top: 82px; left: 22px; padding: 16px 20px; max-width: 320px;
    transition: opacity 0.28s ease, transform 0.28s ease; }
/* En foco de Oportunidades la ficha del mercado ocupa la columna izquierda → se oculta el
   header con un fade suave para que no se superpongan (vuelve al salir del foco). */
.hud-tl.hidden { opacity: 0; transform: translateY(-10px); pointer-events: none; }
.hud-tr { top: 82px; right: 22px; padding: 14px 16px; min-width: 220px; }
.hud-bc { bottom: 22px; left: 50%; transform: translateX(-50%); padding: 6px; }
.hud-br { bottom: 22px; right: 22px; width: 322px; max-height: calc(100vh - 200px); padding: 16px 18px; overflow-y: auto; }
.hud-bl { bottom: 22px; left: 22px; width: 320px; max-height: calc(100vh - 104px); padding: 14px 16px; overflow-y: auto; }
/* 104px = top del header (82) + margen inferior (22): al llegar al tope, el borde superior de
   la ficha coincide con el límite superior del header (que está oculto en foco). */

/* ── Título / leyenda ─────────────────────────────────────────────────────── */
.g-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 22px; letter-spacing: -0.01em; }
.g-sub { font-size: 11px; color: var(--text-secondary); margin-top: 7px; line-height: 1.5; }
.g-legend { display: flex; gap: 14px; margin-top: 11px; font-size: 10.5px; color: var(--text-secondary); }
.g-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg-dot { width: 9px; height: 9px; border-radius: 3px; }
.lg-ref { background: var(--emerald-frontier); box-shadow: 0 0 8px rgba(16,185,129,0.6); }
.lg-esp {
    font-family: 'JetBrains Mono', monospace; color: var(--amber-anomaly); font-weight: 700;
    font-size: 8px; text-transform: uppercase; background: rgba(255,159,0,0.10);
    border: 1px solid rgba(255,159,0,0.32); border-radius: 4px; padding: 1px 4px;
}
.g-source {
    margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line);
    font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--text-faint); line-height: 1.5;
}

/* ── Contexto del dataset (read-only) ─────────────────────────────────────── */
.context { display: flex; flex-direction: column; gap: 8px; }
.ctx-row { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; }
.ctx-k { font-size: 9px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); }
.ctx-v { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; color: var(--text-primary); }
.ctx-ref { color: var(--emerald-frontier); }

/* Toggle HS | CIIU (CIIU abre el modal de versión completa — data-early-access). */
.ctx-seg-row { align-items: center; }
.seg { display: flex; height: 24px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg-btn { background: rgba(255,255,255,0.05); border: none; padding: 0 10px; cursor: pointer;
    font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600;
    color: var(--text-faint); transition: color .12s, background .12s; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.active { color: var(--emerald-frontier); background: rgba(16,185,129,0.12); }
.seg-btn:hover:not(.active) { color: var(--text-primary); }
/* La opción CIIU está bloqueada en la demo: se marca con un candado sutil. */
.seg-btn[data-early-access]::after { content: ' 🔒'; font-size: 9px; opacity: 0.7; }

/* ── Selector de lente ────────────────────────────────────────────────────── */
.lens-tabs { display: flex; gap: 4px; }
.lens-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px; border: none; border-radius: 11px; cursor: pointer;
    background: transparent; color: var(--text-secondary);
    font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600;
    transition: background 0.18s, color 0.18s;
}
.lens-tab .material-symbols-outlined { font-size: 17px; }
.lens-tab:hover { background: rgba(255,255,255,0.05); color: var(--text-primary); }
.lens-tab.active { background: rgba(16,185,129,0.14); color: var(--emerald-frontier); }

/* ── Panel de detalle ─────────────────────────────────────────────────────── */
.lp-head { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.lp-head .material-symbols-outlined { font-size: 20px; color: var(--emerald-frontier); }
.lp-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; }
.lp-sub { font-size: 10.5px; color: var(--text-secondary); margin-bottom: 8px; line-height: 1.45; }
.lp-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 9px; }
.lp-legend .lg-i { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--text-secondary); }
.lp-legend .lg-i i { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.lp-kpi { display: flex; align-items: baseline; gap: 8px; margin-bottom: 9px; }
/* KPI con popover (lista de destinos liderados) */
.lp-kpi-help { position: relative; cursor: help; }
.lp-kpi-help:hover .lp-kpi-lbl { color: var(--text-primary); }
.lp-kpi-pop {
    display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 8;
    min-width: 230px; max-width: 290px; padding: 9px 11px;
    background: rgba(7,11,22,0.98); border: 1px solid var(--line); border-radius: 10px;
    box-shadow: 0 10px 34px rgba(0,0,0,0.6);
}
.lp-kpi-help:hover .lp-kpi-pop { display: block; animation: helpFade 0.14s ease; }
.lp-pop-h {
    font-family: 'Inter', sans-serif; font-size: 9.5px; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-faint); margin-bottom: 6px;
}
.lp-pop-row {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding: 3px 0; font-family: 'Inter', sans-serif; font-size: 12px; color: var(--text-secondary);
}
.lp-pop-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-pop-row b { font-family: 'JetBrains Mono', monospace; color: var(--emerald-frontier); flex-shrink: 0; }
.lp-pop-agg {
    font-family: 'JetBrains Mono', monospace; font-size: 8px; font-style: normal; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--text-faint); background: rgba(255,255,255,0.06);
    border-radius: 4px; padding: 1px 4px; margin-left: 4px;
}
.lp-kpi-val { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 25px; letter-spacing: -0.02em; }
.lp-kpi-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }
.chip { font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 8px; border-radius: 20px; }
.chip-alto { background: rgba(16,185,129,0.14); color: var(--emerald-frontier); }
.chip-medio { background: rgba(255,159,0,0.14); color: var(--amber-anomaly); }
.chip-bajo { background: rgba(225,29,72,0.14); color: var(--ruby-collapse); }

/* Chip import/export del foco (TODO #8 v3): indicio de reexportación clickeable. */
.mc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 4px; }
.mc-chip-btn { border: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
    transition: filter 0.12s, box-shadow 0.12s; }
.mc-chip-btn:hover { filter: brightness(1.18); }
.mc-chip-btn.is-on { box-shadow: 0 0 0 1.5px #34D6C0; }   /* sub-foco de importaciones activo */
/* Desglose de importaciones (cian) — de quién compra el país lo que reexporta. */
.mc-rk-import { color: #34D6C0; }
.mc-row.is-import { box-shadow: inset 2px 0 0 #34D6C0; }
.mc-bar-import i { background: #34D6C0 !important; }
.mc-rk-sub { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-faint); font-size: 8.5px; }
/* Destino compartido (la referencia también vende ahí) en la card del foco de rival. */
.mc-row.is-shared .mc-row-name { color: var(--violet-ai, #7C3AED); font-weight: 600; }
/* Hub de reexportación: color cian, distinto del ámbar del espejo (distorsión opuesta). */
.src-hub {
    font-family: 'JetBrains Mono', monospace; font-size: 8px; font-weight: 700; text-transform: uppercase;
    color: #35d6c8; background: rgba(53,214,200,0.10); border: 1px solid rgba(53,214,200,0.34);
    border-radius: 4px; padding: 1px 4px; margin-left: 5px; vertical-align: middle; cursor: help; white-space: nowrap;
}

.lp-row { display: flex; align-items: center; gap: 8px; padding: 4.5px 4px; border-radius: 7px; transition: background 0.12s; }
.lp-row[data-code] { cursor: pointer; }
.lp-row:hover { background: rgba(255,255,255,0.07); }
.lp-row[data-code]:hover { box-shadow: inset 2px 0 0 var(--emerald-frontier); }
.lp-row.pinned { background: rgba(16,185,129,0.12); box-shadow: inset 2px 0 0 var(--emerald-frontier); }
.lp-row.is-ref { background: rgba(16,185,129,0.08); }
.lp-row.is-ref .lp-name { color: var(--emerald-frontier); }
.lp-rank { font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.30); min-width: 18px; text-align: right; }
.lp-name { flex: 1; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-name .src-mirror {
    font-family: 'JetBrains Mono', monospace; font-size: 8px; font-weight: 700; text-transform: uppercase;
    color: var(--amber-anomaly); background: rgba(255,159,0,0.10); border: 1px solid rgba(255,159,0,0.32);
    border-radius: 4px; padding: 1px 4px; margin-left: 5px; vertical-align: middle;
}
.lp-val { font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 600; }
.lp-meta { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--titanium-bright); min-width: 56px; text-align: right; }
.lp-empty { color: var(--text-secondary); font-size: 12px; font-style: italic; padding: 10px 0; }

/* ── Estado ───────────────────────────────────────────────────────────────── */
.g-status {
    position: fixed; left: 50%; top: 52%; transform: translate(-50%,-50%); z-index: 25;
    color: var(--text-secondary); font-size: 13px; text-align: center;
    background: rgba(7,11,22,0.8); padding: 16px 22px; border-radius: 12px;
    border: 1px solid var(--line); display: none; max-width: 360px; line-height: 1.5;
}
.g-status.show { display: block; }

/* Tooltip nativo de Globe.gl re-skineado */
.scene-tooltip {
    font-family: 'Inter', sans-serif !important; font-size: 11.5px !important;
    background: rgba(7,11,22,0.95) !important; border: 1px solid var(--line) !important;
    border-radius: 9px !important; padding: 8px 11px !important; color: var(--text-primary) !important;
    box-shadow: 0 6px 24px rgba(0,0,0,0.6) !important; backdrop-filter: blur(6px);
}
.tt-t { font-weight: 700; color: var(--emerald-frontier); margin-bottom: 3px; }
.tt-b { font-size: 11px; color: rgba(255,255,255,0.82); line-height: 1.5; }
.tt-b b { font-family: 'JetBrains Mono', monospace; }

/* ── Scrubber temporal ────────────────────────────────────────────────────── */
.scrubber {
    bottom: 80px; left: 50%; transform: translateX(-50%);
    display: flex; align-items: center; gap: 14px; padding: 10px 18px;
}
.scrub-play {
    flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
    background: rgba(16,185,129,0.14); border: 1px solid rgba(16,185,129,0.35);
    color: var(--emerald-frontier); font-size: 12px; cursor: pointer; line-height: 1;
    transition: background 0.15s, transform 0.1s;
}
.scrub-play:hover { background: rgba(16,185,129,0.24); }
.scrub-play:active { transform: scale(0.92); }
.scrub-play.playing { background: rgba(16,185,129,0.28); }
.scrub-track { position: relative; width: 280px; }
.scrub-range {
    -webkit-appearance: none; appearance: none; width: 100%; height: 4px;
    background: rgba(255,255,255,0.16); border-radius: 3px; outline: none; cursor: pointer; margin: 0;
}
.scrub-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
    background: var(--emerald-frontier); border: 2px solid #010208; cursor: grab;
    box-shadow: 0 0 0 1px rgba(16,185,129,0.5), 0 0 10px rgba(16,185,129,0.6);
}
.scrub-range::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%; background: var(--emerald-frontier);
    border: 2px solid #010208; cursor: grab; box-shadow: 0 0 10px rgba(16,185,129,0.6);
}
.scrub-ticks {
    display: flex; justify-content: space-between; margin-top: 5px;
    font-family: 'JetBrains Mono', monospace; font-size: 9px; color: var(--text-faint);
}
.scrub-tick { transition: color 0.15s; }
.scrub-tick.on { color: var(--emerald-frontier); font-weight: 700; }
.scrub-tick.prelim { color: rgba(255,159,0,0.55); }
.scrub-year {
    flex-shrink: 0; min-width: 58px; text-align: right;
    font-family: 'Syne', sans-serif; font-weight: 700; font-size: 17px;
    color: var(--text-primary); letter-spacing: -0.02em;
}
.prelim-tag {
    font-family: 'JetBrains Mono', monospace; font-size: 8px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--amber-anomaly); vertical-align: middle;
    background: rgba(255,159,0,0.12); border: 1px solid rgba(255,159,0,0.30);
    border-radius: 4px; padding: 1px 4px; margin-left: 4px;
}

/* ── Brushing inverso + foco (fila resaltada desde el globo) ───────────────── */
.lp-row.brush { background: rgba(108,160,216,0.14); box-shadow: inset 2px 0 0 var(--titanium-bright); }
.lp-row.focus-rival { background: rgba(226,178,58,0.14); box-shadow: inset 2px 0 0 var(--focus-gold); }

/* ── Banner de foco (Competidores / Oportunidades) ────────────────────────── */
.lp-focus {
    display: flex; align-items: center; gap: 7px; margin: 8px 0 6px;
    padding: 7px 9px; border-radius: 8px;
    background: rgba(255,159,0,0.10); border: 1px solid rgba(255,159,0,0.28);
    font-family: 'Inter', sans-serif; font-size: 11.5px; color: var(--text-primary);
}
.lp-focus .material-symbols-outlined { font-size: 16px; color: var(--amber-anomaly); }
.lp-focus b { font-weight: 700; }
.lp-focus-x {
    margin-left: auto; flex-shrink: 0; width: 18px; height: 18px; line-height: 16px;
    border: none; border-radius: 50%; cursor: pointer; font-size: 14px;
    background: rgba(255,255,255,0.10); color: var(--text-primary); transition: background 0.15s;
}
.lp-focus-x:hover { background: rgba(255,159,0,0.35); }
.lp-hint {
    margin: 7px 0 5px; font-family: 'Inter', sans-serif; font-size: 10.5px;
    color: var(--text-faint); font-style: italic;
}

/* ── Botón de ayuda (?) en el head del panel ──────────────────────────────── */
.lp-help-btn {
    margin-left: auto; flex-shrink: 0; width: 20px; height: 20px; line-height: 18px;
    border: 1px solid rgba(255,255,255,0.22); border-radius: 50%; cursor: pointer;
    background: rgba(255,255,255,0.06); color: var(--text-secondary);
    font-family: 'Syne', sans-serif; font-weight: 700; font-size: 12px;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.lp-help-btn:hover { background: rgba(108,160,216,0.2); color: var(--titanium-bright); border-color: rgba(108,160,216,0.5); }

/* ── Card de ayuda (overlay por lente) ────────────────────────────────────── */
.help-overlay {
    position: fixed; inset: 0; z-index: 60; display: none;
    align-items: center; justify-content: center;
    background: rgba(1,2,8,0.7); backdrop-filter: blur(4px);
}
.help-overlay.show { display: flex; animation: helpFade 0.18s ease; }
@keyframes helpFade { from { opacity: 0; } to { opacity: 1; } }
.help-card {
    position: relative; max-width: 440px; width: calc(100% - 48px); max-height: 80vh; overflow-y: auto;
    padding: 22px 24px; border-radius: 16px;
    background: rgba(7,11,22,0.97); border: 1px solid rgba(255,255,255,0.12);
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
    font-family: 'Inter', sans-serif; color: var(--text-secondary);
}
.help-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.help-head .material-symbols-outlined { font-size: 26px; color: var(--titanium-bright); }
.help-head h2 {
    margin: 0; font-family: 'Syne', sans-serif; font-weight: 700; font-size: 19px;
    color: var(--text-primary); letter-spacing: -0.01em;
}
.help-legend { margin-bottom: 14px; }
.help-body { font-size: 13px; line-height: 1.55; }
.help-body p { margin: 0 0 10px; }
.help-body ul { margin: 0 0 10px; padding-left: 18px; }
.help-body li { margin-bottom: 4px; }
.help-body b { color: var(--text-primary); }
.help-x {
    position: absolute; top: 12px; right: 12px; width: 26px; height: 26px; line-height: 22px;
    border: none; border-radius: 50%; cursor: pointer; font-size: 18px;
    background: rgba(255,255,255,0.08); color: var(--text-primary); transition: background 0.15s;
}
.help-x:hover { background: rgba(255,255,255,0.18); }

/* ── Ficha del mercado enfocado (Oportunidades) ───────────────────────────── */
.market-card { animation: mcIn 0.22s ease; }
@keyframes mcIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.mc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.mc-head .material-symbols-outlined { font-size: 20px; color: var(--amber-anomaly); }
.mc-title { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 16px;
    color: var(--text-primary); letter-spacing: -0.01em; flex: 1; }
.mc-x { flex-shrink: 0; width: 22px; height: 22px; line-height: 19px; border: none; border-radius: 50%;
    background: rgba(255,255,255,0.08); color: var(--text-primary); cursor: pointer; font-size: 15px;
    transition: background 0.15s; }
.mc-x:hover { background: rgba(255,159,0,0.32); }
.mc-sub { font-family: 'Inter', sans-serif; font-size: 11px; color: var(--text-faint); margin-bottom: 9px; }
.mc-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 9px; }
.mc-kpi { background: rgba(255,255,255,0.04); border-radius: 8px; padding: 6px 8px; }
.mc-kpi-val { font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 14px;
    color: var(--text-primary); display: block; line-height: 1.2; }
.mc-kpi-lbl { font-family: 'Inter', sans-serif; font-size: 9px; text-transform: uppercase;
    letter-spacing: 0.03em; color: var(--text-faint); }
.mc-kpi.hl .mc-kpi-val { color: var(--emerald-frontier); }
.mc-note { font-family: 'Inter', sans-serif; font-size: 10px; line-height: 1.4;
    color: var(--text-secondary); margin: -3px 0 10px; }
.mc-spark { margin-bottom: 9px; }
.mc-spark-lbl { font-family: 'Inter', sans-serif; font-size: 9px; text-transform: uppercase;
    letter-spacing: 0.03em; color: var(--text-faint); margin-bottom: 3px; }
.mc-spark svg { display: block; width: 100%; height: 34px; }
.mc-spark-ax { display: flex; justify-content: space-between; margin-top: 2px;
    font-family: 'JetBrains Mono', monospace; font-size: 8.5px; color: var(--text-faint); }
.mc-rk-lbl { font-family: 'Inter', sans-serif; font-size: 9px; text-transform: uppercase;
    letter-spacing: 0.03em; color: var(--text-faint); margin-bottom: 4px; }
.mc-row { display: flex; align-items: center; gap: 7px; padding: 2px 0; font-family: 'Inter', sans-serif;
    font-size: 11.5px; color: var(--text-secondary); }
.mc-row.is-ref { color: var(--emerald-frontier); font-weight: 600; }
.mc-row-rank { flex-shrink: 0; width: 16px; text-align: right; color: var(--text-faint); font-size: 10px; }
.mc-row-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-row-val { flex-shrink: 0; font-family: 'JetBrains Mono', monospace; }
.mc-row-share { flex-shrink: 0; width: 42px; text-align: right; font-family: 'JetBrains Mono', monospace;
    color: var(--text-faint); font-size: 11px; }
.mc-bar { position: relative; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.07);
    margin: 1px 0 3px; overflow: hidden; }
.mc-bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--titanium-bright); }
.mc-row.is-ref + .mc-bar > i { background: var(--emerald-frontier); }

@media (max-width: 760px) {
    /* Navegación mínima: Solo logo y CTA */
    .nav-tag, .nav-share { display: none !important; }
    #nav { padding: 12px 16px; background: rgba(1, 2, 8, 0.6); border-bottom: none; gap: 8px; }
    #nav .logo { font-size: 0; } /* Ocultar "SPATIALNOMICS" text */
    #nav .logo span, #nav .logo .breadcrumb { display: none; }
    #nav .nav-btn { padding: 6px 10px; font-size: 11px; } /* CTA más acorde al nuevo padding */
    
    /* Scrubber integrado dentro del nav */
    .scrubber { 
        position: static;
        flex: 1;
        justify-content: center;
        background: transparent;
        border: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        padding: 0 4px; 
        gap: 6px; 
        width: auto;
        transform: none;
    }
    .scrub-track { width: 100%; max-width: 130px; }
    .scrubber .scrub-play { width: 22px; height: 22px; font-size: 12px; }
    .scrub-year { font-size: 11.5px; min-width: auto; text-align: left; }

    /* Tarjeta de título oculta después del primer toque */
    .hud-tr { display: none; }
    .hud-tl { 
        max-width: 90vw; 
        top: calc(52px + env(safe-area-inset-top, 0px)); 
        left: 5vw; 
        padding: 10px 14px;
        transition: opacity 0.5s ease, transform 0.5s ease;
    }
    .hud-tl.hidden-by-interaction { opacity: 0; transform: translateY(-10px); pointer-events: none; }

    /* Ocultar selector de lente (se usará carrusel táctil) */
    .hud-bc { display: none !important; }

    /* Paneles inferiores (Carrusel) */
    .hud-br, .market-card { 
        width: 90vw; 
        left: 5vw; 
        right: auto; 
        bottom: calc(16px + env(safe-area-inset-bottom, 0px)); 
        max-height: 45lvh;
        padding-top: 28px; /* Espacio para el handle */
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .market-card { z-index: 22; }

    /* Handle para plegar/desplegar */
    .mobile-handle {
        position: absolute;
        top: 0; left: 0; right: 0; height: 28px;
        display: flex; align-items: center; justify-content: center;
        cursor: pointer;
    }
    .mobile-handle::after {
        content: ''; width: 36px; height: 4px;
        background: rgba(255,255,255,0.25); border-radius: 2px;
    }
    
    /* Estado Plegado */
    .hud-br.collapsed, .market-card.collapsed {
        max-height: 48px !important; 
        overflow: hidden;
    }
    
    /* Indicador de Swipe/Carrusel en el handle */
    .mobile-handle .swipe-dots {
        position: absolute; right: 16px; display: flex; gap: 4px;
    }
    .mobile-handle .swipe-dot {
        width: 4px; height: 4px; border-radius: 50%; background: rgba(255,255,255,0.2);
    }
    .mobile-handle .swipe-dot.active { background: var(--emerald-frontier); }
}

/* Hero mode */
html.hero-mode body { background: transparent !important; pointer-events: none; overflow: hidden; }
html.hero-mode .hud, html.hero-mode #nav, html.hero-mode .g-status, html.hero-mode .toast, html.hero-mode #lens-tabs { display: none !important; }


