:root {
  --font: "Avenir Next", Avenir, Futura, "Century Gothic", "Segoe UI", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: #f2e2d6; font-family: var(--font); color: #4a3d63; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.top { text-align: center; padding: calc(34px + var(--safe-t)) 20px 18px; background: linear-gradient(#f7dccb, #f2e2d6); }
.top h1 { margin: 0; font-weight: 400; font-size: 28px; letter-spacing: .5em; padding-left: .5em; text-transform: uppercase; }
.sub { margin: 8px 0 0; font-size: 11px; letter-spacing: .28em; text-transform: uppercase; opacity: .7; }

.theme { padding: 36px 14px 40px; color: var(--ink); background: linear-gradient(var(--sky-top), var(--sky-bottom)); }
.theme header { text-align: center; margin-bottom: 22px; }
.theme .numeral { font-size: 12px; letter-spacing: .4em; opacity: .7; }
.theme h2 { margin: 6px 0 4px; font-weight: 400; font-size: 20px; letter-spacing: .32em; padding-left: .32em; text-transform: uppercase; }
.theme .chapter { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; opacity: .65; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 980px; margin: 0 auto; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  position: relative; border: 0; padding: 12px 10px 12px; border-radius: 18px; text-align: center; cursor: pointer;
  color: inherit; font: inherit; background: var(--card); box-shadow: 0 8px 24px rgba(40, 20, 60, .08);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.card .num { align-self: flex-start; font-size: 22px; font-weight: 500; letter-spacing: .06em; opacity: .85; line-height: 1; }
.card .pics { display: flex; align-items: center; justify-content: center; width: 100%; }
.card .pics img { width: 66%; aspect-ratio: 1; }
.card .pics img.alt { width: 34%; opacity: .85; }
.card .name { font-size: 12px; letter-spacing: .24em; text-transform: uppercase; }
.card .meta { font-size: 10px; letter-spacing: .14em; opacity: .65; font-variant-numeric: tabular-nums; }
.card .meta.bad { color: #c2414a; opacity: 1; }
.card .heart { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: inherit; font-size: 18px; cursor: pointer; opacity: .45; }
.card.picked .heart { opacity: 1; color: #e2566a; }
.card.picked { box-shadow: 0 0 0 2px #e2566a, 0 8px 24px rgba(40, 20, 60, .1); }

#picks {
  position: fixed; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; gap: 12px; align-items: center; padding: 10px 12px 10px 18px; border-radius: 999px; z-index: 5;
  background: rgba(255, 250, 243, .92); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(40, 20, 60, .14); font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  transition: opacity .3s, transform .3s; max-width: calc(100% - 28px);
}
#picks.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#picks-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#picks button + button { margin-left: -4px; opacity: .7; }
#picks button { border: 1px solid currentColor; background: none; color: inherit; font: inherit; letter-spacing: .2em; border-radius: 999px; padding: 6px 12px; cursor: pointer; }

#viewer {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; opacity: 0; pointer-events: none;
  background: linear-gradient(var(--sky-top, #f7dccb), var(--sky-bottom, #c6a3c4)); transition: opacity .3s;
}
#viewer.show { opacity: 1; pointer-events: auto; }
#viewer canvas { flex: 1; width: 100%; min-height: 0; touch-action: none; cursor: grab; }
#viewer .caption { text-align: center; padding: 8px 20px calc(30px + var(--safe-b)); }
#viewer .num { margin: 0; font-size: 12px; letter-spacing: .4em; opacity: .7; }
#viewer .name { margin: 6px 0; font-weight: 400; font-size: 26px; letter-spacing: .3em; padding-left: .3em; text-transform: uppercase; }
#viewer .meta { margin: 0; font-size: 11px; letter-spacing: .2em; opacity: .7; }
#viewer .hint { margin: 10px 0 0; font-size: 10px; letter-spacing: .3em; text-transform: uppercase; opacity: .5; }
#viewer-close {
  position: absolute; top: calc(12px + var(--safe-t)); right: 14px; z-index: 1; width: 46px; height: 46px; border-radius: 50%;
  border: 0; color: inherit; background: rgba(255, 250, 243, .55); display: grid; place-items: center; cursor: pointer;
}

/* back into the game (the gallery opens from its hidden developer panel) */
.top { position: relative; }
.back {
  position: absolute; left: 14px; top: calc(14px + env(safe-area-inset-top, 0px));
  padding: 8px 12px; border-radius: 999px; text-decoration: none; color: inherit;
  font-size: 12px; letter-spacing: .24em; text-transform: uppercase; opacity: .75;
  background: rgba(255, 255, 255, .45);
}

/* page links */
.pages { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin-top: 12px; padding: 0 12px; }
.pages a { color: inherit; text-decoration: none; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; opacity: .55; padding: 4px 2px; }
.pages a.on { opacity: 1; border-bottom: 1px solid currentColor; }

/* objects the QA pass flagged to drop: faded, with the reason */
.card.dropped { opacity: .45; }
.qa-drop { display: block; margin-top: 4px; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: #c4485a; line-height: 1.4; }

/* objects already in the game */
.live-mark {
  position: absolute; top: 14px; right: 40px; padding: 3px 8px 3px 7px; border-radius: 999px;
  background: #e9b949; color: #fffaf0; font-size: 9px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(233, 185, 73, .45);
}
.card.in-game { box-shadow: inset 0 0 0 1.5px #e9b949; }
