/* Final surface system: dark cards, thin bevels and real inner spacing. */
/* Purchase acknowledgement stays over the card without moving its controls. */
.rally-ui #app #shop-list>.item {position:relative;}
.rally-ui #app #shop-list>.shop-purchased {animation:shop-purchase-pulse 1.2s ease-out;}
.rally-ui #app .shop-purchase-feedback {position:absolute;z-index:2;left:5px;right:5px;top:5px;display:block;padding:7px 4px;border:1px solid #9fefba;border-radius:6px;background:#164b39;color:#f4fff8;font:800 14px/1.2 Arial,sans-serif;text-align:center;pointer-events:none;animation:shop-purchase-confirm 1.2s ease-out both;}
@keyframes shop-purchase-pulse {0%,25%{outline:2px solid #9fefba;outline-offset:-2px;}100%{outline:2px solid transparent;outline-offset:-2px;}}
@keyframes shop-purchase-confirm {0%{opacity:0;transform:translateY(5px) scale(.96);}15%,75%{opacity:1;transform:translateY(0) scale(1);}100%{opacity:0;transform:translateY(-6px);}}
/* Selected is a warm status plate, distinct from green selection actions. */
.rally-ui #app #gar-list>.card.car>.tag.on {background:var(--rl-amber-tile) repeat!important;background-color:#ce962c!important;background-blend-mode:soft-light!important;color:#283139!important;border:1px solid #ffdda0;text-shadow:none!important;}
@media(prefers-reduced-motion:reduce){
 .rally-ui #app #shop-list>.shop-purchased {animation:none!important;}
 .rally-ui #app .shop-purchase-feedback {animation:shop-purchase-still 1.2s linear both!important;}
}
@keyframes shop-purchase-still {0%,85%{opacity:1;}100%{opacity:0;}}
/* Dashboard readouts sit on dark plates, like the other menu controls. */
.rally-ui #app .dm .dm-gauge {--rl-frame:var(--rl-slate-frame);--rl-tile:var(--rl-slate-tile);color:#f4f8fc!important;}
.rally-ui #app .dm-gauge b {color:#ffdda0;}
.rally-ui #app .dm-gauge :is(i,.g-chip) {color:#d0dee8;}
/* Keep the 520 x 300 garage canvas proportional on short landscape screens. */
.rally-ui #app #ov-garage #gar-prev {width:auto;max-width:100%;height:clamp(85px,25cqh,136px);aspect-ratio:26/15;align-self:center;object-fit:contain;box-sizing:border-box;}
/* Parts use the same single dark plate as cars, without nested rubber frames. */
.rally-ui #app #ov-mods .mods-option {padding:6px;gap:4px;font-size:calc(13px * var(--ui-text-scale,1));}
.rally-ui #app #ov-mods .mods-stage {border:0!important;border-image:none!important;background:none!important;border-radius:0;}
.rally-ui #app #ov-mods .mods-option>b {font-size:1em;line-height:1.2;color:#f4f8fc!important;}
.rally-ui #app #ov-mods .mods-action {min-height:24px;padding:4px 6px;font-size:.92em;line-height:1.15;box-sizing:border-box;background:var(--rl-green-tile) repeat!important;background-color:#54b36a!important;background-blend-mode:soft-light;color:#fff!important;}
.rally-ui #app #ov-mods .mods-action:has(.cn) {background:var(--rl-amber-tile) repeat!important;background-color:#ce962c!important;background-blend-mode:soft-light;color:#283139!important;}
.rally-ui #app #ov-mods .mods-action .cn {color:inherit;}
/* Brighter green enamel, shared with shop purchase actions. */
.rally-ui #app :is(.b-green,.bw-primary,.bw-ack,.reward-card .btn):not(:disabled):not(#shop-list *) {--rl-color:#54b36a;}
.rally-ui #app :is(.tag.on,.loadout-item.installed) {background-color:#54b36a!important;background-blend-mode:soft-light!important;}
.rally-ui #app .pedal.gas {background-color:#54b36a!important;}
.rally-ui #app :is(.panel,.lobby,.is-box,.pu-content) {border-width:5px!important;border-radius:12px!important;}
.rally-ui #app :is(.card,.mods-option,.row,.rm,.rr,.lb-row,.online-card,.room-track-summary,.room-track-option,.training-card,.idea,.reward-card) {border-width:2px!important;border-radius:8px!important;padding:8px 10px;}
.rally-ui #app :is(.btn,.tab,.btn-icon,.x-close,.qmark,.slot,.mods-picker button,.mods-footer>button) {border-width:3px!important;border-radius:7px!important;}
.rally-ui #app :is(.btn,.tab) {padding:5px 9px;line-height:1.2;}
.rally-ui #app #tune-list .tune-upgrade {border-width:2px!important;padding:9px 10px;gap:5px;}
.rally-ui #app #tune-list .upgrade-price {padding:4px 9px;min-height:34px;}
.rally-ui #app #gar-list>.card.car {padding:6px;gap:4px;}
.rally-ui #app #gar-list>.card.car :is(.btn,.tag) {padding:4px 7px;min-height:34px;}
.rally-ui #app #shop-list>.item {padding:7px;gap:4px;}
.rally-ui #app #shop-list :is(.btn,.tag) {padding:5px 7px;}
.rally-ui #app #ov-shop .loadout-item {padding:3px 5px;border-width:2px!important;}
.rally-ui #app .reward-card {padding:9px 10px;}
.rally-ui #app #q-list .quest-card {padding:8px;}
.rally-ui #app #q-list .bonus-card {padding:8px;}
.rally-ui #app :is(.reward-card,.online-card,.rr) .cn {color:#ffdda0;}
/* Online players: content determines card height, while the list stays within its window. */
.rally-ui #app #ov-online>.online-panel {width:min(760px,calc(100% - 20px));height:min(410px,calc(100% - 16px));padding:10px 12px;gap:9px;min-height:0;}
.rally-ui #ov-online .panel-title {padding:0 44px;flex-shrink:0;font-size:clamp(23px,calc(23px * var(--ui-text-scale,1)),30px);line-height:1.2;}
.rally-ui #ov-online .online-caption {font-size:calc(13px * var(--ui-text-scale,1));line-height:1.2;flex-shrink:0;min-width:0;}
.rally-ui #ov-online .online-caption>span:last-child {display:none;}
.rally-ui #ov-online .online-grid {flex:1;min-height:0;height:auto;grid-auto-rows:max-content;align-content:start;max-height:none;padding:2px;gap:7px;overflow:auto;touch-action:pan-y;}
.rally-ui #app #online-grid .online-card {height:auto;min-height:72px;display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:8px;background-color:#1a364c!important;}
.rally-ui #online-grid .online-player {min-width:0;gap:5px;}
.rally-ui #online-grid .online-heading {flex-wrap:wrap;gap:4px;}
.rally-ui #online-grid .online-name {white-space:normal;overflow:visible;overflow-wrap:anywhere;font-size:calc(14px * var(--ui-text-scale,1));line-height:1.2;color:#f4f8fc!important;}
.rally-ui #online-grid .online-level {font-size:calc(12px * var(--ui-text-scale,1));line-height:1.2;color:#c9deeb!important;}
.rally-ui #online-grid .online-self {color:#183d2b!important;}
.rally-ui #online-grid .lb-avatar {width:34px;height:34px;}
.rally-ui #online-grid .developer-profile {--rl-frame:var(--rl-amber-frame);}
.rally-ui #online-grid .developer-profile .online-name {color:#ffdda0!important;}
/* Finish: clear standings and reward total, with actions always below both columns. */
.rally-ui #app #ov-result>.p-res {width:min(780px,calc(100% - 20px));height:min(430px,calc(100% - 16px));padding:10px 12px;gap:9px;min-height:0;}
.rally-ui #ov-result .res-head {flex-shrink:0;min-height:48px;gap:9px;}
.rally-ui #ov-result .res-copy {min-width:0;max-width:100%;}
.rally-ui #ov-result #res-title {font-size:clamp(23px,calc(23px * var(--ui-text-scale,1)),30px);line-height:1.15;letter-spacing:0;}
.rally-ui #ov-result .res-reason {font-size:calc(12px * var(--ui-text-scale,1));line-height:1.2;margin-top:3px;overflow-wrap:anywhere;}
.rally-ui #ov-result .vic-flag {width:30px;height:28px;}
.rally-ui #ov-result .vic-strip {height:4px;min-height:4px;flex-shrink:0;margin:0;}
.rally-ui #ov-result .res-badge {min-width:44px;height:44px;border-width:3px!important;font-size:26px;padding:3px;}
.rally-ui #ov-result .res-badge.p0 {max-width:100px;font-size:18px;}
.rally-ui #ov-result .res-cols {display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);flex:1;min-height:0;gap:12px;}
.rally-ui #ov-result .res-standings {display:flex;flex-direction:column;gap:7px;min-height:0;min-width:0;}
.rally-ui #ov-result .res-section-title {font-size:11px;line-height:14px;color:#a9c6d9;text-transform:uppercase;letter-spacing:.6px;flex-shrink:0;}
.rally-ui #ov-result :is(.res-list,.res-lines) {min-height:0;min-width:0;overflow:auto;touch-action:pan-y;}
.rally-ui #ov-result .res-list {gap:5px;}
.rally-ui #app #res-list .rr {display:grid;grid-template-columns:24px 6px minmax(0,1fr) auto;gap:6px;min-height:32px;height:max-content;padding:5px 7px;flex-shrink:0;}
.rally-ui #ov-result .rr>span {font-size:calc(13px * var(--ui-text-scale,1));line-height:1.2;white-space:normal;overflow:visible;overflow-wrap:anywhere;color:#f4f8fc!important;}
.rally-ui #ov-result .rr>em {font-size:calc(12px * var(--ui-text-scale,1));line-height:1.2;white-space:nowrap;color:#cfdeea!important;}
.rally-ui #ov-result .rr>i {width:6px;height:6px;border:0;}
.rally-ui #app #res-list .rr.me {--rl-frame:var(--rl-green-frame);--rl-tile:var(--rl-teal-tile);background-color:#164a4c!important;outline:none;}
.rally-ui #ov-result .pl {width:24px;height:24px;border-width:1px!important;padding:0;font-size:13px;}
.rally-ui #ov-result .rr:not(:has(.pl)) {grid-template-columns:minmax(0,1fr) auto;}
.rally-ui #ov-result .res-side {width:auto;min-width:0;min-height:0;gap:7px;}
.rally-ui #ov-result .res-lines {flex:1;font-size:calc(12px * var(--ui-text-scale,1));line-height:1.25;gap:3px;}
.rally-ui #ov-result .res-lines>div {padding:5px 3px;border-bottom:1px solid #466075;background:none;gap:8px;}
.rally-ui #ov-result .res-lines>div>span:first-child {white-space:normal;overflow:visible;overflow-wrap:anywhere;min-width:0;}
.rally-ui #ov-result .res-lines .cn {flex-shrink:0;white-space:nowrap;}
.rally-ui #ov-result .res-total {padding:7px 9px;border:1px solid #3d7381;border-radius:8px;min-height:42px;flex-shrink:0;}
.rally-ui #ov-result #res-coins {font-size:clamp(24px,calc(24px * var(--ui-text-scale,1)),32px);line-height:1.1;}
.rally-ui #ov-result .res-total>span {font-size:16px;}
.rally-ui #ov-result .res-xp {font-size:calc(11px * var(--ui-text-scale,1));line-height:1.2;grid-template-columns:auto minmax(24px,1fr) auto;min-width:0;flex-shrink:0;}
.rally-ui #ov-result .res-xp i {height:6px;}
.rally-ui #ov-result .res-btns {display:grid;grid-template-columns:1.4fr 1fr 1fr 1.2fr;gap:7px;flex-shrink:0;}
.rally-ui #app #ov-result .res-btns>.btn {min-width:0;min-height:42px;padding:6px 8px;font-size:calc(13px * var(--ui-text-scale,1));line-height:1.15;}
.rally-ui #ov-result.is-practice :is(.res-total,.res-xp) {display:none;}
.rally-ui #ov-result.is-practice .res-lines {color:#cfdeea;font-size:calc(14px * var(--ui-text-scale,1));}
/* Driver help: instructions scroll separately, track choices slide horizontally. */
.rally-ui #app #ov-training>.panel {width:min(780px,calc(100% - 20px));height:calc(100% - 16px);max-height:460px;min-height:0;padding:10px 12px;gap:9px;}
.rally-ui #ov-training .panel-title {font-size:24px;line-height:28px;flex-shrink:0;}
.rally-ui #ov-training .training-help {flex:1;min-height:0;overflow:auto;touch-action:pan-y;font-size:calc(13px * var(--ui-text-scale,1));line-height:1.4;padding:1px 6px 1px 1px;}
.rally-ui #ov-training #training-tracks {display:flex;flex-direction:row;gap:8px;height:90px;min-height:90px;max-height:90px;overflow-x:auto;overflow-y:hidden;padding:3px;flex-shrink:0;scroll-snap-type:x proximity;touch-action:pan-x;}
.rally-ui #app #training-tracks>.btn {flex:0 0 170px;min-width:0;height:80px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;padding:8px 10px;white-space:normal;scroll-snap-align:start;font-size:calc(14px * var(--ui-text-scale,1));line-height:1.2;}
.rally-ui #training-tracks small {font-size:.8em;line-height:1.2;}
@container(max-height:340px){
 .rally-ui #app #ov-mods>.panel {padding:7px;gap:5px;}
 .rally-ui #app #ov-mods .mods-picker {min-height:36px;}
 .rally-ui #app #ov-mods .mods-picker button {min-height:36px;padding:4px 8px;}
 .rally-ui #app #ov-mods .mods-workbench {min-height:130px;}
 .rally-ui #app #ov-mods .mods-option {padding:3px;gap:2px;grid-template-rows:minmax(0,1fr) auto auto;}
 .rally-ui #app #ov-mods .mods-action {min-height:18px;padding:2px 4px;}
 .rally-ui #app #ov-mods .mods-footer {min-height:36px;}
 .rally-ui #app #ov-mods .mods-footer>button {min-height:36px;padding:4px 8px;}
 .rally-ui #app :is(#ov-shop>.panel,#ov-garage>.panel,#ov-quests>.panel) {padding:7px;gap:5px;}
 .rally-ui #app #shop-list>.item {padding:5px;gap:3px;}
 .rally-ui #app #ov-result>.p-res {padding:7px 9px;gap:6px;}
 .rally-ui #ov-result .res-head {min-height:42px;}
 .rally-ui #ov-result .res-cols {gap:9px;}
 .rally-ui #app #res-list .rr {min-height:30px;padding:4px 6px;gap:5px;}
 .rally-ui #app #ov-training>.panel {padding:8px 10px;gap:6px;}
 .rally-ui #ov-training #training-tracks {height:82px;min-height:82px;max-height:82px;}
 .rally-ui #app #training-tracks>.btn {height:72px;}
}
/* Use the plate's own center: its enamel and bevel meet at the exact same pixels.
   A separate rounded tile left gaps inside the metal corners and a second color edge. */
.rally-ui #app :is(.btn,.tab,.btn-icon,.x-close,.qmark,.slot,.pedal,.is-tabs button,.is-x,.bw-tabs button,.bw-ack,.bw-primary,.bw-summary button,.pu-secondary,.mods-picker button,.mods-footer>button,.dm-sb,.dm-key,.dm-rbtns>button),
.rally-ui #player-updates button {
 border-image-slice:32 fill!important;
 background:none!important;
 background-color:transparent!important;
 background-blend-mode:normal!important;
}
.rally-ui #app .dm-key.k-chest,
.rally-ui #app .dm-key.k-chest :is(b,small,span,#m-chest-t),
.rally-ui #app .pedal.nitro.full {color:#1d3040!important;text-shadow:none!important;}
/* Garage: one horizontal tab row above the car and its catalogue.
   Grid exposes the existing children; tab handlers and save actions keep their DOM. */
.rally-ui #app #ov-garage>.panel {width:min(900px,calc(100% - 20px));height:min(500px,calc(100% - 16px));min-height:0;}
.rally-ui #app #ov-garage .gar {flex:1;min-height:0;display:grid;grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr);grid-template-rows:40px minmax(0,1fr);gap:10px 12px;}
.rally-ui #app #ov-garage .gar-r {display:contents;}
.rally-ui #app #ov-garage .gar-r>.tabs {grid-column:1/-1;grid-row:1;display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px;min-width:0;margin:0;}
.rally-ui #app #ov-garage .tab {min-height:40px;min-width:0;font-size:calc(13px * var(--ui-text-scale,1));line-height:1.15;padding:3px 5px;white-space:normal;}
.rally-ui #app #ov-garage .gar-l {grid-column:1;grid-row:2;width:auto;min-width:0;min-height:0;gap:4px;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;}
.rally-ui #app #ov-garage #gar-prev {height:clamp(85px,calc(40cqh - 55px),190px);width:auto;max-width:100%;flex-shrink:0;}
.rally-ui #app #ov-garage .gar-r>.tabc {grid-column:2;grid-row:2;min-height:0;min-width:0;height:100%;overflow:auto;}
.rally-ui #app #ov-garage .gar-r>.tabc.on {display:flex;flex-direction:column;}
.rally-ui #app #ov-garage .tabc>.scroller {flex:1;min-height:0;max-height:none;}
.rally-ui #app #ov-garage #tune-list {height:100%;min-height:0;}
@container(max-height:450px){
 .rally-ui #app #ov-garage .gar {grid-template-rows:36px minmax(0,1fr);gap:6px 10px;}
 .rally-ui #app #ov-garage .tab {min-height:36px;font-size:calc(12px * var(--ui-text-scale,1));padding:2px 4px;}
 .rally-ui #app #ov-garage .gar-l {gap:3px;}
 .rally-ui #app #ov-garage .gar-pw {min-height:34px;padding:3px 6px;flex-shrink:0;}
 .rally-ui #app #ov-garage #gar-stats {gap:2px;flex-shrink:0;}
}
.rally-ui #app #ov-garage .tabc>.list {flex:1;min-height:0;max-height:none;overflow-y:auto;overflow-x:hidden;}
