:root {
  --obd-green: #78e2ad;
  --obd-text: #f4f7f6;
  --obd-muted: rgba(244, 247, 246, 0.56);
  --obd-surface: rgba(18, 21, 22, 0.88);
  --obd-border: rgba(255, 255, 255, 0.13);
}

#obd-connect-shell {
  position: absolute;
  inset: 0;
  z-index: 6;
  color: var(--obd-text);
  font-family: "Exo 2", sans-serif;
  pointer-events: none;
}

.obd-connect-trigger {
  position: absolute;
  left: 50%;
  bottom: 30px;
  width: 274px;
  min-height: 64px;
  padding: 10px 13px;
  border: 1px solid var(--obd-border);
  border-radius: 18px;
  display: grid;
  grid-template-columns: 42px 1fr 28px;
  align-items: center;
  gap: 12px;
  color: var(--obd-text);
  background: rgba(15, 18, 19, 0.76);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translate3d(-50%, 16px, 0);
  transition: width 0.35s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

html.is-ready .obd-connect-trigger {
  animation: obd-button-in 0.65s 0.35s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.obd-connect-trigger:hover,
.obd-connect-trigger:focus-visible {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(23, 27, 28, 0.88);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.3);
  outline: none;
}

.obd-connect-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--obd-green);
  background: rgba(120, 226, 173, 0.12);
}

.obd-connect-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.obd-connect-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
}

.obd-connect-copy strong {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.obd-connect-copy small {
  color: var(--obd-muted);
  font-size: 9px;
  line-height: 1.2;
  letter-spacing: 0.05em;
}

.obd-connect-chevron {
  position: relative;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.055);
}

.obd-connect-chevron::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 8px;
  width: 6px;
  height: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.66);
  border-right: 1px solid rgba(255, 255, 255, 0.66);
  transform: rotate(45deg);
}

.obd-connect-shell.is-connected .obd-connect-trigger {
  width: 250px;
  border-color: rgba(120, 226, 173, 0.3);
}

.obd-connect-shell.is-connected .obd-connect-icon {
  color: #0c1b14;
  background: var(--obd-green);
}

.obd-connect-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.obd-connect-panel {
  position: absolute;
  top: 50%;
  right: 26px;
  width: min(360px, calc(100vw - 52px));
  min-height: 362px;
  padding: 23px;
  border: 1px solid var(--obd-border);
  border-radius: 24px;
  background: var(--obd-surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  opacity: 0;
  transform: translate3d(18px, -50%, 0);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.19, 1, 0.22, 1);
}

.obd-connect-shell.is-open .obd-connect-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.obd-connect-shell.is-open .obd-connect-panel {
  opacity: 1;
  transform: translate3d(0, -50%, 0);
  pointer-events: auto;
}

.obd-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.obd-panel-head h2,
.obd-connected-view h3 {
  margin: 0;
  padding: 0;
  color: var(--obd-text);
  font-family: "Exo 2", sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
  text-transform: none;
}

.obd-panel-head p {
  margin-top: 7px;
  color: var(--obd-muted);
  font-size: 10px;
  line-height: 1.55;
  text-align: left;
}

.obd-panel-close {
  position: relative;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.obd-panel-close::before,
.obd-panel-close::after {
  content: "";
  position: absolute;
  top: 15px;
  left: 10px;
  width: 12px;
  height: 1px;
  background: currentColor;
}

.obd-panel-close::before {
  transform: rotate(45deg);
}

.obd-panel-close::after {
  transform: rotate(-45deg);
}

.obd-panel-body {
  position: relative;
  min-height: 245px;
  margin-top: 22px;
}

.obd-scan-view,
.obd-connected-view {
  position: absolute;
  inset: 0;
  transition: opacity 0.3s ease, transform 0.4s ease;
}

.obd-search-state {
  height: 58px;
  padding: 0 16px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  gap: 13px;
  background: rgba(255, 255, 255, 0.055);
}

.obd-spinner {
  width: 19px;
  height: 19px;
  border: 2px solid rgba(255, 255, 255, 0.13);
  border-top-color: var(--obd-green);
  border-radius: 50%;
  animation: obd-spin 0.85s linear infinite;
}

.obd-search-state strong {
  display: block;
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 500;
}

.obd-search-state small {
  display: block;
  color: var(--obd-muted);
  font-size: 9px;
}

.obd-device-card {
  width: 100%;
  min-height: 74px;
  margin-top: 12px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 12px;
  color: var(--obd-text);
  background: rgba(255, 255, 255, 0.055);
  text-align: left;
  opacity: 0;
  transform: translateY(7px);
  pointer-events: none;
  cursor: pointer;
  transition: opacity 0.3s ease, transform 0.35s ease, border-color 0.2s ease, background 0.2s ease;
}

.obd-connect-panel.is-found .obd-device-card {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.obd-device-card:hover,
.obd-device-card:focus-visible {
  border-color: rgba(120, 226, 173, 0.36);
  background: rgba(120, 226, 173, 0.08);
  outline: none;
}

.obd-device-icon {
  position: relative;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.075);
}

.obd-device-icon::before {
  content: "";
  position: absolute;
  inset: 12px 10px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 5px;
}

.obd-device-icon::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 8px;
  height: 3px;
  border-left: 2px solid var(--obd-green);
  border-right: 2px solid var(--obd-green);
}

.obd-device-copy {
  min-width: 0;
}

.obd-device-copy strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 500;
}

.obd-device-copy small {
  display: block;
  color: var(--obd-muted);
  font-size: 9px;
}

.obd-device-action {
  padding: 7px 10px;
  border-radius: 9px;
  color: #0b1711;
  background: var(--obd-green);
  font-size: 9px;
  font-weight: 600;
}

.obd-helper {
  margin: 16px 4px 0;
  color: var(--obd-muted);
  font-size: 9px;
  line-height: 1.55;
  text-align: left;
}

.obd-connect-panel.is-connecting .obd-device-action {
  color: var(--obd-text);
  background: rgba(255, 255, 255, 0.09);
}

.obd-connect-panel.is-connecting .obd-device-card {
  pointer-events: none;
  border-color: rgba(120, 226, 173, 0.3);
}

.obd-connected-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  text-align: center;
}

.obd-connect-panel.is-connected .obd-scan-view {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

.obd-connect-panel.is-connected .obd-connected-view {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.obd-success-icon {
  position: relative;
  width: 58px;
  height: 58px;
  margin-bottom: 17px;
  border-radius: 18px;
  background: rgba(120, 226, 173, 0.13);
}

.obd-success-icon::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 19px;
  width: 19px;
  height: 10px;
  border-left: 2px solid var(--obd-green);
  border-bottom: 2px solid var(--obd-green);
  transform: rotate(-45deg);
}

.obd-connected-view p {
  width: 230px;
  margin: 8px auto 20px;
  color: var(--obd-muted);
  font-size: 10px;
  line-height: 1.55;
}

.obd-done-button {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 14px;
  color: #0b1711;
  background: var(--obd-green);
  font-family: "Exo 2", sans-serif;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

@keyframes obd-button-in {
  to {
    opacity: 1;
    transform: translate3d(-50%, 0, 0);
  }
}

@keyframes obd-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 812px) {
  .obd-connect-trigger {
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: calc(100% - 32px);
    max-width: 330px;
  }

  .obd-connect-shell.is-connected .obd-connect-trigger {
    width: calc(100% - 32px);
    max-width: 300px;
  }

  .obd-connect-panel {
    top: auto;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: calc(100% - 24px);
    min-height: 370px;
    transform: translate3d(0, 22px, 0);
  }

  .obd-connect-shell.is-open .obd-connect-panel {
    transform: translate3d(0, 0, 0);
  }

  .obd-connect-shell.is-open .obd-connect-trigger {
    opacity: 0;
    pointer-events: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #obd-connect-shell *,
  #obd-connect-shell *::before,
  #obd-connect-shell *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* During pairing, let the 3D In Style scene become the entire connection screen. */
.obd-connect-shell.is-connecting .obd-connect-trigger {
  opacity: 0 !important;
  pointer-events: none;
  animation: none;
  transform: translate3d(-50%, 14px, 0);
}

.obd-connect-shell.is-connecting .obd-connect-panel,
.obd-connect-shell.is-connecting .obd-connect-backdrop {
  opacity: 0;
  pointer-events: none;
}

.obd-pairing-status,
.obd-connected-notice {
  position: absolute;
  left: 50%;
  border: 1px solid var(--obd-border);
  border-radius: 18px;
  display: flex;
  align-items: center;
  color: var(--obd-text);
  background: rgba(15, 18, 19, 0.78);
  box-shadow: 0 16px 45px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
}

.obd-pairing-status {
  bottom: 30px;
  width: 286px;
  min-height: 64px;
  padding: 11px 15px;
  gap: 13px;
  overflow: hidden;
  transform: translate3d(-50%, 12px, 0);
  transition: opacity 0.3s ease, transform 0.35s ease;
}

.obd-pairing-status .obd-spinner {
  flex: 0 0 20px;
}

.obd-pairing-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

.obd-pairing-copy strong,
.obd-connected-copy strong {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
}

.obd-pairing-copy small,
.obd-connected-copy small {
  color: var(--obd-muted);
  font-size: 9px;
  line-height: 1.3;
}

.obd-pairing-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
}

.obd-pairing-progress::after {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--obd-green);
  transform: scaleX(0);
  transform-origin: left center;
}

.obd-connect-shell.is-connecting .obd-pairing-status {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

.obd-connect-shell.is-connecting .obd-pairing-progress::after {
  animation: obd-connect-progress 5s linear forwards;
}

.obd-connected-notice {
  top: 28px;
  min-width: 250px;
  min-height: 58px;
  padding: 10px 15px 10px 11px;
  gap: 11px;
  transform: translate3d(-50%, -12px, 0);
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.19, 1, 0.22, 1);
}

.obd-connect-shell.show-connected-notice .obd-connected-notice {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
}

.obd-connected-check {
  position: relative;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: rgba(120, 226, 173, 0.14);
}

.obd-connected-check::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 12px;
  width: 14px;
  height: 8px;
  border-left: 2px solid var(--obd-green);
  border-bottom: 2px solid var(--obd-green);
  transform: rotate(-45deg);
}

.obd-connected-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
}

@keyframes obd-connect-progress {
  to {
    transform: scaleX(1);
  }
}

@media (max-width: 812px) {
  .obd-pairing-status {
    bottom: calc(16px + env(safe-area-inset-bottom));
    width: calc(100% - 32px);
    max-width: 330px;
  }

  .obd-connected-notice {
    top: 18px;
    width: calc(100% - 32px);
    max-width: 300px;
  }
}

/* First-use state: make connection the clear primary action over the car. */
.obd-connect-shell:not(.is-connected) .obd-connect-trigger {
  top: 50%;
  bottom: auto;
  width: 318px;
  min-height: 76px;
  padding: 12px 15px;
  grid-template-columns: 48px 1fr 28px;
  gap: 13px;
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(15, 18, 19, 0.84);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.34);
  transform: translate3d(-50%, calc(-50% + 16px), 0);
}

html.is-ready .obd-connect-shell:not(.is-connected) .obd-connect-trigger {
  animation: obd-center-button-in 0.7s 0.35s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

.obd-connect-shell:not(.is-connected) .obd-connect-icon {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 15px;
}

.obd-connect-shell:not(.is-connected) .obd-connect-icon::after {
  content: "";
  position: absolute;
  inset: -1px;
  border: 1px solid rgba(120, 226, 173, 0.42);
  border-radius: inherit;
  animation: obd-connect-invite 1.8s ease-out infinite;
}

.obd-connect-shell:not(.is-connected) .obd-connect-copy strong {
  font-size: 14px;
}

.obd-connect-shell:not(.is-connected) .obd-connect-copy small {
  font-size: 9px;
  line-height: 1.35;
}

.obd-connect-required {
  position: absolute;
  left: 50%;
  top: -32px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(15, 18, 19, 0.66);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.18);
  font-size: 9px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.obd-connect-required::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 7px 1px 0;
  border-radius: 50%;
  background: var(--obd-green);
  box-shadow: 0 0 8px rgba(120, 226, 173, 0.8);
}

.obd-connect-shell.is-connected .obd-connect-required {
  display: none;
}

.obd-connect-shell.is-open .obd-connect-trigger {
  opacity: 0 !important;
  pointer-events: none;
  animation: none !important;
}

@keyframes obd-center-button-in {
  to {
    opacity: 1;
    transform: translate3d(-50%, -50%, 0);
  }
}

@keyframes obd-connect-invite {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.22);
  }
}

@media (max-width: 812px) {
  .obd-connect-shell:not(.is-connected) .obd-connect-trigger {
    top: 52%;
    bottom: auto;
    width: calc(100% - 42px);
    max-width: 330px;
    min-height: 74px;
  }
}
