/* Paris en couleurs — interface façon BD : papier crème, trait d'encre épais, ombre portée franche. */
:root {
  --encre: #262a38;
  --papier: #fff8ea;
  --papier-2: #f3e8d2;
  --jaune: #f6c62d;
  --bleu: #3d9bff;
  --or: #f5b93a;
  --rouge: #e0483e;
  --vert: #3f9a5a;
  --gris: #8d95a3;
  --trait: 2.5px solid var(--encre);
  --ombre: 4px 4px 0 var(--encre);
  --titre: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --texte: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bas: env(safe-area-inset-bottom, 0px);
  --haut: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #5d6672; color: var(--encre); font-family: var(--texte); font-weight: 700; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* ---------- Étiquettes des spots ---------- */
#etiquettes { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.etiquette { position: absolute; left: 0; top: 0; white-space: nowrap; display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; background: var(--papier); border: 2px solid var(--encre); border-radius: 999px; font-size: 12px; box-shadow: 2px 2px 0 var(--encre); will-change: transform; }
.etiquette::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--gris); border: 1.5px solid var(--encre); }
.etiquette[data-niveau="photo"]::before { background: var(--bleu); }
.etiquette[data-niveau="seance"]::before { background: var(--or); }
.etiquette b { font-family: var(--titre); font-weight: 600; }
.etiquette span { opacity: .6; font-size: 11px; }

#flash { position: fixed; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
#flash.eclair { animation: eclair .7s ease-out; }
@keyframes eclair { 0% { opacity: 0; } 8% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
.bulle { background: var(--papier); border: var(--trait); border-radius: 16px; box-shadow: var(--ombre); }

.progression { position: absolute; left: 14px; top: calc(14px + var(--haut)); padding: 9px 14px 11px; width: 214px; }
.progression__titre { font-family: var(--titre); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; opacity: .65; }
.progression__ligne { display: flex; align-items: baseline; gap: 3px; line-height: 1; margin: 2px 0 7px; }
.progression__ligne b { font-family: var(--titre); font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.progression__ligne span { font-family: var(--titre); font-size: 18px; }
.progression__ligne i { margin-left: auto; font-style: normal; font-size: 12px; opacity: .7; }
.jauge { height: 10px; border: 2px solid var(--encre); border-radius: 999px; background: #cfd4dc; overflow: hidden; }
.jauge > div { height: 100%; width: 0; background: linear-gradient(90deg, #ff6b6b, #ffc93c 30%, #6bcb77 55%, #4d96ff 80%, #b983ff); transition: width .9s cubic-bezier(.2, .8, .2, 1); }
.jauge--fine { height: 8px; margin-top: 6px; }
.jauge--fine > div { background: var(--jaune); }

.quete { position: absolute; left: 14px; top: calc(112px + var(--haut)); width: 214px; padding: 8px 12px 10px; text-align: left; display: block; line-height: 1.25; }
.quete__label { display: inline-block; font-family: var(--titre); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; background: var(--encre); color: var(--papier); border-radius: 999px; padding: 1px 8px; margin-bottom: 3px; }
.quete b { display: block; font-family: var(--titre); font-size: 15px; font-weight: 600; }
.quete > span:not(.quete__label) { display: block; font-size: 12px; font-weight: 700; opacity: .72; }
.quete:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--encre); }

.outils { position: absolute; right: 14px; top: calc(14px + var(--haut)); display: flex; flex-direction: column; gap: 9px; }
.rond { position: relative; width: 46px; height: 46px; border-radius: 50%; background: var(--papier); border: var(--trait); box-shadow: 3px 3px 0 var(--encre); display: grid; place-items: center; padding: 0; }
.rond svg { width: 24px; height: 24px; fill: none; stroke: var(--encre); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rond:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--encre); }
.rond[aria-pressed="true"]#btn-gps { background: var(--bleu); }
.rond[aria-pressed="true"]#btn-gps svg { stroke: #fff; }
.rond[aria-pressed="false"]#btn-son #son-ondes { display: none; }
.pastille { position: absolute; right: -3px; top: -3px; width: 14px; height: 14px; border-radius: 50%; background: var(--rouge); border: 2px solid var(--encre); }

.cap { position: absolute; left: 50%; top: calc(14px + var(--haut)); transform: translateX(-50%); display: flex; align-items: center; gap: 9px; padding: 6px 14px 6px 9px; border-radius: 999px; max-width: calc(100vw - 150px); }
.cap svg { width: 26px; height: 26px; flex: none; fill: var(--jaune); stroke: var(--encre); stroke-width: 2; stroke-linejoin: round; transition: transform .12s linear; }
.cap span { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.cap b { font-family: var(--titre); font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cap i { font-style: normal; font-size: 11.5px; opacity: .7; }

.rue { position: absolute; left: 50%; bottom: calc(16px + var(--bas)); transform: translateX(-50%); font-family: var(--titre); font-weight: 600; font-size: 14px; color: #fff; text-shadow: 0 1px 0 var(--encre), 0 2px 6px rgba(0, 0, 0, .55); white-space: nowrap; pointer-events: none !important; }

.aide-clavier { position: absolute; left: 14px; bottom: calc(14px + var(--bas)); font-size: 12px; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .7); pointer-events: none !important; }
kbd { display: inline-block; min-width: 20px; text-align: center; font: 700 11px var(--texte); background: var(--papier); color: var(--encre); border: 2px solid var(--encre); border-radius: 6px; padding: 1px 4px; margin-right: 2px; box-shadow: 1.5px 1.5px 0 var(--encre); text-shadow: none; }

.manette { position: absolute; left: 18px; bottom: calc(22px + var(--bas)); width: 124px; height: 124px; border-radius: 50%; background: rgba(255, 248, 234, .35); border: var(--trait); display: none; place-items: center; touch-action: none; }
.manette__pommeau { width: 56px; height: 56px; border-radius: 50%; background: var(--papier); border: var(--trait); box-shadow: 2px 2px 0 var(--encre); pointer-events: none; }
@media (pointer: coarse) { .manette { display: grid; } .aide-clavier { display: none; } }

.action { position: absolute; left: 50%; bottom: calc(52px + var(--bas)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 28px); }
.action > span { font-family: var(--titre); font-weight: 600; font-size: 15px; color: #fff; text-shadow: 0 1px 0 var(--encre), 0 2px 8px rgba(0, 0, 0, .6); }
.action button { font-family: var(--titre); font-weight: 600; font-size: 19px; padding: 12px 26px; border-radius: 999px; background: var(--jaune); border: 3px solid var(--encre); box-shadow: 5px 5px 0 var(--encre); animation: battre 1.4s ease-in-out infinite; }
.action button.secondaire { font-size: 14px; padding: 8px 18px; background: var(--or); box-shadow: 3px 3px 0 var(--encre); animation: none; }
.action button:active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--encre); animation: none; }
.action button:disabled { background: var(--papier-2); animation: none; cursor: default; opacity: .9; }
@keyframes battre { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }

.mini { position: absolute; right: 14px; bottom: calc(14px + var(--bas)); width: 132px; height: 132px; border-radius: 50%; padding: 0; overflow: hidden; background: #6b7380; border: var(--trait); box-shadow: var(--ombre); }
.mini canvas { width: 100%; height: 100%; display: block; }

/* ---------- Crédits cartographiques (obligatoires : données OpenStreetMap) ---------- */
.credits { position: absolute; right: 156px; bottom: calc(6px + var(--bas)); margin: 0; font-size: 10px; font-weight: 700; color: rgba(255, 255, 255, .85); text-shadow: 0 1px 2px rgba(0, 0, 0, .7); white-space: nowrap; }
.credits a, .accueil__credits a { color: inherit; }
.accueil__credits { margin: 10px 0 0; font-size: 10.5px; font-weight: 500; opacity: .6; line-height: 1.4; }
@media (max-width: 620px) { .credits { right: auto; left: 50%; transform: translateX(-50%); bottom: calc(2px + var(--bas)); font-size: 9px; } }
@media (max-width: 940px) { .aide-clavier { display: none; } }

/* ---------- Diagnostic (?diag=1) ---------- */
.diag { position: fixed; left: 50%; top: calc(66px + var(--haut)); transform: translateX(-50%); margin: 0; padding: 5px 10px; background: rgba(38, 42, 56, .84); color: #fff; font: 600 11px/1.45 ui-monospace, Consolas, 'Courier New', monospace; border-radius: 8px; pointer-events: none; z-index: 20; white-space: pre; text-align: center; }

/* ---------- Notifications ---------- */
#toasts { position: fixed; left: 50%; top: calc(74px + var(--haut)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 30; width: min(440px, calc(100vw - 28px)); }
.toast { background: var(--papier); border: var(--trait); border-radius: 14px; box-shadow: var(--ombre); padding: 9px 14px; font-size: 14px; line-height: 1.3; text-align: center; animation: toast-in .35s cubic-bezier(.2, 1.4, .4, 1), toast-out .4s ease-in 4.2s forwards; }
.toast b { font-family: var(--titre); font-weight: 600; }
.toast--recompense { background: var(--jaune); }
.toast--alerte { background: #ffd9d4; }
@keyframes toast-in { from { transform: translateY(-14px) scale(.9); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-10px); opacity: 0; } }

/* ---------- Panneaux ---------- */
.voile { position: fixed; inset: 0; background: rgba(30, 33, 45, .45); z-index: 40; }
.panneau { position: fixed; z-index: 41; right: 14px; top: calc(14px + var(--haut)); bottom: calc(14px + var(--bas)); width: min(400px, calc(100vw - 28px)); background: var(--papier); border: var(--trait); border-radius: 20px; box-shadow: 6px 6px 0 var(--encre); display: flex; flex-direction: column; overflow: hidden; animation: glisse .28s cubic-bezier(.2, 1.1, .3, 1); }
@keyframes glisse { from { transform: translateX(40px); opacity: 0; } }
.panneau header { display: flex; align-items: center; padding: 14px 16px 10px; border-bottom: var(--trait); background: var(--papier-2); }
.panneau h2 { margin: 0; font-family: var(--titre); font-weight: 700; font-size: 22px; flex: 1; }
.fermer { width: 36px; height: 36px; border-radius: 50%; border: var(--trait); background: var(--papier); font-size: 22px; line-height: 1; padding: 0 0 3px; }
.panneau__corps { overflow-y: auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 10px; -webkit-overflow-scrolling: touch; }
.panneau__intro { margin: 0 0 2px; font-size: 13.5px; opacity: .8; line-height: 1.4; }

.carte-quete { border: var(--trait); border-radius: 14px; padding: 10px 12px 11px; background: #fff; }
.carte-quete.faite { background: #e7f6df; }
.carte-quete h3 { margin: 0; font-family: var(--titre); font-weight: 600; font-size: 16px; display: flex; gap: 8px; align-items: center; }
.carte-quete h3 em { margin-left: auto; font-style: normal; font-size: 12px; font-family: var(--texte); opacity: .7; white-space: nowrap; }
.carte-quete p { margin: 3px 0 7px; font-size: 13px; line-height: 1.35; opacity: .8; }
.carte-quete .gain { display: flex; align-items: center; gap: 7px; font-size: 12.5px; margin-top: 7px; }
.pastille-couleur { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--encre); flex: none; }

.emplacement h3 { margin: 6px 0 6px; font-family: var(--titre); font-weight: 600; font-size: 15px; }
.grille-objets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.objet { position: relative; text-align: left; border: var(--trait); border-radius: 13px; background: #fff; padding: 8px 10px; display: flex; gap: 9px; align-items: center; min-height: 54px; line-height: 1.2; }
.objet b { font-family: var(--titre); font-weight: 600; font-size: 13.5px; display: block; }
.objet small { font-size: 11px; opacity: .65; display: block; }
.objet[aria-pressed="true"] { background: var(--jaune); box-shadow: 3px 3px 0 var(--encre); }
.objet:disabled { background: var(--papier-2); cursor: default; }
.objet:disabled .pastille-couleur { background: #b9bec8 !important; }
.objet .neuf { position: absolute; right: -5px; top: -7px; font-family: var(--titre); font-size: 10px; background: var(--rouge); color: #fff; border: 2px solid var(--encre); border-radius: 999px; padding: 0 6px; }

.ligne-spot { display: flex; align-items: center; gap: 10px; border: var(--trait); border-radius: 13px; background: #fff; padding: 7px 8px 7px 11px; }
.ligne-spot .pastille-couleur { background: var(--gris); }
.ligne-spot[data-niveau="photo"] .pastille-couleur { background: var(--bleu); }
.ligne-spot[data-niveau="seance"] .pastille-couleur { background: var(--or); }
.ligne-spot div { flex: 1; min-width: 0; line-height: 1.2; }
.ligne-spot b { font-family: var(--titre); font-weight: 600; font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne-spot small { font-size: 11.5px; opacity: .65; }
.ligne-spot button { font-family: var(--titre); font-weight: 600; font-size: 12.5px; border: 2px solid var(--encre); border-radius: 999px; background: var(--jaune); padding: 5px 11px; white-space: nowrap; }
.carte-paris { width: 100%; border: var(--trait); border-radius: 14px; background: #6b7380; display: block; }
.legende { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; }
.legende span { display: inline-flex; align-items: center; gap: 5px; }

/* ---------- Carte souvenir ---------- */
.souvenir { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(30, 33, 45, .5); padding: 16px; }
.polaroid { width: min(380px, 100%); max-height: 100%; overflow-y: auto; background: #fffdf6; border: var(--trait); border-radius: 10px; box-shadow: 8px 8px 0 var(--encre); padding: 12px 12px 16px; transform: rotate(-1.6deg); animation: pose .5s cubic-bezier(.2, 1.5, .4, 1); text-align: center; }
@keyframes pose { from { transform: rotate(8deg) translateY(60px) scale(.7); opacity: 0; } }
.polaroid__photo { aspect-ratio: 4 / 3; background: #cfd4dc; border: var(--trait); border-radius: 4px; overflow: hidden; }
.polaroid__photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.polaroid h3 { margin: 10px 0 0; font-family: var(--titre); font-weight: 700; font-size: 22px; line-height: 1.15; }
.polaroid__lieu { margin: 2px 0 0; font-size: 12.5px; opacity: .65; }
.polaroid__gain { margin: 8px auto 0; display: inline-block; font-family: var(--titre); font-weight: 600; font-size: 14px; background: var(--jaune); border: 2px solid var(--encre); border-radius: 999px; padding: 3px 12px; }
.polaroid__texte { margin: 9px 4px 12px; font-size: 13px; line-height: 1.45; font-weight: 500; text-align: left; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.polaroid button { font-family: var(--titre); font-weight: 600; font-size: 16px; padding: 9px 22px; border-radius: 999px; background: var(--bleu); color: #fff; border: var(--trait); box-shadow: 3px 3px 0 var(--encre); }

/* ---------- Accueil ---------- */
.accueil { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 18px; background: linear-gradient(180deg, rgba(60, 67, 78, .78) 0%, rgba(96, 104, 117, .5) 55%, rgba(120, 128, 142, .42) 100%); transition: opacity .8s ease, visibility .8s; }
.accueil.partie { opacity: 0; visibility: hidden; }
.accueil__pluie { position: absolute; inset: -40px; background-image: repeating-linear-gradient(100deg, rgba(255, 255, 255, 0) 0 22px, rgba(255, 255, 255, .13) 22px 23px); background-size: 140px 140px; animation: pluie .5s linear infinite; }
@keyframes pluie { to { background-position: -24px 140px; } }
.accueil__carte { position: relative; width: min(470px, 100%); background: var(--papier); border: 3px solid var(--encre); border-radius: 24px; box-shadow: 8px 8px 0 var(--encre); padding: 26px 26px 22px; text-align: center; }
.accueil__sur { margin: 0 0 4px; font-family: var(--titre); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .55; }
.accueil h1 { margin: 0; font-family: var(--titre); font-weight: 700; font-size: clamp(34px, 9vw, 50px); line-height: 1.02; }
.arc i { font-style: normal; display: inline-block; animation: saute 2.4s ease-in-out infinite; }
.arc i:nth-child(1) { color: #ef4d4d; } .arc i:nth-child(2) { color: #f58a2e; animation-delay: .08s; } .arc i:nth-child(3) { color: #e9b400; animation-delay: .16s; }
.arc i:nth-child(4) { color: #49b85c; animation-delay: .24s; } .arc i:nth-child(5) { color: #20a9a0; animation-delay: .32s; } .arc i:nth-child(6) { color: #3d8bff; animation-delay: .40s; }
.arc i:nth-child(7) { color: #7a63f0; animation-delay: .48s; } .arc i:nth-child(8) { color: #d953b6; animation-delay: .56s; }
@keyframes saute { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-7px); } }
.accueil__pitch { margin: 14px 0 20px; font-size: 15.5px; line-height: 1.5; font-weight: 700; opacity: .85; }
.accueil button#commencer { font-family: var(--titre); font-weight: 600; font-size: 20px; padding: 13px 30px; border-radius: 999px; background: var(--jaune); border: 3px solid var(--encre); box-shadow: 5px 5px 0 var(--encre); }
.accueil button#commencer:disabled { background: var(--papier-2); box-shadow: 3px 3px 0 var(--encre); cursor: progress; font-size: 16px; }
.accueil button#commencer:not(:disabled):active { transform: translate(3px, 3px); box-shadow: 2px 2px 0 var(--encre); }
.accueil__note { margin: 12px 0 0; font-size: 12px; opacity: .6; min-height: 1.3em; }
.lien { background: none; border: none; text-decoration: underline; font-size: 12px; opacity: .6; margin-top: 4px; }

/* ---------- Téléphone ---------- */
@media (max-width: 620px) {
  .progression { width: 168px; padding: 7px 11px 9px; left: 10px; top: calc(10px + var(--haut)); }
  .progression__ligne b { font-size: 27px; }
  .quete { width: 168px; left: 10px; top: calc(96px + var(--haut)); padding: 6px 10px 8px; }
  .quete > span:not(.quete__label) { display: none; }
  .outils { right: 10px; top: calc(10px + var(--haut)); gap: 7px; }
  .rond { width: 42px; height: 42px; }
  .cap { left: 10px; transform: none; top: calc(170px + var(--haut)); max-width: 210px; padding: 4px 12px 4px 7px; }
  .aide-clavier { display: none; }
  .mini { width: 96px; height: 96px; right: 10px; bottom: calc(18px + var(--bas)); }
  .rue { bottom: calc(150px + var(--bas)); font-size: 13px; }
  .action { bottom: calc(210px + var(--bas)); }
  .panneau { right: 8px; left: 8px; width: auto; top: calc(8px + var(--haut)); bottom: calc(8px + var(--bas)); }
  .diag { left: 10px; transform: none; top: calc(212px + var(--haut)); text-align: left; }
  #toasts { top: calc(276px + var(--haut)); }
}
@media (prefers-reduced-motion: reduce) {
  .arc i, .action button, .accueil__pluie { animation: none; }
}
