/* HUIS CLOS — briefing et traque du signal (docs/SPEC-TRAQUE.md). */

/* ---------- Briefing ---------- */
/* Mêmes codes que la page d'une enquête (css/screens.css, « Codes d'application ») : couverture sous la barre flottante,
   mission posée sur son bas assombri, étapes en cartes qui défilent au doigt, barre d'action (sélecteur segmenté
   « Caméra | Salon dessiné », puis « Commencer »). */
.s-brief .brief-hero { position: relative; flex: none; width: 100%; height: 46vh; min-height: 290px; max-height: 430px; overflow: hidden; background: #06090D; }
.s-brief .brief-hero-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.s-brief .brief-hero::before { content: ""; position: absolute; z-index: 1; left: 0; right: 0; top: 0; height: 30%; pointer-events: none; background: linear-gradient(to bottom, rgba(6, 9, 13, 0.6), rgba(6, 9, 13, 0)); }
.s-brief .brief-hero::after { content: ""; position: absolute; z-index: 1; inset: 0; pointer-events: none;
  background: linear-gradient(to top, var(--ink) 0%, rgba(9, 13, 18, 0.94) 20%, rgba(9, 13, 18, 0.55) 44%, rgba(9, 13, 18, 0) 66%); }
.s-brief .brief-hero-body { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 0 var(--gutter) 14px; }
.brief-kicker { font-size: calc(11.5px * var(--scale)); font-weight: 700; line-height: 1.3; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.brief-title { margin-top: 6px; font-family: var(--font-serif); font-size: calc(31px * var(--scale)); font-weight: 500; line-height: 1.06; letter-spacing: -0.015em; color: var(--text); text-wrap: balance; text-shadow: 0 2px 22px rgba(0, 0, 0, 0.6); }
.brief-body { position: relative; padding: 6px var(--gutter) var(--s5); }
.brief-story { margin-top: 14px; }
.brief-lead { color: var(--text-2); font-size: calc(var(--fs-body) * 0.96); line-height: 1.5; }
.brief-lead.is-clamped { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.brief-sec { margin-top: 18px; }
/* Étapes : une rangée de cartes, la suivante dépasse à droite ; la rangée va d'un bord à l'autre de l'écran. */
.brief-steps { position: relative; display: flex; gap: 10px; margin: -4px calc(-1 * var(--gutter)) 0; padding: 4px var(--gutter) 8px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.brief-steps::-webkit-scrollbar { display: none; }
.brief-steps:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; border-radius: 22px; }
.brief-step { flex: none; width: min(80%, 300px); display: flex; flex-direction: column; padding: 10px 10px 14px; border-radius: 20px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); scroll-snap-align: start; }
.brief-art { width: 100%; }
.brief-art.art-frame { aspect-ratio: 2 / 1; border-radius: 14px; }
.brief-step-text { padding: 12px 4px 0; }
.brief-art-ic { position: relative; display: grid; place-items: center; aspect-ratio: 2 / 1; border-radius: 16px; background: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); color: var(--blue); }
.brief-art-ic svg { width: 28px; height: 28px; }
.brief-step-text h3 { font-size: calc(15.5px * var(--scale)); font-weight: 700; line-height: 1.25; color: var(--text); }
.brief-step-text p { margin-top: 3px; color: var(--text-2); font-size: calc(14px * var(--scale)); line-height: 1.4; }
.brief-privacy { display: flex; gap: 8px; align-items: flex-start; margin-top: var(--s4); color: var(--text-3); font-size: var(--fs-meta); line-height: 1.4; }
.brief-privacy svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
/* Sélecteur segmenté « Caméra | Salon dessiné » : deux segments dans une gouttière, le choisi en relief. */
.brief-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(243, 238, 229, 0.07); box-shadow: inset 0 0 0 1px var(--line-2); }
.brief-mode-opt { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 44px; padding: 0 10px; border-radius: 999px;
  color: var(--text-2); font-size: calc(15px * var(--scale)); font-weight: 600; line-height: 1.15; white-space: nowrap; -webkit-tap-highlight-color: transparent;
  transition: background-color var(--t-press), color var(--t-press), transform var(--t-press) var(--ease-out); }
.brief-mode-opt span { overflow: hidden; text-overflow: ellipsis; }
.brief-mode-opt svg { width: 18px; height: 18px; flex: none; }
.brief-mode-opt[aria-checked="true"] { background: var(--surface-3); color: var(--text); box-shadow: 0 4px 12px -6px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.brief-mode-opt[aria-checked="true"] svg { color: var(--amber); }
.brief-mode-opt.is-pressed, .brief-mode-opt:active { transform: scale(0.97); }
.brief-mode-opt:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
:root[data-text="xl"] .brief-step { width: min(88%, 340px); }
:root[data-text="xl"] .brief-mode-opt svg { display: none; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 6px; color: var(--text-2); font-size: calc(var(--fs-body) * 0.86); font-weight: 600; }
.link-btn svg { width: 16px; height: 16px; color: var(--amber); }
.link-btn:hover { color: var(--text); }

/* ---------- Traque : structure ---------- */
.s-hunt { background: var(--ink); overflow: hidden; user-select: none; -webkit-user-select: none; }
.s-hunt .hunt-view { touch-action: none; }
.s-hunt .hunt-view { position: absolute; inset: 0; }
.s-hunt[data-mode="board"] .hunt-view { bottom: var(--hunt-bottom, 240px); }
.hunt-grain { position: absolute; inset: 0; pointer-events: none; opacity: 0.16; mix-blend-mode: overlay;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 3px); }
.s-hunt.is-dark .cam-view video { filter: brightness(1.35) contrast(1.05); }
.hunt-top { position: absolute; top: var(--safe-top); left: 0; right: 0; z-index: 4; display: grid; grid-template-columns: var(--tap) 1fr var(--tap); align-items: center; gap: var(--s2); padding: var(--s3) var(--s4) 0; }
.hunt-duo { display: flex; justify-content: flex-end; min-width: var(--tap); }
.hunt-duo:empty { display: none; }
.hunt-slots { justify-self: center; display: flex; gap: 10px; padding: 6px 10px; border-radius: var(--r-chip); background: rgba(9,13,18,0.72); border: 1px solid var(--line-2); }
.slot { position: relative; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px dashed rgba(243,238,229,0.28); color: var(--text-3); font-weight: 700; font-size: 13px; transition: background var(--t-view) var(--ease-out), border-color var(--t-view), color var(--t-view), transform var(--t-view) var(--ease-out); }
.slot svg { display: none; width: 16px; height: 16px; }
.slot.is-found { border: 2px solid var(--amber); background: var(--amber); color: var(--amber-ink); box-shadow: 0 0 14px rgba(230,183,124,0.55); animation: slot-pop var(--t-reveal) var(--ease-out); }
.slot.is-found .slot-num { display: none; }
.slot.is-found svg { display: block; }
@keyframes slot-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.18); } 100% { transform: none; } }
.hunt-sub { position: absolute; left: var(--s4); right: var(--s4); top: calc(var(--safe-top) + 66px); z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.hunt-sub > * { pointer-events: auto; }
.hunt-objective { font-size: calc(var(--fs-body) * 0.88); padding: 8px 12px; }
.hunt-hint { margin: 0 var(--s3); text-align: center; color: var(--text); font-size: var(--fs-meta); font-weight: 600; text-shadow: 0 1px 6px rgba(0,0,0,0.8); pointer-events: none; }
.s-hunt[data-phase="scan"] .hunt-hint, .s-hunt.all-found .hunt-hint { display: none; }
.hunt-notice { width: 100%; animation: rise-in var(--t-view) var(--ease-out); }
.hunt-notice:empty { display: none; }
.hunt-notice.is-leaving { opacity: 0; transition: opacity 300ms; }
.hunt-arstate { position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--safe-top) + 150px); z-index: 4; white-space: nowrap; }

/* ---------- Réticule, reflets, repères ---------- */
.reticle { position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; z-index: 2; pointer-events: none; --lock: 0; transition: opacity var(--t-view); }
.reticle-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.reticle-ring circle { fill: none; stroke-width: 3; }
.rr-track { stroke: rgba(243,238,229,0.45); stroke-dasharray: 3 7; }
.rr-fill { stroke: var(--amber); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--lock) * 100); filter: drop-shadow(0 0 6px rgba(230,183,124,0.8)); }
.reticle-dot { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px rgba(9,13,18,0.4); }
.reticle.is-locking .reticle-dot { background: var(--amber); }
.s-hunt[data-phase="scan"] .reticle, .s-hunt.all-found .reticle { opacity: 0; }
.hunt-markers { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.glint, .found-mark { position: absolute; left: 0; top: 0; }
.glint { width: 84px; height: 84px; margin: -42px 0 0 -42px; border-radius: 50%;
  background: radial-gradient(circle, rgba(241,203,147,0.95) 0 6%, rgba(230,183,124,0.45) 18%, rgba(230,183,124,0.12) 42%, transparent 66%);
  animation: glint 1.1s ease-in-out infinite; }
@keyframes glint { 0%, 100% { filter: brightness(0.8); } 50% { filter: brightness(1.4); } }
.found-mark { pointer-events: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 120px; margin-left: -60px; margin-top: -26px; color: var(--amber); }
.found-mark svg { width: 44px; height: 44px; padding: 8px; border-radius: 50%; background: rgba(9,13,18,0.7); border: 2px solid var(--amber); box-shadow: 0 0 18px rgba(230,183,124,0.55); }
.found-label { padding: 2px 8px; border-radius: var(--r-chip); background: rgba(9,13,18,0.8); color: var(--text); font-size: 12px; font-weight: 600; white-space: nowrap; }
.edge-arrow { position: absolute; left: 0; top: 0; z-index: 3; width: 72px; margin: -28px 0 0 -36px; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--amber); pointer-events: none; }
.edge-arrow svg { width: 40px; height: 40px; padding: 6px; border-radius: 50%; background: rgba(9,13,18,0.78); border: 1px solid rgba(230,183,124,0.6); animation: nudge 1s ease-in-out infinite; }
.edge-arrow span { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; text-shadow: 0 1px 4px rgba(0,0,0,0.9); }
@keyframes nudge { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }

/* ---------- Balayage ---------- */
.scan-panel { position: absolute; left: var(--s4); right: var(--s4); top: 50%; transform: translateY(-58%); z-index: 3; display: none; flex-direction: column; align-items: center; text-align: center; gap: 6px; pointer-events: none; }
.s-hunt[data-phase="scan"] .scan-panel { display: flex; animation: fade-in var(--t-view) var(--ease-out); }
.scan-radar-wrap { position: relative; width: 150px; height: 150px; margin-bottom: 6px; }
.scan-radar { width: 100%; height: 100%; transform: rotate(-90deg); }
.scan-radar circle { fill: none; }
.sr-track { stroke: rgba(243,238,229,0.2); stroke-width: 6; }
.sr-fill { stroke: var(--blue); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 300ms var(--ease-out); }
.scan-panel.is-done .sr-fill { stroke: var(--amber); }
.sr-sweep { stroke: rgba(141,207,216,0.25); stroke-width: 1; fill: rgba(9,13,18,0.55); }
.sr-beam { stroke: rgba(141,207,216,0.8); stroke-width: 2; transform-origin: 60px 60px; animation: beam 2.2s linear infinite; }
@keyframes beam { to { transform: rotate(360deg); } }
.scan-pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-serif); font-size: 28px; color: var(--text); font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px rgba(0,0,0,0.8); }
.scan-title { margin: 0; font-family: var(--font-serif); font-size: var(--fs-h3); color: var(--text); text-shadow: 0 2px 10px rgba(0,0,0,0.9); }
.scan-text { margin: 0; max-width: 300px; color: var(--text); font-size: calc(var(--fs-body) * 0.92); text-shadow: 0 1px 8px rgba(0,0,0,0.95); }
.scan-dots { display: flex; gap: 10px; margin-top: 8px; }
.scan-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(243,238,229,0.5); transition: background var(--t-view), transform var(--t-view) var(--ease-out); }
.scan-dot.is-on { background: var(--blue); border-color: var(--blue); transform: scale(1.15); box-shadow: 0 0 10px rgba(141,207,216,0.8); }

/* ---------- Bas : détecteur, trouvailles, barre ---------- */
.hunt-bottom { position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3) var(--s4) calc(var(--s3) + var(--safe-bottom)); background: linear-gradient(to bottom, rgba(9,13,18,0), rgba(9,13,18,0.82) 28%, rgba(9,13,18,0.94)); }
.s-hunt[data-mode="board"] .hunt-bottom { background: var(--ink); border-top: 1px solid var(--line); }
.detector { --level: 0; display: flex; align-items: center; gap: var(--s3); padding: 8px 12px; border-radius: var(--r-card); background: rgba(20,28,38,0.92); border: 1px solid var(--line-2); transition: border-color var(--t-view), box-shadow var(--t-view); }
.detector > svg { width: 22px; height: 22px; flex: none; color: var(--blue); }
.detector.is-hot { border-color: rgba(230,183,124,0.8); box-shadow: 0 0 22px rgba(230,183,124,0.35); }
.detector.is-hot > svg { color: var(--amber); }
.det-main { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: var(--s2); }
.det-label { flex: 0 1 auto; min-width: 102px; font-weight: 700; font-size: calc(var(--fs-body) * 0.88); line-height: 1.2; text-wrap: balance; color: var(--text); }
/* Toutes les cachettes trouvées : plus de signal à tracer, la phrase prend la place de l’onde (et passe à la ligne s’il le faut, jamais sous les barres). */
.s-hunt.all-found .det-wave { display: none; }
.det-dist { flex: none; padding: 2px 8px; border-radius: var(--r-chip); background: rgba(243,238,229,0.08); color: var(--text); font-size: var(--fs-meta); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.det-wave { flex: 1 1 auto; min-width: 0; width: 100%; height: 28px; }
.det-bars { flex: none; display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.det-bars span { width: 6px; border-radius: 2px; background: rgba(243,238,229,0.16); transition: background 120ms; }
.det-bars span:nth-child(1) { height: 30%; } .det-bars span:nth-child(2) { height: 45%; } .det-bars span:nth-child(3) { height: 62%; } .det-bars span:nth-child(4) { height: 80%; } .det-bars span:nth-child(5) { height: 100%; }
.det-bars span.is-on { background: var(--blue); }
.detector.is-hot .det-bars span.is-on { background: var(--amber); }
.s-hunt[data-phase="scan"] .detector { opacity: 0.45; }
.s-hunt.all-found .detector { opacity: 0.6; }
.bag { padding: 8px 12px 4px; border-radius: var(--r-card); background: rgba(20,28,38,0.92); border: 1px solid var(--line-2); }
.bag-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s2); }
.bag-title { font-weight: 700; font-size: var(--fs-meta); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.bag-count { font-size: var(--fs-meta); color: var(--text-3); font-weight: 600; }
.bag-count.is-todo { color: var(--amber); }
.bag-objs { padding-top: 6px; }
.bag-objs:empty { display: none; }
.bag-empty { margin: 4px 0 8px; color: var(--text-3); font-size: var(--fs-meta); }
.tray-obj.pulse-once .obj { animation: bag-pulse 0.8s var(--ease-out) 3; }
@keyframes bag-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(230,183,124,0); } 50% { box-shadow: 0 0 0 6px rgba(230,183,124,0.45); } }
.s-hunt .explore-bar .btn-label-icon { min-height: 50px; }

/* ---------- Trouvaille ---------- */
.found-burst { position: absolute; z-index: 5; width: 0; height: 0; pointer-events: none; }
.found-burst span { position: absolute; left: -40px; top: -40px; width: 80px; height: 80px; border-radius: 50%; border: 3px solid var(--amber); animation: burst 1.1s var(--ease-out) forwards; }
.found-burst span:nth-child(2) { animation-delay: 0.15s; }
.found-burst span:nth-child(3) { animation-delay: 0.3s; border-color: var(--amber-2); }
@keyframes burst { from { transform: scale(0.3); opacity: 1; } to { transform: scale(5); opacity: 0; } }
.found-card { position: absolute; left: var(--s5); right: var(--s5); top: 30%; z-index: 6; padding: var(--s4) var(--s4) var(--s3); border-radius: var(--r-panel); background: rgba(20,28,38,0.96); border: 1px solid rgba(230,183,124,0.6); box-shadow: var(--shadow), 0 0 40px rgba(230,183,124,0.25); text-align: center; animation: found-in var(--t-reveal) var(--ease-out); }
.found-card.is-leaving { animation: found-out 260ms var(--ease-in) forwards; }
@keyframes found-in { from { opacity: 0; transform: translateY(16px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes found-out { to { opacity: 0; transform: translateY(40px) scale(0.9); } }
.fc-kicker { margin: 0; font-size: var(--fs-meta); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.fc-title { margin: 4px 0 0; font-family: var(--font-serif); font-size: var(--fs-title); font-weight: 500; color: var(--text); }
.fc-name { margin: 2px 0 0; color: var(--text-2); }
.fc-objs { display: flex; justify-content: center; gap: var(--s2); margin: var(--s3) 0 var(--s2); }
.fc-hint { margin: 0; color: var(--text-3); font-size: var(--fs-meta); }

/* ---------- Salon illustré ---------- */
.pano { position: absolute; inset: 0; overflow: hidden; cursor: grab; background: #0C121A; }
.pano:active { cursor: grabbing; }
.pano-track { position: absolute; left: 0; top: 0; height: 100%; will-change: transform; }
.pano-copy { position: absolute; top: 0; }
.pano-copy img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pano::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(9,13,18,0.7), rgba(9,13,18,0) 20%, rgba(9,13,18,0) 80%, rgba(9,13,18,0.5)); }
.spot { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; display: grid; place-items: center; background: transparent; }
.spot .spot-mark { width: 46px; height: 46px; padding: 9px; border-radius: 50%; color: var(--amber); background: rgba(9,13,18,0.7); border: 2px solid var(--amber); box-shadow: 0 0 20px rgba(230,183,124,0.6); opacity: 0; transform: scale(0.5); transition: opacity var(--t-view), transform var(--t-view) var(--ease-out); }
.spot .spot-mark svg { width: 100%; height: 100%; }
.spot.is-found .spot-mark { opacity: 1; transform: none; }
.spot:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.spot:active:not(.is-found) { background: radial-gradient(circle, rgba(141,207,216,0.22), transparent 70%); }
.spot.is-empty { animation: spot-shake 0.4s var(--ease-out); background: radial-gradient(circle, rgba(243,238,229,0.14), transparent 70%); }
@keyframes spot-shake { 0%, 100% { transform: translate(-50%, -50%); } 25% { transform: translate(-54%, -50%) rotate(-3deg); } 75% { transform: translate(-46%, -50%) rotate(3deg); } }
.spot-bubble { position: absolute; z-index: 5; max-width: 260px; transform: translate(-50%, -100%); padding: 8px 12px; border-radius: 14px; background: var(--paper); color: var(--paper-ink); font-size: calc(var(--fs-body) * 0.86); font-weight: 600; box-shadow: var(--shadow-soft); pointer-events: none; }
@keyframes bubble-in { from { opacity: 0; transform: translate(-50%, calc(-100% + 8px)); } to { opacity: 1; transform: translate(-50%, -100%); } }
.spot-bubble.is-in { animation: bubble-in var(--t-view) var(--ease-out); }
.spot-bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; width: 12px; height: 12px; margin-left: -6px; background: var(--paper); transform: rotate(45deg); }

/* ---------- Mouvements réduits ---------- */
:root[data-motion="reduced"] .brief-signal span, :root[data-motion="reduced"] .glint, :root[data-motion="reduced"] .sr-beam, :root[data-motion="reduced"] .edge-arrow svg, :root[data-motion="reduced"] .found-burst span { animation: none; }
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="full"]) .brief-signal span, :root:not([data-motion="full"]) .glint, :root:not([data-motion="full"]) .sr-beam, :root:not([data-motion="full"]) .edge-arrow svg, :root:not([data-motion="full"]) .found-burst span { animation: none; }
}
.stage.wide .hunt-bottom { max-width: 640px; left: 50%; transform: translateX(-50%); right: auto; width: 100%; }
