:root {
  --bg:          oklch(0.985 0.003 250);
  --surface:     oklch(1 0 0);
  --ink:         oklch(0.22 0.012 250);
  --ink-muted:   oklch(0.46 0.012 250);
  --accent:      #0065bd;
  --accent-ink:  #003359;
  --accent-soft: #e6f0f9;
  --line:        oklch(0.91 0.005 250);
  --advisor:     oklch(0.968 0.004 250);

  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Georgia, serif;

  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.5rem;
  --step-3: 1.9rem;

  --col: min(100%, 40rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --z-bar: 10;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: var(--col);
  margin-inline: auto;
  padding: 1.5rem 1.25rem 6rem;
}

/* ---------- header and footer ---------- */

.site {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  width: var(--col);
  margin-inline: auto;
  padding: 1rem 1.25rem 0.75rem;
}
.site img { height: 28px; width: auto; }
.site span { font-size: 0.875rem; color: var(--ink-muted); line-height: 1.3; }
.site strong { display: block; color: var(--ink); font-weight: 600; }

footer {
  width: var(--col);
  margin-inline: auto;
  padding: 2rem 1.25rem 3rem;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  border-top: 1px solid var(--line);
}
footer a { color: var(--accent-ink); }

.consent { margin: 0 0 1.5rem; }
.consent p { margin: 0 0 0.875rem; text-wrap: pretty; }

/* ---------- progress ---------- */

.progress {
  position: sticky;
  top: 0;
  z-index: var(--z-bar);
  height: 2px;
  background: var(--line);
  margin: 0 -1.25rem 2rem;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.5s var(--ease);
}

/* ---------- type ---------- */

h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 0.5rem;
}
h1 { font-size: var(--step-3); line-height: 1.2; }
h2 { font-size: var(--step-2); line-height: 1.25; }

.lede {
  color: var(--ink-muted);
  margin: 0 0 2rem;
  text-wrap: pretty;
}

.vignette {
  font-family: var(--serif);
  font-size: var(--step-1);
  line-height: 1.65;
  margin: 0 0 2rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.label {
  display: block;
  font-weight: 600;
  margin: 0 0 0.75rem;
  text-wrap: pretty;
}

.note {
  font-size: 0.9375rem;
  color: var(--ink-muted);
  text-wrap: pretty;
}

/* ---------- chat ---------- */

.thread { display: flex; flex-direction: column; gap: 1.25rem; margin-bottom: 2rem; }
.snippets { gap: 0.75rem; margin-bottom: 2.5rem; }
.snippets .msg.dim { opacity: 0.38; }
.snippets .origin { display: none; }
.snippets.marked .msg:not(.dim) .bubble { border: 1.5px solid var(--accent); }

.msg { max-width: 88%; }
.msg[data-from="participant"] { align-self: flex-end; }

.who {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin: 0 0 0.375rem 0.125rem;
}
.msg[data-from="participant"] .who { text-align: right; }

.bubble {
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.6;
  padding: 0.875rem 1.125rem;
  border-radius: 14px;
  background: var(--advisor);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  text-wrap: pretty;
}
.msg[data-from="participant"] .bubble {
  background: var(--accent-soft);
  border-color: transparent;
  font-family: var(--sans);
}
.bubble.summary { background: var(--surface); border-color: var(--accent); }

.origin {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6875rem;
  color: var(--ink-muted);
  margin: 0.375rem 0 0 0.125rem;
}

.enter { animation: rise 0.32s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

.typing { display: flex; gap: 5px; padding: 1.125rem; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink-muted); opacity: 0.5;
  animation: pulse 1.2s var(--ease) infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pulse { 50% { opacity: 1; transform: translateY(-3px); } }

/* ---------- transcript disclosure ---------- */

details.verlauf { margin: -0.5rem 0 2rem; }
details.verlauf summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--accent-ink);
  padding: 0.5rem 0;
  list-style: none;
}
details.verlauf summary::-webkit-details-marker { display: none; }
details.verlauf summary::before { content: "+"; font-size: 1.1em; line-height: 1; }
details.verlauf[open] summary::before { content: "\2212"; }
details.verlauf .thread { margin: 1rem 0 0; }

/* ---------- rating scale ---------- */

fieldset { border: 0; margin: 0 0 2rem; padding: 0; }
legend { padding: 0; }

.item { padding: 1.125rem 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item p { margin: 0 0 0.875rem; text-wrap: pretty; }

.scale {
  display: grid;
  grid-template-columns: repeat(var(--n, 5), 1fr);
  gap: 0.375rem;
}
.scale[style*="--n:8"] label, .scale[style*="--n:9"] label, .scale[style*="--n:10"] label { font-size: 0.8125rem; min-height: 40px; border-radius: 8px; }
.scale[style*="--n:8"], .scale[style*="--n:9"], .scale[style*="--n:10"] { gap: 0.25rem; }
label.extra {
  position: relative;
  display: block;
  margin-top: 0.375rem;
  padding: 0.5rem 0.75rem;
  border: 1px dashed var(--line);
  border-radius: 10px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--ink-muted);
  cursor: pointer;
}
label.extra input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
label.extra:has(input:checked) { border-style: solid; border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.scale label {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9375rem;
  color: var(--ink-muted);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.scale input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.scale label:hover { background: var(--advisor); }
.scale label:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
  font-weight: 600;
}
.scale label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.range { display: grid; grid-template-columns: 1fr 3ch; align-items: center; gap: 1rem; }
.range input {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.range input:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.range output { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-muted); }
.slider .anchors { margin-top: 0.25rem; }

.anchors {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--ink-muted);
  margin-top: 0.5rem;
}

/* ---------- choices ---------- */

.choices { display: flex; flex-direction: column; gap: 0.625rem; margin-bottom: 2rem; }
.choices label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 52px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  text-wrap: pretty;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.choices input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choices label::before {
  content: "";
  flex: 0 0 auto;
  width: 18px; height: 18px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
}
.choices label:hover { background: var(--advisor); }
.choices label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choices label:has(input:checked)::before {
  border-color: var(--accent);
  border-width: 5px;
}
.choices label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.words { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 2rem; }
.words label {
  position: relative;
  padding: 0.5rem 0.875rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  font-size: 0.9375rem;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease);
}
.words input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.words label:has(input:checked) {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
  font-weight: 600;
}
.words label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- input ---------- */

textarea {
  width: 100%;
  min-height: 96px;
  padding: 0.875rem 1rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: vertical;
}
textarea::placeholder { color: var(--ink-muted); }
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.field {
  width: 100%;
  min-height: 52px;
  padding: 0 1rem;
  margin: 0 0 2rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.field:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }

.composer { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.875rem; }
.composer .label { margin: 0; }
.hint { margin: 0; font-size: 0.9375rem; color: var(--ink-muted); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  width: 100%;
  padding: 0 1.5rem;
  font: inherit;
  font-weight: 600;
  color: var(--surface);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.btn:hover:not(:disabled) { background: var(--accent-ink); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--step-2);
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 1.25rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 2rem;
}

/* ---------- demo banner ---------- */

.demo {
  font-size: 0.8125rem;
  color: var(--ink-muted);
  text-align: center;
  padding: 0.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

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

.source { margin: 0 0 0.25rem; }
.source a { color: var(--accent); }
