:root {
  --ink: #19191e;
  --grey: #78787f;
  --rule: #dee0e6;
  --paper: #ffffff;
  --panel: #f5f6f8;
  --ok: #5caf78;
  --wrong: #d65c54;
  --none: #96969e;
  --tint: 92, 175, 120;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e8e8ec;
    --grey: #9a9aa3;
    --rule: #34363d;
    --paper: #141519;
    --panel: #1d1f24;
    --none: #6c6c74;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 16px 48px;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}

header, #scores, #filters, .legend, #scenes { max-width: 1800px; margin: 0 auto; }

header { padding: 28px 0 8px; }
.title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h1 { margin: 0; font-size: 28px; letter-spacing: -0.01em; }
nav a { color: var(--ink); margin-right: 18px; font-weight: 600; }
.lead { max-width: 900px; color: var(--grey); margin: 8px 0 0; }

#scores { overflow-x: auto; padding: 16px 0 4px; }
table { border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 5px 12px; text-align: right; white-space: nowrap; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--grey); font-weight: 600; }
th.category { cursor: pointer; }
th.category:hover, th.category.active { color: var(--ink); text-decoration: underline; }
td:first-child, th:first-child { text-align: left; padding-left: 0; }
td.total { font-weight: 700; }
tbody tr { border-top: 1px solid var(--rule); }
.note { color: var(--grey); font-size: 13px; margin: 6px 0 0; }

#filters {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  padding: 12px 0;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
#filters label { color: var(--grey); font-size: 13px; }
select { margin-left: 4px; font: inherit; font-size: 14px; color: var(--ink); background: var(--panel); border: 1px solid var(--rule); border-radius: 6px; padding: 3px 6px; }
.toggle { cursor: pointer; }
#count { margin-left: auto; color: var(--grey); font-size: 13px; }
#filters label { white-space: nowrap; }
@media (max-width: 700px) {  /* one row to swipe through, so the bar stays on top without covering the screen */
  #filters { flex-wrap: nowrap; overflow-x: auto; gap: 16px; padding: 8px 0; }
  #count { margin-left: 0; white-space: nowrap; }
  .toggle { order: -1; }  /* the masks switch first, it is the one used most */
}

.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 0; color: var(--grey); font-size: 13px; }
.legend .chip { margin-left: 10px; }
.legend-note { margin-left: 14px; }

.chip {
  display: inline-block;
  min-width: 22px;
  padding: 0 5px;
  border-radius: 5px;
  border: 2px solid transparent;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.chip.ok { background: var(--ok); }
.chip.wrong { background: var(--wrong); }
.chip.none { background: var(--none); }
.chip.point { border-color: var(--ink); }

.scene { padding: 26px 0 18px; border-bottom: 1px solid var(--rule); }
.scene-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.scene-head h2 { margin: 0; font-size: 18px; }
.scene-head span { color: var(--grey); font-size: 13px; }
.prompt { margin: 4px 0 12px; max-width: 1100px; }

.expected { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 14px; }
.expected-label { font-size: 11px; letter-spacing: 0.2em; color: var(--grey); align-self: center; }
.expected div { text-align: center; }
.expected b { display: block; font-size: 24px; line-height: 1.1; }
.expected small { color: var(--grey); font-size: 12px; }

.tiles { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 1400px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); } }
@media (max-width: 700px) {
  .tiles { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 72vw; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .tile { scroll-snap-align: start; }
}

.tile { min-width: 0; }
.stack { position: relative; aspect-ratio: 1; background: var(--panel); border-radius: 6px; overflow: hidden; cursor: zoom-in; }
.stack img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stack .mask { display: none; }
body.masks .stack .mask { display: block; }
.tile-head { display: flex; justify-content: space-between; gap: 6px; margin: 6px 0 4px; font-size: 13px; font-weight: 600; }
.tile-head .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.score.full { color: var(--ok); }
.score.part { color: var(--wrong); }
.chips { display: flex; flex-wrap: wrap; gap: 3px; }

details { margin-top: 12px; color: var(--grey); font-size: 13px; }
summary { cursor: pointer; }
details p { color: var(--ink); max-width: 1100px; margin: 6px 0; }

.status { color: var(--grey); padding: 40px 0; }
#more { height: 1px; }

#viewer { position: fixed; inset: 0; z-index: 10; background: rgba(10, 10, 14, 0.82); display: flex; align-items: center; justify-content: center; padding: 16px; }
#viewer[hidden] { display: none; }
.viewer-box { position: relative; display: flex; gap: 20px; width: min(1400px, 100%); max-height: 100%; background: var(--paper); border-radius: 10px; padding: 16px; overflow: auto; }
.viewer-picture { flex: 0 1 min(820px, 75vh); min-width: 0; }
.viewer-picture .stack { cursor: default; }
.viewer-nav { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-weight: 600; }
.viewer-nav button, .close { font: inherit; font-size: 20px; background: var(--panel); color: var(--ink); border: 1px solid var(--rule); border-radius: 6px; padding: 2px 12px; cursor: pointer; }
.close { position: absolute; top: 10px; right: 10px; }
.viewer-side { flex: 1 1 280px; min-width: 0; font-size: 14px; }
.viewer-side h3 { margin: 0 40px 2px 0; font-size: 18px; }
.viewer-side .exact { color: var(--grey); font-size: 12px; }
.viewer-side table { margin: 12px 0; width: 100%; }
.viewer-side td { padding: 3px 6px; }
.viewer-side .rewrite { color: var(--ink); }
.box { position: absolute; border: 1px solid transparent; }
.box:hover { border-color: #fff; outline: 1px solid #000; }
@media (max-width: 800px) { .viewer-box { flex-direction: column; } .viewer-picture { flex: none; } }
