/* Shared look of the Botopia drive simulators (same style as index2Wheels.php). */
:root {
  --bg: #031629;
  --bg-soft: #071f37;
  --panel: rgba(7, 31, 55, .92);
  --text: #f7fbff;
  --muted: #b9cad9;
  --line: rgba(255,255,255,.14);
  --accent: #ff9d1c;
  --accent-2: #13e084;
  --danger: #ff5a5a;
  --blue: #5cc8ff;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #021120 0%, #061d34 45%, #020d18 100%);
  display: flex;
  flex-direction: column;
}
a { color: inherit; text-decoration: none; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; }
.brand-mark {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 10px;
  background: var(--accent); color: #031629; font-weight: 900;
}
header h1 { margin: 0; font-size: 1rem; font-weight: 600; color: var(--muted); }
.switch { color: var(--accent); text-decoration: underline; }

#json {
  /* Fixed height: the text changes every frame; if the bar grew or shrank the 3D view would
     resize (and flash) all the time. Long JSON scrolls inside the bar. */
  flex: none;
  height: 70px;
  overflow-y: auto;
  margin: 0;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: #020d18;
  color: var(--accent-2);
  font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  min-height: 0;
}
#viewer { position: relative; min-height: 360px; }
#viewer canvas { display: block; width: 100%; height: 100%; }
.hud {
  position: absolute; left: 16px; bottom: 16px;
  padding: 8px 12px; border-radius: 10px;
  background: rgba(2, 17, 32, .75); border: 1px solid var(--line);
  font-size: .8rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  display: grid; gap: 4px;
}
.hud b { color: var(--text); font-weight: 600; }
.banner {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
  padding: 8px 16px; border-radius: 10px; font-weight: 700; font-size: .9rem;
  background: var(--danger); color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.4);
  pointer-events: none;
}
.banner[hidden] { display: none; }

aside {
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
button {
  font: inherit; font-size: .85rem; font-weight: 600;
  padding: 9px 8px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #031629; border-color: var(--accent); }
button.on { background: var(--accent-2); color: #031629; border-color: var(--accent-2); }
kbd {
  font: 600 .7rem ui-monospace, Consolas, monospace; opacity: .6;
  border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-left: 4px;
}
.drive { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.drive button { touch-action: none; user-select: none; -webkit-user-select: none; }
.drive button.active { background: var(--accent-2); color: #031629; border-color: var(--accent-2); }
.drive-note { display: grid; place-items: center; font-size: .75rem; color: var(--muted); text-align: center; }

.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; background: rgba(255,255,255,.03);
  display: flex; flex-direction: column; gap: 8px;
}
.card h2 {
  margin: 0; font-size: .85rem; letter-spacing: .06em; text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: baseline; color: var(--accent);
}
.card h2 span { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; font-size: .75rem; }

.motors { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.motor h3 { margin: 0 0 6px; font-size: .8rem; color: var(--text); }
.motor .bar {
  position: relative; height: 10px; border-radius: 5px; background: rgba(255,255,255,.1); overflow: hidden;
}
.motor .bar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--muted); }
.motor .bar i { position: absolute; top: 0; bottom: 0; background: var(--accent-2); }
.motor .bar i.rev { background: var(--blue); }
.motor dl {
  margin: 6px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px;
  font-size: .78rem; font-variant-numeric: tabular-nums;
}
.motor dt { color: var(--muted); }
.motor dd { margin: 0; text-align: right; font-weight: 600; }

.setting { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.setting label { font-size: .82rem; color: var(--text); }
.setting label span { color: var(--muted); font-size: .72rem; margin-left: 4px; }
.setting input { grid-column: 1 / -1; width: 100%; accent-color: var(--accent-2); }
.setting output { grid-column: 2; grid-row: 1; font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.setting select {
  grid-column: 1 / -1; font: inherit; font-size: .85rem; padding: 7px 8px; border-radius: 10px;
  background: var(--bg-soft); color: var(--text); border: 1px solid var(--line);
}
.toggle { display: flex; align-items: center; gap: 8px; font-size: .82rem; color: var(--muted); }
.toggle input { accent-color: var(--accent); }
.note { font-size: .75rem; color: var(--muted); line-height: 1.5; margin: 0; }
.note b { color: var(--text); }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; grid-template-rows: 55vh auto; }
  aside { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  header { padding: 10px 16px; }
  header h1 { display: none; }
}

/* ?shot: only the 3D view, used to make the pictures for the overview page. */
body.shot header, body.shot #json, body.shot aside, body.shot .hud, body.shot .banner { display: none; }
body.shot main { grid-template-columns: 1fr; grid-template-rows: 1fr; }
