:root {
  --page-bg: #f5f7fb;
  --card-bg: #ffffff;
  --text: #172033;
  --muted: #697386;
  --border: #dce2ea;
  --primary: #0d8ed8;
  --primary-hover: #087bbd;
  --secondary-bg: #eef3f7;
  --danger: #b42318;
  --success: #067647;
  --shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 42px);
}

.subtitle {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.home-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 24px;
  align-items: start;
}

.configuration-panel {
  display: grid;
  gap: 20px;
}

.form-card,
.actions-card,
.preview-card,
.help-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--card-bg);
  box-shadow: var(--shadow);
}

.form-card {
  padding: 24px;
}

.section-heading {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-bottom: 5px;
  font-size: 20px;
}

.section-heading p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.step-number {
  display: inline-grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 800;
}

.form-grid {
  display: grid;
  gap: 18px;
}

.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full-width {
  grid-column: 1 / -1;
}

.extra-space {
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span {
  font-weight: 700;
}

.field strong {
  color: var(--danger);
}

.field small {
  color: var(--muted);
  line-height: 1.4;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 142, 216, 0.14);
}

.switch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.switch-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcfe;
  cursor: pointer;
}

.switch-row input {
  width: 18px;
  min-height: auto;
  height: 18px;
  margin-top: 2px;
}

.switch-row span {
  display: grid;
  gap: 3px;
}

.switch-row small {
  color: var(--muted);
  line-height: 1.35;
}

.actions-card {
  position: sticky;
  bottom: 14px;
  z-index: 3;
  padding: 16px;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 750;
}

.button.primary {
  background: var(--primary);
  color: #fff;
}

.button.primary:hover {
  background: var(--primary-hover);
}

.button.secondary {
  background: var(--secondary-bg);
  color: var(--text);
}

.message {
  display: none;
  margin-bottom: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  line-height: 1.45;
}

.message.error {
  display: block;
  background: #fef3f2;
  color: var(--danger);
}

.message.success {
  display: block;
  background: #ecfdf3;
  color: var(--success);
}

.preview-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 20px;
}

.preview-card,
.help-card {
  padding: 20px;
}

.preview-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.preview-heading h2 {
  margin-bottom: 0;
  font-size: 19px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font-weight: 750;
}

pre {
  max-height: 640px;
  overflow: auto;
  margin: 18px 0 0;
  padding: 16px;
  border-radius: 12px;
  background: #101827;
  color: #d8e5f5;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  font-size: 13px;
}

.help-card h3 {
  margin-bottom: 12px;
}

.help-card ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.65;
}

#tap-checkout-element {
  position: relative;
  z-index: 20;
}

@media (max-width: 1050px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }

  pre {
    max-height: 430px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 20px, 1440px);
    padding-top: 18px;
  }

  .page-header {
    flex-direction: column;
  }

  .two-columns,
  .switch-grid {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }

  .form-card {
    padding: 18px;
  }

  .actions-card {
    position: static;
  }

  .action-buttons {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    width: 100%;
  }
}
