:root {
  --bg: #0b0f14;
  --surface: #121922;
  --surface-2: #18212c;
  --line: #233040;
  --text: #e6edf3;
  --muted: #93a3b4;
  --accent: #5cc8e8;
  --accent-ink: #062330;
  --gold: #e8b85c;
  --good: #6fd39a;
  --bad: #f07a7a;
  --radius: 12px;
  --tabs-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 16px);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }

/* En-tête */
.top {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  padding: 10px 16px 12px;
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.brand { font-weight: 700; letter-spacing: .02em; }
.ver { font-weight: 500; font-size: 12px; color: var(--muted); margin-left: 4px; }
.here {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; max-width: 62%;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer;
}
.here span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.here.set { border-color: var(--accent); color: var(--accent); }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0 12px; min-height: 48px;
}
.search:focus-within { border-color: var(--accent); }
.search svg { color: var(--muted); }
.search input, .where-box input {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0;
  color: var(--text); font: inherit; font-size: 16px; padding: 10px 0;
}
.search input::placeholder, .where-box input::placeholder { color: #6c7d8f; }

/* Vue */
main { padding: 16px; max-width: 760px; margin: 0 auto; outline: none; }
.loading, .empty { color: var(--muted); text-align: center; padding: 40px 0; }
h1 { font-size: 24px; line-height: 1.2; margin: 4px 0 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 26px 0 10px; font-weight: 600; }
.sub { color: var(--muted); margin: 0 0 12px; font-size: 14px; }
.note { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; min-height: 36px; padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  font-size: 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }

.list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.card {
  display: flex; align-items: center; gap: 12px;
  min-height: 60px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color .15s, background .15s;
}
a.card:hover, a.card:focus-visible { border-color: #36506a; background: var(--surface-2); }
.card .main { flex: 1; min-width: 0; }
.card .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.card .s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .r { text-align: right; flex: none; font-size: 14px; }
.card .r small { display: block; color: var(--muted); font-size: 12px; }
.thumb { width: 52px; height: 52px; border-radius: 8px; background: var(--surface-2); object-fit: cover; flex: none; }
.thumb.ph { display: grid; place-items: center; color: #4b5d70; }

.tag { display: inline-block; font-size: 12px; line-height: 1; padding: 4px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); margin: 2px 4px 2px 0; white-space: nowrap; }
.tag.acc { color: var(--accent); border-color: #24546a; }
.tag.gold { color: var(--gold); border-color: #5a4724; }
.tag.bad { color: var(--bad); border-color: #5a2b2b; }
.tag.good { color: var(--good); border-color: #24563d; }
.gold { color: var(--gold); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.acc { color: var(--accent); }
.muted { color: var(--muted); }

/* Détail */
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; color: var(--muted); cursor: pointer; background: none; border: 0; padding: 0; margin-bottom: 4px; }
.hero { width: 100%; max-height: 260px; object-fit: contain; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); margin: 8px 0 12px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 12px 0; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.fact b { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.desc { white-space: pre-line; color: #c9d4de; font-size: 15px; }

.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.rows li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--surface); min-height: 52px; }
.rows li + li { border-top: 1px solid var(--line); }
.rows li.best { background: #12241f; }
.rows .main { flex: 1; min-width: 0; }
.rows .t { font-weight: 500; }
.rows .s { color: var(--muted); font-size: 13px; }
.rows .r { text-align: right; flex: none; }
.rows .r small { display: block; color: var(--muted); font-size: 12px; }
.more { width: 100%; min-height: 44px; margin-top: 8px; background: none; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); cursor: pointer; }

.ladder { display: flex; flex-direction: column; gap: 6px; }
.rank { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); cursor: pointer; min-height: 44px; }
.rank[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

select {
  font: inherit; font-size: 15px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: 44px; max-width: 100%;
}

.callout { background: #10202a; border: 1px solid #24546a; border-radius: var(--radius); padding: 12px 14px; margin: 12px 0; font-size: 15px; }
.callout b { color: var(--accent); }

.group-title { display: flex; justify-content: space-between; align-items: baseline; margin: 22px 0 8px; }
.group-title h2 { margin: 0; }

/* Navigation du bas */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #0d131a; border-top: 1px solid var(--line);
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 12px; }
.tabs a[aria-current="page"] { color: var(--accent); }

/* Fenêtre « Je suis où ? » */
dialog { padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); width: min(560px, calc(100vw - 32px)); max-height: 80vh; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.where-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; max-height: 80vh; }
.where-head { display: flex; justify-content: space-between; align-items: center; }
.where-box input { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.x { min-width: 44px; min-height: 44px; background: none; border: 0; font-size: 26px; color: var(--muted); cursor: pointer; }
.where-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 120px; }
.where-list button { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 4px; cursor: pointer; min-height: 48px; }
.where-list button span { display: block; color: var(--muted); font-size: 13px; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; min-height: 40px; }

footer.credits { color: var(--muted); font-size: 12px; text-align: center; margin: 40px 0 8px; line-height: 1.6; }
footer.credits a { text-decoration: underline; }

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

details summary { cursor: pointer; min-height: 32px; display: flex; align-items: center; color: var(--muted); font-size: 13px; }
details[open] summary { color: var(--accent); }

/* Rangées de boutons : à la souris, elles passent à la ligne (pas de glisser possible) ;
   au doigt, elles défilent et un dégradé signale qu'il en reste à droite. */
@media (hover: hover) and (pointer: fine) {
  .chips { flex-wrap: wrap; overflow: visible; }
}
.chips.more-right { -webkit-mask-image: linear-gradient(90deg, #000 82%, transparent); mask-image: linear-gradient(90deg, #000 82%, transparent); }

/* ---- NXL Holonav : ajouts ---- */
.brand .nxl { color: var(--accent); letter-spacing: .06em; }
.top-actions { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pill { min-height: 40px; min-width: 44px; padding: 6px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.brand { flex: none; }
.top-actions { flex: 1; justify-content: flex-end; }
.here { max-width: none; min-width: 0; flex: 0 1 auto; }
.tabs a { font-size: 11px; text-align: center; }

.subnav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: -4px 0 14px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; padding: 8px 12px; min-height: 36px; border-radius: 9px; color: var(--muted); font-size: 14px; display: flex; align-items: center; }
.subnav a[aria-current="page"] { background: var(--surface-2); color: var(--accent); font-weight: 600; }
@media (hover: hover) and (pointer: fine) { .subnav { flex-wrap: wrap; overflow: visible; } }

.shipbtn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin: 8px 0 14px; padding: 10px 12px; min-height: 64px;
  background: var(--surface); border: 1px dashed #36506a; border-radius: var(--radius); cursor: pointer; }
.shipbtn .main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shipbtn .t { font-weight: 600; }
.shipbtn .s { color: var(--muted); font-size: 13px; }

.inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 10px; }
.inputs label, .form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
input[type="number"], input[type="text"], .form select, .calc-row select {
  font: inherit; font-size: 16px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px; width: 100%; }
input:disabled { opacity: .6; }
input:focus-visible, select:focus-visible { border-color: var(--accent); }
.form { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 4px; }
.calc { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.calc-row { display: grid; grid-template-columns: 1fr 84px 44px; gap: 8px; align-items: center; }

.primary { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin: 6px 0; border: 0; border-radius: 12px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; cursor: pointer; text-align: center; }
.primary.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
a.more { display: flex; align-items: center; justify-content: center; }
.rows .r.col { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.plans .plan { display: block; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.plans .plan + .plan { margin-top: 0; }
.plan .t { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.plan .s { color: var(--muted); font-size: 13px; margin-top: 4px; }
.plan .s a { text-decoration: underline; text-decoration-color: #36506a; }
.rank-n { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); color: var(--accent); font-size: 13px; flex: none; }
.big { font-size: 17px; font-weight: 700; margin-top: 8px; }

.support { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px 12px; margin: 12px 0; }
.support h2 { margin-top: 14px; }
.support p { margin: 0 0 10px; color: #c9d4de; font-size: 15px; }
.refcode { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-bottom: 6px;
  background: var(--bg); border: 1px solid #24546a; border-radius: 10px; }
.refcode code { font: 600 18px/1.2 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .06em; color: var(--accent); }
.support-card { margin: 24px 0 0; border-color: #24546a; }
