:root {
  --ink: #171915;
  --muted: #666b63;
  --soft: #f4f6f2;
  --paper: #ffffff;
  --page: #f7f8f5;
  --line: #d9ddd5;
  --line-strong: #b7bdb3;
  --green: #397552;
  --green-soft: #e8f2eb;
  --blue: #2c5cc5;
  --blue-soft: #e8eefb;
  --coral: #c94d3c;
  --coral-soft: #f8e8e4;
  --focus: #205fd4;
  --shadow: 0 1px 2px rgba(18, 28, 21, 0.05), 0 10px 28px rgba(18, 28, 21, 0.05);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--page);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: rgba(247, 248, 245, 0.92);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
}

button,
select,
textarea,
input {
  font: inherit;
  letter-spacing: 0;
}

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

button,
select {
  min-height: 42px;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible + span {
  outline: 3px solid rgba(32, 95, 212, 0.24);
  outline-offset: 2px;
}

#line-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 248, 245, 0.88);
  border-bottom: 1px solid rgba(184, 190, 180, 0.68);
  backdrop-filter: blur(18px) saturate(130%);
}

.header-inner {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 320px) minmax(180px, 1fr);
  align-items: center;
  gap: 28px;
  width: min(1120px, calc(100% - 48px));
  min-height: 76px;
  margin: 0 auto;
}

.survey-identity {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.survey-mark {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
}

.survey-mark i {
  position: absolute;
  display: block;
  width: 26px;
  height: 2px;
  border-radius: 1px;
  transform-origin: left center;
}

.survey-mark i:nth-child(1) {
  top: 8px;
  left: 4px;
  background: var(--green);
  transform: rotate(18deg);
}

.survey-mark i:nth-child(2) {
  top: 17px;
  left: 3px;
  background: var(--blue);
  transform: rotate(-12deg);
}

.survey-mark i:nth-child(3) {
  top: 25px;
  left: 7px;
  background: var(--coral);
  transform: rotate(10deg);
}

.identity-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.identity-copy strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-copy span {
  color: var(--muted);
  font-size: 12px;
}

.header-progress progress {
  display: block;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border: 0;
  border-radius: 2px;
  background: #e2e5df;
  color: var(--green);
}

.header-progress progress::-webkit-progress-bar {
  background: #e2e5df;
}

.header-progress progress::-webkit-progress-value {
  background: var(--green);
  transition: width 360ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.header-progress progress::-moz-progress-bar {
  background: var(--green);
}

.header-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 12px;
}

.language-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.language-cue {
  display: flex;
  align-items: baseline;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.language-cue b {
  color: var(--blue);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
}

.language-picker select {
  max-width: 180px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  cursor: pointer;
}

.offline-status {
  color: var(--coral);
  font-size: 12px;
  font-weight: 650;
}

.survey-main {
  width: min(920px, calc(100% - 48px));
  min-height: calc(100dvh - 154px);
  margin: 0 auto;
  padding: 76px 0 132px;
  outline: none;
}

.step-enter {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms ease, transform 300ms ease;
}

.step-enter.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.step-heading {
  max-width: 760px;
  margin-bottom: 42px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.step-heading h1,
.terminal-view h1 {
  max-width: 760px;
  margin: 0;
  font-size: 46px;
  font-weight: 630;
  line-height: 1.08;
  text-wrap: balance;
}

.step-description,
.terminal-body {
  max-width: 680px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.55;
  text-wrap: pretty;
}

.notice-panel {
  margin: 0 0 28px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.notice-topline {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 24px;
  align-items: start;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.notice-topline h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.3;
}

.notice-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px 16px;
  color: var(--muted);
  font-size: 13px;
}

.notice-meta span + span::before {
  margin-right: 16px;
  color: var(--line-strong);
  content: "·";
}

.notice-copy {
  padding-top: 8px;
}

.notice-copy p {
  margin: 16px 0 0;
  color: #3f433d;
  line-height: 1.7;
  text-wrap: pretty;
}

.question-stack {
  display: grid;
  gap: 18px;
}

.question-block,
.matrix-block {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 2px rgba(18, 28, 21, 0.04);
}

.question-header,
.matrix-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.question-header h2,
.matrix-heading h2 {
  max-width: 680px;
  margin: 5px 0 0;
  font-size: 20px;
  font-weight: 620;
  line-height: 1.45;
  text-wrap: pretty;
}

.question-id {
  color: var(--blue);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
}

.question-guidance {
  flex: 0 0 auto;
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
}

.question-guidance.is-required {
  color: var(--coral);
  font-weight: 700;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-tile {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 54px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 120ms ease;
}

.choice-tile:hover {
  border-color: var(--line-strong);
  background: var(--soft);
}

.choice-tile:active {
  transform: scale(0.985);
}

.choice-tile:has(input:checked) {
  border-color: var(--green);
  background: var(--green-soft);
}

.choice-tile.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.choice-tile input,
.scale-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-indicator {
  display: grid;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
}

input[type="checkbox"] + .choice-indicator {
  border-radius: 4px;
}

.choice-tile input:checked + .choice-indicator {
  border-color: var(--green);
  background: var(--green);
}

.choice-tile input:checked + .choice-indicator::after {
  width: 7px;
  height: 4px;
  border-bottom: 2px solid white;
  border-left: 2px solid white;
  content: "";
  transform: translateY(-1px) rotate(-45deg);
}

input[type="radio"]:checked + .choice-indicator::after {
  width: 6px;
  height: 6px;
  border: 0;
  border-radius: 50%;
  background: white;
  transform: none;
}

.choice-label {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.4;
}

.selection-count,
.character-count {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.text-question textarea {
  display: block;
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.text-question textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(44, 92, 197, 0.12);
  outline: none;
}

.scenario-note {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
  padding: 20px 22px;
  border-left: 3px solid var(--blue);
  background: rgba(232, 238, 251, 0.84);
}

.scenario-note span {
  color: var(--blue);
}

.scenario-note p {
  margin: 0;
  color: #35466d;
  line-height: 1.65;
}

.scale-legend {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 18px;
  margin: 0 0 24px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.scale-legend li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.scale-legend b {
  color: var(--ink);
}

.matrix-rows {
  display: grid;
  gap: 0;
}

.matrix-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 0.75fr);
  gap: 20px 28px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid #e7e9e4;
}

.matrix-row:last-child {
  border-bottom: 0;
}

.matrix-prompt {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.matrix-prompt span {
  padding-top: 2px;
  color: var(--blue);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
}

.matrix-prompt p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}

.scale-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(40px, 1fr));
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.scale-option {
  position: relative;
  display: grid;
  min-width: 40px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease, transform 120ms ease;
}

.scale-option:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.scale-option:active {
  transform: scale(0.96);
}

.scale-option:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue);
  color: white;
}

.selected-scale-label {
  grid-column: 2;
  min-height: 17px;
  margin: -14px 0 0;
  color: var(--blue);
  font-size: 12px;
  text-align: right;
}

.form-error {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--coral);
  background: var(--coral-soft);
  color: #7d2d22;
  font-weight: 620;
}

.review-intro {
  max-width: 660px;
  color: var(--muted);
  font-size: 17px;
}

.review-summary {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 32px 0;
}

.review-summary strong {
  font-size: 56px;
  font-weight: 560;
  line-height: 1;
}

.review-summary span {
  color: var(--muted);
  font-size: 18px;
}

.review-list {
  border-top: 1px solid var(--line-strong);
}

.review-section {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.review-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}

.review-section-heading h2 {
  margin: 0;
  font-size: 21px;
}

.text-button {
  min-height: 40px;
  padding: 6px 2px;
  background: transparent;
  color: var(--blue);
  font-weight: 650;
}

.text-button:hover {
  color: #183f96;
}

.review-answers {
  display: grid;
  gap: 17px;
}

.review-answer {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(220px, 0.8fr);
  gap: 28px;
}

.review-answer p,
.review-answer strong {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.review-answer p {
  color: var(--muted);
}

.review-answer p span {
  margin-right: 9px;
  color: var(--blue);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 11px;
}

.review-answer strong {
  overflow-wrap: anywhere;
  font-weight: 590;
  white-space: pre-wrap;
}

.terminal-view {
  max-width: 760px;
  padding-top: 54px;
}

.terminal-symbol {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin-bottom: 28px;
  border: 1px solid var(--green);
  border-radius: 50%;
  color: var(--green);
  font-size: 26px;
  font-weight: 650;
}

.terminal-view.failure .terminal-symbol {
  border-color: var(--coral);
  color: var(--coral);
}

.terminal-view.declined .terminal-symbol {
  border-color: var(--muted);
  color: var(--muted);
}

.submission-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 30px;
  color: var(--green);
  font-weight: 650;
}

.submission-status span {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  font-size: 12px;
}

.terminal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.download-hint,
.finish-copy {
  max-width: 640px;
  color: var(--muted);
  font-size: 13px;
}

.finish-copy {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  line-height: 1.6;
}

.action-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  border-top: 1px solid rgba(184, 190, 180, 0.72);
  background: rgba(247, 248, 245, 0.9);
  backdrop-filter: blur(18px) saturate(130%);
}

.action-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(920px, calc(100% - 48px));
  min-height: 78px;
  margin: 0 auto;
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
}

.draft-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.draft-status span {
  color: var(--green);
}

.navigation-actions {
  display: flex;
  gap: 9px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 650;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease, transform 120ms ease;
}

.primary-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
}

.primary-button:hover:not(:disabled) {
  border-color: var(--green);
  background: var(--green);
}

.secondary-button {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: white;
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: scale(0.96);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.42;
}

.button-icon {
  font-size: 17px;
  line-height: 1;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

noscript {
  position: fixed;
  inset: 20px;
  z-index: 99;
  padding: 20px;
  background: white;
  color: var(--ink);
}

@media (max-width: 820px) {
  .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    width: min(100% - 28px, 920px);
  }

  .header-progress {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
  }

  .header-progress progress {
    height: 3px;
    border-radius: 0;
  }

  .offline-status,
  .identity-copy span {
    display: none;
  }

  .survey-main {
    width: min(100% - 32px, 920px);
    padding-top: 54px;
  }

  .step-heading h1,
  .terminal-view h1 {
    font-size: 38px;
  }

  .notice-topline {
    grid-template-columns: 1fr;
  }

  .notice-meta {
    justify-content: flex-start;
  }

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

  .matrix-row {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .selected-scale-label {
    grid-column: 1;
    margin-top: -6px;
    text-align: left;
  }

  .review-answer {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

@media (max-width: 560px) {
  .header-inner {
    min-height: 68px;
  }

  .survey-mark {
    width: 28px;
    height: 30px;
  }

  .survey-mark i {
    width: 22px;
  }

  .identity-copy strong {
    max-width: 145px;
    font-size: 13px;
  }

  .language-picker select {
    width: 112px;
    min-height: 40px;
    padding-left: 9px;
    font-size: 13px;
  }

  .language-cue span {
    display: none;
  }

  .language-picker {
    gap: 7px;
  }

  .survey-main {
    width: min(100% - 24px, 920px);
    padding: 44px 0 144px;
  }

  .step-heading {
    margin-bottom: 30px;
  }

  .step-heading h1,
  .terminal-view h1 {
    font-size: 34px;
    line-height: 1.12;
  }

  .step-description,
  .terminal-body {
    font-size: 17px;
  }

  .notice-panel,
  .question-block,
  .matrix-block {
    padding: 20px 17px;
  }

  .notice-meta {
    display: grid;
    gap: 4px;
  }

  .notice-meta span + span::before {
    margin: 0;
    content: none;
  }

  .question-header,
  .matrix-heading {
    display: grid;
    gap: 8px;
  }

  .question-guidance {
    max-width: none;
    text-align: left;
  }

  .scale-legend {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .scale-controls {
    grid-template-columns: repeat(3, minmax(48px, 1fr));
  }

  .matrix-prompt {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .action-inner {
    width: min(100% - 24px, 920px);
  }

  .draft-status {
    display: none;
  }

  .navigation-actions {
    width: 100%;
  }

  .navigation-actions .primary-button {
    flex: 1;
  }

  .primary-button,
  .secondary-button {
    min-height: 48px;
  }
}

@media (max-width: 380px) {
  .identity-copy strong {
    max-width: 95px;
  }

  .language-picker select {
    width: 86px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
