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

html, body {
  width: 100%;
  background: #ffffff;
  color: #000000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.content, .success-content {
  text-align: center;
  animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Typography ── */
h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 300;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.subtitle, .success-subtitle {
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 32px;
  font-weight: 300;
  letter-spacing: 0.8px;
}

/* ── Product Info ── */
.product-info {
  margin-bottom: 32px;
  padding: 24px 0;
  border-top: 1px solid #000;
  border-bottom: 1px solid #000;
}

.description {
  font-size: 0.95rem;
  color: #333;
  margin-bottom: 16px;
  line-height: 1.7;
}

.price-tag {
  font-size: clamp(2rem, 8vw, 3rem);
  font-weight: 300;
  letter-spacing: -1px;
  margin-top: 12px;
}

/* ── Form ── */
.purchase-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.form-group {
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input {
  width: 100%;
  padding: 14px 14px;
  font-size: 16px; /* prevent iOS zoom */
  border: 1px solid #000;
  background: #fff;
  color: #000;
  transition: box-shadow 0.2s;
  border-radius: 0;
  -webkit-appearance: none;
}

.form-group input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.12);
}

.form-group input::placeholder {
  color: #aaa;
}

/* ── Buttons ── */
.btn-primary,
.btn-secondary,
.btn-tertiary {
  padding: 15px 24px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: 2px solid #000;
  transition: background 0.2s, color 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  display: block;
  width: 100%;
  text-align: center;
  border-radius: 0;
  -webkit-appearance: none;
}

.btn-primary {
  background: #000;
  color: #fff;
  margin-top: 8px;
}

.btn-primary:hover:not(:disabled),
.btn-primary:active:not(:disabled) {
  background: #fff;
  color: #000;
}

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

.btn-secondary {
  background: #000;
  color: #fff;
  padding: 13px 16px;
  font-size: 0.82rem;
}

.btn-secondary:hover,
.btn-secondary:active {
  background: #333;
}

.btn-tertiary {
  background: transparent;
  color: #000;
  padding: 13px 24px;
  font-size: 0.85rem;
  margin-top: 16px;
}

.btn-tertiary:hover,
.btn-tertiary:active {
  background: #000;
  color: #fff;
}

.btn-text { display: inline; }
.btn-loader { display: inline; }
.btn-loader.hidden,
.btn-text.hidden { display: none; }

/* ── Messages ── */
.error-message {
  padding: 12px 14px;
  background: #fff0f0;
  color: #c62828;
  border: 1px solid #c62828;
  font-size: 0.88rem;
  margin-top: 16px;
  text-align: center;
  line-height: 1.5;
}

.error-message.hidden { display: none; }

.error-message.success-message {
  background: #f0fff4;
  color: #2e7d32;
  border-color: #2e7d32;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 14px;
}

/* ── Success Page ── */
.success-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  animation: scaleIn 0.4s ease-out;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.7); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── Code Box ── */
.code-box {
  background: #f7f7f7;
  border: 1px solid #000;
  padding: 24px 20px;
  margin: 24px 0;
}

.code-label {
  font-size: 0.75rem;
  color: #666;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.access-code {
  font-family: 'Courier New', monospace;
  font-size: clamp(1.3rem, 5vw, 1.8rem);
  font-weight: 700;
  color: #000;
  letter-spacing: 2px;
  word-break: break-all;
  margin: 0 0 16px 0;
  padding: 14px 10px;
  background: #fff;
  border: 1px solid #000;
  line-height: 1.3;
}

/* ── Code Actions (Copy + PDF buttons) ── */
.code-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Confirmation Box ── */
.confirmation-box {
  background: #f7f7f7;
  padding: 16px;
  margin: 16px 0;
  border: 1px solid #e0e0e0;
  font-size: 0.88rem;
}

.confirmation-box p {
  color: #666;
  margin-bottom: 4px;
}

.email {
  font-weight: 700;
  color: #000;
  font-size: 0.95rem;
  word-break: break-all;
}

/* ── Next Steps ── */
.next-steps {
  text-align: left;
  background: #f7f7f7;
  padding: 20px;
  margin: 16px 0;
}

.next-steps h3 {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.next-steps ul {
  list-style: none;
  padding: 0;
}

.next-steps li {
  font-size: 0.9rem;
  color: #333;
  padding: 6px 0 6px 20px;
  position: relative;
  line-height: 1.5;
}

.next-steps li:before {
  content: "•";
  position: absolute;
  left: 0;
  font-weight: bold;
}

/* ── Loading ── */
.loading-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px;
  gap: 12px;
}

.loading-message.hidden { display: none; }

.spinner {
  border: 2px solid #eee;
  border-top: 2px solid #000;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-message p {
  font-size: 0.9rem;
  color: #666;
}

/* ── Tablet & Desktop ── */
@media (min-width: 480px) {
  body {
    padding: 24px;
  }

  .code-actions {
    flex-direction: row;
  }

  .code-actions .btn-secondary {
    flex: 1;
  }

  .access-code {
    font-size: 1.8rem;
  }
}
