:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #10b981;
  --dark-bg: #0f172a;
  --card-bg: #1e293b;
  --card-border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  background-color: var(--dark-bg);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.app-container {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Header */
.app-header {
  text-align: center;
  padding: 12px 8px;
}
.brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.header-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}
.header-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.cluster-badge {
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
}
.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

/* Form Sections */
.form-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.section-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

/* Packages */
.package-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pkg-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}
.pkg-card:hover {
  border-color: #475569;
}
.pkg-card.selected {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.12);
  box-shadow: 0 0 0 1px var(--primary);
}
.pkg-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 2px;
}
.pkg-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.pkg-price {
  font-size: 1.15rem;
  font-weight: 800;
  color: #38bdf8;
  text-align: right;
}

/* Inputs */
.input-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.input-group label .req {
  color: #ef4444;
}
.input-affix {
  display: flex;
  align-items: center;
  background: #0b1120;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.affix-prefix {
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  border-right: 1px solid var(--card-border);
}
.input-affix input, .input-card input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 0.95rem;
  outline: none;
}
.input-card input[type="text"] {
  background: #0b1120;
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-sm);
}
.input-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
  display: block;
}

/* Captcha Widget */
.captcha-wrapper {
  display: flex;
  justify-content: center;
}
.robot-captcha {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 304px;
  height: 76px;
  padding: 0 12px 0 14px;
  background: #1e293b;
  border: 1.5px solid #334155;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  user-select: none;
  cursor: pointer;
}
.captcha-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.captcha-checkbox {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: 2px solid #64748b;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.captcha-checkbox.verified {
  background: #10b981;
  border-color: #10b981;
}
.captcha-spin {
  width: 16px;
  height: 16px;
  border: 2px solid #3b82f6;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.captcha-check {
  color: #fff;
  font-weight: 900;
  font-size: 1.1rem;
}
.captcha-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #f1f5f9;
}
.captcha-desc {
  display: block;
  font-size: 0.68rem;
  color: #94a3b8;
}
.captcha-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.captcha-shield {
  color: #3b82f6;
}
.captcha-shield.verified {
  color: #10b981;
}
.captcha-brand {
  font-size: 0.62rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.3px;
  margin-top: 2px;
}
.captcha-legal {
  font-size: 0.55rem;
  color: #64748b;
}

/* Actions */
.action-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.price-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 4px;
  font-size: 0.9rem;
}
.total-amount {
  font-size: 1.35rem;
  font-weight: 800;
  color: #38bdf8;
}
.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--primary);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.safe-payment-notice {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
}

/* Success View */
.success-card {
  background: var(--card-bg);
  border: 1.5px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px 16px;
  text-align: center;
}
.success-icon {
  font-size: 3rem;
  margin-bottom: 8px;
}
.success-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: #34d399;
}
.success-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.voucher-ticket {
  background: #0b1120;
  border: 1.5px dashed #475569;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  text-align: left;
}
.ticket-header {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 8px;
  margin-bottom: 12px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #94a3b8;
}
.credential-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cred-item {
  background: #1e293b;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.cred-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
}
.cred-value-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.cred-value {
  font-size: 1rem;
  font-weight: 800;
  font-family: monospace;
  color: #facc15;
}
.btn-copy {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.ticket-footer {
  margin-top: 12px;
  font-size: 0.72rem;
  color: #34d399;
  text-align: center;
}
.btn-connect {
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
  transition: transform 0.1s;
}
.btn-connect:active {
  transform: scale(0.98);
}
.connect-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.manual-guide {
  margin-top: 20px;
  text-align: left;
  background: #0f172a;
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.manual-guide h4 {
  color: #e2e8f0;
  margin-bottom: 6px;
}
.manual-guide ol {
  padding-left: 18px;
}
.manual-guide li {
  margin-bottom: 4px;
}

/* Common */
.hidden { display: none !important; }
.loading-state {
  text-align: center;
  padding: 30px 0;
  color: var(--text-muted);
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.app-footer {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: auto;
  padding: 16px 0 8px;
}
.cs-phone a {
  color: #38bdf8;
  text-decoration: none;
  font-weight: 600;
}
