:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #11131a;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #11131a;
}

.wrap {
  width: min(44rem, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.5rem;
}

button {
  width: 100%;
  min-height: min(24rem, 62vh);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
  padding: 2.5rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 2.5rem;
  background: #8b79ff;
  color: #0d0d14;
  box-shadow: 0 2rem 6rem rgba(0, 0, 0, 0.34);
  cursor: pointer;
  font: inherit;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 140ms ease, filter 140ms ease, opacity 140ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-0.2rem) scale(1.005);
  filter: brightness(1.06);
}

button:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

button:focus-visible {
  outline: 0.3rem solid rgba(255, 255, 255, 0.92);
  outline-offset: 0.35rem;
}

button:disabled {
  cursor: progress;
  opacity: 0.82;
}

#thing-state {
  font-size: clamp(2.5rem, 9vw, 6.5rem);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

small {
  max-width: 34rem;
  font-size: clamp(0.82rem, 2.4vw, 1.15rem);
  font-weight: 650;
  line-height: 1.35;
  opacity: 0.68;
}

button[data-state="requesting-device"],
button[data-state="connecting"],
button[data-state="reading-device"],
button[data-state="pairing"],
button[data-state="exchanging"] {
  background: #d2a63d;
}

button[data-state="success-pair"],
button[data-state="success-exchange"] {
  background: #69d391;
}

button[data-state="failure"] {
  background: #ff7c8c;
}

button[data-state="unsupported"] {
  background: #4a4d5c;
  color: rgba(255, 255, 255, 0.7);
  cursor: not-allowed;
}

.instructions {
  display: grid;
  gap: 1.25rem;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.82);
}

.step h2 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 800;
}

.step p {
  margin: 0.25rem 0;
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0.85;
}

.note {
  margin: 0;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  line-height: 1.4;
  opacity: 0.62;
}

@media (prefers-reduced-motion: reduce) {
  button {
    transition: none;
  }
}
