/* Round views deliberately have no header or navigation. Shared TNQ controls supply the base. */
.rally-game { position: fixed; inset: 0; z-index: 70; height: 100dvh; padding: max(18px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(18px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left)); background: var(--color-bg); color: var(--color-text-primary); overflow: hidden; }
.rally-game[hidden], .rally-game [hidden] { display: none !important; }
.rally-game .helper { color: var(--color-text-secondary); font-size: .8rem; line-height: 1.55; }
.rally-game button:disabled { cursor: not-allowed; opacity: .55; }
.rally-game :focus-visible { outline: 3px solid var(--color-secondary); outline-offset: 4px; }
.rally-game-frame { width: min(100%,900px); height: 100%; min-height: 0; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.rally-round-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: .85rem; color: var(--color-text-secondary); font-variant-numeric: tabular-nums; min-height: 28px; }
.rally-round-timer { font-size: 1.2rem; color: var(--color-text-primary); font-weight: 800; min-width: 50px; text-align: right; }
.rally-round-timer.rally-timer-low { color: var(--color-secondary); animation: rally-game-tick .6s ease; }
.rally-game-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: clamp(20px,3vw,36px); scrollbar-gutter: stable; }
.rally-question-kind { color: var(--color-text-secondary); font-size: .75rem; font-weight: 600; margin: 0 0 12px; }
.rally-question-title { margin: 0 0 24px; font-weight: 800; font-size: clamp(1.35rem,3vw,2.2rem); line-height: 1.3; letter-spacing: -.035em; overflow-wrap: anywhere; }
.rally-game [tabindex="-1"]:focus { outline: none; }
.rally-question-media { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; margin: 0 0 22px; }
.rally-question-media img { display: block; max-width: 100%; max-height: 26dvh; width: auto; height: auto; object-fit: contain; border-radius: 10px; background: white; }
.rally-question-media audio { width: min(100%,380px); }
.rally-answer-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.rally-answer-option { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 16px; min-height: 72px; text-align: left; line-height: 1.5; font-weight: 600; font-size: 1rem; color: var(--color-text-primary); background: var(--color-bg); border: 2px solid var(--color-border); border-radius: var(--border-radius-button); box-shadow: none; }
.rally-answer-option.secondary-action-button { justify-content: flex-start; }
.rally-game .rally-answer-option:disabled { opacity: 1; cursor: default; }
.rally-answer-marker { display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; font-size: .75rem; font-weight: 800; border-radius: 8px; background: var(--color-card-bg); color: var(--color-text-secondary); }
.rally-answer-marker:empty { display: none; }
.rally-answer-text { overflow-wrap: anywhere; flex: 1; }
.rally-answer-option.rally-answer-selected { border-color: var(--color-primary); background: var(--color-primary-light); opacity: 1; }
.rally-answer-option.rally-answer-correct { border-color: var(--color-correct); background: var(--color-correct-light); }
.rally-answer-label { color: var(--color-text-secondary); font-size: .67rem; flex: 0 0 auto; }
.rally-answer-instruction { margin: 14px 0 0; }
.rally-answer-status { margin: 18px 0 0; font-size: .9rem; line-height: 1.55; color: var(--color-text-secondary); }
.rally-written-form { display: flex; gap: 12px; align-items: flex-end; }
.rally-written-form label { flex: 1; min-width: 0; display: block; font-size: .85rem; font-weight: 700; }
.rally-written-input { display: block; width: 100%; margin-top: 8px; box-sizing: border-box; border: 2px solid var(--color-border); border-radius: var(--border-radius-button); padding: 14px; background: var(--color-bg); color: var(--color-text-primary); font: inherit; font-weight: 500; font-size: 1.05rem; }
.rally-written-input:focus { border-color: var(--color-primary); }
.rally-written-form button { flex-shrink: 0; min-height: 51px; }
.rally-matching-form { display: flex; flex-direction: column; gap: 12px; }
.rally-matching-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--color-border); font-size: .9rem; }
.rally-matching-row > span, .rally-matching-row > strong { overflow-wrap: anywhere; }
.rally-matching-row select { width: 100%; min-width: 0; min-height: 46px; padding: 10px; color: var(--color-text-primary); background: var(--color-bg); border: 2px solid var(--color-border); border-radius: var(--border-radius-button); font: inherit; }
.rally-matching-form > button { align-self: flex-end; margin-top: 6px; }
.rally-matching { display: grid; gap: 8px; }
.rally-matching:has(ul) { grid-template-columns: 1fr 1fr; gap: 20px; }
.rally-matching ul { padding-left: 20px; margin: 0; }
.rally-matching li { margin: 0 0 12px; overflow-wrap: anywhere; }
.rally-paused-note { padding: 12px; border-radius: 10px; color: var(--color-secondary); background: var(--color-secondary-light); margin: 0 0 18px; font-weight: 700; font-size: .9rem; }
.rally-reveal-result { font-size: 1.2rem; margin: 0 0 12px; color: var(--color-secondary); }
body.light-mode .rally-reveal-result { color: var(--color-primary); }
.rally-your-answer { white-space: pre-wrap; margin-bottom: 18px; }
.rally-correct-answer { font-size: clamp(1.2rem,2.6vw,1.7rem); font-weight: 700; color: var(--color-text-primary); line-height: 1.5; margin: 12px 0; overflow-wrap: anywhere; }
.rally-explanation { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--color-border); font-size: 1rem; line-height: 1.7; overflow-wrap: anywhere; }
.rally-round-points { font-size: 1.3rem; font-weight: 800; margin: 18px 0 0; }
.rally-point-details, .rally-question-hint { margin: 14px 0 0; font-size: .82rem; }
.rally-game summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.rally-point-details p, .rally-question-hint p { line-height: 1.6; margin: 8px 0; }
.rally-game-controls { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; }
.rally-game-controls:empty { display: none; }
.rally-game-controls button { min-height: 44px; font-size: .8rem; padding: 10px 14px; }
.rally-game-controls .rally-end-button { margin-left: auto; }
.rally-host-note { flex-shrink: 0; margin: 0; font-size: .7rem !important; text-align: center; }
.rally-host-note:empty { display: none; }
.rally-running-score { margin: 0; font-size: .9rem; font-weight: 700; }
.rally-game-error { flex-shrink: 0; margin: 0; max-height: 18dvh; overflow-y: auto; padding: 10px 12px; border: 1px solid var(--color-incorrect); border-radius: 10px; background: var(--color-incorrect-light); font-size: .8rem; line-height: 1.5; }
.rally-game-connection { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-primary-light); font-size: .82rem; }
.rally-game-connection button { font-size: .75rem; padding: 8px 12px; flex-shrink: 0; }
.rally-board-title { font-size: 1.1rem; margin: 22px 0 14px; }
/* Final results: each part gets room of its own. */
.rally-finale .rally-board-title { margin: 3rem 0 1rem; }
.rally-finale .rally-leaderboard { gap: .625rem; }
.rally-finale > .rally-result-stats { margin: 2.5rem 0; }
.rally-leaderboard { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rally-leaderboard li { min-width: 0; display: flex; align-items: center; gap: 14px; border: 1px solid var(--color-border); border-radius: 12px; padding: 12px 16px; font-size: .9rem; }
.rally-leaderboard li.rally-me { border-color: var(--color-primary); background: var(--color-primary-light); }
.rally-rank { min-width: 20px; font-variant-numeric: tabular-nums; color: var(--color-text-secondary); }
.rally-board-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rally-leaderboard strong { font-variant-numeric: tabular-nums; }
.rally-result-stats { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; padding: 0; margin: 24px 0; }
.rally-result-stats > div { padding: 14px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: 12px; }
.rally-result-stats dt { font-size: .72rem; color: var(--color-text-secondary); line-height: 1.5; }
.rally-result-stats dd { font-size: clamp(1.3rem,3vw,1.8rem); line-height: 1.2; font-weight: 800; margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.rally-game-confirm { width: min(440px,calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; border: 0; border-radius: var(--border-radius-card); padding: 0; background: transparent; color: var(--color-text-primary); }
.rally-game-confirm::backdrop { background: rgba(0,0,0,.65); }
.rally-game-confirm > div { padding: 28px; }
.rally-game-confirm h2 { font-size: 1.4rem; margin: 0 0 14px; }
.rally-game-confirm p { font-size: .9rem; line-height: 1.7; margin: 0 0 24px; }
.rally-game-dialog-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: flex-end; }
.rally-body-enter { animation: rally-game-enter .22s ease-out both; }
.rally-body-reveal { animation: rally-game-reveal .24s ease-out both; }
.rally-body-result { animation: rally-game-result .35s ease-out both; }
@keyframes rally-game-enter { from { opacity: .5; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rally-game-reveal { from { opacity: .4; transform: scale(.985); } to { opacity: 1; transform: none; } }
@keyframes rally-game-result { from { opacity: .3; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes rally-game-tick { 50% { transform: scale(1.08); } }
@media (max-width: 600px) {
  .rally-game { padding: max(12px,env(safe-area-inset-top)) 12px max(12px,env(safe-area-inset-bottom)); }
  .rally-game-frame { gap: 10px; }
  .rally-game-body { padding: 20px 16px; border-radius: 18px; }
  .rally-question-title { margin-bottom: 18px; }
  .rally-answer-grid { grid-template-columns: 1fr; gap: 9px; }
  .rally-answer-option { padding: 12px; min-height: 56px; gap: 9px; font-size: .9rem; }
  .rally-answer-label { font-size: .6rem; }
  .rally-written-form { flex-direction: column; align-items: stretch; }
  .rally-written-form button { align-self: flex-end; min-height: 44px; }
  .rally-matching-row { gap: 10px; font-size: .8rem; }
  .rally-matching-row select { padding: 8px 6px; font-size: .8rem; }
  .rally-game-controls { justify-content: center; gap: 8px; }
  .rally-game-controls button { padding: 9px 10px; font-size: .72rem; }
  .rally-result-stats { grid-template-columns: 1fr 1fr; gap: 9px; }
  .rally-result-stats > div { padding: 12px; }
  .rally-leaderboard li { padding: 10px 12px; gap: 10px; font-size: .82rem; }
}
@media (max-height: 500px) {
  .rally-game { padding-top: 8px; padding-bottom: 8px; }
  .rally-game-frame { gap: 7px; }
  .rally-round-meta { min-height: 22px; font-size: .75rem; }
  .rally-round-timer { font-size: 1rem; }
  .rally-game-body { padding: 16px; }
  .rally-question-title { font-size: 1.25rem; margin-bottom: 12px; }
  .rally-answer-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .rally-answer-option { min-height: 46px; padding: 9px 12px; font-size: .8rem; }
  .rally-game-controls button { min-height: 36px; padding: 7px 10px; }
  .rally-host-note { display: none; }
}
@media (prefers-reduced-motion: reduce) { .rally-game *, .rally-game *::before, .rally-game *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
.rally-round-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.rally-round-actions button { min-height: 44px; padding: 10px 14px; font-size: .8rem; }
.rally-countdown { display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.rally-countdown-number { font-size: clamp(7rem,30vw,14rem); line-height: 1; font-weight: 900; color: var(--color-primary); font-variant-numeric: tabular-nums; }
.rally-submitted-check { display: grid; place-items: center; margin: 9dvh auto 26px; width: 110px; height: 110px; border-radius: 50%; background: var(--color-correct-light); color: var(--color-correct); font-size: 72px; font-weight: 900; }
.rally-submitted-check ~ h1, .rally-submitted-check ~ p { text-align: center; }
/* Match Learn Mode's correct/incorrect feedback using TNQ's shared theme tokens. */
.rally-class-breakdown { display: flex; align-items: center; justify-content: center; gap: clamp(24px,5vw,64px); margin: 28px 0 36px; }
.rally-accuracy-pie { flex: 0 0 auto; width: clamp(160px,25vw,260px); aspect-ratio: 1; border-radius: 50%; background: conic-gradient(var(--color-correct) 0deg var(--correct-angle), var(--color-incorrect) var(--correct-angle) 360deg); box-shadow: var(--shadow-md); }
.rally-accuracy-copy { display: grid; gap: 4px; color: var(--color-text-secondary); font-size: 1rem; }
.rally-accuracy-percent { color: var(--color-text-primary); font-size: clamp(2.8rem,6vw,5rem); font-weight: 800; line-height: 1; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.rally-host-controls { position: fixed; left: max(20px,env(safe-area-inset-left)); bottom: max(18px,env(safe-area-inset-bottom)); display: flex; gap: 24px; align-items: center; }
.rally-game .rally-control-link { min-height: 44px; padding: 8px 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; color: var(--color-text-secondary); text-decoration: underline; text-underline-offset: 4px; font-size: .8rem; font-weight: 500; }
.rally-game .rally-control-link:hover { color: var(--color-text-primary); }
.rally-game .rally-fullscreen { position: fixed; right: max(20px,env(safe-area-inset-right)); bottom: max(18px,env(safe-area-inset-bottom)); display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 10px; border: 0; box-shadow: none; border-radius: 10px; background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.rally-game .rally-fullscreen:hover { color: var(--color-text-primary); background: var(--color-bg-secondary); }
.rally-fullscreen svg { display: block; width: 24px; height: 24px; }
.rally-game-controls:has(.rally-fullscreen) { min-height: 44px; padding-right: 48px; }
.rally-game-controls.rally-result-controls { justify-content: flex-start; padding-right: 0; }
.rally-result-controls .rally-end-button { margin-left: auto; }
.rally-game:has(.rally-result-controls) .rally-game-frame { padding-bottom: 54px; }
@media (max-width: 600px) {
  .rally-round-meta { gap: 8px; flex-wrap: wrap; }
  .rally-round-actions { gap: 8px; margin-left: auto; }
  .rally-round-actions button { padding: 9px 10px; font-size: .72rem; }
}
.rally-hint-button:disabled { cursor: not-allowed; filter: grayscale(1); opacity: .45; }
.rally-lock-in { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-top: 22px; }
.rally-game .rally-hold-button { width: clamp(150px,22vw,184px); height: clamp(150px,22vw,184px); flex: 0 0 auto; border-radius: 50%; position: relative; padding: 0; margin: 10px 0 18px; border: 0; background: #9d2535; box-shadow: 0 9px 0 #701b29, 0 15px 26px #16080c55; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.rally-hold-face { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 50%; transform: translateY(-10px); background: radial-gradient(circle at 38% 25%,#fa6c70,#e83f4e 65%,#ce2f43); color: #fff; box-shadow: inset 0 3px 0 #ffb3b580, inset 0 -3px 0 #af263655; transition: transform .12s ease, filter .12s ease; }
.rally-hold-face > span { font-family: inherit; font-size: clamp(1.1rem,3vw,1.4rem); font-weight: 900; line-height: 1.15; letter-spacing: .025em; text-align: center; padding: 24px; pointer-events: none; }
.rally-hold-button:hover .rally-hold-face { filter: brightness(1.06); }
.rally-hold-pressed .rally-hold-face { transform: translateY(-1px); filter: brightness(.98); }
.rally-hold-face svg { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); overflow: visible; pointer-events: none; }
.rally-hold-face circle { fill: none; stroke-width: 3; }
.rally-hold-track { stroke: #ffb7bd66; }
.rally-hold-progress { stroke: #fff4d6; stroke-linecap: round; stroke-dasharray: 351.86; stroke-dashoffset: 351.86; }
.rally-hold-active .rally-hold-progress { animation: rally-hold-fill .85s linear forwards; }
.rally-lock-in .rally-control-link { display: block; margin: 0 auto; font-size: .85rem; min-height: 36px; padding: 7px 4px; }
.rally-lock-in .rally-question-hint { margin: 0; text-align: center; }
.rally-lock-in .rally-question-hint p { max-width: 460px; }
.rally-team-role { margin: -8px 0 18px; }
.rally-team-milestone { color: var(--color-secondary); font-weight: 800; padding: 12px; border: 1px solid var(--color-secondary); border-radius: 10px; }
@keyframes rally-hold-fill { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .rally-hold-active { outline: 3px solid var(--color-secondary); } }

.rally-game.rally-discussion-phase::after { content: ''; position: fixed; inset: 0; z-index: 10; pointer-events: none; border: 3px solid #5199f5aa; box-shadow: inset 0 0 42px 12px #388df559; border-radius: 5px; }
:root { --rally-discussion-blue: #5199f5; }
.rally-discussion-phase .rally-game-body { border-color: var(--rally-discussion-blue); box-shadow: 0 0 24px #388df52e; }
.rally-discussion-phase .rally-answer-status { color: #8cbfff; font-weight: 700; }
.rally-your-captain-turn { padding: 10px 14px; border-radius: 10px; color: #f6c445 !important; border: 1px solid #f6c44599; background: #f6c44512; font-weight: 800; }
.rally-captain-announcement { position: fixed; z-index: 15; top: max(66px,env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: min(520px,calc(100vw - 40px)); display: flex; align-items: center; justify-content: center; gap: 20px; padding: 24px; border: 2px solid #f6c445; border-radius: 22px; background: var(--color-card-bg); box-shadow: 0 16px 50px #0008, 0 0 24px #f6c44533; pointer-events: none; animation: rally-captain-enter .25s ease-out both; }
.rally-captain-graphic { display: grid; place-items: center; width: 78px; height: 78px; border-radius: 50%; color: #f6c445; background: #f6c4451c; flex-shrink: 0; }
.rally-captain-graphic svg { width: 54px; height: 54px; }
.rally-captain-announcement > div:last-child { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rally-captain-kicker { margin: 0; color: #f6c445; font-size: clamp(.8rem,2.5vw,1rem); font-weight: 900; letter-spacing: .06em; }
.rally-captain-announcement strong { font-size: clamp(1.4rem,4vw,2rem); overflow-wrap: anywhere; }
.rally-round-start { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rally-joins-lock { flex-shrink: 0; width: 40px; height: 40px; }
.rally-joins-lock[hidden] { display: none; }
.rally-joins-lock svg { display: block; width: 22px; height: 22px; }
.rally-joins-lock[aria-pressed=true] { background: var(--color-primary-light); color: var(--color-secondary); }
@keyframes rally-captain-enter { from { opacity: 0; translate: 0 -12px; } to { opacity: 1; translate: 0 0; } }
@media (max-width: 480px) { .rally-captain-announcement { gap: 14px; padding: 18px; } .rally-captain-graphic { width: 58px; height: 58px; } .rally-captain-graphic svg { width: 40px; height: 40px; } }
@media (max-height: 500px) { .rally-game .rally-hold-button { width: 136px; height: 136px; } .rally-lock-in { margin-top: 12px; } .rally-captain-announcement { top: 12px; padding: 12px 20px; } }
@media (prefers-reduced-motion: reduce) { .rally-captain-announcement { animation: none; } .rally-hold-active .rally-hold-progress { stroke-dashoffset: 0; } }

.rally-team-badge { display: inline-flex; align-items: center; gap: .4375rem; vertical-align: middle; font-weight: 700; }
.rally-team-dot { display: inline-block; flex: 0 0 auto; width: .6875rem; height: .6875rem; border-radius: 50%; box-shadow: 0 0 0 1px #ffffff33; print-color-adjust: exact; -webkit-print-color-adjust: exact; }

:is(.rally-page,.rally-game) summary { list-style: none; }
:is(.rally-page,.rally-game) summary::-webkit-details-marker { display: none; }
:is(.rally-page,.rally-game) summary::before { content: ''; display: inline-block; vertical-align: -.15em; width: 16px; height: 16px; margin-right: 7px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 5 7 7-7 7'/%3E%3C/svg%3E") center/contain no-repeat; }
:is(.rally-page,.rally-game) details[open] > summary::before { transform: rotate(90deg); }
/* Step 5: neutral feedback, flat playful depth, and one shared drawn checkmark. */
.rally-game-body { position: relative; }
.rally-game .rally-answer-correct { background: var(--color-correct-light); border-color: var(--color-correct); color: var(--color-text-primary); }
.rally-game .rally-answer-incorrect { background: var(--color-incorrect-light); border-color: var(--color-incorrect); color: var(--color-text-primary); }
.rally-game .rally-hold-button { background: color-mix(in srgb,var(--color-incorrect) 65%,#521625); border: 0; box-shadow: 0 5px 14px #0003; margin: 10px 0 18px; }
/* The shared blue .main-action-button hover must not repaint the button's base; only the face brightens. */
.rally-game .rally-hold-button:hover:not(:disabled) { background: color-mix(in srgb,var(--color-incorrect) 65%,#521625); }
.rally-game .rally-hold-face { background: var(--color-incorrect); transform: translateY(-8px); box-shadow: inset 0 0 0 3px #ffffff30; transition: transform .14s ease, background-color .45s ease, box-shadow .3s ease; }
.rally-game .rally-hold-pressed .rally-hold-face { transform: translateY(-1px); filter: none; }
.rally-hold-track { stroke: #ffffff45; }
.rally-hold-progress { stroke: var(--color-secondary); }
.rally-hold-face > span { transition: opacity .2s ease, scale .2s ease; }
.rally-game .rally-hold-success { background: color-mix(in srgb,var(--color-correct) 65%,#183b2d); opacity: 1; cursor: default; pointer-events: none; transition: background-color .45s ease; }
.rally-game .rally-hold-success .rally-hold-face { background: var(--color-correct); transform: translateY(-4px); }
.rally-hold-success .rally-hold-face > span, .rally-hold-success .rally-hold-face > svg:not(.rally-check-svg) { opacity: 0; scale: .8; }
.rally-check-svg { display: block; width: 64%; height: 64%; overflow: visible; color: currentColor; }
.rally-check-svg path { fill: none; stroke: currentColor; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: rally-check-draw .5s .12s cubic-bezier(.3,0,.2,1) forwards; }
.rally-hold-face .rally-check-svg { inset: 18%; width: 64%; height: 64%; transform: none; }
.rally-submitted-check { margin: 6dvh auto 24px; animation: rally-check-arrive .3s ease both; }
.rally-lock-success { position: absolute; margin: 0; transform: translateX(-50%); gap: 18px; }
.rally-lock-success .rally-hold-button { margin: 0; }
.rally-submission-copy { text-align: center; width: 100%; animation: rally-copy-arrive .35s .18s ease both; }
.rally-submission-copy .rally-question-title { margin: 0 0 8px; font-size: clamp(1.3rem,3vw,2rem); }
.rally-submission-copy .rally-answer-status { margin: 0; }
.rally-discussion-announcement { border-color: var(--color-primary); box-shadow: 0 12px 34px #0004; }
.rally-discussion-announcement .rally-captain-graphic { color: #82b3ff; background: #5199f51c; }
.rally-discussion-announcement .rally-captain-kicker { color: #91b6ff; }
/* Team start banner: the player's team color on the border, the badge and the kicker. */
.rally-team-announcement { border-color: var(--team-color); box-shadow: 0 16px 50px #0008, 0 0 28px color-mix(in srgb, var(--team-color) 30%, transparent); }
.rally-team-announcement .rally-captain-graphic { color: #0d0f2b; background: var(--team-color); }
.rally-team-announcement .rally-captain-graphic svg { width: 44px; height: 44px; }
.rally-team-announcement .rally-captain-kicker { color: var(--team-color); }
@media (max-width: 480px) { .rally-team-announcement .rally-captain-graphic svg { width: 32px; height: 32px; } }
.rally-learning-prompt { margin: 20px 0 0; padding: 16px; border: 1px solid var(--color-border); border-radius: 16px; text-align: center; }
.rally-learning-prompt h2 { margin: 0 0 8px; font-size: 1rem; }
.rally-learning-prompt button { margin: 5px; min-height: 44px; padding: 10px 14px; font-size: .8rem; }
.rally-learning-prompt button[aria-pressed=true] { border-color: var(--color-primary); background: var(--color-primary-light); }
/* Touch browsers can retain :hover after a tap. Only a saved rating gets a selected style. */
@media (hover: none) {
  .rally-learning-prompt button:hover:not([aria-pressed=true]) { background: var(--color-card-bg); color: var(--color-text-secondary); border-color: var(--color-border); }
}
.rally-difficulty-prompt { text-align: left; }
/* Copy inside TNQ's native modals, on both the host and student pages. */
.rally-modal h2 { margin: 0 2rem 1.25rem 0; font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.rally-powerups { margin-top: 18px; padding: 10px 16px; border: 1px solid var(--color-border); border-radius: 14px; }
.rally-powerup-choice { display: grid; grid-template-columns: minmax(130px,1fr) 2fr; align-items: center; gap: 14px; padding: 10px 0; }
.rally-powerup-choice button { display: flex; align-items: center; justify-content: flex-start; gap: 8px; min-height: 44px; padding: 8px 10px; font-size: .8rem; text-align: left; color: var(--color-text-primary); border: 1px solid var(--powerup-color); background: color-mix(in srgb, var(--powerup-color) 8%, var(--color-bg)); }
.rally-powerup-choice button:hover:not(:disabled) { border-color: var(--powerup-color); background: color-mix(in srgb, var(--powerup-color) 18%, var(--color-bg)); }
.rally-powerup-double { --powerup-color: #b4297f; }
.rally-powerup-remove-two { --powerup-color: #c5302f; }
.rally-powerup-second-chance { --powerup-color: #24803c; }
.rally-powerup-shield { --powerup-color: #1f64c4; }
body:not(.light-mode) .rally-powerup-double { --powerup-color: #f58bcb; }
body:not(.light-mode) .rally-powerup-remove-two { --powerup-color: #ff7b78; }
body:not(.light-mode) .rally-powerup-second-chance { --powerup-color: #79dc8d; }
body:not(.light-mode) .rally-powerup-shield { --powerup-color: #7fb4ff; }
.rally-powerup-icon { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--powerup-color); background: color-mix(in srgb, var(--powerup-color) 14%, var(--color-bg)); }
.rally-powerup-icon svg { width: 21px; height: 21px; }
.rally-powerup-note { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.rally-powerup-choice p { margin: 0; }
.rally-option-removed { opacity: .35 !important; text-decoration: line-through; }
.rally-written-feedback { padding: 12px 16px; border: 1px solid; border-radius: 10px; width: fit-content; overflow-wrap: anywhere; }
.rally-awards { display: grid; gap: .875rem; margin: 2.5rem 0; }
.rally-award { --award-color: #117c87; display: grid; grid-template-columns: 42px 1fr; gap: 0 10px; align-items: center; padding: 16px; border: 1px solid var(--award-color); border-radius: 16px; background: color-mix(in srgb, var(--award-color) 8%, var(--color-bg)); animation: rally-award-arrive .45s cubic-bezier(.2,.8,.3,1.1) both; }
.rally-award-fastest { --award-color: #a16a08; }
.rally-award-comeback { --award-color: #8150c7; }
.rally-award-streak { --award-color: #bc4c22; }
body:not(.light-mode) .rally-award-accurate { --award-color: #54d1c6; }
body:not(.light-mode) .rally-award-fastest { --award-color: #f5cb5c; }
body:not(.light-mode) .rally-award-comeback { --award-color: #be9bff; }
body:not(.light-mode) .rally-award-streak { --award-color: #ff9a69; }
.rally-award-icon { grid-row: span 2; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; color: var(--award-color); background: color-mix(in srgb, var(--award-color) 14%, var(--color-bg)); }
.rally-award-icon svg { width: 28px; height: 28px; }
.rally-award p { margin: 5px 0 0; }
.rally-result-details, .rally-private-review, .rally-history { margin: 2.25rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--color-border); }
.rally-review-item { border-bottom: 1px solid var(--color-border); padding: 12px 0; overflow-wrap: anywhere; }
.rally-review-item summary { font-size: .9rem; }
.rally-review-answer { color: var(--color-text-primary); font-weight: 600; font-size: .9rem; white-space: pre-wrap; }
.rally-recovery-note { color: var(--color-text-primary); font-weight: 600; line-height: 1.6; }
.rally-history label { font-size: .85rem; }
.rally-history { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.rally-team-milestone { animation: rally-award-arrive .4s ease both; }
@keyframes rally-check-draw { to { stroke-dashoffset: 0; } }
@keyframes rally-check-arrive { from { opacity: .5; scale: .9; } to { opacity: 1; scale: 1; } }
@keyframes rally-copy-arrive { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
@keyframes rally-award-arrive { from { opacity: 0; translate: 0 10px; scale: .97; } to { opacity: 1; translate: 0 0; scale: 1; } }
@media(max-width:480px) { .rally-powerup-choice { grid-template-columns: 1fr; gap: 6px; } }
@media(prefers-reduced-motion:reduce) { .rally-check-svg path { animation: none; stroke-dashoffset: 0; } .rally-lock-success { animation: none; } }

.rally-check-settled path { animation: none; stroke-dashoffset: 0; }

.rally-reveal-result { color: var(--color-text-primary); }
.rally-match-selected { display:inline-block; border:1px solid; border-radius:8px; padding:8px 10px; overflow-wrap:anywhere; }

.rally-game .rally-hold-button.rally-hold-success:disabled { opacity: 1; cursor: default; }
.rally-submission-neutral { display:flex; flex-direction:column; justify-content:center; }
.rally-submission-neutral .rally-submitted-check { margin: 0 auto 24px; background:var(--color-correct); color:#fff; box-shadow:inset 0 0 0 2px #ffffff30; flex-shrink:0; }

.rally-learning-prompt button[aria-pressed=true]:disabled { opacity:1; }

/* Rally motion: short tactile beats, readable round changes, and a one-shot finale. */
.rally-game { --rally-ease: cubic-bezier(.2,.8,.2,1); }
.rally-body-enter, .rally-body-reveal, .rally-body-result, .rally-round-timer.rally-timer-low, .rally-captain-announcement { animation: none; }
.rally-round-track { flex: 0 0 4px; border-radius: 4px; overflow: hidden; background: var(--color-border); }
.rally-round-track > span { display: block; height: 100%; background: var(--color-primary); transform-origin: left; transition: transform .5s var(--rally-ease); }
.rally-round-progress { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rally-round-actions { flex-shrink: 0; }
.rally-game :is(.main-action-button,.secondary-action-button,.rally-powerup-choice button) { transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .16s var(--rally-ease); }
.rally-game :is(.main-action-button,.secondary-action-button):active:not(:disabled) { transform: translateY(2px) scale(.985); }
.rally-game .rally-answer-option { transition: border-color .18s ease, background-color .18s ease, transform .16s var(--rally-ease); }
.rally-game details[open] > :not(summary) { animation: rally-detail-open .2s var(--rally-ease) both; }
@keyframes rally-detail-open { from { opacity: .3; translate: 0 5px; } to { opacity: 1; translate: 0 0; } }
@media(hover:hover) { .rally-game button.rally-answer-option:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--color-primary); } }
.rally-countdown .rally-question-title { margin-bottom: 24px; }
.rally-countdown-beat { position: relative; display: grid; place-items: center; width: clamp(150px,28dvh,270px); aspect-ratio: 1; margin: 6px 0 24px; flex-shrink: 0; }
.rally-countdown-number { position: relative; font-size: clamp(6rem,21dvh,12rem); color: var(--color-primary); text-shadow: 0 5px 0 color-mix(in srgb,var(--color-primary) 18%,transparent); }
.rally-countdown-orbit { position: absolute; inset: 0; }
.rally-countdown-orbit svg { width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }
.rally-countdown-orbit circle { stroke: var(--color-border); stroke-width: 3; }
.rally-countdown-orbit circle:last-child { stroke: var(--color-primary); stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; stroke-width: 5; }
.rally-waiting-state { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; }
.rally-waiting-state .rally-question-title { margin: 0; }
.rally-waiting-state .helper { max-width: 350px; margin: 0; }
.rally-orbit-spinner { position: relative; width: 88px; height: 88px; margin: 0 0 12px; flex: 0 0 auto; }
.rally-orbit-spinner i { position: absolute; inset: 0; border: 4px solid var(--color-border); border-top-color: var(--color-primary); border-right-color: var(--color-primary); border-radius: 50%; animation: rally-orbit 1.4s linear infinite; }
.rally-orbit-spinner i:nth-child(2) { inset: 12px; border-width: 3px; border-color: transparent; border-bottom-color: var(--color-secondary); animation-direction: reverse; animation-duration: 1.8s; }
.rally-orbit-spinner > span { position: absolute; inset: 33px; border-radius: 7px; background: var(--color-primary); transform: rotate(12deg); }
@keyframes rally-orbit { to { transform: rotate(360deg); } }
.rally-class-breakdown { contain: layout; }
.rally-finale > .rally-question-title { margin-bottom: 12px; text-align: center; }
.rally-finale-copy { text-align: center; margin: 0 0 8px; }
.rally-podium { position: relative; }
.rally-podium-place { transform-origin: 50% 85%; }
.rally-podium { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); align-items: end; list-style: none; padding: 0; margin: 2.5rem 0 3rem; gap: clamp(8px,2vw,18px); }
.rally-podium-place { position: relative; min-width: 0; min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 22px 14px; border: 1px solid var(--color-border); border-radius: 20px; text-align: center; background: var(--color-bg); }
.rally-podium-place-1 { grid-column: 2; grid-row: 1; min-height: 210px; border-color: var(--color-secondary); background: color-mix(in srgb,var(--color-secondary) 6%,var(--color-bg)); }
.rally-podium-place-2 { grid-column: 1; grid-row: 1; }
.rally-podium-place-3 { grid-column: 3; grid-row: 1; min-height: 145px; }
.rally-podium-place[data-rank="1"] { min-height: 210px; border-color: var(--color-secondary); background: color-mix(in srgb,var(--color-secondary) 6%,var(--color-bg)); }
.rally-podium:has(> :only-child) { grid-template-columns: minmax(0,340px); justify-content: center; }
.rally-podium:has(> :only-child) .rally-podium-place-1 { grid-column: 1; }
.rally-podium-medal { display: grid; place-items: center; flex-shrink: 0; width: 50px; height: 50px; border-radius: 50%; background: var(--color-card-bg); border: 2px solid var(--color-border); color: var(--color-text-primary); font-size: 1.5rem; font-weight: 900; box-shadow: 0 4px 0 var(--color-border); }
.rally-podium-place[data-rank="1"] .rally-podium-medal { background: var(--color-secondary); color: #25223f; border-color: transparent; box-shadow: 0 4px 0 color-mix(in srgb,var(--color-secondary) 50%,#4c3820); }
.rally-podium-name { font-size: clamp(.85rem,2.6vw,1.35rem); overflow-wrap: anywhere; width: 100%; }
.rally-podium-name .rally-team-badge { justify-content: center; flex-wrap: wrap; }
.rally-podium-points { color: var(--color-text-secondary); font-size: .82rem; font-variant-numeric: tabular-nums; }
.rally-podium-me::after { content: 'YOU'; position: absolute; bottom: 7px; font-size: .6rem; font-weight: 800; letter-spacing: .08em; color: var(--color-primary); }
.rally-finale .rally-awards { grid-template-columns: repeat(2,minmax(0,1fr)); }
.rally-finale .rally-awards:has(> :only-child) { grid-template-columns: 1fr; }
.rally-finale .rally-award { animation: none; min-width: 0; }
.rally-finale .rally-award :is(strong,p) { overflow-wrap: anywhere; }
.rally-round-actions .rally-skip-celebration { margin: 0; font-size: .75rem; padding: 6px 4px; }
.rally-finale-lighting { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 18; contain: strict; }
.rally-finale-dimmer { position: absolute; inset: 0; background: radial-gradient(ellipse var(--spotlight-width) var(--spotlight-height) at var(--spotlight-x) var(--spotlight-y), transparent 40%, rgb(8 10 28 / .76) 100%); }
.rally-finale-beam { position: absolute; transform-origin: 0 50%; transform: rotate(var(--beam-angle)); filter: blur(10px); }
.rally-finale-beam::before { content: ''; position: absolute; inset: 0; clip-path: polygon(0 49%,100% 0,100% 100%,0 51%); background: linear-gradient(90deg,rgb(255 245 204 / .2),rgb(255 237 173 / .16) 65%,rgb(255 237 173 / 0)); }
.rally-finale-pool { position: absolute; left: var(--spotlight-x); top: var(--spotlight-y); width: calc(var(--spotlight-width) * 2); height: calc(var(--spotlight-height) * 2); transform: translate(-50%,-50%); background: radial-gradient(ellipse,rgb(255 237 173 / .22),rgb(255 237 173 / .08) 45%,transparent 72%); }
.rally-round-meta:has(.rally-skip-celebration:not(:disabled)) { position: relative; z-index: 19; }
.rally-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 20; contain: strict; }
.rally-confetti i { position: absolute; top: 0; left: 0; width: 8px; height: 12px; }
.rally-game-frame { position: relative; }
@media(max-width:480px) {
  .rally-finale .rally-awards { grid-template-columns: 1fr; }
  .rally-podium { gap: 7px; margin: 2rem 0 2.5rem; }
  .rally-podium-place { padding: 18px 7px; gap: 10px; min-height: 152px; border-radius: 14px; }
  .rally-podium-place-1 { min-height: 184px; }
  .rally-podium-place[data-rank="1"] { min-height: 184px; }
  .rally-podium-place-3 { min-height: 132px; }
  .rally-podium-medal { width: 38px; height: 38px; font-size: 1.1rem; }
  .rally-podium-points { font-size: .67rem; }
}
@media(max-height:500px) {
  .rally-finale { padding: 12px 16px; }
  .rally-finale > .rally-question-title { font-size: 1.15rem; margin-bottom: 4px; }
  .rally-game .rally-finale-copy { font-size: .7rem; margin: 0; }
  .rally-podium { margin: 1rem 0 1.5rem; }
  .rally-countdown-beat { width: 135px; margin: 0 0 8px; }
  .rally-countdown-number { font-size: 6rem; }
  .rally-countdown .rally-question-title { margin-bottom: 8px; }
  .rally-orbit-spinner { width: 62px; height: 62px; margin: 0; }
  .rally-orbit-spinner > span { inset: 23px; }
  .rally-podium-place { min-height: 90px; padding: 10px 8px; gap: 6px; }
  .rally-podium-place-1 { min-height: 104px; }
  .rally-podium-place[data-rank="1"] { min-height: 104px; }
  .rally-podium-place-3 { min-height: 82px; }
  .rally-podium-medal { width: 30px; height: 30px; font-size: 1rem; }
  .rally-podium-name { font-size: 1rem; }
  .rally-podium-points { font-size: .68rem; }
}
@media(prefers-reduced-motion:reduce) {
  .rally-confetti, .rally-finale-lighting { display: none; }
  .rally-skip-celebration { visibility: hidden !important; }
  .rally-round-track > span { transition: none; }
}

/* Sound toggle. The host's sits beside fullscreen; a player's sits in the top row. */
.rally-sound-toggle { display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 10px; border: 0; box-shadow: none; border-radius: 10px; background: transparent; color: var(--color-text-secondary); cursor: pointer; }
.rally-sound-toggle:hover { color: var(--color-text-primary); background: var(--color-bg-secondary); }
.rally-sound-toggle svg { display: block; width: 24px; height: 24px; }
.rally-game .rally-sound-host { position: fixed; right: calc(max(20px,env(safe-area-inset-right)) + 48px); bottom: max(18px,env(safe-area-inset-bottom)); }
.rally-game-controls:has(.rally-sound-host) { padding-right: 96px; }
.rally-game-controls.rally-result-controls:has(.rally-sound-host) { padding-right: 0; }
.rally-round-actions .rally-sound-player { width: 36px; height: 36px; min-height: 36px; padding: 6px; }
.rally-round-actions .rally-sound-player svg { width: 22px; height: 22px; }

/* Confidence trends on the host's end screen. */
.rally-confidence-trends { margin-top: 3rem; }
.rally-confidence-trends .rally-board-title { margin-top: 0; }
.rally-confidence-levels { grid-template-columns: repeat(auto-fit,minmax(140px,1fr)); margin: 0 0 14px; }
.rally-confidence-levels .helper { display: block; margin-top: 4px; font-size: .75rem; }
.rally-trend { --trend-color: var(--color-correct); display: grid; grid-template-columns: 42px 1fr; gap: 0 10px; align-items: start; padding: 16px; margin-top: 10px; border: 1px solid var(--trend-color); border-radius: 16px; background: color-mix(in srgb, var(--trend-color) 8%, var(--color-bg)); }
.rally-trend-bad { --trend-color: var(--color-incorrect); }
.rally-trend-icon { display: grid; place-items: center; width: 36px; height: 36px; color: var(--trend-color); }
.rally-trend-icon svg { width: 26px; height: 26px; }
.rally-trend p { margin: 4px 0 0; line-height: 1.5; }
.rally-trend-questions { margin: 8px 0 0; padding-left: 18px; font-size: .85rem; line-height: 1.5; color: var(--color-text-secondary); }

/* Phone-width hosts: Pause, Lock and End share one row with both icon buttons. */
@media (max-width: 600px) {
  .rally-host-controls { left: max(12px,env(safe-area-inset-left)); gap: 10px; }
  .rally-host-controls .rally-control-link { font-size: .72rem; }
  .rally-game .rally-fullscreen, .rally-game .rally-sound-host { width: 36px; height: 36px; min-height: 36px; padding: 6px; bottom: max(22px,env(safe-area-inset-bottom)); }
  .rally-game .rally-fullscreen { right: max(12px,env(safe-area-inset-right)); }
  .rally-game .rally-sound-host { right: calc(max(12px,env(safe-area-inset-right)) + 38px); }
  .rally-game .rally-fullscreen svg, .rally-game .rally-sound-host svg { width: 22px; height: 22px; }
}
/* Short landscape screens: keep both icon buttons clear of the question panel. */
@media (max-height: 500px) {
  .rally-game .rally-fullscreen, .rally-game .rally-sound-host { width: 36px; height: 36px; min-height: 36px; padding: 6px; bottom: max(8px,env(safe-area-inset-bottom)); }
  .rally-game .rally-sound-host { right: calc(max(20px,env(safe-area-inset-right)) + 38px); }
  .rally-game .rally-fullscreen svg, .rally-game .rally-sound-host svg { width: 22px; height: 22px; }
}

/* Host on a classroom screen. The host page's rem grows on big screens (see rally.css), so these rules
   restate the round view's px sizes in rem and the whole screen scales together, from the countdown to
   the final results. At normal size 1rem is 16px, so nothing changes there. Phones and short screens
   keep their own rules above. */
@media (min-width: 601px) and (min-height: 501px) {
  .rally-game.rally-host-game { padding: max(1.125rem,env(safe-area-inset-top)) max(1.25rem,env(safe-area-inset-right)) max(1.125rem,env(safe-area-inset-bottom)) max(1.25rem,env(safe-area-inset-left)); }
  .rally-host-game .rally-game-frame { gap: .875rem; }
  .rally-host-game .rally-round-meta { gap: 1rem; min-height: 1.75rem; font-size: .9rem; }
  .rally-host-game .rally-round-timer { min-width: 3.25rem; font-size: 1.6rem; }
  .rally-host-game .rally-round-track { flex-basis: .25rem; }
  .rally-host-game .rally-round-start { gap: .5rem; }
  .rally-host-game .rally-round-actions { gap: .75rem; }
  .rally-host-game .rally-round-actions button { min-height: 2.75rem; padding: .625rem 1rem; font-size: .9rem; }
  .rally-host-game .rally-joins-lock { width: 2.5rem; height: 2.5rem; }
  .rally-host-game .rally-joins-lock svg { width: 1.375rem; height: 1.375rem; }
  .rally-host-game .rally-game-body { padding: clamp(1.25rem,3vw,2.25rem); }
  .rally-host-game .rally-question-kind { margin-bottom: .75rem; }
  .rally-host-game .rally-question-title { margin-bottom: 1.5rem; }
  .rally-host-game .rally-team-role { margin: -.5rem 0 1.125rem; }
  .rally-host-game .rally-question-media { gap: .875rem; margin-bottom: 1.375rem; }
  .rally-host-game .rally-question-media img { border-radius: .625rem; }
  .rally-host-game .rally-answer-grid { gap: .75rem; }
  .rally-host-game .rally-answer-option { gap: .75rem; min-height: 4.5rem; padding: 1rem 1.25rem; font-size: 1.2rem; }
  .rally-host-game .rally-answer-marker { width: 1.75rem; height: 1.75rem; border-radius: .5rem; font-size: .8rem; }
  .rally-host-game .rally-answer-label { font-size: .75rem; }
  .rally-host-game .rally-answer-status { margin-top: 1.125rem; font-size: 1rem; }
  .rally-host-game .rally-matching { gap: .5rem; font-size: 1.1rem; }
  .rally-host-game .rally-matching:has(ul) { gap: 1.25rem; }
  .rally-host-game .rally-matching ul { padding-left: 1.25rem; }
  .rally-host-game .rally-matching li { margin-bottom: .75rem; }
  .rally-host-game .rally-matching-row { gap: 1rem; padding: .75rem 0; font-size: 1.1rem; }
  .rally-host-game .rally-reveal-result { margin-bottom: .75rem; }
  .rally-host-game .rally-correct-answer { margin: .75rem 0; }
  .rally-host-game .rally-explanation { margin-top: 1.375rem; padding-top: 1.125rem; font-size: 1.05rem; }
  .rally-host-game .rally-class-breakdown { gap: clamp(1.5rem,5vw,4rem); margin: 1.75rem 0 2.25rem; }
  .rally-host-game .rally-accuracy-pie { width: clamp(10rem,25vw,16.25rem); }
  .rally-host-game .rally-board-title { margin: 1.375rem 0 .875rem; font-size: 1.25rem; }
  .rally-host-game .rally-leaderboard { gap: .5rem; }
  .rally-host-game .rally-leaderboard li { gap: .875rem; padding: .75rem 1rem; border-radius: .75rem; font-size: 1rem; }
  .rally-host-game .rally-rank { min-width: 1.25rem; }
  .rally-host-game .rally-countdown-beat { width: clamp(9.5rem,28dvh,17rem); margin: .375rem 0 1.5rem; }
  .rally-host-game .rally-countdown .rally-question-title { margin-bottom: 1.5rem; }
  .rally-host-game .rally-waiting-state { gap: 1rem; }
  .rally-host-game .rally-waiting-state .helper { max-width: 22rem; }
  .rally-host-game .rally-orbit-spinner { width: 5.5rem; height: 5.5rem; margin-bottom: .75rem; }
  .rally-host-game .rally-orbit-spinner i { border-width: .25rem; }
  .rally-host-game .rally-orbit-spinner i:nth-child(2) { inset: .75rem; border-width: .1875rem; }
  .rally-host-game .rally-orbit-spinner > span { inset: 2.0625rem; border-radius: .4375rem; }
  .rally-host-game .rally-finale .rally-board-title { margin: 3rem 0 1rem; }
  .rally-host-game .rally-finale .rally-leaderboard { gap: .625rem; }
  .rally-host-game .rally-podium { gap: clamp(.5rem,2vw,1.125rem); }
  .rally-host-game .rally-podium-place { min-height: 10.625rem; gap: .75rem; padding: 1.375rem .875rem; border-radius: 1.25rem; }
  .rally-host-game .rally-podium-place-1, .rally-host-game .rally-podium-place[data-rank="1"] { min-height: 13.125rem; }
  .rally-host-game .rally-podium-place-3 { min-height: 9.0625rem; }
  .rally-host-game .rally-podium-medal { width: 3.125rem; height: 3.125rem; font-size: 1.5rem; }
  .rally-host-game .rally-podium-name { font-size: clamp(.85rem,2.6vw,1.5rem); }
  .rally-host-game .rally-podium-points { font-size: .9rem; }
  .rally-host-game .rally-award, .rally-host-game .rally-trend { grid-template-columns: 2.625rem 1fr; gap: 0 .625rem; padding: 1rem; border-radius: 1rem; }
  .rally-host-game .rally-trend { margin-top: .625rem; }
  .rally-host-game .rally-award-icon { width: 2.625rem; height: 2.625rem; border-radius: .75rem; }
  .rally-host-game .rally-award-icon svg { width: 1.75rem; height: 1.75rem; }
  .rally-host-game .rally-trend-icon { width: 2.25rem; height: 2.25rem; }
  .rally-host-game .rally-trend-icon svg { width: 1.625rem; height: 1.625rem; }
  .rally-host-game .rally-result-stats { gap: .75rem; }
  .rally-host-game .rally-result-stats > div { padding: .875rem; border-radius: .75rem; }
  .rally-host-game .rally-confidence-levels { grid-template-columns: repeat(auto-fit,minmax(8.75rem,1fr)); margin: 0 0 .875rem; }
  .rally-host-game .rally-trend-questions { padding-left: 1.125rem; }
  .rally-host-game .rally-game-error { padding: .625rem .75rem; border-radius: .625rem; font-size: .85rem; }
  .rally-host-game .rally-game-connection { gap: .75rem; padding: .625rem .875rem; border-radius: .75rem; font-size: .85rem; }
  .rally-host-game .rally-game-controls { gap: .625rem; }
  .rally-host-game .rally-game-controls button { min-height: 2.75rem; padding: .625rem .875rem; font-size: .85rem; }
  .rally-host-game .rally-game-controls:has(.rally-fullscreen) { min-height: 2.75rem; padding-right: 3rem; }
  .rally-host-game .rally-game-controls:has(.rally-sound-host) { padding-right: 6rem; }
  .rally-host-game .rally-game-controls.rally-result-controls:has(.rally-sound-host) { padding-right: 0; }
  .rally-game.rally-host-game:has(.rally-result-controls) .rally-game-frame { padding-bottom: 3.375rem; }
  .rally-host-game .rally-host-controls { left: max(1.25rem,env(safe-area-inset-left)); bottom: max(1.125rem,env(safe-area-inset-bottom)); gap: 1.5rem; }
  .rally-game.rally-host-game .rally-control-link { min-height: 2.75rem; padding: .5rem 0; font-size: .85rem; }
  .rally-game.rally-host-game :is(.rally-fullscreen,.rally-sound-host) { bottom: max(1.125rem,env(safe-area-inset-bottom)); width: 2.75rem; height: 2.75rem; min-height: 2.75rem; padding: .625rem; border-radius: .625rem; }
  .rally-game.rally-host-game .rally-fullscreen { right: max(1.25rem,env(safe-area-inset-right)); }
  .rally-game.rally-host-game .rally-sound-host { right: calc(max(1.25rem,env(safe-area-inset-right)) + 3rem); }
  .rally-game.rally-host-game :is(.rally-fullscreen,.rally-sound-host) svg { width: 1.5rem; height: 1.5rem; }
  .rally-host-game .rally-game-confirm { width: min(27.5rem,calc(100vw - 32px)); }
  .rally-host-game .rally-game-confirm > div { padding: 1.75rem; }
}

/* Wide host screens (a TV, projector or laptop in landscape): the round fills the width instead of
   sitting in a narrow column, and side-by-side layouts use the extra room. */
@media (min-width: 900px) and (min-aspect-ratio: 5/4) {
  .rally-host-game .rally-game-frame { width: min(100%,100rem); }
  /* Answer tiles grow with the screen; with an image they stay compact so everything fits. */
  .rally-host-game .rally-answer-option { min-height: max(4.5rem,13vh); }
  .rally-host-game .rally-game-body:has(.rally-question-media) .rally-answer-option { min-height: 4.5rem; }
  .rally-host-game .rally-question-media img { max-height: 22dvh; }
  /* At the reveal the answers matter most, so a picture and the chart step back to make room. */
  .rally-host-game .rally-body-reveal .rally-question-media img { max-height: 15dvh; }
  .rally-host-game .rally-body-reveal:has(.rally-question-media) .rally-accuracy-pie { width: clamp(7rem,17vh,12rem); }
  .rally-host-game .rally-body-reveal:has(.rally-question-media) .rally-accuracy-percent { font-size: clamp(2rem,5.5vh,3rem); }
  /* Reveal: the class breakdown stands beside the answers. */
  .rally-host-results { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: clamp(2rem,4vw,4.5rem); }
  .rally-host-results .rally-class-breakdown { flex-direction: column; gap: 1rem; margin: 0; }
  .rally-host-results .rally-accuracy-pie { width: clamp(8rem,24vh,17rem); }
  .rally-host-results .rally-accuracy-copy { justify-items: center; text-align: center; }
  .rally-host-results .rally-accuracy-percent { font-size: clamp(2.4rem,7vh,4rem); }
  /* Standings and the final results: one centered column, with long standings split in two. */
  .rally-host-game :is(.rally-standings,.rally-finale) > * { max-width: 60rem; margin-inline: auto; }
  .rally-host-game .rally-standings > .rally-question-title { text-align: center; }
  .rally-host-game .rally-leaderboard-columns { grid-template-columns: repeat(2,minmax(0,1fr)); grid-template-rows: repeat(var(--rows),auto); grid-auto-flow: column; column-gap: 1rem; }
  .rally-host-game .rally-finale .rally-awards { gap: 1rem; }
  .rally-host-game .rally-finale-details:has(> .rally-awards) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: clamp(1.5rem,3vw,3rem); margin-top: 3rem; }
  .rally-host-game .rally-finale-details:has(> .rally-awards) .rally-awards { grid-template-columns: 1fr; margin: 0; }
  .rally-host-game .rally-finale-details:has(> .rally-awards) .rally-board-title { margin-top: 0; }
  /* The final buttons share the bottom row with the sound and fullscreen buttons. */
  .rally-host-game .rally-game-controls.rally-result-controls:has(.rally-sound-host) { padding-right: 6rem; }
  .rally-game.rally-host-game:has(.rally-result-controls) .rally-game-frame { padding-bottom: 0; }
}
