:root {
  color-scheme: dark;
  --bg: #0b0d0f;
  --surface: #13161a;
  --surface-2: #191d22;
  --surface-hover: #1e2329;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f3f6f8;
  --muted: #939da8;
  --soft: #c5ced6;
  --accent: #22c55e;
  --accent-bright: #2dd48a;
  --accent-bg: rgba(34, 197, 94, 0.12);
  --accent-border: rgba(45, 212, 138, 0.45);
  --on-accent: #05140b;
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --danger-border: rgba(248, 113, 113, 0.3);
  --radius-card: 22px;
  --radius-item: 14px;
  --radius-pill: 999px;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.ambient-glow {
  position: fixed;
  inset: -180px auto auto 50%;
  width: 720px;
  height: 420px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(34, 197, 94, 0.16) 0%, rgba(34, 197, 94, 0.04) 45%, transparent 72%);
  pointer-events: none;
  z-index: 0;
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #111417;
}

.brand-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-name strong {
  color: var(--accent-bright);
  font-weight: 700;
}

.bot-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--soft);
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.bot-pill:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.bot-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.7);
}

.bot-arrow {
  color: var(--muted);
  font-size: 12px;
}

/* Main Card */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.checkout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.card-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card-head h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.subtitle {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.feature-pills {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feature-pills li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--soft);
}

.feature-pills svg {
  width: 13px;
  height: 13px;
  color: var(--accent-bright);
  flex-shrink: 0;
}

/* Form */
.checkout-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.section-label,
.field-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--soft);
}

/* Plans Grid */
.plans-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border-radius: var(--radius-item);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
  user-select: none;
}

.plan-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.plan-card:active {
  transform: scale(0.99);
}

.plan-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.plan-card:has(input:checked) {
  background: linear-gradient(180deg, rgba(34, 197, 94, 0.13) 0%, rgba(34, 197, 94, 0.05) 100%);
  border-color: var(--accent-border);
  box-shadow: inset 0 0 0 1px rgba(45, 212, 138, 0.2);
}

.plan-card:has(input:focus-visible) {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

.plan-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.plan-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.plan-badge {
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--soft);
  white-space: nowrap;
}

.plan-badge.badge-accent {
  background: var(--accent-bg);
  color: var(--accent-bright);
}

.plan-prices {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}

.plan-old {
  font-size: 13px;
  color: var(--muted);
}

.plan-price {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.plan-meta {
  font-size: 12px;
  color: var(--muted);
}

/* Inputs */
.text-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.text-input::placeholder {
  color: #636d78;
}

.text-input:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.14);
}

.text-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.field-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

.field-hint a {
  color: var(--accent-bright);
  text-decoration: none;
}

.field-hint a:hover {
  text-decoration: underline;
}

/* Gift Switch */
.gift-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-item);
  background: var(--surface-2);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.gift-row:hover {
  border-color: var(--border-strong);
}

.gift-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  display: grid;
  place-items: center;
  color: var(--accent-bright);
  flex-shrink: 0;
}

.gift-icon svg {
  width: 18px;
  height: 18px;
}

.gift-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.gift-copy strong {
  font-size: 14px;
  font-weight: 600;
}

.gift-copy span {
  font-size: 12px;
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  width: 44px;
  height: 26px;
  border-radius: var(--radius-pill);
  background: #272d35;
  border: 1px solid var(--border);
  position: relative;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #f3f6f8;
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}

/* Promo Code */
.promo-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.promo-block.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.promo-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease;
}

.promo-toggle:hover {
  color: var(--text);
}

.promo-toggle-chevron {
  display: inline-block;
  transition: transform 0.18s ease;
}

.promo-toggle[aria-expanded="true"] .promo-toggle-chevron {
  transform: rotate(90deg);
}

.promo-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.promo-row {
  display: flex;
  gap: 8px;
}

.promo-input {
  height: 44px;
  text-transform: uppercase;
}

.promo-apply-btn {
  height: 44px;
  padding: 0 16px;
  white-space: nowrap;
}

.promo-active {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-bg);
  border: 1px solid var(--accent-border);
}

.promo-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.promo-chip strong {
  color: var(--accent-bright);
  letter-spacing: 0.02em;
}

.promo-chip span {
  color: var(--soft);
}

.promo-clear {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.promo-clear:hover {
  background: rgba(255, 255, 255, 0.16);
}

.promo-feedback {
  margin: 0;
  font-size: 12px;
  color: var(--danger);
}

/* Error Banner */
.error-banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.error-banner p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: #fecaca;
}

.error-bot-link {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-bright);
  text-decoration: none;
}

.error-bot-link:hover {
  text-decoration: underline;
}

/* Buttons */
.primary-btn,
.secondary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.16s ease, border-color 0.16s ease, opacity 0.16s ease;
}

.primary-btn {
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 0;
  background: linear-gradient(180deg, #2dd48a 0%, #20b858 100%);
  color: var(--on-accent);
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(34, 197, 94, 0.22);
}

.primary-btn:hover {
  filter: brightness(1.06);
}

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

.primary-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.secondary-btn {
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
}

.secondary-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.full-width {
  width: 100%;
}

.btn-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(5, 20, 11, 0.25);
  border-top-color: var(--on-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.primary-btn.is-loading .btn-spinner {
  display: inline-block;
}

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

.reassurance {
  margin: -4px 0 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* Status View */
.status-card {
  align-items: center;
  text-align: center;
  padding: 32px 24px;
}

.status-icon {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.status-icon svg {
  display: none;
  width: 28px;
  height: 28px;
}

.status-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.status-icon.status-paid {
  background: var(--accent-bg);
  border-color: var(--accent-border);
  color: var(--accent-bright);
}

.status-icon.status-paid .status-spinner {
  display: none;
}

.status-icon.status-paid .icon-check {
  display: block;
}

.status-icon.status-failed {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.status-icon.status-failed .status-spinner {
  display: none;
}

.status-icon.status-failed .icon-fail {
  display: block;
}

.status-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.status-desc {
  margin: -8px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 380px;
}

.status-meta {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-item);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.status-meta > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.status-meta span {
  color: var(--muted);
}

.status-meta strong {
  color: var(--text);
  font-weight: 600;
}

.status-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Footer */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  padding-bottom: 6px;
}

.footer a {
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer a:hover {
  color: var(--soft);
}

@media (max-width: 480px) {
  .page-shell {
    padding: 16px 12px 24px;
    gap: 16px;
  }

  .checkout-card {
    padding: 20px 16px;
    border-radius: 18px;
  }

  .card-head h1 {
    font-size: 23px;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }

  .plan-card {
    padding: 13px 14px;
  }
}
