:root {
  --bg: #f6f4ee;
  --card: #ffffff;
  --ink: #17231f;
  --muted: #56625c;
  --line: #dad6cb;
  --accent: #0e5a4a;
  --accent-ink: #ffffff;
  --accent-soft: #e3efea;
  --warn-bg: #fbf1da;
  --warn-ink: #5b4100;
  --err-bg: #fde8e8;
  --err-ink: #8a1c1c;
  --radius: 14px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101713;
    --card: #17211c;
    --ink: #e9efeb;
    --muted: #9fb0a7;
    --line: #2b3a33;
    --accent: #6fc2ac;
    --accent-ink: #0a1511;
    --accent-soft: #1d2f28;
    --warn-bg: #3a2f10;
    --warn-ink: #f2d58a;
    --err-bg: #3d1b1b;
    --err-ink: #f4b4b4;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }
[hidden] { display: none !important; }
h1 { font-size: 1.7rem; margin: 0 0 6px; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; margin: 0 0 6px; outline: none; }
h3 { font-size: 1rem; margin: 0; }
.lead { color: var(--muted); margin: 0 0 20px; max-width: 70ch; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.eyebrow { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { font: inherit; font-size: 0.85rem; font-weight: 600; background: transparent; color: var(--ink); border: 0; padding: 6px 12px; min-height: 36px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
button:focus-visible, input:focus-visible, select:focus-visible, .opt:has(input:focus-visible), .chk:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-size: 0.85rem; color: var(--muted); }
progress { flex: 1; height: 6px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; max-width: 70ch; }
.opts { display: grid; gap: 8px; margin: 0 0 6px; padding: 0; border: 0; }
.opts.two { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.opt { position: relative; display: block; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px 12px 44px; cursor: pointer; min-height: 48px; }
.opt input { position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.opt .t { display: block; font-weight: 600; }
.opt .d { display: block; color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.other { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 8px 0 4px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 10px; }
.other label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; font-weight: 600; }
input[type="text"], select { font: inherit; font-weight: 400; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; min-height: 44px; }

.chk { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.chk input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.chk .t { display: block; font-weight: 600; }
.chk .d { display: block; color: var(--muted); font-size: 0.88rem; margin-top: 2px; }
.chk:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.sub { margin: 8px 0 12px; }
.sub label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; font-weight: 600; max-width: 380px; }

.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }
.btn { font: inherit; font-weight: 600; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 8px; padding: 10px 18px; cursor: pointer; min-height: 44px; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: 0.9rem; }
.error { background: var(--err-bg); color: var(--err-ink); padding: 10px 14px; border-radius: 8px; margin: 12px 0 0; font-size: 0.92rem; }

.clauses { display: grid; gap: 14px; margin: 14px 0; }
.clause { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.clause header { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; background: var(--accent-soft); }
.clause .body { padding: 14px 16px 4px; font-family: var(--serif); font-size: 1.02rem; line-height: 1.6; user-select: text; }
.clause .body p { margin: 0 0 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }

.sum { list-style: none; margin: 10px 0 0; padding: 0; font-size: 0.92rem; }
.sum li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sum li span:first-child { color: var(--muted); flex: none; }
.sum li span:last-child { text-align: right; }
.sum button { font: inherit; font-size: 0.85rem; background: none; border: 0; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0 0 0 8px; }
.notes { margin: 12px 0 0; padding-left: 18px; font-size: 0.9rem; color: var(--muted); }
.notes li { margin-bottom: 6px; }
.notes .warn { color: var(--warn-ink); background: var(--warn-bg); padding: 6px 10px; border-radius: 8px; list-style: none; margin-left: -18px; }
.notes a { color: var(--accent); }
.cta { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; margin-top: 14px; font-size: 0.92rem; }
.cta a { color: var(--accent); font-weight: 600; }
.disclaimer { background: var(--accent-soft); border-radius: 8px; padding: 12px 14px; font-size: 0.88rem; }
.foot { color: var(--muted); font-size: 0.82rem; margin-top: 14px; }
.errors { background: var(--err-bg); color: var(--err-ink); padding: 12px 16px; border-radius: var(--radius); }

@media (max-width: 560px) {
  h1 { font-size: 1.4rem; }
  .card { padding: 16px; }
  .nav .btn { flex: 1; }
}
@media print {
  :root { --bg: #fff; --card: #fff; --ink: #000; --muted: #444; --line: #bbb; --accent-soft: #fff; }
  .seg, .progress, .nav, .actions, .sum, .notes, .cta, .disclaimer, .foot, .clause button, .lead { display: none !important; }
  .card { border: 0; padding: 0; }
  .clause { break-inside: avoid; }
}

#stage > h3 { margin-top: 22px; }
#stage > .sum, #stage > .notes { margin-top: 8px; }
.iccbox { margin-top: 14px; }
.iccbox h3 { margin: 0 0 8px; }

/* long unbroken text (a typed seat, a URL) must wrap instead of widening the page */
.clause .body, .sum li span:last-child { overflow-wrap: anywhere; }
/* printing: the clause only, no stray headings */
@media print { #stage > h3, #stage > .hint { display: none !important; } } /* the clause cards keep their "English" / "Ukrainian" labels */

.hint a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
