:root {
  --ink: #1b2540;
  --ink-soft: #46506b;
  --brass: #b0813f;
  --brass-deep: #8f6528;
  --paper: #f7f4ee;
  --card: #ffffff;
  --line: #e3ddd0;
  --ok: #2f6b46;
  --warn: #8a4b1e;
  --warn-bg: #fbefe4;
  --shadow: 0 1px 2px rgba(27,37,64,.06), 0 8px 24px rgba(27,37,64,.06);
  --sans: 'Segoe UI', system-ui, -apple-system, Helvetica, Arial, sans-serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
}

/* Masthead */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.4rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fffdf9, var(--paper));
}
.brand { display: flex; align-items: center; gap: .9rem; color: var(--brass); }
.compass { width: 58px; height: 58px; flex: none; }
.masthead h1 {
  margin: 0; font-family: var(--serif); font-weight: 600;
  font-size: 2.1rem; letter-spacing: .01em; color: var(--ink);
}
.tagline { margin: .15rem 0 0; font-size: .95rem; color: var(--ink-soft); }
.mode-badge {
  font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: .35rem .6rem; border-radius: 999px; border: 1px solid var(--line);
  background: var(--warn-bg); color: var(--warn);
}

/* Hero */
.hero { text-align: center; padding: clamp(2.2rem, 7vw, 4rem) 1rem clamp(1rem, 3vw, 1.6rem); }
.hero-line {
  margin: 0; font-family: var(--serif); font-weight: 600; color: var(--ink);
  font-size: clamp(1.5rem, 4.5vw, 2.3rem); letter-spacing: .01em;
}
.hero-strap { margin: .55rem 0 0; color: var(--ink-soft); font-size: clamp(.85rem, 2vw, 1rem); }
.hero-explainer { margin-top: .9rem; max-width: 640px; margin-left: auto; margin-right: auto; }

/* Layout */
main { max-width: 760px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 2.6rem) clamp(1rem, 4vw, 1.5rem) 3rem; }
.stage { margin-bottom: 2rem; }
.stage-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .3rem; }
.step {
  display: grid; place-items: center; width: 1.7rem; height: 1.7rem; flex: none;
  border-radius: 50%; background: var(--ink); color: var(--paper);
  font-size: .85rem; font-weight: 600; font-family: var(--serif);
}
.stage h2 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.2rem; }
.hint { margin: .1rem 0 1.1rem; color: var(--ink-soft); font-size: .92rem; }
.micro { font-size: .78rem; color: var(--ink-soft); }

/* Input rows */
.rows { display: flex; flex-direction: column; gap: .6rem; }
.charity-row { display: flex; align-items: center; gap: .5rem; }
.charity-row input {
  flex: 1; padding: .7rem .85rem; font-size: 1rem; font-family: var(--sans);
  border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink);
}
.charity-row input::placeholder { font-style: italic; color: #9aa2b8; }
.charity-row input:focus { outline: 2px solid var(--brass); outline-offset: 1px; border-color: var(--brass); }
.icon-btn {
  flex: none; width: 2.5rem; height: 2.5rem; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  cursor: pointer; color: var(--ink-soft); font-size: 1rem;
}
.icon-btn:hover { border-color: var(--brass); color: var(--brass); }
.icon-btn.listening { background: var(--brass); color: #fff; border-color: var(--brass); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(176,129,63,.5); } 50% { box-shadow: 0 0 0 6px rgba(176,129,63,0); } }

/* Buttons */
.row-actions { display: flex; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; }
.btn {
  padding: .68rem 1.15rem; font-size: .95rem; font-weight: 600; font-family: var(--sans);
  border-radius: 8px; border: 1px solid transparent; cursor: pointer; transition: .12s;
}
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: #121a30; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); }
.btn:disabled { opacity: .5; cursor: default; }

/* Resolve cards */
.resolve-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.resolve-card .queried { font-size: .8rem; color: var(--ink-soft); }
.resolve-card .queried b { color: var(--ink); font-weight: 600; }
.option { display: flex; align-items: flex-start; gap: .6rem; padding: .6rem; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.option:hover { background: #faf7f1; }
.option.selected { border-color: var(--brass); background: #fbf6ec; }
.option input { margin-top: .25rem; accent-color: var(--brass); }
.option .name { font-weight: 600; }
.option .meta { font-size: .82rem; color: var(--ink-soft); }
.pill { display: inline-block; font-size: .7rem; font-weight: 600; padding: .1rem .45rem; border-radius: 999px; margin-left: .4rem; vertical-align: 1px; }
.pill.reg { background: #e7f1ea; color: var(--ok); }
.pill.removed { background: var(--warn-bg); color: var(--warn); }
.reg-link { font-size: .8rem; color: var(--brass-deep); text-decoration: none; }
.reg-link:hover { text-decoration: underline; }
.more-toggle { background: none; border: none; color: var(--brass-deep); cursor: pointer; font-size: .82rem; padding: .3rem 0 0; font-weight: 600; }

/* Flags */
.flag { border-left: 3px solid var(--warn); background: var(--warn-bg); color: var(--warn);
  padding: .7rem .85rem; border-radius: 0 8px 8px 0; font-size: .88rem; margin-top: .6rem; }
.flag a { color: var(--warn); font-weight: 600; }
.flag.notfound { }

/* Output */
.clause-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.clause-label { font-size: .78rem; color: var(--ink-soft); margin-bottom: .5rem; }
.clause {
  font-family: Arial, Helvetica, sans-serif; /* matches the will house style exactly */
  font-size: 11pt; color: #000; text-align: justify;
  background: #fdfdfb; border: 1px dashed var(--line); border-radius: 8px;
  padding: .8rem .9rem; margin: 0 0 .7rem;
}
.copy-btn { display: inline-flex; align-items: center; gap: .4rem; }

/* Colophon */
.colophon { max-width: 760px; margin: 0 auto; padding: 1.5rem clamp(1rem,4vw,1.5rem) 2.5rem; border-top: 1px solid var(--line); color: var(--ink-soft); font-size: .78rem; }
.colophon .privacy { color: var(--ok); font-weight: 600; }

/* Toast */
.toast { position: fixed; bottom: 1.4rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: .65rem 1.1rem; border-radius: 8px;
  font-size: .9rem; box-shadow: var(--shadow); z-index: 10; }

/* Selection: keep interface chrome out of drag-selections; theme the highlight */
.btn, .icon-btn, .step, .pill, .more-toggle, .mode-badge, .toast,
.masthead, .hero, .stage-head, .row-actions, .clause-label, .copy-btn {
  -webkit-user-select: none; user-select: none;
}
.clause, .option .name, .option .meta, .queried, .flag { -webkit-user-select: text; user-select: text; }
::selection { background: rgba(176, 129, 63, .3); }

.disclaimer { text-align: justify; }
.copy-hint { font-size: .78rem; color: var(--ink-soft); margin-left: .6rem; -webkit-user-select: none; user-select: none; }

/* Footer sign-off */
.signoff { font-style: italic; text-align: right; color: var(--ink-soft); margin: 2.2rem 0 0; font-size: .95rem; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
