/* Shared look of the browser test rigs (terrain, bike and ride). */
html, body { margin: 0; height: 100%; overflow: hidden; background: #0e0f11; color: #e9e6df;
  font: 13px/1.45 system-ui, "Segoe UI", sans-serif; }
canvas { display: block; touch-action: none; }
.box { background: rgba(17, 18, 21, .84); border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 8px; backdrop-filter: blur(6px); }

.nav { display: flex; gap: 4px; margin-bottom: 10px; }
.nav a { color: #c9c5bb; text-decoration: none; padding: 2px 7px; border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, .16); }
.nav a[aria-current=page] { background: #e0a44a; color: #17130b; border-color: #e0a44a; font-weight: 600; }

#panel { position: fixed; top: 12px; left: 12px; width: 248px; padding: 12px 14px 10px; }
#panel h1 { margin: 0; font-size: 14px; font-weight: 650; }
#sub { margin: 2px 0 10px; color: #a8a49a; font-size: 12px; overflow-wrap: anywhere; }
#sub.error { color: #ff9b8a; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 7px 0; }
.row > span { color: #c9c5bb; white-space: nowrap; }
select, button, input[type=number] { font: inherit; color: inherit; background: #26282d;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 5px; padding: 3px 6px; }
select { min-width: 118px; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
.row > button { flex: 1; padding: 5px 8px; }
input[type=number] { width: 104px; }
input[type=range] { width: 118px; accent-color: #e0a44a; }
input[type=checkbox] { accent-color: #e0a44a; }

.seg { display: flex; }
.seg button { flex: 1; border-radius: 0; padding: 5px 0; }
.seg button:first-child { border-radius: 5px 0 0 5px; }
.seg button:last-child { border-radius: 0 5px 5px 0; border-left: 0; }
.seg button[aria-pressed=true] { background: #e0a44a; color: #17130b; border-color: #e0a44a; font-weight: 600; }

#legend { display: none; margin: 8px 0 2px; font-size: 11.5px; color: #c9c5bb; }
#legend div { display: flex; align-items: center; gap: 7px; margin: 2px 0; }
#legend i { width: 14px; height: 10px; border-radius: 2px; display: inline-block; }

#bottom { position: fixed; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap-reverse;
  justify-content: space-between; align-items: flex-end; gap: 8px; pointer-events: none; }
#hud { padding: 7px 11px; font-variant-numeric: tabular-nums; white-space: pre-wrap; }
#help { padding: 7px 11px; color: #b9b5ab; font-size: 12px; max-width: 330px; }
#status { position: fixed; inset: 0; display: grid; place-items: center; font-size: 15px; pointer-events: none; }
#status.error { color: #ff9b8a; }

/* Bike rig: checks and parts on the right. */
#side { position: fixed; top: 12px; right: 12px; width: 300px; max-height: calc(100% - 96px); overflow: auto;
  padding: 8px 14px 12px; }
#side h2 { margin: 8px 0 4px; font-size: 12px; font-weight: 650; color: #a8a49a; }
#side ul { list-style: none; margin: 0; padding: 0; }
#checks li { display: grid; grid-template-columns: 14px 1fr; gap: 7px; padding: 3px 0; }
#checks li::before { font-weight: 700; text-align: center; }
#checks li.ok::before { content: "\2713"; color: #86c98a; }
#checks li.warn::before { content: "!"; color: #f0b04a; }
#checks li.info::before { content: "\00b7"; color: #a8a49a; }
#checks li.warn { color: #f6dcae; }
#parts li { display: flex; justify-content: space-between; gap: 10px; padding: 2px 6px; margin: 0 -6px;
  border-radius: 4px; cursor: pointer; font-variant-numeric: tabular-nums; }
#parts li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#parts li span:last-child { color: #a8a49a; white-space: nowrap; }
#parts li:hover { background: rgba(255, 255, 255, .08); }
#parts li.isolated { background: rgba(224, 164, 74, .28); }
#drop { position: fixed; inset: 0; display: none; place-items: center; background: rgba(14, 15, 17, .72);
  border: 3px dashed #e0a44a; font-size: 18px; pointer-events: none; }
#drop.on { display: grid; }

/* Ride test: speed top right, tuning fields folded away in the panel. */
#panel:has(#tuning) { max-height: calc(100% - 100px); overflow: auto; }
.hint { margin: 6px 0; color: #a8a49a; font-size: 12px; }
#check-result { white-space: pre-line; }
#check-result:empty { display: none; }
#tuning summary { cursor: pointer; padding: 3px 0; font-weight: 650; }
#fields h2 { margin: 9px 0 2px; font-size: 12px; font-weight: 650; color: #a8a49a; }
#fields .row { margin: 4px 0; }
#fields .row > span { white-space: normal; }
#fields input[type=number] { width: 78px; flex: none; }
#fields input.changed { border-color: #e0a44a; color: #f6dcae; }
#values { width: 100%; box-sizing: border-box; resize: vertical; font: 11.5px/1.4 ui-monospace, Consolas, monospace;
  color: inherit; background: #1b1c20; border: 1px solid rgba(255, 255, 255, .16); border-radius: 5px; padding: 5px 6px; }
#dash { position: fixed; top: 12px; right: 12px; min-width: 132px; padding: 6px 14px 8px; text-align: right;
  font-variant-numeric: tabular-nums; pointer-events: none; }
#speed { font-size: 34px; font-weight: 650; line-height: 1.1; }
#dash > span { color: #a8a49a; }
#dash-state { color: #c9c5bb; font-size: 12px; }

/* Ride test on a phone, a tablet or a small window. ride.js puts two classes on <html>:
   .compact (touch screens and small windows) folds the panel away behind a menu button, and
   .touch adds the thumb controls and moves the readout up under the speed, out of their way. */
:root { --edge-t: max(12px, env(safe-area-inset-top, 0px)); --edge-b: max(12px, env(safe-area-inset-bottom, 0px));
  --edge-l: max(12px, env(safe-area-inset-left, 0px)); --edge-r: max(12px, env(safe-area-inset-right, 0px)); }
#bar, #touch, #dash-more, #full, .for-touch { display: none; }

.compact #bar { display: flex; gap: 6px; position: fixed; top: var(--edge-t); left: var(--edge-l); }
#bar button { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 11px; border-radius: 8px;
  background: rgba(17, 18, 21, .84); touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#bar svg { display: block; width: 18px; height: 18px; fill: currentColor; }
#menu[aria-expanded=true], #pause[aria-pressed=true], .down #bar-reset { background: #e0a44a; color: #17130b;
  border-color: #e0a44a; font-weight: 600; }
#pause .play, #pause[aria-pressed=true] .bars { display: none; }
#pause[aria-pressed=true] .play { display: block; }

.compact #panel { display: none; top: calc(var(--edge-t) + 48px); left: var(--edge-l); box-sizing: border-box;
  width: min(276px, calc(100% - var(--edge-l) - var(--edge-r))); touch-action: manipulation; overscroll-behavior: contain; }
.compact #panel:has(#tuning) { max-height: calc(100% - var(--edge-t) - 136px); }      /* stops short of the readout */
.compact #panel.open { display: block; z-index: 2; }      /* over the speed box, which it reaches on a narrow phone */
.compact.can-fullscreen #full { display: flex; }

.touch .for-touch { display: block; }
.touch .for-keys, .touch #bottom { display: none; }
.touch .box { backdrop-filter: none; }      /* blurring the moving view behind every box costs a phone frames */
.touch #panel:has(#tuning) { max-height: calc(100% - var(--edge-t) - var(--edge-b) - 48px); background: rgba(17, 18, 21, .95); }
.touch #dash { top: var(--edge-t); right: var(--edge-r); min-width: 112px; max-width: 46%; padding: 4px 11px 6px; }
.touch #speed { font-size: 30px; }
.touch #dash-more { display: block; margin-top: 1px; color: #a8a49a; font-size: 11.5px; white-space: pre-line; }
/* Fingers need bigger targets than a mouse, and iOS zooms the page for a field under 16px. */
.touch .nav a { padding: 6px 10px; }
.touch #panel button { padding: 9px 8px; }
.touch #panel input[type=number] { padding: 6px; font-size: 16px; }
.touch #tuning summary { padding: 8px 0; }

.touch #touch { display: block; position: fixed; inset: 0; pointer-events: none; user-select: none;
  -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
#steer, #pedals { position: absolute; bottom: 0; pointer-events: auto; touch-action: none; }
/* Steering takes a touch anywhere in the lower left of the screen; the track only shows where. */
#steer { left: 0; width: 50%; height: 62%; }
#steer .track { position: absolute; left: calc(var(--edge-l) + 8px); bottom: calc(var(--edge-b) + 24px); box-sizing: border-box;
  width: 172px; height: 56px; border-radius: 28px; background: rgba(17, 18, 21, .46); border: 1px solid rgba(255, 255, 255, .24); }
#steer.held .track { bottom: auto; background: rgba(17, 18, 21, .62); }
#steer .track::before, #steer .track::after { content: ""; position: absolute; top: 50%; width: 8px; height: 8px;
  margin-top: -5px; border: solid rgba(255, 255, 255, .55); border-width: 0 0 2px 2px; }
#steer .track::before { left: 16px; transform: rotate(45deg); }
#steer .track::after { right: 16px; transform: rotate(-135deg); }
#steer i { position: absolute; left: 50%; top: 50%; box-sizing: border-box; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: rgba(233, 230, 223, .3); border: 1px solid rgba(255, 255, 255, .5); }
#steer.held i { background: rgba(224, 164, 74, .9); border-color: #e0a44a; }

#pedals { right: 0; display: flex; align-items: flex-end; gap: 10px;
  padding: 28px calc(var(--edge-r) + 8px) calc(var(--edge-b) + 12px) 28px; }
#brake, #gas { position: relative; overflow: hidden; box-sizing: border-box; display: grid; place-items: end center;
  padding-bottom: 10px; border-radius: 12px; background: rgba(17, 18, 21, .46); border: 1px solid rgba(255, 255, 255, .24);
  font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
#brake { width: 78px; height: 96px; }
#gas { width: 86px; height: 132px; }
/* How hard the pedal is pressed, 0 to 1, fills it from the bottom. */
#brake::before, #gas::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--level, 0) * 100%); background: rgba(224, 164, 74, .62); }
#brake::before { background: rgba(214, 92, 72, .62); }
#brake.held, #gas.held { border-color: rgba(255, 255, 255, .5); }
#pedals span { position: relative; }

@media (max-width: 430px) {      /* a phone held upright: both thumbs' controls have to fit side by side */
  #steer .track { left: calc(var(--edge-l) + 2px); width: 144px; height: 50px; }
  #steer i { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
  #pedals { gap: 8px; padding: 24px calc(var(--edge-r) + 2px) calc(var(--edge-b) + 12px) 20px; }
  #brake { width: 68px; }
  #gas { width: 76px; }
}

@media (max-width: 720px) {
  #side { top: auto; bottom: 84px; left: 12px; right: 12px; width: auto; max-height: 34%; }
  #side ~ #bottom #help { display: none; }   /* no room for it under the lists */
}
