#bottombar {
  zoom: var(--ui-playback-scale, 1);
  --surface: var(--material-panel,rgba(250, 250, 252, .96));
  --ink: #1d1d1f;
  --muted: #76767d;
  --line: rgba(0, 0, 0, .09);
  --well: rgba(118, 118, 128, .09);
  --button: #fff;
  --accent: #007aff;
  --shadow: var(--material-shadow,0 12px 40px #00000013, 0 2px 8px #00000008);
  color: var(--ink);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
  position: fixed;
  left: 50%;
  /* Match the feedback button's inset, including the game's desktop UI scale. */
  bottom: calc(var(--ui-map-footer-inset,max(12px, env(safe-area-inset-bottom))) * var(--ui-desktop-scale, 1) / var(--ui-playback-scale, 1));
  transform: translateX(-50%);
  z-index: 1200;
  width: var(--ui-playback-width,184px);
  max-width: calc(100vw / var(--ui-playback-scale, 1) - 24px);
}
html:not(.cityrail-light-ui) #bottombar {
  --surface: rgba(35, 35, 38, .97);
  --ink: #f5f5f7;
  --muted: #a5a5ad;
  --line: rgba(255, 255, 255, .1);
  --well: rgba(118, 118, 128, .18);
  --button: #3b3b40;
  --accent: #0a84ff;
  --shadow: 0 16px 44px #00000040, 0 2px 10px #00000025;
}
#bottombar, #bottombar * { box-sizing: border-box; }
#bottombar button { font: inherit; color: inherit; cursor: pointer; border: 0; background: transparent; }
#bottombar button:active { transform: scale(.97); }
#bottombar button:focus-visible, #bottombar .wheel:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#bottombar button { touch-action: manipulation; }
#bottombar svg {
  width: 22px;
  height: 22px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#bottombar .bar {
  height: var(--ui-playback-bar-height,32px);
  padding: var(--ui-playback-bar-padding,2px 5px);
  display: grid;
  grid-template-columns: 1fr var(--ui-playback-button-size,26px) 1fr;
  align-items: center;
  gap: var(--ui-playback-bar-gap,3px);
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--material-blur,blur(26px));
  backdrop-filter: var(--material-blur,blur(26px));
}
#bottombar .play {
  width: var(--ui-playback-button-size,26px);
  height: var(--ui-playback-button-size,26px);
  padding: 0;
  line-height: 0;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
}
#bottombar .play svg { width:var(--ui-playback-icon-size,15px); height:var(--ui-playback-icon-size,15px); }
#bottombar .value-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: var(--ui-playback-button-size,26px);
  padding: 0;
}
#bottombar .time { justify-content: flex-end; padding-right:var(--ui-playback-value-inset,8px); }
#bottombar .speed { justify-content: flex-start; padding-left:var(--ui-playback-value-inset,8px); }
#bottombar .value { text-align: center; font-size:var(--ui-playback-value-size,14px); font-weight: 600; letter-spacing: -.15px; font-variant-numeric: tabular-nums; }
#bottombar .unit { margin-left: 1px; font-size: 12px; font-weight: 450; color: var(--muted); }
#bottombar .chevron { position: absolute; top: 50%; transform: translateY(-50%); width:var(--ui-playback-chevron-size,14px); height:var(--ui-playback-chevron-size,14px); color: var(--muted); stroke-width: 2; }
#bottombar .time .chevron { left:var(--ui-playback-chevron-inset,6px); }
#bottombar .speed .chevron { right:var(--ui-playback-chevron-inset,6px); }
#bottombar .popover {
  position: absolute;
  bottom: var(--ui-playback-popover-bottom,40px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  max-width: calc(100vw / var(--ui-playback-scale, 1) - 24px);
  border-radius: 22px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--material-blur,blur(28px));
  backdrop-filter: var(--material-blur,blur(28px));
}
#bottombar .heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; font-weight: 600; font-size: 15px; }
#bottombar .close { display: grid; place-items: center; width: 26px; height: 26px; background: var(--well); border-radius: 50%; color: var(--muted); font-size: 19px; }
#bottombar .wheels { position: relative; display: flex; justify-content: center; gap: 12px; margin: 0 0 20px; height: 180px; overflow: hidden; border-radius: 16px; background: var(--well); }
#bottombar .wheel {
  height: 180px;
  width: 100px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  padding: 72px 0;
  position: relative;
  z-index: 1;
  mask-image: linear-gradient(transparent, #000 35%, #000 65%, transparent);
}
#bottombar .wheel[data-unit=speed] { width: 100%; }
#bottombar .wheel::-webkit-scrollbar { display: none; }
#bottombar .wheel button { display: block; width: 100%; height: 36px; min-height: 36px; scroll-snap-align: center; font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; padding: 0; color: var(--muted); }
#bottombar .wheel button[aria-selected=true] { color: var(--ink); font-weight: 650; }
#bottombar .selection-band { position: absolute; top: 72px; height: 36px; left: 10px; right: 10px; border-radius: 9px; background: var(--button); box-shadow: 0 1px 4px #00000008; }
#bottombar .wheel-colon { position: absolute; top: 73px; font-size: 24px; z-index: 2; color: var(--ink); }
#bottombar .quick { display: flex; gap: 8px; margin-bottom: 16px; }
#bottombar .quick button { flex: 1; border: 1px solid var(--line); border-radius: 10px; height: 38px; font-size: 13px; }
#bottombar .apply { background: var(--accent); color: white; width: 100%; border-radius: 12px; height: 42px; font-weight: 550; }
@media (prefers-reduced-transparency: reduce) {
#bottombar .bar, #bottombar .popover { backdrop-filter: none; background: var(--button); }
}

#bottombar .popover { max-height: calc(100dvh / var(--ui-playback-scale, 1) - 70px); overflow-y: auto; }
#bottombar .popover[hidden] { display: none; }
@media (hover: hover) and (pointer: fine) {
#bottombar button:hover { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #bottombar button { transition: none; }
}

/* Larger touch layouts retain their targets; compact phone dimensions come
 * from the shared map budget and affect only the closed playback bar. */
@media (pointer: coarse) {
  #bottombar { width:var(--ui-playback-width,232px); }
  #bottombar .bar { height:var(--ui-playback-bar-height,52px); grid-template-columns:1fr var(--ui-playback-button-size,44px) 1fr; border-radius:28px; }
  #bottombar .play { width:var(--ui-playback-button-size,44px); height:var(--ui-playback-button-size,44px); }
  #bottombar .value-trigger { height:var(--ui-playback-button-size,44px); font-size:15px; }
  #bottombar .play svg { width:var(--ui-playback-icon-size,20px); height:var(--ui-playback-icon-size,20px); }
  #bottombar .popover { bottom:var(--ui-playback-popover-bottom,60px); max-height:calc(100dvh - 90px); }
  #bottombar .close { width:44px; height:44px; }
  #bottombar .quick button, #bottombar .apply { min-height:44px; }
}
@media (pointer:coarse) and (max-height:500px) {
  #bottombar .popover { padding:8px; }
  #bottombar .heading { margin-bottom:6px; }
  #bottombar .wheels { height:108px; margin-bottom:8px; }
  #bottombar .wheel { height:108px; padding:36px 0; }
  #bottombar .selection-band { top:36px; }
  #bottombar .wheel-colon { top:37px; }
  #bottombar .apply { position:sticky; bottom:0; }
}
