:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --surface: #ffffff;
  --ink: #19221f;
  --muted: #5f6c67;
  --line: #d9e2dd;
  --brand: #116d5b;
  --brand-strong: #0d4f43;
  --accent: #c25631;
  --soft: #e9f4ef;
  --warning: #fbf0e8;
  --shadow: 0 18px 60px rgba(25, 34, 31, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0;
}

.hero {
  padding: 12px 0 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

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

h1 {
  max-width: 820px;
  margin-bottom: 0;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 1.04;
}

.home-title {
  cursor: pointer;
  width: fit-content;
}

.home-title:focus-visible {
  outline: 3px solid rgba(17, 109, 91, 0.28);
  outline-offset: 6px;
  border-radius: 8px;
}

.subtitle {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.workspace {
  display: grid;
  gap: 18px;
}

.wizard,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.wizard {
  padding: 28px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
  margin-bottom: 28px;
}

.progress-bar {
  display: block;
  width: 25%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
  transition: width 0.2s ease;
}

.step {
  display: none;
  min-height: 430px;
}

.step.active {
  display: block;
}

.step-count {
  display: inline-block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
}

.step h2 {
  margin-bottom: 24px;
  font-size: 30px;
  line-height: 1.25;
}

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

.option-grid label {
  position: relative;
  display: flex;
  min-height: 70px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: #fbfdfc;
  cursor: pointer;
  user-select: none;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.option-grid label:hover {
  transform: translateY(-1px);
}

.option-grid label:has(input:checked) {
  border-color: var(--brand);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--brand);
}

input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
  flex: 0 0 auto;
}

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

.field {
  display: grid;
  gap: 9px;
  margin-bottom: 18px;
}

.field span,
.preview-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: #fbfdfc;
  color: var(--ink);
  outline: none;
}

.field textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.6;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 109, 91, 0.14);
}

.parse-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  margin: 14px 0 0;
  font-weight: 800;
}

.parse-status.success {
  border-color: rgba(17, 109, 91, 0.28);
  background: var(--soft);
  color: var(--brand);
}

.parse-status.error {
  border-color: rgba(194, 86, 49, 0.28);
  background: var(--warning);
  color: var(--accent);
}

.parse-loading {
  width: 34px;
  height: 34px;
  border: 4px solid var(--soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 16px 0 0;
  animation: spin 0.85s linear infinite;
}

.message {
  min-height: 24px;
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 14px;
  line-height: 1.5;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

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

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

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

.hidden {
  display: none !important;
}

.result-panel {
  min-height: calc(100vh - 170px);
  padding: 34px;
}

.loading-state {
  display: grid;
  min-height: calc(100vh - 240px);
  place-content: center;
  text-align: center;
}

.spinner {
  width: 72px;
  height: 72px;
  border: 8px solid var(--soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 18px;
  animation: spin 0.85s linear infinite;
}

.loading-state h2,
.result h2 {
  margin-bottom: 10px;
  font-size: 30px;
}

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

.result-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

#score {
  border-radius: 999px;
  background: var(--soft);
  padding: 8px 13px;
  color: var(--brand);
  font-weight: 900;
  white-space: nowrap;
}

.commentary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 18px;
  margin-bottom: 20px;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.75;
}

.shared-link-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: #fbfdfc;
  margin-bottom: 0;
}

.shared-link-copy span {
  display: block;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

#qr-code {
  width: 180px;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

@media (max-width: 900px) {
  .app {
    width: min(100% - 24px, 720px);
    padding: 24px 0;
  }

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

@media (max-width: 620px) {
  .wizard,
  .result-panel {
    padding: 20px;
  }

  .option-grid,
  .budget-options,
  .url-row,
  .shared-link-card {
    grid-template-columns: 1fr;
  }

  #qr-code {
    justify-self: center;
  }

  .step h2 {
    font-size: 25px;
  }

  .actions {
    flex-direction: column-reverse;
  }

  button {
    width: 100%;
  }
}
