/* Spot the AI (/spot/): site.css's paper and ink, the slate accent for what you press, gold only for the ✦.
   Motion is transform and opacity only, and all of it sits under prefers-reduced-motion: no-preference, so a reduced
   setting shows the end states. The ring is a pseudo-element that fades in, so it moves nothing either. */
:root { --ease: cubic-bezier(.2, .8, .2, 1); --shade: rgba(34, 29, 25, .1); }
@media (prefers-color-scheme: dark) {
  :root { --gold: #e2bd85; --shade: rgba(0, 0, 0, .45); }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
body.spot { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; overflow-x: hidden; }

/* ------------------------------------------------------------------ the bar: the name, then round, score and streak */
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 24px 0;
}
.bar .brand { font-family: var(--serif); font-size: 20px; color: var(--ink); text-decoration: none; }
.bar .brand:hover { text-decoration: underline; }
.status {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.status .round { color: var(--ink); font-weight: 500; }
.status .num { display: inline-block; min-width: 1ch; color: var(--ink); font-weight: 600; }
.status .mark { display: none; margin-right: 3px; color: var(--gold); }
.status .streak.hot .mark { display: inline-block; }
.status .streak.hot .num { color: var(--gold); }

/* ------------------------------------------------------------------ the views */
.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 24px 24px 40px;
}
.plain { text-align: center; }
.view.center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 0 64px;
  text-align: center;
}
.view.center h1 {
  margin: 0;
  font-size: clamp(40px, 9vw, 64px);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.view.center .line {
  max-width: 460px;
  margin: 18px 0 0;
  color: var(--body);
  font-size: 17px;
}
.button.big { min-height: 48px; margin-top: 32px; padding: 0 28px; font-size: 16px; }
.again { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.again .home-link { font-size: 15px; }
.view.center .total { font-variant-numeric: lining-nums tabular-nums; }

/* ------------------------------------------------------------------ a round: the brief, the question, the pair */
.play { display: flex; flex-direction: column; }
.brief {
  max-width: 760px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raise);
}
.kind {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.ask { margin: 0; color: var(--ink); font-size: 16px; line-height: 1.55; }
.question {
  margin: 28px 0 14px;
  font-size: 24px;
  line-height: 1.25;
}
.question:focus { outline: none; }

.pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: clamp(260px, 50vh, 460px);
  padding: 16px 6px 6px 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 1px 2px var(--shade);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* the ring: a second border outside the first, faded in */
.card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 2px solid var(--acc);
  border-radius: inherit;
  box-shadow: 0 0 0 4px var(--acc-soft);
  opacity: 0;
  pointer-events: none;
}
.card:focus { outline: none; }
.card:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }
.card .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 24px;
  padding-right: 16px;
}
.card .letter { color: var(--muted); font-size: 13px; font-weight: 600; letter-spacing: .04em; }
.card .tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--raise);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.card .tag.person { background: var(--acc-soft); color: var(--acc); }
.card .text {
  flex: 1;
  min-height: 0;
  margin-top: 8px;
  padding: 0 16px 16px 0;
  overflow-y: auto;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  -webkit-overflow-scrolling: touch;
}
/* more below: the text fades out at the bottom edge until it's scrolled to the end */
.card .text.more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 36px), transparent);
}

.play.picking .card:hover { border-color: color-mix(in srgb, var(--acc) 45%, var(--line)); }
.card.human::after { opacity: 1; }
.card.human { transform: translateY(-6px); box-shadow: 0 16px 36px -22px rgba(34, 29, 25, .5); }
.card.dim { opacity: .55; }
.play.revealed .card { cursor: default; }

/* after the pick: the one line, and Next */
.after {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  min-height: 76px;
  margin-top: 18px;
  padding: 14px 0;
}
.verdict { margin: 0; color: var(--ink); font-family: var(--serif); font-size: 22px; line-height: 1.3; }
.after .button { min-width: 120px; }

/* ------------------------------------------------------------------ the sparks: a layer over everything */
.sparks { position: fixed; inset: 0; z-index: 50; overflow: hidden; pointer-events: none; }
.sparks span { position: absolute; top: 0; left: 0; color: var(--gold); line-height: 1; will-change: transform, opacity; }

/* ------------------------------------------------------------------ narrow screens: the cards one above the other */
@media (max-width: 720px) {
  .bar { padding: 14px 18px 0; }
  .bar .brand { font-size: 18px; }
  .status { gap: 14px; font-size: 14px; }
  .stage { padding: 16px 18px 0; }
  .brief { padding: 12px 16px; }
  .ask { font-size: 15px; }
  .question { margin: 20px 0 12px; font-size: 21px; }
  .pair { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .card { height: auto; max-height: 46vh; max-height: 46svh; padding: 12px 4px 4px 18px; }
  .card .text { font-size: 16px; line-height: 1.6; padding-bottom: 12px; }
  .card.human { transform: translateY(-3px); }
  .after {
    min-height: 0;
    margin: 10px -18px 0;
    padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
    background: var(--paper);
  }
  /* once there's an answer (or the error), the line and Next stay on screen at the bottom */
  .play.revealed .after, .play.failed .after {
    position: sticky;
    bottom: 0;
    z-index: 5;
    min-height: 68px;
    border-top: 1px solid var(--line);
  }
  .verdict { font-size: 17px; }
  .after .button { min-width: 88px; }
}

/* ------------------------------------------------------------------ motion */
@media (prefers-reduced-motion: no-preference) {
  .card { transition: transform .35s var(--ease), opacity .35s ease, border-color .15s; }
  .card::after { transition: opacity .3s ease; }
  .play.picking .card:hover { transform: translateY(-2px); }
  .play.picking .card:active, .card.chosen { transform: scale(.985); }
  .card.human, .play.picking .card.human:hover { transform: translateY(-6px); }

  /* a deal comes in from the right, the brief first and the cards after it; it leaves to the left */
  .deal.in .brief { animation: fade-in .35s ease backwards; }
  .deal.in .question { animation: fade-in .35s ease .04s backwards; }
  .deal.in .card { animation: slide-in .48s var(--ease) .06s backwards; }
  .deal.in .card + .card { animation-delay: .14s; }
  .deal.out { animation: slide-out .26s cubic-bezier(.4, 0, .8, .4) forwards; }

  /* after the entry rules, and as specific, so it replaces the slide-in; it stays on until the next deal */
  .deal .pair .card.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
  .card .tag:not([hidden]) { animation: tag-in .3s var(--ease) .18s backwards; }
  .verdict.in, .after .button.in { animation: rise-in .3s var(--ease) backwards; }
  .after .button.in { animation-delay: .08s; }
  .status .num.bump { animation: bump .38s var(--ease); }
  .status .streak.hot .mark.bump { animation: star-in .45s var(--ease); }

  .view.center.in > * { animation: rise-in .5s var(--ease) backwards; }
  .view.center.in > :nth-child(2) { animation-delay: .06s; }
  .view.center.in > :nth-child(3) { animation-delay: .12s; }
  .view.center.in > :nth-child(4) { animation-delay: .18s; }
}
@media (max-width: 720px) and (prefers-reduced-motion: no-preference) {
  .card.human, .play.picking .card.human:hover { transform: translateY(-3px); }
  .play.picking .card:hover { transform: none; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(44px); } }
@keyframes slide-out { to { opacity: 0; transform: translateX(-56px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes tag-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes bump { from { opacity: 0; transform: translateY(.45em); } }
@keyframes star-in { from { opacity: 0; transform: scale(.4) rotate(-40deg); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-9px); }
  36% { transform: translateX(8px); }
  54% { transform: translateX(-6px); }
  72% { transform: translateX(4px); }
  88% { transform: translateX(-2px); }
}
