/* =============================================================================
   Spiders — iOS design system 2.0 (SPEC-2.0 §1, on top of SPEC §6 FROZEN tokens)
   Dark "field at dusk" theme. Native iOS feel: SF system font, large titles,
   bottom tab bar, sheet cards, safe-area insets, 44pt tap targets, springs.

   2.0 raises the polish: layered surfaces + softer/larger shadows, frosted blur
   on the tab bar / sheets / headers, a refined type scale with tabular numerals,
   spring motion, and a full kit of reusable components (segmented control, pill
   chips, progress ring/bar, countdown, upgraded toast, drag-handle bottom sheet,
   empty state, skeleton shimmer, badge, streak flame, camera HUD).

   IMPORTANT: every class the existing screens already rely on is preserved.
   The §6 frozen palette + radii + spacing are unchanged; 2.0 only ADDS tokens.
   ============================================================================= */

:root {
  /* ---- Surfaces / text (FROZEN §6) ---- */
  --bg: #0B0F0C;
  --surface: #141A16;
  --elevated: #1C2620;
  --hairline: #26302A;
  --text: #E8F0EA;
  --text-muted: #8A968C;

  /* ---- 2.0 layered material (additive) — bg → surface → elevated → floating.
     `floating` is the topmost glass layer (sheets/tab bar over content). ---- */
  --floating: #222E27;
  --surface-glass: rgba(20, 26, 22, 0.72);
  --elevated-glass: rgba(28, 38, 32, 0.78);
  --header-glass: rgba(11, 15, 12, 0.62);
  --hairline-strong: #33403A;

  /* ---- Accents (FROZEN §6) ---- */
  --accent: #6BE675;        /* lichen green, primary actions */
  --accent-press: #4FD15C;
  --amber: #FFB74D;
  /* 2.0 secondary glow gradient for hero moments (level-up / new species). */
  --accent-glow: radial-gradient(120% 120% at 50% 0%, rgba(107, 230, 117, 0.35) 0%, rgba(91, 192, 235, 0.12) 45%, transparent 75%);
  --hero-gradient: linear-gradient(150deg, rgba(107, 230, 117, 0.22) 0%, rgba(91, 192, 235, 0.14) 55%, rgba(28, 38, 32, 0.9) 100%);

  /* ---- Rarity (FROZEN §6) ---- */
  --rarity-common: #9AA8A0;
  --rarity-uncommon: #5BC0EB;
  --rarity-rare: #B388FF;
  --rarity-event: #FFB74D;
  --rarity-mythic: #FF6E6E;

  /* ---- Confidence (FROZEN §6) ---- */
  --conf-high: #4CAF50;
  --conf-medium: #FFC107;
  --conf-low: #FF9800;
  --conf-unsafe: #F44336;

  /* ---- Quality HUD (camera framing-ring states) ---- */
  --q-bad: #F44336;
  --q-ok: #FFB74D;
  --q-good: #6BE675;

  /* ---- Radii / shadow (FROZEN §6) ---- */
  --radius-card: 18px;
  --radius-pill: 999px;
  --radius-sheet: 22px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  /* 2.0 softer/larger elevation set */
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.55), 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-float: 0 -10px 36px rgba(0, 0, 0, 0.5);
  --radius-sm: 12px;
  --radius-xs: 8px;

  /* ---- Spacing scale (FROZEN §6): 4 8 12 16 20 24 32 ---- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* ---- Safe-area insets (notch) ---- */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* ---- Layout metrics ---- */
  --tabbar-h: 58px;
  --header-h: 52px;
  --blur: 20px;

  /* ---- Type scale 2.0 (SPEC-2.0 §1) ---- */
  --fs-large: 34px;   /* large titles */
  --fs-title: 28px;   /* secondary large title */
  --fs-section: 20px; /* section titles */
  --fs-body: 16px;    /* body */
  --fs-sub: 15px;
  --fs-caption: 13px; /* caption */
  --fs-tiny: 12px;
  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-body: 1.45;

  /* ---- Springs / motion ---- */
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
  --spring-soft: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-bounce: cubic-bezier(0.5, 1.8, 0.5, 1);
  --dur-fast: 160ms;
  --dur: 280ms;
  --dur-slow: 420ms;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
    system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* Tabular numerals for stats / timers / counters (SPEC-2.0 §1). */
  --num: "SF Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* ----------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

body {
  /* Prevent rubber-band white flash; lock the body, scroll inside screens. */
  position: fixed;
  inset: 0;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
}

button {
  font-family: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

/* Global keyboard focus ring (security-pass a11y): visible only for keyboard /
   assistive-tech focus, never for touch/mouse — uses the FROZEN accent token. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

img,
svg {
  display: block;
  max-width: 100%;
}

::selection {
  background: rgba(107, 230, 117, 0.3);
}

/* Tabular numerals utility — use on any stat/timer/counter run of digits. */
.num,
.tnum,
.countdown-timer,
.xp-amount,
.stat .v,
.xp-ring .level .num,
.progress-ring-label {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ----------------------------------------------------------------------------- */
.app {
  position: relative;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

/* ---- Boot splash ---- */
.splash {
  position: absolute;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  background: radial-gradient(120% 80% at 50% 30%, #16201a 0%, var(--bg) 70%);
  transition: opacity var(--dur) var(--spring), visibility var(--dur);
}
.app:not([data-booting='true']) .splash {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash-mark {
  width: 96px;
  height: 96px;
  animation: float 2.6s var(--spring) infinite alternate;
}
.splash-mark svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 6px 20px rgba(107, 230, 117, 0.35));
}
.splash-name {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.splash-tag {
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.02em;
}
@keyframes float {
  from {
    transform: translateY(0) rotate(-2deg);
  }
  to {
    transform: translateY(-10px) rotate(2deg);
  }
}

/* ---- Header (contextual large title) — frosted in 2.0 ---- */
.app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  padding: calc(var(--safe-top) + var(--sp-3)) var(--sp-5) var(--sp-3);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-3);
  background: linear-gradient(180deg, var(--header-glass) 0%, rgba(11, 15, 12, 0.45) 62%, rgba(11, 15, 12, 0) 100%);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  backdrop-filter: saturate(160%) blur(12px);
  pointer-events: none;
}
.app-header[hidden] {
  display: none;
}
.header-title {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
  pointer-events: auto;
}
/* Optional larger title variant for hero screens. */
.header-title.large {
  font-size: var(--fs-large);
}
.header-accessory {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ---- Screen container ---- */
.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.screen-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-top) + var(--header-h) + var(--sp-2)) var(--sp-5)
    calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-6));
  scroll-behavior: smooth;
}
.screen-enter {
  animation: screenIn var(--dur) var(--spring);
}
.screen-leave {
  animation: screenOut var(--dur-fast) var(--spring) forwards;
}
@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@keyframes screenOut {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

/* List stagger: children fade/rise in sequence (SPEC-2.0 §1). Apply
   .stagger to a container; up to 12 direct children animate in order. */
.stagger > * {
  animation: itemIn var(--dur) var(--spring) backwards;
}
.stagger > *:nth-child(1) { animation-delay: 30ms; }
.stagger > *:nth-child(2) { animation-delay: 70ms; }
.stagger > *:nth-child(3) { animation-delay: 110ms; }
.stagger > *:nth-child(4) { animation-delay: 150ms; }
.stagger > *:nth-child(5) { animation-delay: 190ms; }
.stagger > *:nth-child(6) { animation-delay: 230ms; }
.stagger > *:nth-child(7) { animation-delay: 270ms; }
.stagger > *:nth-child(8) { animation-delay: 310ms; }
.stagger > *:nth-child(9) { animation-delay: 350ms; }
.stagger > *:nth-child(10) { animation-delay: 390ms; }
.stagger > *:nth-child(11) { animation-delay: 430ms; }
.stagger > *:nth-child(12) { animation-delay: 470ms; }
@keyframes itemIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Press scale helper — any tappable card gets a tasteful 0.97 squeeze. */
.pressable {
  transition: transform var(--dur-fast) var(--spring);
}
.pressable:active {
  transform: scale(0.97);
}

/* ----------------------------------------------------------------------------- */
/* Bottom tab bar (Map · Guide · Camera-raised · Profile) — frosted glass        */
/* ----------------------------------------------------------------------------- */
.tab-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  background: var(--surface-glass);
  -webkit-backdrop-filter: saturate(180%) blur(var(--blur));
  backdrop-filter: saturate(180%) blur(var(--blur));
  border-top: 1px solid var(--hairline);
  box-shadow: var(--shadow-float);
}
.tab-bar[hidden] {
  display: none;
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  height: 100%;
  color: var(--text-muted);
  transition: color var(--dur-fast) ease, transform var(--dur-fast) var(--spring);
}
.tab:active {
  transform: scale(0.9);
}
.tab[aria-selected='true'] {
  color: var(--accent);
}
.tab-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
}
.tab-icon svg {
  width: 100%;
  height: 100%;
}
.tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.tab-spacer {
  pointer-events: none;
}

/* Raised center camera button */
.tab-center {
  position: relative;
}
.tab-center-btn {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--accent) 0%, var(--accent-press) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 22px rgba(107, 230, 117, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: 3px solid var(--bg);
  transition: transform var(--dur-fast) var(--spring-soft);
}
.tab-center:active .tab-center-btn {
  transform: translateX(-50%) scale(0.92);
}
.tab-center .tab-icon {
  width: 28px;
  height: 28px;
  color: #07120a;
}

/* ----------------------------------------------------------------------------- */
/* Buttons                                                                       */
/* ----------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 50px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius-pill);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform var(--dur-fast) var(--spring), background var(--dur-fast) ease,
    opacity var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.btn:active {
  transform: scale(0.97);
}
.btn[disabled] {
  opacity: 0.45;
  pointer-events: none;
}
.btn-primary {
  background: var(--accent);
  color: #07120a;
  box-shadow: 0 6px 18px rgba(107, 230, 117, 0.28);
}
.btn-primary:active {
  background: var(--accent-press);
}
.btn-secondary {
  background: var(--elevated);
  color: var(--text);
  border: 1px solid var(--hairline);
}
.btn-ghost {
  background: transparent;
  color: var(--accent);
}
.btn-danger {
  background: rgba(244, 67, 54, 0.16);
  color: var(--conf-unsafe);
  border: 1px solid rgba(244, 67, 54, 0.4);
}
.btn-block {
  width: 100%;
}
.btn-sm {
  min-height: 40px;
  padding: 0 var(--sp-4);
  font-size: 15px;
}
.btn-icon {
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
}
.btn svg {
  width: 20px;
  height: 20px;
}

/* ----------------------------------------------------------------------------- */
/* Cards / surfaces                                                              */
/* ----------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: var(--sp-5);
}
.card-elevated {
  background: var(--elevated);
  box-shadow: var(--shadow);
}
/* 2.0 floating glass card (topmost material). */
.card-floating {
  background: var(--elevated-glass);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow-lg);
}
.card-tappable {
  transition: transform var(--dur-fast) var(--spring), border-color var(--dur-fast) ease;
}
.card-tappable:active {
  transform: scale(0.98);
  border-color: var(--hairline-strong);
}
.card + .card,
.card + .stack,
.stack > * + * {
  margin-top: var(--sp-4);
}
.stack {
  display: flex;
  flex-direction: column;
}
.stack-sm > * + * {
  margin-top: var(--sp-2);
}
.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}
.row-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}
.grow {
  flex: 1;
  min-width: 0;
}
.muted {
  color: var(--text-muted);
}
.tiny {
  font-size: 12px;
}
.small {
  font-size: 14px;
}
.center-text {
  text-align: center;
}
.section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: var(--sp-6) 0 var(--sp-2);
}
.section-title:first-child {
  margin-top: 0;
}
/* Larger section heading variant (sentence case, 20px) per 2.0 type scale. */
.section-heading {
  font-size: var(--fs-section);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: var(--sp-6) 0 var(--sp-3);
}
.section-heading:first-child {
  margin-top: 0;
}

/* ----------------------------------------------------------------------------- */
/* Segmented control (mode switcher) — SPEC-2.0 §1                               */
/* A sliding-pill iOS segmented control. Structure:                              */
/*   <div class="segmented" role="tablist" style="--seg-count:N; --seg-index:i"> */
/*     <button class="segmented-option" aria-selected="true">…</button> …        */
/*     <span class="segmented-thumb"></span>  (optional; CSS positions it)       */
/*   </div>                                                                       */
/* ----------------------------------------------------------------------------- */
.segmented {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--seg-count, 2), 1fr);
  gap: 0;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--elevated);
  border: 1px solid var(--hairline);
  isolation: isolate;
}
.segmented-thumb {
  position: absolute;
  z-index: 0;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / var(--seg-count, 2));
  border-radius: var(--radius-pill);
  background: var(--accent);
  box-shadow: 0 2px 8px rgba(107, 230, 117, 0.35);
  transform: translateX(calc(var(--seg-index, 0) * 100%));
  transition: transform var(--dur) var(--spring);
}
.segmented-option {
  position: relative;
  z-index: 1;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  transition: color var(--dur) ease;
  white-space: nowrap;
}
.segmented-option svg {
  width: 16px;
  height: 16px;
}
.segmented-option[aria-selected='true'] {
  color: #07120a;
}
/* Fallback for thumb-less usage: highlight selected option directly. */
.segmented:not(:has(.segmented-thumb)) .segmented-option[aria-selected='true'] {
  background: var(--accent);
}

/* ----------------------------------------------------------------------------- */
/* Pills / chips                                                                 */
/* ----------------------------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}
.pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.pill svg {
  width: 13px;
  height: 13px;
}

/* Generic pill chip (selectable filter/option). Toggle via aria-pressed. */
.pill-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 13px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--elevated);
  border: 1px solid var(--hairline);
  color: var(--text-muted);
  white-space: nowrap;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease,
    border-color var(--dur-fast) ease, transform var(--dur-fast) var(--spring);
}
.pill-chip:active {
  transform: scale(0.95);
}
.pill-chip svg {
  width: 14px;
  height: 14px;
}
.pill-chip[aria-pressed='true'],
.pill-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #07120a;
}
.pill-chip-row {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--sp-1);
  scrollbar-width: none;
}
.pill-chip-row::-webkit-scrollbar {
  display: none;
}
.pill-chip-row > .pill-chip {
  flex: 0 0 auto;
}

/* Rarity pills */
.rarity-common {
  color: var(--rarity-common);
  background: rgba(154, 168, 160, 0.16);
}
.rarity-uncommon {
  color: var(--rarity-uncommon);
  background: rgba(91, 192, 235, 0.16);
}
.rarity-rare {
  color: var(--rarity-rare);
  background: rgba(179, 136, 255, 0.16);
}
.rarity-event {
  color: var(--rarity-event);
  background: rgba(255, 183, 77, 0.16);
}
.rarity-mythic {
  color: var(--rarity-mythic);
  background: rgba(255, 110, 110, 0.16);
}

/* Confidence chips */
.conf {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
}
.conf-high {
  color: var(--conf-high);
  background: rgba(76, 175, 80, 0.16);
}
.conf-medium {
  color: var(--conf-medium);
  background: rgba(255, 193, 7, 0.16);
}
.conf-low {
  color: var(--conf-low);
  background: rgba(255, 152, 0, 0.16);
}
.conf-unsafe {
  color: var(--conf-unsafe);
  background: rgba(244, 67, 54, 0.18);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--elevated);
  border: 1px solid var(--hairline);
  color: var(--text);
}
.chip-accent {
  border-color: rgba(107, 230, 117, 0.4);
  color: var(--accent);
}

/* Badge — small count/status indicator. */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  background: var(--accent);
  color: #07120a;
  font-variant-numeric: tabular-nums;
}
.badge-muted {
  background: var(--elevated);
  color: var(--text-muted);
  border: 1px solid var(--hairline);
}
.badge-amber {
  background: rgba(255, 183, 77, 0.18);
  color: var(--amber);
}
.badge-danger {
  background: rgba(244, 67, 54, 0.18);
  color: var(--conf-unsafe);
}
/* Dot badge floated on a corner of a relatively-positioned parent. */
.badge-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 10px;
  box-shadow: 0 0 0 2px var(--bg);
}

/* Appearance colour chips (field-guide detail). A small swatch dot + the colour
   name, built on the shared .chip pill so it inherits the design tokens. */
.color-chip {
  padding-left: 8px;
  font-size: 12px;
}
.color-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex: 0 0 auto;
  border: 1px solid var(--hairline);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}
.appearance-label {
  margin-bottom: var(--sp-1);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  background: var(--elevated);
  border: 1px solid var(--hairline);
  color: var(--text-muted);
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
}

/* ----------------------------------------------------------------------------- */
/* Streak flame — SPEC-2.0 §1 (Daily Challenge / Profile)                        */
/* ----------------------------------------------------------------------------- */
.streak-flame {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px 5px 9px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, rgba(255, 183, 77, 0.2), rgba(255, 110, 110, 0.12));
  border: 1px solid rgba(255, 183, 77, 0.4);
  color: var(--amber);
  font-weight: 800;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.streak-flame .flame {
  width: 18px;
  height: 18px;
  display: inline-flex;
  transform-origin: 50% 80%;
  animation: flicker 1.6s var(--spring) infinite alternate;
}
.streak-flame .flame svg {
  width: 100%;
  height: 100%;
}
.streak-flame.cold {
  color: var(--text-muted);
  background: var(--elevated);
  border-color: var(--hairline);
}
.streak-flame.cold .flame {
  animation: none;
  opacity: 0.55;
}
@keyframes flicker {
  0% {
    transform: scale(1) rotate(-2deg);
  }
  100% {
    transform: scale(1.12) rotate(2deg);
  }
}

/* ----------------------------------------------------------------------------- */
/* Progress ring (SVG) — SPEC-2.0 §1                                             */
/* Structure:                                                                    */
/*   <div class="progress-ring" style="--ring-size:96px">                        */
/*     <svg viewBox="0 0 100 100">                                               */
/*       <circle class="progress-ring-track" cx=50 cy=50 r=44/>                  */
/*       <circle class="progress-ring-fill"  cx=50 cy=50 r=44                    */
/*               style="--ring-circ:276.46; --ring-pct:0.42"/>                   */
/*     </svg>                                                                     */
/*     <div class="progress-ring-label">42%</div>                                */
/*   </div>                                                                      */
/* ----------------------------------------------------------------------------- */
.progress-ring {
  position: relative;
  width: var(--ring-size, 88px);
  height: var(--ring-size, 88px);
  flex: 0 0 var(--ring-size, 88px);
}
.progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.progress-ring-track {
  fill: none;
  stroke: var(--hairline);
  stroke-width: var(--ring-stroke, 9);
}
.progress-ring-fill {
  fill: none;
  stroke: var(--ring-color, var(--accent));
  stroke-width: var(--ring-stroke, 9);
  stroke-linecap: round;
  stroke-dasharray: var(--ring-circ, 276.46);
  stroke-dashoffset: calc(var(--ring-circ, 276.46) * (1 - var(--ring-pct, 0)));
  transition: stroke-dashoffset var(--dur-slow) var(--spring), stroke var(--dur) ease;
}
.progress-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  line-height: 1.05;
}
.progress-ring-label .sub {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ----------------------------------------------------------------------------- */
/* Progress bar — SPEC-2.0 §1                                                    */
/* <div class="progress-bar"><span class="progress-bar-fill" style="--pct:.4">   */
/* ----------------------------------------------------------------------------- */
.progress-bar {
  position: relative;
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--hairline);
  overflow: hidden;
}
.progress-bar.tall {
  height: 12px;
}
.progress-bar-fill {
  display: block;
  height: 100%;
  width: calc(var(--pct, 0) * 100%);
  border-radius: var(--radius-pill);
  background: var(--bar-color, var(--accent));
  transition: width var(--dur-slow) var(--spring), background var(--dur) ease;
}
.progress-bar-fill.done {
  background: var(--conf-high);
}

/* ----------------------------------------------------------------------------- */
/* Countdown timer — SPEC-2.0 §1 (Photo Safari)                                  */
/* A big tabular-numeral clock; pair with a .progress-ring for the visual ring.  */
/* ----------------------------------------------------------------------------- */
.countdown-timer {
  font-family: var(--num);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--text);
}
.countdown-timer.sm {
  font-size: 22px;
}
.countdown-timer.warn {
  color: var(--amber);
}
.countdown-timer.danger {
  color: var(--conf-unsafe);
  animation: tick-pulse 1s var(--spring) infinite;
}
@keyframes tick-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

/* ----------------------------------------------------------------------------- */
/* Banners (safety / status)                                                     */
/* ----------------------------------------------------------------------------- */
.banner-slot {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: calc(var(--safe-top) + var(--sp-2)) var(--sp-4) 0;
  pointer-events: none;
}
.banner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: var(--sp-2);
  animation: bannerIn var(--dur) var(--spring-soft);
}
@keyframes bannerIn {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.banner-warn {
  background: rgba(255, 183, 77, 0.16);
  color: var(--amber);
  border: 1px solid rgba(255, 183, 77, 0.45);
}
.banner-danger {
  background: rgba(244, 67, 54, 0.18);
  color: var(--conf-unsafe);
  border: 1px solid rgba(244, 67, 54, 0.5);
}
.banner-info {
  background: var(--elevated-glass);
  color: var(--text);
  border: 1px solid var(--hairline);
}
.banner-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}
.banner-icon svg {
  width: 100%;
  height: 100%;
}

/* ----------------------------------------------------------------------------- */
/* Safety note (inline disclaimer)                                               */
/* ----------------------------------------------------------------------------- */
.safety-note {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-card);
  background: rgba(107, 230, 117, 0.08);
  border: 1px solid rgba(107, 230, 117, 0.25);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}
.safety-note .icon {
  flex: 0 0 18px;
  color: var(--accent);
}
.safety-note .icon svg {
  width: 18px;
  height: 18px;
}
.disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ----------------------------------------------------------------------------- */
/* Toasts — 2.0 upgrade: icon + title + body (still supports plain text)         */
/* ----------------------------------------------------------------------------- */
.toast-host {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-4));
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  pointer-events: none;
  padding: 0 var(--sp-5);
}
.toast {
  pointer-events: auto;
  max-width: 100%;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  background: var(--elevated-glass);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  animation: toastIn var(--dur) var(--spring-soft);
}
.toast-error {
  border-color: rgba(244, 67, 54, 0.5);
  color: var(--conf-unsafe);
}
.toast-success {
  border-color: rgba(107, 230, 117, 0.4);
  color: var(--accent);
}
.toast-warn {
  border-color: rgba(255, 183, 77, 0.45);
  color: var(--amber);
}
/* Rich layout: a toast with an icon + title + body uses a flex grid + a pill
   radius relax to a card radius so two lines read cleanly. */
.toast.toast-rich {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  text-align: left;
  border-radius: var(--radius-card);
  padding: var(--sp-3) var(--sp-4);
  max-width: 92%;
}
.toast-rich .toast-ic {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  color: var(--accent);
}
.toast-rich.toast-error .toast-ic {
  color: var(--conf-unsafe);
}
.toast-rich.toast-warn .toast-ic {
  color: var(--amber);
}
.toast-rich .toast-ic svg {
  width: 100%;
  height: 100%;
}
.toast-rich .toast-body {
  min-width: 0;
}
.toast-rich .toast-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.toast-rich .toast-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ----------------------------------------------------------------------------- */
/* Bottom sheets (slide up over a screen) — 2.0 drag handle + snap               */
/* ----------------------------------------------------------------------------- */
.sheet-host {
  position: absolute;
  inset: 0;
  z-index: 70;
}
.sheet-host[hidden] {
  display: none;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--dur) ease;
}
.sheet-host.open .sheet-backdrop {
  opacity: 1;
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border-top-left-radius: var(--radius-sheet);
  border-top-right-radius: var(--radius-sheet);
  border-top: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow-float);
  padding: var(--sp-2) var(--sp-5) calc(var(--safe-bottom) + var(--sp-6));
  transform: translateY(100%);
  transition: transform var(--dur) var(--spring);
}
.sheet-host.open .sheet {
  transform: translateY(0);
}
/* While the user drags, the JS sets a translateY inline and disables transition. */
.sheet-host.dragging .sheet {
  transition: none;
}
/* The grabber row stays pinned + frosted so long sheets keep an obvious handle. */
.sheet-grabber {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--hairline-strong);
  margin: var(--sp-2) auto var(--sp-3);
  flex: 0 0 auto;
  cursor: grab;
  touch-action: none;
}
.sheet-grabber:active {
  cursor: grabbing;
}
/* Optional sticky frosted handle wrapper for tall sheets (drag affordance). */
.sheet-handle {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 calc(-1 * var(--sp-5)) var(--sp-2);
  padding-top: var(--sp-2);
  background: linear-gradient(180deg, var(--surface) 70%, transparent);
}
.sheet-handle .sheet-grabber {
  margin-bottom: var(--sp-2);
}

/* ----------------------------------------------------------------------------- */
/* Map screen                                                                    */
/* ----------------------------------------------------------------------------- */
.map-root {
  position: absolute;
  inset: 0;
}
#map {
  position: absolute;
  inset: 0;
  background: var(--bg);
}
/* MapLibre attribution dark tweak */
.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib a {
  background: rgba(11, 15, 12, 0.6) !important;
  color: var(--text-muted) !important;
  font-size: 10px;
}
.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom)) !important;
}

/* Player dot */
.player-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 6px rgba(107, 230, 117, 0.25), 0 0 18px rgba(107, 230, 117, 0.6);
  position: relative;
}
.player-dot::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: rgba(107, 230, 117, 0.18);
  animation: pulse 2.4s var(--spring) infinite;
}
@keyframes pulse {
  0% {
    transform: scale(0.6);
    opacity: 0.7;
  }
  100% {
    transform: scale(2.2);
    opacity: 0;
  }
}

/* Spawn markers (stylised spider glyphs) */
.spawn-marker {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--spring-soft);
  will-change: transform;
}
.spawn-marker:active {
  transform: scale(0.86);
}
.spawn-marker .glyph-wrap {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 2px solid currentColor;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 14px currentColor;
}
.spawn-marker .glyph-wrap svg {
  width: 26px;
  height: 26px;
}
.spawn-marker.bob {
  animation: bob 3.4s ease-in-out infinite;
}
/* Bounty-targeted spawn gets an extra ring pulse to read as "counts toward". */
.spawn-marker.targeted .glyph-wrap {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(107, 230, 117, 0.5),
    0 0 18px currentColor;
}
@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

/* GPS accuracy chip in header */
.gps-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: var(--elevated);
  border: 1px solid var(--hairline);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.gps-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--conf-low);
}
.gps-chip.good .dot {
  background: var(--conf-high);
}
.gps-chip.poor .dot {
  background: var(--conf-low);
}
.gps-chip.demo .dot {
  background: var(--rarity-uncommon);
}

/* recenter / refresh floating buttons */
.map-fab {
  position: absolute;
  right: var(--sp-4);
  z-index: 20;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--elevated-glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid var(--hairline-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  color: var(--text);
  transition: transform var(--dur-fast) var(--spring);
}
.map-fab:active {
  transform: scale(0.92);
}
.map-fab svg {
  width: 22px;
  height: 22px;
}
.map-fab.recenter {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-6) + 56px);
}
.map-fab.refresh {
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + var(--sp-6));
}
.map-fab.spinning svg {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Map overlay rail (mode switcher + daily card) sits below the header, above map. */
.map-overlay {
  position: absolute;
  top: calc(var(--safe-top) + var(--header-h) + var(--sp-2));
  left: var(--sp-4);
  right: var(--sp-4);
  z-index: 18;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}
.map-overlay > * {
  pointer-events: auto;
}

/* Collapsible Daily Challenge card on the map. */
.daily-card {
  border-radius: var(--radius-card);
  background: var(--elevated-glass);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border: 1px solid var(--hairline-strong);
  box-shadow: var(--shadow);
  padding: var(--sp-3) var(--sp-4);
}
.daily-card-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 36px;
}
.daily-card-body {
  margin-top: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  overflow: hidden;
  transition: max-height var(--dur) var(--spring), opacity var(--dur) ease,
    margin-top var(--dur) var(--spring);
}
.daily-card.collapsed .daily-card-body {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
  pointer-events: none;
}
.daily-card .chev {
  width: 20px;
  height: 20px;
  color: var(--text-muted);
  transition: transform var(--dur) var(--spring);
}
.daily-card.collapsed .chev {
  transform: rotate(-90deg);
}

/* A single daily mission row. */
.mission {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.mission-check {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--hairline-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: background var(--dur) ease, border-color var(--dur) ease, color var(--dur) ease;
}
.mission.done .mission-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #07120a;
}
.mission-check svg {
  width: 16px;
  height: 16px;
}
.mission-body {
  flex: 1;
  min-width: 0;
}
.mission-title {
  font-size: 14px;
  font-weight: 600;
}
.mission.done .mission-title {
  color: var(--text-muted);
}
.mission-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* ----------------------------------------------------------------------------- */
/* Encounter sheet                                                               */
/* ----------------------------------------------------------------------------- */
.encounter-hero {
  position: relative;
  height: 180px;
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-bottom: var(--sp-4);
}
.encounter-hero svg {
  width: 110px;
  height: 110px;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5));
  animation: float 3.2s var(--spring) infinite alternate;
}
.hero-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(70% 80% at 50% 40%, currentColor 0%, transparent 70%);
  opacity: 0.22;
}
.mystery-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.mystery-sci {
  font-style: italic;
  color: var(--text-muted);
  font-size: 14px;
}

/* ----------------------------------------------------------------------------- */
/* Camera + Camera HUD 2.0 (SPEC-2.0 §3)                                         */
/* ----------------------------------------------------------------------------- */
.camera-root {
  position: absolute;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
}
.camera-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background: #000;
}
.camera-video,
.camera-canvas,
.camera-shot {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.camera-shot {
  object-fit: contain;
  background: #000;
}
/* Legacy dashed frame (kept for back-compat; superseded by .camera-ring). */
.camera-frameguide {
  position: absolute;
  inset: 14% 12%;
  border: 2px dashed rgba(232, 240, 234, 0.4);
  border-radius: 22px;
  pointer-events: none;
}
.camera-frameguide::after {
  content: 'Center the spider';
  position: absolute;
  left: 50%;
  bottom: -28px;
  transform: translateX(-50%);
  font-size: 12px;
  color: rgba(232, 240, 234, 0.7);
  white-space: nowrap;
}

/* HUD overlay layer (rings + hints) — non-interactive, sits over the preview. */
.camera-hud {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

/* Framing ring (rounded-square reticle) with quality states. The ring color is
   driven by a state class set by the camera quality sampler ~2x/sec. */
.camera-ring {
  position: absolute;
  inset: 16% 13%;
  border-radius: 28px;
  border: 3px solid var(--q-bad);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.34);
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease, transform var(--dur) var(--spring);
  animation: ring-pulse 2.4s var(--spring) infinite;
}
.camera-ring.q-bad {
  border-color: var(--q-bad);
}
.camera-ring.q-ok {
  border-color: var(--q-ok);
}
.camera-ring.q-good {
  border-color: var(--q-good);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.34), 0 0 26px rgba(107, 230, 117, 0.5);
}
/* Corner ticks for a "reticle" read. */
.camera-ring::before,
.camera-ring::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: inherit;
  border-style: solid;
  border-width: 0;
}
.camera-ring::before {
  top: -3px;
  left: -3px;
  border-top-width: 3px;
  border-left-width: 3px;
  border-top-left-radius: 28px;
}
.camera-ring::after {
  bottom: -3px;
  right: -3px;
  border-bottom-width: 3px;
  border-right-width: 3px;
  border-bottom-right-radius: 28px;
}
@keyframes ring-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.012);
    opacity: 0.92;
  }
}

/* Live hint pill — dynamic guidance copy under the ring. */
.camera-hint {
  position: absolute;
  left: 50%;
  bottom: 16%;
  transform: translate(-50%, 28px);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 84%;
  padding: 9px 15px;
  border-radius: var(--radius-pill);
  background: rgba(11, 15, 12, 0.66);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--hairline-strong);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  transition: color var(--dur) ease, border-color var(--dur) ease;
}
.camera-hint .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--q-bad);
  flex: 0 0 8px;
  transition: background var(--dur) ease;
}
.camera-hint.q-ok .dot {
  background: var(--q-ok);
}
.camera-hint.q-good .dot {
  background: var(--q-good);
}
.camera-hint.q-good {
  color: var(--q-good);
  border-color: rgba(107, 230, 117, 0.45);
}

.camera-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + var(--sp-3)) var(--sp-4) var(--sp-3);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.6), transparent);
}
.camera-safety {
  position: absolute;
  left: var(--sp-4);
  right: var(--sp-4);
  bottom: var(--sp-3);
  text-align: center;
  font-size: 12px;
  color: rgba(232, 240, 234, 0.85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}
.camera-controls {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: var(--sp-4) var(--sp-5) calc(var(--safe-bottom) + var(--sp-5));
  background: #000;
}
.shutter {
  position: relative;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background: #fff;
  border: 4px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
  transition: transform var(--dur-fast) var(--spring), box-shadow var(--dur) ease;
}
.shutter:active {
  transform: scale(0.9);
}
.shutter[disabled] {
  opacity: 0.4;
}
/* When quality is poor, the shutter glows red to nudge (still tappable). */
.shutter.q-bad {
  box-shadow: 0 0 0 4px rgba(244, 67, 54, 0.25), 0 0 18px rgba(244, 67, 54, 0.4);
}
.shutter.q-good {
  box-shadow: 0 0 0 4px rgba(107, 230, 117, 0.3), 0 0 22px rgba(107, 230, 117, 0.5);
}
.camera-aux {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background var(--dur-fast) ease, transform var(--dur-fast) var(--spring);
}
.camera-aux:active {
  transform: scale(0.9);
}
.camera-aux.on {
  background: var(--accent);
  color: #07120a;
}
.camera-aux svg {
  width: 24px;
  height: 24px;
}
.camera-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--sp-4);
  padding: var(--sp-6);
  color: var(--text);
}
.camera-fallback .fb-mark {
  width: 64px;
  height: 64px;
  color: var(--accent);
  opacity: 0.85;
}

/* Capture flash + "Got it!" confirmation overlay. */
.camera-flash {
  position: absolute;
  inset: 0;
  z-index: 9;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}
.camera-flash.fire {
  animation: flash 0.32s ease-out;
}
@keyframes flash {
  0% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
  }
}
.captured-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  z-index: 7;
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: rgba(11, 15, 12, 0.7);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--hairline-strong);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  animation: popIn var(--dur-slow) var(--spring-soft);
}

/* Uploading / analyzing overlay (spider-themed loader + rotating copy). */
.upload-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--text);
}
.analyzing-mark {
  width: 96px;
  height: 96px;
  color: var(--accent);
}
.analyzing-mark svg {
  width: 100%;
  height: 100%;
  animation: crawl 1.6s var(--spring) infinite alternate;
}
@keyframes crawl {
  0% {
    transform: translateY(0) rotate(-4deg);
  }
  100% {
    transform: translateY(-8px) rotate(4deg);
  }
}
.analyzing-copy {
  font-size: 15px;
  font-weight: 600;
  min-height: 1.4em;
  text-align: center;
  transition: opacity var(--dur) ease;
}
/* Crawling-dot loader (alternative to the glyph). */
.crawl-loader {
  display: flex;
  gap: 8px;
}
.crawl-loader span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  animation: crawl-dot 1s var(--spring) infinite;
}
.crawl-loader span:nth-child(2) {
  animation-delay: 0.15s;
}
.crawl-loader span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes crawl-dot {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }
  50% {
    transform: translateY(-9px);
    opacity: 1;
  }
}

/* ----------------------------------------------------------------------------- */
/* Score bars (recognition result)                                              */
/* ----------------------------------------------------------------------------- */
.score-row {
  display: grid;
  grid-template-columns: 56px 1fr 38px;
  align-items: center;
  gap: var(--sp-2);
  font-size: 12px;
  color: var(--text-muted);
}
.score-row + .score-row {
  margin-top: 6px;
}
.score-track {
  height: 7px;
  border-radius: 4px;
  background: var(--hairline);
  overflow: hidden;
}
.score-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  width: 0;
  transition: width var(--dur-slow) var(--spring);
}
.score-fill.geo {
  background: var(--rarity-uncommon);
}
.score-fill.season {
  background: var(--amber);
}
.score-fill.habitat {
  background: var(--rarity-rare);
}

/* Candidate card */
.candidate {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: var(--sp-4);
  background: var(--surface);
}
.candidate.top {
  border-color: rgba(107, 230, 117, 0.45);
  background: linear-gradient(180deg, rgba(107, 230, 117, 0.06), var(--surface));
}
.candidate-head {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
}
.candidate-glyph {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 52px;
}
.candidate-glyph svg {
  width: 34px;
  height: 34px;
}

/* Result hero header (2.0) — confidence-keyed band over a glow. */
.result-hero {
  position: relative;
  border-radius: var(--radius-card);
  padding: var(--sp-6) var(--sp-5);
  overflow: hidden;
  border: 1px solid var(--hairline);
  background: var(--surface);
  text-align: center;
}
.result-hero.band-high {
  background: var(--hero-gradient);
  border-color: rgba(76, 175, 80, 0.45);
}
.result-hero.band-medium {
  border-color: rgba(255, 193, 7, 0.4);
}
.result-hero.band-low {
  border-color: rgba(255, 152, 0, 0.4);
}
.result-hero.band-unsafe {
  border-color: rgba(244, 67, 54, 0.5);
  background: linear-gradient(150deg, rgba(244, 67, 54, 0.12), var(--surface));
}
.result-hero .hero-art {
  width: 96px;
  height: 96px;
  margin: 0 auto var(--sp-3);
}
.result-hero .hero-art svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.5));
}
.result-hero .hero-headline {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: var(--lh-snug);
}
.result-hero .hero-sci {
  font-style: italic;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* XP / level-up */
.xp-burst {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-5);
  border-radius: var(--radius-card);
  background: var(--hero-gradient);
  border: 1px solid rgba(107, 230, 117, 0.4);
  text-align: center;
  animation: popIn var(--dur-slow) var(--spring-soft);
  position: relative;
  overflow: hidden;
}
@keyframes popIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.xp-amount {
  font-size: 34px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.02em;
}
.levelup-badge {
  font-size: 13px;
  font-weight: 700;
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
/* Celebration burst sparkles for new-species moments. */
.celebrate {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.celebrate i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  animation: spark 900ms var(--spring) forwards;
}
@keyframes spark {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.4);
  }
  100% {
    opacity: 0;
    transform: translate(var(--dx, 0), var(--dy, -60px)) scale(1);
  }
}

/* ----------------------------------------------------------------------------- */
/* Field guide grid                                                              */
/* ----------------------------------------------------------------------------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--elevated);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-pill);
  padding: 0 var(--sp-4);
  height: 44px;
  margin-bottom: var(--sp-3);
}
.search-bar input {
  flex: 1;
  background: none;
  border: 0;
  outline: none;
  font-size: 16px;
  color: var(--text);
}
.search-bar input::placeholder {
  color: var(--text-muted);
}
.search-bar svg {
  width: 18px;
  height: 18px;
  color: var(--text-muted);
}
.filter-row {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--sp-2);
  margin-bottom: var(--sp-2);
  scrollbar-width: none;
}
.filter-row::-webkit-scrollbar {
  display: none;
}
.filter-chip {
  flex: 0 0 auto;
  /* >=44px tap target (SPEC §6) via min-height; padding/visual size unchanged. */
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 600;
  background: var(--elevated);
  border: 1px solid var(--hairline);
  color: var(--text-muted);
  transition: all var(--dur-fast) ease;
}
.filter-chip[aria-pressed='true'] {
  background: var(--accent);
  color: #07120a;
  border-color: var(--accent);
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
.guide-cell {
  position: relative;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  transition: transform var(--dur-fast) var(--spring);
  overflow: hidden;
}
.guide-cell:active {
  transform: scale(0.97);
}
.guide-cell .cell-art {
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.guide-cell .cell-art svg {
  width: 64px;
  height: 64px;
}
.guide-cell.locked .cell-art svg {
  filter: brightness(0) saturate(0) opacity(0.35);
}
.guide-cell.locked .cell-name {
  color: var(--text-muted);
}
.cell-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.cell-sci {
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
}
.lock-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}
.seen-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(107, 230, 117, 0.14);
  padding: 3px 7px;
  border-radius: var(--radius-pill);
}

/* Guide detail */
.guide-hero {
  height: 200px;
  border-radius: var(--radius-card);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: var(--sp-4);
}
.guide-hero svg {
  width: 130px;
  height: 130px;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.5));
}
.photo-gallery {
  display: flex;
  gap: var(--sp-3);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--sp-2);
}
.photo-gallery::-webkit-scrollbar {
  display: none;
}
.photo-card {
  flex: 0 0 220px;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--elevated);
  border: 1px solid var(--hairline);
}
.photo-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  background: var(--surface);
}
.photo-card .attrib {
  padding: var(--sp-2) var(--sp-3);
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}
.photo-placeholder {
  width: 100%;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
  padding: var(--sp-3);
}
.linkout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

/* ----------------------------------------------------------------------------- */
/* Profile                                                                       */
/* ----------------------------------------------------------------------------- */
.xp-ring-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}
.xp-ring {
  position: relative;
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
}
.xp-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.xp-ring .track {
  fill: none;
  stroke: var(--hairline);
  stroke-width: 9;
}
.xp-ring .prog {
  fill: none;
  stroke: var(--accent);
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset var(--dur-slow) var(--spring);
}
.xp-ring .level {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.xp-ring .level .num {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}
.xp-ring .level .lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}
.stat {
  text-align: center;
  padding: var(--sp-3);
  border-radius: var(--radius-card);
  background: var(--elevated);
  border: 1px solid var(--hairline);
}
.stat .v {
  font-size: 22px;
  font-weight: 800;
}
.stat .k {
  font-size: 11px;
  color: var(--text-muted);
}
.rarity-bar {
  display: flex;
  height: 12px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--hairline);
}
.rarity-bar span {
  height: 100%;
}
.rarity-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  margin-top: var(--sp-3);
}
.rarity-legend .lg {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.rarity-legend .sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Toggle (iOS switch) */
.toggle {
  position: relative;
  width: 52px;
  height: 31px;
  flex: 0 0 52px;
  border-radius: var(--radius-pill);
  background: var(--hairline);
  transition: background var(--dur-fast) ease;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  transition: transform var(--dur-fast) var(--spring);
}
.toggle[aria-checked='true'] {
  background: var(--accent);
}
.toggle[aria-checked='true']::after {
  transform: translateX(21px);
}
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) 0;
  border-bottom: 1px solid var(--hairline);
}
.list-row:last-child {
  border-bottom: 0;
}
.list-row .lr-title {
  font-size: 15px;
  font-weight: 600;
}
.list-row .lr-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}
.lb-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--hairline);
}
.lb-row:last-child {
  border-bottom: 0;
}
.lb-rank {
  width: 26px;
  font-weight: 800;
  color: var(--text-muted);
  text-align: center;
}
.lb-row.me {
  color: var(--accent);
}

/* ----------------------------------------------------------------------------- */
/* Modes screen / Safari / Bounty (2.0 game modes)                               */
/* ----------------------------------------------------------------------------- */
/* Hero panel used for the Daily-complete and Safari-end celebrations. */
.mode-hero {
  position: relative;
  border-radius: var(--radius-card);
  padding: var(--sp-6) var(--sp-5);
  text-align: center;
  overflow: hidden;
  background: var(--hero-gradient);
  border: 1px solid rgba(107, 230, 117, 0.4);
  box-shadow: var(--shadow);
}
.mode-hero .mode-hero-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.mode-hero .mode-hero-sub {
  color: var(--text-muted);
  margin-top: var(--sp-2);
}

/* Safari live panel: a big ring + countdown. */
.safari-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-6) var(--sp-5);
  border-radius: var(--radius-card);
  background: var(--elevated);
  border: 1px solid var(--hairline-strong);
}
.safari-clock {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Safari catch list (distinct taxa caught this session). */
.catch-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.catch-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--hairline);
}
.catch-row .catch-glyph {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex: 0 0 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--elevated);
}
.catch-row .catch-glyph svg {
  width: 26px;
  height: 26px;
}

/* Bounty: family picker grid + member rows. */
.bounty-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}
.bounty-cell {
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--hairline);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: transform var(--dur-fast) var(--spring), border-color var(--dur-fast) ease;
}
.bounty-cell:active {
  transform: scale(0.97);
}
.bounty-cell.complete {
  border-color: rgba(107, 230, 117, 0.45);
}
.bounty-member {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--hairline);
}
.bounty-member:last-child {
  border-bottom: 0;
}
.bounty-member .bm-glyph {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--elevated);
}
.bounty-member .bm-glyph svg {
  width: 24px;
  height: 24px;
}
.bounty-member.collected .bm-glyph {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.bounty-member.locked .bm-glyph svg {
  filter: brightness(0) saturate(0) opacity(0.4);
}

/* "Counts toward {family}" tag in the encounter sheet (bounty mode). */
.counts-toward {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(107, 230, 117, 0.14);
  color: var(--accent);
  border: 1px solid rgba(107, 230, 117, 0.4);
  font-size: 12px;
  font-weight: 700;
}
.counts-toward svg {
  width: 13px;
  height: 13px;
}

/* ----------------------------------------------------------------------------- */
/* Onboarding                                                                    */
/* ----------------------------------------------------------------------------- */
.onboard {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + var(--sp-6)) var(--sp-5) calc(var(--safe-bottom) + var(--sp-5));
  background: radial-gradient(130% 70% at 50% 0%, #16201a 0%, var(--bg) 60%);
}
.onboard-brand {
  text-align: center;
  margin-bottom: var(--sp-5);
}
.onboard-brand .mark {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--sp-2);
}
.onboard-brand h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.onboard-brand p {
  color: var(--accent);
  font-size: 14px;
  margin-top: 4px;
}
.onboard-cards {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--sp-3);
}
.safety-card {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-5);
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--hairline);
  animation: screenIn var(--dur) var(--spring) backwards;
}
.safety-card:nth-child(1) {
  animation-delay: 40ms;
}
.safety-card:nth-child(2) {
  animation-delay: 120ms;
}
.safety-card:nth-child(3) {
  animation-delay: 200ms;
}
.safety-card .sc-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(107, 230, 117, 0.12);
  color: var(--accent);
}
.safety-card .sc-icon svg {
  width: 24px;
  height: 24px;
}
.safety-card h3 {
  font-size: 17px;
  font-weight: 700;
}
.safety-card p {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.45;
}
.onboard-foot {
  margin-top: var(--sp-5);
}

/* ----------------------------------------------------------------------------- */
/* Empty / skeleton states                                                       */
/* ----------------------------------------------------------------------------- */
.empty {
  text-align: center;
  padding: var(--sp-8) var(--sp-5);
  color: var(--text-muted);
}
.empty .em-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto var(--sp-3);
  opacity: 0.5;
}
.empty .em-mark svg {
  width: 100%;
  height: 100%;
}
.empty h3 {
  color: var(--text);
  font-size: 18px;
  margin-bottom: var(--sp-2);
}
.empty p {
  line-height: var(--lh-body);
}
.empty .empty-cta {
  margin-top: var(--sp-4);
}

/* Skeleton shimmer (loading placeholder). */
.skeleton {
  background: linear-gradient(
    100deg,
    var(--surface) 30%,
    var(--elevated) 50%,
    var(--surface) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: var(--radius-card);
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
.skel-line {
  height: 14px;
  border-radius: 7px;
  margin-bottom: 8px;
}
.skel-line.short {
  width: 55%;
}
.skel-line.long {
  width: 90%;
}
.skel-cell {
  height: 150px;
}
.skel-pill {
  height: 34px;
  width: 96px;
  border-radius: var(--radius-pill);
}
.skel-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
}

/* ----------------------------------------------------------------------------- */
/* Misc utilities                                                                */
/* ----------------------------------------------------------------------------- */
.hidden {
  display: none !important;
}
.center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--hairline);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
.divider {
  height: 1px;
  background: var(--hairline);
  margin: var(--sp-4) 0;
}
.kv {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  font-size: 14px;
}
.kv .k {
  color: var(--text-muted);
}
.kv .v {
  text-align: right;
  font-weight: 600;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ----------------------------------------------------------------------------- */
/* Reduced motion — extend the §1 contract to ALL new 2.0 animations.            */
/* ----------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
  /* Kill the continuous/looping ambient motions outright so nothing pulses. */
  .splash-mark,
  .player-dot::after,
  .spawn-marker.bob,
  .encounter-hero svg,
  .streak-flame .flame,
  .camera-ring,
  .countdown-timer.danger,
  .analyzing-mark svg,
  .crawl-loader span,
  .map-fab.spinning svg,
  .spinner {
    animation: none !important;
  }
  /* Progress fills still update, just without the spring sweep. */
  .progress-ring-fill,
  .progress-bar-fill,
  .score-fill,
  .xp-ring .prog,
  .segmented-thumb {
    transition: none !important;
  }
}
