[hidden] { display: none !important; }

#screen-garage {
  --menu-ink: #f3faff;
  --menu-muted: #a9c5d7;
  --menu-line: #b3d7ef45;
  --menu-panel: #071a2bee;
  color: var(--menu-ink);
  padding: max(16px, env(safe-area-inset-top) + 10px)
    max(18px, env(safe-area-inset-right) + 8px)
    max(18px, env(safe-area-inset-bottom) + 8px)
    max(18px, env(safe-area-inset-left) + 8px);
}

#screen-garage::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #03121f99 0%, transparent 24%, transparent 54%, #061424c9 100%);
  content: "";
}

#screen-garage .garage-top { align-items: center; }
#screen-garage .logo-title {
  font-size: clamp(21px, 4.4vw, 39px);
  font-weight: 950;
  font-style: italic;
  letter-spacing: -.04em;
  white-space: nowrap;
}
#screen-garage .logo-title span { color: #7efdde; }
#screen-garage .top-right-group { flex-wrap: nowrap; }
#screen-garage .star-pill {
  border: 1px solid var(--menu-line);
  box-shadow: none;
  padding: 6px 10px;
  font-size: 13px;
}
#screen-garage .icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--menu-line);
  border-radius: 12px;
  box-shadow: none;
}
#screen-garage .garage-bottom { max-width: 620px; }
.garage-home { display: grid; gap: 9px; width: min(440px, 100%); }
.garage-choices { display: grid; gap: 6px; }
.garage-choice {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 45px;
  padding: 7px 12px;
  color: var(--menu-ink);
  background: #081b2bdf;
  border: 1px solid var(--menu-line);
  border-radius: 12px;
  font: inherit;
  text-align: left;
  cursor: pointer;
  pointer-events: auto;
}
.garage-choice span { color: var(--menu-muted); font-size: 12px; font-weight: 700; }
.garage-choice strong { font-size: clamp(12px, 3.6vw, 15px); }

#screen-garage .cta-btn {
  min-width: 0;
  min-height: 48px;
  height: auto;
  padding: 8px 16px;
  border: 0;
  border-radius: 13px;
  background: #80f5d7;
  box-shadow: 0 8px 20px #04172766;
  color: #08251f;
  text-shadow: none;
  letter-spacing: 0;
  font-size: 19px;
}
#screen-garage .cta-btn:disabled { color: #c2d2dc; background: #294459; cursor: default; }
#screen-garage button:focus-visible { outline: 2px solid #b7fff0; outline-offset: 2px; }

.garage-panel {
  display: grid;
  gap: 9px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--menu-line);
  border-radius: 16px;
  background: var(--menu-panel);
  pointer-events: auto;
}
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-heading h2 { font-size: 18px; font-weight: 850; }
.panel-back {
  padding: 0 10px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  color: #b7fff0;
  background: transparent;
  font: 700 14px system-ui, sans-serif;
  cursor: pointer;
}
#screen-garage .track-selector-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
#screen-garage .boat-selector-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
#screen-garage :is(.track-chip, .boat-chip) {
  min-height: 46px;
  background: #163044;
  border: 1px solid var(--menu-line);
  border-radius: 10px;
  justify-content: center;
  gap: 2px;
  padding: 5px 4px;
  font-size: clamp(11px, 2.8vw, 14px);
}
#screen-garage :is(.track-chip, .boat-chip).selected {
  color: #f1fffc;
  background: #1d514e;
  border-color: #99f6df;
  box-shadow: none;
  transform: none;
}
#screen-garage .boat-info-strip {
  padding: 6px 0;
  background: none;
  border: 0;
  border-radius: 0;
}
#screen-garage .boat-header-line { gap: 4px 9px; }
.settings-actions { display: flex; flex-wrap: wrap; gap: 5px; }
#screen-garage .settings-actions .pill { min-height: 44px; border: 1px solid var(--menu-line); border-radius: 11px; background: #163044; box-shadow: none; font-size: 13px; }
.controls-note { color: var(--menu-muted); font-size: 12px; line-height: 1.45; }

.speed-cluster {
  position: absolute;
  top: max(66px, env(safe-area-inset-top) + 52px);
  right: auto;
  bottom: auto;
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid #d4efff65;
  border-radius: 9px;
  transform: none;
  pointer-events: none;
}
.speed-num { font-size: 23px; }
.speed-unit { font-size: 9px; letter-spacing: .08em; }
.hud-controls { gap: 8px; }
.steer-group, .boost-group { pointer-events: none; }
.steer-group { gap: 6px; }
.steer-btn, .boost-btn, .item-action { pointer-events: auto; }
.steer-btn { width: clamp(66px, 20vw, 98px); height: clamp(69px, 20vw, 91px); border-radius: 16px; }
.boost-btn { min-width: clamp(94px, 24vw, 155px); height: clamp(61px, 17vw, 82px); padding: 0 10px; border-radius: 16px; }
.boost-meter-wrap { width: clamp(82px, 24vw, 139px); }
.context-controls { bottom: max(130px, env(safe-area-inset-bottom) + 116px); }
.callout {
  width: min(90vw, 760px);
  white-space: normal;
  font-size: clamp(22px, 5.3vw, 58px);
  text-wrap: balance;
}

@media (min-width: 540px) {
  .garage-home { width: 100%; grid-template-columns: minmax(0, 2fr) minmax(145px, 1fr); }
  .garage-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .garage-choice { grid-template-columns: minmax(0, 1fr); gap: 2px 8px; }
  .garage-choice strong { grid-column: 1; }
  #screen-garage .track-selector-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (orientation: landscape) {
  .speed-cluster { top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); }
}
@media (orientation: landscape) and (any-pointer: coarse) {
  .steer-group { display: none; }
  .hud-controls { justify-content: flex-end; }
  .race-action kbd { display: none; }
  .context-controls { bottom: max(20px, env(safe-area-inset-bottom) + 7px); }
  .boost-btn { height: clamp(53px, 13vh, 67px); }
  .boost-group { gap: 5px; }
}
@media (orientation: landscape) and (max-width: 499px) {
  .context-controls { bottom: max(108px, env(safe-area-inset-bottom) + 94px); }
}
@media (max-height: 440px) {
  #screen-garage { padding-top: max(9px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .garage-panel { gap: 5px; padding-block: 5px 8px; }
  #screen-garage .cta-btn { min-height: 44px; }
}

#screen-garage .track-chip .sub { display: inline; }
#screen-garage .garage-bottom { align-items: stretch; }
#screen-garage .garage-home { align-self: center; }
.garage-choice strong { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
#course-status { position: absolute; width: max-content; top: calc(100% + 5px); left: 0; }
@media (min-width: 540px) {
  #screen-garage .boat-selector-row { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .hud-top .pill { font-size: 12px; padding: 6px 8px; }
}

#screen-garage .campaign-menu,
.maintenance-row,
.family-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 9px;
  font-size: 14px;
}

.campaign-menu {
  grid-column: 1 / -1;
  pointer-events: auto;
}

.maintenance-row { justify-content: space-between; }
.family-fields, .family-field { display: grid; gap: 6px; }
.family-field { min-width: 0; color: var(--menu-muted); font-size: 14px; }
.family-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 8px; }

#screen-garage :is(.family-field input, .family-field select, .campaign-menu select) {
  min-width: 0;
  min-height: 44px;
  padding: 7px 10px;
  font: inherit;
  font-size: 16px;
  color: var(--menu-ink);
  border: 1px solid var(--menu-line);
  border-radius: 9px;
  background: #163044;
  user-select: text;
}

.campaign-tip { color: var(--menu-muted); font-size: 14px; line-height: 1.45; }
.campaign-tip:empty { display: none; }
#family-results { display: grid; gap: 5px; list-style: none; }
#family-results li {
  display: grid;
  grid-template-columns: 2ch minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #163044;
  font-variant-numeric: tabular-nums;
}
.family-rank { color: #99f6df; }
#family-results strong { overflow-wrap: anywhere; }
#btn-race-again:disabled { opacity: .55; cursor: default; }
@media (min-width: 540px) {
  .campaign-menu { grid-row: 2; }
}

#screen-garage .garage-bottom:has(.family-panel:not([hidden])) {
  max-height: calc(100% - 56px);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  pointer-events: auto;
}
#family-results {
  max-height: min(190px, 32dvh);
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.boost-caption { display: grid; gap: 2px; text-align: center; font-size: clamp(12px, 3.5vw, 17px); }
.boost-caption small { font-size: 11px; font-variant-numeric: tabular-nums; }
#btn-boost { touch-action: none; }
#btn-boost.boost-active { background: linear-gradient(#a5f3fc, #0891b2); color: #082536; border-color: #ecfeff; }
#btn-boost.empty { opacity: .79; filter: saturate(.5); }

#screen-garage .stat-bars { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.handling-fill { background: linear-gradient(90deg, #a78bfa, #38bdf8); }
.condition-low { color: #fca5a5; }
#screen-pause {
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  background: #07162e85;
  justify-content: center;
  align-items: center;
}
.pause-card { gap: 12px; }
