#app.vehicle-hud #hud .instrument { padding:5px 7px; }
#app.vehicle-hud #hud .speed-row strong { font-size:clamp(22px,4vw,32px); }
#hud .instrument .vehicle-aids { margin-bottom:3px; }
#hud .instrument .vehicle-aids button { padding-inline:4px; }
#hud .instrument .vehicle-aids button span { max-width:none; }
#hud #bag-hud328 { gap:4px; padding-inline:6px; }
#hud #bag-hud328 svg { width:20px; height:20px; }

.drive-speed-controls {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
}
#speed-lock-control {
  position:relative;
  display:grid;
  align-items:center;
  justify-items:end;
  min-width:0;
  min-height:32px;
  pointer-events:auto;
}
#speed-lock-control[hidden] { display:none; }
#speed-lock-label {
  padding:4px 5px;
  border:1px solid #708e79;
  border-radius:6px;
  background:#0e231b;
  color:#e2f0d8;
  font-size:10px;
  font-weight:800;
  white-space:nowrap;
}
#speed-lock {
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  opacity:0;
  pointer-events:auto;
  cursor:pointer;
}
#speed-lock-control:has(#speed-lock:focus-visible) #speed-lock-label {
  outline:2px solid var(--mint);
  outline-offset:2px;
}
body.touch-mode #hud .instrument .vehicle-aids button,
body.touch-mode #speed-lock-control { min-height:44px; }
body.touch-portrait #hud .instrument .vehicle-aids {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
}
body.touch-portrait #hud .instrument .vehicle-aids:not(:has(button:not([hidden]))) { display:none; }
body.touch-portrait #hud .instrument .vehicle-aids svg { display:none; }
body.touch-portrait #hud .instrument .vehicle-aids button { font-size:9px; padding-inline:2px; }
body.touch-portrait .drive-speed-controls {
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1.15fr);
  gap:4px;
}
body.touch-portrait .drive-speed-controls .speed-row {
  display:grid;
  grid-template-columns:minmax(0,1fr);
  gap:0;
}
body.touch-portrait .drive-speed-controls .speed-row>span {
  display:flex;
  flex-wrap:wrap;
  align-items:baseline;
  gap:3px;
}
#hud .map-card { transform-origin:top right; }
body.touch-mode #hud .touch-pedals .brake-pedal {
  min-width:56px;
  min-height:56px;
  border-color:#f6bd91;
}
body.touch-mode #hud .touch-pedals .brake-pedal:is(:active,.is-held) {
  background:#ffd5ae;
  color:#392118;
}

body.touch-mode #hud #nav-card.nav-card {
  left:var(--hud-nav-left,calc(50% - 124px));
  right:auto;
  top:calc(var(--top) + var(--hud-nav-row,0px));
  margin-inline:0;
  transform:none;
  width:var(--hud-nav-width,248px);
  min-width:0;
  max-width:calc(100% - 2 * max(var(--side),var(--right)));
  display:grid;
  grid-template-columns:28px minmax(0,1fr) max-content;
  grid-template-rows:auto auto;
  gap:1px 6px;
  min-height:43px;
  padding:4px 6px;
}
body.touch-mode #hud #nav-card.nav-card[hidden] { display:none; }
#nav-clear-pin svg { display:none; }
body.touch-mode #hud #nav-icon {
  grid-area:1 / 1 / 3 / 2;
  width:28px;
  height:28px;
}
body.touch-mode #hud #nav-icon svg { width:17px; height:17px; }
body.touch-mode #hud #nav-card > div {
  grid-area:1 / 2 / 3 / 3;
  min-width:0;
}
body.touch-mode #hud #nav-card :is(#nav-type,#nav-title,#nav-sub) {
  white-space:normal;
  overflow-wrap:anywhere;
  overflow:visible;
  text-overflow:clip;
  line-height:1.24;
}
body.touch-mode #hud #nav-type { font-size:8px; letter-spacing:.05em; }
body.touch-mode #hud #nav-title { font-size:12px; }
body.touch-mode #hud #nav-sub { font-size:9px; margin-top:1px; }
body.touch-mode #hud #nav-distance {
  grid-area:1 / 3;
  align-self:end;
  justify-self:center;
  font-size:12px;
  font-variant-numeric:tabular-nums;
}
body.touch-mode #hud #nav-card:not(:has(#nav-clear-pin:not([hidden]))) #nav-distance {
  grid-row:1 / 3;
  align-self:center;
}
body.touch-mode #hud #nav-clear-pin {
  grid-area:2 / 3;
  z-index:1;
  min-height:24px;
  font-size:8px;
  padding:1px 3px;
}
body.touch-mode[data-touch-layout] #hud .hud-shortcuts {
  top:calc(var(--top) + var(--hud-bag-row,72px));
}
.hud-tools-heading { min-width:0; }
#hud-edit-grip,#hud-edit-fold { display:none; }
#hud.hud-edit-all #hud-edit-tools {
  top:30%;
  bottom:auto;
  width:min(232px,calc(100% - 24px));
  box-sizing:border-box;
  gap:4px;
  padding:5px 7px;
}
#hud.hud-edit-all .hud-tools-heading {
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:3px;
}
#hud.hud-edit-all #hud-edit-title {
  grid-column:1 / -1;
  font-size:12px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
#hud.hud-edit-all #hud-edit-grip {
  display:flex;
  align-items:center;
  min-height:30px;
  padding-inline:5px;
  border:1px dashed #dfbf79;
  border-radius:6px;
  font-size:11px;
  cursor:grab;
  touch-action:none;
  user-select:none;
}
#hud.hud-edit-all #hud-edit-grip:active { cursor:grabbing; }
#hud.hud-edit-all #hud-edit-fold { display:block; min-height:30px; padding:3px 6px; font-size:10px; }
#hud.hud-edit-all #hud-edit-hint { display:none; }
#hud.hud-edit-all #hud-edit-picker { max-width:calc(100% - 51px); }
#hud.hud-edit-all #hud-edit-tools .action-row button { min-width:0; min-height:34px; font-size:11px; }
#hud.hud-edit-all #hud-edit-tools.hud-tools-folded { width:min(158px,calc(100% - 24px)); }
#hud.hud-edit-all #hud-edit-tools.hud-tools-folded > :not(.hud-tools-heading),
#hud.hud-edit-all #hud-edit-tools.hud-tools-folded #hud-edit-title { display:none; }
body.touch-mode #hud .hud-shortcuts #bag-hud328 {
  min-height:40px;
  padding:3px 5px;
  gap:3px;
  border-radius:9px;
  font-size:10px;
}
body.touch-mode #hud .hud-shortcuts #bag-hud328 svg { width:18px; height:18px; }
body.touch-mode #hud .hud-shortcuts #bag-hud328 small { display:none; }

#traffic-auto-notice {
  position:absolute;
  z-index:12;
  left:50%;
  top:max(12px, min(25%,160px));
  transform:translateX(-50%);
  width:min(360px,calc(100% - 30px));
  max-height:64%;
  overflow:auto;
  padding:12px;
  border:1px solid #bf986a;
  border-radius:12px;
  background:#172e26f5;
  color:#fff0d5;
  font-size:13px;
  pointer-events:auto;
}
#traffic-auto-notice p { margin:6px 0; }
#traffic-auto-records { margin:8px 0; padding-inline-start:18px; }
.traffic-notice-actions { display:flex; flex-wrap:wrap; gap:6px; }
#traffic-auto-notice button { min-height:40px; padding:4px 8px; }

@media (orientation:landscape) and (max-height:520px) {
  body.touch-mode #app.vehicle-hud #hud .instrument {
    max-width:min(245px,max(125px,calc(50vw - 118px - var(--side))));
  }
  body.touch-mode .drive-speed-controls .speed-row { flex-wrap:wrap; min-width:0; }
  body.touch-mode .drive-speed-controls .vehicle-hud-name { min-width:0; overflow:hidden; text-overflow:ellipsis; }
  body.touch-mode .instrument .vehicle-aids button svg { display:none; }
}

/* Keep the full driving dashboard in a compact card on phones. */
body.touch-mode[data-device="phone"] #app.vehicle-hud #hud .bottom > .instrument {
  width:min(174px,100%);
  min-width:0;
  padding:4px 5px;
  border-radius:10px;
}
body.touch-mode[data-device="phone"] #app.vehicle-hud #hud .instrument .vehicle-aids {
  display:flex;
  gap:4px;
  margin-bottom:0;
}
body.touch-mode[data-device="phone"] #app.vehicle-hud #hud .instrument .vehicle-aids:not(:has(button:not([hidden]))) { display:none; }
body.touch-mode[data-device="phone"] #app.vehicle-hud #hud .instrument .vehicle-aids button {
  min-height:36px;
  padding-inline:4px;
  gap:3px;
  font-size:9px;
}
body.touch-mode[data-device="phone"] #app.vehicle-hud #hud .instrument .vehicle-aids svg {
  display:block;
  width:12px;
  height:12px;
}
body.touch-mode[data-device="phone"] #hud .instrument .drive-speed-controls {
  display:flex;
  gap:4px;
}
body.touch-mode[data-device="phone"] #hud .instrument .speed-row {
  display:flex;
  flex-wrap:nowrap;
  flex:1;
  min-width:0;
  align-items:center;
  gap:3px;
}
body.touch-mode[data-device="phone"] #app.vehicle-hud #hud .speed-row strong {
  min-width:0;
  flex:none;
  font-size:22px;
  line-height:1;
}
body.touch-mode[data-device="phone"] #hud .instrument .speed-row > span:first-of-type {
  display:grid;
  gap:0;
  flex:none;
}
body.touch-mode[data-device="phone"] #hud .instrument #gear-read { font-size:8px; letter-spacing:0; }
body.touch-mode[data-device="phone"] #hud .instrument .speed-row small { font-size:8px; }
body.touch-mode[data-device="phone"] #hud .instrument #vehicle-hud-name:not([hidden]) {
  display:block;
  min-width:0;
  max-width:none;
  margin-inline-start:1px;
  padding-inline-start:3px;
  font-size:9px;
  white-space:normal;
  overflow-wrap:anywhere;
}
body.touch-mode[data-device="phone"] #speed-lock-control { flex:none; min-height:36px; }
body.touch-mode[data-device="phone"] #speed-lock-label { padding:3px; font-size:9px; }
body.touch-mode[data-device="phone"] #hud .instrument #vehicle-speed-stats:not([hidden]) {
  display:flex;
  gap:2px 6px;
  margin-top:0;
  font-size:8.5px;
  line-height:1.15;
}
body.touch-mode[data-device="phone"] #hud .instrument .meters {
  gap:6px;
  padding-top:2px;
  margin-top:2px;
}
body.touch-mode[data-device="phone"] #hud .instrument .meters > span {
  display:grid;
  grid-template-columns:11px auto;
  gap:0 3px;
  font-size:9px;
}
body.touch-mode[data-device="phone"] #app.vehicle-hud #hud .instrument .meter-label331 {
  display:block;
  grid-column:1 / -1;
  font-size:8px;
}
body.touch-mode[data-device="phone"] #hud .instrument .meters svg { width:11px; height:11px; }
body.touch-mode[data-device="phone"] #hud .instrument .driver-status-line { margin-top:2px; }

/* Compact controls and a dedicated, centered GPS position. */
body #hud .hud-customize {
  width:48px;
  max-width:48px;
  min-height:32px;
  padding:2px 4px;
  font-size:9px;
  line-height:1.12;
  border-radius:8px;
}
#hud .hud-bag-tools {
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:6px;
}
body #hud .hud-bag-tools .hud-settings331 {
  position:static;
  flex:none;
  width:34px;
  height:40px;
  min-height:40px;
  padding:4px;
  border-radius:9px;
}
body #hud .hud-bag-tools .hud-settings331 svg { width:18px; height:18px; }
body #hud #nav-card.nav-card {
  left:var(--hud-nav-left,calc(50% - 108px));
  right:auto;
  top:calc(var(--top) + var(--hud-nav-row,0px));
  margin:0;
  transform:none;
  box-sizing:border-box;
  width:var(--hud-nav-width,216px);
  min-width:0;
  max-width:calc(100% - var(--side) - var(--right));
  display:grid;
  grid-template-columns:24px minmax(0,1fr) max-content;
  grid-template-rows:auto auto;
  gap:1px 5px;
  min-height:38px;
  padding:3px 5px;
  border-radius:10px;
}
body #hud #nav-card.nav-card[hidden] { display:none; }
body #hud #nav-icon { grid-area:1 / 1 / 3 / 2; width:24px; height:24px; }
body #hud #nav-icon svg { width:15px; height:15px; }
body #hud #nav-card > div { grid-area:1 / 2 / 3 / 3; min-width:0; }
body #hud #nav-card :is(#nav-type,#nav-title,#nav-sub) {
  white-space:normal;
  overflow-wrap:anywhere;
  line-height:1.18;
}
body #hud #nav-type { font-size:7px; }
body #hud #nav-title { font-size:11px; }
body #hud #nav-sub { font-size:8px; margin-top:1px; }
body #hud #nav-distance { grid-area:1 / 3; align-self:end; justify-self:center; font-size:11px; }
body #hud #nav-card:not(:has(#nav-clear-pin:not([hidden]))) #nav-distance { grid-row:1 / 3; align-self:center; }
body #hud #nav-clear-pin { grid-area:2 / 3; min-height:24px; padding:1px 3px; font-size:8px; }
body.touch-portrait #hud .hud-customize { width:44px; max-width:44px; min-height:32px; font-size:8px; }

/* Keep customization beside settings in the inventory toolbar. */
body #hud .hud-bag-tools .hud-customize {
  flex:none;
  width:44px;
  max-width:44px;
  height:34px;
  min-height:30px;
  padding:2px 3px;
  font-size:8px;
  line-height:1.05;
  border-radius:8px;
}

