/* One game bar replaces the site chrome throughout setup and play. */
body.game-mode-open { --game-header-height: calc(76px + env(safe-area-inset-top, 0px)); }
body[data-view="game"].game-mode-open #appHeader,
body[data-view="game"].game-mode-open #appNav { display: none !important; }
.game-mode-header[hidden] { display: none !important; }
.game-mode-header {
  position: sticky; top: 0; z-index: 12015; min-height: 76px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: max(14px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) 14px max(24px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid rgba(255,255,255,.08); background: #0c0a0f; color: #f7f3ea;
}
.game-mode-brand, .game-mode-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.game-mode-logo { width: 44px; height: 44px; flex: none; border: 1px solid rgba(230,209,91,.45); border-radius: 14px; overflow: hidden; }
.game-mode-logo img { width: 100%; height: 100%; display: block; object-fit: cover; }
.game-mode-copy { min-width: 0; }
.game-mode-copy strong { display: block; font-size: 15px; line-height: 1.2; }
.game-mode-copy small { display: block; margin-top: 4px; color: #aaa39a; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.game-mode-back, .game-mode-help { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: #f7f3ea; font: inherit; font-size: 13px; cursor: pointer; }
.game-mode-back { padding: 8px 16px 8px 0; border: 0; border-right: 1px solid #332e3c; background: transparent; color: #aaa39a; white-space: nowrap; }
.game-mode-back:hover { color: #e6d15b; }
.game-mode-back:disabled { cursor: wait; opacity: .6; }
.game-mode-help { padding: 8px 14px; border: 1px solid #332e3c; border-radius: 12px; background: #19151e; font-weight: 700; }
.game-mode-help-mark { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: #e6d15b; color: #110e08; font-weight: 800; }
.game-mode-help:hover { border-color: rgba(230,209,91,.5); }
.game-mode-back:focus-visible, .game-mode-help:focus-visible { outline: 2px solid #e6d15b; outline-offset: 4px; }
.game-mode-connection { display: inline-flex; align-items: center; gap: 6px; color: #aaa39a; font-size: 11px; white-space: nowrap; }
.game-mode-connection i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.game-mode-connection[data-connection="online"] { color: #74d69b; }
.game-mode-connection[data-connection="offline"] { color: #ef7f7f; }
body[data-view="game"].game-mode-open #gameView { padding-top: 36px; }
body[data-view="game"].game-mode-open #gameRoot .jwq-header { display: none; }
body.game-mode-open #gameRoot:not(.game-home-embedded) { top: var(--game-header-bottom, var(--game-header-height)); height: calc(100dvh - var(--game-header-bottom, var(--game-header-height))); }
body.game-mode-open #gameRoot:not(.game-home-embedded) .jwq-shell { min-height: 0; grid-template-rows: minmax(0, 1fr); }
body.game-mode-open #gameRoot.game-home-embedded .jwq-shell { display: block; }
body.game-mode-open #gameRoot.game-home-embedded .jwq-main { padding: 0 0 40px; }
body.game-mode-open #gameRoot:not(.game-home-embedded) .jwq-main { padding-bottom: max(34px, env(safe-area-inset-bottom, 0px)); }
body.game-mode-open #gameRoot:not(.game-home-embedded) .jwq-main--gameplay { padding-bottom: max(clamp(10px, 2.2dvh, 22px), env(safe-area-inset-bottom, 0px)); }
/* Shared lobby proportions and typography, with focused round cards. */
.solo-embedded .solo-shell { max-width: none; padding: 0 0 24px; }
.solo-embedded .solo-top { justify-content: flex-start; text-align: left; margin-bottom: 38px; max-width: 820px; }
.solo-embedded .solo-title { margin: 20px 0 16px; font-size: clamp(38px, 6vw, 72px); line-height: 1.04; letter-spacing: -.04em; font-weight: 800; color: #f7f3ea; }
.solo-embedded .solo-subtitle { max-width: 640px; margin: 0; color: #aaa39a; font-size: clamp(16px, 2vw, 20px); line-height: 1.55; }
.solo-embedded .solo-chips { display: none; }
.solo-embedded .solo-lobby { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.25fr); gap: 36px; padding: 32px; border: 1px solid rgba(230,209,91,.35); border-radius: 24px; background: linear-gradient(115deg, #363225, #211e26 48%, #282231); }
.solo-embedded .solo-lobby::after { content: ''; position: absolute; width: 170px; height: 170px; border: 1px solid rgba(230,209,91,.12); border-radius: 50%; top: -100px; right: -70px; pointer-events: none; }
.solo-lobby-controls { min-width: 0; }
.solo-embedded .solo-lobby-heading h2 { font-size: clamp(25px, 3vw, 34px); line-height: 1.18; letter-spacing: -.025em; margin: 22px 0 12px; }
.solo-embedded .solo-lobby-heading p { color: #b6afa4; font-size: 14px; }
.solo-embedded .solo-lobby-heading .game-hub-tags { margin: 22px 0 0; }
.solo-embedded .solo-settings-row { margin-top: 0; grid-template-columns: minmax(0, 1fr) 100px; gap: 14px; }
.solo-embedded .solo-round-setting select {
  -webkit-appearance: none; appearance: none; padding-right: 38px; color-scheme: dark; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, #e6d15b 50%), linear-gradient(135deg, #e6d15b 50%, transparent 50%);
  background-position: calc(100% - 19px) calc(50% - 2px), calc(100% - 14px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.solo-embedded .solo-position { flex-wrap: nowrap; }
.solo-embedded .solo-position label { justify-content: center; flex: 1; min-width: 0; }
.solo-embedded .solo-lobby .jwq-categories legend { font-size: 14px; }
.solo-embedded .solo-lobby .jwq-filter-empty-note { margin-bottom: 18px; }
.solo-embedded .solo-primary { min-height: 48px; }
.solo-embedded .solo-arena, .solo-embedded .solo-game-progress, .solo-embedded .solo-rules { max-width: 640px; margin-left: auto; margin-right: auto; }
.solo-embedded:has(.solo-lobby:not([hidden])) .solo-rules { display: none; }
.solo-embedded .solo-game-progress { margin-top: 8px; margin-bottom: 18px; }
.game-help-dialog { position: fixed; inset: 0; margin: auto; height: fit-content; overflow: auto; overscroll-behavior: contain; width: min(780px, calc(100% - 32px)); max-height: calc(100dvh - 40px); padding: 28px; border: 1px solid #51452a; border-radius: 22px; background: #17131e; color: #f7f3ea; font: inherit; }
/* Center help against the viewport, including the long embedded quiz home. */
#gameRoot.jwq-root--help-open { z-index: 12020; }
#gameRoot .jwq-help-overlay {
  position: fixed; inset: 0; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
#gameRoot .jwq-help-dialog {
  min-height: 0;
  max-height: calc(100dvh - max(16px, env(safe-area-inset-top, 0px)) - max(16px, env(safe-area-inset-bottom, 0px)));
}
.game-help-dialog::backdrop { background: rgba(0,0,0,.75); backdrop-filter: blur(5px); }
.songless-help-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.game-help-dialog form { flex: none; margin: 0; }
/* Draw the close mark geometrically so font metrics cannot shift it. */
.game-help-dialog form button, #gameRoot [data-jwq-action="close-help"] {
  position: relative; width: 42px; height: 42px; min-height: 42px; padding: 0; flex: none; font-size: 0; line-height: 1;
}
.game-help-dialog form button::before, .game-help-dialog form button::after,
#gameRoot [data-jwq-action="close-help"]::before, #gameRoot [data-jwq-action="close-help"]::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 14px; height: 1.5px; border-radius: 2px; background: currentColor;
  transform: translate(-50%, -50%) rotate(45deg); pointer-events: none;
}
.game-help-dialog form button::after, #gameRoot [data-jwq-action="close-help"]::after { transform: translate(-50%, -50%) rotate(-45deg); }
.game-help-dialog p { color: #b6afa4; line-height: 1.55; }
.game-help-dialog h2 { margin: 14px 0 0; font-size: clamp(28px, 4.5vw, 44px); line-height: 1.04; letter-spacing: -.04em; }
.game-help-dialog .game-hub-eyebrow { margin: 0; color: #e6d15b; }
.game-help-dialog .songless-help-lead { max-width: 580px; margin: 18px 0 22px; font-size: 15px; }
.songless-help-fragments { padding: 16px 18px; border: 1px solid rgba(230,209,91,.22); border-radius: 16px; background: linear-gradient(115deg, rgba(230,209,91,.09), rgba(255,255,255,.02)); }
.songless-help-fragments h3 { font-size: 13px; font-weight: 700; }
.songless-help-timeline { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.songless-help-timeline li { min-width: 0; display: grid; grid-template-rows: 48px auto; align-items: end; gap: 10px; text-align: center; }
.songless-help-bar { display: block; height: var(--fragment-height); width: min(100%, 64px); margin: 0 auto; border-radius: 5px; background: #e6d15b; opacity: .8; }
.songless-help-timeline li:first-child .songless-help-bar { opacity: 1; box-shadow: 0 0 18px rgba(230,209,91,.2); }
.songless-help-timeline strong { color: #e6d15b; font-size: 15px; white-space: nowrap; }
.songless-help-timeline small { font-size: 11px; font-weight: 400; }
.songless-help-steps { margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; list-style: none; counter-reset: songless-help-step; }
.songless-help-steps li { min-width: 0; padding: 16px; display: grid; align-content: start; gap: 9px; border: 1px solid #332e3c; border-radius: 16px; background: rgba(255,255,255,.026); counter-increment: songless-help-step; }
.songless-help-steps strong { font-size: 14px; }
.songless-help-steps strong::before { content: "0" counter(songless-help-step) " · "; color: #e6d15b; }
.songless-help-steps span, .songless-help-notes span { color: #b6afa4; font-size: 12px; line-height: 1.55; }
.songless-help-steps b { color: #e6d15b; }
.songless-help-notes { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.songless-help-notes article { min-width: 0; padding: 14px; display: grid; gap: 6px; border-radius: 14px; background: rgba(230,209,91,.055); }
.songless-help-notes strong { color: #e6d15b; font-size: 12px; }
@media (max-width: 620px) {
  .game-help-dialog { padding: 22px; border-radius: 18px; }
  .songless-help-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; }
  .songless-help-heading > div { display: contents; }
  .songless-help-heading form { grid-column: 2; grid-row: 1; }
  .songless-help-heading h2 { grid-column: 1 / -1; margin-top: 0; }
  .songless-help-steps, .songless-help-notes { grid-template-columns: 1fr; }
  .songless-help-steps li { gap: 6px; padding: 14px; }
  .songless-help-timeline { gap: 7px; }
}
@media (max-width: 360px) {
  .game-help-dialog { padding: 18px; }
  .songless-help-fragments { padding: 14px 12px; }
  .songless-help-timeline { gap: 5px; }
  .songless-help-timeline strong { font-size: 13px; }
}
@media (max-width: 760px) {
  .game-mode-header { min-height: 64px; gap: 10px; padding: max(10px, env(safe-area-inset-top, 0px)) 16px 10px; }
  .game-mode-brand, .game-mode-actions { gap: 9px; }
  .game-mode-copy strong { font-size: 13px; }
  .game-mode-copy small, .game-mode-connection { display: none; }
  .game-mode-logo { width: 38px; height: 38px; border-radius: 12px; }
  .game-mode-back { padding-right: 10px; font-size: 12px; }
  body[data-view="game"].game-mode-open #gameView { padding-top: 28px; }
  .solo-embedded .solo-top { margin-bottom: 28px; }
  .solo-embedded .solo-lobby { grid-template-columns: 1fr; padding: 24px; gap: 28px; }
  .solo-lobby-heading > .game-hub-icon { display: none; }
  .solo-embedded .solo-lobby-heading h2 { margin-top: 0; }
}
@media (max-width: 480px) {
  .game-mode-header { padding-left: 12px; padding-right: 12px; }
  .game-mode-help { width: 44px; padding: 8px; flex: none; }
  .game-mode-help-label { display: none; }
  .game-mode-back { padding-right: 8px; }
  .game-mode-copy strong { font-size: 12px; }
  .solo-embedded .solo-title { font-size: 38px; }
  .solo-embedded .solo-lobby { padding: 22px 18px; }
  .solo-embedded .solo-settings-row { grid-template-columns: 1fr; }
  .solo-round-setting { max-width: 110px; }
  .solo-embedded .solo-position label { font-size: 12px; padding-left: 8px; padding-right: 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .game-mode-header:not([hidden]) { animation: game-panel-in .22s ease-out; }
  .solo-embedded .solo-top:not([hidden]) { animation: game-panel-in .22s ease-out; }
  @keyframes game-panel-in { from { opacity: .45; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }
}

.solo-embedded:is([data-status="idle"], [data-status="playing"], [data-status="finished"]) .solo-status { display: none; }

/* Scores describe this party only; the mean excludes unsolved tracks. */
.solo-round-score { margin: 12px 0 0; color: #aaa39a; font-size: 13px; line-height: 1.5; }
.solo-game-stats { width: 100%; margin-top: 24px; }
.solo-stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; }
.solo-stat-grid > div { min-width: 0; padding: 16px 10px; border: 1px solid #332e3c; border-radius: 14px; background: rgba(230,209,91,.04); display: flex; flex-direction: column; justify-content: space-between; gap: 12px; }
.solo-stat-grid dt { color: #aaa39a; font-size: 12px; line-height: 1.4; }
.solo-stat-grid dd { margin: 0; color: #e6d15b; font-size: clamp(18px, 2vw, 24px); font-weight: 750; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.solo-average-note { margin: 10px 0 0; color: #aaa39a; font-size: 12px; line-height: 1.5; }
.solo-round-results li { display: grid; gap: 6px; }
.solo-round-title { color: #e8e4de; overflow-wrap: anywhere; line-height: 1.45; }
.solo-round-detail { color: #aaa39a; font-size: 12px; line-height: 1.5; }
.solo-round-results [data-solved="true"] .solo-round-detail { color: #cabb70; }
.game-help-dialog .songless-help-scoring { display: grid; gap: 6px; margin: 16px 0 0; font-size: 12px; }
.songless-help-scoring strong { color: #e6d15b; }
@media (max-width: 480px) {
  .solo-stat-grid { grid-template-columns: 1fr; gap: 8px; }
  .solo-stat-grid > div { flex-direction: row; align-items: center; padding: 14px; gap: 14px; }
  .solo-stat-grid dt { text-align: left; }
  .solo-stat-grid dd { text-align: right; flex: none; font-size: 21px; }
}
