/* ==========================================================================
   Shoob Grave — stylesheet
   Visual language: dark charcoal, compact, card-driven, community-era web.
   Inspired by the source-site references: pill nav, colored stat blocks,
   dense card grids, small deliberate accents. Memorial, not melodrama.
   ========================================================================== */

:root {
  --bg: #0e0e10;
  --bg-raise: #17171a;
  --bg-panel: #1c1c20;
  --bg-inset: #121215;
  --line: #2a2a30;
  --line-soft: #232328;
  --text: #f2f2f4;
  --text-dim: #9b9ba4;
  --text-faint: #6d6d76;

  /* Stat block colors, straight from the reference leaderboard blocks */
  --stat-blue: #2f8fe0;
  --stat-green: #35b96b;
  --stat-gold: #e8a33d;
  --stat-red: #e05252;

  --accent: #b58ae6;           /* soft violet — event chips on the old site */
  --accent-strong: #8e5fd6;
  --candle: #e8a33d;           /* respects */
  --ok: #35b96b;
  --warn: #e8a33d;
  --danger: #e05252;

  --tier-t1: #8d9099; --tier-t2: #6faf6f; --tier-t3: #5f9fd6;
  --tier-t4: #b58ae6; --tier-t5: #e0a33d; --tier-t6: #e06666;
  --tier-tsx: #ff5f8f; --tier-ts: #58e0d0;

  --radius: 10px;
  --radius-sm: 6px;
  --maxw: 1180px;
  --font: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--accent-strong);
  color: #fff; padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(14,14,16,0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line-soft);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--candle); display: grid; place-items: center; }
.brand-name { font-weight: 800; letter-spacing: 0.06em; font-size: 15px; }
.brand-name b { color: var(--candle); font-weight: 800; }

.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a {
  color: var(--text-dim); font-weight: 600; font-size: 13px;
  padding: 6px 14px; border-radius: 999px; border: 1px solid transparent;
}
.mainnav a:hover { color: var(--text); text-decoration: none; background: var(--bg-raise); }
.mainnav a.active { color: var(--text); border-color: var(--line); background: var(--bg-raise); }

.topbar-side { display: flex; align-items: center; gap: 8px; }
.topbar-pill {
  font-size: 12px; font-weight: 700; color: var(--candle);
  background: var(--bg-raise); border: 1px solid var(--line-soft);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 20px 16px 56px; min-height: 60vh; }

.section { margin: 30px 0; }
.section-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line-soft); padding-bottom: 8px; margin-bottom: 16px;
}
.section-head h2 { margin: 0; font-size: 16px; letter-spacing: 0.02em; }
.section-head .icon { font-size: 15px; }
.section-head .sub { color: var(--text-faint); font-size: 12px; margin-left: auto; }

.panel {
  background: var(--bg-panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px;
}
.panel-inset { background: var(--bg-inset); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--bg-raise); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 8px 14px; font-size: 13px; font-weight: 600;
}
.btn:hover { border-color: var(--text-faint); text-decoration: none; }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.candle { background: transparent; border-color: var(--candle); color: var(--candle); }
.btn.candle:hover { background: rgba(232,163,61,0.12); }
.btn.danger { border-color: var(--danger); color: var(--danger); background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-raise); border: 1px solid var(--line-soft);
  color: var(--text-dim); border-radius: 999px; padding: 2px 10px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.chip.kind-event { color: var(--accent); border-color: rgba(181,138,230,0.4); }
.chip.kind-tier { color: var(--stat-gold); border-color: rgba(232,163,61,0.4); }
.chip.kind-type { color: var(--stat-blue); border-color: rgba(47,143,224,0.4); }
.chip.kind-year { color: var(--stat-green); border-color: rgba(53,185,107,0.4); }
.chip button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 12px; padding: 0 0 0 2px; line-height: 1; }

.crumbs { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-faint); margin-bottom: 14px; }
.crumbs a { color: var(--text-dim); background: var(--bg-raise); padding: 2px 10px; border-radius: 999px; }
.crumbs span.here { background: var(--accent-strong); color: #fff; padding: 2px 10px; border-radius: 999px; font-weight: 600; }

/* --------------------------------------------------------------------------
   Home — memorial hero
   -------------------------------------------------------------------------- */
.hero {
  text-align: center; padding: 40px 16px 30px; position: relative;
}
.hero-epitaph {
  color: var(--text-faint); font-size: 12px; letter-spacing: 0.34em;
  text-transform: uppercase; margin: 0 0 10px;
}
.hero h1 {
  margin: 0 0 6px; font-size: clamp(30px, 5.5vw, 46px); font-weight: 800;
  letter-spacing: 0.04em;
}
.hero h1 b { color: var(--candle); }
.hero-years { color: var(--text-dim); font-size: 14px; letter-spacing: 0.2em; margin: 0 0 14px; }
.hero-years::before, .hero-years::after { content: "—"; color: var(--line); margin: 0 10px; }
.hero p.lede { max-width: 560px; margin: 0 auto 20px; color: var(--text-dim); font-size: 14.5px; }
.hero-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* the one flourish: a quiet candle that keeps its flame */
.hero-candle { font-size: 22px; display: inline-block; margin-bottom: 8px; }
.hero-candle .flame { display: inline-block; animation: flicker 3.2s infinite ease-in-out; transform-origin: 50% 90%; }
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 1; }
  25% { transform: scale(1.06) rotate(-2deg); opacity: 0.92; }
  55% { transform: scale(0.97) rotate(1.5deg); opacity: 1; }
  80% { transform: scale(1.04) rotate(-1deg); opacity: 0.95; }
}

/* Featured fan */
.featured-fan {
  display: flex; justify-content: center; align-items: flex-end;
  gap: 0; padding: 8px 0 22px; min-height: 220px;
}
.featured-fan a.fan-card {
  display: block; width: 150px; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-inset);
  box-shadow: 0 10px 26px rgba(0,0,0,0.55);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}
.featured-fan a.fan-card img { width: 100%; height: auto; }
.featured-fan a.fan-card:nth-child(1) { transform: rotate(-9deg) translate(26px, 6px); z-index: 1; }
.featured-fan a.fan-card:nth-child(2) { transform: rotate(-4deg) translate(12px, 2px); z-index: 2; }
.featured-fan a.fan-card:nth-child(3) { transform: none; z-index: 3; width: 172px; }
.featured-fan a.fan-card:nth-child(4) { transform: rotate(4deg) translate(-12px, 2px); z-index: 2; }
.featured-fan a.fan-card:nth-child(5) { transform: rotate(9deg) translate(-26px, 6px); z-index: 1; }
.featured-fan a.fan-card:hover { transform: translateY(-8px); z-index: 5; box-shadow: 0 16px 34px rgba(0,0,0,0.7); }
.fan-respects {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 8px 6px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  color: var(--candle); font-size: 11.5px; font-weight: 700; text-align: center;
}

/* Stat blocks — reference-style colored counters */
.stat-blocks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
/*
 * Metric cards: value and label MUST occupy separate visual space. They are
 * flex rows in a column so they can never run together as "2Total Assets",
 * regardless of how long either string gets.
 */
.stat-block {
  border-radius: var(--radius-sm); padding: 16px 12px 13px; text-align: center; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 84px;
}
.stat-block .stat-value,
.stat-block .num {
  display: block; width: 100%;
  font-size: 26px; font-weight: 800; line-height: 1.05; letter-spacing: -0.01em;
}
.stat-block .stat-label,
.stat-block .label {
  display: block; width: 100%;
  font-size: 11px; font-weight: 700; opacity: 0.92; letter-spacing: 0.04em;
  text-transform: uppercase; line-height: 1.25;
}
.stat-block.blue { background: var(--stat-blue); }
.stat-block.green { background: var(--stat-green); }
.stat-block.gold { background: var(--stat-gold); }
.stat-block.red { background: var(--stat-red); }

/* Tier breakdown */
.tier-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; }
/*
 * Preserved by Tier: a large colored top region carries the COUNT, the lower
 * neutral section carries the tier LABEL. Two distinct blocks, never adjacent
 * inline text.
 */
.tier-cell {
  background: var(--bg-panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  text-align: center; padding: 0; overflow: hidden; display: flex; flex-direction: column;
  --tier-color: var(--line);
}
.tier-cell .tier-count,
.tier-cell .t-num {
  display: flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 8px 4px;
  background: var(--tier-color); color: #fff;
  font-size: 20px; font-weight: 800; line-height: 1;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.tier-cell .tier-label,
.tier-cell .t-label {
  display: block; padding: 7px 4px 8px;
  font-size: 10.5px; color: var(--text-faint); font-weight: 700;
  letter-spacing: 0.03em; text-transform: uppercase; line-height: 1.2;
}
.tier-cell[data-tier="t1"] { --tier-color: var(--tier-t1); }
.tier-cell[data-tier="t2"] { --tier-color: var(--tier-t2); }
.tier-cell[data-tier="t3"] { --tier-color: var(--tier-t3); }
.tier-cell[data-tier="t4"] { --tier-color: var(--tier-t4); }
.tier-cell[data-tier="t5"] { --tier-color: var(--tier-t5); }
.tier-cell[data-tier="t6"] { --tier-color: var(--tier-t6); }
.tier-cell[data-tier="tsx"] { --tier-color: var(--tier-tsx); }
.tier-cell[data-tier="ts"] { --tier-color: var(--tier-ts); }
.tier-cell[data-tier="banner"], .tier-cell[data-tier="frame"] { --tier-color: var(--stat-blue); }

/* --------------------------------------------------------------------------
   Archive cards
   -------------------------------------------------------------------------- */
.card-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.acard {
  background: var(--bg-panel); border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; color: var(--text);
  transition: transform 0.14s ease, border-color 0.14s ease;
}
.acard:hover { transform: translateY(-3px); border-color: var(--text-faint); text-decoration: none; }
.acard-media {
  background: var(--bg-inset); display: grid; place-items: center;
  aspect-ratio: 7 / 9; overflow: hidden; position: relative;
}
.acard-media.wide { aspect-ratio: 10 / 3; }
.acard-media.square { aspect-ratio: 1 / 1; }
.acard-media img { width: 100%; height: 100%; object-fit: contain; }
.acard-badges { position: absolute; top: 7px; left: 7px; display: flex; gap: 5px; }
.badge {
  font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px; background: rgba(0,0,0,0.72); color: var(--text-dim);
  border: 1px solid rgba(255,255,255,0.14);
}
.badge.tier { color: #fff; }
.badge.tier[data-tier="t1"] { background: var(--tier-t1); } .badge.tier[data-tier="t2"] { background: var(--tier-t2); }
.badge.tier[data-tier="t3"] { background: var(--tier-t3); } .badge.tier[data-tier="t4"] { background: var(--tier-t4); }
.badge.tier[data-tier="t5"] { background: var(--tier-t5); } .badge.tier[data-tier="t6"] { background: var(--tier-t6); }
.badge.tier[data-tier="tsx"] { background: var(--tier-tsx); } .badge.tier[data-tier="ts"] { background: var(--tier-ts); color: #08302c; }
.badge.anim { color: var(--stat-green); }
.acard-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 5px; flex: 1; }
.acard-name { font-weight: 700; font-size: 13.5px; line-height: 1.3; overflow-wrap: anywhere; }
.acard-meta { color: var(--text-faint); font-size: 11.5px; display: flex; flex-wrap: wrap; gap: 4px 8px; }
.acard-foot {
  margin-top: auto; padding-top: 7px; border-top: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center; font-size: 11.5px;
}
.acard-foot .maker { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.acard-foot .respects { color: var(--candle); font-weight: 700; white-space: nowrap; }

/* Most respected rows */
.mr-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mr-slot h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); text-align: center; }
.mr-empty { color: var(--text-faint); font-size: 12px; text-align: center; padding: 30px 6px; border: 1px dashed var(--line); border-radius: var(--radius); }

/* Banner + frame showcase */
.banner-show { display: block; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-soft); background: var(--bg-inset); }
.banner-show img { width: 100%; height: auto; }
.banner-caption { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--bg-panel); font-size: 12.5px; }
.frame-show { display: flex; gap: 18px; align-items: center; }
.frame-show .frame-img { width: 160px; flex: none; background: var(--bg-inset); border-radius: var(--radius); padding: 12px; border: 1px solid var(--line-soft); }

/* Maker tables */
.maker-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.maker-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.maker-table caption { text-align: left; font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.06em; padding-bottom: 8px; font-weight: 700; }
.maker-table td { padding: 7px 8px; border-top: 1px solid var(--line-soft); }
.maker-table td.rank { color: var(--text-faint); width: 28px; }
.maker-table td.val { text-align: right; color: var(--candle); font-weight: 700; }

/* Secondary stats */
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.mini-stat {
  background: var(--bg-panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 11px 13px; display: flex; flex-direction: column; gap: 4px;
}
.mini-stat .mini-value,
.mini-stat .v { display: block; font-size: 17px; font-weight: 800; line-height: 1.15; }
.mini-stat .mini-label,
.mini-stat .k {
  display: block; color: var(--text-faint); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em; line-height: 1.3;
}

/* --------------------------------------------------------------------------
   Archive page
   -------------------------------------------------------------------------- */
.search-row { display: flex; gap: 10px; margin-bottom: 10px; }
.search-row input[type="search"] {
  flex: 1; background: var(--bg-inset); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px;
}
.search-row input::placeholder { color: var(--text-faint); }
.search-hint { color: var(--text-faint); font-size: 11.5px; margin: 0 0 12px; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; min-height: 4px; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.filter-bar select {
  background: var(--bg-raise); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 8px; font-size: 12.5px; max-width: 170px;
}
.filter-bar .spacer { flex: 1; }
.result-count { color: var(--text-faint); font-size: 12px; }

.pager { display: flex; gap: 6px; justify-content: center; margin-top: 22px; align-items: center; }
.pager button {
  background: var(--bg-raise); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 5px 11px; cursor: pointer; font-size: 12.5px;
}
.pager button[aria-current="page"] { background: var(--accent-strong); border-color: var(--accent-strong); font-weight: 700; }
.pager button:disabled { opacity: 0.4; cursor: default; }

.empty-state { text-align: center; padding: 50px 16px; color: var(--text-dim); }
.empty-state .big { font-size: 34px; margin-bottom: 8px; }

/* --------------------------------------------------------------------------
   Detail page
   -------------------------------------------------------------------------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.detail-media { background: var(--bg-inset); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px; display: grid; place-items: center; }
.detail-media img, .detail-media video { max-height: 72vh; width: auto; max-width: 100%; }
.detail-title { margin: 0 0 4px; font-size: 24px; line-height: 1.2; overflow-wrap: anywhere; }
.detail-sub { color: var(--text-dim); margin: 0 0 14px; font-size: 13px; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }

.respect-box { display: flex; align-items: center; gap: 14px; margin: 18px 0; }
.respect-count { font-size: 22px; font-weight: 800; color: var(--candle); }
.respect-count .label { display: block; font-size: 10.5px; color: var(--text-faint); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.btn-respect {
  background: transparent; border: 1px solid var(--candle); color: var(--candle);
  border-radius: var(--radius-sm); padding: 10px 18px; font-weight: 800; font-size: 14px; cursor: pointer;
  display: inline-flex; gap: 10px; align-items: center;
}
.btn-respect:hover { background: rgba(232,163,61,0.12); }
.btn-respect .fkey {
  border: 1px solid var(--candle); border-radius: 4px; padding: 0 7px; font-size: 12px;
  background: rgba(232,163,61,0.15);
}
.btn-respect.paid { animation: respect-pop 0.4s ease; }
@keyframes respect-pop { 0% { transform: scale(1); } 40% { transform: scale(1.07); } 100% { transform: scale(1); } }

.meta-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.meta-table th { text-align: left; color: var(--text-faint); font-weight: 600; padding: 6px 12px 6px 0; width: 132px; vertical-align: top; white-space: nowrap; }
.meta-table td { padding: 6px 0; overflow-wrap: anywhere; }
.meta-table tr { border-top: 1px solid var(--line-soft); }
.meta-table tr:first-child { border-top: 0; }

details.tech { margin-top: 16px; }
details.tech summary { cursor: pointer; color: var(--text-dim); font-weight: 700; font-size: 12.5px; letter-spacing: 0.04em; }

.variant-strip { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.variant-strip a { width: 110px; }

/* --------------------------------------------------------------------------
   Leaderboards placeholder
   -------------------------------------------------------------------------- */
.lb-placeholder { text-align: center; padding: 44px 16px; }
.lb-placeholder .stone { font-size: 44px; }
.lb-categories { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-top: 24px; }
.lb-cat { background: var(--bg-panel); border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 16px 10px; color: var(--text-faint); font-size: 12.5px; font-weight: 700; }

/* --------------------------------------------------------------------------
   Upload workspace
   -------------------------------------------------------------------------- */
.gate { max-width: 420px; margin: 60px auto; text-align: center; }
.gate input[type="password"] {
  width: 100%; background: var(--bg-inset); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 11px 14px; font-size: 14px; margin: 12px 0;
}
.gate .error { color: var(--danger); font-size: 12.5px; min-height: 18px; margin: 4px 0 8px; }

.ws-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line-soft); margin-bottom: 18px; }
.ws-tabs button {
  background: none; border: 0; color: var(--text-dim); font-weight: 700; font-size: 13px;
  padding: 9px 14px; cursor: pointer; border-bottom: 2px solid transparent;
}
.ws-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--candle); }

.uploader-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 20px; align-items: start; }

.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--bg-inset);
  min-height: 240px; display: grid; place-items: center; text-align: center; padding: 18px;
  cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone.dragover { border-color: var(--candle); background: rgba(232,163,61,0.06); }
.dropzone .dz-icon { font-size: 30px; margin-bottom: 6px; }
.dropzone .dz-sub { color: var(--text-faint); font-size: 12px; }
.dz-preview { max-height: 300px; }
.dz-preview img, .dz-preview video { max-height: 280px; width: auto; max-width: 100%; margin: 0 auto; }
.dz-fileinfo { font-size: 11.5px; color: var(--text-dim); margin-top: 8px; overflow-wrap: anywhere; }

.tech-readout {
  width: min(100%, 430px);
  margin: 0 auto;
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  text-align: center;
}
.tech-readout .ro-name {
  width: 100%;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.tech-readout .ro-line {
  width: 100%;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}
.tech-readout .ro-line.sha {
  font-size: 10.5px;
}
.tech-readout .ro-thumb {
  display: block;
  width: auto;
  max-width: min(100%, 360px);
  max-height: 430px;
  margin: 8px auto 4px;
  object-fit: contain;
  border-radius: 8px;
}
.tech-readout .btn {
  width: 100%;
  max-width: 360px;
  margin-top: 4px;
}
.tech-readout b { color: var(--text); font-weight: 600; }

.field { margin-bottom: 11px; }
.field label { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: var(--text-dim); margin-bottom: 4px; }
.field label .req { color: var(--danger); }
.field input[type="text"], .field input[type="url"], .field input[type="number"], .field select, .field textarea {
  width: 100%; background: var(--bg-inset); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px;
}
.field textarea { min-height: 64px; resize: vertical; }
.field .err { color: var(--danger); font-size: 11.5px; margin-top: 3px; min-height: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.sticky-toggle {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  font-size: 10px; font-weight: 800; letter-spacing: 0.05em; color: var(--text-faint);
  border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; user-select: none;
}
.sticky-toggle input { display: none; }
.sticky-toggle.on { color: var(--candle); border-color: var(--candle); background: rgba(232,163,61,0.1); }

.tag-input { display: flex; flex-wrap: wrap; gap: 5px; background: var(--bg-inset); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 5px; }
.tag-input input { flex: 1; min-width: 120px; background: none; border: 0; color: var(--text); font-size: 13px; padding: 4px 6px; }
.tag-input input:focus { outline: none; }
.tag-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-raise); border: 1px solid var(--line-soft); border-radius: 999px; padding: 2px 9px; font-size: 12px; }
.tag-pill button { background: none; border: 0; color: var(--text-faint); cursor: pointer; padding: 0; font-size: 13px; }

.autocomplete { position: relative; }
.ac-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 3px);
  background: var(--bg-raise); border: 1px solid var(--line); border-radius: var(--radius-sm);
  max-height: 190px; overflow: auto; box-shadow: 0 10px 24px rgba(0,0,0,0.6);
}
.ac-list button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 7px 11px; font-size: 12.5px; cursor: pointer; }
.ac-list button:hover, .ac-list button.hl { background: var(--bg-panel); }
.ac-list .ac-new { color: var(--stat-green); }

.dup-warning { border: 1px solid var(--warn); border-radius: var(--radius); background: rgba(232,163,61,0.07); padding: 14px; margin-top: 14px; }
.dup-warning.exact { border-color: var(--danger); background: rgba(224,82,82,0.08); }
.dup-warning h4 { margin: 0 0 8px; font-size: 13px; }
.dup-match { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.dup-match img { width: 42px; height: 54px; object-fit: contain; background: var(--bg-inset); border-radius: 4px; flex: none; }
.dup-match .sim { color: var(--warn); font-weight: 700; margin-left: auto; white-space: nowrap; }
.dup-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.upload-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.upload-status { font-size: 12.5px; color: var(--text-dim); }
.upload-status.ok { color: var(--ok); font-weight: 700; }
.upload-status.err { color: var(--danger); }

.edit-results { margin-top: 14px; }
.edit-row { display: flex; gap: 12px; align-items: center; padding: 9px 4px; border-top: 1px solid var(--line-soft); font-size: 13px; }
.edit-row img { width: 44px; height: 56px; object-fit: contain; background: var(--bg-inset); border-radius: 4px; flex: none; }
.edit-row .er-meta { color: var(--text-faint); font-size: 11.5px; }
.edit-row .grow { flex: 1; min-width: 0; }

.rev-list { font-size: 12px; color: var(--text-dim); max-height: 200px; overflow: auto; }
.rev-list li { margin-bottom: 6px; }

/* Toasts & overlay */
.toast-host { position: fixed; bottom: 18px; right: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg-raise); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  color: var(--text); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.5); max-width: 340px; animation: toast-in 0.2s ease;
}
.overlay[hidden] {
  display: none !important;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 80; display: grid; place-items: center; padding: 20px; }
.overlay-panel { background: var(--bg-panel); border: 1px solid var(--line); border-radius: var(--radius); max-width: 620px; width: 100%; max-height: 80vh; overflow: auto; padding: 22px; }
.overlay-panel h3 { margin-top: 0; }


/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer { border-top: 1px solid var(--line-soft); background: var(--bg-inset); margin-top: 40px; }
.footer-inner { max-width: var(--maxw); margin: 0 auto; padding: 30px 16px 26px; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.footer-brand { font-weight: 800; letter-spacing: 0.06em; margin-bottom: 8px; }
.footer-brand b { color: var(--candle); }
.footer-col p { color: var(--text-faint); font-size: 12.5px; margin: 0; }
.footer-col h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin: 0 0 8px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 5px; }
.footer-col a { color: var(--text-dim); font-size: 12.5px; }
.footer-legal { border-top: 1px solid var(--line-soft); margin-top: 22px; padding-top: 16px; }
.footer-legal p { color: var(--text-faint); font-size: 11.5px; margin: 0 0 8px; }
.footer-powered a { color: var(--text-faint); font-size: 11px; letter-spacing: 0.04em; }
.footer-powered a:hover { color: var(--text-dim); }

/* Loading shimmer */
.loading { color: var(--text-faint); text-align: center; padding: 40px; font-size: 13px; }
.loading::after { content: "…"; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .tier-grid { grid-template-columns: repeat(5, 1fr); }
  .mr-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
  .uploader-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .stat-blocks { grid-template-columns: repeat(2, 1fr); }
  .maker-cols { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr; }
  .featured-fan a.fan-card { width: 108px; }
  .featured-fan a.fan-card:nth-child(3) { width: 126px; }
  .field-row { grid-template-columns: 1fr; }
  .frame-show { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 480px) {
  body { font-size: 13.5px; }
  .topbar-inner { padding: 8px 10px; gap: 8px; }
  .brand-name { display: none; }
  .mainnav a { padding: 6px 10px; font-size: 12.5px; }
  .topbar-pill { display: none; }
  .page { padding: 14px 10px 44px; }
  .tier-grid { grid-template-columns: repeat(3, 1fr); }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .featured-fan { min-height: 150px; }
  .featured-fan a.fan-card:nth-child(1), .featured-fan a.fan-card:nth-child(5) { display: none; }
  .stat-block .num { font-size: 19px; }
  .search-row { flex-direction: column; }
  .mr-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
}
@media (max-width: 340px) {
  .mr-grid { grid-template-columns: 1fr; }
  .stat-blocks { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tier-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --------------------------------------------------------------------------
   Leaderboards
   -------------------------------------------------------------------------- */
.lb-hero { text-align: center; padding: 26px 0 14px; }
.lb-hero h1 { margin: 0 0 6px; font-size: 30px; }
.lb-hero p { color: var(--text-dim); margin: 0 auto; max-width: 640px; font-size: 14px; }

/* Clear separation between the preserved Shoob snapshot and live archive data. */
.lb-section { margin-top: 26px; }
.lb-band {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px;
  border-left: 3px solid var(--accent); background: var(--bg-panel);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px;
}
.lb-band.historical { border-left-color: var(--stat-gold); }
.lb-band.live { border-left-color: var(--stat-green); }
.lb-band h2 { margin: 0; font-size: 17px; }
.lb-band .lb-tag {
  font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: 999px; background: var(--bg-raise); color: var(--text-dim);
}
.lb-band.historical .lb-tag { background: rgba(214,158,46,0.18); color: #e6b45a; }
.lb-band.live .lb-tag { background: rgba(56,161,105,0.18); color: #63c98d; }
.lb-band p { width: 100%; margin: 4px 0 0; color: var(--text-dim); font-size: 12.5px; }

.lb-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.lb-card {
  background: var(--bg-panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 14px 14px 10px; display: flex; flex-direction: column;
}
.lb-card h3 {
  margin: 0 0 4px; font-size: 14.5px; color: var(--accent); text-align: center;
}
.lb-card .lb-sub {
  text-align: center; font-size: 11px; color: var(--text-faint);
  border-bottom: 1px solid var(--line-soft); padding-bottom: 9px; margin-bottom: 9px;
}
.lb-rows { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 9px;
  background: var(--bg-raise); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px;
}
.lb-row .lb-rank { color: var(--text-faint); font-weight: 800; font-size: 11px; }
.lb-row .lb-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .lb-user a { color: var(--text); }
.lb-row .lb-value { font-weight: 800; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-row.top-1 .lb-rank { color: #e6b45a; }
.lb-row.top-2 .lb-rank { color: #c9ccd1; }
.lb-row.top-3 .lb-rank { color: #cd7f4e; }
.lb-more {
  margin-top: 10px; background: none; border: none; width: 100%;
  color: var(--accent); font-size: 12px; font-weight: 700; cursor: pointer; padding: 7px 0;
  border-top: 1px solid var(--line-soft);
}
.lb-more:hover { color: #fff; }
.lb-empty { color: var(--text-faint); font-size: 12.5px; text-align: center; padding: 10px 0; }

@media (max-width: 720px) {
  .lb-columns { grid-template-columns: 1fr; }
  .lb-hero h1 { font-size: 24px; }
}

/* --------------------------------------------------------------------------
   Upload — File Quality panel
   -------------------------------------------------------------------------- */
.quality-panel {
  background: var(--bg-panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 12px;
}
.quality-panel h4 { margin: 0 0 9px; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.q-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.q-item { background: var(--bg-raise); border-radius: var(--radius-sm); padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.q-item .q-k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); }
.q-item .q-v { font-size: 13px; font-weight: 700; word-break: break-word; }
.q-flags { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.q-flag { font-size: 12.5px; border-radius: var(--radius-sm); padding: 7px 10px; border-left: 3px solid var(--line); background: var(--bg-raise); }
.q-flag.ok { border-left-color: var(--ok); }
.q-flag.warn { border-left-color: var(--stat-gold); }
.q-flag.err { border-left-color: var(--danger); }

/* Recently Preserved (Edit Existing) */
.recent-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.recent-head h4 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); }
.recent-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-bottom: 18px; }
.recent-item {
  display: grid; grid-template-columns: 38px 1fr; gap: 9px; align-items: center; text-align: left;
  background: var(--bg-panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 7px 9px; cursor: pointer; color: var(--text); font: inherit;
}
.recent-item:hover { border-color: var(--accent); }
.recent-item img { width: 38px; height: 38px; object-fit: cover; border-radius: 4px; }
.recent-item .ri-blank { width: 38px; height: 38px; border-radius: 4px; background: var(--bg-raise); }
.recent-item .ri-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.recent-item .ri-name { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-item .ri-meta { font-size: 10.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Duplicate review queue */
.dupq-group { background: var(--bg-panel); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 10px; }
.dupq-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; }
.dupq-badge { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; padding: 3px 8px; border-radius: 999px; }
.dupq-badge.strong { background: rgba(229,62,62,0.18); color: #f08a8a; }
.dupq-badge.possible { background: rgba(214,158,46,0.18); color: #e6b45a; }
.dupq-badge.resolved { background: rgba(56,161,105,0.18); color: #63c98d; }
.dupq-signals { font-size: 11.5px; color: var(--text-faint); }

/* Series tab editable rows */
.series-row { display: grid; grid-template-columns: 1fr 120px auto; gap: 9px; align-items: center; margin-bottom: 8px; }
.series-row input { width: 100%; }
.series-row .sr-count { font-size: 12px; color: var(--text-faint); }

/* Keyboard-highlighted autocomplete option */
.ac-item.active { background: var(--bg-raise); color: #fff; }

/* Duplicate review — make the exact flag reason obvious at a glance. */
.dupq-group.strong { border-left: 3px solid rgba(229,62,62,0.72); }
.dupq-group.possible { border-left: 3px solid rgba(214,158,46,0.72); }
.dupq-reason {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: baseline;
  margin: 0 0 9px;
  font-size: 12px;
  color: var(--text);
}
.dupq-reason strong { font-weight: 800; }
.dupq-reason-copy { color: var(--text-dim); }
.dupq-signal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 11px;
}
.dupq-signal {
  display: block;
  padding: 6px 8px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.035em;
  text-align: center;
}
.dupq-signal.matched {
  background: rgba(214,158,46,0.10);
  border-color: rgba(214,158,46,0.34);
  color: #e6b45a;
}
.dupq-group.strong .dupq-signal.matched {
  background: rgba(229,62,62,0.10);
  border-color: rgba(229,62,62,0.32);
  color: #f08a8a;
}
.dupq-signal.different {
  background: rgba(255,255,255,0.025);
  color: var(--text-faint);
  opacity: 0.78;
}
.dupq-candidates-label {
  margin: 0 0 6px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
}
@media (max-width: 620px) {
  .dupq-signal-grid { grid-template-columns: 1fr; }
  .dupq-signal { text-align: left; }
}


/* Keeper management search + safe record cleanup */
.manage-search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 14px;
}
.manage-search-input { flex: 1 1 360px; }
.manage-count { white-space: nowrap; }
.manage-actions { display: flex; gap: 6px; justify-content: flex-end; }
.creator-row.manage-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 100px 90px minmax(180px, 1.2fr) auto;
  gap: 9px;
  align-items: center;
  margin-bottom: 8px;
}
.creator-row.manage-row input { width: 100%; }
.series-row.manage-row { grid-template-columns: minmax(180px, 1fr) 120px auto; }

/* Duplicate Review is deliberately case-by-case. */
.dupq-case {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.dupq-badge.relation {
  background: rgba(74, 144, 226, .16);
  color: #8dbbf0;
}
.dupq-compare {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.dupq-record {
  border: 1px solid var(--line-soft);
  background: rgba(255,255,255,.018);
  border-radius: var(--radius-sm);
  padding: 10px;
  min-width: 0;
}
.dupq-record-label {
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.dupq-record-main {
  display: grid;
  grid-template-columns: 58px minmax(0,1fr);
  gap: 10px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.dupq-record-main img,
.dupq-record-main .er-blank {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 4px;
}
.dupq-record-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.dupq-record-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dupq-record-copy .tiny { font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dupq-record-actions {
  display: flex;
  gap: 7px;
  margin-top: 10px;
}
.dupq-decision-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--text-dim);
  font-size: 12px;
}
.dupq-decision-note strong { color: var(--text); margin-right: 5px; }

@media (max-width: 820px) {
  .creator-row.manage-row { grid-template-columns: 1fr; }
  .series-row.manage-row { grid-template-columns: 1fr; }
  .manage-actions { justify-content: flex-start; }
  .dupq-compare { grid-template-columns: 1fr; }
}
