html,
body,
#viewport,
#stage {
  width: 100%;
  height: 100%;
  margin: 0;
}
#viewport,
#stage {
  position: relative;
  overflow: hidden;
}
#scene {
  display: none;
}
#race-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#header,
#screen {
  display: contents;
}
#cod-lobby {
  box-sizing: border-box;
}
#toast {
  position: fixed;
  z-index: 600;
  bottom: 28px;
  left: 50%;
  transform: translate(-50%, 16px);
  padding: 13px 22px;
  background: #fff5e3;
  color: #583625;
  border: 1px solid #f0cc83;
  box-shadow: 0 10px 30px #0004;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s,
    transform 0.18s;
  max-width: 90vw;
  text-align: center;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.ui-svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.bp-header-icon-btn .ui-svg {
  width: 16px;
  height: 16px;
}
.lobby-wallet {
  display: flex;
  align-items: center;
  gap: 5px;
}
.lobby-wallet b {
  margin: 0 8px;
}
#cod-lobby .lobby-page {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
  max-width: 1200px;
  width: 100%;
  gap: clamp(10px, 2vh, 20px);
  margin: 0 auto;
}
#cod-lobby .lobby-page .setup-grid {
  flex: 1 1 0;
  min-height: 0;
}
.panel-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  padding: 4px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
#cod-lobby[data-layout="compact"] .setup-panel > .panel-scroll {
  flex-shrink: 1;
}
#cod-lobby .info-tabs {
  display: flex;
  flex-wrap: wrap;
  flex-shrink: 0;
  gap: 5px;
  margin: 0;
}
#cod-lobby .info-tabs button {
  flex: 1 0 auto;
  font-size: 15px;
  padding: 8px 10px;
}
.setup-panel p {
  line-height: 1.65;
  font-size: 11px;
}
.event-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#cod-lobby .event-option {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  padding: 12px;
  width: 100%;
  text-align: left;
}
.event-option canvas {
  width: 100px;
  height: 65px;
  object-fit: cover;
  flex-shrink: 0;
}
.event-option > span:not(.event-status) {
  flex: 1;
  min-width: 0;
}
#cod-lobby .event-option strong {
  font-size: 25px;
  line-height: 1.1;
}
.event-option small {
  display: block;
  margin: 5px 0;
  font-size: 9px;
}
.event-status {
  margin-left: auto;
  font-size: 8px;
  letter-spacing: 1px;
}
.rally-stars {
  display: inline-flex;
  gap: 3px;
  font-size: 18px;
  letter-spacing: 0;
  color: #b7baa8;
}
.rally-stars .earned {
  color: #b68329;
}
.selected .rally-stars .earned,
.setup-poster .rally-stars .earned {
  color: #f0cc83;
}
.route-preview {
  flex: 1 1 0;
  min-height: 110px;
  margin: 18px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.route-preview canvas {
  width: 100%;
  height: 100%;
  min-height: 100px;
  max-height: 230px;
  border: 1px solid #f0cc8370;
}
.route-preview > span {
  margin-top: 8px;
  font-size: 8px;
  letter-spacing: 1px;
}
#cod-lobby .bp-deploy-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
#cod-lobby .compact-button {
  padding: 10px;
  font-size: 16px;
  margin-top: auto;
  gap: 8px;
  text-align: left;
}
.vehicle-cards {
  padding: 5px;
}
#cod-lobby .vehicle-card {
  align-items: stretch;
  padding: 10px;
  gap: 6px;
  text-align: left;
}
.vehicle-card canvas {
  width: 100%;
  height: 104px;
  display: block;
  object-fit: contain;
}
#cod-lobby .vehicle-card strong {
  font-size: 22px;
}
.vehicle-card small {
  font-size: 8px;
}
.vehicle-filters {
  margin: 0 0 16px;
  flex-wrap: wrap;
}
#cod-lobby .vehicle-filters .bp-diff-pill {
  font-size: 12px;
  padding: 8px;
}
#cod-lobby .garage-showcase {
  position: relative;
  gap: 0;
}
#garage-vehicle {
  width: 100%;
  height: clamp(150px, 30vh, 320px);
  min-height: 100px;
  flex: 1 1 0;
  cursor: grab;
  touch-action: none;
}
#garage-vehicle:active {
  cursor: grabbing;
}
.turntable-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.turntable-controls span {
  font-size: 8px;
  letter-spacing: 1px;
}
.turntable-controls .text-button {
  font-size: 22px;
  padding: 2px 8px;
}
#cod-lobby .garage-showcase .poster-copy h2 {
  font-size: clamp(27px, 2.7vw, 42px);
  margin: 0 0 10px;
}
.vehicle-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
}
.vehicle-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 8px;
}
.vehicle-stat > span {
  width: 67px;
}
.vehicle-stat > i {
  height: 4px;
  flex: 1;
  background: #fff5e329;
}
.vehicle-stat b {
  display: block;
  height: 100%;
  background: #f0cc83;
}
.vehicle-stat > strong {
  min-width: 20px;
  text-align: right;
  font-size: 11px;
}
.upgrade-grid {
  gap: 12px;
}
#cod-lobby .upgrade-item {
  padding: 15px;
  min-height: 165px;
}
#cod-lobby .upgrade-item strong {
  font-size: 25px;
}
.upgrade-level,
.item-price {
  font-size: 11px;
  font-weight: 700;
  margin: 8px 0;
}
.finish-color {
  border: 2px solid #fff5e3;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin: 6px 0 12px;
  display: block;
}
.wheel-option img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  align-self: center;
}
#cod-lobby .wheel-option strong,
#cod-lobby .paint-option strong {
  font-size: 22px;
}
.shop-card {
  min-height: 240px;
}
#cod-lobby .shop-card {
  padding: 14px;
  gap: 6px;
}
#cod-lobby .shop-card strong {
  font-size: 22px;
}
.shop-art {
  width: 100%;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shop-art canvas,
.shop-art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.shop-art .finish-color {
  width: 62px;
  height: 62px;
  margin: 0;
}
.shop-symbol {
  font:
    700 65px/1 "Barlow Condensed",
    sans-serif;
  color: #d86b2b;
}
.shop-vehicle {
  display: block;
  width: 100%;
  height: clamp(140px, 27vh, 280px);
  flex: 1 1 0;
  min-height: 100px;
}
.inline-error {
  color: #327d9b;
  font-size: 10px;
  margin: 0;
}
.report-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #58362526;
  font-size: 10px;
}
.report-stat-row strong {
  font:
    700 23px "Barlow Condensed",
    sans-serif;
}
#cod-lobby .setup-panel .report-stat-row > span {
  color: #94704d;
}
#cod-lobby .setup-panel .report-stat-row > strong {
  color: var(--rally-ink);
}
.career-level {
  font:
    800 40px "Barlow Condensed",
    sans-serif;
  margin: 20px 0 8px;
  color: #f0cc83;
}
.rally-xp {
  height: 7px;
  background: #fff5e32e;
}
.rally-xp i {
  display: block;
  height: 100%;
  background: #f0cc83;
}
.event-record,
.achievement {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid #58362526;
}
.event-record > div,
.achievement > div {
  flex: 1;
  min-width: 0;
}
.event-record strong,
.achievement strong {
  font:
    700 22px "Barlow Condensed",
    sans-serif;
  display: block;
}
.event-record small,
.achievement small {
  display: block;
  font-size: 9px;
  margin-top: 4px;
}
.event-record > span:last-child {
  font-size: 11px;
}
.achievement > span {
  font-size: 8px;
  letter-spacing: 1px;
}
.achievement.earned {
  color: #d86b2b;
}
.achievement .ui-svg {
  width: 24px;
  height: 24px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  border-bottom: 1px solid #58362526;
  padding: 10px 0;
}
.setting-label {
  font:
    700 19px "Barlow Condensed",
    sans-serif;
}
.setting-label small {
  display: block;
  font:
    500 9px/1.5 "Space Grotesk",
    sans-serif;
  margin-top: 5px;
}
.setting-input {
  display: flex;
  align-items: center;
  gap: 10px;
}
.setting-input input[type="range"] {
  width: clamp(110px, 13vw, 175px);
  accent-color: #d86b2b !important;
}
.setting-input input[type="checkbox"] {
  width: 21px;
  height: 21px;
  accent-color: #d86b2b !important;
  cursor: pointer;
}
.setting-input output {
  min-width: 40px;
  text-align: right;
  font-size: 10px;
}
.setting-input select {
  border: 1px solid #d4b79a;
  color: #583625;
  background: #fff8eb;
  padding: 8px 9px;
  font:
    700 15px "Barlow Condensed",
    sans-serif;
  min-width: 95px;
}
.settings-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dark-text {
  color: #583625;
}
.binding-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.binding {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #d4b79a;
  padding: 10px;
}
.binding > span {
  font:
    700 16px "Barlow Condensed",
    sans-serif;
}
.binding button {
  background: #d86b2b;
  color: #fff5e3;
  padding: 8px;
  border: 0;
  font-size: 9px;
  min-width: 55px;
  cursor: pointer;
}
#cod-lobby .info-control-row {
  padding: 12px 0;
}
#cod-lobby .info-control-row strong {
  font-size: 17px;
}
#cod-lobby .info-note {
  font-size: 10px;
  line-height: 1.65;
}
.rally-scoreboard {
  flex-shrink: 0;
  border-color: #f0cc8345;
  padding: 8px 0 16px;
}
.rally-scoreboard h1 {
  font-size: 42px;
  line-height: 1;
  margin-top: 5px;
}
.rally-scoreboard .report-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  color: #fff5e3;
}
.rally-scoreboard .report-score strong {
  font:
    800 34px "Barlow Condensed",
    sans-serif;
  color: #f0cc83;
}
.rally-scoreboard .report-score span,
.rally-scoreboard .report-score small {
  font-size: 9px;
}
.rally-report-columns {
  display: grid;
  grid-template-columns: 1fr 1.25fr 1fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
  max-height: none;
}
#cod-lobby .rally-report-columns .setup-panel {
  padding: 18px;
  gap: 12px;
}
#cod-lobby .result-vehicle-poster {
  min-height: 0;
  padding: 18px;
}
.result-vehicle-poster canvas {
  width: 100%;
  height: 100%;
  flex: 1;
  min-height: 120px;
}
#cod-lobby .result-vehicle-poster h2 {
  font-size: 28px;
}
.result-next {
  padding-top: 24px;
}
.result-next strong,
.result-next small {
  display: block;
  margin-top: 10px;
}
.result-next strong {
  font:
    700 24px "Barlow Condensed",
    sans-serif;
}
.result-next small {
  font-size: 9px;
}
.rally-report-actions {
  margin: 0;
  flex-shrink: 0;
  gap: 8px;
}
.rally-report-actions > button {
  background: #fff5e3;
  color: #583625;
  border: 0;
  font:
    800 19px "Barlow Condensed",
    sans-serif;
  padding: 15px;
  cursor: pointer;
}
.rally-report-actions > button:hover {
  background: #f0cc83;
}
.modal-shade {
  position: fixed;
  inset: 0;
  background: #492c1eb8;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 20px;
}
.pause-menu {
  width: min(580px, 100%);
  max-height: calc(100dvh - 40px);
  overflow: auto;
  background: linear-gradient(145deg, #fff7e9, #efe6d4);
  color: #583625;
  border-color: #fff4dc;
  outline-color: #f0cc8366;
  gap: 18px;
  padding: 28px;
}
.pause-menu h2 {
  font-size: clamp(28px, 5vw, 42px);
}
.pause-menu h2 em {
  color: #d86b2b;
}
.pause-menu p {
  font-size: 11px;
}
.pause-menu .bp-deploy-btn {
  background: #f0cc83;
  color: #3f3021;
}
.pause-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pause-actions button {
  border: 1px solid #d4b79a;
  padding: 12px;
  background: #f3e2c8;
  color: #583625;
  font:
    700 18px "Barlow Condensed",
    sans-serif;
  cursor: pointer;
}
.pause-actions button:last-child {
  grid-column: 1/-1;
}
@media (max-width: 900px) {
  .event-option canvas {
    width: 75px;
    height: 56px;
  }
  #cod-lobby .event-option {
    gap: 8px;
    padding: 8px;
  }
  #cod-lobby .event-option strong {
    font-size: 21px;
  }
  .event-status {
    font-size: 7px;
  }
  #cod-lobby .info-tabs button {
    font-size: 13px;
    padding: 8px;
  }
  .lobby-wallet {
    font-size: 7px;
  }
  .vehicle-stats {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  #cod-lobby .vehicle-card strong {
    font-size: 18px;
  }
  .vehicle-card canvas {
    height: 83px;
  }
  .binding-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .bp-header-icon-btn .ui-svg {
    display: none;
  }
  #cod-lobby[data-layout="compact"]:has(.lobby-page) {
    overflow-y: auto;
  }
  #cod-lobby[data-layout="compact"] .lobby-page {
    flex: 0 0 auto;
  }
  #cod-lobby[data-layout="compact"] .lobby-page .setup-grid {
    flex: none;
    grid-template-rows: auto auto;
  }
  #cod-lobby[data-layout="compact"]
    .lobby-page
    :is(.setup-panel, .setup-poster) {
    min-height: 0;
  }
  .lobby-page .panel-scroll {
    flex: 0 1 auto;
    max-height: 500px;
  }
  #cod-lobby .setup-panel h2 {
    font-size: 35px;
  }
  .route-preview {
    height: 190px;
    margin: 12px 0;
  }
  .route-preview canvas {
    height: 170px;
  }
  .event-option canvas {
    width: 72px;
    height: 52px;
  }
  .event-option small {
    font-size: 8px;
  }
  #cod-lobby .event-option strong {
    font-size: 22px;
  }
  #cod-lobby[data-layout="compact"]
    :is(.garage-showcase, .shop-poster)
    .poster-top {
    display: flex;
  }
  #cod-lobby[data-layout="compact"]
    :is(.garage-showcase, .shop-poster)
    .poster-copy
    h2 {
    display: block;
  }
  #cod-lobby .garage-showcase .poster-copy h2 {
    font-size: 31px;
  }
  #garage-vehicle {
    height: 230px;
    flex: none;
  }
  .shop-vehicle {
    height: 210px;
    flex: none;
  }
  .vehicle-stats {
    grid-template-columns: 1fr 1fr;
    gap: 9px 10px;
  }
  .vehicle-stat > span {
    width: 61px;
    font-size: 7px;
  }
  .vehicle-card canvas {
    height: 100px;
  }
  .settings-row {
    gap: 8px;
  }
  .setting-label {
    font-size: 17px;
  }
  .setting-input input[type="range"] {
    width: 110px;
  }
  .setting-input {
    gap: 5px;
  }
  .setting-input output {
    min-width: 33px;
    font-size: 9px;
  }
  .binding-grid {
    grid-template-columns: 1fr 1fr;
  }
  .binding {
    padding: 7px;
  }
  .binding > span {
    font-size: 14px;
  }
  .binding button {
    min-width: 45px;
    font-size: 8px;
  }
  .event-record {
    flex-wrap: wrap;
    gap: 8px;
  }
  .event-record strong,
  .achievement strong {
    font-size: 21px;
  }
  .achievement {
    gap: 8px;
  }
  .achievement > span {
    font-size: 7px;
  }
  .rally-scoreboard {
    flex-direction: row;
    gap: 12px;
  }
  .rally-scoreboard h1 {
    font-size: 30px;
  }
  .rally-scoreboard .report-score strong {
    font-size: 28px;
  }
  .rally-report-columns {
    grid-template-columns: 1fr;
    flex: none;
  }
  .result-vehicle-poster canvas {
    height: 230px;
    flex: none;
  }
  .rally-report-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .rally-report-actions button {
    font-size: 17px;
    padding: 13px;
  }
  #cod-lobby[data-layout="compact"] .result-vehicle-poster .poster-copy h2 {
    display: block;
  }
  #cod-lobby[data-layout="compact"] .settings-poster .poster-copy > small {
    display: none;
  }
}
@media (max-height: 520px) and (min-width: 601px) {
  #cod-lobby .lobby-page {
    padding-top: 8px;
  }
  #cod-lobby .info-tabs button {
    padding: 5px 7px;
    font-size: 12px;
  }
  #garage-vehicle {
    min-height: 90px;
    height: 140px;
  }
  #cod-lobby .garage-showcase .poster-copy h2 {
    font-size: 25px;
  }
  .vehicle-stats {
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
  }
  .vehicle-stat {
    font-size: 7px;
  }
  .turntable-controls {
    margin: 4px 0;
  }
  .route-preview {
    margin: 8px 0;
    min-height: 75px;
  }
  .route-preview canvas {
    min-height: 65px;
    max-height: 110px;
  }
  #cod-lobby .route-poster .poster-copy h2 {
    font-size: 23px;
  }
  #cod-lobby .route-poster .poster-copy p {
    margin: 6px 0;
    font-size: 9px;
  }
  #cod-lobby .route-poster .bp-deploy-btn {
    padding: 9px;
    font-size: 18px;
  }
  .rally-scoreboard {
    padding: 0 0 5px;
  }
  .rally-scoreboard h1 {
    font-size: 26px;
  }
  .rally-scoreboard .report-score strong {
    font-size: 24px;
  }
  .rally-report-actions button {
    padding: 9px;
    font-size: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
