/* Détecteur de fantômes — ambiance nuit, mystérieuse mais douce. Polices système, aucune ressource externe. */
:root {
  --bg: #141033; --bg2: #1f1950; --panel: rgba(255, 255, 255, .07); --line: rgba(255, 255, 255, .16);
  --ink: #f4f1ff; --muted: #b9b2e6; --glow: #5cf2c8; --glow2: #8f7bff; --warm: #ffd56b; --hot: #ff7aa8;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px); --sar: env(safe-area-inset-right, 0px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--ink); font: 400 1.05rem/1.5 var(--font); overflow-x: hidden;
  background: radial-gradient(900px 600px at 80% -10%, #3a2a8a 0, transparent 60%), radial-gradient(700px 500px at 0% 100%, #0f4a5a 0, transparent 60%), var(--bg);
  background-attachment: fixed;
}
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .55;
  background-image: radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 72% 12%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 40% 70%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 88% 60%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 25% 90%, #fff 50%, transparent 51%), radial-gradient(1.2px 1.2px at 58% 40%, #fff 50%, transparent 51%); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); } .center { text-align: center; }
:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; border-radius: 10px; }
.shell { position: relative; max-width: 560px; margin: 0 auto; padding: calc(var(--sat) + 14px) calc(var(--sar) + 16px) calc(var(--sab) + 24px) calc(var(--sal) + 16px); outline: none; }
h1 { margin: 0; line-height: 1.15; }

.hero { text-align: center; padding: 6px 0 4px; }
.hero h1 { font-size: clamp(1.9rem, 9vw, 2.6rem); font-weight: 900; letter-spacing: -.02em; }
.hero h1 span { color: var(--glow); display: block; font-size: .8em; }
.hero-ghost { display: flex; justify-content: center; animation: float 3.2s ease-in-out infinite; filter: drop-shadow(0 10px 22px rgba(143, 123, 255, .5)); }
@keyframes float { 50% { transform: translateY(-8px) rotate(-3deg); } }
.tag { color: var(--muted); margin: 8px 0 0; }
.panel { display: grid; gap: 12px; margin: 18px 0; padding: 18px; border-radius: 24px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.lbl { margin: 0; font-weight: 700; color: var(--muted); font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lvl { min-height: 48px; border-radius: 14px; border: 2px solid var(--line); background: transparent; color: var(--ink); font: 700 1rem var(--font); cursor: pointer; }
.lvl.on { background: var(--glow2); border-color: var(--glow2); color: #fff; box-shadow: 0 0 18px rgba(143, 123, 255, .6); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: .65rem 1.1rem; border-radius: 16px; border: 2px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--ink); font: 700 1.05rem var(--font); cursor: pointer; touch-action: manipulation; transition: transform .12s ease; }
.btn:active { transform: scale(.98); }
.btn.big { min-height: 64px; font-size: 1.2rem; }
.btn.primary { background: linear-gradient(135deg, #34d8b0, #6f8bff); border-color: transparent; color: #0d0b26; box-shadow: 0 8px 26px rgba(92, 242, 200, .35); }
.btn.ghostly { border-style: dashed; }
.ic { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; border: 0; background: rgba(255, 255, 255, .08); color: var(--ink); cursor: pointer; }
.disclaimer { font-size: .85rem; color: var(--muted); text-align: center; padding: 0 8px; }
.foot { text-align: center; font-size: .85rem; margin: 6px 0; }
.linkbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; background: none; border: 0; color: var(--glow); font: 600 .95rem var(--font); cursor: pointer; }
.linkbtn .ic { width: 18px; height: 18px; }

.top { display: grid; grid-template-columns: 48px 1fr auto; gap: 10px; align-items: center; margin-bottom: 8px; }
.top h1 { font-size: 1.15rem; text-align: center; }
.volbox { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.vol { width: 96px; accent-color: var(--glow); }

.hunt { display: grid; gap: 12px; justify-items: center; text-align: center; }
.radar-wrap { position: relative; width: min(86vw, 360px, 52vh); aspect-ratio: 1; touch-action: none; border-radius: 50%; }
.radar-wrap.lab { aspect-ratio: auto; height: 120px; width: min(92vw, 420px); border-radius: 20px; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); }
.radar { width: 100%; height: 100%; display: block; }
.r-bg { fill: #0b2a2d; stroke: var(--glow); stroke-width: 2; }
.r-ring { fill: none; stroke: rgba(92, 242, 200, .3); stroke-width: 1; }
.r-sweep { transform-origin: 100px 100px; animation: sweep 2.4s linear infinite; }
.r-cone { fill: rgba(92, 242, 200, .22); }
@keyframes sweep { to { transform: rotate(360deg); } }
.r-blip { fill: var(--hot); opacity: 0; filter: drop-shadow(0 0 6px var(--hot)); }
.r-me { fill: #7cc8ff; stroke: #fff; stroke-width: 1.5; }
.radar.hot .r-bg { stroke: var(--hot); }
.radar.hot .r-sweep { animation-duration: .9s; }
.lockring { position: absolute; inset: -6px; border-radius: 50%; opacity: 0; pointer-events: none; background: conic-gradient(var(--warm) calc(var(--k, 0) * 360deg), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px)); mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px)); }
.lockring.on { opacity: 1; }
.bars { display: flex; gap: 5px; align-items: flex-end; height: 46px; }
.bars i { width: 16px; border-radius: 4px; background: rgba(255, 255, 255, .12); transition: background-color .15s; }
.bars i:nth-child(1) { height: 10%; } .bars i:nth-child(2) { height: 19%; } .bars i:nth-child(3) { height: 28%; } .bars i:nth-child(4) { height: 37%; } .bars i:nth-child(5) { height: 46%; }
.bars i:nth-child(6) { height: 55%; } .bars i:nth-child(7) { height: 64%; } .bars i:nth-child(8) { height: 73%; } .bars i:nth-child(9) { height: 86%; } .bars i:nth-child(10) { height: 100%; }
.bars i.on { background: var(--glow); box-shadow: 0 0 10px var(--glow); }
.bars i.on:nth-child(n+8) { background: var(--hot); box-shadow: 0 0 10px var(--hot); }
.hz { margin: 0; font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.hint { margin: 0; min-height: 3em; font-size: 1.15rem; font-weight: 700; color: var(--warm); }
.manual-tip { margin: 0; font-size: .9rem; color: var(--muted); }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.labhz { margin: 0; font-size: clamp(2.6rem, 14vw, 4rem); font-weight: 900; color: var(--glow); font-variant-numeric: tabular-nums; text-shadow: 0 0 22px rgba(92, 242, 200, .55); }
.labwave { margin: 0; font-weight: 700; color: var(--warm); }
.gauge { width: min(92vw, 420px); height: 14px; border-radius: 999px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.gfill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6f8bff, var(--glow), var(--warm)); }
.scope { width: 100%; height: 100%; } .scope path { fill: none; stroke: var(--glow); stroke-width: 3; stroke-linejoin: round; filter: drop-shadow(0 0 4px var(--glow)); }

.book { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.gcard { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; border-radius: 18px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: 700 .95rem var(--font); cursor: pointer; }
.gcard.unknown { cursor: default; color: var(--muted); }
.ghost-svg { display: block; }
.paused { text-align: center; display: grid; gap: 14px; justify-items: center; padding-top: 10vh; }

dialog.modal { width: min(460px, calc(100vw - 24px)); max-height: calc(100dvh - var(--sat) - var(--sab) - 24px); border: 1px solid var(--line); border-radius: 24px; padding: 0; color: var(--ink); background: #221b55; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); overflow: auto; }
dialog.modal::backdrop { background: rgba(5, 3, 20, .7); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 14px 4px 20px; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.modal-body { padding: 4px 20px 8px; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding: 8px 20px 20px; }
.reveal-body { text-align: center; }
.reveal-body h3 { margin: 4px 0; font-size: 1.6rem; color: var(--warm); }
.reveal-body .ghost-svg { margin: 0 auto; }
.pop { display: flex; justify-content: center; animation: pop .7s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop { from { transform: scale(.2) translateY(30px); opacity: 0; } }
.where { color: var(--glow); font-weight: 700; margin: 0; }
.steps { padding-left: 1.2rem; } .steps li { margin: 8px 0; } .steps .ic { width: 18px; height: 18px; vertical-align: -3px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--sab) + 18px); z-index: 60; max-width: min(480px, calc(100vw - 32px)); background: #f4f1ff; color: #141033; padding: 10px 16px; border-radius: 14px; font-weight: 700; text-align: center; }
@media (max-height: 640px) { .radar-wrap { width: min(70vw, 44vh); } .hint { min-height: 2.4em; font-size: 1rem; } .btn.big { min-height: 54px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
