/* Approved enameled PIT rails. Music engraving and green/red feedback stay independent. */
:root{--pit-face:#147fa6;--pit-deep:#085582;--pit-rail:#38bfd7;--pit-light:#b9f4ff;--pit-edge:#083e69;--pit-pale:#effbff;--paper:var(--pit-deep);--pixel-panel:var(--pit-deep);--pixel-edge:var(--pit-rail);--line:var(--pit-rail);--blue:var(--pit-light);--muted:#fff;--ink:#fff;--pixel-gold:#fff0a9}
body{background-color:var(--pit-deep);color:#fff}
.masthead nav{background:var(--pit-deep);border:4px solid var(--pit-rail);box-shadow:4px 4px var(--pit-edge),inset 0 3px var(--pit-light)}
.masthead .nav.active{background:var(--pit-light);color:var(--pit-edge)}
.lobby>h1,.lobby .practice-switch,.lobby .setup-controls,.lobby .start-line{background:var(--pit-deep);border-color:var(--pit-rail)}
.lobby .practice-switch button{background:var(--pit-face);border:3px solid var(--pit-rail);color:#fff;box-shadow:inset 0 2px var(--pit-light),inset 0 -3px var(--pit-edge)}
.lobby .practice-switch button[aria-pressed=true]{color:var(--pit-edge);background:var(--pit-light);border-color:#fff}
.player-page,.stats-page,.room-menu,.question-panel,.track-panel,body[data-view=arena] section.arena{background:var(--pit-face);border:20px solid transparent;border-image:var(--pit-frame) 16 / 20px stretch;box-shadow:0 5px var(--pit-edge);border-radius:0;background-clip:padding-box}
.player-page,.stats-page{padding:20px;max-width:1200px}
body[data-view=arena] section.arena{padding:12px 16px 16px;color:#fff}
.arena .game-top,.arena .game-top .text-button,.arena .game-top #gameContext,.arena #clock,.arena #clock span{color:#fff}
.arena .race-controls{display:flex;align-items:center;gap:12px;white-space:nowrap}
.arena .race-controls .text-button{min-height:44px;padding:6px 2px}
.arena #newRace{color:var(--pit-light);text-decoration:underline;text-decoration-thickness:2px;text-underline-offset:4px}
.intro-preference{display:flex;align-items:center;gap:12px;min-height:48px;margin:16px 0 24px;cursor:pointer;color:#fff;font:22px/1.3 var(--pixel-text,'Pixel UI',monospace)}
.intro-preference input{appearance:auto;width:24px;height:24px;min-width:24px;margin:0;accent-color:var(--pit-light);cursor:pointer}
.intro-preference input:focus-visible{outline:3px solid var(--pit-light);outline-offset:4px}
.arena .prompt:not(:has(.counting-builder)){background:var(--pit-pale);border-color:var(--pit-light);box-shadow:0 4px var(--pit-edge)}
.player-sections{border-bottom:4px solid var(--pit-edge);gap:20px;flex-wrap:wrap}
.player-sections button,.shop-slots button,.player-page .text-button{color:#fff}
.player-sections button[aria-pressed=true],.shop-slots button[aria-pressed=true]{color:#fff;text-decoration-color:var(--pit-light)}
.garage-item,.achievement{background:var(--pit-deep);border:3px solid var(--pit-rail);border-radius:0;box-shadow:inset 0 3px var(--pit-light),0 3px var(--pit-edge);color:#fff}
.garage-item[aria-pressed=true]{background:var(--pit-edge);outline:3px solid #fff;outline-offset:2px}
.garage-item small,.achievement p,.achievement span,.achievement small{color:#e4efff}
.garage-item.locked .sticker-art,.garage-item.locked .vehicle-thumb,.achievement.locked .sticker-art,.theme-choice.locked .theme-swatch{filter:grayscale(1);opacity:.7}
.garage-item progress,.theme-choice progress,.achievement progress{appearance:none;width:calc(100% - 12px);height:5px;min-height:5px;border:0;box-shadow:none;background:#173048;margin:4px 6px 0;accent-color:var(--pit-light)}
.garage-item progress::-webkit-progress-bar,.theme-choice progress::-webkit-progress-bar,.achievement progress::-webkit-progress-bar{background:#173048}
.garage-item progress::-webkit-progress-value,.theme-choice progress::-webkit-progress-value,.achievement progress::-webkit-progress-value{background:var(--pit-light)}
.garage-item progress::-moz-progress-bar,.theme-choice progress::-moz-progress-bar,.achievement progress::-moz-progress-bar{background:var(--pit-light)}
.achievement{padding:12px;position:relative}.achievement details>summary{cursor:pointer;list-style:none}.achievement details>summary::-webkit-details-marker{display:none}.achievement details p{margin-top:8px;min-height:0}.achievement.locked h3{margin-bottom:0}
.garage-selection,.garage-unlock,.coin-details{color:#fff}.garage-price-hint,.garage-description,.garage-unlock p{color:#e2efff}
.part-tabs button,.badge-pagination button{border-radius:0;border:3px solid var(--pit-rail);background:var(--pit-deep);color:#fff;min-height:44px}
.part-tabs button[aria-pressed=true]{background:var(--pit-light);color:var(--pit-edge)}
.theme-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;max-width:760px}
.theme-choice{position:relative;min-height:116px;padding:10px;border:3px solid var(--pit-rail);border-radius:0;background:var(--pit-deep);color:#fff;font:22px/1.3 var(--pixel-text,'Pixel UI',monospace);box-shadow:0 4px var(--pit-edge)}
.theme-choice[aria-pressed=true]{outline:3px solid #fff;outline-offset:2px}
.theme-choice[data-theme=rainbow] .theme-swatch{border:0;padding:7px;box-shadow:none;background:linear-gradient(90deg,#e35769 0 16.667%,#ed9950 16.667% 33.333%,#e9cf67 33.333% 50%,#61c99c 50% 66.667%,#61bade 66.667% 83.333%,#ad88e8 83.333% 100%)}
.theme-choice[data-theme=rainbow] .theme-swatch::after{content:'';display:block;height:100%;background:var(--swatch);box-shadow:inset 0 -5px var(--swatch-dark),inset 0 3px #ffffff66}
.theme-swatch{display:block;width:100%;height:52px;background:var(--swatch);border:8px solid var(--swatch-light);box-shadow:inset 0 -5px var(--swatch-dark),inset 0 3px #ffffffaa;margin-bottom:8px;clip-path:polygon(4px 0,calc(100% - 4px) 0,calc(100% - 4px) 4px,100% 4px,100% calc(100% - 4px),calc(100% - 4px) calc(100% - 4px),calc(100% - 4px) 100%,4px 100%,4px calc(100% - 4px),0 calc(100% - 4px),0 4px,4px 4px)}
#themeRequirement{min-height:1.5em;color:#fff;font:20px/1.4 var(--pixel-text,'Pixel UI',monospace)}
.room-menu select,.game-picker select{border-color:var(--pit-rail)}
.question-panel .question-meta,.track-top,.room-bar{background:var(--pit-deep);color:#fff;border-color:var(--pit-rail)}
#garagePanel .garage-collection{background:var(--pit-deep);border:16px solid transparent;border-image:var(--pit-frame) 16 / 16px stretch;box-shadow:none;background-clip:padding-box}
#garagePanel .garage-item{background:var(--pit-face);border:3px solid var(--pit-rail);box-shadow:inset 0 3px var(--pit-light),0 3px var(--pit-edge);border-radius:0;color:#fff}
#garagePanel .garage-item[aria-pressed=true]{background:var(--pit-edge);border-color:#fff;outline:2px solid #fff;outline-offset:1px}
#garagePanel .garage-item:hover:not([aria-pressed=true]){background:var(--pit-edge);border-color:var(--pit-light)}
#garagePanel .shop-slots,#garagePanel .garage-selection,#garagePanel .garage-unlock{background:var(--pit-deep);border-color:var(--pit-rail);color:#fff;box-shadow:none}
#garagePanel .shop-slots button{background:var(--pit-face);border-color:var(--pit-rail);color:#fff}
#garagePanel .shop-slots button[aria-pressed=true]{background:var(--pit-light);color:var(--pit-edge);border-color:#fff}
#garagePanel .garage-filter-row label,#garagePanel .garage-selection h3,#garagePanel .garage-preview-controls .text-button,#garageDescription,.badge-filters label{color:#fff}
.player-sections button[aria-pressed=true]{background:var(--pit-light);color:var(--pit-edge);border-color:#fff}
@media(max-width:600px){.player-page,.stats-page,.room-menu,.question-panel,.track-panel,body[data-view=arena] section.arena{border-width:12px;border-image-width:12px}.player-page,.stats-page{padding:10px}.theme-grid{gap:8px}.theme-choice{font-size:19px;padding:6px}.theme-swatch{border-width:6px;height:44px}body[data-view=arena] section.arena{padding:8px}}

/* Counting needs room for music, actions and four beat rows. */
body[data-view=arena] section.arena:has(.counting-game){width:calc(100% - 36px);max-width:1100px;min-height:0;padding:8px 10px 12px;border-width:10px;border-image-width:10px}
/* The solo circuit is a body-level overlay at z=8. Raising only its child
   arena cannot escape main's z=1 stacking context; raise that context too. */
body[data-view=arena]:has(section.arena .counting-game)>main{position:relative;z-index:9}
.counting-mode #arena{display:flex;flex-direction:column;gap:10px}
.counting-mode #arena>.question-panel{width:100%;max-width:none;border-width:10px;border-image-width:10px;padding:8px 10px}
.counting-mode #arena>.track-panel{position:relative;inset:auto;width:100%;max-height:none;height:132px;overflow:hidden;border-width:8px;border-image-width:8px;opacity:1}
.counting-mode #arena>.track-panel .track-scroll,.counting-mode #arena>.track-panel .track-bottom,.counting-mode #overviewToggle{display:none}
.counting-mode #arena>.track-panel .track-top{height:32px;padding:2px 10px}
.counting-mode #arena>.track-panel .closeup{display:block;margin:0;border:0;height:84px;overflow:hidden}
.counting-mode #arena>.track-panel #closeCanvas{width:100%;height:84px;object-fit:contain}
@media(orientation:landscape) and (max-height:500px){
 body[data-view=arena]:has(section.arena .counting-game) .masthead{height:48px;min-height:0;width:100%;max-width:none;padding:0 18px;align-items:center;gap:12px}
 body[data-view=arena]:has(section.arena .counting-game) .masthead .logo{width:146px;max-width:45%}
 body[data-view=arena] section.arena:has(.counting-game){display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 12px;margin:0 auto 10px;padding:4px 10px}
 body[data-view=arena] section.arena:has(.counting-game) .game-top{grid-column:1;grid-row:1;min-height:44px;margin:0}
 body[data-view=arena] section.arena:has(.counting-game) .game-metrics{grid-column:2;grid-row:1;min-height:44px;margin:0;gap:8px}
 body[data-view=arena] section.arena:has(.counting-game) #answers{grid-column:1 / -1}
 body[data-view=arena] section.arena:has(.counting-game) #hoctopusRaceStatus,body[data-view=arena] section.arena:has(.counting-game) #recoveryStatus{grid-column:1 / -1;margin:0}
 .counting-game .counting-actions{margin:0}
 .counting-game .rhythm-check,.counting-game .counting-clear{margin-top:0;min-height:44px}
 .counting-mode[data-view=arena] main{padding:0 18px 10px}
 .counting-mode[data-view=arena] .masthead{min-height:48px;padding:2px 18px;flex-wrap:nowrap;gap:8px}
 .counting-mode[data-view=arena] .masthead .brand{width:160px;flex-shrink:0}
 .counting-mode[data-view=arena] .masthead .brand img{height:40px}
 .counting-mode[data-view=arena] .masthead .local-marker{display:none}
 .counting-mode[data-view=arena] .room-bar{min-height:44px;margin-bottom:4px;gap:8px;flex-wrap:nowrap}
 .counting-mode[data-view=arena]:has(#questionPanel:not([hidden])) .room-bar #roomTitle,.counting-mode[data-view=arena]:has(#questionPanel:not([hidden])) .room-bar #copy,.counting-mode[data-view=arena]:has(#questionPanel:not([hidden])) .room-bar #copyCode{display:none}
 .counting-mode[data-view=arena] .room-info{flex-wrap:nowrap;gap:8px}
 .counting-mode[data-view=arena] #arena>.question-panel{order:0;padding:4px 10px}
 .counting-mode[data-view=arena] #arena>.track-panel{order:1}
 .counting-mode[data-view=arena] .question-meta{margin-bottom:4px}
 .counting-mode[data-view=arena] .question-footer{padding-top:4px}
}
/* Every setup panel follows the selected enamel palette, including the mobile layout. */
body[data-view=lobby],body[data-view=access]{background-color:var(--pit-deep)}
body[data-view=lobby]::before,body[data-view=access]::before{background:var(--pit-edge);opacity:.22}
.lobby>h1,.lobby .race-details #roundSize{color:var(--pit-light)}
.lobby .start-line{border-top-color:var(--pit-rail);box-shadow:5px 6px var(--pit-edge)}
.lobby .garage::before{display:none;content:none}
.lobby .garage .earned-levels{background:var(--pit-deep);border-color:var(--pit-rail);box-shadow:4px 4px var(--pit-edge)}
.lobby .garage .level-choice,.lobby .race-format button,.lobby .duration-controls button,.lobby .valve-controls button,.lobby .favorite-instruments button{background:var(--pit-face);border-color:var(--pit-rail);color:#fff}
.lobby .garage .level-choice[aria-pressed=true],.lobby .race-format button[aria-pressed=true],.lobby .duration-controls button[aria-pressed=true],.lobby .valve-controls button[aria-pressed=true],.lobby .favorite-instruments button[aria-pressed=true]{background:var(--pit-light);border-color:#fff;color:var(--pit-edge)}
.lobby .practice-switch button:hover:not([aria-pressed=true]){background:var(--pit-face);border-color:var(--pit-light)}
.lobby select,.lobby #instrument,.lobby .piece-controls select{background:var(--pit-pale);color:var(--pit-edge);border-color:var(--pit-light);border-right-color:var(--pit-rail);border-bottom-color:var(--pit-rail)}
.lobby select option{background:var(--pit-pale);color:var(--pit-edge)}
.lobby .instrument-label,.lobby .field-label,.lobby .piece-controls label,.lobby .tempo-controls label,.lobby .tempo-stake,.lobby .race-details #unlockRule{color:#fff}
.lobby .tempo-controls output{color:var(--pit-light)}
.lobby .tempo-controls input{accent-color:var(--pit-light)}
.lobby #setupStatus{background:var(--pit-deep)}
.masthead .nav:not(.active):not(.tutti-nav):hover{background:var(--pit-face);color:#fff}
/* Nine compact illustrated tabs; the button's accessible name and hover title remain. */
.player-sections{gap:10px}
.player-sections button[data-navigation-icon],#garagePanel .shop-slots button[data-navigation-icon]{display:grid;place-items:center;padding:6px;width:58px;min-width:48px;height:52px;min-height:48px;flex:none;background:var(--pit-face);border:3px solid var(--pit-rail);box-shadow:inset 0 2px var(--pit-light),0 3px var(--pit-edge);text-decoration:none}
.player-sections button[data-navigation-icon][aria-pressed=true],#garagePanel .shop-slots button[data-navigation-icon][aria-pressed=true]{background:var(--pit-light);border-color:#fff;box-shadow:0 3px var(--pit-edge)}
.navigation-art{display:block;width:32px;height:32px;overflow:visible;image-rendering:pixelated}
#garagePanel .shop-slots{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-start;padding:8px;margin:0}
#garagePanel .garage-tools{align-items:flex-start}
@media(max-width:600px){.player-sections button[data-navigation-icon],#garagePanel .shop-slots button[data-navigation-icon]{width:48px;height:48px;padding:5px}.player-sections{gap:8px}#garagePanel .shop-slots{gap:5px;padding:6px}#garagePanel .garage-tools{gap:4px;flex-wrap:wrap}}
/* Tire trails stay behind the vehicle; tailpipe exhaust keeps its foreground canvas. */
#garageCarWrap .garage-trails{position:absolute;inset:0;width:100%;height:100%;z-index:0;pointer-events:none}
#garageCarWrap>.paper-vehicle{z-index:1}
/* Header controls and wallet share the same selected shell palette. */
.masthead .audio-mute,.masthead .audio-controls>summary,.masthead .icon-button,.coin-wallet,#previewBurst{background:var(--pit-deep);border-color:var(--pit-rail);color:var(--pit-light);box-shadow:3px 3px var(--pit-edge)}
@media(max-width:600px){#garagePanel .shop-slots{gap:3px;padding:3px}#garagePanel .shop-slots button[data-navigation-icon]{width:44px;min-width:44px;height:48px;padding:3px}}
@media(orientation:landscape) and (max-height:360px){body[data-view=arena] section.arena:has(.counting-game) .game-top{display:flex;gap:6px}body[data-view=arena] section.arena:has(.counting-game) #gameContext{font-size:14px;white-space:nowrap}body[data-view=arena] section.arena:has(.counting-game) .game-metrics{flex-wrap:nowrap}body[data-view=arena] section.arena:has(.counting-game) #clock{font-size:20px}}

/* Reveal is independent of answer markup: Counting replaces the original class. */
[data-race-concealed=true],[data-race-concealed=true] *,[data-input-blocked=true],[data-input-blocked=true] *{visibility:hidden!important}
.input-landscape-blocked{position:relative;overflow-x:clip;min-height:180px}
.input-rotate{position:absolute;z-index:12;inset:0;display:grid;place-items:center;text-align:center;padding:18px;color:var(--pit-light);font:26px/1.2 var(--hand);pointer-events:none}
.input-rotate[hidden]{display:none}
/* A complete mallet keyboard shares the full screen width, never a swipe strip. */
body[data-view=arena] section.arena:has(.mallet-answers){width:calc(100% - 36px);max-width:1100px;min-height:0;padding:8px 10px 12px;border-width:10px;border-image-width:10px}
body[data-view=arena]:has(section.arena .mallet-answers)>main{position:relative;z-index:9}
.arena .answers.mallet-answers,.mallet-mode .answers.mallet-answers{max-width:none;width:100%;overflow:visible}
.arena .mallet-keyboard,.mallet-mode .mallet-keyboard{min-width:0;width:100%;box-sizing:border-box;grid-template-columns:repeat(var(--bar-columns),minmax(0,1fr))}
.mallet-mode #arena{display:flex;flex-direction:column;gap:10px}
.mallet-mode #arena>.question-panel{width:100%;max-width:none;border-width:10px;border-image-width:10px;padding:8px 10px;order:0}
.mallet-mode #arena>.track-panel{order:1;max-height:260px}
@media(orientation:landscape) and (max-height:600px){
 body[data-view=arena]:has(section.arena .mallet-answers) .masthead{height:48px;min-height:0;width:100%;max-width:none;padding:0 18px;gap:12px}
 body[data-view=arena]:has(section.arena .mallet-answers) .masthead .logo{width:146px;max-width:45%}
 body[data-view=arena] section.arena:has(.mallet-answers){display:grid;grid-template-columns:minmax(0,1fr) auto;gap:0 12px;margin:0 auto 10px;padding:4px 10px}
 body[data-view=arena] section.arena:has(.mallet-answers) .game-top{grid-column:1;grid-row:1;min-height:44px;margin:0}
 body[data-view=arena] section.arena:has(.mallet-answers) .game-metrics{grid-column:2;grid-row:1;min-height:44px;margin:0;gap:8px}
 body[data-view=arena] section.arena:has(.mallet-answers) #answers,body[data-view=arena] section.arena:has(.mallet-answers) .prompt{grid-column:1 / -1;margin:0}
 body[data-view=arena] section.arena:has(.mallet-answers) .prompt{height:70px;min-height:0;padding:0}
 body[data-view=arena] section.arena:has(.mallet-answers) .notation{height:70px;width:auto}
 .arena .mallet-keyboard,.mallet-mode .mallet-keyboard{grid-template-rows:58px 80px 16px;row-gap:4px;column-gap:2px;padding-top:5px;background:linear-gradient(0deg,transparent 0 37px,#785131 37px 43px,transparent 43px 108px,#785131 108px 114px,transparent 114px)}
 .arena .mallet-keyboard .mallet-bar,.mallet-mode .mallet-keyboard .mallet-bar{height:var(--bar-height);min-height:44px}
 .mallet-mode[data-view=arena] main{padding:0 18px 10px}
 .mallet-mode[data-view=arena] .masthead{min-height:48px;padding:2px 18px;flex-wrap:nowrap;gap:8px}
 .mallet-mode[data-view=arena] .masthead .brand{width:160px;flex-shrink:0}
 .mallet-mode[data-view=arena] .masthead .brand img{height:40px}
 .mallet-mode[data-view=arena] .masthead .local-marker{display:none}
 .mallet-mode[data-view=arena] .room-bar{min-height:44px;margin-bottom:4px;gap:8px;flex-wrap:nowrap}
 .mallet-mode[data-view=arena]:has(#questionPanel:not([hidden])) .room-bar #roomTitle,.mallet-mode[data-view=arena]:has(#questionPanel:not([hidden])) .room-bar #copy,.mallet-mode[data-view=arena]:has(#questionPanel:not([hidden])) .room-bar #copyCode{display:none}
 .mallet-mode[data-view=arena] .room-info{flex-wrap:nowrap;gap:8px}
 .mallet-mode[data-view=arena] #arena>.question-panel{padding:4px 10px}
 .mallet-mode[data-view=arena] .question-meta{margin-bottom:2px}
 .mallet-mode[data-view=arena] #notation .notation{height:65px;max-height:65px}
 .mallet-mode[data-view=arena] #notation{min-height:0}
 .mallet-mode[data-view=arena] #prompt{display:none}
 .mallet-mode[data-view=arena]:has(#questionPanel:not([hidden])) .room-code-label{display:none}
 .mallet-mode[data-view=arena] .room-info{width:auto}
 .mallet-mode[data-view=arena] .room-bar{display:flex;align-items:center;justify-content:space-between;height:44px;min-height:44px}
 .mallet-mode[data-view=arena] .question-footer{padding-top:2px}
}

@media(orientation:landscape) and (max-height:360px){
 .arena .mallet-keyboard,.mallet-mode .mallet-keyboard{grid-template-rows:44px 60px 14px;row-gap:3px}
 body[data-view=arena] section.arena:has(.mallet-answers) .prompt,body[data-view=arena] section.arena:has(.mallet-answers) .notation,.mallet-mode[data-view=arena] #notation .notation{height:45px;max-height:45px}
 .mallet-mode[data-view=arena] .masthead{height:48px;min-height:48px;padding-block:0}
 .mallet-mode[data-view=arena] .masthead .quiet,.mallet-mode[data-view=arena] .audio-controls>summary{padding-block:2px}
}
