:root {
  --bg: #14161a;
  --panel: #1d2026;
  --panel-2: #262a32;
  --text: #e8e6e1;
  --muted: #9aa0ab;
  --accent: #f5b301;
  --line: #31353e;
  --common: #7d8590;
  --notable: #3fb8af;
  --rare: #4f8ff7;
  --epic: #a06bfa;
  --legendary: #f5b301;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; text-decoration: none; }
main { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }

.site-header {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; padding-top: calc(8px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
/* the wordmark is a plate */
.logo {
  flex: none; font-family: ui-monospace, "JetBrains Mono", Consolas, monospace;
  font-weight: 900; font-size: .8rem; letter-spacing: 1.5px; line-height: 1.1;
  background: var(--accent); color: #1a1a1a; border: 2px solid #1a1a1a; border-radius: 6px;
  padding: 5px 9px; box-shadow: 0 0 0 1px var(--accent);
}
.search { flex: 1; min-width: 0; display: flex; max-width: 520px; margin-left: auto; }
.search input { width: 100%; border-radius: 999px; padding: 7px 14px; }
.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 24px 96px; }
.site-footer a { text-decoration: underline; }
.site-footer p { margin: 6px 0 0; }

input, select, button {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 12px; font: inherit;
}
button { cursor: pointer; }
button:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: #14161a; font-weight: 700; border-color: var(--accent); }

/* feed: one column of posts, sections down the side (a swipeable rail on phones) */
.layout { display: grid; grid-template-columns: 220px minmax(0, 600px); gap: 28px; justify-content: center; }
.rail {
  position: sticky; top: 64px; align-self: start; max-height: calc(100vh - 80px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px; padding: 14px 0; scrollbar-width: thin;
}
.rail-head { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: 1px; margin: 12px 0 2px; }
.rail-head:first-child { margin-top: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 5px 12px; border-radius: 999px; font-size: .88rem;
  background: var(--panel); border: 1px solid var(--line);
}
.chip small { color: var(--muted); font-size: .75rem; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #14161a; font-weight: 700; }
.chip.on small { color: inherit; }
.chip.more { background: transparent; border-style: dashed; color: var(--muted); }
.chip.tier { color: var(--tier); }
.chip.tier.on { color: #14161a; }
.rail .chip { justify-content: space-between; }

.feed-heading { font-size: 1.25rem; margin: 16px 0 0; }
.tabs {
  display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line);
  margin: 8px 0 14px; position: relative;
}
.tab { padding: 10px 14px; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--text); border-color: var(--accent); }
.filter-sheet { margin-left: auto; }
.filter-sheet summary { list-style: none; cursor: pointer; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.filter-sheet summary::-webkit-details-marker { display: none; }
.filter-sheet[open] summary { color: var(--text); border-color: var(--accent); }
.filter-sheet form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: min(100%, 320px);
  display: flex; flex-direction: column; gap: 8px; padding: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px #0008;
}
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }

.grid { display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; }
.reads { font-weight: 700; font-size: 1.05rem; }
.reads.big { font-size: 1.5rem; }
.card-img img {
  width: 100%; display: block; min-height: 220px; max-height: 80vh; object-fit: cover;
  background: var(--panel-2);
}
/* several photos of one plate: a swipeable strip, cropped to the tallest shot */
.card-shots { position: relative; }
.shots { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.shots::-webkit-scrollbar { display: none; }
.shots .card-img { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; }
.shots .card-img img { height: 100%; }
.shots-count {
  position: absolute; top: 10px; right: 10px; padding: 2px 10px; border-radius: 999px;
  background: #000a; color: #fff; font-size: .8rem; font-variant-numeric: tabular-nums; pointer-events: none;
}
.shots-step {
  position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; padding: 0;
  border-radius: 50%; border: 0; background: #000a; color: #fff; font-size: 1.3rem; line-height: 1;
}
.shots-step[data-step="-1"] { left: 10px; }
.shots-step[data-step="1"] { right: 10px; }
@media (hover: none) { .shots-step { display: none; } }  /* touch screens swipe */
.card-caption {
  margin: 10px 14px 0; color: var(--muted); font-size: .92rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px 0; }
.card-actions { display: flex; gap: 8px; padding: 10px 14px 12px; }
.plate-no {
  font-family: ui-monospace, "JetBrains Mono", Consolas, monospace;
  font-weight: 800; letter-spacing: 2px; font-size: 1.05rem;
  background: #f8f4e3; color: #1a1a1a; border: 2px solid #1a1a1a;
  border-radius: 6px; padding: 2px 10px; align-self: flex-start;
  box-shadow: 0 1px 0 #000;
}
.plate-no.big { font-size: 1.8rem; padding: 6px 18px; }
.badge {
  font-size: .78rem; padding: 3px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
}
a.badge:hover { border-color: var(--accent); }
.tier-common    { --tier: var(--common); }
.tier-notable   { --tier: var(--notable); }
.tier-rare      { --tier: var(--rare); }
.tier-epic      { --tier: var(--epic); }
.tier-legendary { --tier: var(--legendary); }
.badge.tier { color: var(--tier); border-color: var(--tier); background: transparent; font-weight: 700; }

.upvote, .share { border-radius: 999px; padding: 6px 16px; font-size: .95rem; background: var(--panel-2); }
.upvote.on { background: var(--accent); color: #14161a; border-color: var(--accent); font-weight: 700; }
.share { color: var(--muted); white-space: nowrap; }
.sentinel { text-align: center; color: var(--muted); padding: 20px; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.empty a { text-decoration: underline; color: var(--text); }

/* shuffle: the one primary action, always under the thumb */
.fab, .dock .next {
  background: var(--accent); color: #14161a; font-weight: 800; border-radius: 999px;
  box-shadow: 0 6px 24px #000a; text-align: center;
}
.fab {
  position: fixed; z-index: 25; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom)); padding: 12px 26px; font-size: 1.05rem;
}
.dock {
  position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; display: flex; gap: 8px;
  justify-content: center; align-items: center;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.dock .upvote, .dock .share { padding: 12px 18px; }
.dock .next { flex: 0 1 300px; padding: 12px 20px; font-size: 1.05rem; box-shadow: none; }

/* browse tiles */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 16px; }
.tile { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; }
.tile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.tile-name { padding: 8px 10px 0; font-weight: 700; }
.tile-n { padding: 0 10px 10px; color: var(--muted); font-size: .8rem; }
.tile:hover { border-color: var(--accent); }

/* plate detail */
.detail, .more { max-width: 600px; margin: 16px auto 0; }
.more h2 { font-size: 1.05rem; margin: 28px 0 12px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumb { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.thumb .plate-no { position: absolute; left: 6px; bottom: 6px; font-size: .7rem; letter-spacing: 1px; padding: 1px 6px; }
.prevnext { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; margin-bottom: 4px; }
.prevnext a:hover { color: var(--text); }
.detail .tags { padding: 8px 0 0; }
.hero { width: 100%; border-radius: 12px; margin: 12px 0; border: 1px solid var(--line); }
.carousel { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; margin: 12px 0 6px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel .hero { flex: 0 0 100%; margin: 0; scroll-snap-align: center; object-fit: contain; }
.carousel-nav { display: flex; justify-content: center; align-items: center; gap: 14px; margin-bottom: 12px; color: var(--muted, #8b949e); font-size: 14px; }
.carousel-nav button { padding: 2px 12px; font-size: 18px; line-height: 1.2; }
.detail-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.detail-head h1 { margin: 0; }
.caption { color: var(--text); font-style: italic; }
.rarity-card {
  background: var(--panel); border: 1px solid var(--tier, var(--line));
  border-radius: 12px; padding: 16px 18px; margin-top: 18px;
}
.rarity-card h2 { margin: 0 0 12px; color: var(--tier); }
.rarity-card .score { color: var(--muted); font-size: 1rem; font-weight: 400; }
.stat { display: grid; grid-template-columns: 140px 1fr 52px; gap: 10px; align-items: center; margin: 6px 0; }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-val { text-align: right; font-variant-numeric: tabular-nums; font-size: .85rem; }
.bar { background: var(--panel-2); border-radius: 999px; height: 8px; overflow: hidden; display: block; }
.fill { background: var(--tier, var(--accent)); height: 100%; display: block; border-radius: 999px; }

@media (max-width: 900px) {
  .layout { display: block; }
  .rail {
    position: static; flex-direction: row; align-items: center; overflow-x: auto; max-height: none;
    margin: 0 -16px; padding: 10px 16px 2px; scrollbar-width: none;
  }
  .rail::-webkit-scrollbar { display: none; }
  .rail-head { display: none; }
  .column { max-width: 600px; margin: 0 auto; }
  /* edge-to-edge posts, like the apps do it */
  .grid .card { margin: 0 -16px; border-radius: 0; border-left: 0; border-right: 0; }
}

/* admin */
.login { max-width: 360px; margin: 60px auto; display: flex; flex-direction: column; gap: 12px; }
.login form { display: flex; flex-direction: column; gap: 10px; }
.error { color: #ff7b72; }
.dupe-note { color: #e3b341; margin: 0 0 8px; }
.dupe-actions { margin: 0 0 12px; }
.extra-shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.extra-shot { display: grid; gap: 6px; }
.extra-shot img { width: 100%; border-radius: 8px; }
.dupe-note a { color: inherit; text-decoration: underline; }
.admin-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-top: 20px; }
.admin-head .counts { color: var(--muted); }
.admin-head form { margin-left: auto; }
.admin-head form.upload + form { margin-left: 0; }
.upload .button {
  display: inline-block; cursor: pointer; border-radius: 8px; padding: 8px 12px;
  background: var(--accent); color: #14161a; font-weight: 700; border: 1px solid var(--accent);
}
.queue-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 14px 0; }
.queue-bar .primary { background: var(--accent); color: #14161a; font-weight: 700; border-color: var(--accent); }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 20px 0; }
.muted { color: var(--muted); }
.notice { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin: 14px 0; }
.review-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin: 14px 0; display: grid; gap: 14px;
  grid-template-columns: 220px 1fr auto; align-items: start;
}
.review-card img { width: 100%; border-radius: 8px; }
.review-card img.wide-img { grid-column: 1; }
.review-card.slim { grid-template-columns: 80px 1fr auto auto; align-items: center; padding: 8px 14px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; color: var(--muted); }
.fields label.wide { grid-column: 1/-1; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.actions .primary { background: var(--accent); color: #14161a; font-weight: 700; border-color: var(--accent); }
.actions .danger, .inline .danger { border-color: #ff7b72; color: #ff7b72; }
.inline { display: inline; }

@media (max-width: 720px) {
  .review-card { grid-template-columns: 1fr; }
  .stat { grid-template-columns: 110px 1fr 48px; }
}
.review-card:has(.htmx-request) { opacity: .5; pointer-events: none; transition: opacity .15s; }

/* review mode: one decision per screen, everything within thumb reach */
.rv-body { overflow: hidden; overscroll-behavior: none; }
.rv { height: 100vh; height: 100dvh; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; position: relative; }
.rv-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top)); }
.rv-exit, .rv-skip { color: var(--muted); padding: 8px 6px; white-space: nowrap; }
.rv-lanes { flex: 1; display: flex; gap: 6px; justify-content: center; }
.rv-lanes a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: .9rem; white-space: nowrap; }
.rv-lanes a.on { color: var(--text); border-color: var(--accent); }
.rv-progress { height: 3px; background: var(--line); flex: none; }
.rv-progress i { display: block; height: 100%; background: var(--accent); }
.rv-photo { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #000; cursor: zoom-in; }
.rv-photo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.rv-shots { flex: 1; min-height: 0; display: flex; gap: 6px; overflow-x: auto; background: #000; scroll-snap-type: x proximity; padding: 0 6px; }
.rv-shots figure { flex: 1 0 46%; margin: 0; min-width: 0; display: flex; flex-direction: column; scroll-snap-align: start; cursor: zoom-in; }
.rv-shots figure img { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.rv-shots figcaption { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: .8rem; }
.rv-info { flex: none; padding: 10px 14px 6px; text-align: center; }
.rv-line { margin: 6px 0 0; }
.rv-bar { flex: none; display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.rv-bar.two { grid-template-columns: 1fr 1fr; }
.rv-bar form { display: contents; }
.rv-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 56px; border-radius: 12px; font-weight: 700; font-size: 1rem; background: var(--panel); border: 1px solid var(--line); color: var(--text); cursor: pointer; text-align: center; padding: 6px 10px; }
.rv-btn small { font-weight: 400; font-size: .72rem; opacity: .8; }
.rv-btn.primary { background: var(--accent); border-color: var(--accent); color: #14161a; }
.rv-btn.danger { color: #ff8f8f; }
.rv-btn:disabled { opacity: .35; }
.rv:has(.htmx-request) .rv-bar { opacity: .5; pointer-events: none; }
.rv-undo { position: absolute; left: 50%; transform: translateX(-50%); top: calc(58px + env(safe-area-inset-top)); z-index: 5; display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 14px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: .9rem; white-space: nowrap; animation: rv-fade 7s forwards; }
.rv-undo button { border-radius: 999px; padding: 4px 14px; font-weight: 700; }
@keyframes rv-fade { 0%, 85% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }
.rv-done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; }
.rv-done .rv-btn { max-width: 320px; }
.rv-done-big { font-size: 3rem; margin: 0; }
.rv-sheet { position: fixed; inset: 0; z-index: 10; background: var(--bg); overflow-y: auto; padding: 0 14px 40px; }
.rv-sheet form { max-width: 640px; margin: 0 auto; }
.rv-sheet-head { position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 0 10px; background: var(--bg); }
.rv-sheet-photo { width: 100%; max-height: 30vh; object-fit: contain; background: #000; border-radius: 8px; margin-bottom: 10px; cursor: zoom-in; }
.rv-sheet .fields { margin-bottom: 14px; }
.rv-zoom { position: fixed; inset: 0; z-index: 20; background: #000; overflow: auto; cursor: zoom-out; }
.rv-zoom img { width: 250%; max-width: none; display: block; }
.rv-preload { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.review-cta { display: flex; flex-direction: column; align-items: center; margin: 14px 0 0; padding: 12px; border-radius: 12px; background: var(--accent); color: #14161a; font-weight: 800; }
.review-cta small { font-weight: 400; opacity: .8; }
