/* ==========================================================================
   Twin Pill drive controls (Start/Stop + Rev).
   Visual only: app.js still owns #startBtn / #revBtn, their text
   (START/STOP), the .running class, the disabled state and every pointer
   handler. gauge-styles.js feeds --rev-fill (0–1) and .redline while Rev is
   held. The ":not(#x)" suffix outranks the older per-breakpoint rules in
   style.css / mobile-ui.css / apex-racing.css without !important.
   ========================================================================== */

.drive-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border-radius: 20px;
  background: rgba(9, 13, 18, .42);
  border: 1px solid rgba(255, 255, 255, .1);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .06);
}
/* Inside the (already glass) sidebar the bar only needs a subtle tray. */
.control-strip .drive-pills { background: rgba(0, 0, 0, .18); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); backdrop-filter: none; -webkit-backdrop-filter: none; }

#startBtn:not(#x),
#revBtn:not(#x) {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 54px;
  min-height: 54px;
  margin: 0;
  padding: 0 10px;
  border: 0;
  border-radius: 15px;
  font: 700 13px var(--font-ui);
  letter-spacing: .08em;
  text-shadow: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition: transform .08s ease, background-color .2s ease, color .2s ease, box-shadow .2s ease, opacity .2s ease;
  -webkit-tap-highlight-color: transparent;
}
#startBtn:not(#x)::before,
#revBtn:not(#x)::before {
  content: '';
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--pill-icon) center / contain no-repeat;
  mask: var(--pill-icon) center / contain no-repeat;
  position: relative;
}
#startBtn:not(#x):active:not(:disabled),
#revBtn:not(#x):active:not(:disabled) { transform: scale(.97); }

/* Start → solid instrument cyan with a play glyph. */
#startBtn:not(#x) {
  --pill-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5.5v13l11-6.5z'/%3E%3C/svg%3E");
  background: var(--accent);
  color: #04161b;
  box-shadow: 0 6px 18px rgba(95, 211, 228, .28);
}
#startBtn:not(#x):disabled { opacity: .6; cursor: progress; }
/* Running → quiet red outline with a stop glyph. */
#startBtn.running:not(#x) {
  --pill-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='6' y='6' width='12' height='12' rx='2.5'/%3E%3C/svg%3E");
  background: rgba(226, 86, 77, .14);
  color: #ff8f86;
  box-shadow: inset 0 0 0 1.5px rgba(226, 86, 77, .7);
}

/* Rev → orange outline; fills left-to-right with live RPM while held. */
#revBtn:not(#x) {
  --pill-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M13 3 5 13.5h6L10 21l8-10.5h-6z'/%3E%3C/svg%3E");
  --fill-pct: calc(var(--rev-fill, 0) * 100%);
  background:
    linear-gradient(90deg, rgba(255, 138, 61, .55), rgba(255, 138, 61, .9)) left / var(--fill-pct) 100% no-repeat,
    rgba(255, 138, 61, .12);
  color: #ffb27d;
  box-shadow: inset 0 0 0 1.5px rgba(255, 138, 61, .55);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#revBtn.redline:not(#x) {
  background:
    linear-gradient(90deg, rgba(255, 138, 61, .6), var(--limit)) left / var(--fill-pct) 100% no-repeat,
    rgba(255, 138, 61, .12);
}
#revBtn:not(#x):active:not(:disabled) { color: #fff; }
#revBtn:not(#x):disabled { opacity: .38; cursor: not-allowed; }

/* ---------- Web sidebar: pills sit side by side at the top ---------- */
.control-strip > .drive-pills { width: 100%; }

/* ---------- Light theme ---------- */
body.theme-day .control-strip .drive-pills { background: rgba(16, 34, 45, .06); }
body.theme-day #startBtn:not(#x) { background: #00778f; color: #fff; box-shadow: 0 6px 16px rgba(0, 119, 143, .25); }
body.theme-day #startBtn.running:not(#x) { background: rgba(179, 36, 26, .08); color: #b3241a; box-shadow: inset 0 0 0 1.5px rgba(179, 36, 26, .6); }
body.theme-day #revBtn:not(#x) {
  background:
    linear-gradient(90deg, rgba(255, 122, 26, .7), #ff7a1a) left / var(--fill-pct) 100% no-repeat,
    rgba(255, 122, 26, .1);
  color: #b8501a;
  box-shadow: inset 0 0 0 1.5px rgba(184, 80, 26, .55);
}

@media (prefers-reduced-motion: reduce) {
  #startBtn:not(#x), #revBtn:not(#x) { transition: none; }
}
