:root {
  color-scheme: light;
  --page: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --ink: #111827;
  --muted: #667085;
  --soft: #98a2b3;
  --line: #e4e7ec;
  --line-strong: #d0d5dd;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-line: #bfdbfe;
  --success: #12b76a;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
  --shadow-soft: 0 8px 24px rgba(16, 24, 40, 0.05);
  --radius: 8px;
  font-family: "Aptos", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 34rem),
    linear-gradient(180deg, #fbfcff, var(--page));
}

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

button {
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 850;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-family: inherit;
  line-height: 1.16;
}

h1 {
  font-size: 18px;
  font-weight: 850;
}

h2 {
  max-width: 880px;
  font-size: 34px;
  font-weight: 850;
}

h3 {
  font-size: 20px;
}

.progress-card {
  padding: 14px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.progress-copy strong {
  color: var(--ink);
  font-weight: 800;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 99px;
  background: #e9eef8;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
  transition: width 180ms ease;
}

.section-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-size: 14px;
}

.nav-item:hover {
  color: var(--ink);
  background: #f2f6ff;
}

.nav-index {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--soft);
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.nav-item.is-active {
  color: var(--accent-strong);
  border-color: #dbeafe;
  background: var(--accent-soft);
}

.nav-item.is-active .nav-index {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.nav-item.is-complete .nav-index {
  color: #fff;
  border-color: var(--success);
  background: var(--success);
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  padding: 28px 34px 0;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  max-width: 1020px;
  margin: 0 auto 24px;
}

.topbar .eyebrow {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-transform: none;
}

.topbar-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.question-form {
  display: grid;
  gap: 20px;
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  align-content: start;
}

.question {
  min-width: 0;
  padding: 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.question label,
.question legend {
  display: block;
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
}

.hint {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  outline: none;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

input::placeholder,
textarea::placeholder {
  color: #98a2b3;
}

input,
select {
  min-height: 44px;
  padding: 0 14px;
}

textarea {
  min-height: 108px;
  padding: 14px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12), 0 1px 2px rgba(16, 24, 40, 0.04);
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 10px;
  min-width: 0;
}

.choice {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  gap: 10px;
  align-items: start;
  min-height: 84px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.choice:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-soft);
}

.choice input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.choice-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid #dbeafe;
  border-radius: 7px;
  color: var(--accent);
  background: #f8fbff;
  font-size: 12px;
  font-weight: 850;
}

.choice-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.choice-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.choice-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
}

.choice-description {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.choice-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: transparent;
  background: #fff;
  font-size: 11px;
  font-weight: 900;
}

.choice:has(input:focus-visible) {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.12);
}

.choice:has(input:checked) .choice-icon {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.choice:has(input:checked) .choice-check {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}

.form-footer {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: calc(100% + 68px);
  margin: 28px -34px 0;
  padding: 14px 34px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.footer-status,
.save-status {
  color: var(--muted);
  font-size: 13px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  min-height: 42px;
  border-radius: var(--radius);
  font-weight: 800;
}

.primary-button {
  padding: 0 16px;
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}

.primary-button:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
  transform: translateY(-1px);
}

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

.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.secondary-button,
.ghost-button {
  padding: 0 15px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  font-size: 20px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.prompt-dialog {
  width: min(980px, calc(100vw - 28px));
  height: min(820px, calc(100vh - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: 0 34px 120px rgba(16, 24, 40, 0.28);
}

.prompt-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  font-size: 28px;
}

#promptOutput {
  display: block;
  width: calc(100% - 44px);
  height: calc(100% - 168px);
  min-height: 360px;
  margin: 22px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.dialog-actions {
  justify-content: flex-end;
  padding: 0 22px 22px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .section-nav {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .workspace {
    min-height: auto;
    padding: 24px 20px 0;
  }

  .topbar,
  .question-form {
    max-width: none;
  }

  h2 {
    font-size: 30px;
  }

  .form-footer {
    width: calc(100% + 40px);
    margin-right: -20px;
    margin-left: -20px;
    padding-right: 20px;
    padding-left: 20px;
  }
}

@media (max-width: 720px) {
  h2 {
    font-size: 26px;
  }

  .topbar,
  .form-footer,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

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

  .ghost-button,
  .primary-button,
  .secondary-button {
    width: 100%;
  }
}
