/* Dedicated stylesheet for #touch (loaded AFTER toy.css).
 * Native-game-grade dark translucent touch ergonomics for Portrait & Landscape phones/tablets.
 * Physical car controls stay strictly LTR (wheel left, brake inner-right, gas outer-right) even in [dir="rtl"]. */

/* ---------- Root container & browser gesture hygiene ---------- */
html body #touch {
  --tc-glass: rgba(12, 18, 30, 0.72);
  --tc-glass-hi: rgba(20, 30, 48, 0.86);
  --tc-glass-soft: rgba(12, 18, 30, 0.48);
  --tc-border: rgba(255, 255, 255, 0.18);
  --tc-border-hi: rgba(255, 255, 255, 0.36);
  --tc-text: #f8fafc;
  --tc-dim: rgba(226, 232, 240, 0.78);
  --tc-amber: #f59e0b;
  --tc-amber-glow: rgba(245, 158, 11, 0.45);
  --tc-red: #ef4444;
  --tc-red-deep: rgba(185, 28, 28, 0.48);
  --tc-green: #10b981;
  --tc-green-deep: rgba(6, 95, 70, 0.48);
  --tc-blue: #38bdf8;
  --tc-edge: 12px;
  --tc-bot: max(14px, var(--safe-b, 0px));
  --tc-l: calc(var(--tc-edge) + var(--safe-l, 0px));
  --tc-r: calc(var(--tc-edge) + var(--safe-r, 0px));

  position: fixed;
  inset: 0;
  z-index: 14;
  pointer-events: none;
  direction: ltr !important;
  color: var(--tc-text);
  font-family: var(--font-body, "DM Sans", system-ui, -apple-system, sans-serif);
  font-size: 14px;
  line-height: 1.2;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html body #touch.hidden {
  display: none !important;
}

html body #touch *,
html body #touch button {
  box-sizing: border-box;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

/* Retire legacy clutch strip & hidden elements cleanly without affecting layout */
html body #touch #t-cbar,
html body.upright #touch #t-cbar,
html body:not(.upright) #touch #t-cbar,
html body #touch .tc-legacy-hidden,
html body #touch #t-more {
  display: none !important;
  pointer-events: none !important;
}

/* ---------- Shared tactile dark-glass button surface ---------- */
html body #touch.tc-ready .tc-btn {
  pointer-events: auto;
  position: relative;
  display: inline-flex !important;
  flex: none !important;
  order: 0 !important;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  margin: 0;
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  background: var(--tc-glass);
  color: var(--tc-text);
  border: 1px solid var(--tc-border);
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease-out, background-color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

/* Neutralize any legacy pseudo-element line breaks or wrapping from older stylesheets */
html body #touch.tc-ready .t-pad::before,
html body #touch.tc-ready .t-pad::after,
html body #touch.tc-ready .t-mid::before,
html body #touch.tc-ready .t-mid::after,
html body.upright #touch.tc-ready .t-pad::before,
html body.upright #touch.tc-ready .t-pad::after {
  content: none !important;
  display: none !important;
}

html body #touch.tc-ready .tc-btn:active,
html body #touch.tc-ready .tc-btn.tc-pressed {
  transform: scale(0.94);
  background: var(--tc-glass-hi);
  border-color: var(--tc-border-hi);
}

html body #touch.tc-ready .tc-btn svg {
  width: 22px;
  height: 22px;
  flex: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

/* Screen-reader captions injected by hud.js stay accessible with readable >=12px computed size */
html body #touch.tc-ready .tc-sig > span,
html body #touch.tc-ready .tc-glance > span,
html body #touch.tc-ready .tc-util > span,
html body #touch.tc-ready .tc-extra > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.2;
}

/* Visual coaching highlight (.want from hud.js) — pure glow, ZERO hiding or reflow */
html body #touch.tc-ready button.want {
  border-color: var(--tc-amber) !important;
  box-shadow: 0 0 0 2.5px var(--tc-amber), 0 0 16px var(--tc-amber-glow), 0 6px 18px rgba(2, 6, 23, 0.36) !important;
  animation: tc-want-pulse 1.15s ease-in-out infinite alternate;
}

@keyframes tc-want-pulse {
  from { box-shadow: 0 0 0 2px var(--tc-amber), 0 0 10px rgba(245, 158, 11, 0.35), 0 6px 18px rgba(2, 6, 23, 0.36); }
  to   { box-shadow: 0 0 0 3.5px #fbbf24, 0 0 20px rgba(245, 158, 11, 0.72), 0 6px 18px rgba(2, 6, 23, 0.36); }
}

/* =========================================================================
 * 1. LEFT-THUMB STEERING CLUSTER (Indicators + Wheel / Paddles / Tilt + Mode)
 * ========================================================================= */
html body #touch.tc-ready .tc-steer-cluster {
  position: absolute;
  left: var(--tc-l);
  bottom: var(--tc-bot);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  pointer-events: none;
  z-index: 2;
}

/* Fixed indicator stalks directly above steering */
html body #touch.tc-ready .tc-indicators {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 4px;
  pointer-events: none;
}

html body #touch.tc-ready .tc-sig {
  width: 56px;
  height: 48px;
  min-width: 56px;
  min-height: 48px;
  border-radius: 14px;
  color: rgba(248, 250, 252, 0.84);
}

html body #touch.tc-ready .tc-sig svg {
  width: 24px;
  height: 24px;
}

html body #touch.tc-ready .tc-sig.tc-sig-armed {
  border-color: rgba(245, 158, 11, 0.55);
  color: #fcd34d;
  background: rgba(120, 53, 15, 0.42);
}

html body #touch.tc-ready .tc-sig.on {
  background: rgba(245, 158, 11, 0.92) !important;
  border-color: #fde68a !important;
  color: #0f172a !important;
  box-shadow: 0 0 18px rgba(245, 158, 11, 0.78), inset 0 1px 0 rgba(255, 255, 255, 0.45) !important;
}

/* Steering surface + 1-tap mode switcher row */
html body #touch.tc-ready .tc-steer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

/* Reset all legacy .t-steer overrides from sim.css / toy.css */
html body #touch.tc-ready .t-steer,
html body.upright #touch.tc-ready .t-steer,
html body:not(.upright) #touch.tc-ready .t-steer {
  position: relative !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  top: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: none !important;
  background-image: none !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  pointer-events: auto;
  flex: none;
}

/* --- Mode 1: Virtual Steering Wheel (default: 136px portrait, 144px landscape) --- */
html body #touch.tc-ready[data-steer-mode="wheel"] .t-steer {
  width: 136px !important;
  height: 136px !important;
  border-radius: 50% !important;
}

html body #touch.tc-ready .tc-wheel-wrap {
  display: none;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

html body #touch.tc-ready[data-steer-mode="wheel"] .tc-wheel-wrap {
  display: flex;
}

html body #touch.tc-ready .tc-wheel-ring {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, rgba(15, 23, 42, 0.42) 0%, rgba(12, 18, 30, 0.72) 72%, rgba(15, 23, 42, 0.84) 100%);
  border: 1.5px solid var(--tc-border);
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

html body #touch.tc-ready .t-steer.active .tc-wheel-ring {
  border-color: rgba(245, 158, 11, 0.7);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.25), 0 10px 28px rgba(2, 6, 23, 0.56);
}

/* Fixed 12 o'clock reference tick on housing so driver feels exact center angle */
html body #touch.tc-ready .tc-tdc-ref {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  border-radius: 2px;
  background: rgba(248, 250, 252, 0.75);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  z-index: 2;
}

html body #touch.tc-ready .tc-wheel-svg {
  width: 96%;
  height: 96%;
  display: block;
  will-change: transform;
  pointer-events: none;
  filter: drop-shadow(0 2px 6px rgba(2, 6, 23, 0.5));
}

/* --- Mode 2: Ergonomic Left / Right Paddles (>=64x64px each) --- */
html body #touch.tc-ready[data-steer-mode="paddles"] .t-steer {
  width: auto !important;
  height: auto !important;
}

html body #touch.tc-ready .tc-paddles {
  display: none;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

html body #touch.tc-ready[data-steer-mode="paddles"] .tc-paddles {
  display: flex;
}

html body #touch.tc-ready .tc-paddle {
  width: 66px;
  height: 66px;
  min-width: 64px;
  min-height: 64px;
  border-radius: 18px;
  background: var(--tc-glass);
  border: 1.5px solid var(--tc-border);
  color: var(--tc-text);
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s ease, background-color 0.1s ease, border-color 0.1s ease;
}

html body #touch.tc-ready .tc-paddle svg {
  width: 30px;
  height: 30px;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

html body #touch.tc-ready .tc-paddle.on {
  background: rgba(56, 189, 248, 0.34);
  border-color: var(--tc-blue);
  color: #ffffff;
  transform: scale(0.95);
  box-shadow: 0 0 18px rgba(56, 189, 248, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* --- Mode 3: Tilt / Gyro level gauge --- */
html body #touch.tc-ready[data-steer-mode="tilt"] .t-steer {
  width: 136px !important;
  height: 64px !important;
}

html body #touch.tc-ready .tc-tilt-gauge {
  display: none;
  width: 100%;
  height: 100%;
  padding: 8px 12px;
  border-radius: 16px;
  background: var(--tc-glass);
  border: 1.5px solid rgba(56, 189, 248, 0.42);
  color: var(--tc-text);
  box-shadow: 0 8px 22px rgba(2, 6, 23, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: auto;
}

html body #touch.tc-ready[data-steer-mode="tilt"] .tc-tilt-gauge {
  display: flex;
}

html body #touch.tc-ready .tc-tilt-gauge.on {
  border-color: var(--tc-amber);
  background: var(--tc-glass-hi);
}

html body #touch.tc-ready .tc-tilt-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

html body #touch.tc-ready .tc-tilt-center {
  position: absolute;
  left: 50%;
  top: -2px;
  bottom: -2px;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.45);
}

html body #touch.tc-ready .tc-tilt-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--tc-amber);
  border: 2px solid #0f172a;
  box-shadow: 0 0 10px var(--tc-amber-glow);
  will-change: transform;
}

html body #touch.tc-ready .tc-tilt-lbl {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--tc-dim);
  white-space: nowrap;
}

/* --- Compact 1-tap Steering Mode Switcher (>=44x44px) --- */
html body #touch.tc-ready .tc-mode-btn {
  width: 48px;
  height: 48px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 14px;
  flex-direction: column;
  gap: 2px;
  padding: 4px 2px;
  margin-bottom: 4px;
  flex: none;
}

html body #touch.tc-ready .tc-mode-ic {
  display: grid;
  place-items: center;
  line-height: 0;
}

html body #touch.tc-ready .tc-mode-ic svg {
  width: 19px;
  height: 19px;
}

html body #touch.tc-ready .tc-mode-lbl {
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  color: var(--tc-dim);
  max-width: 44px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body #touch.tc-ready .tc-mode-btn[data-steer-mode="tilt"] {
  border-color: rgba(56, 189, 248, 0.55);
  color: var(--tc-blue);
}

html body #touch.tc-ready .tc-mode-btn.on {
  border-color: var(--tc-amber);
  background: var(--tc-glass-hi);
}

/* =========================================================================
 * 2. ANALOG VERTICAL CLUTCH SLIDER (Manual mode only, outer-left edge)
 * ========================================================================= */
html body #touch.tc-ready #t-clutch.tc-clutch {
  position: absolute;
  left: var(--tc-l);
  bottom: calc(var(--tc-bot) + 206px);
  width: 52px;
  height: 176px;
  padding: 5px;
  border-radius: 26px;
  background: var(--tc-glass);
  border: 1.5px solid var(--tc-border);
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  z-index: 3;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

html body #touch.tc-ready #t-clutch.tc-clutch.hidden {
  display: none !important;
}

html body #touch.tc-ready .tc-cl-track {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 21px;
  background: rgba(2, 6, 23, 0.52);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}

html body #touch.tc-ready .tc-cl-fill {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.16), rgba(56, 189, 248, 0.32));
  pointer-events: none;
}

/* Highlighted green biting-point zone (0.16–0.74) */
html body #touch.tc-ready .tc-cl-bite {
  position: absolute;
  left: 0;
  right: 0;
  top: 16%;
  bottom: 26%;
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.22), rgba(16, 185, 129, 0.36), rgba(16, 185, 129, 0.22));
  border-top: 1.5px solid rgba(52, 211, 153, 0.72);
  border-bottom: 1.5px solid rgba(52, 211, 153, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}

html body #touch.tc-ready .tc-cl-bite-tag {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: rgba(167, 243, 208, 0.92);
  text-shadow: 0 1px 2px rgba(2, 6, 23, 0.8);
  pointer-events: none;
}

html body #touch.tc-ready .tc-cl-thumb {
  position: absolute;
  top: 0;
  left: 2px;
  right: 2px;
  height: 36px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fafc, #cbd5e1);
  color: #0f172a;
  box-shadow: 0 3px 10px rgba(2, 6, 23, 0.65), inset 0 1px 0 #ffffff;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  will-change: transform;
  pointer-events: none;
}

html body #touch.tc-ready #t-clutch.on {
  border-color: var(--tc-blue);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.32), 0 8px 24px rgba(2, 6, 23, 0.5);
}

/* Live green bite-point glow & tactile pulse */
html body #touch.tc-ready #t-clutch.at-bite {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.45), 0 0 22px rgba(16, 185, 129, 0.65);
}

html body #touch.tc-ready #t-clutch.at-bite .tc-cl-bite {
  background: linear-gradient(180deg, rgba(16, 185, 129, 0.42), rgba(52, 211, 153, 0.58), rgba(16, 185, 129, 0.42));
}

html body #touch.tc-ready #t-clutch.at-bite .tc-cl-thumb {
  background: linear-gradient(180deg, #6ee7b7, #10b981);
  color: #022c22;
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.9);
}

/* =========================================================================
 * 3. SUBTLE FIXED EDGE GLANCE PILLS (NEVER shift or reflow)
 * ========================================================================= */
/* Portrait: Left & Right flush screen-edge tabs + Rear mirror tucked cleanly bottom-center */
html body #touch.tc-ready .tc-glances {
  display: contents;
  pointer-events: none;
}

html body #touch.tc-ready .tc-glance {
  background: var(--tc-glass-soft);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(248, 250, 252, 0.86);
  box-shadow: 0 4px 14px rgba(2, 6, 23, 0.28);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2;
}

html body #touch.tc-ready .tc-glance.on {
  background: rgba(245, 158, 11, 0.9) !important;
  border-color: #fde68a !important;
  color: #0f172a !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.72) !important;
}

html body #touch.tc-ready .tc-glance-l {
  position: absolute;
  left: var(--safe-l, 0px);
  top: 36%;
  transform: translateY(-50%);
  width: 46px;
  height: 52px;
  border-radius: 0 16px 16px 0;
  border-left: 0;
}

html body #touch.tc-ready .tc-glance-r {
  position: absolute;
  right: var(--safe-r, 0px);
  top: 36%;
  transform: translateY(-50%);
  width: 46px;
  height: 52px;
  border-radius: 16px 0 0 16px;
  border-right: 0;
}

html body #touch.tc-ready .tc-glance-rear {
  position: absolute;
  left: 50%;
  bottom: calc(var(--tc-bot) + 74px);
  transform: translateX(-50%);
  width: 48px;
  height: 44px;
  border-radius: 14px;
}

/* =========================================================================
 * 4. RIGHT CLUSTER: UTILITY DOCK + GEAR POPOVER + ANALOG PEDAL CLUSTER
 * ========================================================================= */
html body #touch.tc-ready .tc-right-cluster {
  position: absolute;
  right: var(--tc-r);
  bottom: var(--tc-bot);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  z-index: 3;
}

html body #touch.tc-ready .tc-right-top {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}

/* Extras row (Horn + weather-conditional Fog lamp) — neatly offset clear of Gear popover */
html body #touch.tc-ready .tc-extras-row,
html body.upright #touch.tc-ready .t-mid,
html body:not(.upright) #touch.tc-ready .t-mid {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-right: 58px;
  pointer-events: none;
}

html body #touch.tc-ready .tc-extras-row:empty {
  display: none !important;
}

html body #touch.tc-ready .tc-extra {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  border-radius: 13px !important;
  font-size: 12px !important;
}

html body #touch.tc-ready .tc-extra.on {
  background: rgba(245, 158, 11, 0.85) !important;
  border-color: #fde68a !important;
  color: #0f172a !important;
  filter: none !important;
}

/* Only show rear fog button in fog weather or when active/suggested */
html body #touch.tc-ready:not(.tc-fog-wx) [data-x="fog"]:not(.on):not(.want) {
  display: none !important;
}

/* Primary fixed utility row: Lights, Handbrake, Gear */
html body #touch.tc-ready .tc-utility-row,
html body.upright #touch.tc-ready .t-pad,
html body:not(.upright) #touch.tc-ready .t-pad {
  position: static !important;
  inset: auto !important;
  width: auto !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  pointer-events: none;
}

html body #touch.tc-ready .tc-util {
  width: 48px !important;
  height: 48px !important;
  min-width: 48px !important;
  min-height: 48px !important;
  border-radius: 14px !important;
}

/* Handbrake active = crisp crimson glow */
html body #touch.tc-ready [data-t="hand"].on {
  background: rgba(220, 38, 38, 0.82) !important;
  border-color: #fca5a5 !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.55) !important;
}

/* Headlights active = crisp sky-blue glow */
html body #touch.tc-ready [data-t="lights"].on {
  background: rgba(14, 165, 233, 0.82) !important;
  border-color: #bae6fd !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.55) !important;
}

/* --- Gear Selector Button + Compact Popover Strip --- */
html body #touch.tc-ready .tc-gear-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

html body #touch.tc-ready #t-gear.tc-gear-btn {
  width: 52px !important;
  height: 48px !important;
  min-width: 52px !important;
  min-height: 48px !important;
  border-radius: 14px !important;
  background: rgba(15, 23, 42, 0.88) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.3) !important;
  color: #ffffff !important;
  font-family: var(--font-display, system-ui, sans-serif) !important;
  font-size: 20px !important;
  font-weight: 800 !important;
  font-variant-numeric: tabular-nums;
  padding-bottom: 2px !important;
}

/* Subtle chevron cue that tapping #t-gear opens the gear strip (survives textContent updates) */
html body #touch.tc-ready #t-gear.tc-gear-btn::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 6px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid rgba(148, 163, 184, 0.85);
  transition: transform 0.14s ease;
}

html body #touch.tc-ready #t-gear.tc-gear-btn.open {
  border-color: var(--tc-blue) !important;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.35), 0 8px 20px rgba(2, 6, 23, 0.5) !important;
}

html body #touch.tc-ready #t-gear.tc-gear-btn.open::after {
  transform: rotate(180deg);
  border-bottom-color: var(--tc-blue);
}

/* Vertical Gear Popover Strip (opens upward in Portrait) */
html body #touch.tc-ready .tc-gear-pop {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  z-index: 25;
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
  padding: 5px;
  border-radius: 16px;
  background: rgba(10, 16, 28, 0.94);
  border: 1.5px solid rgba(255, 255, 255, 0.24);
  box-shadow: 0 14px 36px rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  pointer-events: auto;
}

html body #touch.tc-ready .tc-gear-pop.hidden {
  display: none !important;
}

html body #touch.tc-ready .tc-gear-pop.tc-gear-man {
  grid-template-columns: repeat(2, 1fr);
}

html body #touch.tc-ready .tc-gear-opt {
  width: 48px;
  height: 44px;
  min-width: 48px;
  min-height: 44px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--tc-text);
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 16px;
  font-weight: 800;
  display: grid;
  place-items: center;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.1s ease, border-color 0.1s ease;
}

html body #touch.tc-ready .tc-gear-opt.on {
  background: var(--tc-blue);
  border-color: #bae6fd;
  color: #082f49;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

html body #touch.tc-ready .tc-gear-opt[data-gear-pick="R"].on {
  background: var(--tc-amber);
  border-color: #fde68a;
  color: #0f172a;
}

html body #touch.tc-ready .tc-gear-opt[data-gear-pick="P"].on {
  background: var(--tc-red);
  border-color: #fca5a5;
  color: #ffffff;
}

html body #touch.tc-ready .tc-gear-opt.tc-pressed {
  transform: scale(0.92);
}

/* --- Analog Vertical-Slide Brake & Gas Pedal Cluster (Always LTR: Brake left, Gas right) --- */
html body #touch.tc-ready .t-pedals,
html body.upright #touch.tc-ready .t-pedals,
html body:not(.upright) #touch.tc-ready .t-pedals {
  position: static !important;
  inset: auto !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: flex-end !important;
  justify-content: flex-end !important;
  gap: 10px !important;
  direction: ltr !important;
  pointer-events: auto !important;
}

html body #touch.tc-ready .t-pedals .tc-pedal {
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 0 4px 12px !important;
  margin: 0 !important;
  border-radius: 18px !important;
  border: 1.5px solid var(--tc-border) !important;
  background: var(--tc-glass) !important;
  color: #ffffff !important;
  box-shadow: 0 10px 26px rgba(2, 6, 23, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.16) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  pointer-events: auto;
  transform: none !important;
  filter: none !important;
  transition: border-color 0.1s ease, box-shadow 0.1s ease;
}

html body #touch.tc-ready .t-pedals [data-p="brake"] {
  order: 0 !important;
  width: 68px !important;
  height: 136px !important;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.72) 0%, rgba(127, 29, 29, 0.56) 100%) !important;
  border-color: rgba(248, 113, 113, 0.42) !important;
}

html body #touch.tc-ready .t-pedals [data-p="throttle"] {
  order: 1 !important;
  width: 72px !important;
  height: 152px !important;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.72) 0%, rgba(6, 78, 59, 0.58) 100%) !important;
  border-color: rgba(52, 211, 153, 0.45) !important;
}

/* Live illuminated analog fill bar (0.0 -> 1.0) */
html body #touch.tc-ready .tc-pfill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  transform-origin: bottom center;
  transform: scaleY(var(--v, 0));
  will-change: transform;
  pointer-events: none;
  z-index: 0;
}

html body #touch.tc-ready .tc-pedal-brake .tc-pfill {
  background: linear-gradient(0deg, rgba(220, 38, 38, 0.88) 0%, rgba(248, 113, 113, 0.92) 92%, #fecaca 100%);
  box-shadow: 0 -4px 16px rgba(239, 68, 68, 0.65);
}

html body #touch.tc-ready .tc-pedal-throttle .tc-pfill {
  background: linear-gradient(0deg, rgba(5, 150, 105, 0.88) 0%, rgba(52, 211, 153, 0.92) 92%, #a7f3d0 100%);
  box-shadow: 0 -4px 16px rgba(16, 185, 129, 0.65);
}

/* Modulation scale ticks along pedal track */
html body #touch.tc-ready .tc-pticks {
  position: absolute;
  inset: 14px 10px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 1;
}

html body #touch.tc-ready .tc-pticks i {
  display: block;
  width: 10px;
  height: 2px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.24);
}

html body #touch.tc-ready .tc-pticks i:nth-child(2) {
  width: 16px;
  background: rgba(255, 255, 255, 0.34);
}

/* Tactile metallic pedal tread ribs */
html body #touch.tc-ready .tc-pgrip {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 34px;
  margin-bottom: 10px;
  pointer-events: none;
}

html body #touch.tc-ready .tc-pgrip i {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.28);
}

/* Readable >=12px pedal labels (fits Arabic/German/Russian cleanly) */
html body #touch.tc-ready .tc-plbl {
  position: relative;
  z-index: 2;
  font-family: var(--font-display, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(2, 6, 23, 0.85);
  max-width: 100%;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  unicode-bidi: isolate;
  pointer-events: none;
}

html body #touch.tc-ready .tc-pedal-brake.on {
  border-color: #fca5a5 !important;
  box-shadow: 0 0 22px rgba(239, 68, 68, 0.55), 0 10px 26px rgba(2, 6, 23, 0.48) !important;
}

html body #touch.tc-ready .tc-pedal-throttle.on {
  border-color: #6ee7b7 !important;
  box-shadow: 0 0 22px rgba(16, 185, 129, 0.55), 0 10px 26px rgba(2, 6, 23, 0.48) !important;
}

/* =========================================================================
 * 5. COMPACT PORTRAIT PHONES (<= 375px width, e.g. 360x800 Android)
 * ========================================================================= */
@media (max-width: 375px) and (orientation: portrait) {
  html body #touch {
    --tc-edge: 10px;
  }

  html body #touch.tc-ready[data-steer-mode="wheel"] .t-steer {
    width: 128px !important;
    height: 128px !important;
  }

  html body #touch.tc-ready .tc-paddles {
    gap: 6px;
  }

  html body #touch.tc-ready .tc-paddle {
    width: 64px;
    height: 64px;
  }

  html body #touch.tc-ready .tc-mode-btn {
    width: 46px;
    height: 46px;
  }

  html body #touch.tc-ready .t-pedals {
    gap: 8px !important;
  }

  html body #touch.tc-ready .t-pedals [data-p="brake"] {
    width: 62px !important;
    height: 130px !important;
  }

  html body #touch.tc-ready .t-pedals [data-p="throttle"] {
    width: 66px !important;
    height: 146px !important;
  }

  html body #touch.tc-ready #t-clutch.tc-clutch {
    bottom: calc(var(--tc-bot) + 196px);
    width: 50px;
    height: 168px;
  }

  html body #touch.tc-ready .tc-glance-rear {
    bottom: calc(var(--tc-bot) + 74px);
  }
}

/* =========================================================================
 * 6. LANDSCAPE PHONES & TABLETS (not .upright / landscape orientation)
 * ========================================================================= */
@media (orientation: landscape) {
  html body:not(.upright) #touch {
    --tc-edge: 14px;
    --tc-bot: max(12px, var(--safe-b, 0px));
  }

  /* >=144px virtual wheel diameter in landscape */
  html body:not(.upright) #touch.tc-ready[data-steer-mode="wheel"] .t-steer {
    width: 144px !important;
    height: 144px !important;
  }

  html body:not(.upright) #touch.tc-ready .tc-paddle {
    width: 68px;
    height: 68px;
  }

  html body:not(.upright) #touch.tc-ready .tc-steer-cluster {
    gap: 8px;
  }

  /* Landscape manual mode: sleek vertical clutch rail outer-left, wheel neatly beside it */
  html body:not(.upright) #touch.tc-ready #t-clutch.tc-clutch {
    left: var(--tc-l);
    bottom: var(--tc-bot);
    width: 48px;
    height: 184px;
  }

  html body.tc-manual:not(.upright) #touch.tc-ready .tc-steer-cluster {
    left: calc(var(--tc-l) + 58px);
  }

  /* Landscape right cluster: single horizontal row for extras + utilities above pedals */
  html body:not(.upright) #touch.tc-ready .tc-right-cluster {
    gap: 8px;
  }

  html body:not(.upright) #touch.tc-ready .tc-right-top {
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  html body:not(.upright) #touch.tc-ready .tc-extras-row,
  html body:not(.upright) #touch.tc-ready .t-mid {
    padding-right: 0;
  }

  html body:not(.upright) #touch.tc-ready .t-pedals [data-p="brake"] {
    width: 70px !important;
    height: 130px !important;
  }

  html body:not(.upright) #touch.tc-ready .t-pedals [data-p="throttle"] {
    width: 74px !important;
    height: 146px !important;
  }

  /* Landscape gear popover opens to the LEFT of #t-gear so it never clips at top of 390px screens */
  html body:not(.upright) #touch.tc-ready .tc-gear-pop {
    bottom: 0;
    right: calc(100% + 8px);
    grid-template-columns: repeat(4, 1fr);
  }

  html body:not(.upright) #touch.tc-ready .tc-gear-pop.tc-gear-man {
    grid-template-columns: repeat(4, 1fr);
  }

  html body:not(.upright) #touch.tc-ready #t-gear.tc-gear-btn::after {
    top: 50%;
    right: auto;
    left: 4px;
    margin-top: -4px;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 5px solid rgba(148, 163, 184, 0.85);
    border-left: 0;
  }

  /* Landscape glance pills: clean horizontal translucent strip centered at bottom (center road 100% open!) */
  html body:not(.upright) #touch.tc-ready .tc-glances {
    position: absolute;
    left: 50%;
    bottom: var(--tc-bot);
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    z-index: 2;
  }

  html body:not(.upright) #touch.tc-ready .tc-glance-l,
  html body:not(.upright) #touch.tc-ready .tc-glance-rear,
  html body:not(.upright) #touch.tc-ready .tc-glance-r {
    position: static;
    inset: auto;
    transform: none;
    width: 48px;
    height: 44px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.16);
  }
}

/* Very tight landscape phones (e.g. 667x375) */
@media (orientation: landscape) and (max-width: 720px) {
  html body:not(.upright) #touch {
    --tc-edge: 8px;
  }

  html body.tc-manual:not(.upright) #touch.tc-ready .tc-steer-cluster {
    left: calc(var(--tc-l) + 52px);
  }

  html body:not(.upright) #touch.tc-ready #t-clutch.tc-clutch {
    width: 44px;
    height: 172px;
  }

  html body:not(.upright) #touch.tc-ready .tc-glances {
    gap: 6px;
  }

  html body:not(.upright) #touch.tc-ready .tc-glance-l,
  html body:not(.upright) #touch.tc-ready .tc-glance-rear,
  html body:not(.upright) #touch.tc-ready .tc-glance-r {
    width: 44px;
    height: 44px;
  }
}

/* =========================================================================
 * 7. iOS VISUAL PULSE FEEDBACK (when navigator.vibrate is absent)
 * ========================================================================= */
html body #touch.tc-pulse-bite #t-clutch {
  animation: tc-ios-bite 0.26s ease-out;
}

html body #touch.tc-pulse-stall .tc-steer-surface,
html body #touch.tc-pulse-stall #t-clutch {
  animation: tc-ios-stall 0.32s ease-out;
}

html body #touch.tc-pulse-grind #t-gear {
  animation: tc-ios-grind 0.26s ease-out;
}

@keyframes tc-ios-bite {
  0%   { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.85); }
  100% { box-shadow: 0 0 0 12px rgba(16, 185, 129, 0); }
}

@keyframes tc-ios-stall {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

@keyframes tc-ios-grind {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8); }
  50%      { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.45); }
}

@media (prefers-reduced-motion: reduce) {
  html body #touch.tc-ready button.want,
  html body #touch.tc-pulse-bite #t-clutch,
  html body #touch.tc-pulse-stall .tc-steer-surface,
  html body #touch.tc-pulse-stall #t-clutch,
  html body #touch.tc-pulse-grind #t-gear {
    animation: none !important;
  }
}
