:root {
  --bg: #090a10;
  --surface: #151823;
  --text: #f8f8fb;
  --muted: #a6a9b7;
  --accent: #b77cff;
  --accent-2: #ff4fb3;
  --accent-3: #74e6c3;
  --line: rgb(255 255 255 / 10%);
  --gradient: linear-gradient(120deg, #ff4fb3 0%, #a875ff 52%, #55d9d1 100%);
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 80% 10%, rgb(183 124 255 / 16%), transparent 30rem),
    radial-gradient(circle at 8% 85%, rgb(255 79 179 / 12%), transparent 28rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 12px;
  left: 12px;
  padding: 0.7rem 1rem;
  color: var(--bg);
  background: var(--text);
  border-radius: 8px;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.site-header {
  position: fixed;
  z-index: 2;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 30px clamp(24px, 5vw, 78px);
}

.brand {
  color: var(--text);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.045em;
  text-decoration: none;
}

.brand span,
h1 span {
  color: transparent;
  background: var(--gradient);
  background-clip: text;
}

.phase-badge {
  padding: 7px 12px;
  color: var(--muted);
  background: rgb(21 24 35 / 72%);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.75rem;
  backdrop-filter: blur(14px);
}

.hero {
  position: relative;
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 120px clamp(24px, 5vw, 78px) 64px;
}

.hero__glow {
  position: absolute;
  width: min(56vw, 760px);
  aspect-ratio: 1;
  border: 1px solid rgb(183 124 255 / 18%);
  border-radius: 50%;
  box-shadow:
    0 0 100px rgb(183 124 255 / 10%),
    inset 0 0 100px rgb(255 79 179 / 8%);
  transform: translate(42vw, -28vh);
}

.hero__content {
  z-index: 1;
  width: min(100%, 980px);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 22px;
  color: var(--accent-3);
  font-size: 0.77rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow span,
.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-3);
  border-radius: 50%;
  box-shadow: 0 0 16px var(--accent-3);
}

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(3rem, 7.6vw, 7rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.lead {
  max-width: 740px;
  margin: 30px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.32rem);
  line-height: 1.65;
}

.offline-actions {
  margin: 32px 0 0;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 48px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.status-grid article {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  min-height: 110px;
  padding: 24px;
  background: rgb(21 24 35 / 82%);
}

.status-grid .status-dot {
  flex: 0 0 auto;
  margin-top: 7px;
}

.status-grid strong,
.status-grid small {
  display: block;
}

.status-grid small {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.next-step {
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.realtime-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.realtime-status .status-dot {
  width: 7px;
  height: 7px;
}

.realtime-status[data-transport="http"] .status-dot {
  background: #f0bd61;
  box-shadow: 0 0 16px #f0bd61;
}

.realtime-status[data-transport="offline"] .status-dot {
  background: #ff6b7a;
  box-shadow: 0 0 16px #ff6b7a;
}

.messages {
  position: fixed;
  z-index: 4;
  top: 82px;
  right: clamp(24px, 5vw, 78px);
  max-width: min(420px, calc(100vw - 48px));
}

.message {
  margin: 0;
  padding: 12px 16px;
  color: var(--text);
  background: rgb(21 24 35 / 94%);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgb(0 0 0 / 28%);
}

.message--success {
  border-color: rgb(116 230 195 / 42%);
}

.auth-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-top: 48px;
  padding: 24px;
  background: rgb(21 24 35 / 82%);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.auth-card strong,
.auth-card small {
  display: block;
}

.auth-card small,
.configuration-note {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.5;
}

.configuration-note {
  max-width: 330px;
  padding: 10px 14px;
  background: rgb(255 255 255 / 4%);
  border-radius: 10px;
  font-size: 0.86rem;
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 36px;
}

.auth-actions form {
  margin: 0;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.button--primary {
  color: #110b18;
  background: var(--gradient);
}

.button--secondary {
  color: var(--text);
  background: rgb(255 255 255 / 5%);
  border-color: var(--line);
}

.button:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 3px;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  padding: 130px clamp(24px, 5vw, 78px) 70px;
  place-items: center;
}

.auth-page__panel {
  width: min(100%, 850px);
  padding: clamp(26px, 5vw, 58px);
  background: rgb(21 24 35 / 82%);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 28px 90px rgb(0 0 0 / 32%);
}

.auth-page__panel h1 {
  font-size: clamp(2.8rem, 7vw, 6rem);
}

.auth-page__panel--error {
  border-color: rgb(255 79 179 / 24%);
}

.eyebrow--error {
  color: var(--accent-2);
}

.eyebrow--error span {
  background: var(--accent-2);
  box-shadow: 0 0 16px var(--accent-2);
}

.error-page {
  display: grid;
  min-height: 100vh;
  max-width: 760px;
  margin: auto;
  padding: 140px 28px 80px;
  align-content: center;
}

.error-code {
  margin: 0;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.1em;
}

.error-page h1 {
  margin-top: 14px;
  font-size: clamp(2.6rem, 6vw, 5rem);
}

.error-page > p:not(.error-code) {
  color: var(--muted);
  font-size: 1.1rem;
}

.error-page a {
  width: fit-content;
  margin-top: 18px;
  padding: 12px 18px;
  color: #110b18;
  background: var(--accent);
  border-radius: 10px;
  font-weight: 750;
  text-decoration: none;
}

.pairing-screen {
  background:
    linear-gradient(rgb(2 4 20 / 18%), rgb(2 4 20 / 18%)),
    url("../images/pairing-waves.a96938805589.png") center / cover fixed,
    #030616;
}

.pairing-screen .site-header {
  padding-top: 30px;
  padding-right: clamp(28px, 3vw, 46px);
  padding-left: clamp(28px, 3vw, 46px);
}

.pairing-screen .brand {
  font-size: clamp(1.55rem, 2.2vw, 2rem);
}

.pairing {
  position: relative;
  display: flex;
  min-height: 100vh;
  align-items: center;
  flex-direction: column;
  padding: clamp(96px, 10vh, 122px) 24px 42px;
  text-align: center;
}

.pairing__intro h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(3rem, 5.4vw, 5rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.pairing__intro p {
  margin: 16px 0 0;
  color: #c5c2d5;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.pairing__qr-shell {
  width: clamp(320px, 29vw, 430px);
  margin-top: clamp(28px, 3.4vh, 42px);
  padding: 10px;
  background: #fff;
  border: 1px solid rgb(217 124 255 / 90%);
  border-radius: clamp(20px, 2vw, 28px);
  box-shadow:
    0 0 0 1px rgb(190 89 255 / 20%),
    0 0 42px rgb(190 62 255 / 55%),
    0 22px 70px rgb(0 0 0 / 40%);
  transition: opacity 180ms ease, filter 180ms ease;
}

.pairing__qr {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
}

.pairing__qr-shell--inactive {
  opacity: 0.3;
  filter: grayscale(1);
}

.pairing__timer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 19px 0 0;
  color: #c4c0d0;
  font-size: clamp(1rem, 1.35vw, 1.2rem);
}

.pairing__timer img {
  width: 22px;
  height: 22px;
}

.pairing__timer strong {
  margin-left: 0;
  color: #ff53c0;
  font-variant-numeric: tabular-nums;
}

.pairing__status {
  min-height: 1.5em;
  margin: 8px 0 0;
  color: #f4d7ff;
  font-size: 0.94rem;
}

.pairing__status:empty {
  display: none;
}

.pairing__steps {
  display: grid;
  width: min(100%, 810px);
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(28px, 6vw, 88px);
  margin: clamp(12px, 2vh, 24px) 0 0;
  padding: 0;
  list-style: none;
}

.pairing__steps li {
  min-width: 0;
}

.pairing__step-icon {
  display: grid;
  width: clamp(64px, 5.8vw, 86px);
  height: clamp(64px, 5.8vw, 86px);
  margin: 0 auto 11px;
  background: rgb(66 42 139 / 44%);
  border: 1px solid rgb(150 100 255 / 40%);
  border-radius: 50%;
  place-items: center;
  box-shadow: inset 0 0 28px rgb(142 80 255 / 14%);
}

.pairing__step-icon img {
  width: 39%;
  height: 39%;
}

.pairing__steps strong {
  font-size: clamp(1rem, 1.4vw, 1.25rem);
  font-weight: 650;
}

.pairing__steps strong span {
  color: #ff53c0;
}

.pairing__steps p {
  margin: 9px 0 0;
  color: #aaa5c1;
  font-size: clamp(0.82rem, 1.08vw, 0.98rem);
  line-height: 1.34;
}

.pairing__alternative {
  display: flex;
  max-width: min(100%, 780px);
  align-items: center;
  flex-direction: column;
  margin-top: clamp(26px, 3vh, 38px);
}

.pairing__alternative button,
.pairing__alternative > a:not(.pairing__retry) {
  padding: 0;
  color: #c76cff;
  background: none;
  border: 0;
  border-bottom: 1px solid currentcolor;
  font: inherit;
  font-size: 0.96rem;
  text-decoration: none;
  cursor: pointer;
}

.pairing__alternative > a:not(.pairing__retry) {
  max-width: min(780px, calc(100vw - 48px));
  margin-top: 12px;
  overflow-wrap: anywhere;
}

.pairing__alternative button:focus-visible,
.pairing__alternative a:focus-visible {
  outline: 3px solid var(--accent-3);
  outline-offset: 5px;
}

.pairing__retry {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 11px 17px;
  color: #120a18;
  background: var(--gradient);
  border-radius: 10px;
  font-weight: 760;
  text-decoration: none;
}

.pairing__secure {
  position: absolute;
  right: clamp(24px, 4vw, 60px);
  bottom: clamp(22px, 3vw, 42px);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: #c1bdce;
  font-size: 0.86rem;
}

.pairing__secure-icon {
  display: grid;
  width: 36px;
  height: 36px;
  border: 1px solid rgb(174 126 255 / 28%);
  border-radius: 50%;
  place-items: center;
}

.pairing__secure-icon img {
  width: 18px;
  height: 18px;
}

.pairing__secure-dot {
  width: 8px;
  height: 8px;
  background: #24e786;
  border-radius: 50%;
  box-shadow: 0 0 12px rgb(36 231 134 / 70%);
}

.pairing-mobile-panel {
  max-width: 760px;
}

[hidden] {
  display: none !important;
}

@media (max-height: 900px) and (min-width: 721px) {
  .pairing {
    padding-top: 90px;
  }

  .pairing__intro h1 {
    font-size: clamp(2.8rem, 4.8vw, 4.1rem);
  }

  .pairing__intro p {
    margin-top: 10px;
  }

  .pairing__qr-shell {
    width: clamp(294px, 37vh, 344px);
    margin-top: 20px;
    padding: 20px;
  }

  .pairing__timer {
    margin-top: 12px;
  }

  .pairing__step-icon {
    width: 64px;
    height: 64px;
  }

  .pairing__steps p {
    margin-top: 5px;
  }

  .pairing__alternative {
    margin-top: 18px;
  }
}

@media (max-width: 720px) {
  .status-grid {
    grid-template-columns: 1fr;
  }

  .status-grid article {
    min-height: auto;
  }

  .phase-badge {
    display: none;
  }

  .auth-card {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-actions .button,
  .auth-actions form,
  .auth-actions form .button {
    width: 100%;
  }

  .pairing-screen {
    background-attachment: scroll;
  }

  .pairing {
    padding: 105px 20px 92px;
  }

  .pairing__intro h1 {
    font-size: clamp(2.55rem, 12vw, 4rem);
  }

  .pairing__intro p {
    font-size: 1.04rem;
  }

  .pairing__qr-shell {
    width: min(100%, 330px);
    margin-top: 28px;
    padding: 20px;
  }

  .pairing__steps {
    width: min(100%, 420px);
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .pairing__steps li {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 14px;
    text-align: left;
  }

  .pairing__step-icon {
    width: 58px;
    height: 58px;
    margin: 0;
    grid-row: span 2;
  }

  .pairing__steps p {
    margin-top: 5px;
  }

  .pairing__secure {
    right: auto;
    bottom: 26px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
