/* V49.9 — consistent instrument alignment, optical centering and safe actions. */
#race .hud-right{align-items:center;gap:calc(7 * var(--hu))}
#race .hud-right .hud-speed{flex:none}
#race .hud-right #pause-btn,#race .hud-right #time{
  box-sizing:border-box;margin:0;align-self:center;flex:none;
  height:max(34px,calc(40 * var(--hu)));padding:0;display:grid;place-items:center;
  line-height:1;font-variant-numeric:tabular-nums;
}
#race .hud-right #pause-btn{width:max(34px,calc(41 * var(--hu)));touch-action:manipulation}
#race .hud-right #pause-btn::before,#race .hud-right #pause-btn::after{display:none!important;content:none}
#race #pause-btn svg{display:block;width:max(16px,calc(21 * var(--hu)));height:max(16px,calc(21 * var(--hu)));pointer-events:none}
#race .hud-right #time{
  width:max(50px,calc(88 * var(--hu)));min-width:0;white-space:nowrap;
  font-size:clamp(12px,calc(20 * var(--hu)),34px);letter-spacing:-.035em;
}
#race .hud-coins{align-self:center;margin-top:0}
#race :is(.pos,.hud-coins,.hud-speed,.hud-lap,.best-lap-hud,#pause-btn,#time,.control.steer,#item-btn,#boost-btn,#drift-btn){
  background-color:transparent!important;
}
#race #item-btn.equipped{background-color:transparent!important}
#race #race-notices{gap:calc(5 * var(--hu))}
#race #race-notices #ghost-status{font-weight:800;max-width:100%;line-height:1.14}
#race #race-notices:has(#pass-toast.visible) #race-mission[data-done="0"]{display:none!important}
#race #race-message:not([data-important="true"]){max-width:40%;overflow-wrap:normal}
/* Shared heading and scrollable center for the secondary collection screens. */
#app:has(:is(#history,#awards,#ranking).active){width:100%;max-width:none;height:100dvh;aspect-ratio:auto;border:0;box-shadow:none}
body:has(:is(#history,#awards,#ranking).active){padding:0}
body:has(:is(#history,#awards,#ranking).active)::before{display:none}
:is(#history,#awards,#ranking).active{
  background:linear-gradient(180deg,#071a3840,#071c3785),url('assets/paddock-v110.webp') center/cover no-repeat!important;
  padding:clamp(7px,2dvh,16px);overflow:hidden!important;box-sizing:border-box;
}
:is(#history,#awards,#ranking).active .history-panel{
  --list-gap:clamp(4px,1.5dvh,12px);display:flex!important;flex-direction:column;min-height:0;min-width:0;
  width:min(100%,170dvh,900px)!important;max-height:100%!important;height:min(100%,620px);box-sizing:border-box;
  padding:clamp(7px,2.3dvh,20px)!important;gap:var(--list-gap)!important;
  background:linear-gradient(145deg,#153b68f5,#091f43f8)!important;border:2px solid #94b6dc!important;
  border-top:4px solid #ffe17b!important;border-radius:6px;box-shadow:0 4px #06172f!important;overflow:hidden;
}
:is(#history,#awards,#ranking) .history-panel h1{
  flex:none;font-size:clamp(19px,5.6dvh,38px)!important;line-height:1.1!important;padding:0;margin:0;
  color:#ffe278!important;-webkit-text-fill-color:#ffe278!important;text-shadow:2px 3px #07162f!important;
}
:is(#history,#awards,#ranking) .history-panel>p{flex:none;font:600 clamp(9px,2.6dvh,14px)/1.2 system-ui;margin:0;color:#e4edfa}
:is(#history,#awards,#ranking) .history-list{
  flex:1 1 0;min-height:0!important;max-height:none!important;overflow:auto!important;overscroll-behavior:contain;
  align-content:start;touch-action:pan-y;padding:2px 5px 2px 1px;scrollbar-width:thin;scrollbar-color:#8daecf #10294f;
}
:is(#history,#awards,#ranking) .history-entry{background:#173c67;border:1px solid #82a5c8;border-left:3px solid #8fb6df;border-radius:4px;padding:clamp(5px,1.3dvh,9px) 8px;min-width:0}
:is(#history,#awards,#ranking) .history-entry:is(.earned,.my-rank){border-color:#ffdc6b;background:#3b3c30}
:is(#history,#awards,#ranking) .history-entry span{min-width:0;gap:2px}
:is(#history,#awards,#ranking) .history-entry b{font:800 clamp(10px,2.8dvh,15px)/1.12 system-ui;color:#fff2ca;overflow-wrap:anywhere}
:is(#history,#awards,#ranking) .history-entry strong{font:900 italic clamp(12px,3.1dvh,19px)/1.1 system-ui;color:#ffe16a}
:is(#history,#awards,#ranking) .history-entry small{font:600 clamp(9px,2.35dvh,12px)/1.12 system-ui;color:#d4e2f4}
#history :is(.records-tabs,#record-filters){flex:none;gap:5px;margin:0}
#history #record-filters[hidden]{display:none!important}
#history :is(.records-tabs,#record-filters) button{font:italic 800 clamp(10px,2.7dvh,14px)/1.1 system-ui;min-height:clamp(28px,8dvh,38px);border-radius:4px}
:is(#history,#awards,#ranking) .history-panel>.arcade-btn{
  flex:none;min-height:clamp(31px,10dvh,48px)!important;margin:0!important;padding:5px 10px!important;
  font-size:clamp(12px,3.6dvh,23px)!important;line-height:1.1!important;white-space:normal;
}
/* Clear modal buttons and a replay bar that shrinks around its caption. */
#pause .modal{max-height:94%;overflow:auto;overscroll-behavior:contain;width:min(460px,86%);gap:clamp(4px,1.5dvh,10px);padding:clamp(9px,3dvh,22px)!important}
#pause .modal .arcade-btn{min-height:clamp(33px,10dvh,50px);margin:0!important;font-size:clamp(12px,4.2dvh,22px)!important;line-height:1.1}
#pause .modal h2{font-size:clamp(20px,6dvh,42px)!important;margin:0!important;padding:0}
#pause .modal p,#pause #pause-context{margin:0!important;font-size:clamp(10px,2.7dvh,14px)}
#replay .replay-banner{max-width:100%;min-width:0;gap:clamp(4px,1.2vw,12px);padding:clamp(5px,1.5dvh,10px);border-radius:5px}
#replay .replay-caption{min-width:0;flex:1 1 auto;line-height:1.15}
#replay .replay-caption span{overflow-wrap:anywhere}
#replay .replay-banner button{min-height:34px;white-space:nowrap;font-size:clamp(9px,2.7dvh,13px)}
/* Long button labels must never be clipped on the celebration screen. */
#result .podium-actions .arcade-btn{font:italic 900 clamp(9px,2.65dvh,15px)/1.12 system-ui!important;letter-spacing:-.025em;white-space:normal;overflow-wrap:normal;padding:3px 4px!important;min-width:0;min-height:clamp(30px,9dvh,48px)}
#result .podium-actions #replay-btn small{font:800 clamp(7px,1.9dvh,10px)/1.08 system-ui!important;letter-spacing:0}
#result #result-awards{max-height:2.5em;overflow:auto;scrollbar-width:thin;overscroll-behavior:contain;touch-action:pan-y}
/* Explicit keyboard focus without changing selection or touch behavior. */
.screen button:focus-visible,.screen select:focus-visible,.screen summary:focus-visible{outline:2px solid #fff0a0!important;outline-offset:2px}
@media(orientation:landscape) and (max-height:350px){
  #race .hud-right{gap:3px}
  #race .hud-right #time{font-size:clamp(11px,calc(20 * var(--hu)),16px)}
  #race #race-notices{top:calc(max(8px,env(safe-area-inset-top,0px)) + 104 * var(--hu))}
  #pause .modal{gap:4px}
}
@media(orientation:portrait){
  #race .hud-right{align-items:center;gap:3px}
  #race .hud-right #pause-btn,#race .hud-right #time{height:29px}
  #race .hud-right #pause-btn{width:29px}
  #race .hud-right #time{width:100%;font-size:12px}
  :is(#history,#awards,#ranking).active .history-panel{width:100%!important;height:100%;max-height:100%!important}
}
