:root {
  --bg: #05070a;
  --panel: #0d131b;
  --panel-2: #111a24;
  --text: #f7fafc;
  --muted: #9aa7b5;
  --green: #36d399;
  --red: #ff5a5f;
  --yellow: #f7c948;
  --line: rgba(154, 167, 181, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 38%, rgba(54, 211, 153, 0.12), transparent 18rem),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(180deg, #05070a 0%, #091018 100%);
  background-size: auto, 28px 28px, 28px 28px, auto;
  color: var(--text);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

button,
input {
  font: inherit;
}

.ride-screen {
  display: grid;
  grid-template-rows: auto auto minmax(180px, 1fr) auto auto auto;
  gap: 10px;
  width: min(680px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px 18px max(18px, env(safe-area-inset-bottom));
}

.top-row,
.stats-row,
.sensor-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: start;
}

.panel-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(17, 26, 36, 0.72), rgba(9, 16, 24, 0.64));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.top-row,
.stats-row {
  padding: 12px 14px;
}

.label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.clock {
  display: block;
  font-size: clamp(44px, 12vw, 66px);
  line-height: 0.9;
  letter-spacing: -0.06em;
}

.cadence-block,
.right {
  text-align: right;
}

.cadence {
  font-size: clamp(36px, 8vw, 50px);
  line-height: 1;
}

.green-unit {
  color: var(--green);
  font-size: 18px;
  font-weight: 800;
}

.mid-value {
  display: block;
  font-size: clamp(32px, 8vw, 46px);
  line-height: 1;
  letter-spacing: -0.05em;
}

.speed-panel {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 180px;
  padding: 6px 0;
}

.speed-wrap {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
  border: 1px solid rgba(54, 211, 153, 0.18);
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 50%, rgba(54, 211, 153, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(54, 211, 153, 0.09), rgba(255, 255, 255, 0.015));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.025),
    0 22px 70px rgba(0, 0, 0, 0.28);
  padding: 24px 16px 22px;
}

.speed-badges {
  position: absolute;
  top: 14px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.app-version {
  position: absolute;
  top: 14px;
  right: 16px;
}

.speed-status,
.app-version {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgba(232, 255, 246, 0.12);
  border-radius: 999px;
  background: rgba(2, 8, 8, 0.36);
  color: rgba(232, 255, 246, 0.62);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.speed-status {
  gap: 6px;
  padding: 0 9px;
}

.app-version {
  padding: 0 8px;
}

.speed-status[hidden] {
  display: none;
}

.sensor-mark {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid var(--green);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(54, 211, 153, 0.28);
}

.sensor-mark::before,
.sensor-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(232, 255, 246, 0.62);
  border-radius: 50%;
}

.sensor-mark::after {
  inset: auto;
  left: 50%;
  top: 50%;
  width: 2px;
  height: 14px;
  border: 0;
  border-radius: 1px;
  background: rgba(232, 255, 246, 0.55);
  transform: translate(-50%, -50%) rotate(45deg);
  transform-origin: center;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.gps-status.is-on {
  color: rgba(232, 255, 246, 0.78);
}

.gps-status.is-on .status-dot {
  background: var(--green);
  box-shadow: 0 0 14px rgba(54, 211, 153, 0.72);
}

.gps-status.is-off {
  color: rgba(255, 204, 204, 0.72);
}

.gps-status.is-off .status-dot {
  background: #ff5b5b;
  box-shadow: 0 0 14px rgba(255, 91, 91, 0.55);
}

.speed {
  display: block;
  text-align: center;
  font-size: clamp(98px, 29vw, 164px);
  line-height: 0.82;
  letter-spacing: -0.08em;
  text-shadow: 0 0 38px rgba(54, 211, 153, 0.16);
}

.speed-unit {
  color: var(--green);
  font-size: clamp(18px, 4vw, 24px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source {
  display: block;
  min-width: 240px;
  margin-top: 12px;
  padding: 9px 14px;
  border: 1px solid rgba(54, 211, 153, 0.28);
  border-radius: 999px;
  background: rgba(54, 211, 153, 0.06);
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
}

.bottom {
  padding-bottom: 4px;
}

.avg-value {
  font-size: clamp(34px, 9vw, 54px);
  line-height: 1;
  letter-spacing: -0.06em;
}

.avg-unit {
  font-size: 22px;
}

.sensor-row {
  align-items: center;
  grid-template-columns: 1fr 1fr auto;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sensor-row label {
  white-space: nowrap;
}

.sensor-row input {
  width: 74px;
  margin: 0 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 6px;
  background: #0b1119;
  color: var(--text);
  text-align: center;
}

.install-button,
.ride-button {
  height: 68px;
  border: 0;
  border-radius: 18px;
  cursor: pointer;
  font-weight: 900;
}

.install-button {
  height: 52px;
  border: 1px solid rgba(54, 211, 153, 0.35);
  background: rgba(54, 211, 153, 0.1);
  color: var(--green);
  font-size: 18px;
}

.install-button[hidden] {
  display: none;
}

.ride-button {
  background: linear-gradient(180deg, #55efb3, var(--green));
  color: var(--bg);
  font-size: 32px;
  box-shadow: 0 18px 42px rgba(54, 211, 153, 0.24);
}

.ride-button.stop {
  background: linear-gradient(180deg, #ff777b, var(--red));
  box-shadow: 0 18px 42px rgba(255, 90, 95, 0.24);
}

.install-button:active,
.ride-button:active {
  transform: translateY(1px);
}

.ride-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.permission-dialog {
  width: min(420px, calc(100vw - 30px));
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: transparent;
  color: var(--text);
}

.permission-dialog::backdrop {
  background: rgba(2, 4, 8, 0.72);
  backdrop-filter: blur(6px);
}

.dialog-card {
  padding: 24px;
  border: 1px solid rgba(54, 211, 153, 0.25);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(54, 211, 153, 0.2), transparent 12rem),
    linear-gradient(180deg, #111a24, #070b10);
  box-shadow: 0 26px 90px rgba(0, 0, 0, 0.46);
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  border: 1px solid rgba(54, 211, 153, 0.34);
  border-radius: 24px;
  background: rgba(54, 211, 153, 0.12);
  color: var(--green);
  font-size: 21px;
  font-weight: 950;
  letter-spacing: 0.04em;
}

.dialog-eyebrow {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dialog-card h1 {
  margin: 0 0 12px;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.dialog-card p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.dialog-actions button {
  min-height: 52px;
  border: 0;
  border-radius: 16px;
  background: var(--green);
  color: var(--bg);
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
}

.dialog-actions .ghost {
  border: 1px solid rgba(154, 167, 181, 0.22);
  background: rgba(154, 167, 181, 0.08);
  color: var(--text);
}

@media (max-width: 480px) {
  .ride-screen {
    gap: 9px;
    padding: 14px 14px max(14px, env(safe-area-inset-bottom));
  }

  .label {
    font-size: 13px;
  }

  .top-row,
  .stats-row {
    gap: 12px;
  }

  .sensor-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .speed-panel {
    min-height: 176px;
  }

  .speed-wrap {
    gap: 8px;
    padding: 20px 12px 18px;
  }
}
