* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: #000;
  color: #fff;
  font-family: Helvetica, sans-serif;
}

#app { 
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh; 
  width: 100vw;
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

.stage-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 80vw;
  height: 100vh;
  margin: 0 auto;
}

.stage { 
  position: relative; 
  background: #000;
  width: 1440px;
  height: 800px;
  flex-shrink: 0;
}

.dials { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; justify-content: space-around; }

.dial { width: 500px; height: 230px; display: grid; place-items: center; }
.dial-frame { position: relative; width: 500px; height: 230px; }

/* transparent box with 1px white border */
.dial-border { position: absolute; inset: 0; border: 1px solid #fff; pointer-events: none; }

/* white fill that grows left->right */
.dial-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0px; background: #fff; transition: width 120ms linear; }

/* value blocks: black text on white box */
.value { position: absolute; left: 50%; transform: translateX(-50%); background: #fff; color: #000; display: grid; place-items: center; padding: 8px 16px; }
.value-rpm { top: 50%; transform: translate(-50%, -50%); font-weight: 700; font-size: 96px; line-height: 1; }
.value-speed { top: 50%; transform: translate(-50%, -50%); font-weight: 700; font-size: 128px; line-height: 1; }
/* Fixed width equal to width at 100 */
.value-speed { width: 300px; text-align: center; }

/* badges */
.badge { position: absolute; background: #fff; color: #000; font-weight: 400; font-size: 24px; line-height: 1; padding: 4px 10px; }
.badge-gear { left: 12px; bottom: 12px; }
.badge-unit { right: 12px; bottom: 12px; }
.badge-hidden { opacity: 0; }

/* Controls under dials */
.controls { position: absolute; left: 0; right: 0; bottom: 50px; display: flex; gap: 20px; justify-content: center; align-items: center; }
.set-speed { display: grid; gap: 8px; color: #fff; font-size: 24px; }
.set-speed .label { text-align: center; color: rgba(255, 255, 255, 0.3); font-style: italic; font-family: Helvetica, sans-serif; }
#setSpeedSlider { width: 520px; }
.set-speed input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 8px;
  background: #222;
  outline: none;
  border-radius: 4px;
  border: 1px solid #444;
}
.set-speed input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px;
  background: #fff;
  border: 1px solid #111;
  border-radius: 50%; cursor: pointer;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.05);
}
.set-speed input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: #fff;
  border: 1px solid #111;
  border-radius: 50%; cursor: pointer;
}
.drive-btn { background: #fff; color: #000; border: 1px solid #fff; font-size: 24px; padding: 8px 16px; cursor: pointer; }

/* Horizontal Dashboard Styles */
.horizontal-dashboard {
  position: absolute;
  inset: 0;
  background: #000;
  font-family: Helvetica, sans-serif;
}

/* Alerts (Top Left) */
.alerts {
  position: absolute;
  top: 308px;
  left: 287px;
  display: flex;
  gap: 36px;
}

.alert {
  padding: 4px 8px;
  border-radius: 3px;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 29px;
}

.alert-text {
  color: #999;
  font-size: 12px;
  font-weight: 400;
  font-family: Helvetica, sans-serif;
  transition: color 0.2s ease;
}

.alert.active {
  background: #ff6b35;
  border-color: #ff6b35;
}

.alert.active .alert-text {
  color: #fff;
}

.alert.flashing {
  animation: alertFlash 0.15s infinite alternate;
}

@keyframes alertFlash {
  0% { opacity: 0.4; }
  100% { opacity: 1; }
}

/* Gear Display (Top Center) */
.gear-display {
  position: absolute;
  top: 221px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
}

.gear-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 66px;
  position: relative;
  overflow: visible;
  width: 100%;
  height: 114px;
}

.gear-current {
  font-size: 114px;
  font-weight: 700;
  color: #fff;
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  font-family: Helvetica, sans-serif;
  line-height: 1;
  white-space: nowrap;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.gear-inactive {
  font-size: 46px;
  font-weight: 400;
  color: #666;
  text-align: center;
  position: absolute;
  left: 50%;
  z-index: 1;
  font-family: Helvetica, sans-serif;
  line-height: 1;
  white-space: nowrap;
}

/* Tachometer (Middle) */
.tachometer {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 918px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.rpm-display {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
}

.rpm-text {
  font-size: 48px;
  font-weight: 700;
  color: #000;
  font-family: Helvetica, sans-serif;
  line-height: 1;
}

.tachometer-bar {
  position: relative;
  width: 918px;
  height: 64px;
  overflow: hidden;
}

.tachometer-background {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.tachometer-ticks {
  position: absolute;
  inset: 0;
  /* 
     Logic as suggested:
     - Complete gauge length: 918px
     - 100 ticks evenly spaced: 918px / 100 = 9.18px per tick
     - Each tick is 3px wide, spacing 9.18px - 3px = 6.18px gap
     - Draw grey ticks, but override the first two with black without shifting anything
  */
  background:
    /* First two ticks from the left set to black (covering the first two grey ticks) */
    /* Tick #1: 6.18px–9.18px */
    linear-gradient(to right, transparent 0, transparent 6.18px, #000 6.18px, #000 9.18px, transparent 9.18px) no-repeat,
    /* Tick #2: 15.36px–18.36px (2*9.18 - 3 to 2*9.18) */
    linear-gradient(to right, transparent 0, transparent 15.36px, #000 15.36px, #000 18.36px, transparent 18.36px) no-repeat,
    /* Base grey repeating ticks across the full bar */
    repeating-linear-gradient(
      to right,
      transparent 0px,
      transparent calc(9.18px - 3px),
      #666 calc(9.18px - 3px),
      #666 9.18px,
      transparent 9.18px,
      transparent calc(9.18px * 2)
    );
  background-size: 100% 100%, 100% 100%, 100% 100%;
  background-position: 0 0, 0 0, 0 0;
}

.tachometer-ticks::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 12.18px;
  pointer-events: none;
  /* First two ticks in black: tick 1 at 0-3px, tick 2 at 9.18-12.18px */
  background-image: 
    /* Tick 2 at 9.18px */
    linear-gradient(to right, transparent 0, transparent 9.18px, #000 9.18px, #000 12.18px, transparent 12.18px),
    /* Tick 1 at 0px */
    linear-gradient(to right, #000 0, #000 3px, transparent 3px);
  background-size: 100% 100%;
  background-repeat: no-repeat;
  z-index: 2;
}

.tachometer-ticks::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 2;
  /* 
     Redline ratio: 7000 RPM / 8800 RPM = 0.79545 (79.545%)
     Redline position: 918px * 0.79545 = 730.23px
     Tick positions: 9.18px * tick_number
     Tick 79 = 725.22px, Tick 80 = 734.4px
     Redline falls between ticks, so we align to nearest tick (80)
     Tick 80 position: 80 * 9.18 = 734.4px
     This corresponds to: 734.4/918 * 8800 = 7039 RPM
     Start red ticks exactly at tick 80's position for perfect alignment
  */
  left: 734.4px;
  width: calc(918px - 734.4px);
  background: repeating-linear-gradient(
    to right,
    transparent 0px,
    transparent calc(9.18px - 3px),
    #ff6b35 calc(9.18px - 3px),
    #ff6b35 9.18px,
    transparent 9.18px,
    transparent calc(9.18px * 2)
  );
}

.tachometer-movement {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: #fff;
  border-radius: 32px 0 0 32px;
  width: 0;
  transition: width 0.1s linear;
  z-index: 3;
}

.tachometer-movement.redline {
  background: #ff6b35;
}

/* Speed Display (Bottom Right of Tachometer) */
.speed-display {
  position: absolute;
  top: 440px;
  right: 265px;
  text-align: right;
}

.speed-number {
  font-size: 96px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
  font-family: Helvetica, sans-serif;
}

.speed-unit {
  font-size: 17px;
  color: #fff;
  margin-left: 6px;
  font-family: Helvetica, sans-serif;
}

/* Boost Meter (Bottom Left) */
.boost-meter {
  position: absolute;
  top: 457px;
  left: 285px;
  width: 218px;
  height: 26px;
}

.boost-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.boost-ticks {
  position: absolute;
  inset: 0;
  /* Solid black overlay starting from absolute left edge, 10px wide to cover first few ticks */
  /* background:
    linear-gradient(to right, #000 0px, #000 10px, transparent 10px) no-repeat,
    repeating-linear-gradient(
      to right,
      transparent 15px,
      transparent 18px,
      #666 18px,
      #666 19px
    ); */
  background-size: 10px 100%, 100% 100%;
  background-position: 0px 0, 0 0;
  background-origin: border-box;
}

.boost-ticks::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 16px;
  background: repeating-linear-gradient(
    to right,
    transparent 0px,
    transparent 3px,
    #ff6b35 3px,
    #ff6b35 4px
  );
}

.boost-movement {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: #5b5b5b;
  border-radius: 13px 0 0 13px;
  width: 0;
  transition: width 0.1s linear;
}

.boost-label {
  position: absolute;
  bottom: -15px;
  left: 0;
  font-size: 11px;
  color: #A6A6A6;
  font-family: Helvetica, sans-serif;
}


