/* qsolve – Teilnehmeransicht (index.php, body.player-view).
   Liegt über css/qsolve.css und gilt nur für die Geräte der Klasse; Beamer und
   Spielsteuerung bleiben unberührt. Grundlage: Handy (eine Spalte), ab 900 px
   Seitenspalte mit Zeitring und vier Felder im Quadrat. Die Schrift kommt aus
   qsolve.css.

   14.11.2026: sachlicher statt „Eisdiele“ – keine Eistüte, kein wippendes Eis,
   schlichter Zeitring, weniger runde Ecken, Antworttext in normaler Stärke.
   FARBEN: keine Hex-Werte hier. Alles kommt aus dem Palettenblock --p-* am
   Anfang von css/qsolve.css; eine neue Palette ändert nur dort die Werte. */

body.player-view {
  --bg:            var(--p-grund);
  --bg-card:       var(--p-grund);
  --bg-warm:       var(--p-flaeche);
  --bg-elevated:   var(--p-flaeche);
  --text-primary:  var(--p-text);
  --text-secondary:var(--p-text-leise);
  --border:        var(--p-linie);
  --border-dark:   color-mix(in srgb, var(--p-text-leise) 45%, var(--p-linie));
  --accent:        var(--p-spalte);
  --accent-dark:   var(--p-spalte);
  --accent-bg:     var(--p-flaeche);
  --correct:       var(--p-richtig);
  --correct-bg:    color-mix(in srgb, var(--p-richtig) 10%, var(--p-grund));
  --wrong:         var(--p-falsch);
  --wrong-bg:      color-mix(in srgb, var(--p-falsch) 10%, var(--p-grund));
  --radius:        12px;
  --radius-sm:     8px;
}
body.player-view::before { display: none; }

/* ===== Anmelden und Warten ===== */
.player-view .join-card::before,
.player-view .btn-join::after { display: none; }
.player-view .join-card { border-radius: 14px; }
.player-view .form-input { font-size: 1.1rem; }
.player-view .form-input.code-input { font-weight: 600; letter-spacing: .22em; }
.player-view .form-input:focus { border-color: var(--p-spalte); box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-spalte) 18%, transparent); }
.player-view .form-input::placeholder { color: var(--border-dark); }
.player-view .btn-join { border-radius: 10px; font-size: 1.2rem; font-weight: 600; padding: 1rem; min-height: 54px; background: var(--p-spalte); color: var(--p-spalte-text); }

.sp-symbol { width: 64px; height: 64px; border-radius: 14px; margin-bottom: 1rem; }
.player-view .waiting-screen h2 { font-weight: 600; }

/* ===== Frage (Handy) =====
   Die Seitenspalte löst sich auf, ihre Teile ordnen sich über und unter die
   Antworten. */
.player-view .question-screen { min-height: 100dvh; padding: 1.25rem 1rem; gap: 14px; }
.sp-seite { display: contents; }
.sp-spiel { order: 2; flex: 1; display: flex; flex-direction: column; gap: 12px; width: 100%; min-width: 0; }
.player-view .question-header { order: 1; margin-bottom: 0; }

.player-view .question-counter {
  background: none; border: none; padding: 0;
  font-size: 1.2rem; font-weight: 500; color: var(--text-primary);
}

.player-view .timer-ring, .player-view .timer-ring svg { width: 60px; height: 60px; }
.player-view .timer-ring circle { stroke-width: 5; }
.player-view .timer-ring .timer-bg { stroke: var(--p-linie); }
.player-view .timer-ring .timer-fg { stroke: var(--p-spalte); }
.player-view .timer-ring .timer-fg.urgent { stroke: var(--p-falsch); }
.player-view .timer-text { font-size: 1.45rem; font-weight: 600; color: var(--p-text); }

.player-view .player-question-text {
  margin: 0; padding: 0; background: none; border: none;
  font-size: 1.5rem; font-weight: 500; line-height: 1.25;
}

.player-view .answers-grid { flex: 1; gap: 10px; grid-template-columns: minmax(0, 1fr); }

.player-view .answer-btn {
  border: none; border-radius: var(--radius); box-shadow: none;
  gap: 14px; padding: 10px 16px; min-height: 68px;
  color: var(--text-primary); font-family: var(--font-body);
  font-size: 1.6rem; font-weight: 400; line-height: 1.15;
  transition: transform .12s, outline-color .12s, opacity .2s;
  outline: 0 solid transparent;
}
.player-view .answer-btn.a { background: var(--p-a-hell); }
.player-view .answer-btn.b { background: var(--p-b-hell); }
.player-view .answer-btn.c { background: var(--p-c-hell); }
.player-view .answer-btn.d { background: var(--p-d-hell); }

.player-view .answer-btn:hover { transform: none; outline: 3px solid var(--ant); box-shadow: none; }
.player-view .answer-btn:focus-visible { outline: 3px solid var(--p-spalte); outline-offset: 2px; }
.player-view .answer-btn.selected { outline: 4px solid var(--p-spalte); box-shadow: none; }
.player-view .answer-btn.answered:not(.selected) { opacity: .45; }

.player-view .answer-btn .answer-label {
  width: 52px; height: 52px; border-radius: 9px;
  font-size: 1.9rem; font-weight: 600;
  background: var(--ant); color: #fff;
}
.player-view .answer-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.player-view #playerAnswerFeedback {
  margin: auto; width: 100%; max-width: 34rem;
  background: var(--p-flaeche); border: 1px solid var(--p-linie);
  border-radius: 14px; padding: 2.5rem 1.5rem !important;
}
.player-view #feedbackText { font-size: 1.5rem; font-weight: 500 !important; }

/* Eigener Stand */
.sp-ich {
  order: 3; display: flex; align-items: center; gap: .75rem;
  background: var(--p-spalte); color: var(--p-spalte-text);
  border-radius: var(--radius); padding: 10px 16px; font-size: 1.05rem;
}
.sp-ich:empty { display: none; }
#ichName { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
#ichPunkte::after { content: ' ·'; }
#ichPunkte, #ichPlatz { white-space: nowrap; }
#ichPlatz { margin-left: -.4rem; }

/* ===== Zwischenstand und Siegerehrung ===== */
.player-view .scoreboard-screen { min-height: 100dvh; padding: 1.5rem 1rem; }
#playerResult { text-align: center; margin-bottom: 1rem; }
#resultEmoji { font-size: 3.5rem; line-height: 1.1; }
#resultText { font-family: var(--font-display); font-size: 2rem; font-weight: 600; margin: .4rem 0; }
#resultPoints { font-size: 1.4rem; font-weight: 500; color: var(--accent); }
#playerRank { text-align: center; font-size: 1.15rem; color: var(--text-secondary); margin-bottom: 1.5rem; }

.player-view .scoreboard-screen .sp-spiel { order: 0; flex: none; align-items: center; }
.player-view .leaderboard-row { border-radius: var(--radius-sm); padding: .6rem .85rem; gap: .55rem; box-shadow: none; background: var(--p-grund); border-color: var(--p-linie); }
.player-view .lb-rank { width: 22px; }
.player-view .lb-avatar { width: 30px; height: 30px; }
.player-view .lb-points-change, .player-view .lb-score { min-width: 0; }
.player-view .leaderboard-row:nth-child(1) { background: var(--p-b-hell); border-color: var(--answer-b-border); }
.player-view .leaderboard-row:nth-child(2),
.player-view .leaderboard-row:nth-child(3) { background: var(--p-flaeche); border-color: var(--p-linie); }
.player-view .leaderboard-row.ich { outline: 3px solid var(--p-spalte); outline-offset: -1px; }
.player-view .lb-name { font-weight: 500; font-size: 1.1rem; min-width: 0; overflow-wrap: break-word; }
.player-view .lb-score { font-weight: 600; font-size: 1.1rem; }
.player-view .lb-rank { color: var(--text-primary); font-weight: 600; }
.player-view .lb-points-change { color: var(--p-richtig); font-size: .95rem; font-weight: 500; }
.player-view .lb-points-change.zero { color: var(--text-secondary); opacity: 1; }

.player-view .winner-title { font-weight: 600; }
.player-view .podium-name { font-weight: 500; font-size: 1.05rem; overflow-wrap: anywhere; }
.player-view .podium-score { font-weight: 600; font-size: 1rem; color: var(--p-text); }
.player-view .podium-bar { border-radius: 8px 8px 0 0; }
.player-view .podium-place:nth-child(2) .podium-bar { background: var(--p-b-hell); border-color: var(--answer-b-border); }
.player-view .podium-place:nth-child(1) .podium-bar,
.player-view .podium-place:nth-child(3) .podium-bar { background: var(--p-flaeche); border-color: var(--p-linie); }

/* ===== Ab 900 px: Seitenspalte und vier Felder im Quadrat ===== */
@media (min-width: 900px) {
  .player-view .question-screen,
  .player-view .scoreboard-screen {
    display: grid; grid-template-columns: 320px minmax(0, 1fr);
    padding: 0; gap: 0; align-items: stretch;
  }

  .sp-seite {
    /* Farben, die auf der dunklen Spalte lesbar bleiben (auch die, die das
       Skript als var(--correct) usw. direkt setzt) */
    --text-secondary: var(--p-spalte-leise);
    --accent: var(--p-spalte-text);
    --correct: var(--p-richtig-hell);
    --wrong: var(--p-falsch-hell);
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    gap: 36px; padding: 48px 32px;
    background: var(--p-spalte); color: var(--p-spalte-text);
  }

  .sp-spiel { gap: 24px; padding: 56px 40px 40px; }

  .player-view .question-header {
    flex-direction: column; flex-wrap: nowrap; gap: 36px; padding-right: 0;
  }
  .player-view .question-counter { font-size: 1.5rem; color: var(--p-spalte-text); }

  .player-view .timer-ring, .player-view .timer-ring svg { width: 200px; height: 200px; }
  .player-view .timer-ring circle { stroke-width: 3; }
  .player-view .timer-ring .timer-bg { stroke: var(--p-ring-grund); }
  .player-view .timer-ring .timer-fg { stroke: var(--p-ring); }
  .player-view .timer-ring .timer-fg.urgent { stroke: var(--p-falsch-hell); }
  .player-view .timer-text { font-size: 4.5rem; font-weight: 500; color: var(--p-spalte-text); }

  .player-view .player-question-text {
    text-align: center; font-size: clamp(1.8rem, 3.4vw, 3rem); line-height: 1.2;
  }

  .player-view .answers-grid { gap: 20px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .player-view .answer-btn {
    border-radius: 16px; gap: clamp(16px, 2vw, 24px); padding: 20px clamp(20px, 2.5vw, 32px); min-height: 130px;
    font-size: clamp(1.5rem, 2.9vw, 2.6rem);
  }
  .player-view .answer-btn .answer-label {
    width: clamp(56px, 6vw, 84px); height: clamp(56px, 6vw, 84px); border-radius: 12px;
    font-size: clamp(2rem, 3.5vw, 3.1rem);
  }

  .sp-ich { flex-direction: column; gap: 6px; width: 100%; background: none; padding: 0; text-align: center; font-size: 1.3rem; }
  #ichName { flex: none; width: 100%; font-size: 1.7rem; }
  #ichPunkte::after { content: none; }
  #ichPlatz { margin-left: 0; color: var(--p-spalte-leise); }

  .player-view .scoreboard-screen .sp-seite { justify-content: center; }
  .player-view .scoreboard-screen .sp-spiel { order: 0; padding: 56px 40px 40px; }
  #resultEmoji { font-size: 5rem; }
  #resultText { font-size: 2.6rem; }
  #resultPoints { font-size: 1.8rem; }
  #playerRank { font-size: 1.3rem; margin-bottom: 0; }
  .player-view .leaderboard { max-width: 820px; }
  .player-view .leaderboard-row { padding: .85rem 1.3rem; gap: 1rem; }
  .player-view .lb-avatar { width: 38px; height: 38px; }
  .player-view .lb-name, .player-view .lb-score { font-size: 1.3rem; }
}

/* Niedriger Bildschirm: kleinerer Ring, damit Zähler und Stand sichtbar bleiben. */
@media (min-width: 900px) and (max-height: 719px) {
  .player-view .timer-ring, .player-view .timer-ring svg { width: 150px; height: 150px; }
  .player-view .timer-text { font-size: 3.4rem; }
  .sp-seite { gap: 20px; padding: 28px 32px; }
  .player-view .question-header { gap: 20px; }
}
