/* ------------------------- Pubquiz Schritt 5: Buzzer ------------------------- */
.pq-buzz {
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  padding: 0.75rem 0;
  text-align: center;
}
.pq-buzzer {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 0.2rem;
  width: min(82vw, 22rem);
  aspect-ratio: 1;
  /* Feste Rückfälle vor color-mix() (iOS < 16.2); mit var() greift erst der Block @supports not (color-mix) unten. */
  border: 0.45rem solid #12142a;
  border: 0.45rem solid color-mix(in srgb, var(--pq-team, var(--primary-color, #007cc1)) 55%, #12142a);
  border-radius: 50%;
  background: #007cc1;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--pq-team, var(--primary-color, #007cc1)) 70%, #ffffff), var(--pq-team, var(--primary-color, #007cc1)) 62%);
  color: #ffffff;
  font: inherit;
  font-size: clamp(1.8rem, 9vw, 3rem);
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow: 0 0.55rem 0 #12142a, 0 1rem 2rem rgb(18 20 42 / 0.3);
  box-shadow: 0 0.55rem 0 color-mix(in srgb, var(--pq-team, var(--primary-color, #007cc1)) 50%, #12142a), 0 1rem 2rem rgb(18 20 42 / 0.3);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.2s ease;
}
/* Helle Teamfarben: dunkle Schrift (Kontrast ≥ 4,5:1), wie bei den Teamkacheln. */
.pq-buzzer.pq-team--green,
.pq-buzzer.pq-team--yellow,
.pq-buzzer.pq-team--orange {
  color: #1a1a1a;
}
.pq-buzzer:active:not(:disabled) {
  transform: translateY(0.4rem);
  box-shadow: 0 0.15rem 0 #12142a, 0 0.4rem 1rem rgb(18 20 42 / 0.3);
  box-shadow: 0 0.15rem 0 color-mix(in srgb, var(--pq-team, var(--primary-color, #007cc1)) 50%, #12142a), 0 0.4rem 1rem rgb(18 20 42 / 0.3);
}
.pq-buzzer:focus-visible {
  outline: 4px solid var(--text-color, #1a1a1a);
  outline-offset: 5px;
}
.pq-buzzer:disabled {
  cursor: default;
  filter: grayscale(0.85) opacity(0.5);
  box-shadow: none;
}
.pq-buzz-status {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}
/* Eigener Abstand zum Sieger („0,12 s zu spät“); leer, solange es keinen gibt (die Live-Region bleibt stehen). */
.pq-buzz-gap {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.pq-buzz-gap:empty {
  display: none;
}
/* Reaktionszeit der Person, die dran ist (Leinwand und Moderation), in der Zeile des Namens bzw. des Ergebnisses. */
.pq-buzz-time {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pq-stage-buzz {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  margin: 0.75rem 0;
  text-align: center;
}
.pq-buzz-call {
  margin: 0;
  font-size: clamp(1.6rem, 3.6vw, 3rem);
  font-weight: 900;
}
.pq-buzz-holder {
  display: grid;
  justify-items: center;
  padding: 0.6rem 2.2rem 0.8rem;
  border-radius: 1.4rem;
  background: var(--pq-team, var(--primary-color, #007cc1));
  color: #ffffff;
  box-shadow: 0 0.6rem 2rem rgb(18 20 42 / 0.3);
}
.pq-buzz-holder.pq-team--green,
.pq-buzz-holder.pq-team--yellow,
.pq-buzz-holder.pq-team--orange {
  color: #1a1a1a;
}
.pq-buzz-name {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 5rem);
  font-weight: 900;
  line-height: 1.1;
}
.pq-buzz-line {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 1.7rem);
  font-weight: 700;
}
.pq-buzz-wrong,
.pq-buzz-result {
  margin: 0;
  font-size: clamp(1.2rem, 2.4vw, 2rem);
  font-weight: 800;
}
/* Frühstart (E4): Hinweis auf Leinwand und Moderation, Sperre auf dem Handy. */
.pq-buzz-early {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 1.7rem);
  font-weight: 800;
}
.pq-stage .pq-stage-buzz--stage .pq-buzz-early,
.pq-stage > .pq-gate .pq-buzz-early {
  font-size: calc(3.6 * var(--pq-k));
}
.pq-buzz-status--early {
  padding: 10px 12px;
  border: 2px solid #a3162b;
  border-radius: 12px;
  background: #fde8ea;
  color: #a3162b;
}
/* Sperre bis zur nächsten Buzzerrunde (E4): Hinweis auf Leinwand und Moderation, Text statt nur Farbe auf dem Handy. */
.pq-buzz-locked {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 1.7rem);
  font-weight: 800;
}
.pq-stage .pq-stage-buzz--stage .pq-buzz-locked,
.pq-stage > .pq-gate .pq-buzz-locked {
  font-size: calc(3.6 * var(--pq-k));
}
.pq-buzz-status--locked {
  padding: 10px 12px;
  border: 2px solid #a3162b;
  border-radius: 12px;
  background: #fde8ea;
  color: #a3162b;
}
.pq-stage-buzz--presenter .pq-buzz-name {
  font-size: 1.8rem;
}
.pq-stage-buzz--presenter .pq-buzz-call {
  font-size: 1.3rem;
}

/* ---------- Pubquiz Handy-Gameplay: Teamrahmen, Kopfzeile, Zeitbalken (Spec 2026-10-14-pubquiz-handy-design.md) ---------- */
/* Ab dem Start: Seitengerüst weg (Logo, Code, „Live“, Reaktionen, Fußbereich, Folientitel); nur das Menü ⋯ bleibt oben rechts im Rahmen. */
#view-join.pq-focus .join-top {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  right: calc(env(safe-area-inset-right, 0px) + 14px);
  z-index: 40;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  box-shadow: none;
  min-height: 0;
}
#view-join.pq-focus .join-top > :not(#join-menu) {
  display: none !important;
}
#view-join.pq-focus .join-menu__btn {
  position: relative;
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.82);
  background: color-mix(in srgb, #ffffff 82%, transparent);
  color: #16161d;
}
/* Verbindung weg: roter Punkt am Menü (der Statustext selbst ist ausgeblendet). */
#view-join.pq-focus .join-top:has(#join-connection-status:not([data-state="open"])) .join-menu__btn::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d6336c;
  border: 2px solid #ffffff;
}
#view-join.pq-focus #join-secondary,
#view-join.pq-focus #join-question,
#view-join.pq-focus #join-slide-hint,
#view-join.pq-focus #join-instruction,
#view-join.pq-focus #join-privacy-line,
#view-join.pq-focus #join-made-with {
  display: none !important;
}
body:has(#view-join.pq-focus:not([hidden])) #app-footer {
  display: none;
}
#view-join.pq-focus .join-main {
  padding: calc(env(safe-area-inset-top, 0px) + 6px) calc(env(safe-area-inset-right, 0px) + 6px) calc(env(safe-area-inset-bottom, 0px) + 6px) calc(env(safe-area-inset-left, 0px) + 6px);
}
#view-join.pq-focus .join-question-card {
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  box-shadow: none;
  max-width: none;
}
#view-join.pq-focus .join-question-card__content,
#view-join.pq-focus .join-thumb {
  padding: 0;
  margin: 0;
}
.pq-frame {
  --pq-team: #4a5263;
  --pq-team-ink: #ffffff;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: calc(100dvh - 12px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  border: 6px solid var(--pq-team);
  border-radius: 18px;
  /* clip statt hidden: sonst klebt der Kopf (position: sticky) nicht. */
  overflow: clip;
  background: var(--surface, #ffffff);
}
#view-join.pq-focus #join-question-card {
  background: transparent !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
#view-join.pq-focus #join-quiz {
  padding: 0;
  min-height: 0;
}
.pq-frame-head > .pq-timebar {
  margin: 12px 12px 0;
  border-radius: 999px;
  overflow: hidden;
}
/* Antworten im Raster 2 × 2 (bei 3 bzw. 5–6 Antworten füllt die letzte Karte die Zeile). */
.pq-frame .quiz-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.pq-frame .quiz-options > .quiz-opt {
  margin: 0;
  min-height: 76px;
}
.pq-frame .quiz-options > .quiz-opt:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
.pq-frame-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--surface, #ffffff);
}
.pq-frame-headrow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 58px 10px 14px;
  background: var(--pq-team);
  color: var(--pq-team-ink);
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1.2;
}
.pq-frame-team {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pq-frame-round {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* Schmale Handys (320 px): „Spiel 2 · Runde 5/5“ soll nicht unter dem Menüknopf ⋯ liegen. */
@media (max-width: 360px) {
  .pq-frame-headrow {
    gap: 6px;
    padding-right: 62px;
    font-size: 0.95rem;
  }
}
.pq-frame-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 12px 16px;
}
.pq-frame-body .quiz-elimination-header:empty {
  display: none;
}
.pq-frame-body .quiz-elimination-question {
  margin: 0;
  font-size: 1.3rem;
  line-height: 1.25;
}
.pq-timebar {
  height: 10px;
  background: rgba(74, 82, 99, 0.2);
  background: color-mix(in srgb, var(--pq-team) 20%, transparent);
}
.pq-timebar__fill {
  height: 100%;
  width: 100%;
  background: var(--pq-team);
  /* Keine Überblendung: Die Breite wird in jedem Bild gesetzt; eine Überblendung ließe den Balken hinterherhinken und vor 0 enden. */
}
.pq-timebar.is-urgent .pq-timebar__fill {
  animation: pq-timebar-pulse 0.8s ease-in-out infinite alternate;
}
@keyframes pq-timebar-pulse {
  from { opacity: 1; }
  to { opacity: 0.45; }
}
.pq-frame.is-signal {
  animation: pq-frame-signal 0.3s ease-in-out 2;
}
@keyframes pq-frame-signal {
  50% { box-shadow: inset 0 0 0 10px var(--pq-team), 0 0 24px var(--pq-team); }
}
@media (prefers-reduced-motion: reduce) {
  .pq-timebar__fill { transition: none; }
  .pq-timebar.is-urgent .pq-timebar__fill { animation: none; }
  .pq-frame.is-signal { animation: none; box-shadow: inset 0 0 0 10px var(--pq-team); }
}

/* Handy-Gameplay: Buzzer ganz im Rahmen, Ring entfällt (der Zeitbalken zeigt die Zeit); eingeloggte Antwort deutlich über den Antworten. */
.pq-frame .pq-buzzer {
  width: min(78vw, 44dvh, 22rem);
  margin: 0 auto;
}
.pq-frame [data-pq-buzz-ring] {
  display: none;
}
.pq-frame [data-pq-logged],
.pq-frame .qe-answer-status {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 800;
  text-align: center;
  background: #eef0f4;
  background: color-mix(in srgb, var(--pq-team) 14%, #ffffff);
  color: #16161d;
}
/* Fehler bzw. zu spät: deutlich rot (Rand, Hintergrund, Symbol), „Erneut senden“ steht direkt darunter. */
.pq-frame .qe-answer-status.is-failed,
.pq-frame .qe-answer-status.is-late {
  background: #fde8ea;
  border: 2px solid #a3162b;
  color: #a3162b;
}
.pq-frame .qe-answer-status.is-failed::before,
.pq-frame .qe-answer-status.is-late::before {
  content: "✖ ";
}
.pq-frame .qe-answer-status.is-failed + .qe-answer-retry {
  align-self: center;
  margin: -4px 0 0;
}
/* Browser ohne color-mix() (iOS < 16.2): Regeln mit var() in color-mix() wären sonst ungültig (unset), der Rückfall davor griffe nicht. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  .pq-buzzer {
    border: 0.45rem solid #12142a;
    background: var(--pq-team, var(--primary-color, #007cc1));
    box-shadow: 0 0.55rem 0 #12142a, 0 1rem 2rem rgb(18 20 42 / 0.3);
  }
  .pq-buzzer:active:not(:disabled) {
    box-shadow: 0 0.15rem 0 #12142a, 0 0.4rem 1rem rgb(18 20 42 / 0.3);
  }
  .pq-timebar {
    background: rgba(74, 82, 99, 0.2);
  }
  .pq-frame [data-pq-logged],
  .pq-frame .qe-answer-status {
    background: #eef0f4;
  }
  .pq-frame .qe-answer-status.is-failed,
  .pq-frame .qe-answer-status.is-late {
    background: #fde8ea;
  }
}
.pq-frame .qe-phone-sound {
  font-size: 0.85rem;
  opacity: 0.8;
}
/* Mobiles Pubquiz: Ton-Schalter an fester Stelle (Lobby: ganz oben; Teamrahmen: unter Team und Runde im Kopf). */
.qe-phone-sound--head {
  justify-content: flex-end;
  margin: 0;
  padding: 6px 14px;
  min-height: 40px;
  opacity: 1;
}
.pq-frame-head > .qe-phone-sound--head {
  background: var(--surface, #ffffff);
  border-bottom: 1px solid var(--border, rgba(0, 0, 0, 0.12));
}

/* Handy-Gameplay: Ergebnis nach der Auflösung (Symbol und Text, Farbe nie allein). */
.pq-frame .pq-result-question {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  opacity: 0.85;
}
.pq-frame .pq-result {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #f1f3f7;
  color: #16161d;
}
.pq-frame .pq-result.is-right { background: #e3f6ea; }
.pq-frame .pq-result.is-wrong { background: #fde8ea; }
.pq-frame .pq-result.is-good { background: #fff4d6; }
.pq-frame .pq-result-title {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.1;
}
.pq-frame .pq-result.is-right .pq-result-title { color: #146c3a; }
.pq-frame .pq-result.is-wrong .pq-result-title { color: #a3162b; }
.pq-frame .pq-result-line {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.pq-frame .pq-result-standing {
  margin: 6px 0 0;
  padding-top: 10px;
  border-top: 1px solid rgba(22, 22, 29, 0.15);
  font-weight: 700;
}

/* Niedrige Handys (Sichtfläche bis 740 px, z. B. iPhone SE, 393 x 695 in Safari): Ergebniskarte enger, damit Figur samt Emote-Leiste
 * die Rangliste nicht unter die Kante schiebt (Schätzfragen mit langen Texten brauchen sonst bis zu 50 px mehr). */
@media (max-height: 740px) {
  .pq-frame .pq-result {
    gap: 3px;
    padding: 10px 14px;
  }
  .pq-frame .pq-result-title {
    font-size: 1.45rem;
  }
  .pq-frame .pq-result-line {
    font-size: 1rem;
  }
  .pq-frame .pq-result-standing {
    margin-top: 3px;
    padding-top: 6px;
  }
}

/* Handy-Gameplay: Antworttext bricht um statt abgeschnitten zu werden (lange Antworten wie „Melbourne“ im Raster 2 × 2). */
.pq-frame .quiz-opt[class*="pq-opt-"] {
  padding: 10px 12px;
  gap: 10px;
  white-space: normal;
  font-size: 1.15rem;
  line-height: 1.2;
}
.pq-frame .quiz-opt[class*="pq-opt-"] > span:not(.pq-mark) {
  flex: 1;
  min-width: 0;
  /* Nie mitten im Wort mit Trennstrich (Nutzermeldung 15.10.); passt ein Wort trotz kleinerer Schrift nicht, bricht es ohne Strich. */
  overflow-wrap: anywhere;
  -webkit-hyphens: manual;
  hyphens: manual;
}

/* Handy-Gameplay: eigener Avatar bzw. Foto neben der Standzeile */
.pq-frame .pq-result-standing {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pq-frame .pq-result-standing p {
  margin: 0;
}
.pq-frame .pq-me-avatar {
  flex: none;
  width: 48px;
  height: 48px;
  margin: 0;
  border-radius: 50%;
  overflow: hidden;
}
.pq-frame .pq-me-avatar > *,
.pq-frame .pq-me-avatar > svg,
.pq-frame .pq-me-avatar > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

