:root {
  --bg: #16171a; --panel: #1f2125; --line: #34373d; --text: #e9e9ea; --dim: #9a9da3;
  --pick: #58c28a; --standout: #e7b34f; --fault: #e06c6c; --accent: #7aa7f0;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 -apple-system, "Segoe UI", sans-serif; }
header { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); padding: 10px 18px; }
.bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
h1 { font-size: 16px; margin: 0; font-weight: 600; }
.spacer { flex: 1; }
.counters { display: flex; gap: 16px; align-items: baseline; color: var(--dim); font-variant-numeric: tabular-nums; }
.counters b { color: var(--text); font-size: 18px; }
.counters .off b { color: var(--standout); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
select, button { font: inherit; color: var(--text); background: #2a2d33; border: 1px solid var(--line); border-radius: 6px; padding: 5px 10px; }
button { cursor: pointer; }
button:hover { border-color: var(--dim); }
button.primary { background: var(--accent); border-color: var(--accent); color: #0d1320; font-weight: 600; }
details#bent { margin-top: 8px; color: var(--dim); }
details#bent summary { cursor: pointer; color: var(--standout); }
details#bent ul { margin: 6px 0 0; padding-left: 20px; max-height: 160px; overflow: auto; }
.help { margin: 8px 0 0; color: var(--dim); }
main { padding: 8px 18px 60px; }
section.scene { margin-top: 22px; }
section.scene > h2 { font-size: 15px; margin: 0 0 8px; display: flex; gap: 12px; align-items: baseline; }
section.scene > h2 small { color: var(--dim); font-weight: 400; }
.moment { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; margin-bottom: 8px; background: var(--panel); border-radius: 8px; }
.card { position: relative; width: 150px; border-radius: 6px; overflow: hidden; outline: 3px solid transparent; background: #000; }
.card img { display: block; width: 150px; height: 225px; object-fit: cover; cursor: zoom-in; opacity: .45; transition: opacity .12s; }
.card.on { outline-color: var(--pick); }
.card.on img, .card:hover img { opacity: 1; }
.card.off { outline-color: #5b3a3a; }
.card .tag { position: absolute; left: 4px; top: 4px; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #000b; }
.card .tag.standout { color: var(--standout); }
.card .tag.standard { color: var(--pick); }
.card .rank { position: absolute; left: 4px; bottom: 30px; font-size: 11px; padding: 1px 6px; border-radius: 10px; background: #000b; color: var(--dim); }
.card .flags { position: absolute; right: 4px; top: 4px; display: flex; gap: 3px; }
.card .flags i { width: 9px; height: 9px; border-radius: 50%; background: var(--fault); }
.card .flags i.soft { background: var(--standout); }
.card .flags i.pin { background: var(--accent); }
.card .row { display: flex; }
.card .row button { flex: 1; border: 0; border-radius: 0; padding: 4px 0; font-size: 12px; background: #24262b; color: var(--dim); }
.card .row button.active.keep { background: var(--pick); color: #06210f; }
.card .row button.active.drop { background: #7a3d3d; color: #fff; }
.card .name { position: absolute; right: 4px; bottom: 30px; font-size: 10px; color: #ccc; background: #000a; padding: 0 4px; border-radius: 3px; }
#viewer { position: fixed; inset: 0; z-index: 20; background: #0b0c0ef2; display: grid; grid-template-columns: 56px 1fr 56px 380px; }
#viewer[hidden] { display: none; }
#viewer .stage { display: flex; align-items: center; justify-content: center; min-width: 0; padding: 14px 0; }
#viewer .stage img { max-width: 100%; max-height: calc(100vh - 28px); object-fit: contain; }
#viewer .nav { border: 0; background: none; font-size: 44px; color: var(--dim); }
#viewer .close { position: absolute; right: 392px; top: 8px; border: 0; background: none; font-size: 30px; color: var(--dim); z-index: 2; }
#detail { background: var(--panel); border-left: 1px solid var(--line); padding: 16px; overflow: auto; }
#detail h3 { margin: 0 0 4px; font-size: 14px; word-break: break-all; }
#detail .faces { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
#detail .faces img { width: 168px; height: 168px; object-fit: cover; border-radius: 6px; }
#detail dl { display: grid; grid-template-columns: 96px 1fr; gap: 4px 10px; margin: 10px 0; }
#detail dt { color: var(--dim); }
#detail dd { margin: 0; }
#detail .fault { color: var(--fault); }
#detail p { margin: 8px 0; }
#detail .actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #000d; border: 1px solid var(--line); padding: 8px 14px; border-radius: 8px; z-index: 30; }
/* when marking blind, every photo is fully visible until it is dropped */
.blind .card img { opacity: 1; }
.blind .card.off img { opacity: .35; }

/* sign-in page */
input { font: inherit; color: var(--text); background: #2a2d33; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; }
input:focus-visible, button:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
body.login { display: flex; justify-content: center; padding: 12vh 18px; }
#login { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 340px; }
#login h1 { font-size: 20px; }
#login label { color: var(--dim); margin-top: 8px; }
#login button { margin-top: 14px; padding: 10px; }
.error { color: var(--fault); margin: 6px 0 0; }
/* phones: two photos per row, large view stacked over the buttons */
@media (max-width: 720px) {
  header { position: static; padding: 8px 12px; }
  .bar { gap: 8px 12px; }
  main { padding: 4px 10px 60px; }
  .moment { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card { width: auto; }
  .card img { width: 100%; height: auto; aspect-ratio: 2 / 3; }
  .card .row button { padding: 11px 0; font-size: 14px; }
  .card .rank, .card .name { bottom: 46px; }
  #viewer { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  #viewer .stage { grid-row: 1; padding: 0; min-height: 0; overflow: hidden; }
  #viewer .stage img { max-height: 100%; }
  #viewer .nav { position: absolute; top: 28%; z-index: 2; width: 44px; height: 64px; background: #0009; border-radius: 6px; font-size: 34px; color: #fff; padding: 0; }
  #viewer .prev { left: 4px; }
  #viewer .next { right: 4px; }
  #viewer .close { right: 8px; top: 8px; width: 40px; height: 40px; background: #0009; border-radius: 50%; color: #fff; padding: 0; }
  #detail { grid-row: 2; border-left: 0; border-top: 1px solid var(--line); max-height: 44vh; padding: 12px; }
  #detail .faces img { width: 84px; height: 84px; }
  #detail .actions button { flex: 1; padding: 13px; font-size: 15px; }
}
