/* Participant screen (phone) */

body.play {
  display: flex;
  flex-direction: column;
  transition: background 0.3s;
}

/* Full-screen colour for right/wrong so the result reads at a glance. */
body.play.is-correct {
  --muted: rgba(34, 39, 42, 0.75);
  background: var(--success);
  color: var(--ink);
}

body.play.is-wrong {
  --muted: rgba(255, 255, 255, 0.85);
  background: var(--wrong);
}

/* Page chrome. Until play.js has decided, no header and no footer show. The join form has the
   skip link, header and footer of the site design (body.site-design, see sha.css); every other view has
   the play bar (body.in-game) and no footer. */
body.play:not(.site-design) .skip-link,
body.play:not(.site-design) .page-header,
body.play:not(.site-design) .page-footer,
body.play:not(.in-game) .play-bar {
  display: none;
}

.play-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  padding-top: max(14px, env(safe-area-inset-top));
}

.play-bar .logo {
  height: 34px;
}

.play-bar__me {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: 0.9rem;
}

.play-bar__me span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.play-bar__me strong {
  padding: 0.2em 0.7em;
  border-radius: 999px;
  background: var(--rose);
  color: var(--ink);
}

.play-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 16px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.play-main > .view {
  flex: 1;
  flex-direction: column;
}

.panel {
  gap: 18px;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding-top: 6vh;
}

.panel--center {
  justify-content: center;
  align-items: center;
  padding-top: 0;
  text-align: center;
}

.panel h1 {
  font-size: clamp(1.6rem, 7vw, 2.2rem);
  overflow-wrap: anywhere;
}

.join-form {
  display: grid;
  gap: 16px;
}

.join-note {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.join-note a {
  color: var(--rose);
}

.input--pin {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-align: center;
}

/* Bigger, never smaller than 48px; the shape comes from .btn (the border is 1px, hence the -1px). */
.btn--large {
  min-height: 48px;
  padding: calc(1em - 1px) calc(2em - 1px);
  font-size: 1.15rem;
}

/* Lobby waiting dots */
.dots {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--rose);
  animation: pulse 1.2s infinite ease-in-out;
}

.dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes pulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* Reading countdown */
.countdown {
  display: grid;
  place-items: center;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--rose);
  color: var(--ink);
  font-size: 4.5rem;
  font-weight: 700;
}

.countdown.tick {
  animation: tick 0.4s ease-out;
}

@keyframes tick {
  from { transform: scale(1.15); }
  to { transform: scale(1); }
}

/* Answer buttons: 2×2 grid filling the screen */
.question {
  gap: 10px;
}

.question .eyebrow {
  text-align: center;
}

.answers {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
  min-height: 300px;
}

.answer {
  justify-content: center;
  border: 0;
  font: inherit;
  font-size: clamp(3.5rem, 18vw, 6rem);
  font-weight: 700;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s, opacity 0.2s;
}

.answer:active {
  transform: scale(0.96);
}

.answers.locked .answer {
  opacity: 0.3;
  pointer-events: none;
}

.answers.locked .answer.chosen {
  opacity: 1;
}

.big-badge {
  justify-content: center;
  width: 110px;
  height: 110px;
  font-size: 3.5rem;
  font-weight: 700;
}

/* Result */
.result__icon {
  display: grid;
  place-items: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--white);
  font-size: 4rem;
  font-weight: 700;
  animation: pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}

.is-correct .result__icon {
  color: #3f7a52;
}

.is-wrong .result__icon {
  color: var(--wrong);
}

.result h1 {
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  animation: pop 0.45s 0.1s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}

.result__points {
  color: var(--rose);
  font-size: 1.6rem;
  font-weight: 700;
}

.is-correct .result__points,
.is-wrong .result__points {
  color: inherit;
}

.result__correct {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.result__correct .badge {
  width: 2.2em;
  height: 2.2em;
  background: var(--tile-bg);
  color: var(--tile-fg);
  box-shadow: var(--tile-ring, none);
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.thanks {
  margin-top: 12px;
}
