@font-face {
  font-family: "Unbounded";
  src: url("assets/unbounded-variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
}

:root {
  --ink: #1f2b24;
  --muted: #59685f;
  --paper: #f1eee5;
  --surface: #fffdf8;
  --line: #cbd2ca;
  --line-strong: #adb9b0;
  --sage: #2f6b50;
  --sage-dark: #234e3b;
  --sage-soft: #d9e9df;
  --ochre: #a7652f;
  --ochre-soft: #f1e3cf;
  --error: #a13d35;
  --focus: #1f5f8f;
  --shadow: 0 18px 48px rgba(31, 58, 43, 0.12);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  color-scheme: light;
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Unbounded", ui-sans-serif, system-ui, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
textarea,
input { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
}

.skip-link:focus { transform: translateY(0); }

button:focus-visible,
textarea:focus-visible,
input:focus-visible + span,
a:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 34%, transparent);
  outline-offset: 3px;
}

main { min-height: 100vh; min-height: 100dvh; }

.view {
  width: min(100%, 940px);
  margin: 0 auto;
  padding: clamp(38px, 8vw, 84px) clamp(20px, 5vw, 48px) max(42px, env(safe-area-inset-bottom));
}

.intro-view { position: relative; }

.intro-number {
  position: absolute;
  top: clamp(30px, 7vw, 67px);
  right: clamp(20px, 5vw, 48px);
  color: #b87943;
  font-size: clamp(34px, 6vw, 58px);
  font-weight: 500;
  line-height: 1;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--sage);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.5;
  text-transform: uppercase;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 22px;
  font-size: clamp(30px, 6.5vw, 58px);
  font-weight: 620;
  letter-spacing: -0.045em;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

.lead {
  max-width: 730px;
  margin-bottom: 36px;
  color: #43534a;
  font-size: clamp(14px, 2.2vw, 17px);
  font-weight: 400;
  line-height: 1.72;
}

.intro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(34px, 7vw, 72px);
}

.info-card {
  padding: 22px 0 4px;
  border: 0;
  border-top: 2px solid var(--sage);
  border-radius: 0;
  background: transparent;
}

.info-card:nth-child(2) {
  border-top-color: var(--ochre);
  background: transparent;
}

.info-card:nth-child(2) h2 { color: #603b20; }
.info-card:nth-child(2) .plain-list li::before { background: var(--ochre); }

.info-card h2,
.time-notice h2,
.export-card h2 {
  margin-bottom: 15px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.plain-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.plain-list li {
  position: relative;
  padding-left: 19px;
  color: #43534a;
  font-size: 12px;
  line-height: 1.7;
}

.plain-list li + li { margin-top: 10px; }

.plain-list li::before {
  content: "";
  position: absolute;
  top: 0.72em;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
}

.time-notice {
  margin-top: clamp(30px, 6vw, 52px);
  padding: 24px 0 0;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border: 0;
  border-top: 1px solid #91b09d;
  border-radius: 0;
  background: transparent;
}

.notice-mark {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 3px;
  border: 3px solid var(--sage);
  border-radius: 50%;
}

.time-notice h2 { margin-bottom: 8px; }

.time-notice p,
.privacy-copy {
  margin-bottom: 0;
  color: #465a4e;
  font-size: 11px;
  line-height: 1.72;
}

.privacy-copy {
  margin: 20px auto 14px;
  text-align: center;
}

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 56px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--sage);
  color: #fff;
  background: var(--sage);
  box-shadow: 0 8px 20px rgba(35, 78, 59, 0.22);
}

.primary-button:hover { background: var(--sage-dark); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: not-allowed; opacity: 0.58; }

.start-button { max-width: 420px; margin: 0 auto; }

.secondary-button {
  margin-top: 10px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: transparent;
}

.secondary-button:hover { background: var(--ochre-soft); }

.status-message {
  margin: 14px 0 0;
  color: var(--sage-dark);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.test-bar {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(225, 235, 227, 0.97);
  backdrop-filter: blur(12px);
}

.bar-inner {
  width: min(100%, 800px);
  min-height: 76px;
  margin: 0 auto;
  padding: 13px clamp(18px, 4vw, 28px);
  display: flex;
  align-items: center;
  gap: clamp(20px, 6vw, 56px);
}

.progress-block { min-width: 0; flex: 1 1 auto; }

.progress-copy {
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.3;
}

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

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

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--sage);
  transition: width 220ms ease;
}

.timer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.timer strong {
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.timer-dot {
  width: 8px;
  height: 8px;
  border: 2px solid var(--ochre);
  border-radius: 50%;
}

.question-view {
  width: min(100%, 800px);
  padding-top: clamp(32px, 6vw, 58px);
}

.question-panel {
  padding: clamp(24px, 6vw, 48px);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.question-toolbar {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.back-button {
  min-height: 44px;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 0;
  color: var(--sage-dark);
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.back-button:hover { color: var(--ink); }
.back-button span[aria-hidden="true"] { font-size: 17px; }

.stage-label {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 9px;
}

.stage-label strong {
  padding: 0;
  border-radius: 0;
  color: #71431f;
  background: transparent;
  font-size: 9px;
  white-space: nowrap;
}

.question-panel h1 {
  margin-bottom: 28px;
  font-size: clamp(27px, 5vw, 40px);
}

.question-copy {
  color: #2d3d34;
  font-size: clamp(13px, 2.1vw, 15px);
  font-weight: 400;
  line-height: 1.82;
  overflow-wrap: anywhere;
}

.question-copy p { margin: 0; }
.question-copy p + p { margin-top: 15px; }
.question-copy p:last-child { font-weight: 650; }

.locked-note {
  margin-top: 24px;
  padding: 5px 0 5px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border-left: 3px solid #79a088;
  border-radius: 0;
  color: #4f5e55;
  background: transparent;
  font-size: 10px;
  line-height: 1.55;
}

.locked-check { color: var(--sage-dark); font-weight: 800; }

#answer-form { margin-top: 34px; }

.answer-field > label,
.confidence-field legend {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

textarea {
  display: block;
  width: 100%;
  min-height: 190px;
  padding: 16px;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  background: #fffefb;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
}

textarea::placeholder { color: #8b948e; }

textarea:hover { border-color: #9ea8a1; }

textarea:focus {
  border-color: var(--sage);
  outline: 3px solid rgba(72, 105, 89, 0.14);
}

textarea[aria-invalid="true"] { border-color: var(--error); }

textarea:disabled {
  border-color: var(--line);
  color: #4f5852;
  background: #e7ebe5;
  cursor: default;
  opacity: 1;
  -webkit-text-fill-color: #4f5852;
}

.field-meta {
  margin-top: 7px;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.confidence-field {
  min-width: 0;
  margin: 31px 0 0;
  padding: 0;
  border: 0;
}

.confidence-help {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.6;
}

.confidence-options {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.confidence-options label { min-width: 0; cursor: pointer; }

.confidence-options input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.confidence-options span {
  min-width: 0;
  min-height: 52px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: #49514c;
  background: #fffefb;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.confidence-options label:hover span { border-color: var(--sage); }

.confidence-options input:checked + span {
  border-color: var(--sage);
  color: #fff;
  background: var(--sage);
}

.confidence-options input:disabled + span { cursor: default; opacity: 0.76; }
.confidence-options input:checked:disabled + span { opacity: 1; }

.confidence-ends {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
}

.form-error {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-left: 3px solid var(--error);
  color: #762f2a;
  background: #f8eae8;
  font-size: 10px;
  line-height: 1.55;
}

.continue-button { margin-top: 25px; }

.reset-button {
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  padding: 8px 14px;
  border: 0;
  border-radius: 10px;
  color: #7b3932;
  background: transparent;
  font-size: 9px;
  font-weight: 650;
  line-height: 1.5;
  text-decoration: underline;
  text-decoration-color: rgba(123, 57, 50, 0.4);
  text-underline-offset: 4px;
  cursor: pointer;
}

.reset-button:hover { background: #f2dfdc; }
.completion-reset { margin-top: 24px; }

.completion-view {
  width: min(100%, 700px);
  padding-top: clamp(48px, 9vw, 92px);
}

.completion-mark {
  width: 68px;
  height: 68px;
  margin-bottom: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ochre-soft);
}

.completion-mark span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid #91a699;
  border-radius: 50%;
  color: var(--sage-dark);
  font-size: 18px;
  font-weight: 700;
}

.completion-view h1 { margin-bottom: 12px; }

.result-meta {
  margin: 30px 0;
  border-top: 1px solid var(--line);
}

.result-meta div {
  padding: 15px 0;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

.result-meta dt,
.result-meta dd {
  font-size: 11px;
  line-height: 1.5;
}

.result-meta dt { color: var(--muted); }
.result-meta dd { margin: 0; font-weight: 700; text-align: right; }

.export-card {
  padding: 26px 0 0;
  border: 0;
  border-top: 2px solid var(--sage);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.export-card p {
  margin-bottom: 22px;
  color: #536059;
  font-size: 10px;
  line-height: 1.72;
}

.export-card .file-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 8px;
  text-align: center;
}

.noscript-message {
  position: fixed;
  z-index: 200;
  right: 16px;
  bottom: 16px;
  left: 16px;
  padding: 18px;
  border: 1px solid #d7a7a2;
  border-radius: 12px;
  color: #702d28;
  background: #fff0ee;
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 680px) {
  .view { padding-right: 18px; padding-left: 18px; }
  .intro-number { right: 18px; }
  .intro-grid { grid-template-columns: 1fr; }
  .bar-inner { min-height: 70px; gap: 18px; }
  .progress-copy { font-size: 9px; }
  .timer > span:not(.timer-dot) { display: none; }
  .question-view { padding: 18px 0 max(24px, env(safe-area-inset-bottom)); }
  .question-panel { padding: 25px 18px 20px; }
  .question-toolbar { align-items: center; }
  .stage-label { justify-content: space-between; }
  .continue-button {
    position: sticky;
    bottom: max(10px, env(safe-area-inset-bottom));
    z-index: 8;
    box-shadow: 0 10px 26px rgba(55, 84, 70, 0.24);
  }
}

@media (max-width: 390px) {
  .intro-number { font-size: 32px; }
  h1 { padding-right: 32px; font-size: 29px; }
  .question-panel h1 { padding-right: 0; font-size: 26px; }
  .lead { font-size: 13px; }
  .info-card { padding: 19px 0 4px; }
  .confidence-options { gap: 7px; }
  .confidence-options span { min-height: 50px; }
  .result-meta div { display: block; }
  .result-meta dd { margin-top: 5px; text-align: left; }
}

@media (max-width: 340px) {
  .view { padding-right: 15px; padding-left: 15px; }
  .intro-number { display: none; }
  h1 { padding-right: 0; font-size: 27px; }
  .bar-inner { padding-right: 14px; padding-left: 14px; }
  .question-panel { padding-right: 15px; padding-left: 15px; }
  .confidence-ends { font-size: 7px; }
}

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

@media print {
  .test-bar, .primary-button, .secondary-button { display: none !important; }
  body { background: #fff; }
  .view { padding: 24px; }
}
