:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #17201d;
  background: #f4f6f5;
  font-synthesis: none;
  --ink: #17201d;
  --muted: #65716c;
  --line: #d7ddda;
  --surface: #ffffff;
  --accent: #087f5b;
  --accent-dark: #076448;
  --error: #b42318;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: #f4f6f5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 44px auto;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
  gap: 24px;
  align-items: start;
}

.tool-panel,
.result-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 30px rgb(23 32 29 / 5%);
}

.section-heading {
  min-height: 84px;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.required-note,
.result-state {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

form {
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.checkout-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

label {
  color: #36413d;
  font-size: 13px;
  font-weight: 650;
}

label span {
  color: var(--error);
}

.session-link {
  color: var(--accent-dark);
  font-weight: 650;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.session-link:hover {
  color: var(--accent);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #bdc7c2;
  border-radius: 5px;
  outline: none;
  letter-spacing: 0;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

input::placeholder {
  color: #8a9490;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(8 127 91 / 12%);
}

.secret-control {
  min-width: 0;
}

.billing-actions-row {
  min-width: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.form-actions {
  min-height: 72px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 8px;
}

.form-actions .primary-button {
  width: 100%;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
}

.primary-button:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.secondary-button {
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #aeb9b4;
}

.secondary-button:hover {
  background: #f4f6f5;
}

.spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgb(255 255 255 / 35%);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

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

.result-panel {
  position: sticky;
  top: 24px;
}

.progress-steps {
  padding: 8px 24px 24px;
}

.progress-step {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.progress-step:last-child {
  border-bottom: 0;
}

.step-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.step-number {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  color: #64716b;
  background: #f1f4f2;
  border: 1px solid #cbd3cf;
  border-radius: 50%;
  font: 700 12px/1 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.progress-step[data-status="running"] .step-number {
  color: var(--accent-dark);
  background: #eaf5f0;
  border-color: var(--accent);
}

.progress-step[data-status="success"] .step-number {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.progress-step[data-status="error"] .step-number {
  color: #ffffff;
  background: var(--error);
  border-color: var(--error);
}

.step-heading h3 {
  margin: 0;
  font-size: 14px;
  line-height: 1.3;
}

.step-status {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.progress-step[data-status="running"] .step-status {
  color: var(--accent-dark);
}

.progress-step[data-status="success"] .step-status {
  color: var(--accent-dark);
}

.progress-step[data-status="error"] .step-status {
  color: var(--error);
}

.step-result {
  min-height: 20px;
  margin: 12px 0 0 42px;
  color: #52605a;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.step-link {
  margin: 14px 0 0 42px;
}

.step-link textarea {
  margin-top: 8px;
  min-height: 112px;
  overflow-wrap: anywhere;
  color: #244b3e;
  background: #f7faf8;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.result-actions {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-state.is-success {
  color: var(--accent-dark);
}

.result-state.is-error {
  color: var(--error);
}

@media (max-width: 820px) {
  main {
    width: min(100% - 24px, 640px);
    margin: 24px auto;
    grid-template-columns: 1fr;
  }

  .result-panel {
    position: static;
  }

}

@media (max-width: 520px) {
  form,
  .section-heading,
  .progress-steps {
    padding-left: 18px;
    padding-right: 18px;
  }

  form,
  .billing-actions-row,
  .checkout-options {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions .primary-button {
    width: 100%;
  }

  .result-actions {
    grid-template-columns: 1fr;
  }

  .step-result,
  .step-link {
    margin-left: 42px;
  }

}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
