:root {
  --accent: #990066;
  --accent-dark: #72004c;
  --accent-soft: #f7e8f1;
  --ink: #19171a;
  --muted: #69636a;
  --paper: #f5f5f2;
  --white: #ffffff;
  --line: #dedbdd;
  --success: #176b4d;
  --success-soft: #e7f4ee;
  --warning: #8a5b08;
  --warning-soft: #fff4d8;
  --danger: #9d2f2f;
  --danger-soft: #fbeaea;
  --info: #28666e;
  --font: "Onest", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.topbar__inner {
  width: min(880px, calc(100% - 40px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 18px;
}

.brand__mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--white);
  font-size: 12px;
}

.save-status {
  flex: none;
  color: var(--info);
  font-size: 13px;
  font-weight: 600;
}

.save-status[data-state="error"] {
  color: var(--danger);
}

.progress {
  width: min(880px, calc(100% - 40px));
  margin: 24px auto 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.progress__step {
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.progress__bar {
  display: block;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}

.progress__label {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress__step[data-state="active"] .progress__bar,
.progress__step[data-state="done"] .progress__bar {
  background: var(--accent);
}

.progress__step[data-state="active"] .progress__label,
.progress__step[data-state="done"] .progress__label {
  color: var(--ink);
}

.progress__step:not(:disabled) {
  cursor: pointer;
}

.workspace {
  width: min(880px, calc(100% - 40px));
  margin: 12px auto 72px;
}

.tool,
.result {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 50px rgba(47, 35, 45, 0.08);
}

.tool__header {
  min-height: 104px;
  padding: 24px 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.step-label {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.18;
}

.delete-button {
  flex: none;
  border: 0;
  background: transparent;
  padding: 6px 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.delete-button:hover,
.delete-button:focus-visible {
  color: var(--danger);
}

.questions {
  padding: 4px 28px 0;
}

.question {
  min-width: 0;
  margin: 0;
  padding: 24px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.question:last-child {
  border-bottom: 0;
}

.question__number {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.question__title {
  max-width: 700px;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.35;
}

.question__help {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.choices {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.choices[data-count="3"],
.choices[data-count="4"],
.choices[data-count="5"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  padding: 11px 14px;
  cursor: pointer;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.choice:hover,
.choice:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.choice[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: inset 3px 0 0 var(--accent);
}

.number-input {
  width: 132px;
  height: 48px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--white);
  padding: 0 14px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
}

.number-input:focus {
  border-color: var(--accent);
  outline: 2px solid var(--accent-soft);
}

.question[data-invalid="true"] .question__title {
  color: var(--danger);
}

.question__error {
  min-height: 18px;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.form-error {
  min-height: 20px;
  margin: 0;
  padding: 0 28px;
  color: var(--danger);
  font-size: 14px;
  font-weight: 600;
}

.actions {
  min-height: 88px;
  padding: 18px 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.button {
  min-height: 48px;
  border-radius: 6px;
  padding: 12px 22px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button--primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--white);
}

.button--primary:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button--secondary {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}

.button--secondary:hover:not(:disabled) {
  border-color: var(--ink);
}

.loading {
  margin: 0;
  padding: 40px 0;
  color: var(--muted);
}

.result {
  padding: 34px;
  border-top: 5px solid var(--info);
}

.result[data-result="allow"] {
  border-top-color: var(--success);
  background: var(--success-soft);
}

.result[data-result="review"],
.result[data-result="warn"] {
  border-top-color: var(--warning);
  background: var(--warning-soft);
}

.result[data-result="stop"] {
  border-top-color: var(--danger);
  background: var(--danger-soft);
}

.result__status {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.result__message {
  max-width: 680px;
  margin: 14px 0 0;
  color: #4f494f;
  font-size: 16px;
  line-height: 1.55;
}

.result__guidance {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.result__guidance[hidden] {
  display: none;
}

.result__guidance section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgb(255 255 255 / 72%);
}

.result__guidance h2,
.result__issues h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.result__guidance p,
.result__issues p {
  margin: 0;
  color: #4f494f;
  line-height: 1.5;
}

.result__issues {
  margin-top: 24px;
}

.result__issues ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.result__issues li {
  padding: 14px 16px;
  border-left: 3px solid var(--warning);
  border-radius: 8px;
  background: rgb(255 255 255 / 66%);
}

.result__issues li p {
  margin-top: 5px;
}

.result__issue-action {
  margin-top: 9px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.result__issue-action:hover {
  text-decoration: underline;
}

.result__notice {
  max-width: 680px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.result__actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

noscript {
  display: block;
  margin: 20px;
  color: var(--danger);
  text-align: center;
}

@media (max-width: 640px) {
  .topbar__inner,
  .progress,
  .workspace {
    width: min(100% - 24px, 880px);
  }

  .topbar__inner {
    min-height: 60px;
  }

  .brand {
    font-size: 15px;
  }

  .result__guidance {
    grid-template-columns: 1fr;
  }

  .brand__mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .save-status {
    max-width: 104px;
    text-align: right;
  }

  .progress {
    margin-top: 18px;
  }

  .progress__label {
    display: none;
  }

  .tool__header,
  .questions,
  .form-error,
  .actions {
    padding-left: 18px;
    padding-right: 18px;
  }

  .tool__header {
    min-height: 92px;
    padding-top: 20px;
    padding-bottom: 20px;
  }

  h1 {
    font-size: 23px;
  }

  .delete-button {
    max-width: 72px;
    text-align: right;
  }

  .question {
    padding: 21px 0;
  }

  .question__title {
    font-size: 16px;
  }

  .choices,
  .choices[data-count="3"],
  .choices[data-count="4"],
  .choices[data-count="5"] {
    grid-template-columns: 1fr;
  }

  .actions {
    min-height: 82px;
  }

  .button {
    padding-inline: 17px;
  }

  .result {
    padding: 26px 20px;
  }
}
