:root {
  --bg: #FAF7F2;
  --card: #FFFFFF;
  --text: #2E3742;
  --text-2: #56606C;
  --muted: #7A8390;
  --line: #E3DCD1;
  --line-soft: #EFE9DF;
  --accent: #3F6B60;
  --accent-line: #B9C9C3;
  --accent-soft: #EEF3F1;
  --serif: Newsreader, "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Source Sans 3", "Gill Sans", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 2.35rem; line-height: 1.08; letter-spacing: -0.015em; text-wrap: pretty; }
h2 { font-size: 1.9rem; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
.deck { font-size: 18px; color: var(--text-2); text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.note { font-size: 13px; color: var(--muted); }
.center { text-align: center; }
.label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.label.accent { color: var(--accent); }

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.bar.flush { border-bottom: 0; }
.wordmark { font-family: var(--serif); font-size: 19px; font-weight: 500; color: var(--text); }
.bar-right { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.bar-right.count { letter-spacing: 0.06em; text-transform: none; font-size: 13px; }

.progress { height: 3px; background: var(--line); }
.progress > div { height: 3px; background: var(--accent); transition: width 220ms ease; }

.stack { display: flex; flex-direction: column; }
.pad { padding: 0 24px; }
.hero { gap: 14px; padding: 36px 24px 8px; }
.actions { gap: 10px; padding: 18px 24px 8px; }
.section { gap: 10px; margin: 28px 24px 0; padding-top: 24px; border-top: 1px solid var(--line); }
.section.first { margin-top: 32px; }
.grow { flex-grow: 1; }
.footer { display: flex; flex-direction: column; gap: 6px; padding: 32px 24px 28px; font-size: 13px; color: var(--muted); }
.footer .links { display: flex; gap: 16px; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.secondary { background: transparent; border-color: var(--accent-line); color: var(--accent); }
.btn.outline { background: transparent; color: var(--accent); }
.btn.quiet { background: transparent; border-color: transparent; color: var(--muted); min-height: 48px; }
.btn.compact { width: auto; min-height: 48px; min-width: 120px; padding: 0 22px; font-size: 16px; }
.btn.text { width: auto; min-height: 48px; padding: 0 12px; background: transparent; border-color: transparent; color: var(--muted); font-size: 16px; }

label { display: block; font-size: 15px; color: var(--muted); margin: 18px 0 6px; }
input[type="text"] {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }
input.code { font-family: var(--serif); font-size: 28px; letter-spacing: 0.22em; text-transform: uppercase; text-align: center; }

.panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 28px 24px 0;
  padding: 22px 22px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.panel p { font-size: 15px; color: var(--text-2); }
.code-display {
  font-family: var(--serif);
  font-size: 40px;
  letter-spacing: 0.2em;
  text-align: center;
  padding: 6px 0 2px 0.2em;
  color: var(--text);
}

.steps { gap: 18px; }
.step { display: flex; gap: 16px; align-items: flex-start; }
.step .num {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--accent); color: var(--accent);
  font-family: var(--serif); font-size: 16px;
}
.step strong { display: block; font-weight: 600; }
.step span { display: block; font-size: 15px; color: var(--text-2); }

.qtext { font-size: 27px; line-height: 1.25; }
.choices { gap: 10px; }
.choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 14px 16px;
  font: inherit;
  font-size: 17px;
  line-height: 1.4;
  text-align: left;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.choice:hover { border-color: #CFC5B7; }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 0.5px var(--accent); }
.choice svg { flex-shrink: 0; visibility: hidden; }
.choice.selected svg { visibility: visible; }
.nav { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }

.item { display: flex; flex-direction: column; gap: 4px; padding: 14px 0; border-top: 1px solid var(--line-soft); }
.item:first-of-type { border-top: 0; }
.item h3 { font-size: 20px; }
.item p { font-size: 16px; color: var(--text-2); }
.item .k { font-size: 13px; color: var(--muted); }
.item .v { font-size: 16px; color: var(--text); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.section .body p { color: var(--text); }
.prompt {
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.4;
  text-wrap: pretty;
}
.error { color: var(--text); background: #F3ECE2; border: 1px solid #E3D6C4; border-radius: 8px; padding: 12px 14px; margin: 16px 24px 0; font-size: 15px; }
.spinner { padding: 36px 24px; color: var(--muted); font-size: 15px; }
