:root {
  color-scheme: light;
  --bg: #f4f1eb;
  --ink: #24312c;
  --muted: #5c6b64;
  --card: #fffcf8;
  --line: #e2dbd1;
  --accent: #2f6f5e;
  --accent-ink: #f7fffc;
  --flag: #8a4b2f;
  --flag-bg: #f8efe8;
  --hold: #6b3a3a;
  --hold-bg: #f8eeee;
  --focus: #1d4e42;
  --accent-soft: #8fb5a9;
  --selected: #e8f2ee;
  --scene: #ece6db;
  --scene-line: #e0d7c8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 1.05rem;
  line-height: 1.5;
}

a { color: var(--accent); }
a:hover { text-decoration: none; }

.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  background: var(--card);
  padding: 0.4rem 0.7rem;
}
.skip:focus { top: 0.5rem; }

header, main { width: min(40rem, calc(100% - 2rem)); margin: 0 auto; }
header { padding: 1.25rem 0 0.5rem; display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; }
.lang { display: flex; gap: 0.75rem; }
.lang a[aria-current="true"] { font-weight: 600; text-decoration: underline; text-underline-offset: 0.25rem; }
main { padding-bottom: 3rem; }

nav { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; font-size: 0.95rem; }
nav a { text-decoration: none; }
nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 0.25rem; }

h1, h2, h3 {
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h1 { font-size: 2rem; margin: 0.2rem 0 0.6rem; }
h2 { font-size: 1.35rem; margin: 0 0 0.4rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1.1rem;
  padding: 1.1rem 1.15rem 1.25rem;
  margin: 1rem 0;
}

/* Question pages: progress bar, eyebrow, scene card, title, option cards. */
.qhead { margin: 0.4rem 0 1rem; }
.bar { display: flex; gap: 0.3rem; }
.bar span {
  flex: 1;
  height: 0.45rem;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}
.bar span:first-child i { min-width: 0.45rem; }
.eyebrow, .progress {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0.7rem 0 0;
}

.scene {
  background: var(--scene);
  border: 1px solid var(--scene-line);
  border-radius: 1.1rem;
  padding: 1rem 1.15rem;
  margin: 0 0 1.3rem;
}
.scene .situation, .situation { color: var(--ink); margin: 0; font-size: 1.08rem; }

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
legend, .qtitle {
  display: block;
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 0.9rem;
  padding: 0;
}

.choices { display: grid; gap: 0.6rem; }
.choice {
  position: relative;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
  min-height: 3.4rem;
  padding: 0.9rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: 0.9rem;
  background: var(--card);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.choice input {
  margin: 0.2rem 0 0;
  width: 1.2rem;
  height: 1.2rem;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.choice:hover { border-color: var(--accent-soft); background: #fff; }
.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--selected);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice input:focus-visible { outline: none; }
.choice.unknown {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  min-height: 0;
}
.choice.unknown:has(input:checked) { color: var(--ink); border-style: solid; }

.qform .actions { margin-top: 1.3rem; }
.qform button.primary { min-width: 11rem; }
form.back { margin-top: 0.6rem; }
form.back button.link::before { content: "\2190\00a0"; }

button, .button {
  display: inline-block;
  min-height: 3rem;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
button:hover, .button:hover { background: var(--focus); }
button:disabled, button:disabled:hover {
  background: #c9d3cf;
  color: #4a5753;
  cursor: not-allowed;
}
button.secondary, a.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}
button.secondary:hover, a.secondary:hover { background: var(--card); }
button.link, a.quiet {
  background: none;
  border: 0;
  min-height: 2.75rem;
  padding: 0.5rem 0.2rem;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 0.2rem;
}
button.link:hover, a.quiet:hover { background: none; color: var(--ink); }
.actions a.quiet { align-self: center; }
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1rem; }

.flag { background: var(--flag-bg); border-color: #efd8cc; }
.flag h2 { color: var(--flag); }
.hold { background: var(--hold-bg); border-color: #efd0d0; }
.hold h2, .hold p { color: var(--hold); }
.hold p, .prose { white-space: pre-wrap; }

label.consent { display: flex; gap: 0.7rem; align-items: flex-start; }
input[type="text"] {
  width: 100%;
  min-height: 3rem;
  border-radius: 0.7rem;
  border: 1px solid var(--line);
  padding: 0.5rem 0.7rem;
  font: inherit;
  background: #fff;
}
.muted { color: var(--muted); }
.codebox {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 0.8rem 1rem;
  color: var(--muted);
}
.codebox code { color: var(--ink); }
.notice { background: #fff6e0; border: 1px solid #ecd9a6; border-radius: 10px; padding: 0.7rem 0.9rem; }
.hint { margin: -0.3rem 0 0.8rem; font-size: 0.95rem; }
code { font-size: 0.92em; overflow-wrap: anywhere; word-break: break-all; }

/* A cheap fade as each page arrives. */
main { animation: mm-fade 0.22s ease-out both; }
@keyframes mm-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  main, .bar i, .choice { animation: none; transition: none; }
}

@media (max-width: 40rem) {
  h1 { font-size: 1.7rem; }
  header, main { width: min(40rem, calc(100% - 1.6rem)); }
  legend, .qtitle { font-size: 1.35rem; }
  .qform button.primary { width: 100%; }
}
