* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #1f2937;
  background: #868b8c;
}

.connect-page {
  min-height: 100vh;
}

.connect-overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(92, 97, 98, 0.42);
}

.connect-modal {
  width: min(88vw, 280px);
  background: #f8f8f8;
  border-radius: 15px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
  padding: 18px 14px 16px;
  text-align: center;
  opacity: 0;
  transform: translateY(10px) scale(0.94);
  animation: connectModalFadeUp 0.58s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.connect-modal-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 600;
  color: #1f2937;
}

.connect-divider {
  width: 100%;
  height: 1px;
  background: #c8c8c8;
  margin: 14px 0;
}

.connect-modal-text {
  margin: 0 0 18px;
  padding: 0 4px;
  font-size: 13px;
  line-height: 1.75;
  font-weight: 400;
  color: #6b7280;
}

.connect-button {
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #9b4dff 0%, #3f32d6 100%);
  box-shadow: 0 8px 18px rgba(83, 54, 214, 0.3);
  color: #ffffff;
  font-size: 15px;
  line-height: 1.3;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  padding: 10px 12px;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.connect-button:hover {
  opacity: 0.96;
}

.connect-button:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.connect-button + .connect-button {
  margin-top: 12px;
}

.connect-button-secondary {
  background: linear-gradient(180deg, #f3f4f6 0%, #e5e7eb 100%);
  box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.08);
  color: #1f2937;
}

.connect-button-secondary:hover {
  opacity: 1;
  transform: translateY(0);
  box-shadow: inset 0 0 0 1px rgba(31, 41, 55, 0.1);
}

.connect-button-back {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #7e8081;
}

/* Waiting animation */
.connect-button-waiting {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 52px;
}

.connect-button-dots {
  display: inline-flex;
  gap: 3px;
}

.connect-button-dots span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  opacity: 0.3;
  animation: connectWaitingDots 1.2s infinite ease-in-out;
}

.connect-button-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.connect-button-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes connectWaitingDots {
  0%, 80%, 100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.connect-loading-state[hidden] {
  display: none;
}

.connect-loading-state {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connect-loading-card {
  width: min(88vw, 280px);
  background: rgba(248, 248, 248, 0.96);
  border-radius: 15px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.18);
  padding: 28px 18px 24px;
  text-align: center;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  animation: connectModalFadeUp 0.38s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.connect-loading-title {
  margin: 18px 0 8px;
  font-size: 18px;
  line-height: 1.3;
  font-weight: 700;
  color: #1f2937;
}

.connect-loading-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: #6b7280;
}

.connect-subscription-info {
  margin: 16px auto 18px;
  padding: 10px 12px 9px;
  width: 76%;
  max-width: 188px;
  border: 1px solid rgba(31, 41, 55, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(4px);
}

.connect-subscription-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.connect-subscription-row + .connect-subscription-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(31, 41, 55, 0.04);
}

.connect-subscription-label {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: #9aa0ae;
}

.connect-subscription-value {
  margin-left: auto;
  min-width: 0;
  text-align: right;
  padding-right: 0;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
}

.pl {
  display: block;
  width: 92px;
  height: 92px;
  margin: 0 auto;
}

.pl__ring,
.pl__ball {
  animation: ring 2s ease-out infinite;
}

.pl__ball {
  animation-name: ball;
}

@keyframes connectModalFadeUp {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.94);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ring {
  from {
    stroke-dasharray: 0 257 0 0 1 0 0 258;
  }

  25% {
    stroke-dasharray: 0 0 0 0 257 0 258 0;
  }

  50%,
  to {
    stroke-dasharray: 0 0 0 0 0 515 0 0;
  }
}

@keyframes ball {
  from,
  50% {
    animation-timing-function: ease-in;
    stroke-dashoffset: 1;
  }

  64% {
    animation-timing-function: ease-in;
    stroke-dashoffset: -109;
  }

  78% {
    animation-timing-function: ease-in;
    stroke-dashoffset: -145;
  }

  92% {
    animation-timing-function: ease-in;
    stroke-dashoffset: -157;
  }

  57%,
  71%,
  85%,
  99%,
  to {
    animation-timing-function: ease-out;
    stroke-dashoffset: -163;
  }
}

@media (min-width: 768px) {
  .connect-modal {
    width: 300px;
    padding: 18px 16px 16px;
    border-radius: 16px;
  }

  .connect-modal-title {
    font-size: 22px;
  }

  .connect-divider {
    margin: 14px 0;
  }

  .connect-modal-text {
    font-size: 15px;
    margin-bottom: 18px;
  }

  .connect-button {
    min-height: 54px;
    font-size: 18px;
    border-radius: 10px;
    padding: 8px 14px;
  }

  .connect-loading-card {
    width: 300px;
    border-radius: 16px;
    padding: 30px 20px 26px;
  }

  .connect-loading-title {
    font-size: 20px;
  }

  .connect-loading-text {
    font-size: 15px;
  }

  .connect-subscription-info {
    margin: 18px auto 20px;
    padding: 11px 13px 10px;
    width: 74%;
    max-width: 196px;
    border-radius: 12px;
  }

  .connect-subscription-value {
    font-size: 14px;
  }

  .pl {
    width: 104px;
    height: 104px;
  }

  .connect-button-back {
    font-weight: 500;
  }
}