/* Carte interactive — s'appuie sur les jetons de app.css */
body[data-site="carte"] { height: 100%; }
.home-nav { display: flex; gap: 4px; height: 100%; align-items: stretch; }
.home-nav a { display: flex; align-items: center; padding: 0 14px; text-decoration: none; font: 600 15px/1 var(--head); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); border-bottom: 3px solid transparent; }
.home-nav a:hover { color: var(--text); border-bottom-color: var(--line-2); }

.map-view { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px 1fr; }
.map-side { overflow-y: auto; background: var(--bg-2); border-right: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.map-wrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: #4d6c75; }
.leaflet-container { font: 13px var(--body); }
.leaflet-control-attribution { background: rgb(21 23 27 / .7) !important; color: var(--dim) !important; }
.leaflet-control-zoom a { background: var(--panel) !important; color: var(--text) !important; border-color: var(--line-2) !important; }
.save-canvas { position: absolute; pointer-events: none; }

.drop { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 24px 14px; border: 2px dashed var(--line-2); border-radius: 10px; cursor: pointer; background: var(--bg); }
.drop.over, .drop:hover { border-color: var(--accent); }
.drop input { display: none; }
.drop code { font-size: 11px; background: var(--bg-2); padding: 2px 5px; border-radius: 4px; word-break: break-all; }
.privacy { font-size: 13px; color: var(--muted); margin: 10px 0 0; }
.progress { position: relative; height: 26px; margin-top: 12px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: rgb(245 154 35 / .35); transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 24px; }

.map-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; z-index: 500; }
.map-empty strong { font: 700 34px var(--head); text-transform: uppercase; letter-spacing: .03em; text-shadow: 0 2px 12px rgb(0 0 0 / .6); }
.map-empty span { color: var(--text); text-shadow: 0 1px 8px rgb(0 0 0 / .8); }
.map-empty[hidden] { display: none; }

.save-dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.save-dl dt { color: var(--dim); }
.save-dl dd { margin: 0; }

.layers { display: flex; flex-direction: column; gap: 2px; }
.layer-group { font: 600 12px var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin: 8px 0 2px; }
.layer { display: flex; align-items: center; gap: 8px; padding: 4px 2px; cursor: pointer; font-size: 14px; }
.layer.empty { opacity: .45; cursor: default; }
.layer input { accent-color: var(--accent); }
.sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.sw.line { height: 4px; border-radius: 2px; }
.grow { flex: 1; min-width: 0; }
.n { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 13px; }

#type-search { margin-bottom: 8px; padding: 6px 9px; }
.types { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.types li { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 5px; cursor: pointer; font-size: 14px; }
.types li:hover { background: var(--panel-2); }
.types li.active { background: rgb(245 154 35 / .14); color: var(--accent-2); }

.prod-power { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.prod-power div { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.prod-power .lbl, .info-flow .lbl { display: block; font: 600 11px var(--head); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 4px; }
.prod-power b { font: 700 20px var(--head); }
.prod-table { font-size: 13px; }
.prod-table td, .prod-table th { padding: 5px 6px; }

.map-tip { position: absolute; z-index: 700; pointer-events: none; background: rgb(21 23 27 / .92); border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 9px; font-size: 13px; max-width: 280px; }
.map-tip span { color: var(--muted); }
.map-info { position: absolute; z-index: 700; top: 12px; right: 12px; width: 320px; max-height: calc(100% - 24px); overflow-y: auto; box-shadow: 0 10px 30px rgb(0 0 0 / .45); }
.info-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.cat-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.map-info h3 { font: 700 22px/1.1 var(--head); margin: 6px 0 4px; }
.info-recipe { margin: 0 0 6px; color: var(--accent-2); }
.info-flow { margin: 8px 0; display: grid; gap: 4px; }
.coords { font-size: 12px; color: var(--dim); }

@media (max-width: 900px) {
  .map-view { grid-template-columns: 1fr; grid-template-rows: auto 70vh; }
  .map-side { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .home-nav { display: none; }
  .map-info { width: auto; left: 12px; }
}

/* ---------- Inventaire (tuiles avec icônes du jeu) ---------- */
#tile-search { margin-bottom: 6px; padding: 6px 9px; }
.inv-help { margin: 0 0 6px; font-size: 12px; }
.inv-section { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.inv-section:first-child { border-top: 0; }
.inv-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.inv-head h3 { font: 600 15px var(--head); letter-spacing: .06em; text-transform: uppercase; margin: 0; display: flex; align-items: center; }
.eye { background: var(--bg); border: 1px solid var(--line-2); color: var(--accent); border-radius: 5px; width: 28px; height: 24px; cursor: pointer; font-size: 13px; line-height: 1; }
.eye.off { color: var(--dim); }
.eye:hover { border-color: var(--accent); }
.inv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 7px; }
.tile { position: relative; aspect-ratio: 1; padding: 4px; border-radius: 7px; cursor: pointer;
  background: radial-gradient(circle at 50% 40%, #2c3138, #1d2025); border: 1px solid #7a5a2a; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .03); }
.tile:hover { border-color: var(--accent); }
.tile img { width: 100%; height: 100%; object-fit: contain; display: block; filter: drop-shadow(0 2px 2px rgb(0 0 0 / .5)); }
.tile .badge { position: absolute; top: -6px; right: -6px; background: var(--accent); color: var(--accent-ink); font: 700 11px/1 var(--head); padding: 3px 5px 2px; border-radius: 4px; white-space: nowrap; box-shadow: 0 1px 3px rgb(0 0 0 / .5); text-transform: none; letter-spacing: 0; }
.tile .tile-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tile-ph { display: grid; place-items: center; width: 100%; height: 100%; font: 700 16px var(--head); color: var(--muted); text-transform: uppercase; }
.tile-ph.player { color: var(--ok); font-size: 26px; }
.tile.off { border-color: var(--line); }
.tile.off img, .tile.off .tile-ph { opacity: .3; filter: grayscale(1); }
.tile.off .badge { background: var(--panel-2); color: var(--dim); }
.tile.focus { border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }

.map-tip { display: flex; gap: 8px; align-items: center; }
.map-tip img { width: 34px; height: 34px; object-fit: contain; }
.info-title { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; }
.info-title img { width: 54px; height: 54px; object-fit: contain; }
.info-title h3 { margin: 0; }
.prod-table td.it { display: flex; align-items: center; gap: 6px; }
.prod-table td.it img { width: 20px; height: 20px; object-fit: contain; }

/* ---------- Ressources et découvertes ---------- */
.purity { display: flex; gap: 6px; margin-bottom: 8px; }
.pur { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 6px; font-size: 13px; cursor: pointer;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px; color: var(--dim); }
.pur i { width: 10px; height: 10px; border-radius: 50%; opacity: .35; }
.pur.on { color: var(--text); border-color: var(--line-2); background: var(--panel-2); }
.pur.on i { opacity: 1; }
#free-row { margin: 4px 0 8px; }
.tile-ph.pod { color: #fff; background: #d9483b; width: 62%; height: 62%; margin: 19%; transform: rotate(45deg); border-radius: 3px; font-size: 20px; }
.pod-mark { display: inline-grid; place-items: center; width: 40px; height: 40px; background: #d9483b; color: #fff; font: 800 24px var(--head); transform: rotate(45deg); border-radius: 4px; }
.rates { margin: 8px 0; }
.rates td, .rates th { padding: 4px 6px; }
.tile-ph.pod b, .pod-mark b { display: block; transform: rotate(-45deg); }
/* Invitation à charger une sauvegarde : petite pastille en bas, sans masquer les ressources */
.map-empty { inset: auto 0 22px 0; display: flex; justify-content: center; }
.map-empty > * { display: none; }
.map-empty::before { content: 'Chargez une sauvegarde pour voir votre usine sur la carte'; background: rgb(21 23 27 / .88); border: 1px solid var(--accent);
  color: var(--text); padding: 8px 16px; border-radius: 20px; font-size: 14px; box-shadow: 0 6px 20px rgb(0 0 0 / .4); }
