:root {
  --bg: #0a0f1e;
  --bg2: #0d1424;
  --card: #161b2c;
  --border: #252d40;
  --blue: #2563eb;
  --blue2: #1d4ed8;
  --blue-glow: rgba(37, 99, 235, 0.12);
  --green: #10b981;
  --red: #ef4444;
  --grey: #94a3b8;
  --dim: #64748b;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  background: var(--bg);
  color: #fff;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 99;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  background: var(--blue-glow);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-name {
  color: #60a5fa;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-ring {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.05;
}

.brand-mark-title {
  color: var(--dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border-bottom: 1px solid var(--red);
  color: #fca5a5;
  padding: 12px 16px;
  font-size: 13px;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 108px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.card-label {
  color: #60a5fa;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin-bottom: 14px;
}

.input-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.input-wrap {
  flex: 1;
  min-width: 0;
}

.voucher-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 4px 4px 12px;
  transition: border-color 0.2s;
}

.voucher-wrap:focus-within {
  border-color: var(--blue);
}

.voucher-icon {
  flex-shrink: 0;
  display: flex;
  opacity: 0.85;
}

.voucher-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  padding: 12px 10px 12px 0;
  color: #fff;
  font-size: 14px;
  outline: none;
}

.voucher-input::placeholder {
  color: var(--dim);
}

.connect-btn {
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 0 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
}

.connect-btn:active {
  transform: scale(0.98);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 22px 0 12px;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.badge {
  color: var(--dim);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.section-label {
  color: var(--dim);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  margin: 22px 0 12px;
}

.packages-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pkg-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
}

.pkg-item.selected {
  border-color: var(--blue);
  background: rgba(37, 99, 235, 0.1);
}

.pkg-item.best {
  border-color: rgba(37, 99, 235, 0.55);
}

.best-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  background: var(--blue);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 5px 10px;
  border-radius: 0 16px 0 10px;
}

.pkg-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pkg-info {
  flex: 1;
  min-width: 0;
}

.pkg-name {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.pkg-dur {
  color: var(--dim);
  font-size: 13px;
}

.pkg-price {
  text-align: right;
}

.price-amt {
  color: #60a5fa;
  font-size: 19px;
  font-weight: 800;
}

.pkg-item.selected .price-amt {
  color: #fff;
}

.price-cur {
  color: var(--dim);
  font-size: 11px;
  font-weight: 600;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

@media (max-width: 360px) {
  .payment-methods {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pay-opt {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  aspect-ratio: 1;
  max-height: 76px;
  background: #0f1522;
  border: 2px solid var(--border);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
  font: inherit;
  color: inherit;
}

.pay-opt.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
  background: rgba(37, 99, 235, 0.08);
}

.pay-icon {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.pay-logo {
  width: 100%;
  height: 100%;
  max-width: 64px;
  max-height: 64px;
  object-fit: contain;
  border-radius: 8px;
}

.pay-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pay-opt .check {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 18px;
  height: 18px;
  background: var(--blue);
  color: #fff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.pay-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #fff;
  border: none;
  border-radius: 16px;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 8px;
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.35);
}

.pay-btn:active {
  transform: scale(0.99);
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  color: var(--dim);
  font-size: 14px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

#ads {
  margin: 16px 0;
  font-size: 13px;
  color: var(--grey);
}

.bottom-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: linear-gradient(180deg, transparent, var(--bg) 12px);
  padding-top: 4px;
}

.powered-line {
  text-align: center;
  font-size: 10px;
  color: var(--dim);
  padding: 4px 0 8px;
  letter-spacing: 0.04em;
}

.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom, 0));
  max-width: 480px;
  margin: 0 auto;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  color: var(--dim);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  border-radius: 12px;
  transition: color 0.2s;
}

.nav-item svg {
  opacity: 0.85;
}

.nav-item.active {
  color: var(--blue);
}

.nav-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 32px;
  background: rgba(37, 99, 235, 0.2);
  border-radius: 20px;
  color: var(--blue);
}

.nav-item.active .nav-pill {
  background: rgba(37, 99, 235, 0.25);
}

.nav-label {
  line-height: 1;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 250;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 22px 20px 28px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.overlay.show .modal {
  transform: translateY(0);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-head h3 {
  font-size: 18px;
  font-weight: 800;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--dim);
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}

.summary {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 18px;
}

.sum-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  color: var(--grey);
  margin-bottom: 10px;
}

.sum-row.total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-weight: 800;
  color: #fff;
  font-size: 16px;
}

.sum-row .price {
  color: #60a5fa;
}

.phone-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--dim);
  margin-bottom: 8px;
}

.phone-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.phone-wrap .code {
  padding: 14px 12px;
  color: var(--dim);
  font-weight: 600;
  border-right: 1px solid var(--border);
}

.phone-input {
  flex: 1;
  border: none;
  background: transparent;
  color: #fff;
  padding: 14px 12px;
  font-size: 16px;
  outline: none;
}

.phone-hint {
  font-size: 12px;
  color: var(--dim);
  margin: 10px 0 18px;
  line-height: 1.45;
}

.confirm-btn {
  width: 100%;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 15px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
}

.confirm-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-spin {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.wait-modal,
.ok-modal {
  text-align: center;
  padding-top: 28px;
  padding-bottom: 32px;
}

.pulse-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pulse-ring {
  position: absolute;
  inset: 0;
  border: 2px solid var(--blue);
  border-radius: 50%;
  opacity: 0.4;
  animation: pulse 1.5s ease-out infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.8);
    opacity: 0.6;
  }
  100% {
    transform: scale(1.4);
    opacity: 0;
  }
}

.wait-modal h3 {
  font-size: 20px;
  margin-bottom: 10px;
}

.wait-modal p {
  color: var(--grey);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.wait-timer {
  font-size: 28px;
  font-weight: 800;
  color: var(--blue);
  margin-bottom: 20px;
}

.cancel-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--grey);
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}

.ok-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
}

.ok-modal h3 {
  font-size: 20px;
  margin-bottom: 8px;
}

.ok-modal p {
  color: var(--grey);
  margin-bottom: 20px;
}

.prog-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  max-width: 200px;
  margin: 0 auto;
}

.prog-fill {
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: 2px;
  animation: fillBar 2.5s ease forwards;
}

@keyframes fillBar {
  to {
    width: 100%;
  }
}

@media (min-width: 520px) {
  .overlay {
    align-items: center;
  }

  .modal {
    border-radius: 22px;
    margin: 20px;
    transform: scale(0.92);
    opacity: 0;
    transition: transform 0.25s, opacity 0.25s;
  }

  .overlay.show .modal {
    transform: scale(1);
    opacity: 1;
  }
}
