/*
Revision      : 1.7.0
Description   : Styling for dark themed odometer and speedometer emulator
                including analog flip animation, gauge rendering,
                tick marks, responsive layout, and dashboard visuals.
Author        : Jason Lamb (with help from ChatGPT)
Created Date  : 2026-05-15
Modified Date : 2026-05-17

Features:
- Dark dashboard styling
- Analog-inspired odometer display
- Flip animation effects
- Animated speedometer gauge
- Responsive mobile layout
- Gauge labels and tick marks

Change Log:
1.0.0 - Initial styling layout
1.1.0 - Added odometer digit styling
1.2.0 - Added decimal alignment support
1.3.0 - Added dark theme styling
1.4.0 - Added speedometer visuals
1.5.0 - Added animated needle
1.6.0 - Added colored gauge ranges
1.7.0 - Added analog flip animation and speed ticks
*/

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;

  font-family: Arial, sans-serif;

  background: #05070a;
  color: #f5f5f5;

  display: grid;
  place-items: center;
}

.page {
  width: min(95vw, 940px);

  text-align: center;

  padding: 30px;
}

h1 {
  color: #f0f0f0;

  margin-bottom: 25px;

  letter-spacing: 1px;
}

.odometer {
  display: flex;

  justify-content: center;

  gap: 5px;

  padding: 22px;

  margin-bottom: 25px;

  background:
    linear-gradient(
      180deg,
      #111,
      #020202
    );

  border: 5px solid #333;

  border-radius: 16px;

  box-shadow:
    inset 0 0 25px #000,
    0 0 35px rgba(0,0,0,0.95);
}

.digit,
.decimal {
  width: 54px;
  height: 82px;

  perspective: 400px;
}

.decimal {
  width: 24px;

  font-family: "Courier New", monospace;

  font-size: 54px;
  font-weight: bold;

  line-height: 82px;

  color: #f4f4f4;
}

.digit-inner {
  position: relative;

  width: 100%;
  height: 100%;

  overflow: hidden;

  font-family: "Courier New", monospace;

  font-size: 54px;
  font-weight: bold;

  line-height: 82px;

  text-align: center;

  color: #f4f4f4;

  background:
    linear-gradient(
      180deg,
      #2c2c2c 0%,
      #070707 50%,
      #1a1a1a 100%
    );

  border: 1px solid #555;

  border-radius: 8px;

  text-shadow:
    0 0 8px rgba(255,255,255,0.35);

  box-shadow:
    inset 0 8px 12px rgba(255,255,255,0.05),
    inset 0 -8px 12px rgba(0,0,0,0.8);
}

.digit-inner::before {
  content: "";

  position: absolute;

  left: 0;
  right: 0;

  top: 50%;

  height: 2px;

  background: rgba(0,0,0,0.75);

  z-index: 5;
}

.digit-inner.flip {
  animation:
    flipDigit 0.18s ease-in-out;
}

@keyframes flipDigit {

  0% {
    transform: rotateX(0deg);
    filter: brightness(1);
  }

  45% {
    transform: rotateX(-82deg);
    filter: brightness(0.55);
  }

  55% {
    transform: rotateX(82deg);
    filter: brightness(1.35);
  }

  100% {
    transform: rotateX(0deg);
    filter: brightness(1);
  }
}

.speedometer {
  display: grid;

  place-items: center;

  gap: 10px;

  margin-bottom: 25px;
}

.gauge {
  position: relative;

  width: 340px;
  height: 185px;

  border-radius: 340px 340px 0 0;

  background:
    radial-gradient(
      circle at 50% 100%,
      #050505 0 24%,
      transparent 25%
    ),

    conic-gradient(
      from 270deg,
      #00ff66 0deg,
      #ffee00 70deg,
      #ff9900 120deg,
      #ff3300 180deg,
      transparent 181deg
    );

  border: 4px solid #333;

  border-bottom: none;

  overflow: hidden;

  box-shadow:
    inset 0 0 20px #000,
    0 0 20px #000;
}

.ticks {
  position: absolute;
  inset: 0;
}

.tick {
  position: absolute;

  left: 50%;
  bottom: 0;

  width: 2px;
  height: 100%;

  transform-origin: bottom center;
}

.tick::before {
  content: "";

  position: absolute;

  top: 9px;
  left: 50%;

  width: 2px;
  height: 10px;

  background:
    rgba(255,255,255,0.75);

  transform: translateX(-50%);
}

.tick.major::before {
  width: 3px;
  height: 18px;

  background: #fff;
}

.tick-label {
  position: absolute;

  left: 50%;
  top: 30px;

  font-family: "Courier New", monospace;

  font-size: 12px;
  font-weight: bold;

  color: #f5f5f5;

  transform-origin: center;

  text-shadow: 0 0 5px #000;
}

.needle {
  position: absolute;

  left: 50%;
  bottom: 0;

  width: 5px;
  height: 132px;

  background: #f5f5f5;

  transform:
    translateX(-50%)
    rotate(-90deg);

  transform-origin: bottom center;

  border-radius: 999px;

  box-shadow:
    0 0 10px rgba(255,255,255,0.5);

  z-index: 10;
}

.gauge-center {
  position: absolute;

  left: 50%;
  bottom: -16px;

  width: 32px;
  height: 32px;

  background: #111;

  border: 4px solid #888;

  border-radius: 50%;

  transform: translateX(-50%);

  z-index: 12;
}

.mph-label {
  position: absolute;

  left: 50%;
  bottom: 42px;

  transform: translateX(-50%);

  font-size: 18px;
  font-weight: bold;

  color: #ddd;

  z-index: 11;
}

.speed-readout {
  font-family: "Courier New", monospace;

  font-size: 26px;
  font-weight: bold;
}

.inputs {
  display: grid;

  grid-template-columns: 1fr 1fr;

  gap: 14px;

  margin-bottom: 20px;
}

label {
  display: grid;

  gap: 6px;

  text-align: left;

  color: #ddd;

  font-weight: bold;
}

input {
  padding: 11px;

  border-radius: 8px;

  border: 1px solid #444;

  background: #111;

  color: #f5f5f5;

  font-size: 16px;
}

input:focus {
  outline: 2px solid #666;
}

.controls {
  display: flex;

  justify-content: center;

  flex-wrap: wrap;

  gap: 10px;
}

button {
  padding: 10px 18px;

  border-radius: 8px;

  border: 1px solid #555;

  background: #181818;

  color: #f5f5f5;

  font-weight: bold;

  cursor: pointer;
}

button:hover {
  background: #242424;
}

@media (max-width: 700px) {

  .digit {
    width: 34px;
    height: 58px;
  }

  .digit-inner,
  .decimal {
    height: 58px;

    font-size: 36px;

    line-height: 58px;
  }

  .decimal {
    width: 18px;
  }

  .inputs {
    grid-template-columns: 1fr;
  }

  .gauge {
    width: 280px;
    height: 150px;
  }

  .needle {
    height: 105px;
  }

  .tick-label {
    font-size: 10px;

    top: 26px;
  }
}