/* ==========================================================================
   Spot Them — styles. Theme tokens and shared components come from
   shared/style.css; the faces are Face Off's (faceoff/faces.js).

   The crowd is a grid of faces, three to six across depending on its size,
   under the description to find. A wrong tap shakes, the right one lights up.
   ========================================================================== */

.sp { position: relative; display: grid; gap: .7rem; max-width: 34rem; margin-inline: auto; padding-block: .5rem 2rem; }
.sp-title { font-size: clamp(1.6rem, 7vw, 2.2rem); text-align: center; }
.sp-sub { font-size: 1.2rem; text-align: center; }
.sp-note { font-size: 1.02rem; font-weight: 700; text-align: center; }
.sp-center { text-align: center; font-weight: 700; }
.sp-center-btn { justify-self: center; }
.sp-step { color: var(--muted); }
.sp-result { font-size: 1.5rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; }
.sp-sent { font-size: 1.15rem; font-weight: 900; text-align: center; color: var(--olive); }
:root[data-theme="dark"] .sp-sent { color: #b7cc6a; }
.sp-top { display: flex; align-items: center; gap: .6rem; }
.sp-top > .clock, .sp-time { margin-inline-start: auto; }
.sp-time { font-size: 1.9rem; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }

/* ---------- Menu ---------- */

.sp-menu { display: grid; gap: .5rem; }
.sp-menu__art { font-size: 1.8rem; text-align: center; }
.sp-tagline { font-size: 1.1rem; font-weight: 700; text-align: center; }
.sp-best { font-weight: 800; text-align: center; color: var(--muted); }
.sp-best.sp-center { font-size: 1.2rem; color: var(--olive); }
:root[data-theme="dark"] .sp-best.sp-center { color: #b7cc6a; }
.howto { max-width: 34rem; margin: 1.5rem auto 0; padding: .25rem 1rem; }
.howto summary { min-height: var(--tap); display: flex; align-items: center; font-weight: 800; cursor: pointer; }
.howto ol { display: grid; gap: .5rem; padding: 0 0 1rem; padding-inline-start: 1.4rem; list-style: decimal; }
.host--small .host__teta { width: 76px; }
.host--small .bubble { padding: .65rem .9rem; font-weight: 700; }

/* ---------- The description ---------- */

.sp-clues { position: sticky; top: .3rem; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .5rem .6rem; background: var(--surface); border: 3px solid var(--line); border-radius: 16px 14px 18px 13px; box-shadow: 0 4px 0 var(--line); }
.sp-clues__find { font-weight: 900; margin-inline-end: .1rem; }
.sp-clue { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .65rem; font-weight: 800; background: var(--sun); color: var(--ink); border-radius: 999px; }

/* ---------- The crowd ---------- */

.sp-crowd { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: .35rem; }
.sp-face { display: block; min-width: 0; padding: 0; overflow: hidden; aspect-ratio: 1; font: inherit; background: #fffdf7; border: 3px solid var(--line); border-radius: 12px 14px 11px 15px; cursor: pointer; transition: transform .12s, opacity .2s; }
.sp-face svg { display: block; width: 100%; height: 100%; }
.sp-face:active { transform: scale(.94); }
.sp-face.is-wrong { animation: sp-shake .35s; border-color: var(--tomato); }
.sp-face.is-right { outline: 4px solid var(--olive); outline-offset: 2px; transform: scale(1.06); }
.sp-crowd.is-done .sp-face:not(.is-right) { opacity: .35; }
.sp-crowd.is-done .sp-face { cursor: default; }

@keyframes sp-shake {
  0%, 100% { translate: 0; }
  20%, 60% { translate: -5px; }
  40%, 80% { translate: 5px; }
}

.sp-flash { position: fixed; inset-inline: 0; top: 40%; z-index: 10; margin: 0 auto; width: max-content; padding: .3rem 1rem; font-size: 1.6rem; font-weight: 900; color: #fff; background: var(--tomato); border-radius: 999px; pointer-events: none; animation: sp-pop .9s forwards; }
.sp-flash.is-good { background: var(--olive); }

@keyframes sp-pop {
  0% { opacity: 0; scale: .6; }
  20% { opacity: 1; scale: 1.1; }
  70% { opacity: 1; scale: 1; }
  100% { opacity: 0; translate: 0 -1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sp-face.is-wrong, .sp-flash { animation: none; }
}

/* ---------- The race ---------- */

.sp-race { display: grid; gap: .35rem; padding: 0; list-style: none; }
.sp-runner { display: grid; grid-template-columns: auto minmax(0, 6rem) 1fr auto; align-items: center; gap: .5rem; padding: .35rem .6rem; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; }
.sp-runner bdi { overflow: hidden; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.sp-runner b { font-variant-numeric: tabular-nums; }
.sp-runner.is-you { background: var(--surface-2); border-width: 3px; }
.sp-runner.is-done b { color: var(--olive); }
:root[data-theme="dark"] .sp-runner.is-done b { color: #b7cc6a; }
.sp-runner__bar { height: .6rem; overflow: hidden; background: var(--surface-2); border: 2px solid var(--line); border-radius: 999px; }
.sp-runner__bar i { display: block; height: 100%; background: var(--sea); transition: width .3s; }
