/* Classroom quiz (js/quiz.js): the teacher's screen and the pupils' phones. */
:root { --qa0: #2f4b8c; --qa1: #2a9d8f; --qa2: #d6951a; --qa3: #b03a5b; }

/* ---------- teacher's screen ---------- */
body.quiz-on .line-arrows { visibility: hidden; }
.qz-card { width: min(560px, 100%); }
.qz-card.lobby { width: min(640px, 100%); }
.qz-title { margin: 2px 0 4px; font-size: 28px; text-wrap: balance; }
.qz-sub { margin: 0 0 14px; color: #666; font-size: 15px; }
.qz-small { display: block; color: #777; font-size: 13.5px; }
.qz-note { margin: 12px 0 0; padding: 8px 12px; background: #fff6e0; border-radius: 10px; color: #7a5a10; font-size: 13.5px; text-align: start; }
.qz-join { display: flex; align-items: center; justify-content: center; gap: 24px; flex-wrap: wrap; }
.qz-qr { padding: 10px; background: #fff; border: 1px solid #e3e3e3; border-radius: 14px; line-height: 0; }
.qz-qr img, .qz-qr canvas { display: block; width: 200px; height: 200px; }
.qz-join-text { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.qz-code { font-size: 54px; letter-spacing: .08em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.qz-url { font-size: 12.5px; color: #888; max-width: 260px; overflow-wrap: anywhere; }
.qz-players { margin-top: 16px; padding-top: 12px; border-top: 1px solid #eee; }
.qz-count { display: block; font-weight: 700; margin-bottom: 8px; }
.qz-names { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 34px; max-height: 160px; overflow-y: auto; }
.qz-name { padding: 5px 12px; border-radius: 99px; background: #f2f2f2; font-size: 15px; animation: gc-in .25s ease-out; }
.qz-actions { display: flex; gap: 8px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.qz-actions .gc-btn:disabled { opacity: .45; cursor: default; }

/* the question under the music */
.quiz-panel { margin-top: 12px; }
.qz-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.qz-qnum { font-weight: 700; font-size: 17px; }
.qz-answered { color: #555; font-size: 15px; margin-inline-start: auto; }
.qz-next { margin-inline-start: 8px; }
.qz-ring { position: relative; width: 52px; height: 52px; display: inline-flex; align-items: center; justify-content: center; }
.qz-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.qz-ring circle { fill: none; stroke-width: 4; }
.qz-ring-bg { stroke: #ececec; }
.qz-ring-fg { stroke: #222; stroke-dasharray: 119.4; stroke-linecap: round; transition: stroke-dashoffset .1s linear; }
.qz-sec { font-size: 19px; font-variant-numeric: tabular-nums; }
.qz-ring.hurry .qz-ring-fg { stroke: #c62a3a; }
.qz-ring.hurry .qz-sec { color: #c62a3a; }
.qz-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qz-tile, .qp-opt, .qp-chosen {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 14px;
  color: #fff; min-height: 72px; transition: opacity .3s, transform .3s, box-shadow .3s;
}
.t0 { background: var(--qa0); } .t1 { background: var(--qa1); } .t2 { background: var(--qa2); } .t3 { background: var(--qa3); }
.qz-sign { font-size: 30px; line-height: 1; opacity: .9; width: 32px; text-align: center; flex: none; }
.qz-label { direction: ltr; unicode-bidi: isolate; flex: 1; text-align: center; font-family: "Times New Roman", Georgia, serif; font-size: 34px; line-height: 1; }
.qz-label .rn { display: inline-flex; align-items: center; gap: 1px; color: inherit; }
.qz-label .figs { font-size: .5em; }
.qz-label .sec { font-size: .8em; }
.qz-votes { min-width: 34px; font-size: 22px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.qz-tile.off { opacity: .28; }
.qz-tile.right { box-shadow: 0 0 0 4px #fff, 0 0 0 7px #17914a; transform: scale(1.02); }
.qz-tile.right::after { content: "✓"; position: absolute; top: -12px; inset-inline-end: -10px; width: 30px; height: 30px; border-radius: 50%; background: #17914a; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; }

/* leaderboard and podium */
.qz-board { list-style: none; margin: 10px 0 0; padding: 0; text-align: start; }
.qz-board li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px; font-size: 18px; }
.qz-board li:nth-child(odd) { background: #f7f7f7; }
.qz-board li:first-child { background: #fff6e0; font-weight: 700; }
.qz-place { width: 28px; height: 28px; border-radius: 50%; background: #222; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.qz-bname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qz-plus { color: #17914a; font-size: 14px; font-weight: 600; }
.qz-board b { font-variant-numeric: tabular-nums; }
.qz-podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 18px 0 6px; }
.qz-step { display: flex; flex-direction: column; align-items: center; width: 140px; min-width: 0; }
.qz-pname { font-weight: 700; font-size: 17px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qz-pscore { color: #666; font-size: 14px; margin-bottom: 6px; }
.qz-block { width: 100%; border-radius: 10px 10px 0 0; color: #fff; font-size: 30px; font-weight: 800; display: flex; align-items: flex-start; justify-content: center; padding-top: 8px; animation: qz-rise .6s ease-out both; }
.s1 .qz-block { height: 130px; background: #e3a524; animation-delay: .6s; }
.s2 .qz-block { height: 95px; background: #9aa3ad; animation-delay: .3s; }
.s3 .qz-block { height: 70px; background: #b77a4a; }
.qz-step.empty .qz-block { opacity: .25; }
@keyframes qz-rise { from { transform: scaleY(0); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }
.qz-rest { margin: 12px 0 0; padding: 0; list-style-position: inside; text-align: start; color: #444; }
.qz-rest li { display: flex; justify-content: space-between; padding: 4px 10px; }
@media (max-width: 640px) {
  .qz-tiles { grid-template-columns: 1fr; }
  .qz-label { font-size: 28px; }
  .qz-code { font-size: 40px; }
}

/* ---------- pupil's phone ---------- */
body.quiz-player { overflow: hidden; }
.quiz-phone {
  position: fixed; inset: 0; z-index: 100; background: #fff; color: #222; overflow-y: auto;
  padding: calc(16px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.qp-in { max-width: 480px; min-height: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.qp-brand { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border-radius: 14px; color: #fff; font-size: 20px; font-weight: 700; background: linear-gradient(90deg, #3b2470, #563599); }
.qp-brand span { color: #b9a6e3; font-size: 26px; }
.qp-sub { text-align: center; color: #555; margin: 4px 0 0; font-size: 16px; }
.qp-form { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.qp-form label { font-size: 15px; color: #555; }
.qp-form input { font: inherit; font-size: 22px; padding: 12px 14px; border: 1.5px solid #cfcfcf; border-radius: 12px; text-align: center; }
.qp-form input:focus { outline: none; border-color: rgba(44, 90, 160, .7); box-shadow: 0 0 0 3px rgba(44, 90, 160, .15); }
.qp-btn { font: inherit; font-size: 20px; font-weight: 700; padding: 14px; border: 0; border-radius: 12px; background: #222; color: #fff; cursor: pointer; }
.qp-err { color: #c62a3a; margin: 0; text-align: center; }
.qp-me { text-align: center; font-size: 22px; font-weight: 700; }
.qp-wait { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: #555; font-size: 18px; text-align: center; }
.qp-spin { width: 40px; height: 40px; border-radius: 50%; border: 4px solid #e6e6e6; border-top-color: #563599; animation: qp-spin 1s linear infinite; }
@keyframes qp-spin { to { transform: rotate(360deg); } }
.qp-top { display: flex; justify-content: space-between; align-items: center; font-size: 16px; color: #555; }
.qp-left { font-size: 24px; color: #222; font-variant-numeric: tabular-nums; }
.qp-opts { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 10px; }
.qp-opt { border: 0; font: inherit; cursor: pointer; flex-direction: column; justify-content: center; gap: 6px; min-height: 120px; }
.qp-opt:active { transform: scale(.97); }
.qp-opt .qz-label { font-size: 38px; flex: none; }
.qp-sent, .qp-result { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.qp-sent p { margin: 0; font-size: 22px; font-weight: 700; }
.qp-chosen { width: 100%; max-width: 320px; justify-content: center; }
.qp-small { color: #777; font-size: 15px; margin: 0; }
.qp-result h2 { margin: 0; font-size: 30px; }
.qp-mark { width: 96px; height: 96px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 56px; color: #fff; animation: gc-in .3s ease-out; }
.qp-result.good .qp-mark { background: #17914a; }
.qp-result.bad .qp-mark { background: #c62a3a; }
.qp-points { font-size: 34px; font-weight: 800; color: #17914a; }
.qp-total { font-size: 18px; color: #333; margin: 6px 0 0; }
.qp-rank { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 18px; }
.qp-rank b { font-size: 64px; line-height: 1; }
.qp-rank.end b { font-size: 44px; }
.qp-medal { font-size: 64px; }
/* a phone held sideways: wider and lower answer buttons, so all four fit */
@media (orientation: landscape) and (max-height: 500px) {
  .qp-in { max-width: 720px; gap: 8px; }
  .qp-opt { min-height: 70px; flex-direction: row; gap: 12px; }
  .qp-opt .qz-label { font-size: 32px; }
  .qp-mark { width: 64px; height: 64px; font-size: 38px; }
  .qp-result h2 { font-size: 24px; }
  .qp-rank b { font-size: 44px; }
  .qp-brand { padding: 8px; font-size: 17px; }
}

/* the chords still to come, behind frosted glass on the teacher's screen */
.quiz-veil {
  position: absolute; pointer-events: none; border-radius: 12px;
  background: rgba(255, 255, 255, .62);
  -webkit-backdrop-filter: blur(7px) saturate(.6); backdrop-filter: blur(7px) saturate(.6);
  box-shadow: inset 0 0 0 1px rgba(86, 53, 153, .10);
}
.quiz-veil.edge {
  border-radius: 0 12px 12px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px); mask-image: linear-gradient(90deg, transparent 0, #000 22px);
}
.quiz-veil::after {
  content: "♪"; position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%);
  font-size: 34px; color: rgba(86, 53, 153, .22);
}
.qp-ask { text-align: center; font-weight: 700; font-size: 18px; margin: 6px 0 2px; }
