:root {
  color-scheme: light dark;
  --bg: #f6f6fb; --surface: #ffffff; --surface-2: #f0f0f7; --line: #e3e3ee; --fg: #14141f; --muted: #6b6b80;
  --accent: #5b4cf5; --accent-2: #8b5cf6; --accent-fg: #fff; --ok: #12915b; --err: #c4302b;
  --shadow: 0 1px 2px rgba(20,20,40,.06), 0 12px 32px -8px rgba(20,20,60,.14);
  --daily: #6366f1; --r: 20px;
  --t0: #8a8a9c; --t1: #12915b; --t2: #1f6fd1; --t3: #8b3fd9; --t4: #e07a10; --t5: #d6303a;
}
/* Dark mode: follows the system unless the toggle set data-theme on <html> (see theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0d0d14; --surface: #16161f; --surface-2: #1e1e2a; --line: #2a2a3a; --fg: #f1f1f8; --muted: #9696ab;
    --accent: #8b7bff; --accent-2: #b794ff; --accent-fg: #0c0a1f; --ok: #4ade80; --err: #ff8a85;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -10px rgba(0,0,0,.6);
    --t0: #a3a3b8; --t1: #4ade80; --t2: #60a5fa; --t3: #c084fc; --t4: #fbbf24; --t5: #ff6b6b; }
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #0d0d14; --surface: #16161f; --surface-2: #1e1e2a; --line: #2a2a3a; --fg: #f1f1f8; --muted: #9696ab;
    --accent: #8b7bff; --accent-2: #b794ff; --accent-fg: #0c0a1f; --ok: #4ade80; --err: #ff8a85;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 40px -10px rgba(0,0,0,.6);
    --t0: #a3a3b8; --t1: #4ade80; --t2: #60a5fa; --t3: #c084fc; --t4: #fbbf24; --t5: #ff6b6b; }
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg); font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
.glow { position: fixed; inset: -20% -10% auto; height: 60vh; pointer-events: none; z-index: 0; opacity: .35;
  background: radial-gradient(60% 60% at 50% 0%, var(--daily), transparent 70%); transition: background .6s; filter: blur(30px); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .glow { opacity: .28; } }
:root[data-theme="dark"] .glow { opacity: .28; }
.app { position: relative; z-index: 1; max-width: 520px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom)); }
h2 { font-size: 1.15rem; margin: 0 0 12px; letter-spacing: -.01em; }
button, input, a.btn { font: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }

.bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0 14px; }
.logo { display: flex; align-items: center; gap: 0; text-decoration: none; color: inherit; font-weight: 800; font-size: 1.35rem; letter-spacing: -.03em; }

.account { position: relative; }
.chip { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; color: inherit; box-shadow: var(--shadow); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.chip small { color: var(--muted); font-weight: 600; }
.chip .bar-xp { width: 38px; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.chip .bar-xp i { display: block; height: 100%; background: var(--accent); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 8px; min-width: 210px; box-shadow: var(--shadow); z-index: 5; }
.menu p { margin: 4px 8px 8px; font-size: .8rem; color: var(--muted); word-break: break-all; }
.menu button { width: 100%; text-align: left; }

.seg { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 14px; margin-bottom: 14px; }
.seg button { border: 0; background: none; padding: 9px 2px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: clamp(.66rem, 2.9vw, .9rem); white-space: nowrap; cursor: pointer; transition: background .2s, color .2s; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.eyebrow, .label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0; }
.muted { color: var(--muted); font-size: .92rem; margin: 0 0 12px; }
.lead { margin: 0 0 16px; color: var(--muted); }
.lead strong { color: var(--fg); }

.banner { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line)); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; font-size: .92rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid transparent; border-radius: 14px; padding: 12px 18px; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .1s, filter .2s; color: inherit; background: none; }
.btn:active { transform: scale(.98); }
.btn.wide { width: 100%; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-fg); box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.primary:disabled { opacity: .55; cursor: default; }
.btn.ghost { border-color: var(--line); background: var(--surface-2); }
.btn.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn.small { padding: 6px 12px; border-radius: 10px; font-size: .88rem; }
.row { display: flex; gap: 8px; align-items: stretch; }
input:not([type=range]) { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--fg); margin: 6px 0 8px; }
.row input { margin: 0; }
.error { color: var(--err); min-height: 1.3em; margin: 0 0 8px; font-size: .88rem; }

/* boards */
.board { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; counter-reset: r; }
.board li { counter-increment: r; display: flex; align-items: center; gap: 12px; background: var(--surface-2); border-radius: 12px; padding: 10px 14px; }
.board li::before { content: counter(r); width: 22px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.board li:nth-child(1)::before { color: #f5a524; }
.board .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.board .who small { color: var(--muted); font-weight: 500; }
.board .pts { font-weight: 800; font-variant-numeric: tabular-nums; }
.board li.empty::before { content: none; }
.codebox { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface-2); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
code { font: 800 1.3rem ui-monospace, Menlo, monospace; letter-spacing: .08em; }

/* dialogs + toast */
dialog { border: 0; padding: 0; border-radius: 22px; background: var(--surface); color: var(--fg); width: min(380px, calc(100% - 32px)); box-shadow: 0 30px 80px rgba(0,0,0,.4); }
dialog::backdrop { background: rgba(10,10,20,.55); backdrop-filter: blur(6px); }
dialog[open] { animation: dlg .25s cubic-bezier(.2,.8,.2,1); }
@keyframes dlg { from { transform: translateY(14px) scale(.98); opacity: 0; } }
.dlg { padding: 24px; position: relative; }
.x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 1.6rem; color: var(--muted); cursor: pointer; line-height: 1; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; margin: 16px 0 6px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translate(-50%, 30px); background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: .9rem; opacity: 0; pointer-events: none; transition: .3s; z-index: 20; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
footer { margin-top: 22px; font-size: .75rem; color: var(--muted); text-align: center; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* header: theme toggle next to the account chip */
.bar-right { display: flex; align-items: center; gap: 8px; }
.theme-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 1.1rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow); display: grid; place-items: center; }

/* sign-in buttons */
.oauth-btns { display: grid; gap: 8px; }
.btn.oauth { border-color: var(--line); }
.btn.oauth.google { background: #fff; color: #1f1f1f; border-color: #dadce0; }
.btn.oauth.github { background: #24292f; color: #fff; border-color: #24292f; }
.btn.oauth.discord { background: #5865f2; color: #fff; border-color: #5865f2; }

/* sign-in dialog: email + password */
.account { display: flex; align-items: center; gap: 8px; }
.btn.signin { padding: 7px 14px; border-radius: 999px; }
.seg2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 12px; margin: 4px 0 12px; }
.seg2 button { border: 0; background: none; padding: 8px 4px; border-radius: 9px; color: var(--muted); font: 600 .88rem/1.2 inherit; cursor: pointer; }
.seg2 button[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
#pw-form .label { display: block; margin-top: 6px; }
.pw-row { display: flex; gap: 6px; align-items: center; }
.pw-row input { flex: 1; }
.pw-row .btn { flex: none; }
.hint { font-size: .78rem; color: var(--muted); margin: 0 0 6px; }
.linkbtn { border: 0; background: none; color: var(--accent); font: 600 .85rem inherit; cursor: pointer; padding: 6px 0; text-decoration: underline; text-underline-offset: 2px; }
#pw-form .linkbtn, #auth-forgot .linkbtn { display: block; margin: 6px auto 0; }
.magic { margin-top: 10px; }
.magic summary { cursor: pointer; color: var(--muted); font-size: .88rem; text-align: center; padding: 6px 0; }
.magic form { margin-top: 6px; }
.menu .unverified { color: var(--err); }
.menu .unverified .linkbtn { padding: 0; font-size: .8rem; }
#auth-forgot { display: grid; gap: 4px; }

.boardhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.boardhead h2 { margin: 0; }
.kind { display: flex; gap: 2px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.kind button { border: 0; background: none; color: var(--muted); font: 600 .8rem/1.2 inherit; padding: 5px 9px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.kind button[aria-pressed="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.menu .xps { color: var(--fg); font-variant-numeric: tabular-nums; }

/* ads: small, labeled, out of the way */
.ad { margin-top: 14px; padding: 10px 12px 12px; border: 1px dashed var(--line); border-radius: 16px; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.ad-label { display: block; font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.ad .adsbygoogle { min-height: 90px; }
.house-ad { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.house-ad img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; flex: none; }
.house-ad strong { display: block; font-size: .92rem; }
.house-ad small { display: block; color: var(--muted); font-size: .8rem; }
.house-ad:hover strong { text-decoration: underline; }

/* ---------- Zoodle ---------- */
.logo svg { width: 26px; height: 26px; margin-right: 8px; color: var(--accent); flex: none; }
.t0 { --tc: var(--t0); } .t1 { --tc: var(--t1); } .t2 { --tc: var(--t2); } .t3 { --tc: var(--t3); } .t4 { --tc: var(--t4); } .t5 { --tc: var(--t5); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; background: var(--tc, var(--line)); flex: none; }
.tier { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-weight: 800; font-size: .85rem; color: #fff; background: var(--tc, #6b7280); }
[class*=" t"] .tier, .tier { text-shadow: 0 1px 2px rgba(0,0,0,.25); }

/* ready screen */
.ready h2 { margin-top: 6px; }
.mystery { display: grid; place-items: center; height: 150px; margin-bottom: 14px; border-radius: 18px; border: 1px solid var(--line);
  background: repeating-linear-gradient(135deg, var(--surface-2) 0 14px, color-mix(in srgb, var(--line) 70%, var(--surface-2)) 14px 15px);
  font: 800 4rem/1 ui-sans-serif, system-ui, sans-serif; color: var(--muted); letter-spacing: -.04em; }
.how { margin: 0 0 18px; padding-left: 20px; color: var(--muted); display: grid; gap: 6px; }
.how b { color: var(--fg); }
.btn.big { padding: 16px 20px; font-size: 1.15rem; border-radius: 16px; }
#ready-note { margin: 12px 0 0; }
.tiers { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.tierrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tierchip { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 3px 10px 3px 8px; font-size: .78rem; font-weight: 600; }
.tierchip small { color: var(--muted); margin-left: 6px; font-variant-numeric: tabular-nums; }

/* the pull: a photo with its credit, the lineage landing rank by rank, then the points */
#stage-result { position: relative; padding: 0 20px 20px; overflow: hidden; }
.pull-photo { position: relative; margin: 0 -20px; aspect-ratio: 4 / 3; max-width: calc(100% + 40px); background: var(--surface-2); overflow: hidden; }
.pull-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: filter 1.1s cubic-bezier(.2,.8,.2,1), transform 1.1s cubic-bezier(.2,.8,.2,1); }
.pull-photo.veiled img { filter: blur(30px) saturate(.5); transform: scale(1.2); }
.pull-photo .tier { position: absolute; left: 14px; top: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.pull-photo .specimen { position: absolute; right: 14px; top: 14px; background: rgba(0,0,0,.55); color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; }
.pull-photo.gone::after { content: "No photo available"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.credit { margin: 8px 0 0; font-size: .72rem; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.credit a { color: var(--accent); }
.skip { position: absolute; top: 12px; right: 14px; z-index: 2; }
.animal { margin: 14px 0 0; font-size: clamp(1.5rem, 7vw, 2rem); letter-spacing: -.025em; line-height: 1.15; text-wrap: balance; }
.sci { margin: 2px 0 0; font-style: italic; color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.odds { font: 800 1.1rem ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }
.tiernote { flex-basis: 100%; font-size: .78rem; }
.iucn { display: inline-flex; gap: 6px; align-items: center; font-size: .78rem; color: var(--muted); }
.iucn b { background: var(--line); color: var(--fg); border-radius: 6px; padding: 1px 6px; font-size: .72rem; }
.iucn.VU b, .iucn.NT b { background: color-mix(in srgb, var(--t4) 30%, transparent); }
.iucn.EN b, .iucn.CR b { background: color-mix(in srgb, var(--t5) 30%, transparent); }
.lineage { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 14px 0 0; }
.lineage li { background: var(--surface-2); border-radius: 12px; padding: 4px 10px 5px; font-size: .82rem; font-weight: 600; }
.lineage small { display: block; font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.rv { opacity: 0; transform: translateY(10px); transition: opacity .45s, transform .45s cubic-bezier(.2,.8,.2,1); }
.rv.on { opacity: 1; transform: none; }
.pbadges { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 6px; }
.pbadges li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 8px 12px; font-size: .9rem; font-variant-numeric: tabular-nums; }
.pbadges li b { color: var(--accent); white-space: nowrap; }
.pbadges li.zero b { color: var(--muted); }
.sumrow { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 16px; }
.total { font-size: 2.6rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.total small { font-size: .9rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.xp { font-weight: 800; color: var(--accent); text-align: right; font-variant-numeric: tabular-nums; }
.streaknote { margin: 8px 0 0; }
.next { text-align: center; color: var(--muted); font-size: .85rem; margin: 14px 0 0; font-variant-numeric: tabular-nums; }
.actions { display: grid; gap: 8px; margin-top: 12px; }

/* Zoodex */
#tab-zoodex { display: grid; gap: 14px; }
.dexsum { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.dexsum h2 { margin: 0; }
.prog { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.prog li { display: grid; grid-template-columns: minmax(0, 9.5em) 1fr auto; align-items: center; gap: 10px; font-size: .85rem; }
.prog .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog .meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.prog .meter i { display: block; height: 100%; background: var(--accent); border-radius: 4px; min-width: 0; }
.prog .ct { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .78rem; }
.dexgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 12px; }
.dexcard { position: relative; display: block; min-width: 0; padding: 0; text-align: left; font: inherit; color: inherit; cursor: pointer;
  border: 1px solid var(--line); border-bottom: 3px solid var(--tc, var(--line)); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.dexcard:active { transform: scale(.98); }
.dexcard img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; background: var(--line); }
.dexcard .nm { display: block; padding: 5px 8px 6px; font-size: .74rem; line-height: 1.25; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dexcard .nm small { display: block; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.dexcard .cnt { position: absolute; top: 6px; right: 6px; background: var(--surface); border-radius: 999px; padding: 0 7px; font-size: .7rem; font-weight: 800; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.dexcard.unowned img { filter: grayscale(1) opacity(.6); }
#dex-q { margin-bottom: 0; }
.emptydex { text-align: center; padding: 18px 0 6px; }

/* the detail sheet */
#detail { width: min(460px, calc(100% - 32px)); max-height: 92dvh; overflow-y: auto; }
#detail .dlg { padding: 0 20px 20px; }
#detail .pull-photo { margin: 0 -20px; }
#detail .x { z-index: 3; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.6); }

footer a { color: inherit; }

/* Records and the range map */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chips button { border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 6px 12px; border-radius: 999px; font: inherit; font-size: .85rem; font-weight: 600; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.reclist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; }
.reclist li button { display: grid; grid-template-columns: 1.4em 44px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: left; padding: 5px 6px; border-radius: 12px; cursor: pointer; }
.reclist li button:hover { background: var(--surface-2); }
.reclist .rk { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .8rem; text-align: right; }
.reclist img { width: 44px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--surface-2); }
.reclist .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .92rem; }
.reclist .nm small { display: block; font-weight: 400; color: var(--muted); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; }
.reclist .val { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--fg); font-size: .92rem; }
.recnote { font-size: .78rem; padding: 0 4px; }
.traits { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.traits div { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; font-size: .95rem; font-weight: 700; }
.traits small { display: block; color: var(--muted); font-weight: 500; font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.rangebox { margin-top: 14px; }
.rangebox canvas { width: 100%; aspect-ratio: 2 / 1; display: block; border-radius: 12px; background: var(--surface-2); }
.rangebox .credit { margin-top: 4px; }

/* Zoodex habitat map: the landscape is drawn in habitat.js; dark mode dims it, the labels are rounded chips like the rest of the app */
.maphead { margin: 16px 0 6px; font-size: .95rem; }
.habmap { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); touch-action: manipulation; background: var(--surface-2); }
.habmap .zone { cursor: pointer; outline: none; }
.habmap .hit { fill: transparent; stroke: transparent; stroke-width: 2; stroke-dasharray: 5 3; transition: fill .15s; }
.habmap .zone:hover .hit, .habmap .zone:focus-visible .hit { stroke: #fff; fill: rgba(255,255,255,.1); }
.habmap .zone.on .hit { stroke: #fff; stroke-dasharray: none; stroke-width: 2.5; fill: rgba(255,255,255,.14); }
.habmap .chip { fill: color-mix(in srgb, var(--surface) 88%, transparent); stroke: color-mix(in srgb, var(--fg) 12%, transparent); stroke-width: .6; }
.habmap .zone.on .chip { fill: var(--accent); }
.habmap .zl { font-size: 8.5px; font-weight: 650; fill: var(--fg); pointer-events: none; }
.habmap .zone.on .zl { fill: var(--accent-fg); }
.habmap .badge { fill: var(--accent); }
.habmap .zc { font-size: 8px; font-weight: 700; fill: var(--accent-fg); pointer-events: none; font-variant-numeric: tabular-nums; }
.habmap .sd { fill: var(--tc, var(--accent)); stroke: #fff; stroke-width: 1.2; cursor: pointer; filter: drop-shadow(0 .6px .8px rgba(0,0,0,.4)); }
.habmap .sd:hover { stroke: var(--fg); stroke-width: 1.8; }
:root[data-theme="dark"] .habmap .picture { filter: brightness(.7) saturate(.9); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .habmap .picture { filter: brightness(.7) saturate(.9); } }
.landpill { margin-top: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--fg); font: inherit; font-size: .85rem; cursor: pointer; }
.landpill.on { border-color: var(--accent); }
.zonebox { margin-top: 10px; }
.zonebox h3 { margin: 0 0 2px; font-size: 1rem; }

/* Zoodex collection facts */
.tiermix { display: flex; gap: 3px; height: 22px; margin: 10px 0 12px; border-radius: 11px; overflow: hidden; }
.tiermix span { display: grid; place-items: center; min-width: 22px; background: var(--tc); color: #fff; font-size: .7rem; font-weight: 700; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.fact { display: grid; gap: 2px; align-content: start; align-self: stretch; height: 100%; min-width: 0; padding: 10px 12px; text-align: left; font: inherit; color: inherit;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
button.fact { cursor: pointer; border-bottom: 3px solid var(--tc, var(--line)); }
button.fact:active { transform: scale(.98); }
.fact small { color: var(--muted); font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.fact b { font-size: 1rem; overflow-wrap: anywhere; line-height: 1.25; }
.fact span { color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }

/* Badge explanations */
.pbadges li .tx { display: grid; gap: 1px; min-width: 0; }
.pbadges li .tx small, .guidelist .tx small { color: var(--muted); font-size: .76rem; line-height: 1.3; }
.guide { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.guide summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.guide input { width: 100%; margin: 8px 0; }
.guide h4 { margin: 14px 0 6px; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.guidelist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.guidelist li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; background: var(--surface-2); border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
.guidelist .tx { display: grid; gap: 1px; min-width: 0; }
.guidelist .pts { display: grid; justify-items: end; color: var(--accent); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.guidelist .pts small { color: var(--muted); font-weight: 500; font-size: .72rem; }

.muted a { color: var(--accent); }

/* Cookie banner and privacy page */
.consent { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 50; max-width: 560px; margin: 0 auto;
  display: grid; gap: 8px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); font-size: .86rem; line-height: 1.45; }
.consent p { margin: 0; color: var(--muted); }
.consent a { color: var(--accent); }
.consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.consent-actions .btn { flex: 1 1 140px; }
.legal { max-width: 680px; margin: 0 auto; padding: 16px; }
.legal h1 { margin-top: 0; font-size: 1.4rem; }
.legal h2 { margin: 20px 0 6px; font-size: 1.05rem; }
.legal li { margin: 6px 0; }
.legaltable { width: 100%; border-collapse: collapse; font-size: .85rem; margin: 8px 0; }
.legaltable th, .legaltable td { text-align: left; vertical-align: top; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.legaltable code { font-size: .8rem; }

/* showcase: favourites on your Zoodex and on player profiles */
.board button.who { border: 0; background: none; padding: 0; font: inherit; font-weight: 600; color: inherit; text-align: left; cursor: pointer; }
.board button.who:hover, .board button.who:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.banner .linkbtn { padding: 0; font-size: inherit; }
.dexcard .star { position: absolute; top: 6px; left: 6px; color: #f5a524; font-size: .85rem; line-height: 1; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.showcase { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#showcase { margin-bottom: 8px; }
#showcase .recnote { margin: 8px 0 0; }
#showcase-share { margin-top: 10px; }
.favbtn { display: block; margin: 10px 0 0; }
.favbtn[aria-pressed="true"] { color: #b7791f; border-color: color-mix(in srgb, #f5a524 50%, var(--line)); }
#profile { width: min(440px, calc(100% - 32px)); }
.phead { display: flex; align-items: center; gap: 12px; padding-right: 24px; }
.phead h2 { margin: 0; overflow-wrap: anywhere; }
.phead p { margin: 2px 0 0; font-size: .88rem; }
.avatar.big { width: 48px; height: 48px; font-size: 1.2rem; flex: none; }
.ptoday { margin: 12px 0 0; font-size: .9rem; }

/* bonus game: guess where the animal lives */
.bonus { margin-top: 14px; }
.bonus > h2:first-child { margin: 0 0 12px; font-size: 1.05rem; }
.bonus .pull-photo { margin-top: 0; }
.guesswrap { position: relative; margin-top: 10px; }
.guessmap { width: 100%; aspect-ratio: 2 / 1; display: block; border-radius: 12px; background: var(--surface-2); touch-action: none; cursor: crosshair; }
.zoom { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px; }
.zoom button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: 700 1.1rem/1 inherit; cursor: pointer; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.hints { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 4px; font-size: .88rem; }
.hints li::before { content: "✗ "; color: var(--err); font-weight: 800; }
.bonus > .btn.wide { margin-top: 12px; }
.bonusend { margin: 14px 0 4px; font-weight: 700; }
.bonusend.won { color: var(--ok); }
.bonusend.lost { color: var(--muted); }
