:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16191d;
  --muted: #5b6470;
  --border: #d6dbe1;
  --accent: #0b6e8a;
  --accent-text: #ffffff;
  --accent-soft: #e3f2f6;
  --error: #b42318;
  --error-soft: #fdecea;
  --ok-soft: #e7f5ec;
  --radius: 12px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1215;
    --surface: #181c21;
    --text: #e7eaee;
    --muted: #9aa4b0;
    --border: #2c333b;
    --accent: #4fb3cf;
    --accent-text: #06232c;
    --accent-soft: #15313a;
    --error: #ff8a80;
    --error-soft: #3a1714;
    --ok-soft: #14301f;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1215;
  --surface: #181c21;
  --text: #e7eaee;
  --muted: #9aa4b0;
  --border: #2c333b;
  --accent: #4fb3cf;
  --accent-text: #06232c;
  --accent-soft: #15313a;
  --error: #ff8a80;
  --error-soft: #3a1714;
  --ok-soft: #14301f;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
}

a {
  color: var(--accent);
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 8px;
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  margin: 0 0 8px;
  font-size: 20px;
}

.intro {
  margin: 0 0 20px;
  color: var(--muted);
}

.notice {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--error-soft);
  color: var(--text);
}

.field label,
.q-prompt {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type="text"],
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

input[type="text"]:focus-visible,
textarea:focus-visible,
button:focus-visible,
.option:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.name-field {
  margin-bottom: 20px;
}

.questions {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: q;
}

.question {
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.question.invalid {
  border-color: var(--error);
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
  width: 100%;
}

.q-num {
  color: var(--accent);
  margin-right: 4px;
}

.q-help {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.q-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.q-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 4px 14px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.q-link:hover,
.q-link:focus-visible {
  text-decoration: underline;
}

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.option input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.comment {
  margin-top: 10px;
}

.comment summary {
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
}

.comment textarea {
  margin-top: 6px;
  min-height: 64px;
}

.counter {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.error {
  margin: 8px 0 0;
  color: var(--error);
  font-size: 14px;
}

.submit-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px calc(-1 * var(--gutter)) 0;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.progress {
  flex: 1;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

button {
  min-height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: progress;
}

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.status {
  min-height: 1.5em;
  margin: 12px 0 0;
  color: var(--error);
}

.done {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--ok-soft);
}

[hidden] {
  display: none !important;
}
