/* Bellabu stills picker — dark, no chrome, 2px gutters, one-hand on 390x844. */

:root {
  --bg: #0a0a0b;
  --bg2: #0e0e10;
  --bg3: #141417;
  --line: #1e1e23;
  --line2: #2c2c33;
  --fg: #f4f4f5;
  --fg2: #d3d3d8;
  --mut: #8b8b93;
  --accent: #ffd60a;
  --accent-ink: #0a0a0b;
  --radius: 4px;
  --bar-h: 64px;
  --ease: 120ms ease-out;
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}
html.lb-open, html.panel-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.08);
  overscroll-behavior-y: none;
}

img { display: block; max-width: 100%; }
button { font-family: inherit; }
a { color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line2); border-radius: 6px;
  background: var(--bg3); color: var(--fg);
  font-size: 14px; font-weight: 500; letter-spacing: 0;
  cursor: pointer; touch-action: manipulation;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.btn:hover { background: #1c1c21; }
.btn:active { background: #222228; }
.btn.ghost { background: transparent; }
.btn.tiny { min-height: 44px; padding: 0 12px; font-size: 13px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.primary.on { background: transparent; color: var(--accent); }
.btn.filt.on { border-color: var(--accent); color: var(--accent); }
.btn:focus-visible, .chip:focus-visible, .back:focus-visible,
.expand:focus-visible, .lb-x:focus-visible, .lb-nav:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------------- gallery bar ---------------- */
.bar {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.bar-top {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px 4px 4px;
  min-height: 52px;
}
.back {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 44px; height: 44px;
  color: var(--fg2); text-decoration: none; font-size: 20px;
  border-radius: 6px;
}
.back:hover { background: var(--bg3); color: var(--fg); }
.bar-mid { flex: 1 1 auto; min-width: 0; }
.ttl {
  margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--fg2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prog { display: flex; align-items: center; gap: 8px; margin-top: 5px; padding-right: 2px; }
.prog-bar {
  position: relative; flex: 1 1 auto; height: 4px;
  background: #24242a; border-radius: 2px; overflow: hidden;
}
.prog-bar i {
  display: block; height: 100%; width: 0;
  background: var(--accent);
  transition: width var(--ease);
}
.prog-num { flex: 0 0 auto; font-size: 12px; color: var(--mut); white-space: nowrap; }
.prog-num b { color: var(--fg); font-weight: 700; }

.counts {
  display: flex; align-items: center; gap: 6px;
  padding: 0 12px 6px; font-size: 11.5px; color: var(--mut);
  white-space: nowrap; overflow: hidden;
}
.counts .sep { opacity: 0.5; }
.onlypill {
  margin-left: 4px; padding: 1px 6px; border-radius: 3px;
  background: rgba(255, 214, 10, 0.14); color: var(--accent);
  font-size: 10.5px; letter-spacing: 0.02em;
}
.hint {
  padding: 0 12px 7px;
  font-size: 11.5px; color: #6f6f78;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
}

/* ---------------- filters panel ---------------- */
.panel {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  background: var(--bg);
  opacity: 0; pointer-events: none;
  transition: opacity var(--ease);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.panel.open { opacity: 1; pointer-events: auto; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 6px 8px 6px 14px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.panel-head h2 {
  margin: 0; font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--fg2); font-weight: 600;
}
.panel-body {
  flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 14px 40px;
  overscroll-behavior: contain;
}
.scrim { position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, 0.6); }

.search {
  width: 100%; min-height: 46px;
  padding: 0 12px; font-size: 16px; /* 16px stops iOS zoom-on-focus */
  color: var(--fg); background: var(--bg3);
  border: 1px solid var(--line2); border-radius: 6px;
  -webkit-appearance: none; appearance: none;
}
.search::placeholder { color: #6b6b73; }
.search:focus { outline: none; border-color: var(--accent); }

.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.grp { margin-top: 20px; }
.grp h3 {
  margin: 0 0 8px; font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--mut); font-weight: 600;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 12px;
  border: 1px solid var(--line2); border-radius: 999px;
  background: var(--bg3); color: var(--fg2);
  font-size: 13px; line-height: 1; cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.chip .cn { color: var(--mut); font-size: 11px; font-variant-numeric: tabular-nums; }
.chip.on {
  background: var(--accent); color: var(--accent-ink);
  border-color: var(--accent); font-weight: 600;
}
.chip.on .cn { color: rgba(10, 10, 11, 0.62); }

.select {
  width: 100%; min-height: 46px; padding: 0 10px;
  font-size: 16px; color: var(--fg);
  background: var(--bg3); border: 1px solid var(--line2);
  border-radius: 6px; -webkit-appearance: none; appearance: none;
}
.code {
  width: 100%; margin-top: 10px; padding: 10px;
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--fg2); background: var(--bg3);
  border: 1px solid var(--line2); border-radius: 6px;
  resize: vertical; word-break: break-all;
}
.code:focus { outline: none; border-color: var(--accent); }
.grp.share { border-top: 1px solid var(--line); padding-top: 18px; }

/* desktop: centred sheet */
@media (min-width: 900px) {
  .panel {
    inset: auto; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: min(720px, 92vw); max-height: 84vh;
    border: 1px solid var(--line2); border-radius: 10px;
    padding-top: 0;
  }
  .scrim { background: rgba(0, 0, 0, 0.72); }
}

/* ---------------- hash note ---------------- */
.hashnote {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: #1a1607; border-bottom: 1px solid #3a3210;
  font-size: 12.5px; color: var(--accent);
  flex-wrap: wrap;
}
.hashnote span { flex: 1 1 140px; }

/* ---------------- grid ---------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 2px;
  padding: 2px 0 0;
}
@media (min-width: 820px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }
}
/* judging needs face-sized frames: fewer, bigger columns */
@media (min-width: 1080px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1900px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.card {
  position: relative;
  background: var(--bg2);
  border: 2px solid #191a1d;
  border-radius: var(--radius);
  overflow: hidden;
  outline: none;
  scroll-margin: 96px;
}
.card:focus, .card:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  z-index: 2;
}
.card.done { border-color: var(--accent); }

.meta {
  display: flex; align-items: center; gap: 5px;
  height: 27px; padding: 0 7px;
  min-width: 0; overflow: hidden;
  color: var(--mut); font-size: 11px;
  white-space: nowrap;
}
.gname {
  flex: 0 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px; color: var(--fg2); letter-spacing: -0.01em;
}
.mc {
  flex: 0 0 auto;
  padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--line2);
  font-size: 10px; line-height: 1.35; color: var(--mut);
}
.mc.method { color: var(--fg2); border-color: #3a3a42; }
.sz { flex: 0 0 auto; margin-left: auto; font-size: 10.5px; color: #6f6f78; }
.meta .gname + .mc { margin-left: 2px; }
.premark {
  flex: 0 0 auto; display: none;
  padding: 1px 5px; border-radius: 3px;
  background: rgba(255, 214, 10, 0.14); color: var(--accent);
  font-size: 9.5px; letter-spacing: 0.04em; text-transform: uppercase;
}
.card.pre .premark { display: inline-block; }
/* narrow screens: the clipped cast chip looked broken; the group name matters more */
@media (max-width: 560px) {
  .meta .mc.cast { display: none; }
  .meta .sz { display: none; }
}

.frames {
  display: flex; gap: 2px;
  width: 100%; background: #000;
  align-items: stretch;
}
@media (min-width: 820px) {
  /* keep one huge 1-up card from stretching a whole desktop row */
  .frames { max-height: min(460px, 50vh); }
  /* a lone frame gets a narrower card and its natural height: no black bars, no giant row */
  .card:has(.fw:only-child) { max-width: 460px; }
  .card:has(.fw:only-child) .frames { max-height: min(620px, 62vh); }
}
.fw {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  container-type: inline-size;
  opacity: 1;
  transition: opacity var(--ease);
}
.frame {
  display: block; width: 100%; height: 100%;
  padding: 0; margin: 0; border: 0;
  background: #000; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.frame img {
  display: block; width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: none;
}
.frame:focus { outline: none; }

.check {
  position: absolute; top: 5px; left: 5px;
  display: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  font-size: 12px; font-weight: 800; line-height: 20px; text-align: center;
}
.fw.picked .check { display: block; }
.fw.picked::after {
  content: "";
  position: absolute; inset: 0;
  border: 2px solid var(--accent);
  pointer-events: none;
}
.card.done .fw:not(.picked) { opacity: 0.4; }

.expand {
  position: absolute; top: 0; right: 0;
  width: 44px; height: 44px;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding: 0; border: 0; background: none;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
.expand span {
  display: grid; place-items: center;
  width: 24px; height: 24px; margin: 4px 4px 0 0;
  border-radius: 50%;
  background: rgba(10, 10, 11, 0.62);
  color: #fff; font-size: 12px; line-height: 1;
  opacity: 0.72;
  transition: opacity var(--ease);
}
.expand:hover span { opacity: 1; }
@container (max-width: 118px) {
  .expand { display: none; }
}
.fw.missing .frame img { display: none; }
.fw.missing .frame::after {
  content: "no image";
  display: grid; place-items: center;
  width: 100%; height: 100%; min-height: 80px;
  color: #5a5a62; font-size: 10px; letter-spacing: 0.04em;
}

.more-wrap { display: flex; justify-content: center; padding: 14px 12px 8px; }
.more { min-width: 200px; }
.sentinel { height: 1px; }

.empty { padding: 60px 20px; text-align: center; color: var(--fg2); }
.empty h2 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.empty p { margin: 0 0 6px; font-size: 13px; }
.empty .dim { color: var(--mut); }
.empty.error h2 { color: #ff8a8a; }
.empty .btn { margin-top: 14px; }

/* ---------------- lightbox ---------------- */
.lb {
  position: fixed; inset: 0; z-index: 80;
  display: flex; flex-direction: column;
  background: #050506;
  max-height: 100dvh;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.lb[hidden] { display: none; }
.lb-top {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 10px;
  padding: 4px 4px 4px 14px;
  min-height: 48px;
}
.lb-idx {
  flex: 0 0 auto;
  padding: 3px 7px; border-radius: 4px;
  background: #16161a; color: var(--accent);
  font-size: 12px; font-weight: 700;
}
.lb-name {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 11.5px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--mut);
}
.lb-x {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--fg);
  font-size: 17px; cursor: pointer;
}
.lb-x:hover { background: #17171b; }
.lb-stage {
  position: relative;
  flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.lb-img {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 76px;
  display: grid; place-items: center;
  border: 0; background: rgba(10, 10, 11, 0.5);
  color: #fff; font-size: 26px; line-height: 1;
  cursor: pointer; border-radius: 6px;
  opacity: 0.9;
}
.lb-nav:hover { background: rgba(20, 20, 24, 0.9); }
.lb-nav.prev { left: 4px; }
.lb-nav.next { right: 4px; }
.lb-bot {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #141417;
  background: #0a0a0b;
}
.lb-bot .btn { min-width: 108px; }
.lb-file {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: right;
  font: 10.5px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #6f6f78;
}

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 6px);
  z-index: 90;
  max-width: min(92vw, 420px);
  padding: 10px 14px;
  border-radius: 6px;
  background: #f4f4f5; color: #0a0a0b;
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity var(--ease), transform var(--ease);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- landing ---------------- */
.land {
  max-width: 780px; margin: 0 auto;
  padding: calc(28px + env(safe-area-inset-top, 0px)) 14px calc(40px + env(safe-area-inset-bottom, 0px));
}
.land-h h1 {
  margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em;
}
.land-h h1 span { color: var(--mut); font-weight: 400; }
.land-sub { margin: 6px 0 0; font-size: 13.5px; color: var(--mut); }
.land-prog { margin: 22px 0 26px; }
.prog-bar.big { height: 6px; border-radius: 3px; }
.land-pnum { margin-top: 8px; font-size: 13px; color: var(--mut); }
.land-pnum b { color: var(--fg); font-weight: 700; }

.tiles { display: grid; gap: 8px; }
@media (min-width: 700px) { .tiles { grid-template-columns: repeat(3, 1fr); } }

.tile {
  display: block;
  padding: 16px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  transition: border-color var(--ease), background var(--ease);
}
.tile:hover { background: var(--bg3); border-color: var(--line2); }
.tile:active { background: #1a1a1f; }
.tile-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tile-t { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.tile-c { font-size: 11px; color: var(--mut); white-space: nowrap; }
.tile-sub { margin-top: 3px; font-size: 12px; color: var(--mut); }
.prog-bar.mid { height: 4px; margin: 14px 0 8px; }
.tile-p { font-size: 12px; color: var(--mut); }
.tile-p b { color: var(--fg); font-weight: 700; }

.land-foot { margin: 30px 0 0; font-size: 12px; color: #66666e; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------------- best picks (second round, 2026-11-17) ---------------- */
.best {
  margin: 18px 0 0;
  border-top: 2px solid var(--line);
  background: #08080a;
  padding: 0 0 72px;
}
.best-top {
  position: sticky; top: 0; z-index: 3;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 8px 8px 4px;
  background: linear-gradient(#08080a, rgba(8,8,10,0.92));
  border-bottom: 1px solid var(--line);
}
.best-h {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 6px 4px;
  color: var(--fg); font: inherit; text-align: left; cursor: pointer;
  min-height: 44px;
}
.best-h h2 { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; margin: 0; }
.best-chev { color: var(--mut); font-size: 11px; transition: transform var(--ease); }
.best-h[aria-expanded="false"] .best-chev { transform: rotate(-90deg); }
.best-n, .best-f { font-size: 11px; color: var(--mut); font-variant-numeric: tabular-nums; }
.best-n b, .best-f b { color: var(--fg2); font-size: 13px; }
.best-f b { color: var(--accent); }
.best-body { padding: 2px; }
.best-body[hidden] { display: none; }
.best-grid {
  display: grid; grid-template-columns: 1fr; gap: 2px;
}
@media (min-width: 700px) { .best-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .best-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.best-empty {
  margin: 26px 8px 40px; color: var(--mut); font-size: 13px;
}
.bcard { background: var(--bg2); border: 2px solid #191a1d; overflow: hidden; }
.bcard.is-final { border-color: var(--accent); }
.bmeta {
  display: flex; align-items: center; gap: 6px; height: 27px; padding: 0 7px;
  min-width: 0; overflow: hidden; white-space: nowrap;
}
.bgname {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px; color: var(--fg2);
}
.bshot {
  display: block; width: 100%; padding: 0; border: 0; margin: 0;
  background: #000; cursor: zoom-in; line-height: 0;
}
.bimg {
  display: block; width: 100%; height: auto; max-height: min(64vh, 720px);
  object-fit: contain; background: #000;
}
.bbot { display: flex; align-items: center; gap: 8px; padding: 6px 7px; }
.btn.final {
  flex: 0 0 auto; min-height: 36px; padding: 6px 12px;
  font-size: 10.5px; letter-spacing: 0.1em; font-weight: 700;
  border-color: var(--line2); color: var(--fg2);
}
.btn.final.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.bfile {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px; color: var(--mut);
}
.bestbtn {
  position: fixed; right: 10px; bottom: 12px; z-index: 40;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink);
  border: 0; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55); cursor: pointer;
}
.bestbtn[hidden] { display: none; }
.bestbtn b { font-variant-numeric: tabular-nums; }
/* picks.json is a non-selecting hint: grey dotted frame, never yellow */
.fw.sugg .frame::after {
  content: ""; position: absolute; inset: 0;
  border: 1px dashed #4a4a52; pointer-events: none;
}
.card.hint .premark { display: inline-block; background: #1b1b1f; color: var(--mut); }
.card.is-final { border-color: var(--accent); }
.card.is-final .meta::after {
  content: "FINAL"; flex: 0 0 auto; margin-left: 4px;
  padding: 1px 5px; border-radius: 3px; background: var(--accent); color: var(--accent-ink);
  font-size: 9px; font-weight: 800; letter-spacing: 0.06em;
}
@media (max-width: 560px) { .bbot .bfile { display: none; } }
.tile-f { margin-left: 6px; font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .btn.final { min-height: 44px; padding: 8px 14px; }
  .best-top .btn.tiny { min-height: 40px; }
}
