.drive-overlay-layer {
  position: absolute;
  left: 0;
  top: 0;
  right: auto;
  bottom: auto;
  width: 100%;
  height: 100%;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

.drive-overlay-layer[hidden] {
  display: none;
}

.drive-overlay-stage {
  --text: #f3f4f4;
  --muted: #b8bec4;
  --accent: #32c477;
  --accent-2: #e1a93b;
  --danger: #ef4444;
  position: relative;
  width: 1280px;
  height: 720px;
  overflow: hidden;
  background: transparent;
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  pointer-events: none;
  transform: scale(var(--drive-overlay-scale, 1));
  transform-origin: top left;
}

.drive-overlay-stage .widget-canvas {
  position: absolute;
  z-index: 8;
  pointer-events: none;
}

.drive-overlay-stage .widget-minimap {
  left: 0;
  top: 0;
  width: 320px;
  height: 230px;
  border: 1px solid rgba(243, 244, 244, 0.24);
  border-radius: 0 0 4px 0;
  background:
    linear-gradient(135deg, rgba(50, 196, 119, 0.14), transparent 42%),
    rgba(4, 6, 8, 0.78);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(6px);
}

.drive-overlay-stage .drive-gauge-hud {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 9;
  opacity: 0.56;
  pointer-events: none;
}

.drive-overlay-stage .drive-gauge-hud.active {
  opacity: 1;
}

.drive-overlay-stage .overlay-context-hud {
  position: absolute;
  left: 0;
  top: 238px;
  display: grid;
  width: 360px;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(243, 244, 244, 0.26);
  border-left: 4px solid var(--accent);
  border-radius: 0 4px 4px 0;
  background:
    linear-gradient(90deg, rgba(50, 196, 119, 0.2), transparent 38%),
    rgba(4, 6, 8, 0.84);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.drive-overlay-stage .overlay-context-hud div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px 8px;
  background: rgba(17, 20, 23, 0.74);
  border: 1px solid rgba(243, 244, 244, 0.08);
}

.drive-overlay-stage .overlay-context-hud span,
.drive-overlay-stage .overlay-context-hud small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.drive-overlay-stage .overlay-context-hud strong {
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-overlay-stage .overlay-context-hud small {
  grid-column: 1 / -1;
  padding: 0 2px;
}

.drive-overlay-stage .telemetry-hud {
  --rpm-arc: 0deg;
  --speed-arc: 0deg;
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: block;
  width: 220px;
  height: 220px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(4, 6, 8, 0.88) 0 50%, transparent 51%);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.42);
  pointer-events: none;
  backdrop-filter: none;
}

.drive-overlay-stage .telemetry-hud::before,
.drive-overlay-stage .telemetry-hud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 1;
}

.drive-overlay-stage .hud-arc-rings {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 1;
  transform-box: view-box;
  transform-origin: 110px 110px;
  transform: rotate(135deg);
}

.drive-overlay-stage .hud-arc-track,
.drive-overlay-stage .hud-arc {
  fill: none;
  stroke-linecap: butt;
  stroke-dasharray: 270 90;
}

.drive-overlay-stage .hud-arc-track-rpm {
  stroke: rgba(243, 244, 244, 0.14);
  stroke-width: 17;
}

.drive-overlay-stage .hud-arc-track-speed {
  stroke: rgba(243, 244, 244, 0.16);
  stroke-width: 13;
}

.drive-overlay-stage .hud-arc-rpm {
  stroke: var(--accent-2);
  stroke-width: 17;
  stroke-dasharray: 0 360;
}

.drive-overlay-stage .hud-arc-speed {
  stroke: var(--accent);
  stroke-width: 13;
  stroke-dasharray: 0 360;
}

.drive-overlay-stage .hud-scale {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.drive-overlay-stage .hud-rpm-scale {
  --tick-radius: 104px;
}

.drive-overlay-stage .hud-speed-scale {
  --tick-radius: 76px;
}

.drive-overlay-stage .hud-scale-tick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: rotate(var(--tick-angle)) translateY(calc(-1 * var(--tick-radius)));
  transform-origin: center center;
}

.drive-overlay-stage .hud-scale-tick i {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 12px;
  border-radius: 99px;
  background: rgba(243, 244, 244, 0.82);
  transform: translate(-50%, -6px);
}

.drive-overlay-stage .hud-scale-tick.minor i {
  width: 1px;
  height: 7px;
  background: rgba(243, 244, 244, 0.45);
  transform: translate(-50%, -4px);
}

.drive-overlay-stage .hud-rpm-scale .hud-scale-tick i {
  background: rgba(255, 244, 212, 0.9);
  box-shadow: 0 0 8px rgba(4, 6, 8, 0.5);
}

.drive-overlay-stage .hud-rpm-scale .hud-scale-tick.minor i {
  background: rgba(255, 244, 212, 0.42);
}

.drive-overlay-stage .hud-speed-scale .hud-scale-tick i {
  height: 10px;
  background: rgba(138, 222, 255, 0.9);
  transform: translate(-50%, 0);
  box-shadow: 0 0 8px rgba(4, 6, 8, 0.48);
}

.drive-overlay-stage .hud-speed-scale .hud-scale-tick.minor i {
  width: 1px;
  height: 6px;
  background: rgba(138, 222, 255, 0.44);
  transform: translate(-50%, 2px);
}

.drive-overlay-stage .hud-scale-tick b {
  position: absolute;
  left: 0;
  top: 0;
  color: rgba(243, 244, 244, 0.86);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-align: center;
  transform: translate(-50%, -18px) rotate(var(--label-angle));
  white-space: nowrap;
}

.drive-overlay-stage .hud-rpm-scale .hud-scale-tick b {
  color: #ffd36a;
}

.drive-overlay-stage .hud-speed-scale .hud-scale-tick b {
  color: #8adeff;
  font-size: 8px;
  transform: translate(-50%, 13px) rotate(var(--label-angle));
}

/* Retained conic-gradient implementation for rollback/reference only.
.drive-overlay-stage .telemetry-hud::before {
  inset: 0;
  background:
    conic-gradient(from -135deg, var(--accent-2) 0 var(--rpm-arc), rgba(243, 244, 244, 0.14) var(--rpm-arc) 270deg, transparent 270deg 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 18px), #000 calc(100% - 17px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 18px), #000 calc(100% - 17px));
}

.drive-overlay-stage .telemetry-hud::after {
  inset: 28px;
  background:
    conic-gradient(from -135deg, var(--accent) 0 var(--speed-arc), rgba(243, 244, 244, 0.16) var(--speed-arc) 270deg, transparent 270deg 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px));
}
*/

.drive-overlay-stage .hud-cell {
  position: absolute;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.drive-overlay-stage .hud-speed {
  inset: 58px 44px 70px;
  display: grid;
  place-items: center;
  text-align: center;
  z-index: 4;
}

.drive-overlay-stage .hud-rpm {
  left: 44px;
  right: 44px;
  bottom: 42px;
  display: grid;
  gap: 1px;
  text-align: center;
  z-index: 4;
}

.drive-overlay-stage .hud-cell span,
.drive-overlay-stage .hud-cell small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.drive-overlay-stage .hud-cell strong {
  color: var(--text);
  font-size: 25px;
  font-weight: 800;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.drive-overlay-stage .hud-speed strong {
  font-size: 54px;
  line-height: 0.86;
}

.drive-overlay-stage .hud-speed small {
  color: var(--accent);
}

.drive-overlay-stage .hud-rpm strong {
  color: var(--accent-2);
  font-size: 23px;
}

.drive-overlay-stage .hud-meter,
.drive-overlay-stage .hud-rpm-bar {
  display: none;
}

.drive-overlay-stage .drive-gball {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: none;
  width: 168px;
  padding: 10px;
  border: 1px solid rgba(243, 244, 244, 0.24);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(225, 169, 59, 0.14), transparent 42%),
    rgba(4, 6, 8, 0.78);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(6px);
}

.drive-overlay-stage .drive-gball.active {
  display: grid;
  gap: 8px;
}

.drive-overlay-stage .drive-gball-dial {
  position: relative;
  width: 132px;
  height: 132px;
  margin-inline: auto;
  border: 1px solid rgba(243, 244, 244, 0.36);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(243, 244, 244, 0.12) 0 2px, transparent 3px),
    rgba(17, 20, 23, 0.78);
}

.drive-overlay-stage .drive-gball-ring,
.drive-overlay-stage .drive-gball-axis,
.drive-overlay-stage .drive-gball-dot {
  position: absolute;
  pointer-events: none;
}

.drive-overlay-stage .drive-gball-ring {
  left: 50%;
  top: 50%;
  border: 1px solid rgba(243, 244, 244, 0.16);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.drive-overlay-stage .drive-gball-ring-major {
  width: 84%;
  height: 84%;
}

.drive-overlay-stage .drive-gball-ring-minor {
  width: 44%;
  height: 44%;
}

.drive-overlay-stage .drive-gball-axis {
  background: rgba(243, 244, 244, 0.2);
}

.drive-overlay-stage .drive-gball-axis-x {
  left: 10%;
  right: 10%;
  top: 50%;
  height: 1px;
}

.drive-overlay-stage .drive-gball-axis-y {
  top: 10%;
  bottom: 10%;
  left: 50%;
  width: 1px;
}

.drive-overlay-stage .drive-gball-dot {
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.74);
  transform: translate(-50%, -50%);
}

.drive-overlay-stage .drive-gball-readout {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.drive-overlay-stage .drive-gball-readout span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.drive-overlay-stage .turn-hud {
  position: absolute;
  right: 0;
  top: 0;
  display: grid;
  width: 236px;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgba(243, 244, 244, 0.26);
  border-right: 4px solid var(--accent-2);
  border-radius: 0 0 0 4px;
  background:
    linear-gradient(270deg, rgba(225, 169, 59, 0.2), transparent 38%),
    rgba(4, 6, 8, 0.82);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  backdrop-filter: blur(6px);
}

.drive-overlay-stage .turn-head,
.drive-overlay-stage .turn-speed-row,
.drive-overlay-stage .turn-g-row {
  display: grid;
  gap: 2px;
}

.drive-overlay-stage .turn-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  padding: 6px 8px;
  background: rgba(17, 20, 23, 0.78);
  border: 1px solid rgba(243, 244, 244, 0.08);
}

.drive-overlay-stage .turn-head strong {
  overflow: hidden;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.drive-overlay-stage .turn-head span,
.drive-overlay-stage .turn-speed-row span,
.drive-overlay-stage .turn-g-row span,
.drive-overlay-stage .turn-g-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.drive-overlay-stage .turn-speed-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.drive-overlay-stage .turn-g-row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.drive-overlay-stage .turn-speed-row div,
.drive-overlay-stage .turn-g-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 6px 8px;
  background: rgba(17, 20, 23, 0.76);
  border: 1px solid rgba(243, 244, 244, 0.08);
}

.drive-overlay-stage .turn-speed-row strong,
.drive-overlay-stage .turn-g-row strong {
  overflow: hidden;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-overlay-stage .turn-g-row strong {
  color: var(--accent-2);
  font-size: 20px;
}
