:root {
  --bg: #1b1530;
  --panel: #251d42;
  --panel-2: #2e2552;
  --line: #43386f;
  --text: #f4efff;
  --muted: #b0a7d6;
  --gold: #ffd166;
  --discord: #5865f2;
  --r-common: #9aa5b8;
  --r-uncommon: #4ade80;
  --r-rare: #38bdf8;
  --r-epic: #c084fc;
  --r-legendary: #fbbf24;
  --display: 'Fredoka', 'Outfit', system-ui, sans-serif;
  --sans: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 18px;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; color: var(--text); font: 400 1rem/1.55 var(--sans);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(255, 140, 190, .16), transparent 60%),
    radial-gradient(800px 500px at -10% 10%, rgba(120, 160, 255, .14), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
code { background: var(--panel); padding: .1em .45em; border: 1px solid var(--line); border-radius: 8px; font-size: .9em; }

/* top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; max-width: 1180px; margin: 0 auto; padding: 1rem 1.25rem; }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font: 700 1.65rem var(--display); letter-spacing: .01em; }
.brand img { filter: drop-shadow(0 3px 0 rgba(0,0,0,.25)); }
.btn {
  display: inline-flex; align-items: center; gap: .6rem; border: 0; cursor: pointer; text-decoration: none; border-radius: 14px;
  font: 600 .95rem var(--sans); color: #fff; background: var(--discord); padding: 0 1.1rem; height: 46px;
  box-shadow: 0 4px 0 #3b45b8; transition: transform .08s, box-shadow .08s;
}
.btn:hover { transform: translateY(2px); box-shadow: 0 2px 0 #3b45b8; }
.btn:active { transform: translateY(4px); box-shadow: none; }
.btn svg { width: 20px; height: 20px; fill: currentColor; }
/* logged-in chip: the same blue 3D Discord button, with the account info inside */
/* same size, shape, font, shadow and press effect as the other blue buttons (no overrides) */
.btn.user { gap: .6rem; padding: 0 .45rem 0 .45rem; max-width: 100%; }
.user img { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 2px solid var(--gold); background: #3b45b8; object-fit: cover; image-rendering: auto; }
.user-name { max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .logout {
  display: inline-flex; align-items: center; gap: .4rem; border: 0; cursor: pointer; font: 600 .85rem var(--sans); color: #fff;
  background: rgba(255,255,255,.18); border-radius: 10px; padding: 0 .7rem; height: 32px; transition: background .15s, transform .08s;
}
.user .logout svg { width: 16px; height: 16px; fill: currentColor; }
.user .logout:hover { background: rgba(255,255,255,.3); }
.user .logout:active { transform: translateY(1px); }

main { max-width: 1180px; margin: 0 auto; padding: 0 1.25rem 3rem; }

/* hero */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: end; padding: 2rem 0 1.75rem; }
h1 { margin: 0 0 .8rem; font: 700 clamp(2rem, 5vw, 3.4rem)/1.1 var(--display); text-wrap: balance; }
.hero p { margin: 0; color: var(--muted); max-width: 46ch; font-size: 1.1rem; }
.notice { margin-top: 1rem; padding: .65rem .9rem; border-left: 4px solid #f87171; border-radius: 6px; background: rgba(248,113,113,.1); max-width: 46ch; }
.hero-side { display: grid; gap: .5rem; }
.mascots { display: flex; justify-content: center; align-items: flex-end; margin-bottom: -.4rem; }
.mascots img { height: auto; max-width: 34%; filter: drop-shadow(0 8px 10px rgba(0,0,0,.3)); animation: bob 3.2s ease-in-out infinite; }
.mascots img:nth-child(2) { animation-delay: -1.1s; margin: 0 -.5rem; z-index: 1; }
.mascots img:nth-child(3) { animation-delay: -2.2s; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; margin: 0; }
.stats div { display: flex; flex-direction: column; background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: .8rem .9rem; }
.stats dt { color: var(--muted); font-size: .85rem; order: 2; }
.stats dd { margin: 0; font: 700 1.8rem var(--display); color: var(--gold); }

/* progress */
.progress { background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1.5rem; }
.progress-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; margin-bottom: .7rem; }
.progress-head strong { font: 600 1.15rem var(--display); }
.progress-head span { color: var(--muted); }
.bar { height: 20px; background: #140f26; border-radius: 99px; padding: 3px; overflow: hidden; }
#bar-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ffb35c, var(--gold)); transition: width .8s cubic-bezier(.2,.8,.2,1); }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1.25rem; }
#search {
  flex: 1 1 200px; min-width: 0; max-width: 320px; padding: .6rem 1rem; font: inherit; color: var(--text);
  background: var(--panel); border: 2px solid var(--line); border-radius: 99px;
}
#search::placeholder { color: var(--muted); }
.seg { display: flex; border: 2px solid var(--line); border-radius: 99px; overflow: hidden; }
.seg button, .chips button {
  font: 500 .92rem var(--sans); color: var(--muted); background: var(--panel); border: 0; padding: .55rem 1rem; cursor: pointer;
}
.seg button + button { border-left: 2px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--gold); color: #2a1d00; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips button { border: 2px solid var(--line); border-radius: 99px; display: flex; align-items: center; gap: .45rem; }
.chips button i { width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); display: inline-block; }
.chips button[aria-pressed="true"] { color: var(--text); border-color: var(--c, var(--gold)); background: var(--panel-2); }
.seg button:hover:not([aria-pressed="true"]), .chips button:hover { color: var(--text); }

/* grid + cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.1rem; }
.card {
  --c: var(--r-common);
  position: relative; text-align: left; font: inherit; color: inherit; cursor: pointer; padding: 0; overflow: hidden;
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius);
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-5px); border-color: var(--c); box-shadow: 0 10px 24px rgba(0,0,0,.28); }
.card[data-rarity="uncommon"] { --c: var(--r-uncommon); }
.card[data-rarity="rare"] { --c: var(--r-rare); }
.card[data-rarity="epic"] { --c: var(--r-epic); }
.card[data-rarity="legendary"] { --c: var(--r-legendary); }
.card .art {
  aspect-ratio: 1; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--c) 32%, #3a2f66) 0%, #2a2250 70%);
}
.card .art img { width: 88%; height: 88%; object-fit: contain; transition: transform .2s; }
.card:hover .art img { transform: scale(1.06); }
.card.missing .art img { filter: brightness(0) opacity(.34); }
.card .info { padding: .7rem .9rem .85rem; display: grid; gap: .1rem; border-top: 3px solid var(--c); }
.card .num { font: 600 .8rem var(--display); color: var(--muted); letter-spacing: .04em; }
.card .name { font: 600 1.15rem var(--display); }
.card.missing .name { color: var(--muted); }
.card .rar { font-size: .88rem; color: var(--c); font-weight: 500; }
.badge {
  position: absolute; top: .6rem; right: .6rem; font: 700 .85rem var(--display);
  background: var(--gold); color: #2a1d00; padding: .2rem .6rem; border-radius: 99px;
}
.card.unowned .badge { background: #140f26; color: var(--muted); border: 1px solid var(--line); }
.card[data-rarity="legendary"]:not(.missing) { box-shadow: 0 0 0 2px rgba(251,191,36,.25), 0 0 28px rgba(251,191,36,.2); }

.empty { text-align: center; color: var(--muted); padding: 3rem 0; }

/* detail dialog */
dialog { border: 3px solid var(--c, var(--line)); border-radius: 24px; background: var(--panel); color: var(--text); padding: 0; width: min(520px, calc(100vw - 2rem)); overflow: hidden; }
dialog::backdrop { background: rgba(12, 8, 26, .78); backdrop-filter: blur(3px); }
dialog[open] { animation: pop .22s cubic-bezier(.2,1.2,.4,1); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.close { position: absolute; top: .6rem; right: .7rem; width: 38px; height: 38px; font-size: 1.6rem; line-height: 1; color: var(--text); background: rgba(0,0,0,.35); border: 0; border-radius: 50%; cursor: pointer; z-index: 1; }
dialog form { margin: 0; }
.d-art { display: grid; place-items: center; padding: 1.5rem; background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--c) 34%, #3a2f66) 0%, #2a2250 72%); }
.d-art img { width: min(260px, 62vw); height: auto; }
.d-art.missing img { filter: brightness(0) opacity(.4); }
.d-body { padding: 1.1rem 1.5rem 1.6rem; }
.d-num { margin: 0; font: 600 .9rem var(--display); color: var(--muted); letter-spacing: .04em; }
.d-body h2 { margin: .1rem 0 .2rem; font: 700 1.9rem var(--display); }
.d-rarity { margin: 0 0 .9rem; color: var(--c); font-weight: 600; }
.d-fact { margin: 0 0 .9rem; max-width: 52ch; }
.d-meta { margin: 0; color: var(--muted); font-size: .92rem; }

footer { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 2.5rem; color: var(--muted); border-top: 2px solid var(--line); font-size: .92rem; }
footer p { margin: 0; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 1rem; }
  .mascots img { max-width: 30%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .75rem; }
  .brand { font-size: 1.35rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* the animals are pixel art: keep the pixels crisp at any size */
.brand img, .mascots img, .card .art img, .d-art img { image-rendering: pixelated; }
.d-touch { margin: 0 0 .9rem; max-width: 52ch; color: var(--muted); font-size: .95rem; }

/* make the hidden attribute win over display rules like .seg { display: flex } */
[hidden] { display: none !important; }

/* ===== Pixdex polish layer: motion, depth, shine ===== */
.aurora { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none; }
.aurora b { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .32; animation: drift 26s ease-in-out infinite alternate; }
.aurora b:nth-child(1) { background: #6a4cff; left: -20vmax; top: -25vmax; }
.aurora b:nth-child(2) { background: #ff7ab8; right: -25vmax; top: 10vmax; animation-duration: 32s; opacity: .2; }
.aurora b:nth-child(3) { background: #3fd0ff; left: 25vw; bottom: -40vmax; animation-duration: 38s; opacity: .16; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }
.sparkles { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.sparkles i { position: absolute; bottom: -10px; width: var(--z); height: var(--z); background: #fff4c4; opacity: 0; box-shadow: 0 0 8px #ffd166; animation: rise var(--d) linear var(--s) infinite; }
@keyframes rise { 10% { opacity: .9; } 90% { opacity: .5; } to { transform: translateY(-110vh) rotate(180deg); opacity: 0; } }

.topbar { position: sticky; top: 0; z-index: 20; border: 1px solid transparent; border-radius: 999px;
  transition: top .3s, margin .3s, padding .3s, background .3s, border-color .3s, box-shadow .3s, max-width .3s, transform .3s; }
.topbar::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; opacity: 0; transition: opacity .3s; pointer-events: none;
  background: linear-gradient(110deg, rgba(255,209,102,.55), rgba(192,132,252,.35) 45%, rgba(56,189,248,.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.scrolled .topbar { top: 12px; margin-top: 12px; max-width: min(1080px, calc(100% - 1.5rem)); padding: .45rem .55rem .45rem 1rem;
  background: rgba(33,26,58,.72); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 12px 32px rgba(8,4,24,.45), inset 0 1px 0 rgba(255,255,255,.06); }
.scrolled .topbar::before { opacity: 1; }
.scrolled .brand { font-size: 1.3rem; } .scrolled .brand img { width: 32px; height: 32px; }
.brand, .brand img { transition: font-size .3s, width .3s, height .3s; }
.brand img { animation: bob 2.4s ease-in-out infinite; image-rendering: pixelated; }
@keyframes bob { 50% { transform: translateY(-3px) rotate(-4deg); } }

h1 { background: linear-gradient(100deg, #fff 30%, var(--gold) 50%, #fff 70%) 0 0 / 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 6s ease-in-out infinite; }
@keyframes shine { 0%, 55% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.hero-text > * { animation: up .7s cubic-bezier(.2,.8,.2,1) both; }
.hero-text > :nth-child(2) { animation-delay: .1s; }
@keyframes up { from { opacity: 0; transform: translateY(18px); } }

.mascots img { image-rendering: pixelated; filter: drop-shadow(0 14px 14px rgba(0,0,0,.35)); animation: float 4s ease-in-out infinite; }
.mascots img:nth-child(2) { animation-delay: -1.3s; } .mascots img:nth-child(3) { animation-delay: -2.6s; }
@keyframes float { 50% { transform: translateY(-10px); } }
.stats div { transition: transform .2s, border-color .2s; }
.stats div:hover { transform: translateY(-3px); border-color: var(--gold); }

.card { transform: perspective(700px) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)); animation: pop .55s cubic-bezier(.2,.9,.3,1.2) both; animation-delay: calc(var(--i, 0) * 40ms); will-change: transform; }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.92); } }
.card:hover { transform: perspective(700px) translateY(-6px) rotateX(var(--rx, 0)) rotateY(var(--ry, 0)); border-color: var(--c); box-shadow: 0 14px 30px rgba(0,0,0,.35), 0 0 0 1px var(--c), 0 0 26px color-mix(in srgb, var(--c) 40%, transparent); }
.card .art { position: relative; overflow: hidden; }
.card .art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(115deg, transparent 40%, rgba(255,255,255,.22) 50%, transparent 60%); transform: translateX(-120%); transition: transform .7s; }
.card:hover .art::after { transform: translateX(120%); }
.card .art img { image-rendering: pixelated; filter: drop-shadow(0 6px 6px rgba(0,0,0,.3)); }
.card.missing .art img { filter: brightness(0) opacity(.34); }
.card[data-rarity="legendary"]:not(.missing), .card[data-rarity="epic"]:not(.missing) { animation: pop .55s both, glow 3s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 40ms), 0s; }
@keyframes glow { 50% { box-shadow: 0 0 34px color-mix(in srgb, var(--c) 45%, transparent); } }

dialog[open] { animation: modal .35s cubic-bezier(.2,.9,.3,1.3); }
dialog::backdrop { background: rgba(10,6,24,.72); backdrop-filter: blur(6px); animation: fade .3s; }
#d-img { image-rendering: pixelated; }
@keyframes modal { from { opacity: 0; transform: translateY(20px) scale(.9); } }
@keyframes fade { from { opacity: 0; } }
.chips button, .seg button { transition: transform .15s, color .15s, background .15s, border-color .15s; }
.chips button:active, .seg button:active { transform: scale(.94); }
#search { transition: border-color .2s, box-shadow .2s; } #search:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 4px rgba(255,209,102,.18); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* invite button (navbar) */
.top-actions { display: flex; flex-wrap: nowrap; align-items: center; gap: .75rem; }
#account { display: flex; align-items: center; }
.top-actions .btn { white-space: nowrap; }
@media (max-width: 480px) { .top-actions .btn-invite span { display: none; } .top-actions .btn-invite { padding: 0 .75rem; } }

@media (max-width: 480px) { .user-name { max-width: 9ch; } .user .logout span { display: none; } .user .logout { padding: 0 .5rem; } }

/* ===== Phone layout ===== */
html { -webkit-text-size-adjust: 100%; --gutter: 1.25rem; }
@media (max-width: 760px) { html { --gutter: 1rem; } }
body { overflow-x: clip; -webkit-tap-highlight-color: transparent; }
body:has(dialog[open]) { overflow: hidden; }                 /* no scrolling the page behind the popup */
.topbar, main, footer { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
footer { padding-bottom: max(2.5rem, calc(1.5rem + env(safe-area-inset-bottom))); }
.topbar, .top-actions, .btn.user { min-width: 0; }

/* the detail popup: scrolls if the screen is short, close button stays put */
dialog { max-height: calc(100dvh - 2rem); overflow-y: auto; overscroll-behavior: contain; }
dialog form { position: sticky; top: 0; height: 0; z-index: 2; }

/* touch screens: no "stuck" hover effects, give a press effect instead */
@media (hover: none) {
  .card, .card:hover { will-change: auto; }
  .card:hover { transform: perspective(700px); border-color: var(--line); box-shadow: none; }
  .card[data-rarity="legendary"]:not(.missing):hover, .card[data-rarity="epic"]:not(.missing):hover { border-color: var(--c); }
  .card:hover .art img { transform: none; }
  .card:hover .art::after { transform: translateX(-120%); }
  .card:active { transform: perspective(700px) scale(.97); }
  .btn:hover { transform: none; box-shadow: 0 4px 0 #3b45b8; }
  .btn:active { transform: translateY(4px); box-shadow: none; }
  .stats div:hover { transform: none; border-color: var(--line); }
}

@media (max-width: 760px) {
  body { background-attachment: scroll; }                    /* fixed backgrounds stutter on iOS */
  .aurora b { filter: blur(60px); animation: none; }         /* big animated blurs eat battery */
  .topbar { padding-top: .7rem; padding-bottom: .7rem; gap: .5rem; }
  .brand img { width: 34px; height: 34px; }
  .scrolled .topbar { margin-top: 8px; top: 8px; }
  main { padding-bottom: 2rem; }
  .hero { gap: 1rem; padding: .75rem 0 1rem; }
  h1 { margin-bottom: .55rem; }
  .hero p { font-size: 1rem; }
  .mascots img { max-width: 26%; }
  .stats { gap: .5rem; }
  .stats div { padding: .6rem .7rem; border-radius: 14px; }
  .stats dd { font-size: 1.5rem; }
  .stats dt { font-size: .78rem; line-height: 1.25; }
  .progress { padding: .85rem .95rem; margin-bottom: 1.1rem; }
  .progress-head strong { font-size: 1.05rem; }
  .progress-head { gap: .15rem; margin-bottom: .6rem; }

  /* filters: search on top, All/Caught/Missing full width, rarity chips in one swipeable row */
  .toolbar { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: .6rem; margin-bottom: 1rem; }
  #search { flex: none; max-width: none; width: 100%; height: 46px; }
  .seg { width: 100%; }
  .seg button { flex: 1; min-height: 44px; }
  .chips { flex-wrap: nowrap; min-width: 0; overflow-x: auto; margin: 0 calc(-1 * max(var(--gutter), env(safe-area-inset-left))); padding: .15rem max(var(--gutter), env(safe-area-inset-left)) .35rem;
    scroll-padding-inline: max(var(--gutter), env(safe-area-inset-left)); scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button { flex: none; min-height: 40px; white-space: nowrap; scroll-snap-align: start; }

  /* cards: always two even columns on a phone */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .card .info { padding: .55rem .7rem .7rem; }
  .card .name { font-size: 1.02rem; overflow-wrap: anywhere; }
  .card .rar { font-size: .8rem; }
  .badge { top: .4rem; right: .4rem; font-size: .75rem; padding: .12rem .5rem; }

  /* detail popup becomes a bottom sheet */
  dialog { width: 100%; max-width: 100%; margin: auto 0 0; max-height: 90dvh; border-radius: 24px 24px 0 0; border-bottom-width: 0; }
  dialog[open] { animation: sheet .3s cubic-bezier(.2,.9,.3,1); }
  @keyframes sheet { from { transform: translateY(100%); } }
  .close { width: 44px; height: 44px; top: .5rem; right: .6rem; }
  .d-art { padding: 1rem 1rem .75rem; }
  .d-art img { width: min(240px, 52vw, 32dvh); }
  .d-body { padding: .9rem 1.25rem max(1.4rem, calc(.9rem + env(safe-area-inset-bottom))); }
  .d-body h2 { font-size: 1.7rem; }
}

@media (min-width: 521px) and (max-width: 760px) { .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

@media (max-width: 480px) {
  .btn { height: 44px; padding: 0 .9rem; }
  .btn.user { padding: 0 .4rem; }
  .top-actions { gap: .5rem; }
  .top-actions .btn-invite { padding: 0 .75rem; }
  .user-name { max-width: 7ch; flex: 0 1 auto; min-width: 0; }
  .login-long { display: none; }                              /* "Log in with Discord" -> "Log in" */
}
@media (max-width: 400px) { .user-name { max-width: 5ch; } }
@media (max-width: 360px) {
  .user-name { display: none; }                               /* avatar + log out is enough on tiny phones */
  .brand span { font-size: 1.2rem; }
  .stats dt { font-size: .72rem; }
}
@media (max-height: 480px) and (orientation: landscape) {
  .d-art img { width: min(150px, 30vw); }
  .d-art { padding: .75rem; }
}

/* ===== Leaderboards ===== */
@media (max-width: 640px) { .top-actions .btn-lb span { display: none; } .top-actions .btn-lb { padding: 0 .75rem; } }
.btn-lb[aria-current="page"] { transform: translateY(2px); box-shadow: 0 2px 0 #3b45b8; pointer-events: none; }

.lb-page { max-width: 760px; }
.lb-hero { text-align: center; padding: 1.5rem 0 1.25rem; }
.lb-hero h1 { margin-bottom: .5rem; }
.lb-hero p { margin: 0 auto 1.25rem; }
.lb-sort { display: inline-flex; background: var(--panel); }

/* your ranking */
.lb-me { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.5rem; padding: .9rem 1.1rem; border: 2px solid var(--gold); border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,209,102,.14), var(--panel) 60%); box-shadow: 0 0 0 4px rgba(255,209,102,.08); }
.lb-me[hidden] { display: none; }
.lb-me-text { flex: 1; min-width: 0; }
.lb-me-label { margin: 0; color: var(--gold); font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.lb-me h2 { margin: 0; font: 700 1.35rem/1.2 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-me-rank { display: flex; flex-direction: column; align-items: center; line-height: 1; padding-left: .5rem; }
.lb-me-rank span { color: var(--gold); font: 700 1rem var(--display); }
.lb-me-rank strong { color: var(--gold); font: 700 2.4rem var(--display); }
.lb-me-rank small { color: var(--muted); font-size: .75rem; margin-top: .25rem; }
.lb-sub { margin: .1rem 0 0; color: var(--muted); font-size: .92rem; }
.lb-sub b { color: var(--text); font-weight: 600; }
.lb-sub .dot { margin: 0 .4rem; }

/* avatars */
.lb-av { flex: none; border-radius: 50%; object-fit: cover; background: var(--panel-2); border: 2px solid var(--line); image-rendering: auto; }
.me-av { border-color: var(--gold); }
.you-tag { display: inline-block; flex: none; margin-left: .4rem; padding: .05rem .5rem; border-radius: 99px; background: var(--gold); color: #2a1d00; font: 600 .7rem var(--sans); letter-spacing: .04em; text-transform: uppercase; vertical-align: middle; }

/* podium */
.lb-podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; align-items: end; margin-bottom: 1.25rem; }
.lb-podium[hidden] { display: none; }
.pod { --c: var(--r-common); position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0;
  padding: 1.1rem .6rem 1rem; border: 2px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 18%, var(--panel)), var(--panel) 70%);
  animation: pop .5s cubic-bezier(.2,.9,.3,1) both; animation-delay: calc(var(--i) * 90ms); }
.pod-1 { --c: #ffd166; padding-top: 2.2rem; border-color: #ffd166; box-shadow: 0 0 30px rgba(255,209,102,.22); }
.pod-2 { --c: #cfd6e6; border-color: #8e97ad; padding-top: 1.6rem; }
.pod-3 { --c: #e0956a; border-color: #a8643f; padding-top: 1.3rem; }
.pod.is-me { outline: 3px solid var(--gold); outline-offset: 3px; }
.pod-crown { position: absolute; top: -.95rem; left: 50%; width: 34px; height: 34px; margin-left: -17px; color: #ffd166; filter: drop-shadow(0 3px 0 rgba(0,0,0,.3)); animation: bob 3s ease-in-out infinite; }
.pod-crown svg { width: 100%; height: 100%; fill: currentColor; }
.pod-av { position: relative; margin-bottom: .7rem; }
.pod-av .lb-av { width: 76px; height: 76px; border: 4px solid var(--c); box-shadow: 0 6px 14px rgba(0,0,0,.35); }
.pod-1 .pod-av .lb-av { width: 100px; height: 100px; box-shadow: 0 0 0 4px rgba(255,209,102,.2), 0 8px 18px rgba(0,0,0,.4); }
.pod-badge { position: absolute; right: -6px; bottom: -4px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--c); color: #2a1d00; font: 700 .95rem var(--display); border: 3px solid var(--panel); }
.pod h3 { margin: 0; max-width: 100%; font: 600 1.05rem/1.25 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod .you-tag { margin: .25rem 0 0; }
.pod-main { margin: .4rem 0 0; color: var(--muted); font-size: .85rem; }
.pod-main strong { color: var(--c); font: 700 1.6rem var(--display); }
.pod-sub { margin: 0; color: var(--muted); font-size: .82rem; }

/* the rest of the board */
.lb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.lb-row { display: flex; align-items: center; gap: .85rem; padding: .65rem .9rem .65rem .6rem; border: 2px solid var(--line); border-radius: 16px; background: var(--panel);
  transition: transform .15s, border-color .15s; animation: pop .45s cubic-bezier(.2,.9,.3,1) both; animation-delay: calc(var(--i) * 35ms); }
.lb-row:hover { transform: translateX(4px); border-color: var(--r-epic); }
.lb-row.is-me { border-color: var(--gold); background: linear-gradient(90deg, rgba(255,209,102,.13), var(--panel) 70%); }
.lb-rank { flex: none; width: 2.4rem; text-align: center; color: var(--muted); font: 700 1.15rem var(--display); }
.lb-info { flex: 1; min-width: 0; }
.lb-name { display: flex; align-items: center; min-width: 0; font: 600 1.05rem/1.3 var(--display); }
.lb-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-meter { height: 14px; margin-top: .4rem; border-radius: 99px; background: #140f26; padding: 3px; overflow: hidden; }
.lb-meter-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, #ffb35c, var(--gold)); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.lb-score { flex: none; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; min-width: 4.5rem; }
.lb-score strong { color: var(--gold); font: 700 1.35rem var(--display); }
.lb-score small { color: var(--muted); font-size: .75rem; }
.lb-note { margin: 1.25rem 0 0; text-align: center; color: var(--muted); font-size: .9rem; }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }

@media (max-width: 520px) {
  .lb-podium { gap: .4rem; }
  .pod { padding-left: .3rem; padding-right: .3rem; }
  .pod-av .lb-av { width: 58px; height: 58px; }
  .pod-1 .pod-av .lb-av { width: 76px; height: 76px; }
  .pod h3 { font-size: .9rem; }
  .pod-main strong { font-size: 1.25rem; }
  .pod-main span, .pod-sub { font-size: .7rem; }
  .lb-me { gap: .7rem; padding: .75rem .8rem; }
  .lb-me .lb-av { width: 46px; height: 46px; }
  .lb-me h2 { font-size: 1.1rem; }
  .lb-me-rank strong { font-size: 1.9rem; }
  .lb-row { gap: .6rem; padding-right: .7rem; }
  .lb-rank { width: 1.8rem; font-size: 1rem; }
  .lb-row .lb-av { width: 38px; height: 38px; }
  .lb-score { min-width: 3.4rem; }
}
@media (hover: none) { .lb-row:hover { transform: none; border-color: var(--line); } .lb-row.is-me:hover { border-color: var(--gold); } }
.lb-list { grid-template-columns: minmax(0, 1fr); }
.lb-row, .lb-podium, .lb-me { min-width: 0; }
.lb-podium { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* three navbar buttons on narrow phones: avatar + log out is enough */
@media (max-width: 400px) { .user-name { display: none; } .top-actions { gap: .4rem; } }

/* home button (navbar) */
@media (max-width: 640px) { .top-actions .btn-home span { display: none; } .top-actions .btn-home { padding: 0 .75rem; } }
.btn-home[aria-current="page"] { transform: translateY(2px); box-shadow: 0 2px 0 #3b45b8; pointer-events: none; }
