/* ── Reset & variables ─────────────────────────────────────────────────── */
:root {
  --bg:       #0d0d0d;
  --surface:  #161616;
  --border:   #252525;
  --text:     #e2e2e2;
  --muted:    #777;
  --accent:   #a78bfa;
  --radius:   6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ── Header ───────────────────────────────────────────────────────────── */
header {
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent);
  text-transform: uppercase;
}

/* ── Breadcrumb ───────────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
  flex-wrap: wrap;
}
.breadcrumb .sep { color: var(--border); }
.breadcrumb a { color: var(--text); }
.breadcrumb a:hover { color: var(--accent); }

/* ── Main container ───────────────────────────────────────────────────── */
main {
  padding: 1.5rem;
  max-width: 1800px;
  margin: 0 auto;
}

h1 {
  font-size: 1.6rem;
  font-weight: 300;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.count {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 400;
}

/* ── Grid ─────────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

/* ── Card ─────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  position: relative;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.card-thumb {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: #111;
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.no-thumb {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--border);
}

.card-info {
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.card-name {
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

/* ── Heart button ─────────────────────────────────────────────────────── */
.heart-btn {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: rgba(0,0,0,0.55);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: rgba(255,255,255,0.35);
  transition: color 0.15s, background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.heart-btn:hover  { color: #f87171; background: rgba(0,0,0,0.72); }
.heart-btn.active { color: #f87171; }

/* page heading row — model name + heart + count on one line */
.page-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.page-heading h1 {
  margin: 0;
}
.page-heading .count {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 400;
}

/* inline variant — sits next to a heading, not overlaid on a card */
.heart-btn.inline-heart {
  position: static;
  background: transparent;
  color: var(--muted);
  width: 1.8rem;
  height: 1.8rem;
  font-size: 1rem;
  flex-shrink: 0;
}
.heart-btn.inline-heart:hover  { color: #f87171; background: transparent; }
.heart-btn.inline-heart.active { color: #f87171; }

/* ── User nav ──────────────────────────────────────────────────────────── */
.user-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.75rem;
  flex-shrink: 0;
}
.nav-link {
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}
.nav-link:hover { color: var(--accent); }
.nav-btn {
  font-size: 0.82rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  padding: 0;
}
.nav-btn:hover { color: var(--text); }

/* ── Image grid (set page) ────────────────────────────────────────────── */
.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 3px;
}
.image-grid-item {
  aspect-ratio: 2 / 3;
  overflow: hidden;
  cursor: pointer;
  background: #111;
}
.image-grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.18s ease;
}
.image-grid-item:hover img { transform: scale(1.06); }

/* ── Lightbox ─────────────────────────────────────────────────────────── */
#lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
#lightbox.active { display: flex; }

#lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 0 60px rgba(0,0,0,0.8);
  user-select: none;
  -webkit-user-drag: none;
}

/* True-fullscreen tweaks */
#lightbox.fullscreen img {
  max-width:  100vw;
  max-height: 100vh;
  border-radius: 0;
  box-shadow: none;
}

.lb-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.12s, opacity 0.12s;
  z-index: 1001;
  font-size: 2.5rem;
  padding: 0.3rem 0.9rem;
  line-height: 1;
}
.lb-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
.lb-prev { left: 0.75rem; }
.lb-next { right: 0.75rem; }

/* Toolbar (counter + fullscreen + close) */
.lb-toolbar {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  z-index: 1001;
  background: rgba(0,0,0,0.5);
  border-radius: 99px;
  padding: 0.25rem 0.6rem;
}
.lb-counter {
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 3.5rem;
  text-align: center;
}
.lb-icon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
  border-radius: var(--radius);
  transition: color 0.12s;
}
.lb-icon-btn:hover { color: #fff; }
/* cover-pin button: turns gold when active */
.lb-icon-btn#lb-cover-btn.active { color: #fbbf24; }
/* slideshow button: turns accent when playing */
#lightbox.slideshow #lb-ss-btn { color: var(--accent); }

/* ── Slideshow progress bar ──────────────────────────────────────────── */
#lb-progress-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 1002;
  width: 0;
}

/* ── Search box (header) ─────────────────────────────────────────────── */
.header-search {
  margin-left: auto;
  position: relative;
}
.search-wrap {
  position: relative;
}
.search-icon {
  position: absolute;
  left: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.8rem;
  pointer-events: none;
  line-height: 1;
}
.search-input {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.38rem 0.75rem 0.38rem 1.9rem;
  font-size: 0.85rem;
  width: 220px;
  transition: border-color 0.15s, width 0.2s;
  outline: none;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus {
  border-color: var(--accent);
  width: 300px;
}

/* ── Typeahead dropdown ───────────────────────────────────────────────── */
.search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.55);
  z-index: 200;
  max-height: 440px;
  overflow-y: auto;
}
.sd-group {
  padding: 0.35rem 0.75rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.sd-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}
.sd-item:hover, .sd-item.active {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.sd-item img, .sd-no-thumb {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
  background: #111;
  display: block;
}
.sd-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.sd-name {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sd-meta {
  font-size: 0.75rem;
  color: var(--muted);
}
.sd-all {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: var(--accent);
  text-align: center;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.sd-all:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }

/* ── Search results page ─────────────────────────────────────────────── */
.search-section { margin-bottom: 2.5rem; }
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}
.empty-msg {
  color: var(--muted);
  padding: 2rem 0;
}

/* ── Login ────────────────────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  justify-content: center;
  padding-top: 5vh;
}
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.login-box h2 { font-size: 1.2rem; font-weight: 400; }
.login-box label { font-size: 0.85rem; color: var(--muted); display: block; margin-bottom: 0.25rem; }
.login-box input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.95rem;
  outline: none;
  margin-bottom: 0.75rem;
}
.login-box input:focus { border-color: var(--accent); }
.btn-primary {
  width: 100%;
  background: var(--accent);
  color: #0d0d0d;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { opacity: 0.9; }
.error-msg {
  font-size: 0.85rem;
  color: #f87171;
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

/* ── Responsive tweaks ────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .search-input { width: 130px; }
  .search-input:focus { width: 180px; }
  .search-dropdown { width: 96vw; right: -0.75rem; }
  main { padding: 1rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .image-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .lb-btn { font-size: 1.8rem; padding: 0.2rem 0.6rem; }
  .models-toolbar { gap: 0.5rem; }
}

/* ── Models toolbar (sort + letter filter) ───────────────────────────── */
.models-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
}

.sort-bar,
.letter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.pill-link {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 99px;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.pill-link:hover {
  color: var(--fg);
  background: var(--surface-2, #1e1e1e);
}
.pill-link.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(167, 139, 250, 0.08);
}

/* "New" badge on recently scanned cards */
.badge-new {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #34d399;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 99px;
  padding: 0.05rem 0.45rem;
  vertical-align: middle;
  margin-left: 0.25rem;
}

/* ── Continue watching ────────────────────────────────────────────────── */
.continue-watching {
  margin-bottom: 1.75rem;
}
.cw-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.cw-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
}
.cw-clear {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0.15rem 0.6rem;
  border-radius: 99px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.cw-clear:hover { color: #f87171; border-color: #f87171; }

.cw-strip {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.4rem;
  scrollbar-width: thin;
  scrollbar-color: var(--surface) transparent;
}
.cw-card {
  flex: 0 0 120px;
  text-decoration: none;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: opacity 0.14s;
}
.cw-card:hover { opacity: 0.8; }
.cw-thumb {
  width: 120px;
  height: 90px;
  overflow: hidden;
}
.cw-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}
.cw-info {
  padding: 0.3rem 0.4rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.cw-set {
  font-size: 0.75rem;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cw-model {
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Stats bar ────────────────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  width: fit-content;
}
.stats-item {
  font-size: 0.85rem;
  color: var(--muted);
}
.stats-item strong {
  color: var(--fg);
  font-weight: 600;
}
.stats-sep {
  color: var(--muted);
  opacity: 0.4;
}

/* ── Admin page ───────────────────────────────────────────────────────── */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.admin-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}
.admin-card--danger {
  border-color: rgba(248, 113, 113, 0.25);
}
.admin-card--warn {
  border-color: rgba(251, 191, 36, 0.3);
}
.admin-badge {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 99px;
  padding: 0.05rem 0.45rem;
  vertical-align: middle;
}
.admin-card-body {
  padding: 1rem 1.1rem 0.75rem;
  flex: 1;
}
.admin-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.4rem;
}
.admin-card-desc {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}
.admin-card-foot {
  padding: 0.75rem 1.1rem;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.admin-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.4rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.12s;
}
.admin-btn:hover { opacity: 0.85; }
.admin-btn--danger {
  background: #dc2626;
}

/* ── Tags ─────────────────────────────────────────────────────────────── */
.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.3);
  color: var(--accent);
  border-radius: 99px;
  font-size: 0.72rem;
  padding: 0.1rem 0.55rem;
  text-decoration: none;
  transition: background 0.12s;
  white-space: nowrap;
}
.tag-pill:hover { background: rgba(167, 139, 250, 0.22); }
.tag-pill.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tag-pill--sm {
  font-size: 0.65rem;
  padding: 0.05rem 0.4rem;
}
.tag-rm {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 0.75rem;
  line-height: 1;
  padding: 0;
  margin-left: 0.1rem;
  opacity: 0.7;
}
.tag-rm:hover { opacity: 1; }

/* Tag filter bar (model page) */
.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}
.tag-filter-label {
  font-size: 0.75rem;
  color: var(--muted);
}

/* Set-page tag section */
.set-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin: 1rem 0 0.5rem;
}
.set-tags-label {
  font-size: 0.75rem;
  color: var(--muted);
  margin-right: 0.15rem;
}
#tag-pills {
  display: contents;
}
.tag-add-form {
  display: inline-flex;
  gap: 0.25rem;
}
.tag-add-form input {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 99px;
  color: var(--text);
  font-size: 0.75rem;
  padding: 0.1rem 0.6rem;
  width: 8rem;
  outline: none;
}
.tag-add-form input:focus { border-color: var(--accent); }
.tag-add-form button {
  background: var(--accent);
  border: none;
  border-radius: 99px;
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1;
  padding: 0.15rem 0.55rem;
}

/* Tags on set cards */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.6rem;
}

/* ── Lightbox: pan & zoom ────────────────────────────────────────────── */
#lightbox.zoomed  img { cursor: grab; }
#lightbox.panning img { cursor: grabbing; }
#lightbox img { transform-origin: center center; }

/* ── Star ratings ────────────────────────────────────────────────────── */
.set-rating {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0 1.25rem;
}
.stars {
  display: flex;
  gap: 0.1rem;
}
.star {
  background: none;
  border: none;
  color: rgba(255,255,255,0.2);
  cursor: pointer;
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  transition: color 0.1s;
}
.star.filled,
.stars:hover .star { color: #fbbf24; }
.stars .star:hover ~ .star { color: rgba(255,255,255,0.2); }
.star:disabled { cursor: default; }
.rating-avg {
  font-size: 0.82rem;
  color: var(--muted);
}
/* Compact stars on model-page cards */
.card-stars {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.72rem;
  color: #fbbf24;
  margin-top: 0.15rem;
}
.card-stars-count {
  font-size: 0.68rem;
  color: var(--muted);
  margin-left: 0.1rem;
}

/* ── Related sets strip ──────────────────────────────────────────────── */
.related-sets {
  margin-top: 2.5rem;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 1.25rem;
}
.related-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.75rem;
}
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
}
.related-card {
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.12s, box-shadow 0.12s;
  display: flex;
  flex-direction: column;
}
.related-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.related-thumb {
  aspect-ratio: 3/4;
  overflow: hidden;
  background: var(--surface);
}
.related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.related-info {
  padding: 0.4rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.related-model {
  font-size: 0.65rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.related-name {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Storage stats card ─────────────────────────────────────────────── */
.storage-stats {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.3rem 1rem;
  margin: 0;
  font-size: 0.82rem;
}
.storage-stats dt { color: var(--muted); }
.storage-stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.storage-stats dt.storage-total,
.storage-stats dd.storage-total {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 0.3rem;
  margin-top: 0.1rem;
  font-weight: 600;
  color: var(--text);
}
.storage-count {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

/* ── Top Picks page ──────────────────────────────────────────────────── */
.picks-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.pick-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  transition: border-color 0.12s;
}
.pick-item:hover { border-color: var(--accent); }
.pick-rank {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  min-width: 2rem;
  text-align: right;
}
.pick-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  display: block;
  background: var(--bg);
}
.pick-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.pick-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}
.pick-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pick-name:hover { color: var(--accent); }
.pick-model {
  font-size: 0.75rem;
  color: var(--accent);
  text-decoration: none;
}
.pick-model:hover { text-decoration: underline; }
.pick-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.1rem;
}
.pick-stars { color: #fbbf24; font-size: 0.85rem; letter-spacing: -0.05em; }
.pick-avg   { font-size: 0.82rem; font-weight: 600; }
.pick-votes { font-size: 0.75rem; color: var(--muted); }
.pick-views { font-size: 0.75rem; color: var(--muted); margin-left: 0.25rem; }

/* ── Lightbox: image info overlay ───────────────────────────────────── */
.lb-info-overlay {
  position: fixed;
  bottom: 3.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.78);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 0.5rem 1rem;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  z-index: 1002;
  min-width: 220px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text);
  pointer-events: none;
}
.lb-info-overlay.visible { display: flex; }
#lb-info-name { font-weight: 600; word-break: break-all; }
#lb-info-dims, #lb-info-size { color: var(--muted); }
.lb-icon-btn.active { color: var(--accent); }

/* ── Keyboard shortcuts modal ───────────────────────────────────────── */
.kb-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kb-modal[hidden] { display: none; }
.kb-box {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: calc(var(--radius) * 2);
  padding: 1.25rem 1.5rem 1rem;
  min-width: 280px;
  max-width: 380px;
  width: 90vw;
}
.kb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.kb-title {
  font-weight: 700;
  font-size: 0.95rem;
}
.kb-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
}
.kb-list dt {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
  align-items: center;
}
.kb-list dd {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  align-self: center;
}
kbd {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-family: inherit;
  font-size: 0.72rem;
  color: var(--text);
}
.kb-tip {
  margin: 0.9rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

/* ── Set nav (prev/next set) ────────────────────────────────────────────── */
.set-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.4rem 0 1.2rem;
  font-size: 0.8rem;
}
.set-nav-btn {
  flex: 1;
  max-width: 40%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  padding: 0.3rem 0.6rem;
  transition: color 0.12s, border-color 0.12s;
}
.set-nav-btn:hover { color: var(--accent); border-color: var(--accent); }
.set-nav-filler { visibility: hidden; }
.set-nav-prev { text-align: left; }
.set-nav-next { text-align: right; }
.set-nav-model {
  flex: 0 0 auto;
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
}
.set-nav-model:hover { color: var(--accent); }

/* ── Set notes ──────────────────────────────────────────────────────────── */
.set-notes {
  margin: 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.set-notes-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.set-notes-input {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.88rem;
  font-family: inherit;
  line-height: 1.5;
  padding: 0.6rem 0.8rem;
  resize: vertical;
  transition: border-color 0.12s;
  width: 100%;
  box-sizing: border-box;
}
.set-notes-input:focus { outline: none; border-color: var(--accent); }
.set-notes-input[readonly] { opacity: 0.6; cursor: default; }
.set-notes-save {
  align-self: flex-end;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.3rem 0.9rem;
  transition: border-color 0.12s, color 0.12s;
}
.set-notes-save:hover { border-color: var(--accent); color: var(--accent); }
.set-notes-save:disabled { opacity: 0.5; cursor: default; }

/* ── Settings page ──────────────────────────────────────────────────────── */
.settings-grid { max-width: 480px; margin: 1rem 0 0; }
.settings-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: calc(var(--radius) * 2);
  padding: 1.25rem 1.5rem 1.5rem;
}
.settings-card-title { font-size: 1rem; font-weight: 700; margin: 0 0 1rem; }
.settings-msg {
  border-radius: var(--radius);
  font-size: 0.82rem;
  margin-bottom: 0.9rem;
  padding: 0.5rem 0.75rem;
}
.settings-msg--error { background: rgba(239,68,68,0.15); color: #f87171; }
.settings-msg--ok    { background: rgba(34,197,94,0.12); color: #4ade80; }
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.settings-form label { font-size: 0.78rem; color: var(--muted); }
.settings-input {
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  padding: 0.55rem 0.8rem;
  width: 100%;
  box-sizing: border-box;
}
.settings-input:focus { outline: none; border-color: var(--accent); }
.settings-btn {
  align-self: flex-start;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 0.4rem;
  padding: 0.55rem 1.2rem;
  transition: opacity 0.12s;
}
.settings-btn:hover { opacity: 0.88; }

/* ── Admin: user table + create form ────────────────────────────────────── */
.admin-card--wide { grid-column: 1 / -1; }
.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.user-table th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 0 0.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.user-table td { padding: 0.45rem 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.user-table-name { font-weight: 500; }
.user-table-actions { text-align: right; }
.admin-btn--sm { padding: 0.2rem 0.6rem; font-size: 0.75rem; }
.admin-card-foot--form { display: block; padding: 0.9rem 1rem; }
.create-user-form {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}
.admin-input {
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  padding: 0.4rem 0.7rem;
  flex: 1;
  min-width: 140px;
}
.admin-input:focus { outline: none; border-color: var(--accent); }

/* ── Invite page ────────────────────────────────────────────────────────── */
.invite-wrap {
  max-width: 360px;
  margin: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}
.invite-qr svg {
  display: block;
  width: 220px;
  height: 220px;
  border-radius: calc(var(--radius) * 2);
  background: #fff;
  padding: 8px;
}
.invite-url {
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
  max-width: 340px;
}
.invite-hint { font-size: 0.75rem; color: var(--muted); margin: 0; }
.invite-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; }
.invite-copy-link {
  display: inline-block;
  padding: 0.45rem 1rem;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.12s;
}
.invite-copy-link:hover { border-color: var(--accent); color: var(--accent); }
.invite-back { font-size: 0.8rem; color: var(--muted); margin: 0; }
.invite-back a { color: var(--accent); text-decoration: none; }

/* ── Set share ────────────────────────────────────────────────────────── */
.set-share {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1.25rem;
}
.set-share-btn {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0.3rem 0.9rem;
  transition: border-color 0.12s, color 0.12s;
}
.set-share-btn:hover { border-color: var(--accent); color: var(--accent); }
.set-share-btn:disabled { opacity: 0.5; cursor: default; }
.set-share-url {
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
  max-width: 340px;
}
.set-share-copy {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  transition: border-color 0.12s, color 0.12s;
}
.set-share-copy:hover { border-color: var(--accent); color: var(--accent); }

