/* Jetons repris du prototype validé (proto/web/index.html). */
:root {
  --bg: #0e0f11;
  --land: #1a1a19;
  --border: #3a3b3e;
  --panel: rgba(22, 23, 25, 0.94);
  --ink: #e8e8e6;
  --ink-2: #a9a9a5;
  --ink-3: #75756f;
  --operational: #3987e5;
  --under_construction: #d95926;
  --suspended: #199e70;
  --permanent_shutdown: #8a8a85;
  --gold: #d4af37;
  --number: #3d3e42;
  --row: #26272a;
  --row-sel: #2e3035;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font: 13px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; }
#map { position: absolute; inset: 0; }
button { background: #242528; color: var(--ink); border: 1px solid var(--border); border-radius: 5px;
  padding: 4px 9px; font: inherit; cursor: pointer; }
button:hover { border-color: var(--ink-3); }
button[aria-pressed="true"] { background: #33363b; border-color: var(--ink-2); }

.panel { position: absolute; top: 12px; left: 12px; bottom: 12px; z-index: 2; width: 320px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-y: auto;
  display: flex; flex-direction: column; }
h1 { font-size: 14px; margin: 0 0 2px; font-weight: 600; }
.sub { color: var(--ink-3); font-size: 12px; margin-bottom: 10px; }
.sect { color: var(--ink-3); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; margin: 6px 0 4px; }
.year-tag { text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.row { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.stat { color: var(--ink-3); font-size: 12px; margin-top: 4px; }

.search { position: relative; margin-bottom: 8px; }
.search input { width: 100%; background: #111214; color: var(--ink); border: 1px solid var(--border); border-radius: 5px;
  padding: 6px 8px; font: inherit; }
.search input:focus { outline: none; border-color: var(--ink-3); }
.search-results { position: absolute; left: 0; right: 0; top: 100%; z-index: 3; margin: 2px 0 0; padding: 4px; list-style: none;
  background: #17181a; border: 1px solid var(--border); border-radius: 5px; max-height: 320px; overflow-y: auto; }
.search-results li { padding: 4px 6px; border-radius: 4px; cursor: pointer; display: flex; gap: 8px; }
.search-results li:hover, .search-results li.active { background: var(--row); }
.search-results .kind { color: var(--ink-3); font-size: 11px; min-width: 52px; }

.legend label, .filter label { display: flex; align-items: center; gap: 8px; padding: 2px 0; cursor: pointer; }
.legend .n, .filter .n { margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.dot.PERMANENT_SHUTDOWN { background: transparent !important; border: 1.5px solid var(--permanent_shutdown); }
.unlocated { margin: 4px 0; color: var(--ink-2); font-size: 12px; }
.unlocated summary { cursor: pointer; }
.unlocated ul { margin: 4px 0 0; padding-left: 18px; }
.filter { margin: 4px 0; }
.filter summary { cursor: pointer; color: var(--ink-2); font-size: 12px; }
.filter .options { max-height: 220px; overflow-y: auto; padding: 4px 0 2px; }
.filter .tools { display: flex; gap: 6px; margin-bottom: 4px; }
.filter .tools button { font-size: 11px; padding: 1px 6px; }
.active-tag { color: var(--gold); font-size: 11px; }
.empty-msg { color: var(--under_construction); font-size: 12px; margin: 4px 0; }

.hovered { font-size: 14px; font-weight: 600; color: var(--ink-3); min-height: 20px; }
.hovered.on { color: var(--ink); }

.detail { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.detail .hint { color: var(--ink-3); font-size: 12px; }
.detail .head { display: flex; align-items: flex-start; gap: 8px; }
.detail h2 { font-size: 15px; margin: 0; font-weight: 600; }
.detail .close { margin-left: auto; padding: 0 7px; line-height: 20px; }
.detail .site { color: var(--ink-2); font-size: 12px; margin: 2px 0 8px; }
.detail .badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 8px; }
.detail .note { background: #2a2419; border: 1px solid #5a4a22; color: #e6d7a8; border-radius: 5px; padding: 6px 8px;
  font-size: 12px; margin: 6px 0 8px; }
.detail table { border-collapse: collapse; width: 100%; }
.detail td { padding: 3px 0; vertical-align: top; border-bottom: 1px solid var(--row); }
.detail td.k { color: var(--ink-3); width: 38%; padding-right: 10px; }
.detail .src { display: block; color: var(--ink-3); font-size: 11px; }
.detail .forecast { color: var(--under_construction); font-size: 11px; }
.detail .na { color: var(--ink-3); font-style: italic; }
.detail .units { list-style: none; margin: 4px 0 0; padding: 0; }
.detail .units li { display: flex; align-items: center; gap: 8px; padding: 3px 4px; border-radius: 4px; cursor: pointer; }
.detail .units li:hover { background: var(--row); }
.detail .units li.sel { background: var(--row-sel); }
.detail .mw { margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.detail .bars td.v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.detail .small { color: var(--ink-3); font-size: 11px; margin-top: 6px; }


@media (max-width: 700px) {
  .panel { left: 8px; right: 8px; top: auto; width: auto; max-height: 50vh; }
  .timebox { bottom: calc(50vh + 16px); }
  .maplibregl-ctrl-bottom-left { left: 0; bottom: calc(50vh + 8px); }
}

/* Production (002) */
.prod-chart { display: block; margin: 4px 0 2px; background: #141517; border-radius: 4px; }
.prod-chart path { fill: none; stroke: var(--operational); stroke-width: 1.4; }
.prod-chart .ref { stroke: var(--ink-3); stroke-width: 0.8; stroke-dasharray: 3 3; }
.prod-chart .cursor { stroke: var(--gold); stroke-width: 1; }
#hovered-prod { margin-top: 0; }

/* Cycle du combustible (003) */
.layer-toggle { display: flex; align-items: center; gap: 8px; padding: 2px 0; cursor: pointer; }
.fc-legend { margin: 2px 0 2px 22px; }
.fc-legend svg, .detail .fc-icon { flex: none; }
.fc-note { color: var(--ink-3); font-size: 11px; margin: 2px 0 0 22px; }

/* Uranium (004) */
.mine-dot { width: 11px; height: 11px; border-radius: 50%; border: 2.4px solid #7fd34e; background: var(--land);
  display: inline-block; margin-left: auto; box-sizing: border-box; }
.u-bars { display: flex; align-items: flex-end; gap: 3px; height: 54px; margin: 4px 0 2px; }
.u-bars span { flex: 1; background: #3b5a2c; border-radius: 2px 2px 0 0; min-height: 1px; }
.u-bars span.on { background: #7fd34e; }
.u-bars span.est { opacity: .6; }
.u-bars span.sec { background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgba(0,0,0,.4) 3px 5px); }
.u-years { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 10px; }
#hovered-u { margin-top: 0; }
.detail a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--ink-3); }
.detail a:hover { color: var(--ink); }

/* Gisements (007) */
.dep-dot { width: 9px; height: 9px; border-radius: 50%; background: #c8964b; display: inline-block; margin-left: auto; }
#dep-controls label { display: flex; align-items: center; gap: 6px; margin: 3px 0; }
#dep-controls select { background: #111214; color: var(--ink); border: 1px solid var(--border); border-radius: 4px; font: inherit; font-size: 11px; }

/* --- Mise en page (révision du 2026-10-01) ------------------------------------------------- */
.panel { padding: 12px 12px 8px; gap: 0; }
.hover-box { background: #141517; border: 1px solid var(--row); border-radius: 6px; padding: 6px 9px; margin-bottom: 8px; min-height: 30px; }
.hover-box .stat { margin-top: 1px; }
.hovered { font-size: 13px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.tabs button { flex: 1; background: none; border: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 6px 4px;
  color: var(--ink-3); font-weight: 600; letter-spacing: .02em; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--gold); }
.tabs button:hover { color: var(--ink-2); }
.pane { overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.views { margin-bottom: 10px; }
.views button { flex: 1; }

.layer { border: 1px solid var(--row); border-radius: 7px; margin-bottom: 8px; background: rgba(255,255,255,0.012); }
.layer-head { display: flex; align-items: center; gap: 6px; padding: 7px 8px; }
.layer-head label { display: flex; align-items: center; gap: 7px; font-weight: 600; cursor: pointer; flex: 1; }
.layer-head .year-tag { color: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.disclose { background: none; border: none; color: var(--ink-3); padding: 0 4px; font-size: 13px; transform: rotate(-90deg); transition: transform .15s; }
.disclose[aria-expanded="true"] { transform: rotate(0); }
.disclose:hover { color: var(--ink); }
.layer-body { padding: 0 8px 8px 10px; border-top: 1px solid var(--row); }
.group-title { color: var(--ink-3); font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; margin: 8px 0 2px; }
.legend label .lbl { flex: 1; }
.legend label svg, .legend label .dot { flex: none; }
.opt { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); margin: 6px 0 2px; cursor: pointer; }
.opt select { background: #111214; color: var(--ink); border: 1px solid var(--border); border-radius: 4px; font: inherit; font-size: 12px; padding: 1px 4px; }
.note-small { color: var(--ink-3); font-size: 11px; line-height: 1.4; margin-top: 6px; }
.fc-key { width: 0; height: 10px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 10px solid #c98500; display: inline-block; }
.dep-dot.th { background: #4fb3a9; margin-left: 0; }
.layer-head .mine-dot, .layer-head .dep-dot { margin-left: 0; }
input[type=checkbox] { accent-color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

.panel-foot { padding-top: 8px; border-top: 1px solid var(--row); margin-top: 6px; font-size: 11.5px; }
.panel-foot a { color: var(--ink-2); }

/* carré de l'année (bas droite) */
.timebox { position: absolute; right: 14px; bottom: 26px; z-index: 2; width: 132px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 8px 9px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.timebox input { width: 100%; background: none; border: none; color: var(--ink); text-align: center; font: 600 28px/1.1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield; padding: 2px 0; border-radius: 6px; }
.timebox input::-webkit-outer-spin-button, .timebox input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.timebox input:hover, .timebox input:focus { background: #141517; outline: none; }
.time-buttons { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 5px; }
.time-buttons button { padding: 4px 0; font-size: 15px; line-height: 1; }
.time-buttons #play { color: var(--gold); }
.time-buttons button:disabled { opacity: .35; cursor: default; }

/* contrôles de carte (haut droite) et échelle (bas, à droite du volet) */
.maplibregl-ctrl-top-right { top: 12px; right: 14px; }
.maplibregl-ctrl-top-right .maplibregl-ctrl { margin: 0 0 8px 0; float: none; }
.sources-ctrl a { display: block; background: var(--panel); color: var(--ink); border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 600; text-decoration: none; }
.sources-ctrl a:hover { border-color: var(--gold); color: var(--gold); }
.maplibregl-ctrl-group { background: var(--panel) !important; border: 1px solid var(--border); box-shadow: none !important; margin-left: auto !important; width: 31px; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--border) !important; }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(0.85); }
.maplibregl-ctrl-top-right { display: flex; flex-direction: column; align-items: flex-end; }
.maplibregl-ctrl-bottom-left { left: 346px; bottom: 6px; }
.maplibregl-ctrl-scale { background: transparent; border-color: var(--ink-3); color: var(--ink-3); font-size: 10px; }

/* mention OpenStreetMap / OpenMapTiles / OpenFreeMap : obligatoire (ODbL), aussi discrète que possible */
.osm-attrib { position: absolute; right: 14px; bottom: 6px; z-index: 2; font-size: 9px; color: #5c5c58; }
.osm-attrib a { color: #5c5c58; text-decoration: none; }
.osm-attrib a:hover { color: var(--ink-2); }
.panel { overflow: hidden; }

/* --- Révision 2 (2026-10-01) ---------------------------------------------------------------- */
h1 { font-size: 21px; letter-spacing: .01em; margin-bottom: 3px; }
.sub { font-size: 12.5px; margin-bottom: 12px; }
/* case de survol : hauteur fixe (nom + 2 lignes), le texte ne déborde jamais */
.hover-box { height: 64px; min-height: 64px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; }
.hover-box > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-foot #data-date { color: var(--ink-3); font-size: 10.5px; }
button.link { background: none; border: none; padding: 0; color: var(--ink-2); text-decoration: underline; font-size: 11.5px; cursor: pointer; }
button.link:hover { color: var(--gold); }
.sources-ctrl button { display: block; background: var(--panel); color: var(--ink); border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 600; }
.sources-ctrl button:hover { border-color: var(--gold); color: var(--gold); }

/* fenêtre des sources : marges sur les côtés, fond très légèrement transparent */
.sources-dialog { width: min(980px, calc(100vw - 120px)); max-height: calc(100vh - 80px); padding: 0;
  background: rgba(18, 19, 21, 0.93); color: var(--ink); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.55); backdrop-filter: blur(3px); }
.sources-dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.sources-dialog[open] { display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: center; padding: 14px 20px 10px; border-bottom: 1px solid var(--border); }
.dialog-head h2 { margin: 0; font-size: 17px; }
.dialog-head .close { margin-left: auto; font-size: 16px; padding: 2px 10px; }
.dialog-body { overflow-y: auto; padding: 12px 20px 22px; }
.sources-content h3 { font-size: 14px; margin: 20px 0 8px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.sources-content .lead { color: var(--ink-2); margin: 4px 0 10px; }
.sources-content ul { color: var(--ink-2); line-height: 1.55; }
.sources-content code { background: #141517; padding: 0 4px; border-radius: 3px; font-size: 12px; }
@media (max-width: 700px) { .sources-dialog { width: calc(100vw - 24px); } }

/* graphique uranium : lecture au survol */
.u-bars span { cursor: crosshair; }
.u-bars span.hover { outline: 1px solid var(--gold); outline-offset: 1px; }
.u-read { color: var(--ink-2); font-size: 11.5px; min-height: 16px; margin: 2px 0 4px; font-variant-numeric: tabular-nums; }
.sources-dialog a { color: var(--ink-2); }
.sources-dialog a:hover { color: var(--gold); }
/* sources factorisées dans les fiches */
.src-mark { color: var(--ink-2); font-size: 9px; margin-left: 2px; cursor: help; }
.src-notes { margin-top: 10px; padding-top: 6px; border-top: 1px solid var(--row); color: var(--ink-3); font-size: 11px; line-height: 1.45; }
.src-notes .m { display: inline-block; min-width: 10px; color: var(--ink-2); font-size: 9px; }
/* bouton « Comprendre » sous « Sources » ; lexique */
.sources-ctrl { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.sources-ctrl button { width: 100%; text-align: center; }
.glossary .toc { font-size: 12px; color: var(--ink-3); line-height: 1.8; margin-bottom: 4px; }
.glossary .toc a { color: var(--ink-2); }
.glossary dl { display: grid; grid-template-columns: 230px 1fr; gap: 6px 16px; margin: 6px 0; font-size: 12.5px; }
.glossary dt { color: var(--ink); font-weight: 600; }
.glossary dt .count { color: var(--ink-3); font-weight: 400; }
.glossary dd { margin: 0; color: var(--ink-2); line-height: 1.45; }
.glossary p { color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.glossary ol.cycle { color: var(--ink-2); font-size: 12.5px; line-height: 1.5; padding-left: 20px; }
.glossary section { scroll-margin-top: 8px; }
@media (max-width: 700px) { .glossary dl { grid-template-columns: 1fr; } }
.sat-link { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid var(--border); border-radius: 4px;
  font-size: 10.5px; color: var(--ink-2); text-decoration: none; white-space: nowrap; vertical-align: 1px; }
.sat-link:hover { border-color: var(--gold); color: var(--gold); }
.li-sub { display: block; color: var(--ink-3); font-size: 11px; }

/* fiche pays : éléments sans position publiée (repliables) */
#detail details { margin: 4px 0; }
#detail details > summary { cursor: pointer; font-size: 12px; color: var(--ink-2); padding: 2px 0; }
#detail details > summary:hover { color: var(--ink); }
#detail details ul.units { max-height: 240px; overflow-y: auto; }

/* mode quiz (inspiré de Jetpunk) : volet dédié, couches de la carte masquées */
.quiz-panel { gap: 8px; }
/* le volet ne défile pas (.panel { overflow: hidden }) : c'est la zone de jeu qui défile */
.quiz-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-right: -8px; padding-right: 8px; }
.quiz-head { display: flex; justify-content: space-between; align-items: flex-start; }
.quiz-head .sub { margin-bottom: 0; }
.quiz-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.quiz-tabs button { font-size: 12px; padding: 5px 4px; }
.quiz-body h2 { font-size: 16px; margin: 6px 0; }
.quiz-lead { margin: 4px 0; font-size: 13.5px; }
.quiz-note { color: var(--ink-2); font-size: 12px; margin: 6px 0; }
.quiz-go { background: #2b2a20; border-color: var(--gold); color: var(--gold); font-weight: 600; padding: 6px 12px; }
.quiz-go:hover { background: #36341f; }
.quiz-status { display: flex; justify-content: space-between; font-size: 22px; font-weight: 600;
  font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
.quiz-input { width: 100%; background: #111214; color: var(--ink); border: 1px solid var(--ink-3); border-radius: 6px;
  padding: 9px 10px; font: inherit; font-size: 15px; }
.quiz-input:focus { outline: none; border-color: var(--gold); }
.quiz-input:disabled { opacity: .5; }
.quiz-form { display: flex; gap: 6px; }
.quiz-form .quiz-input { flex: 1; }
.quiz-flash { min-height: 20px; margin: 6px 0; font-size: 12.5px; color: var(--ink-2); }
.quiz-flash.ok { color: #5cc184; }
.quiz-flash.ko { color: #e0735f; }
.quiz-country { font-size: 20px; font-weight: 600; color: var(--gold); margin: 4px 0 8px; }
.quiz-slots { columns: 2; column-gap: 14px; margin: 4px 0 8px; padding-left: 26px; font-size: 12.5px; }
.quiz-slots li { min-height: 19px; border-bottom: 1px solid var(--row); color: var(--ink); break-inside: avoid; }
.quiz-slots li.ok { color: #7fd29f; }
.quiz-slots li.ko { color: #e0735f; }
.quiz-found { list-style: none; padding: 0; margin: 4px 0 8px; columns: 2; column-gap: 12px; font-size: 12px; }
.quiz-found li { break-inside: avoid; padding: 1px 0; color: #7fd29f; }
.quiz-found li.ko { color: #e0735f; }
.quiz-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.quiz-table th { text-align: left; color: var(--ink-3); font-weight: 500; }
.quiz-table td, .quiz-table th { padding: 2px 4px; border-bottom: 1px solid var(--row); }
.quiz-table td:nth-child(n+2), .quiz-table th:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.quiz-table tr.ok td:last-child { color: #7fd29f; }
.quiz-table tr.near td:last-child { color: var(--gold); }
.quiz-table tr.ko td:last-child { color: #e0735f; }
.quiz-result { background: #1d1e21; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; margin: 4px 0 8px;
  font-size: 14px; }
.quiz-pick { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.quiz-pick select { flex: 1; background: #111214; color: var(--ink); border: 1px solid var(--border); border-radius: 5px; padding: 5px; font: inherit; }

/* l'attribut hidden l'emporte sur les display des composants (volet, frise) */
[hidden] { display: none !important; }
