:root {
  color-scheme: dark;
  --background: #050711;
  --surface: rgba(15, 18, 36, 0.7);
  --surface-border: rgba(255, 255, 255, 0.1);
  --text: #f7f8ff;
  --muted: #a8aec2;
  --accent: #7668ff;
  --accent-blue: #4ea1ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 27%, rgba(96, 74, 255, 0.17), transparent 34rem),
    radial-gradient(circle at 15% 8%, rgba(32, 113, 255, 0.1), transparent 26rem),
    var(--background);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 75%);
  content: "";
  pointer-events: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  display: flex;
  flex-direction: column;
  width: min(100%, 800px);
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: 20px 14px 18px;
}

.site-header {
  display: flex;
  justify-content: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}

.brand__logo {
  display: block;
  width: 126px;
  max-width: 42vw;
  height: auto;
}

main {
  display: flex;
  flex-direction: column;
  flex: 1;
}

[hidden] { display: none !important; }

.state-panel { display: block; }

.hero {
  padding-top: clamp(36px, 9vh, 82px);
}

.hero__copy {
  max-width: 650px;
  margin: 0 auto 28px;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(2.35rem, 13vw, 4.8rem);
  line-height: .97;
  letter-spacing: -.055em;
}

h1 span {
  color: transparent;
  background: linear-gradient(100deg, #9f8cff 10%, #5f87ff 55%, #57b3ff);
  background-clip: text;
  -webkit-background-clip: text;
}

.hero__description {
  max-width: 520px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: .96rem;
  line-height: 1.65;
}

.connection-card {
  position: relative;
  padding: 22px 16px 20px;
  overflow: hidden;
  border: 1px solid rgba(155, 149, 255, .16);
  border-radius: 25px;
  background: linear-gradient(145deg, rgba(22, 26, 49, .82), rgba(9, 12, 26, .66));
  box-shadow:
    0 30px 90px rgba(0, 0, 0, .4),
    0 0 52px rgba(91, 76, 255, .09),
    inset 0 1px rgba(255,255,255,.055);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.connection-card::before {
  position: absolute;
  top: -100px;
  left: 50%;
  width: 320px;
  height: 170px;
  border-radius: 50%;
  background: rgba(104, 82, 255, .14);
  filter: blur(42px);
  content: "";
  transform: translateX(-50%);
}

.connection-card__intro {
  position: relative;
  display: flex;
  gap: 13px;
  align-items: center;
  margin-bottom: 20px;
}

.security-icon,
.benefit__icon {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(137, 121, 255, .25);
  background: rgba(118, 104, 255, .1);
  color: #9e91ff;
}

.security-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

svg {
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.security-icon svg,
.benefit__icon svg {
  width: 21px;
  height: 21px;
}

h2,
h3,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 5px;
  font-size: 1.05rem;
  letter-spacing: -.02em;
}

.connection-card__intro p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.5;
}

.wallet-button {
  position: relative;
  display: flex;
  width: 100%;
  height: 68px;
  min-height: 68px;
  gap: 12px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 18px;
  color: #0b0e1a;
  background: #fff;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.68),
    0 12px 42px rgba(102, 83, 255, .43),
    0 0 30px rgba(63, 139, 255, .12);
  font: inherit;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -.015em;
  cursor: pointer;
  overflow: hidden;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.wallet-button__logo {
  display: block;
  width: auto;
  max-width: min(82%, 260px);
  max-height: 62px;
  height: auto;
  mix-blend-mode: multiply;
}

.wallet-button:active {
  transform: translateY(1px) scale(.992);
  box-shadow: 0 0 0 1px rgba(255,255,255,.6), 0 5px 20px rgba(102, 83, 255, .28);
}

.wallet-button:focus-visible,
.brand:focus-visible {
  outline: 3px solid #66adff;
  outline-offset: 4px;
}

.privacy-note {
  display: flex;
  max-width: 520px;
  gap: 10px;
  align-items: flex-start;
  margin: 17px auto 0;
  color: #8f96ac;
}

.privacy-note svg {
  flex: 0 0 17px;
  width: 17px;
  height: 17px;
  margin-top: 2px;
}

.privacy-note p {
  margin-bottom: 0;
  font-size: .73rem;
  line-height: 1.55;
}

.benefits {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.benefit {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 17px 16px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px;
  background: rgba(12, 15, 29, .44);
}

.benefit__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
}

.benefit h3 {
  margin: 0 0 3px;
  font-size: .94rem;
}

.benefit p {
  margin: 0;
  color: #9299ad;
  font-size: .76rem;
  line-height: 1.4;
}

.payment-state {
  display: grid;
  flex: 1;
  place-items: center;
  padding: 36px 0 24px;
}

.payment-state__card {
  width: min(100%, 680px);
  padding: 34px 20px 32px;
  border: 1px solid rgba(155, 149, 255, .16);
  border-radius: 25px;
  background: linear-gradient(145deg, rgba(22, 26, 49, .82), rgba(9, 12, 26, .66));
  box-shadow: 0 30px 90px rgba(0,0,0,.4), 0 0 52px rgba(91,76,255,.09), inset 0 1px rgba(255,255,255,.055);
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.timer-visual {
  position: relative;
  display: grid;
  width: 158px;
  height: 158px;
  place-items: center;
  margin: 0 auto 25px;
}

.timer-progress {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.timer-progress circle { fill: none; stroke-width: 5; }
.timer-progress__track { stroke: rgba(255,255,255,.08); }
.timer-progress__value {
  stroke: #796dff;
  stroke-dasharray: 490.09;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .35s linear;
  filter: drop-shadow(0 0 7px rgba(99,103,255,.65));
}

.timer-visual::after {
  position: absolute;
  inset: -2px;
  border: 1px solid transparent;
  border-top-color: rgba(91,166,255,.75);
  border-radius: 50%;
  content: "";
  animation: waiting-spin 2.8s linear infinite;
}

.timer-visual__glow {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: rgba(107,82,255,.17);
  filter: blur(24px);
  animation: waiting-pulse 2.2s ease-in-out infinite;
}

.countdown {
  position: relative;
  font-size: 2.35rem;
  font-weight: 750;
  letter-spacing: -.045em;
  font-variant-numeric: tabular-nums;
}

.payment-state__title {
  max-width: 570px;
  margin: 0 auto;
  font-size: clamp(1.7rem, 8vw, 2.8rem);
  line-height: 1.08;
  letter-spacing: -.045em;
}

.payment-state__description {
  max-width: 500px;
  margin: 15px auto 0;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.6;
}

.waiting-status {
  display: flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  margin: 22px 0 0;
  color: #a8aec2;
  font-size: .79rem;
}

.waiting-status__dot {
  width: 7px;
  height: 7px;
  margin-right: 9px;
  border-radius: 50%;
  background: #7f74ff;
  box-shadow: 0 0 12px rgba(111,101,255,.8);
  animation: status-pulse 1.4s ease-in-out infinite;
}

.animated-dots::after {
  display: inline-block;
  width: 1.4em;
  overflow: hidden;
  vertical-align: bottom;
  content: "...";
  animation: waiting-dots 1.5s steps(4, end) infinite;
}

.payment-state__card--message { padding-block: 48px; }

.result-icon {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin: 0 auto 24px;
  border: 1px solid rgba(137,121,255,.25);
  border-radius: 20px;
  background: rgba(118,104,255,.1);
  color: #9e91ff;
  box-shadow: 0 0 34px rgba(99,82,255,.16);
}

.result-icon svg { width: 31px; height: 31px; }
.result-icon--success { color: #76d8b0; border-color: rgba(91,215,166,.22); background: rgba(61,190,140,.09); }

.retry-button {
  min-width: 160px;
  min-height: 52px;
  margin-top: 25px;
  padding: 12px 26px;
  border: 1px solid rgba(255,255,255,.68);
  border-radius: 16px;
  color: #0b0e1a;
  background: #fff;
  box-shadow: 0 10px 32px rgba(102,83,255,.3);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.retry-button:active { transform: translateY(1px) scale(.992); }
.retry-button:focus-visible { outline: 3px solid #66adff; outline-offset: 4px; }

@keyframes waiting-spin { to { transform: rotate(360deg); } }
@keyframes waiting-pulse { 0%,100% { opacity: .55; transform: scale(.9); } 50% { opacity: 1; transform: scale(1.14); } }
@keyframes status-pulse { 0%,100% { opacity: .45; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.18); } }
@keyframes waiting-dots { 0% { width: 0; } 100% { width: 1.4em; } }

footer {
  padding: 34px 0 6px;
  color: #656b7d;
  font-size: .69rem;
  text-align: center;
}

@media (hover: hover) and (pointer: fine) {
  .wallet-button:hover {
    background: #f7f8ff;
    box-shadow: 0 0 0 1px rgba(255,255,255,.65), 0 14px 48px rgba(102, 83, 255, .48);
    transform: translateY(-2px);
  }

  .retry-button:hover {
    background: #f7f8ff;
    box-shadow: 0 14px 42px rgba(102,83,255,.42);
    transform: translateY(-2px);
  }
}

@media (min-width: 480px) {
  .page-shell { padding-inline: 24px; }
  .connection-card { padding: 28px; }
  .connection-card__intro { justify-content: center; text-align: left; }
  .privacy-note { justify-content: center; }
}

@media (min-width: 768px) {
  .page-shell { width: min(100%, 820px); padding: 18px 28px 14px; }
  .brand { min-height: 38px; }
  .brand__logo { width: 150px; }
  .hero { padding-top: clamp(20px, 3.5vh, 32px); }
  .hero__copy { max-width: 650px; margin-bottom: 24px; }
  h1 { font-size: 4.8rem; }
  .hero__description { max-width: 540px; margin-top: 18px; font-size: 1.05rem; line-height: 1.55; }
  .connection-card { padding: 28px 32px 25px; border-radius: 28px; }
  .connection-card__intro { gap: 13px; margin-bottom: 20px; }
  .security-icon { width: 42px; height: 42px; border-radius: 13px; }
  .security-icon svg { width: 21px; height: 21px; }
  h2 { font-size: 1.15rem; }
  .connection-card__intro p { font-size: .86rem; }
  .wallet-button { height: 74px; min-height: 74px; border-radius: 20px; }
  .wallet-button__logo { max-width: min(82%, 270px); max-height: 68px; }
  .privacy-note { max-width: 540px; margin-top: 17px; }
  .privacy-note svg { flex-basis: 17px; width: 17px; height: 17px; }
  .privacy-note p { font-size: .76rem; }
  .benefits { grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
  .benefit { min-width: 0; gap: 12px; align-items: flex-start; padding: 16px 14px; border-radius: 18px; }
  .benefit__icon { width: 36px; height: 36px; border-radius: 12px; }
  .benefit__icon svg { width: 20px; height: 20px; }
  .benefit h3 { margin-bottom: 3px; font-size: .9rem; }
  .benefit p { font-size: .7rem; }
  footer { padding: 18px 0 2px; }
  .payment-state { padding-block: 22px 16px; }
  .payment-state__card { padding: 34px 38px 32px; border-radius: 28px; }
  .timer-visual { width: 166px; height: 166px; margin-bottom: 24px; }
  .payment-state__title { font-size: 2.65rem; }
  .payment-state__description { font-size: 1rem; }
  .payment-state__card--message { padding-block: 52px; }
}

@media (min-width: 1200px) {
  .page-shell { width: min(100%, 860px); }
  h1 { font-size: 5rem; }
}

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