/* Match & Marry - calm, editorial, grown-up. System fonts only; no external assets. */
:root {
  --bg: #faf7f3; --surface: #ffffff; --surface-2: #f4efe9; --ink: #1e1a22; --muted: #6b6470; --line: #e7e0d8;
  --accent: #6e2c4f; --accent-hover: #5a2240; --accent-ink: #ffffff; --accent-soft: #f3e8ee; --gold: #a8844f; --gold-soft: #f6efe3;
  --good: #2f6b4f; --good-bg: #e6f0ea; --warn: #855a0a; --warn-bg: #fbf0d9; --bad: #9b2c2c; --bad-bg: #f8e4e4;
  --shadow: 0 1px 2px rgba(30, 26, 34, .05), 0 8px 24px -16px rgba(30, 26, 34, .18);
  --radius: 14px; --radius-s: 10px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --focus: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141116; --surface: #1c181f; --surface-2: #231e27; --ink: #f2ecef; --muted: #b2a8af; --line: #322a33;
    --accent: #d79ab9; --accent-hover: #e6b3cc; --accent-ink: #1b0f16; --accent-soft: #2c1f28; --gold: #d2b07a; --gold-soft: #2a2319;
    --good: #8fd4ae; --good-bg: #17291f; --warn: #f1c97a; --warn-bg: #2d2412; --bad: #f19b9b; --bad-bg: #351a1a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -16px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 17px; line-height: 1.6; color: var(--ink); background: var(--bg); min-height: 100vh; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; letter-spacing: -.005em; margin: 0 0 .5em; }
h1 { font-size: clamp(1.9rem, 4.4vw, 2.6rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.2em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt { margin-top: 16px; }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .74rem; font-weight: 700; color: var(--gold); margin: 0 0 6px; }
code { font-size: .85rem; background: var(--surface-2); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.3) blur(10px); -webkit-backdrop-filter: saturate(1.3) blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1040px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand img { width: 34px; height: 34px; }
.brand span { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; letter-spacing: .01em; }
.brand em { font-style: italic; color: var(--gold); font-weight: 500; }
.nav { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; }
.nav a, .nav button { font: inherit; font-size: .93rem; color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px;
  background: none; border: 0; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; gap: 6px; }
.nav a:hover, .nav button:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--accent); }
@media (max-width: 720px) {
  .nav { width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a, .nav button { white-space: nowrap; padding: 8px 10px; }
}

/* ---------- layout ---------- */
main { max-width: 880px; margin: 0 auto; padding: 32px 16px 64px; }
main.wide { max-width: 1040px; }
footer { border-top: 1px solid var(--line); padding: 28px 16px 40px; text-align: center; color: var(--muted); font-size: .88rem; }
footer p { max-width: 640px; margin: 0 auto 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.soft { background: var(--surface-2); box-shadow: none; }
.card.accent { background: var(--accent-soft); border-color: transparent; box-shadow: none; }
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.card > :last-child { margin-bottom: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.jc { justify-content: center; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid > .card { margin-bottom: 0; }
.hero { padding: 24px 0 12px; }
.hero h1 { font-size: clamp(2.1rem, 5.5vw, 3.3rem); max-width: 18ch; }
.hero .lede { font-size: 1.15rem; color: var(--muted); max-width: 52ch; }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }

/* ---------- buttons, forms ---------- */
.btn { font: inherit; font-weight: 600; font-size: .98rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  text-decoration: none; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.quiet { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn.quiet:hover { border-color: var(--muted); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.armed { background: var(--bad); border-color: var(--bad); color: #fff; }
.field { margin-bottom: 16px; }
.field > label, .label-like { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.hint { font-size: .86rem; color: var(--muted); margin: 5px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number],
input[type=search], input[type=datetime-local], select, textarea {
  font: inherit; width: 100%; padding: 11px 13px; border-radius: var(--radius-s); border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-height: 46px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice label { cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: .94rem; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.choice input:focus-visible + span { box-shadow: var(--focus); }
.error { color: var(--bad); font-size: .92rem; min-height: 0; }
.error:not(:empty) { background: var(--bad-bg); border-radius: 8px; padding: 9px 12px; margin: 8px 0; }
.success:not(:empty) { color: var(--good); background: var(--good-bg); border-radius: 8px; padding: 9px 12px; margin: 8px 0; font-size: .92rem; }
.copybox { display: flex; gap: 8px; }
.copybox input { flex: 1; min-width: 0; font-size: .9rem; }

/* ---------- chips, banners ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: .82rem; font-weight: 600;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); white-space: nowrap; }
.chip.good { background: var(--good-bg); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.banner { border-radius: var(--radius-s); padding: 13px 16px; margin-bottom: 16px; border: 1px solid transparent; font-size: .96rem; }
.banner.ok { background: var(--good-bg); color: var(--ink); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.banner.info { background: var(--surface-2); border-color: var(--line); }
.banner.flag { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner.fail { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.banner .word { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; margin-right: 8px; }
.honesty { font-size: .88rem; color: var(--muted); border-left: 3px solid var(--gold); padding: 6px 0 6px 12px; margin: 12px 0; }
.honesty strong { display: block; color: var(--ink); }

/* ---------- lists, tables ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.scroll-x { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.table th { font-weight: 600; color: var(--muted); font-size: .85rem; }

/* ---------- scores ---------- */
.progress { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.bar { display: grid; grid-template-columns: minmax(120px, 34%) 1fr 48px; gap: 12px; align-items: center; margin: 8px 0; font-size: .94rem; }
.bar .track { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar .track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.mini .bar { font-size: .86rem; grid-template-columns: minmax(110px, 34%) 1fr 44px; }
.mini .bar .track i { background: var(--gold); }
@media (max-width: 520px) { .bar { grid-template-columns: 1fr 44px; } .bar .track { grid-column: 1 / -1; grid-row: 2; } }
.score { width: 168px; height: 168px; border-radius: 50%; margin: 6px auto 14px; display: grid; place-items: center;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), var(--surface-2) 0); }
.score > div { width: 140px; height: 140px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; }
.score b { font-family: var(--serif); font-size: 3rem; line-height: 1; display: block; text-align: center; }
.score small { display: block; color: var(--muted); font-size: .8rem; text-align: center; }
.score-num b { font-family: var(--serif); font-size: 1.6rem; }
details.explain { margin-top: 8px; }
details.explain summary { cursor: pointer; color: var(--accent); font-size: .9rem; font-weight: 600; }
details.explain .box { margin-top: 8px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius-s); font-size: .9rem; }
.domain { padding: 10px 0; border-bottom: 1px solid var(--line); }
.domain:last-child { border-bottom: 0; }
.domain-meta { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tone-warn .bar .track i { background: var(--gold); }
.tone-bad .bar .track i { background: var(--bad); }

/* ---------- people: photo cards ---------- */
.avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--surface-2); flex-shrink: 0; }
.avatar.big { width: 112px; height: 112px; }
.initial { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
  font-family: var(--serif); font-size: 1.8rem; flex-shrink: 0; }
.person { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
@media (max-width: 520px) { .person { grid-template-columns: auto 1fr; } .person > :last-child { grid-column: 1 / -1; } }

/* ---------- module list ---------- */
.mods { list-style: none; padding: 0; margin: 0; }
.mods li { display: flex; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mods li:last-child { border-bottom: 0; }
.mods .num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .82rem; font-weight: 700; background: var(--surface-2); flex-shrink: 0; }
.mods li.done .num { background: var(--good-bg); color: var(--good); }
.mods li > span:nth-child(2) { flex: 1; }

/* ---------- question runner ---------- */
.runner-top { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; color: var(--muted); }
.q { font-family: var(--serif); font-size: clamp(1.25rem, 3vw, 1.6rem); line-height: 1.35; margin-bottom: 20px; }
.scale { display: grid; gap: 8px; }
.scale > button { font: inherit; text-align: left; display: flex; gap: 12px; align-items: center; min-height: 52px; padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--surface); color: var(--ink); cursor: pointer; }
.scale > button:hover { border-color: var(--accent); }
.scale > button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.scale .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: .85rem; font-weight: 700; flex-shrink: 0; }
.runner-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.saved { color: var(--good); font-size: .88rem; min-height: 1.4em; margin: 10px 0 0; }

/* ---------- calendar ---------- */
.days { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.days button, .slots button { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: var(--radius-s); cursor: pointer; }
.days button { min-width: 62px; padding: 8px 6px; display: grid; place-items: center; }
.days .dow { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.days .dn { font-family: var(--serif); font-size: 1.3rem; }
.days button[disabled] { opacity: .35; cursor: not-allowed; }
.days button[aria-pressed="true"], .slots button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.slots { display: flex; flex-wrap: wrap; gap: 8px; }
.slots button { padding: 9px 14px; min-height: 44px; }
.week .wd { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: start; }
.win { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.win select { width: auto; min-width: 96px; }
@media (max-width: 520px) { .week .wd { grid-template-columns: 1fr; } }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { font: inherit; font-size: .94rem; background: none; border: 0; padding: 10px 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; min-height: 44px; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* ---------- Messages: copied from Tegula Stone web-app/site/app.html (.conv inbox, .thwrap thread).
   Class names kept so the two apps read side by side; colours re-derived from this palette. ---------- */
.conv { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 14px; margin-bottom: 9px; color: var(--ink); text-decoration: none; min-height: 68px; }
.conv:hover { border-color: var(--accent); }
.av { width: 42px; height: 42px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center;
  font-family: var(--serif); font-weight: 600; flex-shrink: 0; overflow: hidden; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.conv .cmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.conv .cn { font-weight: 700; }
.conv .clast { font-size: .9rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .cmeta { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
.conv .ct { font-size: .78rem; color: var(--muted); }
.cunread { background: var(--accent); color: var(--accent-ink); font-size: .72rem; font-weight: 700; min-width: 20px; height: 20px;
  border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.back { display: inline-block; font-weight: 600; margin-bottom: 14px; }
.thwrap { display: flex; flex-direction: column; }
.thhead { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; flex-wrap: wrap; }
.thhead .grow { min-width: 120px; }
.thmsgs { display: flex; flex-direction: column; gap: 8px; padding: 8px 2px 16px; }
.bub { max-width: 80%; padding: 9px 13px; border-radius: 16px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.bub.them { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bub.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.bub .bt { font-size: .7rem; opacity: .72; margin-top: 4px; text-align: right; white-space: normal; }
.seen { align-self: flex-end; font-size: .75rem; color: var(--muted); margin-top: -4px; }
.msgbar { position: sticky; bottom: 0; display: flex; gap: 8px; align-items: flex-end; padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--bg); }
.msgbar textarea { flex: 1; margin: 0; min-height: 48px; max-height: 160px; resize: none; }
.msgbar .btn { flex-shrink: 0; }

/* ---------- misc ---------- */
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.verify-bar { background: var(--gold-soft); border-bottom: 1px solid var(--line); font-size: .9rem; }
.verify-bar .in { max-width: 1040px; margin: 0 auto; padding: 9px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.legal h2 { margin-top: 1.4em; }
@media print { .top, footer, .no-print, .btn, .verify-bar { display: none !important; } .card { box-shadow: none; break-inside: avoid; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
