:root {
  --bg: #0e0b08;
  --surface: rgba(24, 18, 12, .88);
  --surface-solid: #18120c;
  --card: #1f1810;
  --line: rgba(232, 174, 72, .18);
  --line-strong: rgba(232, 174, 72, .42);
  --amber: #e8ae48;
  --amber-deep: #b8701c;
  --foam: #f4ead6;
  --muted: #a8957a;
  --ok: #8fc27a;
  --radius: 14px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --header-h: 68px;
  --panel-w: 420px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--foam);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Carte ---------- */
#map { position: fixed; inset: 0; z-index: 0; background: #0b0907; }
.leaflet-container { background: #0b0907; font-family: var(--sans); }
.leaflet-tile-pane { filter: sepia(.35) saturate(.8) brightness(.95); }
.leaflet-control-attribution {
  background: rgba(14, 11, 8, .7) !important; color: var(--muted) !important; font-size: 10px;
}
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-bar a { background: var(--surface-solid); color: var(--foam); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--card); }

.veil {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(14, 11, 8, .45), rgba(14, 11, 8, .92) 70%),
    linear-gradient(to bottom, rgba(14, 11, 8, .7), transparent 25%);
  transition: opacity .8s ease;
}
body.exploring .veil { opacity: .25; }

.pinwrap { display: grid; place-items: center; }
.pin {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber); border: 2px solid #fff3d6;
  box-shadow: 0 0 0 0 rgba(232, 174, 72, .6);
  transition: transform .2s;
}
.pin.n2 { width: 18px; height: 18px; }
.pin.n3 { width: 22px; height: 22px; }
.pin span { display: none; }
.pin.active { animation: pulse 1.6s infinite; transform: scale(1.35); background: #fff3d6; border-color: var(--amber); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 174, 72, .7); }
  100% { box-shadow: 0 0 0 26px rgba(232, 174, 72, 0); }
}
.leaflet-tooltip.tip {
  background: var(--surface-solid); color: var(--foam); border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); font-size: 13px; padding: 6px 10px;
}
.leaflet-tooltip.tip::before { display: none; }
.tip b { color: var(--amber); font-weight: 600; }

/* ---------- En-tête ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20; height: var(--header-h);
  display: flex; align-items: center; gap: 24px; padding: 0 28px;
  background: linear-gradient(to bottom, rgba(14, 11, 8, .95), rgba(14, 11, 8, .75));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0; }
.brand-ico { width: 22px; height: 36px; color: var(--amber); }
.brand-txt { font: 600 21px/1.05 var(--serif); letter-spacing: .01em; }
.brand-txt em { display: block; font-style: italic; font-weight: 500; font-size: 14px; color: var(--muted); }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  white-space: nowrap; text-decoration: none; font-size: 13.5px; font-weight: 500;
  padding: 8px 13px; border-radius: 999px; color: var(--muted); transition: color .2s, background .2s;
}
.nav a:hover { color: var(--foam); background: rgba(232, 174, 72, .08); }
.nav a.on { color: #1a1108; background: var(--amber); }

/* ---------- Accueil / recherche ---------- */
.hero {
  position: fixed; z-index: 10; left: 50%; top: 50%;
  width: min(640px, calc(100% - 32px));
  transform: translate(-50%, -46%);
  text-align: center;
  transition: top .7s cubic-bezier(.2, .8, .2, 1), left .7s cubic-bezier(.2, .8, .2, 1),
              transform .7s cubic-bezier(.2, .8, .2, 1), width .7s;
}
.kicker {
  margin: 0 0 10px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--amber);
}
.hero h1 {
  margin: 0; font: 600 clamp(40px, 7vw, 72px)/.98 var(--serif); letter-spacing: -.01em;
}
.hero h1 span { color: var(--amber); font-style: italic; font-weight: 500; }
.stats { margin: 16px 0 28px; color: var(--muted); font-size: 14px; }
.stats b { color: var(--foam); font-weight: 600; }
.hint { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

.hero h1, .kicker, .stats, .hint { transition: opacity .4s, max-height .6s, margin .6s; max-height: 300px; overflow: hidden; }

body.exploring .hero {
  top: calc(var(--header-h) + 16px); left: 24px; transform: none; width: min(420px, calc(100% - 32px));
}
body.exploring .hero h1, body.exploring .kicker, body.exploring .stats, body.exploring .hint {
  opacity: 0; max-height: 0; margin: 0; pointer-events: none;
}
body.sheet-open .hero { opacity: 0; pointer-events: none; }

.search { position: relative; text-align: left; }
.search input {
  width: 100%; height: 60px; padding: 0 52px 0 54px;
  background: var(--surface); color: var(--foam);
  border: 1px solid var(--line-strong); border-radius: 16px;
  font: 500 17px var(--sans); outline: none;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .5);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transition: border-color .2s, box-shadow .2s;
}
.search input::placeholder { color: #85755f; }
.search input:focus { border-color: var(--amber); box-shadow: 0 18px 50px rgba(0, 0, 0, .5), 0 0 0 4px rgba(232, 174, 72, .15); }
.search input::-webkit-search-cancel-button { display: none; }
.search-ico { position: absolute; left: 20px; top: 19px; width: 22px; height: 22px; color: var(--amber); pointer-events: none; z-index: 1; }
.search-clear {
  position: absolute; right: 12px; top: 13px; width: 34px; height: 34px; border: 0; border-radius: 50%;
  background: transparent; font-size: 22px; color: var(--muted);
}
.search-clear:hover { color: var(--foam); background: rgba(255, 255, 255, .06); }

.results {
  position: absolute; left: 0; right: 0; top: 68px; z-index: 5;
  max-height: min(52vh, 440px); overflow-y: auto;
  background: var(--surface-solid); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6); padding: 6px;
}
.res {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 10px 12px; border: 0; border-radius: 10px; background: transparent;
}
.res:hover, .res.sel { background: rgba(232, 174, 72, .1); }
.res svg { width: 22px; height: 36px; flex-shrink: 0; color: var(--muted); }
.res-txt { flex: 1; min-width: 0; }
.res-nom { display: block; font-weight: 600; font-size: 15px; }
.res-nom mark { background: none; color: var(--amber); }
.res-sub { display: block; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  flex-shrink: 0; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  color: var(--ok); border: 1px solid rgba(143, 194, 122, .4); border-radius: 999px; padding: 3px 9px;
}
.res-none { padding: 18px 16px; }
.res-none strong { display: block; font: 600 20px var(--serif); color: var(--amber); margin-bottom: 4px; }
.res-none p { margin: 0; color: var(--muted); font-size: 13.5px; }
.res-count { padding: 6px 12px 8px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

/* ---------- Fiche verre (panneau) ---------- */
.panel {
  position: fixed; z-index: 30; top: calc(var(--header-h) + 16px); right: 16px; bottom: 16px;
  width: var(--panel-w); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 20px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  transform: translateX(calc(100% + 32px)); transition: transform .55s cubic-bezier(.2, .8, .2, 1);
}
.panel.open { transform: none; }
.panel-close {
  position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: rgba(14, 11, 8, .6); font-size: 20px; line-height: 1;
}
.panel-body { padding: 0 0 24px; }

.glass-stage {
  position: relative; height: 240px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 60%, rgba(232, 174, 72, .22), transparent 65%);
  border-bottom: 1px solid var(--line);
}
.glass-stage svg { width: 92px; height: 160px; color: rgba(244, 234, 214, .55); filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .5)); animation: rise .7s cubic-bezier(.2, .8, .2, 1); }
.glass-stage img { max-height: 210px; max-width: 80%; object-fit: contain; }
.glass-stage .nophoto {
  position: absolute; bottom: 12px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted);
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.fiche { padding: 20px 24px 0; }
.fiche .owned { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.fiche h2 { margin: 0 0 4px; font: 600 34px/1.05 var(--serif); }
.fiche .brass { margin: 0 0 18px; color: var(--amber); font-size: 15px; font-weight: 500; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 22px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts .todo { color: var(--muted); font-style: italic; }
.warn {
  font-size: 12.5px; color: #e9c27a; background: rgba(232, 174, 72, .08); border: 1px dashed var(--line-strong);
  border-radius: 10px; padding: 8px 12px; margin: 0 0 20px;
}

.block { border-top: 1px solid var(--line); padding: 18px 0 4px; }
.block h3 { margin: 0 0 10px; font: 600 20px var(--serif); }
.block h3 small { font: 500 12px var(--sans); color: var(--muted); margin-left: 6px; }
.block p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .02); border-radius: 999px;
  padding: 6px 12px; font-size: 13px; transition: border-color .2s, background .2s;
}
.chip:hover { border-color: var(--amber); background: rgba(232, 174, 72, .08); }
.chip.cur { border-color: var(--amber); color: var(--amber); }
.hunt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hunt a {
  text-align: center; text-decoration: none; font-size: 13px; font-weight: 500;
  padding: 10px 6px; border-radius: 10px; border: 1px solid var(--line-strong); color: var(--foam);
  transition: background .2s;
}
.hunt a:hover { background: rgba(232, 174, 72, .12); }
.soon { display: inline-block; font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--amber); border: 1px solid var(--line-strong); border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }

/* ---------- Feuilles (onglets) ---------- */
.sheet {
  position: fixed; z-index: 15; top: var(--header-h); left: 0; right: 0; bottom: 0;
  overflow-y: auto; background: rgba(14, 11, 8, .9);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: fade .35s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet-inner { max-width: 1120px; margin: 0 auto; padding: 40px 28px 80px; }
.sheet h2 { margin: 0 0 6px; font: 600 clamp(32px, 5vw, 46px)/1.05 var(--serif); }
.sheet .lead { margin: 0 0 28px; color: var(--muted); max-width: 640px; }

.letters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; position: sticky; top: 0; padding: 12px 0; background: rgba(14, 11, 8, .95); z-index: 2; }
.letters button {
  min-width: 38px; height: 38px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line);
  background: transparent; font-weight: 600; font-size: 14px;
}
.letters button:hover:not(:disabled) { border-color: var(--amber); }
.letters button.on { background: var(--amber); color: #1a1108; border-color: var(--amber); }
.letters button:disabled { opacity: .25; cursor: default; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card {
  display: flex; gap: 14px; align-items: center; text-align: left;
  padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--card);
  transition: transform .2s, border-color .2s, background .2s;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-strong); background: #261d13; }
.card svg { width: 30px; height: 50px; flex-shrink: 0; color: rgba(244, 234, 214, .45); }
.card-nom { display: block; font: 600 19px/1.1 var(--serif); text-transform: none; }
.card-sub { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); }

.regions { display: grid; gap: 10px; }
.region { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.region > button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 16px 18px; border: 0; background: transparent; text-align: left;
}
.region > button:disabled { cursor: default; opacity: .45; }
.region-name { font: 600 22px var(--serif); flex: 1; }
.region-deps { font-size: 12.5px; color: var(--muted); }
.count { min-width: 34px; text-align: center; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: rgba(232, 174, 72, .14); color: var(--amber); }
.region-body { padding: 0 18px 18px; }
.dep-title { margin: 14px 0 10px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 40px 28px; text-align: center; color: var(--muted);
}
.empty svg { width: 46px; height: 76px; color: rgba(244, 234, 214, .3); margin-bottom: 8px; }
.empty strong { display: block; font: 600 24px var(--serif); color: var(--foam); margin-bottom: 6px; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  :root { --header-h: 108px; }
  .top { flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; padding: 10px 16px; height: var(--header-h); }
  .nav { margin: 0 -16px; padding: 0 16px; }
  .brand-txt { font-size: 19px; }
  .hero { top: 54%; }
  body.exploring .hero { left: 16px; width: calc(100% - 32px); top: calc(var(--header-h) + 10px); }
  .search input { height: 54px; font-size: 16px; }
  .search-ico { top: 16px; }
  .search-clear { top: 10px; }
  .results { top: 62px; }
  .panel {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62vh;
    border-radius: 22px 22px 0 0; border-bottom: 0;
    transform: translateY(105%);
  }
  .panel::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 10px auto 0; }
  .glass-stage { height: 170px; }
  .glass-stage svg { width: 64px; height: 112px; }
  .fiche { padding: 14px 18px 0; }
  .fiche h2 { font-size: 28px; }
  .sheet-inner { padding: 26px 16px 60px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .card-nom { font-size: 17px; }
}
@media (max-width: 380px) { .grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
