/*
 * Pubquiz Teamcaptain-Wahl auf dem Handy: Bewerben, Wählen, Münze, Walze, Ergebnis (frontend/js/quizStage/captainPhone.js).
 * Teamfarbe kommt vom Teamrahmen (--pq-team, --pq-team-ink), nie allein: immer mit Haken, Text oder Form. Knöpfe und Zeilen mindestens
 * 44 px hoch, lesbar ab 320 px Breite. Bewegt wird nur transform und opacity.
 */

.pq-captain--phone {
  --pq-cap-team: var(--pq-team, var(--primary-color, #007cc1));
  --pq-cap-team-ink: var(--pq-team-ink, #fff);
  display: grid;
  align-content: start;
  gap: 0.9rem;
  width: 100%;
  max-width: 30rem;
  margin-inline: auto;
  padding: 0.4rem 0 1.2rem;
  text-align: center;
}
.pq-cap-title,
.pq-cap-headline {
  margin: 0;
  font-size: clamp(1.35rem, 6.2vw, 1.8rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.pq-cap-headline {
  font-size: clamp(1.5rem, 7vw, 2rem);
}
.pq-cap-hint,
.pq-cap-status,
.pq-cap-how,
.pq-cap-votes-line {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.35;
}
.pq-cap-hint,
.pq-cap-how {
  color: var(--muted, #3d4450);
}
.pq-cap-status {
  min-height: 1.35em;
  font-weight: 700;
}
.pq-cap-how {
  font-weight: 700;
  font-size: 1.05rem;
}

/* Restzeit: Text und Balken (transform) */
.pq-cap-timer {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}
.pq-cap-timer__text {
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pq-cap-timer__track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.pq-cap-timer__fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--pq-cap-team);
  transform-origin: left center;
}

/* Warten und Zuschauer/in */
.pq-cap-wait {
  margin: 0;
  padding: 2.2rem 0.6rem;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
}
.pq-cap-wait::before {
  content: "";
  display: block;
  width: 14px;
  height: 14px;
  margin: 0 auto 0.9rem;
  border-radius: 50%;
  background: var(--pq-cap-team);
  animation: pq-cap-pulse 1.4s ease-in-out infinite;
}
@keyframes pq-cap-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.15); }
}

/* Bewerben: zwei große Knöpfe */
.pq-cap-choices {
  display: grid;
  gap: 0.75rem;
}
.pq-cap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-width: 44px;
  min-height: 3.6rem;
  padding: 0.7rem 1rem;
  border: 3px solid var(--pq-cap-team);
  border-radius: 1rem;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.pq-cap-btn--yes {
  background: var(--pq-cap-team);
  color: var(--pq-cap-team-ink);
}
.pq-cap-btn--no {
  background: var(--bg-color, #fff);
  color: var(--text-color, #1a171b);
}
.pq-cap-btn:focus-visible,
.pq-cap-vote:focus-visible {
  outline: 3px solid var(--text-color, #1a1a1a);
  outline-offset: 3px;
}
.pq-cap-btn[aria-pressed="true"] {
  box-shadow: 0 0 0 3px var(--bg-color, #fff), 0 0 0 6px var(--text-color, #1a1a1a);
  transform: scale(1.02);
}
.pq-cap-check {
  display: inline-block;
  width: 1.1em;
  opacity: 0;
  transform: scale(0.4);
  transition: transform 0.18s ease, opacity 0.18s ease;
}
[aria-pressed="true"] > .pq-cap-check {
  opacity: 1;
  transform: scale(1);
}
.pq-cap-btn[aria-pressed="false"] > .pq-cap-check {
  display: none;
}

/* Wählen: eine Zeile je Bewerber/in */
.pq-cap-votes {
  display: grid;
  gap: 0.65rem;
}
.pq-cap-vote {
  position: relative;
  display: grid;
  grid-template-columns: 4rem 1fr;
  align-items: center;
  gap: 0.75rem;
  min-height: 4.8rem;
  padding: 0.5rem 0.9rem 0.7rem 0.6rem;
  overflow: hidden;
  border: 3px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 1rem;
  background: var(--bg-elev, #fff);
  color: var(--text-color, #1a171b);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s ease;
}
.pq-cap-vote[aria-pressed="true"] {
  border-color: var(--pq-cap-team);
  background: color-mix(in srgb, var(--pq-cap-team) 14%, var(--bg-elev, #fff));
  transform: scale(1.02);
}
.pq-cap-vote__face {
  display: grid;
  place-items: center;
  width: 4rem;
}
.pq-cap-vote__face .pq-figure--phone,
.pq-cap-crowned .pq-figure--phone {
  margin: 0 auto;
}
.pq-cap-vote__face .pq-figure--phone {
  --pq-k: 2.5px;
}
.pq-cap-vote__text {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}
.pq-cap-vote__name {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.pq-cap-tag {
  justify-self: start;
  padding: 0.05rem 0.55rem;
  border: 2px solid currentColor;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}
.pq-cap-vote__mine {
  display: none;
  font-size: 0.9rem;
  font-weight: 800;
}
.pq-cap-vote[aria-pressed="true"] .pq-cap-vote__mine {
  display: block;
}
.pq-cap-vote__bar {
  position: absolute;
  inset: auto 0 0 0;
  height: 6px;
  background: var(--pq-cap-team);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.pq-cap-vote[aria-pressed="true"] .pq-cap-vote__bar {
  transform: scaleX(1);
}

/* Auflösung: Bühne für Szene und Ergebnis (übereinander, ein Platz) */
.pq-cap-stagebox {
  display: grid;
  justify-items: center;
}
.pq-cap-stagebox > * {
  grid-area: 1 / 1;
  width: 100%;
}
.pq-cap-stagebox > [hidden] {
  display: none;
}
.pq-cap-scene {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.6rem;
}
.pq-cap-scenehost {
  display: grid;
  justify-items: center;
  width: 100%;
}

/* Münze */
.pq-coin-stage {
  position: relative;
  display: grid;
  justify-items: center;
  width: 100%;
  padding-top: 150px;
  perspective: 800px;
}
.pq-coin {
  position: relative;
  width: 132px;
  height: 132px;
  transform-style: preserve-3d;
  will-change: transform;
}
.pq-coin__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 6px solid var(--pq-cap-team);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3b0, #f2c230 55%, #c28a0c);
  box-shadow: inset 0 0 0 4px #fff6cf, inset 0 0 0 7px #b8860b, 0 6px 14px rgba(0, 0, 0, 0.25);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.pq-coin__face--back {
  transform: rotateX(180deg);
}
.pq-coin-shadow {
  position: absolute;
  top: 262px;
  left: 50%;
  width: 104px;
  height: 22px;
  margin-left: -52px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.4);
  filter: blur(4px);
  opacity: 0.55;
}
.pq-coin-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}
.pq-coin-legend > li {
  padding: 0.3rem 0.9rem;
  border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
  border-radius: 999px;
  background: var(--bg-elev, #fff);
  font-weight: 800;
  overflow-wrap: anywhere;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.pq-coin-legend.is-landed > li:not(.is-win) {
  opacity: 0.45;
}
.pq-coin-legend > li.is-win {
  border-color: var(--pq-cap-team);
  text-decoration: underline;
  text-decoration-color: var(--pq-cap-team);
  text-decoration-thickness: 0.18em;
  text-underline-offset: 0.2em;
  transform: scale(1.1);
}

/* Köpfe auf Münze und Walze (Größe über --pq-k) */
.pq-cap-head {
  --pq-ink: #16161d;
  flex: none;
  margin-bottom: 0;
}
.pq-coin .pq-cap-head {
  --pq-k: 7.2px;
}

/* Walze: drei Zeilen, in der Mitte steht die gelosten Person (Höhe der Zeile: --pq-reel-cell, in captainReel.js REEL_CELL) */
.pq-reel-window {
  --pq-reel-cell: 76px;
  position: relative;
  width: min(100%, 20rem);
  height: calc(var(--pq-reel-cell) * 3);
  margin-top: 0.4rem;
  overflow: hidden;
  border: 3px solid var(--pq-cap-team);
  border-radius: 1.1rem;
  background: var(--bg-elev, #fff);
}
.pq-reel-roll {
  padding-top: var(--pq-reel-cell);
  will-change: transform;
}
.pq-reel-cell {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  height: var(--pq-reel-cell);
  padding-inline: 0.9rem;
  text-align: left;
}
.pq-reel-cell .pq-cap-head {
  --pq-k: 5px;
}
.pq-reel-cell__name {
  min-width: 0;
  overflow: hidden;
  font-size: 1.3rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-reel-window::before,
.pq-reel-window::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  z-index: 2;
  height: var(--pq-reel-cell);
  pointer-events: none;
}
.pq-reel-window::before {
  top: 0;
  background: linear-gradient(to bottom, var(--bg-elev, #fff) 15%, transparent);
}
.pq-reel-window::after {
  bottom: 0;
  background: linear-gradient(to top, var(--bg-elev, #fff) 15%, transparent);
}
.pq-reel-frame {
  position: absolute;
  inset-inline: 0;
  top: var(--pq-reel-cell);
  z-index: 3;
  height: var(--pq-reel-cell);
  border-block: 4px solid var(--pq-cap-team);
  pointer-events: none;
}
.pq-reel-window.is-landed .pq-reel-frame {
  background: color-mix(in srgb, var(--pq-cap-team) 12%, transparent);
}

/* Ergebnis */
.pq-cap-result {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0.7rem;
}
.pq-cap-crowned {
  position: relative;
  display: inline-block;
  padding-top: 26px;
}
.pq-cap-crowned > [data-pq-crown] {
  position: absolute;
  top: 3px;
  left: 50%;
  z-index: 3;
  width: 58px;
  transform: translateX(-50%);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}
.pq-crown svg {
  display: block;
  width: 100%;
  height: auto;
}
.pq-cap-textrow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}
.pq-cap-textrow > [data-pq-crown] {
  flex: none;
  width: 44px;
}
.pq-cap-bar {
  width: min(100%, 18rem);
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, currentColor 14%, transparent);
}
.pq-cap-bar__fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--pq-cap-team);
  transform-origin: left center;
}
.pq-cap-votes-line {
  font-weight: 700;
}

/* Schalter „Avatare und Animationen“ aus (Klasse am Dokument, figures.js): keine Dauer-Animation */
.pq-figures-still .pq-cap-wait::before {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .pq-cap-wait::before {
    animation: none;
  }
  .pq-cap-btn,
  .pq-cap-check,
  .pq-cap-vote,
  .pq-cap-vote__bar,
  .pq-coin-legend > li {
    transition: none;
  }
}
