/* First morning (js/onboard.js) and ring cards (js/cards.js). Rarity colors from design/colors/tokens.json
   (rarity.*); the Legendary foil is the Daybreak opal. Gold (#FFD27A) stays for buttons and the alert. */
:root {
  --tier-common: #8E97AD; --tier-uncommon: #7C8FD6; --tier-rare: #E88AB0; --tier-epic: #9B6BFF;
  --tier-legendary: linear-gradient(135deg, #FFF1E4 0%, #FFC6A8 35%, #F49AC1 65%, #B6A8FF 100%);
}

/* ---------- 1. the alert: a push notification sliding down over the map ---------- */
.ob-alert {
  position: absolute; z-index: 30; left: 50%; top: 10px; width: min(440px, calc(100% - 20px));
  transform: translate(-50%, -140%); transition: transform .45s cubic-bezier(.2,.9,.2,1.1);
  display: flex; flex-direction: column; gap: 4px;
}
.ob-alert.in { transform: translate(-50%, 0); }
.ob-alert-main {
  display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: start; text-align: left; width: 100%;
  padding: 14px 16px; border-radius: 20px; border: 1.5px solid var(--accent); cursor: pointer; color: var(--text);
  background: rgba(20,27,45,.97); box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 0 6px rgba(255,210,122,.12);
  font: 15px/1.35 var(--ui); animation: ob-nudge 2.4s ease-in-out 1.2s infinite;
}
@keyframes ob-nudge { 0%, 100% { box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 0 6px rgba(255,210,122,.12); } 50% { box-shadow: 0 18px 50px rgba(0,0,0,.6), 0 0 0 12px rgba(255,210,122,.05); } }
.ob-alert-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--bg); padding: 6px; }
.ob-alert-text { display: flex; flex-direction: column; gap: 2px; }
.ob-alert-meta { font: 600 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); }
.ob-alert-text b { font: 800 18px/1.15 var(--display); }
.ob-alert-text small { color: var(--text-muted); font-size: 12px; margin-top: 2px; }
.ob-alert-later { align-self: flex-end; border: 0; background: rgba(10,14,20,.7); color: var(--text-muted); font: 700 13px var(--ui); padding: 8px 12px; border-radius: 10px; cursor: pointer; }

/* ---------- 2. the replay panel and the ring growing on the map ---------- */
.ob-watch {
  position: absolute; z-index: 25; left: 12px; top: 64px; width: 380px; max-width: calc(100% - 24px);
  background: rgba(20,27,45,.97); border: 1px solid var(--border-strong); border-radius: 18px; padding: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(12px); transition: opacity .35s, transform .35s;
}
.ob-watch.in { opacity: 1; transform: none; }
.ob-watch-head { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-muted); margin: 0 2px 8px; }
.ob-live { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font: 800 11px var(--ui); letter-spacing: .06em; text-transform: uppercase; }
.ob-live i { width: 7px; height: 7px; border-radius: 50%; background: #E8743B; animation: pulse-dot 1s infinite alternate; }
@keyframes pulse-dot { to { opacity: .3; } }
.ob-clock { margin-left: auto; font: 600 15px var(--mono); color: var(--text); }
.ob-video { border-radius: 12px; overflow: hidden; aspect-ratio: 1; background: var(--map-basemap); }
.ob-video video { width: 100%; height: 100%; display: block; object-fit: cover; }
.ob-beat { margin: 10px 4px 2px; font-weight: 700; font-size: 15px; min-height: 2.7em; }
.ob-watch.confirmed .ob-beat { color: var(--live-fill); }
.ob-ring { position: relative; width: 0; height: 0; transition: opacity .3s; }
.ob-ring i { position: absolute; left: 50%; top: 50%; width: var(--d, 6px); height: var(--d, 6px); transform: translate(-50%, -50%); border-radius: 50%;
  border: 3px solid var(--live-fill); background: rgba(4,233,231,.12); box-shadow: 0 0 24px rgba(4,233,231,.5), inset 0 0 18px rgba(4,233,231,.35); }
.ob-ring.settled i { animation: ob-settle 2.4s ease-out 2; }
@keyframes ob-settle { 50% { box-shadow: 0 0 40px rgba(4,233,231,.8), inset 0 0 24px rgba(4,233,231,.5); } }
@media (max-width: 760px) {
  .ob-watch { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; display: grid; grid-template-columns: 132px 1fr; gap: 0 10px; align-items: center; }
  .ob-watch-head { grid-column: 1 / -1; }
  .ob-beat { margin: 0; font-size: 14px; }
}

/* ---------- ring cards ---------- */
.rc { --frame: var(--tier-common); position: relative; width: 300px; max-width: 78vw; aspect-ratio: 63 / 88; border-radius: 18px; padding: 6px; background: var(--frame); color: #0A0E14;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.rc-uncommon { --frame: var(--tier-uncommon); }
.rc-rare { --frame: var(--tier-rare); }
.rc-epic { --frame: var(--tier-epic); }
.rc-legendary { --frame: var(--tier-legendary); }
.rc-inner { position: relative; height: 100%; border-radius: 13px; background: #0F1524; color: var(--text); padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.rc-legendary .rc-inner::after { content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; opacity: .35;
  background: linear-gradient(115deg, transparent 30%, rgba(255,198,168,.6) 45%, rgba(244,154,193,.55) 52%, rgba(182,168,255,.5) 58%, transparent 72%);
  background-size: 250% 100%; animation: rc-shine 3.2s ease-in-out infinite; }
@keyframes rc-shine { 0% { background-position: 120% 0; } 100% { background-position: -120% 0; } }
.rc-top { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rc-top b { font: 800 14px var(--display); letter-spacing: .04em; text-transform: uppercase; }
.rc-legendary .rc-top b { background: var(--tier-legendary); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rc-set { margin-left: auto; font: 600 11px var(--mono); color: var(--text-muted); }
.rc-glyph svg { width: 22px; height: 22px; display: block; fill: none; stroke: #FFC6A8; stroke-width: 1.4; }
.rc-art { margin: 0; position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--map-basemap); }
.rc-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.rc-art figcaption { position: absolute; left: 6px; bottom: 6px; font: 600 10px var(--mono); padding: 2px 6px; border-radius: 6px; background: rgba(10,14,20,.75); color: var(--text-muted); }
.rc-name { margin: 2px 0 0; font: 800 20px/1.1 var(--display); }
.rc-place { margin: 0; font-size: 12px; color: var(--text-muted); }
.rc-stats { margin: 4px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; }
.rc-stats div { display: flex; flex-direction: column; }
.rc-stats dt { font: 600 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.rc-stats dd { margin: 0; font: 600 14px var(--mono); }
.rc-stats small { color: var(--text-muted); font-size: 11px; }
.rc-foot { margin-top: auto; display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.rc-chip { padding: 2px 8px; border-radius: 999px; border: 1px solid #FFC6A8; color: #FFC6A8; font-weight: 700; white-space: nowrap; }
.rc-mini { width: 132px; max-width: none; border-radius: 12px; padding: 4px; box-shadow: none; }
.rc-mini .rc-inner { border-radius: 9px; padding: 6px; gap: 4px; }
.rc-mini .rc-top { font-size: 10px; } .rc-mini .rc-top b { font-size: 10px; } .rc-mini .rc-set { display: none; }
.rc-mini .rc-glyph svg { width: 14px; height: 14px; }
.rc-mini .rc-name { font-size: 13px; } .rc-mini .rc-place { font-size: 10px; }
.rc-mini .rc-art figcaption { display: none; }

/* ---------- the reveal ---------- */
.rv { position: fixed; inset: 0; z-index: 1100; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: 16px; padding: 20px; overflow-y: auto;
  background: radial-gradient(60% 50% at 50% 45%, rgba(107,78,155,.45), rgba(5,8,13,.94) 70%); opacity: 0; transition: opacity .3s; perspective: 1200px; }
.rv.in { opacity: 1; } .rv.out { opacity: 0; }
.rv-kicker { margin: 0; font: 800 14px var(--ui); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.rv-flip { position: relative; transform-style: preserve-3d; transform: rotateY(180deg) scale(.6); transition: transform .9s cubic-bezier(.2,.8,.2,1.05); }
.rv.in .rv-flip { transform: rotateY(180deg) scale(.95); }
.rv.flipped .rv-flip { transform: rotateY(0) scale(1); }
.rv-flip > .rc { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.rc-back { position: absolute; inset: 0; border-radius: 18px; transform: rotateY(180deg); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font: 800 18px var(--display); color: var(--text);
  background: radial-gradient(130% 160% at 100% 0%, #F2A65A 0%, #E8743B 18%, #6B4E9B 42%, #2B2F6B 62%, #141B2D 82%, #0A0E14 100%); border: 6px solid #1E2740; }
.rc-back img { width: 96px; height: 96px; }
.rv-burst { position: absolute; left: 50%; top: 46%; width: 0; height: 0; pointer-events: none; }
.rv-burst i { position: absolute; left: 50%; top: 50%; width: 80px; height: 80px; margin: -40px 0 0 -40px; border-radius: 50%; border: 3px solid #FFC6A8; opacity: 0; }
.rv.flipped .rv-burst i { animation: rv-burst 1.6s cubic-bezier(.2,.7,.2,1) forwards; }
.rv.flipped .rv-burst i:nth-child(2) { animation-delay: .18s; border-color: #F49AC1; }
.rv.flipped .rv-burst i:nth-child(3) { animation-delay: .36s; border-color: #B6A8FF; }
@keyframes rv-burst { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(7); opacity: 0; } }
.rv-actions { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 52px; opacity: 0; transition: opacity .3s .5s; }
.rv.flipped .rv-actions { opacity: 1; }
.rv-alt { border: 0; background: none; color: var(--text-muted); font: 700 14px var(--ui); padding: 8px; cursor: pointer; text-decoration: underline; }
.rv.still .rv-flip, .rv.still .rv-actions, .rv.still { transition: none; }
.rv.still .rv-burst { display: none; }

/* ---------- My cards panel ---------- */
.tab-n:not(:empty) { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--on-accent); font-size: 11px; }
.cards-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.card-slot { padding: 0; border: 0; background: none; cursor: pointer; border-radius: 12px; }
.card-slot:hover .rc { transform: translateY(-2px); }
.card-slot .rc { transition: transform .2s; }

/* ---------- 4. labels ---------- */
.lb-shade { position: fixed; inset: 0; z-index: 1050; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5,8,13,.8); opacity: 0; transition: opacity .25s; }
.lb-shade.in { opacity: 1; }
.lb { position: relative; width: min(420px, 100%); max-height: 100%; overflow-y: auto; padding: 16px; border-radius: 20px; background: var(--surface-raised); border: 1px solid var(--border-strong); box-shadow: 0 24px 60px rgba(0,0,0,.6); }
.lb-title { margin: 0 0 6px; font: 800 26px/1.1 var(--display); }
.lb-help { margin: 0 0 10px; font-size: 14px; color: var(--text-muted); }
.lb-help b { color: var(--text); }
.lb-count { margin: 0 0 6px; font-size: 12px; color: var(--accent-text); }
.lb-art { display: flex; justify-content: center; }
.lb-art .thumb-lg { width: 100%; max-width: 300px; }
.lb-meta { margin: 6px 0 12px; text-align: center; font-size: 12px; color: var(--text-muted); }
.lb-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.lb-btn { min-height: 52px; border-radius: 14px; font: 700 15px var(--ui); cursor: pointer; border: 1.5px solid var(--border-strong); background: transparent; color: var(--text); }
/* All three answers look the same, so the buttons don't nudge anyone toward "yes". */
.lb-btn:hover { border-color: var(--text); background: rgba(244,241,234,.06); }
.lb-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.lb-row .btn-primary { grid-column: 1 / -1; }
.lb-thanks { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 18px 6px; }
.lb-thanks b { font: 800 24px var(--display); }
.lb-thanks span:last-child { color: var(--text-muted); font-size: 14px; }
.lb-thanks-ico { width: 64px; height: 64px; border-radius: 50%; border: 4px solid var(--live-fill); box-shadow: 0 0 0 10px rgba(4,233,231,.15); }
.lb-note { margin: 8px 0 0; font-size: 13px; color: var(--text-muted); }
.lb-note a { color: var(--accent); }
.lb .card-close { position: absolute; }

@media (prefers-reduced-motion: reduce) {
  .ob-alert, .ob-watch { transition: none; }
  .ob-alert-main, .rc-legendary .rc-inner::after, .ob-ring.settled i { animation: none; }
}

/* A ring's radar clip (cards.js clipPlayer): real 1 km radar cells, so they stay crisp, not smoothed. */
.rclip { width: 100%; background-repeat: no-repeat; image-rendering: pixelated; background-color: #0E121A; }
.rc-art .rclip { height: 100%; aspect-ratio: auto !important; }
.rc-chip.rc-fl { background: var(--first-light-ink, #FFD27A); color: #0A0E14; }
.rc-art:has(.rclip) { aspect-ratio: 192 / 162; }
.lb-why { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-why[hidden] { display: none; }
.lb-why-q { width: 100%; margin: 0; font-size: 14px; color: var(--text-muted); }
.lb-reason { min-height: 40px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font: 600 14px var(--ui); cursor: pointer; }
.lb-reason.skip { background: transparent; color: var(--text-muted); }
.lb-row[hidden] { display: none; }
.lb-art .thumb-clip { width: 100%; max-width: 360px; }

/* The daily ring (js/daily.js). */
.dr-stage { position: relative; cursor: crosshair; border-radius: 12px; overflow: hidden; max-width: 420px; margin: 0 auto; }
.dr-inner { position: absolute; }   /* the whole clip; .dr-stage shows today's window of it (daily.js) */
.dr-inner .rclip { width: 100%; }
.dr-tap { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 2px solid var(--text); pointer-events: none; }
.dr-tap.hit { border-color: var(--live-fill); box-shadow: 0 0 10px var(--live-fill); }
.dr-tap.miss { border-color: var(--missed-ink); }
.dr-tap.near { border-color: var(--accent); }
.dr-center { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--accent); pointer-events: none; }
.dr-ring { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; border: 2px dashed var(--accent); pointer-events: none; }
.dr-status { text-align: center; margin: 8px 0 0; font-size: 14px; }
.dr-grid { text-align: center; margin: 4px 0 0; font-size: 22px; letter-spacing: .2em; color: var(--accent); min-height: 1.4em; }
.dr-next { text-align: center; margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }

/* Species cards (js/species.js). */
.sp-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 0; }
.sp-lead { width: 100%; font-size: 12px; color: var(--text-muted); }
.sp-chip { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--live-fill); background: rgba(4,233,231,.08);
  color: var(--text); font: 700 13px var(--ui); cursor: pointer; }
.sp-chip::after { content: " \203A"; color: var(--live-fill); }
.sp .lb-title { margin-bottom: 0; }
.sp-sci { margin: 0; font-style: italic; color: var(--text-muted); }
.sp-iucn { display: inline-block; margin: 8px 0 4px; padding: 3px 10px; border-radius: 999px; font: 700 12px var(--mono); background: var(--surface-raised); }
.sp-iucn.iucn-NT { background: #6B5A1E; color: #FFE98A; }
.sp-iucn.iucn-VU { background: #6B2E24; color: #FFB4A6; }
.sp-stats { display: flex; gap: 16px; margin: 8px 0 4px; }
.sp-stats dt { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.sp-stats dd { margin: 0; font: 700 14px var(--mono); }
.sp h3 { margin: 12px 0 2px; font-size: 14px; color: var(--accent); }
.sp p { margin: 0; line-height: 1.45; }
.sp-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.sp-links a { display: inline-flex; align-items: center; text-decoration: none; }
.sp .source { margin-top: 10px; }
.sp { max-height: 90vh; overflow-y: auto; }
.rv-share { min-width: 200px; }
/* Share sheet (share.js), where the browser has no share sheet for images. */
.share-sheet { width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 52px 18px 18px;   /* room for Close above the card, not over it */ border-radius: 20px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); overflow: auto; }
.share-sheet::backdrop { background: rgba(5,8,14,.72); }
.share-sheet img { display: block; width: 100%; height: auto; border-radius: 12px; }
.share-text { margin: 14px 0; white-space: pre-line; font-size: 15px; line-height: 1.45; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.share-actions .btn-ghost { flex: 1 1 0; min-width: 0; padding: 0 10px; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; text-align: center; text-decoration: none; }
.share-close { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(10,14,20,.7); color: var(--text); font-size: 22px; cursor: pointer; }

/* Today's two side games, above the ring list: Daily ring and Label rings. */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.quick-btn { display: flex; flex-direction: column; gap: 2px; min-height: 52px; padding: 8px 12px; border-radius: 14px; text-align: left; cursor: pointer;
  background: var(--surface-raised); border: 1px solid var(--border); color: var(--text); font: inherit; }
.quick-btn:hover { border-color: var(--accent); }
.quick-btn b { font-size: 14px; }
.quick-btn span { font-size: 12px; color: var(--text-muted); }

/* Label mode: step through a detection's scans. */
.lb-scans { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 8px; }
.lb-scans[hidden] { display: none; }
.lb-scans span { min-width: 11ch; font-size: 12px; color: var(--text-muted); }

.lb-next { margin-top: 10px; width: 100%; }

@media (pointer: coarse) { .sp-chip { min-height: 44px; } }
/* The reveal scrolls on short screens instead of squeezing the card: squeezed, its radar art collapsed to a sliver
   (1 px tall at 320 x 568). */
.rv > * { flex-shrink: 0; }
/* A narrow card can't hold its words and its radar inside the playing-card shape, and the radar lost: let the card
   grow taller there and keep the art. */
@media (max-width: 359px) { .rv .rc { aspect-ratio: auto; } .rv .rc-art { flex: none; aspect-ratio: 192 / 130; } }
/* "Keep this card" on a signed-out player's new card (savecatch.js). */
.rv-save { width: min(340px, 86vw); display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px;
  background: rgba(20,27,45,.92); border: 1px solid var(--border-strong); color: var(--text); opacity: 0; transition: opacity .3s .5s; }
.rv.flipped .rv-save, .rv-save-sent { opacity: 1; }
.rv.still .rv-save { transition: none; }
.rv-save-q { margin: 0; font: 800 15px var(--ui); color: var(--accent); }
.rv-save-sub { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-muted); }
.rv-save-sub b { color: var(--text); word-break: break-all; }
.rv-save-row { display: flex; gap: 8px; margin-top: 4px; }
.rv-save-row input { flex: 1; min-width: 0; min-height: 44px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); padding: 0 10px; font: 600 16px var(--ui); }   /* 16px: no zoom-on-focus on iPhone */
.rv-save-row input[aria-invalid="true"] { border-color: #ff8a8a; }
.rv-save-go { min-height: 44px; padding: 0 16px; white-space: nowrap; }
.rv-save-err { margin: 0; font-size: 13px; color: #ff8a8a; }
/* The same box on the map, after a signed-out tap on a Potential ring (savecatch.js offerSaveOnMap). */
.save-panel { position: absolute; z-index: 4; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(360px, calc(100% - 32px)); }
.save-panel .rv-save { width: 100%; opacity: 1; transition: none; padding-right: 40px; box-shadow: 0 12px 40px rgba(0,0,0,.5); }
.save-panel-x { position: absolute; top: 4px; right: 4px; z-index: 1; width: 40px; height: 40px; border: 0; border-radius: 10px; background: none;
  color: var(--text-muted); font: 700 22px/1 var(--ui); cursor: pointer; }
