:root {
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', ui-sans-serif, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --accent: #0a84ff;
  --up: #d8434e;
  --down: #248a3d;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.9);
  --hairline: rgba(0, 0, 0, 0.07);
  --fill: rgba(0, 0, 0, 0.05);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 40, 60, 0.06), 0 8px 28px rgba(20, 60, 90, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: #e3f0f8; color: var(--text); font-family: var(--font); font-size: 13px; -webkit-font-smoothing: antialiased; letter-spacing: -0.005em; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
b { font-weight: 600; }

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; }
.label-layer { position: fixed !important; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1s; }
.label-layer.labels-ready { opacity: 1; }

/* ------------------------------------------------------------ glass surfaces */
.panel, .timeline, .cam-dock, .tooltip, .dossier, .sources-card, .chip {
  background: var(--glass);
  backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------ top bar */
.topbar {
  position: fixed; top: 20px; left: 24px; right: 24px; z-index: 10; display: flex; align-items: flex-start; gap: 16px; pointer-events: none;
  opacity: 0; transform: translateY(-10px); transition: all 0.9s var(--ease) 0.3s;
}
.ready .topbar { opacity: 1; transform: none; }
.topbar > * { pointer-events: auto; }
.brand h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.025em; color: var(--text); text-shadow: 0 1px 12px rgba(255, 255, 255, 0.8); }
.brand p { color: var(--text-2); font-size: 13px; margin-top: 2px; text-shadow: 0 1px 8px rgba(255, 255, 255, 0.9); }
.brand p b { color: var(--text); font-weight: 600; }
.chip { margin-left: auto; border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500; transition: transform 0.2s var(--ease), background 0.2s; }
.chip:hover { background: var(--glass-strong); transform: translateY(-1px); }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.chip.small { padding: 3px 10px; font-size: 11.5px; box-shadow: none; border: 1px solid var(--hairline); background: rgba(255, 255, 255, 0.6); }
.chip.small.on { background: var(--text); color: #fff; border-color: var(--text); }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-right .chip { margin-left: 0; }


/* segmented view switch (Blocks | Every child) */
.seg {
  position: absolute; left: 50%; top: 0; transform: translateX(-50%); display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.6); backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.7); box-shadow: var(--shadow);
}
.seg button { position: relative; z-index: 1; padding: 7px 18px; font-size: 13px; font-weight: 500; color: var(--text-2); border-radius: 999px; transition: color 0.3s; white-space: nowrap; }
.seg button.on { color: var(--text); }
.seg-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); transform: translateX(var(--x, 0%)); transition: transform 0.45s var(--ease); }

/* ------------------------------------------------------------ panels */
.panel {
  position: fixed; z-index: 8; border-radius: var(--radius);
  opacity: 0; transition: opacity 0.8s var(--ease), transform 1s var(--ease);
}
.panel.left { top: 92px; left: 24px; width: 292px; max-height: calc(100vh - 180px); overflow-y: auto; transform: translateX(-24px); transition-delay: 1.3s;
  /* soft fade at the bottom edge hints that the panel scrolls on short screens */
  -webkit-mask-image: linear-gradient(#000 calc(100% - 28px), transparent); mask-image: linear-gradient(#000 calc(100% - 28px), transparent); }
.panel.left section:last-child { padding-bottom: 26px; }
.panel.rank { top: 92px; right: 24px; width: 264px; padding: 14px 10px 10px; transform: translateX(24px); transition-delay: 1.6s; }
.ready .panel { opacity: 1; transform: none; }
.dossier-open .panel.rank { opacity: 0; transform: translateX(40px); pointer-events: none; transition-delay: 0s; }
.panel section { padding: 11px 16px; border-bottom: 1px solid var(--hairline); }
#nat-spark .spark { height: 30px; }
.panel section:last-child { border-bottom: 0; }
.p-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; padding: 0 2px; }
.p-title .hint { color: var(--text-3); font-weight: 400; margin-left: auto; }
.p-title .chip { margin-left: auto; }
.rank .p-title { color: var(--text); font-size: 13px; padding: 0 8px; }
.panel::-webkit-scrollbar, .dossier::-webkit-scrollbar { width: 0; }

/* national */
.nat-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 10px; }
.nat-grid b { display: block; font-size: 30px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.nat-grid label { font-size: 11.5px; color: var(--text-2); }
.nat-delta { font-size: 12px; color: var(--text-2); margin: 6px 0 4px; }
.up { color: var(--up); } .down { color: var(--down); }

/* metric list */
#metric-list { display: flex; flex-direction: column; gap: 1px; }
.metric { display: flex; align-items: center; gap: 10px; text-align: left; padding: 5px 8px; border-radius: 9px; transition: background 0.2s; }
.metric .k { font-size: 11px; color: var(--text-3); width: 10px; font-variant-numeric: tabular-nums; }
.metric .t { flex: 1; font-size: 13px; }
.metric .tag { font-size: 10.5px; color: var(--accent); background: rgba(10, 132, 255, 0.1); padding: 1px 7px; border-radius: 999px; }
.metric:hover { background: var(--fill); }
.metric.on { background: var(--accent); color: #fff; }
.metric.on .k { color: rgba(255, 255, 255, 0.7); }
.metric.on .tag { background: rgba(255, 255, 255, 0.22); color: #fff; }
.metric-desc { color: var(--text-2); font-size: 12px; line-height: 1.45; margin-top: 8px; padding: 0 2px; }

/* legend */
.legend-title { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.legend-title span { color: var(--text-2); font-weight: 400; margin-left: 4px; }
.legend-bar { height: 10px; border-radius: 999px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04); }
.legend-scale { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-2); margin-top: 6px; font-variant-numeric: tabular-nums; }
.legend-scale span:first-child, .legend-scale span:last-child { color: var(--text); font-weight: 500; }
.legend-note { color: var(--text-2); font-size: 12px; line-height: 1.45; } .legend-note b { color: var(--text); }
.legend-dots { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; margin-bottom: 6px; }
.legend-dots i { flex: none; width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px #fff, 0 1px 3px rgba(0, 0, 0, 0.2); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }
.view-dots .metric { opacity: 0.55; }
.view-dots .metric:hover { opacity: 1; }

/* regions */
#regions { display: flex; flex-wrap: wrap; gap: 5px; }
.region { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 999px; background: var(--fill); transition: background 0.2s, transform 0.2s var(--ease); }
.region i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.region span { font-size: 12px; }
.region em, .region b { display: none; }
.region:hover { background: color-mix(in srgb, var(--c) 22%, white); transform: translateY(-1px); }

/* ranking */
#rank-list { display: flex; flex-direction: column; max-height: calc(100vh - 270px); overflow-y: auto; overflow-x: hidden; scrollbar-width: none; }
.row { position: relative; display: grid; grid-template-columns: 20px 1fr auto; grid-template-rows: auto 4px; column-gap: 8px; padding: 4px 8px 5px; cursor: pointer; border-radius: 8px; transition: background 0.2s; background: #f7f9fa; }
.row .pos { color: var(--text-3); font-size: 11px; align-self: center; font-variant-numeric: tabular-nums; }
.row .nm { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .val { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row .bar { grid-column: 2 / 4; height: 4px; background: var(--fill); border-radius: 999px; margin-top: 3px; overflow: hidden; }
.row .bar i { display: block; height: 100%; background: var(--c); border-radius: 999px; transition: width 0.9s var(--ease); }
.row:hover, .row.hot { background: #eceff1; }
.row.sel { background: #e3effd; }

/* ------------------------------------------------------------ map labels */
/* the root is the anchor (moved by CSS2DRenderer every frame: no transform transition here) */
.la-label { position: relative; pointer-events: none; transition: opacity 0.4s; font-variant-numeric: tabular-nums; }
.la-inner { display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform 0.35s var(--ease), opacity 0.25s; }
/* nudged or collapsed labels leave a small dot on the exact spot, with a leader line to the pill */
.la-label::before {
  content: ''; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 1.5px rgba(29, 29, 31, 0.45), 0 1px 3px rgba(0, 0, 0, 0.2);
  opacity: 0; transform: scale(0.4); transition: opacity 0.25s, transform 0.35s var(--ease);
}
.la-label::after {
  content: ''; position: absolute; left: 50%; top: 50%; height: 1.5px; width: var(--len, 0); margin-top: -0.75px; z-index: -1;
  background: rgba(29, 29, 31, 0.35); transform-origin: 0 50%; transform: rotate(var(--ang, 0rad)); opacity: 0; transition: opacity 0.25s;
}
.la-label.moved::before, .la-label.collapsed::before { opacity: 1; transform: scale(1); }
.la-label.moved::after { opacity: 1; }
.la-label.collapsed .la-inner { opacity: 0; transform: scale(0.6) !important; }
.labels-off .la-label:not(.active)::before, .labels-off .la-label:not(.active)::after { display: none; }
.la-label .v, .la-label .n {
  background: rgba(255, 255, 255, 0.88); color: var(--text); border-radius: 999px; padding: 1px 7px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); white-space: nowrap;
}
.la-label .v { font-size: 11px; font-weight: 600; }
.la-label .n { font-size: 10.5px; font-weight: 500; }
.labels-values .la-label .n { display: none; }
.labels-names .la-label .v { display: none; }
.labels-off .la-label:not(.active) { opacity: 0; }
.la-label.dim { opacity: 0.25; }
.la-label.active { opacity: 1; z-index: 10; }
.la-label.active .v, .la-label.active .n { display: block; }
.la-label.active .n { background: var(--text); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 10px; transform: translateY(-22px); }
.la-label.active .v { display: none; }
.sea-label, .land-label { display: flex; flex-direction: column; align-items: center; pointer-events: none; text-align: center; }
.sea-label span { font-size: 12px; font-style: italic; font-weight: 500; color: #3d7fae; letter-spacing: 0.02em; }
.sea-label em { font-size: 10.5px; color: #6aa1c7; }
.land-label span { font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: #9aab8e; }
.land-label em { font-size: 10.5px; font-style: italic; color: #b3c0a8; }

/* ------------------------------------------------------------ compass */
.compass {
  position: fixed; right: 24px; bottom: 24px; z-index: 9; width: 56px; height: 56px; border-radius: 50%; padding: 0;
  background: var(--glass); backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.7); box-shadow: var(--shadow);
  transform: perspective(240px) rotateX(var(--tilt, 0deg)); transition: opacity 0.6s var(--ease), box-shadow 0.2s;
  opacity: 0;
}
.ready .compass { opacity: 1; transition-delay: 2.3s; }
.dossier-open .compass { opacity: 0; pointer-events: none; transition-delay: 0s; }
.compass:hover { box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25), var(--shadow); }
.compass svg { width: 100%; height: 100%; display: block; }
#compass-rose { transform-origin: 28px 28px; }
.c-ring { fill: none; stroke: var(--hairline); }
.c-ticks line { stroke: var(--text-3); stroke-width: 1.5; stroke-linecap: round; }
.c-n { fill: #ff3b30; } .c-s { fill: #c7c7cc; }
.c-hub { fill: #fff; stroke: var(--text-3); }
.c-label { font-size: 7px; font-weight: 700; fill: var(--text); font-family: var(--font); }

/* ------------------------------------------------------------ tooltip */
.tooltip {
  position: fixed; top: 0; left: 0; z-index: 20; width: 270px; pointer-events: none; border-radius: 16px; overflow: hidden;
  background: var(--glass-strong); opacity: 0; transition: opacity 0.18s, transform 0.12s linear;
}
.tooltip.show { opacity: 1; }
.tooltip.show > * { animation: ttIn 0.4s var(--ease) both; }
.tooltip.show > *:nth-child(2) { animation-delay: 0.04s; } .tooltip.show > *:nth-child(3) { animation-delay: 0.08s; }
.tooltip.show > *:nth-child(4) { animation-delay: 0.12s; } .tooltip.show > *:nth-child(5) { animation-delay: 0.16s; }
@keyframes ttIn { from { opacity: 0; transform: translateY(6px); } }
.tt-head { padding: 14px 16px 10px; }
.tt-code { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.tt-code i, .d-code i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tt-name { font-size: 21px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; margin-top: 2px; }
.tt-cy { color: var(--text-2); font-size: 13px; }
.tt-metric { padding: 0 16px 12px; }
.tt-label { font-size: 12px; color: var(--text-2); }
.tt-big { display: flex; align-items: baseline; gap: 6px; }
.tt-big span { font-size: 34px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tt-big small { font-size: 12px; color: var(--text-2); }
.tt-rank { font-size: 12px; color: var(--text-2); }
.tt-rank b { color: var(--text); }
.tt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--hairline); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.tt-grid > div { padding: 8px 16px; background: var(--glass-strong); }
.tt-grid label { display: block; font-size: 11.5px; color: var(--text-2); }
.tt-grid b { font-size: 16px; font-variant-numeric: tabular-nums; }
.tt-grid em { display: block; font-style: normal; font-size: 11px; }
.tt-spark { padding: 10px 16px 4px; }
.tt-spark label { font-size: 11.5px; color: var(--text-2); }
.tt-spark label i { font-style: normal; color: var(--text-3); }
.tt-hint { font-size: 12px; font-weight: 500; color: var(--accent); padding: 4px 16px 12px; }

.spark { width: 100%; height: 44px; display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease) forwards 0.1s; }
.spark-area { fill: rgba(10, 132, 255, 0.08); }
.spark-ref { fill: none; stroke: var(--text-3); stroke-width: 1.2; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.spark-dot { fill: var(--accent); stroke: #fff; stroke-width: 1.5; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ------------------------------------------------------------ dossier */
.dossier {
  position: fixed; top: 92px; right: 24px; bottom: 24px; width: 400px; z-index: 12; overflow-y: auto; overflow-x: hidden;
  border-radius: 22px; background: var(--glass-strong);
  transform: translateX(calc(100% + 40px)); transition: transform 0.7s var(--ease);
}
.dossier.open { transform: none; }
.dossier .close { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border-radius: 50%; background: var(--fill); color: var(--text-2); font-size: 12px; z-index: 2; transition: background 0.2s, transform 0.3s var(--ease); }
.dossier .close:hover { background: rgba(0, 0, 0, 0.1); transform: rotate(90deg); }
.dossier header { padding: 22px 22px 14px; }
.d-code { font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.dossier h2 { font-size: 32px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.1; margin-top: 4px; }
.d-cy { color: var(--text-2); font-size: 15px; }
.dossier section { padding: 14px 22px; border-top: 1px solid var(--hairline); }
.dossier h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dossier h3 .sub { color: var(--text-2); font-weight: 400; }
.dossier h3 .key { margin-left: auto; font-weight: 400; font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 5px; }
.k-la, .k-w { display: inline-block; width: 12px; height: 2px; border-radius: 2px; background: var(--accent); }
.k-w { background: var(--text-3); margin-left: 6px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-top: 0 !important; padding-top: 0 !important; }
.kpi { background: var(--fill); border-radius: 14px; padding: 12px 14px; }
.kpi label { display: block; font-size: 12px; color: var(--text-2); }
.kpi b { display: block; font-size: 32px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi em { font-style: normal; font-size: 11.5px; color: var(--text-2); }
.kpi em.up { color: var(--up); } .kpi em.down { color: var(--down); }
.vs { border-top: 0 !important; padding-top: 2px !important; }
.vs-track { position: relative; height: 8px; background: var(--fill); border-radius: 999px; margin: 18px 0 4px; }
.vs-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); border-radius: 999px; background: linear-gradient(90deg, #9edcc0, #ffe28a, #f4795b); animation: grow 1.2s var(--ease) both 0.3s; }
@keyframes grow { from { width: 0; } }
.vs-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--text); }
.vs-mark span { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--text-2); }

.trend { width: 100%; height: auto; display: block; overflow: visible; }
.trend .grid { stroke: var(--hairline); }
.trend .axis { fill: var(--text-3); font-size: 10px; font-family: var(--font); }
.trend-line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.8s var(--ease) forwards 0.4s; }
.trend-ref { fill: none; stroke: var(--text-3); stroke-width: 1.4; stroke-dasharray: 4 4; }
.trend-area { animation: fadeIn 1.5s both 0.9s; }
.trend-dot { fill: var(--accent); stroke: #fff; stroke-width: 2; animation: fadeIn 0.4s both 2s; }
@keyframes fadeIn { from { opacity: 0; } }
.note { font-size: 12px; color: var(--text-2); margin-top: 4px; }

.stack { display: flex; height: 12px; gap: 2px; border-radius: 999px; overflow: hidden; }
.stack i { width: var(--w); background: var(--c); animation: growW 1s var(--ease) both 0.4s; transform-origin: left; }
@keyframes growW { from { transform: scaleX(0); } }
.stack-key { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; margin-top: 10px; }
.stack-key span { display: grid; grid-template-columns: 8px 1fr auto 32px; gap: 6px; align-items: center; font-size: 12px; }
.stack-key i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.stack-key b { font-variant-numeric: tabular-nums; }
.stack-key em { font-style: normal; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }

.split { display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px; }
.cols { display: flex; gap: 6px; height: 104px; align-items: flex-end; }
.col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; gap: 3px; }
.col span { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.col span i { width: 100%; height: var(--h); background: var(--accent); border-radius: 6px 6px 3px 3px; animation: growH 1s var(--ease) both 0.5s; transform-origin: bottom; }
@keyframes growH { from { transform: scaleY(0); } }
.col b { font-size: 11.5px; font-variant-numeric: tabular-nums; } .col label { font-size: 11px; color: var(--text-2); }
.ring-stat { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ring-stat svg { width: 54px; height: 54px; transform: rotate(-90deg); }
.ring-stat circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.ring-stat .bg { stroke: var(--fill); }
.ring-stat .fg { stroke: #30d158; stroke-dasharray: calc(var(--p) * 1.005) 200; animation: ringIn 1.4s var(--ease) both 0.5s; }
@keyframes ringIn { from { stroke-dasharray: 0 200; } }
.ring-stat b { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; display: block; line-height: 1; }
.ring-stat label { font-size: 11.5px; color: var(--text-2); }
.mini { font-size: 12px; color: var(--text-2); padding: 2px 0; }
.mini b { color: var(--text); } .mini b.warn { color: var(--up); }

.hbar { display: grid; grid-template-columns: 150px 1fr 36px; align-items: center; gap: 8px; padding: 3px 0; font-size: 12px; }
.hbar label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar span { height: 6px; background: var(--fill); border-radius: 999px; overflow: hidden; }
.hbar i { display: block; height: 100%; width: var(--w); background: var(--accent); border-radius: 999px; animation: growW 1s var(--ease) both 0.5s; transform-origin: left; }
.hbar b { text-align: right; font-variant-numeric: tabular-nums; }
.hbar abbr { color: var(--text-3); text-decoration: none; font-weight: 400; }
.dossier h3 .sub { margin-left: 2px; }
.waffle { width: 100%; height: auto; display: block; }
.waffle circle { transform-box: fill-box; transform-origin: center; animation: pop 0.45s var(--ease) both; animation-delay: calc(var(--d) + 0.3s); }
@keyframes pop { from { transform: scale(0); opacity: 0; } }

/* content note: sensitive figures fold away until the reader chooses to open them */
.cn summary { list-style: none; cursor: pointer; display: grid; gap: 3px; padding: 12px 14px 12px 40px; border-radius: 14px; background: var(--fill); position: relative; transition: background 0.2s; }
.cn summary::-webkit-details-marker { display: none; }
.cn summary::before { content: ''; position: absolute; left: 15px; top: 15px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1.5px var(--text-3); }
.cn summary::after { content: ''; position: absolute; left: 20px; top: 19px; width: 4px; height: 4px; border-right: 1.5px solid var(--text-2); border-bottom: 1.5px solid var(--text-2); transform: rotate(-45deg); transition: transform 0.3s var(--ease); }
.cn[open] summary::after { transform: rotate(45deg); top: 18px; }
.cn summary:hover { background: rgba(0, 0, 0, 0.07); }
.cn-title { font-size: 13px; font-weight: 600; }
.cn-note { font-size: 12px; color: var(--text-2); line-height: 1.4; }
.cn[open] summary { margin-bottom: 14px; }
.cn[open] > *:not(summary) { animation: ttIn 0.5s var(--ease) both; }
.dossier h3.gap { margin-top: 16px; }
.support { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-top: 12px; }
.support a, .dossier footer a { color: var(--accent); text-decoration: none; }
.sources-card .lede { color: var(--text); font-size: 14px; margin-bottom: 10px; }
.sources-card p + p { margin-top: 8px; }
.ctx { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ctx > div { background: var(--fill); border-radius: 12px; padding: 10px 12px; }
.ctx b { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; display: block; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ctx label { font-size: 11.5px; color: var(--text-2); line-height: 1.35; display: block; }
.dossier footer { padding: 12px 22px 20px; font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

/* ------------------------------------------------------------ timeline */
.timeline {
  /* centred in the free strip between the camera dock (left) and the screen edge / profile card (right) */
  /* right: clear of the compass (24px edge + 56px dial + 24px gap) */
  position: fixed; bottom: 24px; left: 470px; right: 104px; margin: 0 auto; max-width: 680px; z-index: 9;
  display: flex; align-items: center; gap: 14px; padding: 10px 18px 10px 10px; border-radius: 999px;
  opacity: 0; transform: translateY(20px); transition: opacity 0.8s var(--ease) 1.9s, transform 1s var(--ease) 1.9s, right 0.6s var(--ease);
}
.ready .timeline { opacity: 1; transform: none; }
.dossier-open .timeline { right: 444px; transition-delay: 0s; }
.play { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; flex: none; transition: transform 0.2s var(--ease), box-shadow 0.2s; box-shadow: 0 4px 12px rgba(10, 132, 255, 0.35); }
.play:hover { transform: scale(1.06); }
.track { position: relative; flex: 1; height: 36px; --k: 14px; }
/* bar + knob sit on the top line; the year labels sit clear underneath */
.track input { position: absolute; left: 0; right: 0; top: 0; height: 18px; margin: 0; width: 100%; appearance: none; -webkit-appearance: none; background: transparent; cursor: pointer; z-index: 2; }
.track::before { content: ''; position: absolute; left: 0; right: 0; top: 7px; height: 4px; border-radius: 999px; background: var(--fill); }
.track::after { content: ''; position: absolute; left: 0; width: calc(var(--k) / 2 + (100% - var(--k)) * var(--f, 1)); top: 7px; height: 4px; border-radius: 999px; background: var(--accent); transition: width 0.45s var(--ease); }
/* the native thumb is an invisible hit area; the visible knob is drawn separately so it can glide */
.track input::-webkit-slider-thumb { -webkit-appearance: none; width: var(--k); height: 18px; opacity: 0; }
.track input::-moz-range-thumb { width: var(--k); height: 18px; border: 0; opacity: 0; }
.track input::-webkit-slider-runnable-track { height: 18px; }
.knob { position: absolute; top: 2px; left: calc(var(--k) / 2 + (100% - var(--k)) * var(--f, 1)); width: var(--k); height: var(--k); margin-left: calc(var(--k) / -2); border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 0.5px rgba(0, 0, 0, 0.08); pointer-events: none; z-index: 1; transition: left 0.45s var(--ease), transform 0.2s var(--ease); }
.track:hover .knob { transform: scale(1.15); }
.timeline.playing .track::after, .timeline.playing .knob { transition: none; }
.timeline.playing .knob { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), 0 0 0 4px rgba(10, 132, 255, 0.22); }
.ticks span { position: absolute; top: 20px; left: calc(var(--k) / 2 + (100% - var(--k)) * var(--f)); transform: translateX(-50%); font-size: 10.5px; line-height: 1; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ticks span:first-child { left: 0; transform: none; } .ticks span:last-child { left: auto; right: 0; transform: none; }
.yr { text-align: right; flex: none; white-space: nowrap; }
.yr label { display: none; }
.yr b { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.tl-off { z-index: 3; display: none; font-size: 12.5px; color: var(--text-2); position: absolute; inset: 0; align-items: center; justify-content: center; border-radius: 999px; background: rgba(255, 255, 255, 0.82); }
.timeline.disabled .tl-off { display: flex; }

/* ------------------------------------------------------------ camera dock */
.cam-dock {
  position: fixed; left: 24px; bottom: 24px; z-index: 9; display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  opacity: 0; transform: translateY(16px); transition: all 0.9s var(--ease) 2.1s;
}
.ready .cam-dock { opacity: 1; transform: none; }
.cam-dock button { padding: 7px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--text-2); transition: all 0.2s; }
.cam-dock button:hover { color: var(--text); background: var(--fill); }
.cam-dock button.on { color: #fff; background: var(--text); }
.cam-dock .sep { width: 1px; background: var(--hairline); margin: 6px 3px; }

/* ------------------------------------------------------------ sources modal */
.sources { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; background: rgba(230, 240, 248, 0.5); backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity 0.35s; }
.sources.open { opacity: 1; pointer-events: auto; }
.sources-card { position: relative; width: min(540px, 90vw); padding: 26px 28px; border-radius: 22px; background: var(--glass-strong); transform: scale(0.97) translateY(8px); transition: transform 0.5s var(--ease); }
.sources.open .sources-card { transform: none; }
.sources-card h3 { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 8px; }
.sources-card p { color: var(--text-2); line-height: 1.5; font-size: 13px; }
.sources-card ul { list-style: none; margin: 14px 0; }
.sources-card li { padding: 6px 0; border-bottom: 1px solid var(--hairline); }
.sources-card a { color: var(--accent); text-decoration: none; font-size: 13px; }
.sources-card a:hover { text-decoration: underline; }
.sources-card .close { position: absolute; top: 16px; right: 16px; width: 28px; height: 28px; border-radius: 50%; background: var(--fill); color: var(--text-2); font-size: 12px; }
.kbd b { color: var(--text); }

/* ------------------------------------------------------------ loading */
.boot { position: fixed; inset: 0; z-index: 100; background: #e3f0f8; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.boot-inner { text-align: center; }
.boot-title { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }
.boot-sub { font-size: 14px; color: var(--text-2); margin-top: 4px; }
.boot-bar { width: 180px; height: 4px; border-radius: 999px; background: rgba(0, 0, 0, 0.07); margin: 18px auto 0; overflow: hidden; }
.boot-bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 999px; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .panel.rank { display: none; }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .brand p { display: none; }
}

/* ------------------------------------------------------------ phones: full-bleed map, chip row, bottom sheet */
@media (max-width: 760px) {
  body { font-size: 13px; }
  .topbar { top: 12px; left: 14px; right: 14px; flex-wrap: wrap; gap: 8px; }
  .brand h1 { font-size: 18px; }
  .brand p { font-size: 12px; }
  .chip { padding: 5px 11px; font-size: 12px; }
  .seg { position: relative; left: auto; top: auto; transform: none; order: 3; width: 100%; }
  .seg button { padding: 6px 10px; }

  /* the left panel becomes a legend pill + swipeable layer chips above the timeline */
  .panel.left {
    top: auto; bottom: 78px; left: 0; right: 0; width: auto; max-height: none; overflow: visible;
    display: flex; flex-direction: column; gap: 8px;
    background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; border-radius: 0;
    -webkit-mask-image: none; mask-image: none;
  }
  .panel.left section { padding: 0; border: 0; }
  .panel.left .national, .panel.left section:last-child, .p-title, .metric-desc { display: none; }
  #legend { order: 1; margin: 0 14px; padding: 10px 14px; border-radius: 16px; background: var(--glass); backdrop-filter: blur(24px) saturate(1.8); -webkit-backdrop-filter: blur(24px) saturate(1.8); box-shadow: var(--shadow); }
  .legend-title { font-size: 12px; margin-bottom: 6px; }
  .panel.left section:nth-child(2) { order: 2; }
  #metric-list { flex-direction: row; gap: 6px; overflow-x: auto; padding: 2px 14px 6px; scroll-snap-type: x proximity; scrollbar-width: none; }
  #metric-list::-webkit-scrollbar { display: none; }
  .metric { flex: none; scroll-snap-align: start; padding: 7px 13px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: 0 1px 2px rgba(20, 40, 60, 0.08); }
  .metric .k, .metric .tag { display: none; }
  .metric .t { font-size: 12.5px; white-space: nowrap; }

  .timeline { left: 12px; right: 12px; bottom: 14px; padding: 6px 14px 6px 6px; gap: 10px; }
  .play { width: 34px; height: 34px; }
  .ticks span { visibility: hidden; }
  .ticks span:first-child, .ticks span:last-child { visibility: visible; }
  .yr b { font-size: 16px; }
  .cam-dock, .tooltip, .panel.rank { display: none !important; }
  .top-right { gap: 6px; }
  .compass { top: 146px; bottom: auto; right: 14px; width: 44px; height: 44px; }

  /* profile slides up as a bottom sheet */
  .dossier {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 74vh; border-radius: 22px 22px 0 0;
    transform: translateY(105%);
  }
  .dossier.open { transform: none; }
  .dossier header::before { content: ''; position: absolute; top: 8px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 999px; background: rgba(0, 0, 0, 0.15); }
  .dossier header { position: relative; padding-top: 24px; }
  .dossier h2 { font-size: 28px; }
  .dossier section { padding: 12px 18px; }
  .hbar { grid-template-columns: 128px 1fr 32px; }
  .dossier-open .panel.left, .dossier-open .timeline { opacity: 0; pointer-events: none; transition-delay: 0s; }

  .la-label .v { font-size: 9.5px; padding: 0 5px; }
  .la-label .n { font-size: 9.5px; }
  .sea-label span, .land-label span { font-size: 10px; }
  .sea-label em, .land-label em { display: none; }
  .sources-card { max-height: 86vh; overflow-y: auto; padding: 22px 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------ cloud cover (zoomed right out) */
.cloud-cover { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.cc-fill { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, #fbfcff 0%, #eef2fb 55%, #dde5f5 100%); }
.cloud-cover img { position: absolute; height: auto; will-change: transform, opacity; }
.cloud-cover img { animation: ccDrift 14s ease-in-out infinite alternate; animation-delay: var(--d); }
@keyframes ccDrift { from { translate: -1vmax 0.3vmax; scale: var(--flip, 1) 1; } to { translate: 1.2vmax -0.5vmax; scale: var(--flip, 1) 1; } }
.cc-hint {
  position: absolute; z-index: 1; left: 50%; top: 50%; translate: -50% -50%; margin: 0; padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; color: #5b6f94; background: rgba(255, 255, 255, 0.8); box-shadow: 0 2px 12px rgba(120, 140, 190, 0.18);
}


/* ------------------------------------------------------------ VFCC home link + no-WebGL fallback */
.home-link { flex: none; display: block; height: 46px; margin: -4px -4px 0 -6px; transition: transform 0.3s var(--ease); }
.home-link img { height: 100%; width: auto; display: block; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.12)); }
.home-link:hover { transform: scale(1.05) rotate(-2deg); }
@media (max-width: 760px) { .home-link { height: 34px; } }
.no-webgl { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 24px; background: #e3f0f8; text-align: center; }
.no-webgl[hidden] { display: none; }
.no-webgl h2 { font-size: 20px; margin-bottom: 8px; }
.no-webgl p { max-width: 420px; color: var(--text-2); font-size: 14px; line-height: 1.5; margin: 0 auto 16px; }
.no-webgl a { color: var(--accent); font-weight: 600; }
