.race-active .puzzle-meta{display:none}
#race-panel{flex-shrink:0;margin-bottom:15px}
/* The room's tools (trophy, challenge, language, invite, chat, leave) live in the header; the panel
   starts with the status line: what is happening, then Start, the countdown or the round clock. */
.race-status{display:flex;justify-content:space-between;align-items:center;gap:8px;min-height:25px}
.race-title{min-width:0}
/* Round clock (m:ss): ticks while a round runs, frozen at the final time once it ends. */
.race-timer,.race-result-time{display:inline-flex;align-items:center;gap:4px;flex:none;font-variant-numeric:tabular-nums;font-weight:850;white-space:nowrap}
.race-timer{min-height:25px;padding:3px 9px 3px 7px;border:1px solid #e3d8f7;border-radius:9px;background:#f6f1ff;color:#5b36b8;font-size:13px;line-height:1}
.race-timer svg,.race-result-time svg{width:15px;height:15px;flex:none;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.race-timer:not(.is-running){background:#f3f1f7;border-color:#e6e1ee;color:#5e5670}
/* The final time follows the result line; on a rotated phone it flows inline after its text. */
.race-result-head{display:flex;align-items:center;flex-wrap:wrap;gap:3px 8px;min-width:0}
.race-result-time{display:none;padding:1px 6px;border-radius:7px;background:#ffffffb3;color:#5e5670;font-size:11px;line-height:16px}
.race-result-time svg{width:12px;height:12px}
.race-title{font-size:15px;letter-spacing:-.4px;margin:0}
.race-countdown{font-size:24px;line-height:26px;font-weight:850;color:var(--purple)}
.race-hint{margin:4px 0 9px;font-size:9px;line-height:1.6;color:var(--muted)}
.race-players{display:grid;grid-template-columns:1fr 1fr;gap:9px;margin-top:11px}
.race-player{min-width:0;border:1px solid #eadff8;background:#faf7ff;padding:10px 11px;border-radius:14px}
.race-player.is-me{background:#f2edff;border-color:#e2d3ff}
.race-player.is-away{opacity:.6}
.race-identity{display:flex;align-items:center;gap:7px;min-width:0}
.race-avatar{display:grid;place-items:center;flex-shrink:0;width:29px;height:29px;border-radius:10px;background:#ffeabe;color:#b68725;font-size:15px;font-weight:850}
.is-me .race-avatar{background:#e2d4ff;color:#8155da}
.race-player-details{min-width:0;display:flex;flex-direction:column;gap:3px}
.race-name{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:850}
.race-player-state{font-size:8px;color:#a18aae;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.race-progress{display:flex;gap:5px;margin-top:10px;align-items:center;height:7px}
.race-attempt{display:flex;gap:1px;flex:1;height:6px;border-radius:3px;overflow:hidden}
.race-attempt i{flex:1;display:block;background:#e8dff2;border-radius:1px;min-width:0}
.race-attempt i.submitted{background:#b399e6}
.race-attempt i.correct{background:var(--green)}
.race-attempt i.present{background:var(--gold)}
.race-attempt i.absent{background:var(--absent)}
#race-result{display:flex;gap:9px;align-items:center;justify-content:space-between;background:#f1eaff;border:1px solid #e2d5fb;padding:10px 11px;border-radius:12px;margin-bottom:10px;flex-shrink:0}
.race-result-copy{display:flex;gap:6px;align-items:center;min-width:0}
.race-result-symbol{font-size:20px;color:#dba136}
.race-result-details{display:flex;flex-direction:column;gap:3px;min-width:0}
.race-answer{display:flex;flex-direction:column;align-items:flex-start;gap:2px;margin-top:2px}
.race-answer-label{font-size:10px;line-height:1.3;font-weight:700;color:#79658b}
.race-answer-word{display:block;padding:2px 9px;border:1px solid #b6e6d4;border-radius:7px;background:#dcf6e9;color:#14664d;font-size:26px;line-height:1.2;font-weight:850;letter-spacing:2px;white-space:nowrap}
.race-answer-word:lang(ja){font-family:Manrope,"Hiragino Sans","Hiragino Kaku Gothic ProN","Yu Gothic","Meiryo","Noto Sans JP",sans-serif}
.race-answer-word:lang(zh){font-family:Manrope,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","Noto Sans SC",sans-serif}
.race-result-title{font-size:10px;line-height:1.5}
.race-rematch{font-size:9px;font-weight:850;padding:9px 10px;background:var(--purple);color:white;border-radius:9px;flex-shrink:0;max-width:48%}
@media(max-width:760px){#race-panel{margin-bottom:13px}.race-players{gap:8px}.race-player{background:#ffffffa6}.race-player.is-me{background:#ece2ff99}.race-active .legend{display:none}.race-active .game-message{min-height:29px}}
@media(max-width:760px) and (max-height:780px){#race-panel{margin-bottom:9px}.race-players{margin-top:8px}.race-player{padding:8px 10px}.race-hint{font-size:8px;margin-bottom:6px}.race-title{font-size:14px}.race-avatar{width:26px;height:26px}.race-progress{margin-top:8px}}
@media(max-height:650px){#race-panel{margin-bottom:7px}.race-status{min-height:21px}.race-timer{min-height:21px;padding-block:2px;font-size:12px}.race-title{font-size:12px}.race-hint{margin:2px 0 5px;font-size:7px}.race-players{margin-top:6px;gap:7px}.race-player{padding:7px 8px;border-radius:11px}.race-avatar{width:24px;height:24px;font-size:13px;border-radius:8px}.race-name{font-size:10px}.race-player-state{font-size:7px}.race-progress{margin-top:7px;gap:4px;height:5px}.race-attempt{height:5px}.race-active .game-message{min-height:23px}.race-active .legend{display:none}#race-result{padding:7px 8px;margin-bottom:7px}.race-result-title,.race-rematch{font-size:8px}.race-rematch{padding:7px 8px}}

/* Compact race result: short screens and every phone. The status line steps aside for the board;
   the result card shows the round's final time instead. */
@media(max-height:780px),(max-width:760px){
  html[data-race-phase=finished] .race-status{display:none}
  html[data-race-phase=finished] .race-result-time:not([hidden]){display:inline-flex}
  html[data-race-phase=finished] .race-players{margin-top:0}
  html[data-race-phase=finished] .race-player{padding:6px 8px}
}

@media(max-height:780px){
  .race-answer{flex-direction:row;align-items:center;gap:6px}
  .race-answer-label{font-size:9px}
  .race-answer-word{font-size:22px;padding:1px 7px;letter-spacing:1.5px}
  .race-result-symbol{display:none}
}

html[data-race-phase=finished] .play-area>.feedback-slot:has(.game-message:empty){display:none}

@media(max-height:780px){
  html[data-race-phase=finished] #race-panel{margin-bottom:4px}
  html[data-race-phase=finished] #race-result{padding-block:5px;margin-bottom:4px}
  html[lang=mn][data-race-phase=finished] .board-wrap{margin-bottom:4px}
}

.race-countdown-overlay{position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;pointer-events:none;background:radial-gradient(circle at 50% 45%,#ffffffe6 0,#ffffffb3 38%,#f6f1ff66 70%,transparent 100%);padding:max(16px,env(safe-area-inset-top)) 16px max(16px,env(safe-area-inset-bottom))}
.race-countdown-overlay[hidden]{display:none}
.race-countdown-number{display:grid;place-items:center;min-width:min(46vw,210px);aspect-ratio:1;border-radius:50%;background:var(--purple);color:#fff;font-size:clamp(84px,30vw,150px);font-weight:900;line-height:1;letter-spacing:-4px;font-variant-numeric:tabular-nums;box-shadow:0 18px 50px #8058e94d,inset 0 -8px 0 #00000014}
.race-countdown-overlay.is-go .race-countdown-number{background:#20a873;font-size:clamp(38px,12vw,62px);letter-spacing:-1px;box-shadow:0 18px 50px #20a8734d,inset 0 -8px 0 #00000014}
.race-countdown-hint{max-width:300px;text-align:center;font-size:15px;font-weight:800;color:var(--purple-dark,#4b2c91);line-height:1.4}.race-countdown-hint:empty{display:none}
.race-countdown-number.is-pop{animation:race-count-pop .55s cubic-bezier(.2,1.4,.4,1) both}
@keyframes race-count-pop{0%{transform:scale(1.7);opacity:0}55%{opacity:1}100%{transform:scale(1);opacity:1}}
@media(max-height:480px){.race-countdown-number{min-width:min(34vh,150px);font-size:clamp(64px,22vh,110px)}.race-countdown-hint{font-size:13px}}
@media(prefers-reduced-motion:reduce){.race-countdown-number.is-pop{animation:none}}
/* Rotated phones: the result card is one short row, so the final time rides inline at the end of
   the result line instead of taking a line of its own. */
@media(orientation:landscape) and (max-height:500px){
  html[data-race-phase=finished] .race-result-head{display:block;font-size:10px;line-height:15px}
  html[data-race-phase=finished] .race-result-time:not([hidden]){display:inline;margin-left:4px;padding:1px 4px;line-height:inherit;font-size:10px}
  html[data-race-phase=finished] .race-result-time svg{display:inline;width:10px;height:10px;margin-right:3px;vertical-align:-1px}
}
