/* PILL DOSE HUD + progressive reality decay.
   Effects are CSS only, rare, and cheap on mobile. Contract addresses,
   price data, and outbound links are explicitly protected from all of it. */

#pill-hud {
  position: fixed; z-index: 9000; left: 14px; bottom: 14px;
  font-family: 'Space Mono', ui-monospace, 'Courier New', monospace;
  max-width: calc(100vw - 28px);
}
.pill-hud__line {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  background: rgba(13, 15, 12, 0.9); color: #D9DED4;
  border: 2px solid #46C88C; border-radius: 4px;
  padding: 7px 12px; font-size: 12px; letter-spacing: 0.1em;
  font-family: inherit; cursor: pointer; text-align: left;
}
.pill-hud__line:hover { background: rgba(13, 15, 12, 0.98); }
.pill-hud__line:focus-visible { outline: 3px solid #46C88C; outline-offset: 2px; }
.pill-hud__line .k { color: #8B948A; }
.pill-hud__line .v { color: #fff; font-weight: 700; }
.pill-hud__line .v.bad { color: #E8B84B; }
.pill-hud__line .sep { color: #454B42; }

.pill-hud__panel {
  margin-top: 8px; width: min(340px, calc(100vw - 28px));
  background: #0D0F0C; color: #D9DED4;
  border: 2px solid #2E332B; border-radius: 4px; padding: 14px 16px;
  max-height: min(60vh, 520px); overflow-y: auto;
}
.pill-hud__h { font-size: 10px; letter-spacing: 0.24em; color: #8B948A; margin: 2px 0 8px; }
.pill-hud__h + .pill-hud__h { margin-top: 16px; }
.pill-hud__dl { display: grid; gap: 4px; margin: 0 0 4px; }
.pill-hud__dl > div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.pill-hud__dl dt { color: #8B948A; letter-spacing: 0.06em; margin: 0; }
.pill-hud__dl dd { color: #fff; margin: 0; font-variant-numeric: tabular-nums; }
.pill-hud__sym { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.pill-hud__sym li { font-size: 11.5px; color: #46C88C; letter-spacing: 0.08em; }
.pill-hud__sym li.none { color: #454B42; }
.pill-hud__note { font-size: 10px; color: #454B42; line-height: 1.5; margin: 14px 0 0; letter-spacing: 0.04em; }

.pill-hud__toast {
  position: fixed; z-index: 9001; left: 14px; bottom: 62px;
  background: #0D0F0C; color: #46C88C;
  border: 2px solid #46C88C; border-radius: 4px;
  padding: 9px 14px; font-family: 'Space Mono', ui-monospace, monospace;
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em;
  opacity: 0; transform: translateY(6px); transition: opacity 320ms, transform 320ms;
  pointer-events: none; max-width: calc(100vw - 28px);
}
.pill-hud__toast.is-on { opacity: 1; transform: translateY(0); }

@media (max-width: 640px) {
  #pill-hud { left: 8px; bottom: 8px; }
  .pill-hud__line { font-size: 10.5px; padding: 6px 9px; gap: 5px; }
  .pill-hud__toast { left: 8px; bottom: 54px; font-size: 10.5px; }
}

/* ---------- progressive reality decay ----------
   Never applied to identity-critical content. */
[data-corrupt-safe], .ca, .ca *, [class*="contract"], [class*="stat-"],
a[href^="http"], code, .dose__links, .dose__links * {
  filter: none !important; transform: none !important; letter-spacing: inherit !important;
}

/* band 1: barely there */
body[data-reality-band="1"] .specimen__tag,
body[data-reality-band="1"] .term__bar { letter-spacing: 0.16em; }

/* band 2: the document starts breathing */
body[data-reality-band="2"] .specimen__tag,
body[data-reality-band="2"] .term__bar { letter-spacing: 0.2em; color: #8B948A; }
body[data-reality-band="2"]::after {
  content: ""; position: fixed; inset: 0; z-index: 8000; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(22, 25, 20, 0.035) 3px 4px);
}

/* band 3: visibly wrong, still readable */
body[data-reality-band="3"]::after {
  content: ""; position: fixed; inset: 0; z-index: 8000; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(22, 25, 20, 0.06) 3px 4px);
}
body[data-reality-band="3"] h1, body[data-reality-band="3"] h2 { letter-spacing: -0.005em; }
body[data-reality-band="3"] .specimen__tag::after { content: " / OBSERVED"; color: #C6402E; }

/* band 4: containment failing. Slow, rare, never seizure-adjacent. */
body[data-reality-band="4"]::after {
  content: ""; position: fixed; inset: 0; z-index: 8000; pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(22, 25, 20, 0.085) 3px 4px);
  animation: pill-decay 14s ease-in-out infinite;
}
body[data-reality-band="4"] .specimen__tag::after { content: " / THERE HAS ONLY EVER BEEN ONE"; color: #C6402E; }
@keyframes pill-decay { 0%, 92%, 100% { opacity: 1; } 95% { opacity: 0.55; } }

@media (prefers-reduced-motion: reduce) {
  body[data-reality-band="4"]::after { animation: none; }
  .pill-hud__toast { transition: none; }
}
