:root {
  --void: #07070a;
  --void-2: #0d0c12;
  --ink: #ede9e1;
  --mute: #9a96a2;
  --line: rgba(237, 233, 225, 0.14);
  --gold: #c8a96e;
  --violet: #8a3ffc;
  --glass: rgba(9, 9, 13, 0.72);
  --f-display: "Syne", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --gut: 16px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--void); color: var(--ink); overflow: hidden; }
body { font-family: var(--f-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }
.mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: .02em; color: var(--mute); }
.small { font-size: 11px; }
.eyebrow { margin: 0; font-family: var(--f-mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }

#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }

/* ---------- boutons */
.btn { appearance: none; border: 1px solid var(--line); background: rgba(255,255,255,.04); padding: 12px 18px; border-radius: 999px; font-weight: 600; letter-spacing: .01em; transition: background .25s var(--ease), border-color .25s var(--ease), transform .25s var(--ease); min-height: 44px; }
.btn:hover { border-color: rgba(237,233,225,.35); }
.btn:active { transform: scale(.98); }
.btn--gold { background: var(--gold); color: #120f08; border-color: var(--gold); }
.btn--gold:hover { background: #d8bb83; }
.btn--ghost { background: transparent; }
.iconbtn { appearance: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 18px; display: grid; place-items: center; }

/* ---------- chargement */
.loader { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: max(var(--gut), var(--st)) max(var(--gut), var(--sr)) max(var(--gut), var(--sb)) max(var(--gut), var(--sl));
  background: radial-gradient(120% 90% at 50% 10%, #16131d 0%, var(--void) 60%); transition: opacity .8s var(--ease), visibility .8s; }
.loader.is-out { opacity: 0; visibility: hidden; }
.loader { overflow-y: auto; }
.loader__inner { width: min(440px, 100%); margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.logo { width: 72px; height: 72px; animation: breathe 3.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); filter: drop-shadow(0 0 18px rgba(200,169,110,.35)); } }
.loader__title { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: clamp(44px, 12vw, 76px); letter-spacing: -.03em; line-height: .95; }
.loader__sub { margin: 0; color: var(--mute); max-width: 34ch; }
.bar { width: 100%; height: 3px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; margin-top: 10px; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--violet), var(--gold)); transition: width .3s linear; }
.bar.is-indeterminate span { width: 30%; animation: indet 1.2s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(340%); } }
.tip { margin: 0; min-height: 3em; color: var(--ink); opacity: .75; font-size: 13px; }
.loader__actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.check { display: flex; gap: 8px; align-items: center; color: var(--mute); font-size: 13px; }
.check input { accent-color: var(--gold); width: 18px; height: 18px; }
.back { color: var(--mute); font-size: 13px; text-decoration: none; margin-top: 6px; }
.back:hover { color: var(--ink); }

/* ---------- intro */
.intro-text { position: fixed; left: 0; right: 0; bottom: 18vh; z-index: 20; text-align: center; pointer-events: none;
  font-family: var(--f-display); font-weight: 800; font-size: clamp(28px, 7vw, 64px); letter-spacing: -.02em; text-shadow: 0 4px 40px rgba(0,0,0,.6); opacity: 0; transition: opacity .9s var(--ease), transform .9s var(--ease); transform: translateY(12px); }
.intro-text.is-on { opacity: 1; transform: none; }
.intro-text small { display: block; font-family: var(--f-mono); font-size: 12px; font-weight: 400; letter-spacing: .2em; color: var(--gold); margin-bottom: 8px; }
.skip { position: fixed; z-index: 21; right: max(var(--gut), var(--sr)); bottom: max(var(--gut), var(--sb)); }

/* ---------- HUD */
.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud > * { pointer-events: auto; }
.hud__top { position: absolute; top: max(12px, var(--st)); left: max(var(--gut), var(--sl)); right: max(var(--gut), var(--sr)); display: flex; align-items: center; gap: 12px; pointer-events: none; }
.hud__top > * { pointer-events: auto; }
.hud__brand { width: 44px; height: 44px; border-radius: 12px; background: var(--glass); border: 1px solid var(--line); display: grid; place-items: center; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.hud__brand svg { width: 26px; height: 26px; }
.hud__place { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; text-shadow: 0 1px 12px rgba(0,0,0,.7); }
.hud__place strong { font-family: var(--f-display); font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud__map { position: absolute; right: max(var(--gut), var(--sr)); top: calc(max(12px, var(--st)) + 56px); width: 168px; height: 168px; border-radius: 50%; overflow: hidden; border: 1px solid rgba(200,169,110,.45); box-shadow: 0 10px 40px rgba(0,0,0,.45); background: #0b0b10; cursor: pointer; }
.hud__map canvas { width: 100%; height: 100%; display: block; }
.north { position: absolute; top: 4px; left: 50%; transform: translateX(-50%); font-family: var(--f-mono); font-size: 10px; color: var(--gold); pointer-events: none; }
.hud__speed { position: absolute; left: max(var(--gut), var(--sl)); bottom: max(18px, calc(var(--sb) + 8px)); display: flex; align-items: baseline; gap: 6px; text-shadow: 0 2px 16px rgba(0,0,0,.7); }
.hud__speed strong { font-family: var(--f-display); font-size: 44px; font-weight: 800; letter-spacing: -.03em; min-width: 2ch; text-align: right; }
.hud__speed span { font-family: var(--f-mono); font-size: 12px; color: var(--mute); }
.hud__speed em { font-style: normal; font-family: var(--f-mono); font-size: 11px; color: var(--gold); letter-spacing: .14em; text-transform: uppercase; margin-left: 10px; }
.hud__hint { position: absolute; left: 50%; bottom: max(24px, calc(var(--sb) + 14px)); transform: translateX(-50%); background: var(--glass); border: 1px solid rgba(200,169,110,.5); padding: 10px 16px; border-radius: 999px; font-size: 13px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); white-space: nowrap; cursor: pointer; }
.hud__hint kbd { font-family: var(--f-mono); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; margin-right: 6px; color: var(--gold); }
.hud__attrib { position: absolute; right: max(var(--gut), var(--sr)); bottom: max(6px, var(--sb)); margin: 0; font-family: var(--f-mono); font-size: 9px; color: rgba(237,233,225,.55); pointer-events: none; text-shadow: 0 1px 6px rgba(0,0,0,.8); }

/* ---------- tactile */
.touch { position: fixed; inset: 0; z-index: 11; pointer-events: none; }
.stick { position: absolute; left: max(28px, calc(var(--sl) + 18px)); bottom: max(78px, calc(var(--sb) + 70px)); width: 128px; height: 128px; border-radius: 50%; border: 1px solid var(--line); background: rgba(9,9,13,.35); pointer-events: auto; touch-action: none; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.stick span { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(237,233,225,.18); border: 1px solid rgba(200,169,110,.6); transition: transform .08s linear; }
.touch__right { position: absolute; right: max(22px, calc(var(--sr) + 14px)); bottom: max(70px, calc(var(--sb) + 60px)); display: flex; gap: 14px; align-items: flex-end; pointer-events: auto; }
.touch__aux { position: absolute; right: max(22px, calc(var(--sr) + 14px)); bottom: max(190px, calc(var(--sb) + 182px)); display: flex; gap: 10px; pointer-events: auto; }
.tbtn { appearance: none; touch-action: none; user-select: none; -webkit-user-select: none; width: 76px; height: 76px; border-radius: 50%; border: 1px solid var(--line); background: rgba(9,9,13,.5); font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.tbtn.is-down { background: rgba(237,233,225,.18); }
.tbtn--gold { width: 92px; height: 92px; border-color: rgba(200,169,110,.7); color: var(--gold); }
.tbtn--s { width: 58px; height: 44px; border-radius: 22px; font-size: 10px; }
.is-walk .touch__right #t-gas { color: var(--ink); }

/* ---------- panneaux */
.panel { position: fixed; inset: 0; z-index: 30; background: rgba(5,5,8,.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); display: grid; place-items: center; padding: max(var(--gut), var(--st)) max(var(--gut), var(--sr)) max(var(--gut), var(--sb)) max(var(--gut), var(--sl)); }
.panel__inner { width: min(760px, 100%); max-height: 100%; overflow: auto; background: linear-gradient(180deg, rgba(20,18,26,.92), rgba(10,10,14,.94)); border: 1px solid var(--line); border-radius: 22px; padding: 18px; display: grid; gap: 14px; }
.panel__head { display: flex; justify-content: space-between; align-items: center; }
.menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.menu button, .menu a { text-align: left; appearance: none; border: 1px solid var(--line); background: rgba(255,255,255,.03); padding: 14px 16px; border-radius: 14px; font-family: var(--f-display); font-weight: 700; font-size: 17px; text-decoration: none; min-height: 48px; }
.menu button:hover, .menu a:hover, .menu .is-active { border-color: rgba(200,169,110,.6); background: rgba(200,169,110,.08); }
.menu small { display: block; font-family: var(--f-mono); font-weight: 400; font-size: 11px; color: var(--mute); margin-top: 2px; }
.menu-view:empty { display: none; }
.menu-view { border-top: 1px solid var(--line); padding-top: 14px; display: grid; gap: 10px; }
.menu-view h3 { margin: 0; font-family: var(--f-display); font-size: 20px; }
.menu-view p, .menu-view li { color: #d6d1c8; margin: 0; }
.menu-view ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { appearance: none; border: 0; background: transparent; padding: 9px 14px; font-family: var(--f-mono); font-size: 12px; min-height: 40px; }
.seg button.is-on { background: var(--gold); color: #120f08; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.keys kbd { font-family: var(--f-mono); font-size: 12px; color: var(--gold); white-space: nowrap; }
.places { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.places button { appearance: none; text-align: left; border: 1px solid var(--line); background: rgba(255,255,255,.03); border-radius: 12px; padding: 10px 12px; }
.places button strong { display: block; font-family: var(--f-display); font-size: 15px; }
.places button span { font-family: var(--f-mono); font-size: 10px; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; }
.tag { display: inline-block; font-family: var(--f-mono); font-size: 10px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--mute); }
.tag--ok { border-color: rgba(120,200,140,.5); color: #a6e3b4; }
.tag--warn { border-color: rgba(230,180,90,.5); color: #f0c97e; }
.tag--todo { border-color: rgba(160,140,200,.5); color: #c6b5ef; }

.panel--map .panel__inner { width: min(980px, 100%); height: min(900px, 100%); grid-template-rows: auto 1fr; }
.bigmap__wrap { position: relative; min-height: 0; border-radius: 14px; overflow: hidden; background: #0b0b10; }
.bigmap__wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }

.card { position: fixed; z-index: 25; left: max(var(--gut), var(--sl)); top: calc(max(12px, var(--st)) + 60px); width: min(360px, calc(100vw - 2 * var(--gut) - 180px)); background: linear-gradient(180deg, rgba(20,18,26,.92), rgba(10,10,14,.94)); border: 1px solid rgba(200,169,110,.4); border-radius: 18px; padding: 16px; display: grid; gap: 8px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.card h2 { margin: 0; font-family: var(--f-display); font-size: 24px; line-height: 1.1; }
.card p { margin: 0; }

@media (max-width: 640px) {
  .hud__map { width: 120px; height: 120px; }
  .hud__place strong { font-size: 15px; }
  .hud__speed strong { font-size: 34px; }
  .card { width: calc(100vw - 2 * var(--gut)); top: auto; bottom: calc(max(var(--gut), var(--sb)) + 210px); }
  .hud__attrib { display: none; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .hud__map { width: 110px; height: 110px; top: calc(max(8px, var(--st)) + 52px); }
  .stick { bottom: max(20px, var(--sb)); }
  .touch__right { bottom: max(16px, var(--sb)); }
  .touch__aux { bottom: max(126px, calc(var(--sb) + 116px)); }
  .hud__speed { left: 50%; transform: translateX(-50%); bottom: max(8px, var(--sb)); }
  .card { top: calc(max(8px, var(--st)) + 54px); bottom: auto; width: min(340px, 45vw); }
}
@media (max-height: 520px) {
  .loader { place-items: start center; }
  .loader__inner { gap: 8px; }
  .logo { width: 40px; height: 40px; }
  .loader__title { font-size: 40px; }
  .loader__sub, .tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .logo, .bar.is-indeterminate span { animation: none; }
  * { transition-duration: .01ms !important; }
}
