/*
  rootemojis. Plain CSS.
  Tokens: one cool-grey neutral family, one accent (signal green), one theme at a time (light or dark).
  Shape rule: interactive controls (buttons, inputs, chips) are full pill. Surfaces (tiles, panels) are 20px.
  Aesthetic: minimalist consumer UI. No official design system applies.
*/

@font-face { font-family: "Geist"; src: url("../vendor/fonts/Geist-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist"; src: url("../vendor/fonts/Geist-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Geist"; src: url("../vendor/fonts/Geist-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../vendor/fonts/GeistMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("../vendor/fonts/GeistMono-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --bg: #f4f5f6;
  --surface: #fafafb;
  --raised: #eceef0;
  --ink: #111316;
  --muted: #565c66;
  --line: #dcdfe3;
  --accent: #5ed08a;
  --accent-ink: #08170e;
  --danger: #b4232f;
  --danger-bg: #f7e4e6;
  --checker-a: #e6e8eb;
  --checker-b: #f4f5f6;
  --panel: 20px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0c0d0f;
  --surface: #141618;
  --raised: #1c1f23;
  --ink: #eceef0;
  --muted: #9ca2ad;
  --line: #262a30;
  --danger: #ff8a93;
  --danger-bg: #2b1518;
  --checker-a: #1c1f23;
  --checker-b: #141618;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { background: var(--bg); color: var(--ink); scroll-behavior: smooth; }
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
ul, ol { list-style: none; padding: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 999px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ph { display: inline-block; }

.wrap { width: 100%; max-width: 1280px; margin-inline: auto; padding-inline: 16px; }
.narrow { max-width: 448px; }
.page { padding-block: 48px 96px; }
@media (min-width: 640px) { .wrap { padding-inline: 24px; } }
@media (min-width: 768px) { .page { padding-top: 64px; } }

h1, h2 { letter-spacing: -0.04em; font-weight: 600; }
h1 { font-size: clamp(2.25rem, 4vw + 1rem, 3rem); line-height: 1.05; }
h2 { font-size: 1.5rem; letter-spacing: -0.02em; line-height: 1.2; }
.muted { color: var(--muted); }
.stack { display: grid; gap: 24px; }
.stack-lg { display: grid; gap: 32px; }

/* ---------- header (64px, one line) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 8px; }
.brand { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.03em; padding-right: 8px; }
.nav, .nav-end, .nav-start { display: flex; align-items: center; gap: 4px; }
.nav-start { gap: 4px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding-inline: 12px;
  border-radius: 999px; font-size: 0.875rem; font-weight: 500; color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.nav-link:hover { background: var(--raised); color: var(--ink); }
.nav-link .ph { font-size: 18px; }
.nav-link .label { display: none; }
.nav-link .badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 1px 8px; font-size: 0.75rem; font-weight: 600; }
.only-md, .only-sm { display: none; }
@media (min-width: 640px) {
  .nav-link { padding-inline: 16px; }
  .nav-link .label { display: inline; }
  .only-sm { display: inline-flex; }
}
@media (min-width: 768px) { .only-md { display: inline-flex; } }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 999px; font-size: 20px; transition: background 0.2s, transform 0.2s; }
.icon-btn:hover { background: var(--raised); }
.icon-btn:active { transform: scale(0.96); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  height: 44px; padding-inline: 20px; border-radius: 999px; border: 1px solid transparent;
  font-size: 0.875rem; font-weight: 500;
  transition: background 0.2s, filter 0.2s, transform 0.2s var(--ease);
}
.btn:active { transform: translateY(-1px) scale(0.98); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn .ph { font-size: 18px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(0.95); }
.btn-outline { border-color: var(--line); background: var(--surface); }
.btn-outline:hover { background: var(--raised); }
.btn-danger { border-color: var(--line); background: var(--surface); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost:hover { background: var(--raised); }
.btn-sm { height: 40px; padding-inline: 16px; }
.btn-lg { height: 56px; }
.btn-dark { background: var(--accent-ink); color: var(--accent); }
.btn-dark:hover { opacity: 0.9; }

/* ---------- forms ---------- */
.field { display: grid; gap: 8px; }
.field > label, .label-text { font-size: 0.875rem; font-weight: 500; }
.hint { font-size: 0.875rem; color: var(--muted); }
.error { font-size: 0.875rem; color: var(--danger); }
.form-error { border-radius: var(--panel); background: var(--danger-bg); color: var(--danger); padding: 12px 16px; font-size: 0.875rem; }
.input {
  width: 100%; height: 48px; padding-inline: 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); outline: none; transition: border-color 0.2s;
}
.input::placeholder { color: var(--muted); }
.input:focus { border-color: var(--ink); }
.mono { font-family: var(--mono); }

.search { position: relative; display: flex; align-items: center; width: 100%; }
.search > .ph { position: absolute; left: 20px; font-size: 20px; color: var(--muted); pointer-events: none; }
.search .input { height: 56px; padding-left: 52px; padding-right: 64px; }
.search.has-submit .input { padding-right: 128px; }
.search .btn { position: absolute; right: 6px; }
.search kbd {
  position: absolute; right: 20px; display: none; border: 1px solid var(--line); border-radius: 6px;
  padding: 0 8px; font-family: var(--mono); font-size: 0.75rem; color: var(--muted);
}
@media (min-width: 640px) { .search kbd { display: block; } }

.chips-input {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: var(--panel); background: var(--surface); transition: border-color 0.2s;
}
.chips-input:focus-within { border-color: var(--ink); }
.chips-input input { flex: 1; min-width: 8rem; height: 32px; padding: 0 4px; background: none; border: 0; outline: none; }
.chip-tag { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--raised); font-size: 0.875rem; }
.chip-tag button { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; color: var(--muted); font-size: 12px; }
.chip-tag button:hover { background: var(--line); color: var(--ink); }

.dropzone {
  display: flex; align-items: center; gap: 20px; padding: 16px; border: 1px dashed var(--line);
  border-radius: var(--panel); background: var(--surface); cursor: pointer; transition: border-color 0.2s;
}
.dropzone:hover { border-color: var(--ink); }
.dropzone .thumb { display: grid; place-items: center; flex: none; width: 96px; height: 96px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; font-size: 28px; color: var(--muted); }
.dropzone .thumb img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.dropzone .copy { display: grid; gap: 4px; font-size: 0.875rem; }
.dropzone .sizes { display: flex; align-items: center; gap: 12px; color: var(--muted); }

.checker {
  background-color: var(--checker-b);
  background-image:
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%),
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%, transparent 75%, var(--checker-a) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 8px 8px;
}

/* ---------- hero ---------- */
.hero { display: grid; gap: 40px; align-items: center; padding-block: 48px 64px; }
.hero h1 { max-width: 16ch; font-size: clamp(2.25rem, 6vw, 4.5rem); line-height: 1.02; }
.hero-copy { display: grid; gap: 24px; }
.hero-copy p { max-width: 46ch; font-size: 1.125rem; line-height: 1.6; color: var(--muted); }
.hero-actions { display: flex; flex-direction: column; gap: 12px; max-width: 672px; }
.hero-actions .btn-outline { height: 56px; align-self: flex-start; }
@media (min-width: 640px) { .hero-actions { flex-direction: row; align-items: center; } .hero-actions .search { flex: 1; } }
@media (min-width: 768px) { .hero { padding-top: 64px; } }
@media (min-width: 1024px) { .hero { grid-template-columns: 1.05fr 0.95fr; gap: 64px; } }

.cluster { position: relative; width: 100%; max-width: 520px; margin-inline: auto; aspect-ratio: 1; --mx: 0; --my: 0; }
.cluster-tile {
  position: absolute; aspect-ratio: 1; border-radius: var(--panel); border: 1px solid var(--line); background: var(--surface);
  left: var(--x); top: var(--y); width: var(--s);
  rotate: var(--r);
  translate: calc(var(--mx) * var(--d) * 28px) calc(var(--my) * var(--d) * 28px);
  transition: translate 0.35s var(--ease), scale 0.3s var(--ease), rotate 0.3s var(--ease);
}
.cluster-tile:hover { scale: 1.08; rotate: 0deg; }
.cluster-tile a { position: absolute; inset: 0; display: grid; place-items: center; padding: 16%; }
.cluster-tile img { width: 100%; height: 100%; object-fit: contain; }
.cluster-tile.empty { border-style: dashed; background: transparent; }
.cluster-note { position: absolute; inset-inline: 0; bottom: 0; text-align: center; font-size: 0.875rem; color: var(--muted); }

/* ---------- tags rail ---------- */
.rail-bleed { margin-inline: -16px; }
@media (min-width: 640px) { .rail-bleed { margin-inline: -24px; } }
.rail { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-left: 16px; padding: 0 16px 4px; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
@media (min-width: 640px) { .rail { padding-inline: 24px; scroll-padding-left: 24px; } }
.pill {
  display: inline-flex; align-items: center; gap: 8px; flex: none; scroll-snap-align: start;
  height: 40px; padding-inline: 16px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); font-size: 0.875rem; font-weight: 500;
  transition: background 0.2s, transform 0.2s;
}
.pill:hover { background: var(--raised); }
.pill:active { transform: scale(0.98); }
.pill .count { color: var(--muted); }
.pill.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pill.on .count { color: inherit; opacity: 0.7; }

/* ---------- sections ---------- */
.section { padding-bottom: 64px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.text-link { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 500; }
.text-link:hover { text-decoration: underline; }

/* ---------- emoji grid + tiles ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(6, 1fr); } }

.tile { position: relative; display: grid; gap: 12px; align-content: start; animation: rise 0.5s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 30ms); }
.tile-media {
  position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--panel); background: var(--surface);
  transition: transform 0.3s var(--ease), border-color 0.3s;
}
.tile:hover .tile-media { transform: translateY(-2px); border-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.tile-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 22%; transition: transform 0.3s var(--ease); }
.tile-media img { pointer-events: none; }
/* The picture area sits above the name's stretched link (z-index), and holds its own link, so the quick actions on top stay clickable. */
.tile-media { z-index: 1; }
.tile-cover { position: absolute; inset: 0; border-radius: inherit; }
.tile:hover .tile-media img { transform: scale(1.1); }
.tile-actions { position: absolute; right: 8px; bottom: 8px; z-index: 1; display: flex; gap: 6px; }
@media (hover: hover) {
  .tile-actions { opacity: 0; transition: opacity 0.2s; }
  .tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; }
}
.tile-action {
  display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(6px); font-size: 16px;
  transition: background 0.2s, transform 0.2s;
}
.tile-action:hover { background: var(--raised); }
.tile-action:active { transform: scale(0.94); }
.tile-info { min-width: 0; padding-inline: 4px; }
.tile-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 0.875rem; font-weight: 500; }
.tile-name::after { content: ""; position: absolute; inset: 0; }
.tile-tags { position: relative; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; font-size: 0.875rem; color: var(--muted); }
.tile-tags a:hover { color: var(--ink); text-decoration: underline; }

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; scale: 0.6; } to { opacity: 1; scale: 1; } }

.rise { animation: rise 0.7s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 100ms); }
.cluster-tile { animation: pop 0.8s var(--ease) backwards; animation-delay: calc(150ms + var(--k, 0) * 70ms); }

/* ---------- empty / status / skeleton ---------- */
.empty { border: 1px dashed var(--line); border-radius: var(--panel); padding: 64px 24px; text-align: center; }
.empty strong { display: block; font-size: 1.125rem; font-weight: 500; }
.empty p { max-width: 42ch; margin: 8px auto 0; color: var(--muted); }
.empty .row { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }
.result-count { margin: 40px 0 24px; font-size: 0.875rem; color: var(--muted); }

.skeleton { background: linear-gradient(100deg, var(--raised) 30%, var(--surface) 50%, var(--raised) 70%); background-size: 200% 100%; animation: shimmer 1.6s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel-tile { display: grid; gap: 12px; }
.skel-tile .skeleton:first-child { aspect-ratio: 1; border-radius: var(--panel); }
.skel-tile .skeleton:last-child { height: 16px; width: 66%; border-radius: 999px; }

.notice { max-width: 576px; border-radius: var(--panel); background: var(--accent); color: var(--accent-ink); padding: 16px 20px; }
.status { display: inline-block; width: fit-content; border-radius: 999px; padding: 4px 12px; font-size: 0.75rem; font-weight: 500; }
.status.pending { background: var(--raised); }
.status.approved { background: var(--accent); color: var(--accent-ink); }
.status.declined { background: var(--danger-bg); color: var(--danger); }

/* ---------- upload band ---------- */
.band { position: relative; overflow: hidden; border-radius: var(--panel); background: var(--accent); color: var(--accent-ink); padding: 32px; }
.band-copy { position: relative; display: grid; gap: 16px; max-width: 576px; }
.band h2 { font-size: clamp(2.25rem, 4vw, 3rem); line-height: 1.05; letter-spacing: -0.04em; }
.band p { max-width: 42ch; font-size: 1.125rem; line-height: 1.6; }
.band-tiles { display: none; position: absolute; right: -24px; top: 50%; translate: 0 -50%; gap: 12px; pointer-events: none; }
.band-tiles div { display: grid; place-items: center; width: 112px; height: 112px; padding: 20px; border-radius: var(--panel); background: color-mix(in srgb, var(--bg) 80%, transparent); }
.band-tiles img { width: 100%; height: 100%; object-fit: contain; }
@media (min-width: 768px) { .band { padding: 56px; } }
@media (min-width: 1024px) { .band-tiles { display: flex; } }

/* ---------- emoji detail ---------- */
.detail { display: grid; gap: 40px; align-items: start; }
@media (min-width: 1024px) { .detail { grid-template-columns: minmax(0, 32rem) 1fr; gap: 64px; } }
.detail-media { display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: var(--panel); }
.detail-media img { width: 100%; height: 100%; object-fit: contain; padding: 14%; }
.detail h1 { font-family: var(--mono); overflow-wrap: anywhere; letter-spacing: -0.03em; }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-list a { display: inline-flex; align-items: center; height: 36px; padding-inline: 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 0.875rem; transition: background 0.2s; }
.tag-list a:hover { background: var(--raised); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }
.sizes-box { display: flex; align-items: flex-end; gap: 24px; padding: 24px; border: 1px solid var(--line); border-radius: var(--panel); background: var(--surface); }
.sizes-box img { object-fit: contain; }

/* ---------- panel / review ---------- */
.panel { display: grid; gap: 20px; padding: 24px; border: 1px solid var(--line); border-radius: var(--panel); background: var(--surface); }
.review-list { display: grid; gap: 16px; }
.review-card { display: grid; gap: 24px; padding: 16px; border: 1px solid var(--line); border-radius: var(--panel); background: var(--surface); }
@media (min-width: 640px) { .review-card { padding: 20px; } }
@media (min-width: 768px) { .review-card { grid-template-columns: minmax(0, 15rem) 1fr; } }
.review-preview { display: grid; gap: 12px; }
.review-preview .big { display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; }
.review-preview .big img { width: 100%; height: 100%; object-fit: contain; padding: 24px; }
.review-preview .small { display: flex; align-items: center; gap: 16px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.875rem; color: var(--muted); }
.review-form { display: grid; gap: 16px; align-content: start; }
.review-form .btns { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; translate: -50% 0; border-radius: 999px; background: var(--ink); color: var(--bg); padding: 10px 20px; font-size: 0.875rem; animation: rise 0.3s var(--ease) both; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); }
.site-footer .wrap { display: grid; gap: 24px; padding-block: 40px; font-size: 0.875rem; color: var(--muted); }
.footer-row { display: flex; flex-direction: column; gap: 16px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.site-footer a:hover { color: var(--ink); }
.site-footer strong { color: var(--ink); font-weight: 500; }
.disclaimer { max-width: 70ch; padding-top: 20px; border-top: 1px solid var(--line); line-height: 1.6; }
@media (min-width: 640px) { .footer-row { flex-direction: row; align-items: center; justify-content: space-between; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
}

/* utility classes (inline style attributes are blocked by the CSP) */
.d1 { --i: 1; }
.d2 { --i: 2; }
.tight { gap: 16px; }
.fit { width: fit-content; }
.section-last { padding-bottom: 96px; }
.lede { max-width: 42ch; line-height: 1.6; }
.small { font-size: 0.875rem; }
.small a { color: var(--ink); font-weight: 500; text-decoration: underline; }
.search-wrap { max-width: 672px; }
.fill { width: 100%; }
.stack > *, .stack-lg > *, .review-card > *, .detail > * { min-width: 0; }

/* ---------- account ---------- */
.account-page { max-width: 640px; }
.panel h2 { font-size: 1.25rem; }
.panel.danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.check { display: flex; align-items: center; gap: 12px; font-weight: 400; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- tile meta: creator and downloads ---------- */
.tile-meta { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 2px; font-size: 0.875rem; color: var(--muted); }
.tile-meta .creator { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-meta .dl { display: inline-flex; align-items: center; gap: 4px; flex: none; font-variant-numeric: tabular-nums; }
.tile-meta .dl .ph { font-size: 14px; }

/* ---------- tag picker (upload, review) ---------- */
.tag-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding-inline: 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-size: 0.875rem; font-weight: 500; transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.choice:hover:not(:disabled) { background: var(--raised); }
.choice:active:not(:disabled) { transform: scale(0.97); }
.choice:disabled { opacity: 0.45; cursor: not-allowed; }
.choice.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.choice .count { color: var(--muted); font-weight: 400; }
.choice.on .count { color: inherit; opacity: 0.7; }

/* ---------- browse: toolbar, filter panel, active filters ---------- */
.toolbar { display: flex; gap: 12px; max-width: 672px; }
.toolbar .search { flex: 1; min-width: 0; }
.filter-btn { position: relative; padding-inline: 18px; }
.filter-btn .label { display: none; }
.filter-btn .badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding-inline: 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; font-weight: 600; }
.filter-btn[aria-expanded="true"] { border-color: var(--ink); }
@media (min-width: 640px) { .filter-btn .label { display: inline; } }
.filter-panel { max-width: 672px; padding: 20px; border: 1px solid var(--line); border-radius: var(--panel); background: var(--surface); display: grid; gap: 16px; animation: rise 0.3s var(--ease) backwards; }
.filter-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filter-head h2 { font-size: 1.125rem; }
.filter-list { display: flex; flex-wrap: wrap; gap: 8px; max-height: 280px; overflow-y: auto; }
.active-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.active-tags:empty { display: none; }
.chip-remove { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px 0 16px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 0.875rem; font-weight: 500; transition: opacity 0.2s; }
.chip-remove:hover { opacity: 0.85; }
.chip-remove .ph { font-size: 12px; }

/* ---------- detail stats ---------- */
.stats { display: flex; gap: 40px; }
.stat { display: grid; gap: 2px; }
.stat dt { font-size: 0.875rem; color: var(--muted); }
.stat dd { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }


/* ---------- tag picker (upload, review) ---------- */
.tp { display: grid; gap: 12px; }
.tp-field { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--panel); background: var(--surface); }
.tp-empty { padding-left: 8px; color: var(--muted); }
.tp-add { display: inline-flex; align-items: center; gap: 6px; height: 36px; margin-left: auto; padding-inline: 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.875rem; font-weight: 500; transition: background 0.2s; }
.tp-add:hover { background: var(--raised); }
.tp-add .ph { font-size: 14px; }
.tp-panel { display: grid; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--panel); background: var(--surface); animation: rise 0.25s var(--ease) backwards; }
.tp-search { height: 44px; }
.tp-list { display: grid; gap: 20px; max-height: 288px; overflow-y: auto; padding-right: 4px; overscroll-behavior: contain; }
.tp-title { margin-bottom: 8px; font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.tp-options { display: flex; flex-wrap: wrap; gap: 8px; }
.tp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- profile pictures ---------- */
.avatar {
  --size: 40px;
  display: inline-grid; place-items: center; flex: none; overflow: hidden;
  width: var(--size); height: var(--size); border-radius: 999px;
  background: var(--raised); border: 1px solid var(--line);
  font-size: calc(var(--size) * 0.42); font-weight: 600; line-height: 1; color: var(--muted); user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-row { display: flex; align-items: center; gap: 20px; }
.btn-quiet-danger { color: var(--muted); }
.btn-quiet-danger:hover { background: var(--danger-bg); color: var(--danger); }
.creator-line { display: inline-flex; align-items: center; gap: 10px; }
.tile-meta .creator { display: inline-flex; align-items: center; gap: 6px; }
.tile-meta .creator-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-action.danger:hover { background: var(--danger-bg); color: var(--danger); }

/* ---------- confirm dialog ---------- */
.dialog { width: min(92vw, 420px); padding: 0; border: 1px solid var(--line); border-radius: var(--panel); background: var(--surface); color: var(--ink); margin: auto; }
.dialog::backdrop { background: rgb(8 9 11 / 0.6); backdrop-filter: blur(3px); }
.dialog-body { display: grid; gap: 12px; padding: 24px; }
.dialog[open] { animation: rise 0.25s var(--ease); }
.toast { max-width: min(92vw, 520px); text-align: center; }

/* ---------- leaderboard ---------- */
.lb-podium { display: grid; gap: 8px; align-items: end; max-width: 820px; margin-inline: auto; border-bottom: 1px solid var(--line); }
.lb-podium.cols-1 { grid-template-columns: minmax(0, 260px); justify-content: center; }
.lb-podium.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 520px; }
.lb-podium.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.lb-step { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 0; animation: rise 0.6s var(--ease) backwards; animation-delay: calc(var(--i, 0) * 90ms); }
.lb-top { display: grid; justify-items: center; gap: 6px; width: 100%; padding: 0 2px 16px; text-align: center; }
.lb-top > .ph { font-size: 30px; color: var(--accent); }
.lb-step.place-1 .lb-top .avatar { border: 2px solid var(--accent); }
.lb-top-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.lb-top-total { display: grid; justify-items: center; line-height: 1.1; }
.lb-top-total strong { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.lb-step.place-1 .lb-top-total strong { font-size: 2rem; }
.lb-top-total span, .lb-top-count { font-size: 0.8125rem; color: var(--muted); }
.lb-top .lb-thumbs { display: none; margin-top: 4px; }

.lb-pedestal {
  display: grid; place-items: start center; width: 100%; padding-top: 14px;
  border: 1px solid var(--line); border-bottom: 0; border-radius: var(--panel) var(--panel) 0 0; background: var(--surface);
  font-size: 2.25rem; font-weight: 600; letter-spacing: -0.04em; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums;
}
.place-1 .lb-pedestal { height: 140px; border-color: transparent; background: var(--accent); color: var(--accent-ink); font-size: 3rem; }
.place-2 .lb-pedestal { height: 104px; }
.place-3 .lb-pedestal { height: 76px; }
.lb-step.mine .lb-top-name { text-decoration: underline; text-underline-offset: 4px; }
.lb-you { border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 0.75rem; font-weight: 500; color: var(--muted); }

.lb-thumbs { display: flex; gap: 8px; }
.lb-thumbs a {
  --size: 44px;
  display: grid; place-items: center; width: var(--size); height: var(--size);
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg); transition: transform 0.2s var(--ease);
}
.lb-thumbs a:hover { transform: translateY(-2px); }
.lb-thumbs img { width: 68%; height: 68%; object-fit: contain; }

.lb-list { margin-top: 40px; border-top: 1px solid var(--line); }
.lb-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px 16px;
  padding: 14px 4px; border-bottom: 1px solid var(--line); animation: rise 0.5s var(--ease) backwards;
}
.lb-row.mine { background: var(--surface); }
.lb-rank { font-family: var(--mono); font-size: 0.9375rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-who { display: flex; align-items: center; gap: 14px; min-width: 0; }
.lb-name { display: grid; min-width: 0; }
.lb-name strong { display: flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.lb-name span { font-size: 0.875rem; color: var(--muted); }
.lb-row .lb-thumbs { display: none; }
.lb-count { display: inline-flex; align-items: center; gap: 6px; font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.lb-count .ph { font-size: 16px; color: var(--muted); }

@media (min-width: 640px) {
  .lb-podium { gap: 12px; }
  .lb-top { gap: 8px; padding-bottom: 20px; }
  .lb-top-name { font-size: 1.125rem; }
  .lb-top-total strong { font-size: 2rem; }
  .lb-step.place-1 .lb-top-total strong { font-size: 2.75rem; }
  .lb-top .lb-thumbs { display: flex; }
  .place-1 .lb-pedestal { height: 180px; font-size: 3.5rem; }
  .place-2 .lb-pedestal { height: 132px; }
  .place-3 .lb-pedestal { height: 96px; }
  .lb-row { grid-template-columns: 40px minmax(0, 1fr) auto 96px; padding-inline: 12px; }
  .lb-row .lb-thumbs { display: flex; }
  .lb-count { justify-content: flex-end; }
}

.tile-info .btn-quiet-danger { justify-self: start; margin-left: -10px; }

/* ---------- profile ---------- */
.profile-head { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.profile-head .who { display: grid; gap: 12px; }
.profile-head h1 { overflow-wrap: anywhere; }
.profile-stats { display: flex; flex-wrap: wrap; gap: 8px 40px; }
.profile-stats .stat dd { font-size: 1.5rem; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.tile-meta a.creator:hover .creator-name { color: var(--ink); text-decoration: underline; }
a.creator-line:hover { text-decoration: underline; }
.lb-top-name a:hover, a.lb-who:hover .lb-name strong { text-decoration: underline; text-underline-offset: 3px; }
a.lb-who { color: inherit; }
.lb-link { display: inline-block; border-radius: 999px; transition: transform 0.2s var(--ease); }
.lb-link:hover { transform: scale(1.04); }

/* ---------- administrator badge ---------- */
.admin-badge { display: inline-block; flex: none; vertical-align: -0.15em; margin-left: 4px; object-fit: contain; }
.profile-name { display: flex; align-items: center; gap: 10px; }
.profile-name .admin-badge, .tile-meta .creator .admin-badge, .creator-line .admin-badge, .nav-link .admin-badge, .lb-name strong .admin-badge, .lb-top-name .admin-badge { margin-left: 0; }
.lb-top-name { display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.lb-top-name a { overflow: hidden; text-overflow: ellipsis; }
