/* LinageRoot — interface styles
   Palette: indigo-dyed cloth (ink + indigo) with gold for marriages and
   leaf green for verified facts. Spectral for names, Instrument Sans for UI. */

/* Self-hosted fonts (SIL Open Font Licence): no third-party requests, no visitor IPs sent to Google */
@font-face { font-family: "Spectral"; src: url(fonts/spectral-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Spectral"; src: url(fonts/spectral-latin-400-italic.woff2) format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Spectral"; src: url(fonts/spectral-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Spectral"; src: url(fonts/spectral-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(fonts/instrument-sans-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(fonts/instrument-sans-latin-500-normal.woff2) format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(fonts/instrument-sans-latin-600-normal.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --ink: #18203f;
  --ink-2: #4a5272;
  --ink-3: #737a96;
  --paper: #f2f3f7;
  --surface: #ffffff;
  --surface-2: #e8eaf1;
  --line: #d3d7e3;
  --indigo: #150186;
  --indigo-2: #3b2fc4;
  --indigo-soft: #e4e2fb;
  --gold: #a87a12;
  --gold-bright: #e2b54a;
  --gold-soft: #f6ecd2;
  --leaf: #2c7656;
  --leaf-soft: #ddefe6;
  --danger: #a3322a;
  --danger-soft: #f7e1de;
  --focus: #3d63dd;
  --radius-s: 6px;
  --radius-m: 10px;
  --shadow: 0 1px 2px rgba(24, 32, 63, .08), 0 4px 14px rgba(24, 32, 63, .06);
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6e9f4;
    --ink-2: #b4bad0;
    --ink-3: #8a91ab;
    --paper: #0e1325;
    --surface: #161d36;
    --surface-2: #1f2847;
    --line: #2d375a;
    --indigo: #a59cff;
    --indigo-2: #c2bcff;
    --indigo-soft: #26205e;
    --gold: #e2b54a;
    --gold-soft: #3a3220;
    --leaf: #6cc79c;
    --leaf-soft: #1c3a2e;
    --danger: #f08b80;
    --danger-soft: #42221f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; max-width: 68ch; }
a { color: var(--indigo-2); }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.noscript { padding: 2rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Buttons & forms ─────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: 500 .95rem/1 var(--sans);
  padding: .7em 1.1em; min-height: 42px;
  border-radius: var(--radius-s); border: 1px solid transparent;
  background: var(--indigo); color: #fff; cursor: pointer; text-decoration: none;
}
@media (prefers-color-scheme: dark) { .btn { color: #0e1325; } }
.btn:hover { background: var(--indigo-2); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { border-color: var(--ink-3); }
.btn.ghost { background: transparent; color: var(--indigo-2); padding-inline: .6em; }
.btn.ghost:hover { background: var(--indigo-soft); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 34px; padding: .5em .8em; font-size: .875rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

label.field { display: block; margin-bottom: .9rem; }
label.field > span { display: block; font-size: .875rem; font-weight: 500; color: var(--ink-2); margin-bottom: .3rem; }
input, select, textarea {
  width: 100%; font: 1rem/1.4 var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: .6em .75em; min-height: 42px;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--indigo-2); outline: none; box-shadow: 0 0 0 3px var(--indigo-soft); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--indigo); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 .9rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 .9rem; }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.check { display: flex; gap: .5rem; align-items: center; margin: .3rem 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); color: var(--ink-2); padding: .55em .9em; font: 500 .9rem var(--sans); cursor: pointer; min-height: 40px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--indigo); color: #fff; }
@media (prefers-color-scheme: dark) { .seg button[aria-pressed=true] { color: #0e1325; } }
.error { color: var(--danger); background: var(--danger-soft); padding: .6em .8em; border-radius: var(--radius-s); font-size: .92rem; }
.note { background: var(--indigo-soft); padding: .7em .9em; border-radius: var(--radius-s); font-size: .92rem; }

/* ── Public pages ────────────────────────────────────── */
.site-head { display: flex; justify-content: space-between; align-items: center; padding: 18px clamp(16px, 4vw, 48px); }
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 600 1.15rem var(--serif); color: var(--ink); text-decoration: none; }
.brand svg { width: 30px; height: 30px; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(24px, 4vw, 64px);
  align-items: center; padding: clamp(24px, 6vw, 80px) clamp(16px, 4vw, 48px) 48px; max-width: 1240px; margin: 0 auto;
}
@media (max-width: 880px) { .hero { grid-template-columns: 1fr; } }
.hero h1 { font-weight: 500; }
.hero .lede { font-size: 1.15rem; color: var(--ink-2); }
.hero-search { display: flex; gap: .5rem; margin-top: 1.5rem; max-width: 520px; }
.hero-search input { flex: 1; }
.hero-art { width: 100%; height: auto; }
.hero-art .n { fill: var(--surface); stroke: var(--line); }
.hero-art .t { font: 500 12px var(--serif); fill: var(--ink); }
.hero-art .y { font: 10px var(--sans); fill: var(--ink-3); }
.hero-art .bl { stroke: var(--indigo); stroke-width: 1.6; fill: none; }
.hero-art .ring { stroke: var(--gold); stroke-width: 2; fill: var(--paper); }
.hero-art .you { stroke: var(--indigo); stroke-width: 2; }
.hero-art .gen { font: 11px var(--sans); fill: var(--ink-3); }
.band { max-width: 1240px; margin: 0 auto; padding: 48px clamp(16px, 4vw, 48px); }
.principles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; border-top: 1px solid var(--line); padding-top: 32px; }
@media (max-width: 880px) { .principles { grid-template-columns: 1fr; } }
.principles h3 { font-size: 1.3rem; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 880px) { .plans { grid-template-columns: 1fr; } }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 22px; }
.plan h3 { margin-bottom: .2em; }
.plan ul { padding-left: 1.1em; margin: .8em 0 0; color: var(--ink-2); }
.site-foot { border-top: 1px solid var(--line); padding: 24px clamp(16px, 4vw, 48px); color: var(--ink-3); font-size: .9rem; display: flex; gap: 1.5rem; flex-wrap: wrap; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.9rem; }
.or { text-align: center; color: var(--ink-3); margin: 1rem 0; font-size: .9rem; }

/* ── App shell ───────────────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.side .brand { padding: 4px 10px 18px; }
.nav a {
  display: flex; align-items: center; justify-content: space-between; gap: .5rem;
  padding: .6em .75em; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav a[aria-current=page] { background: var(--indigo-soft); color: var(--indigo); }
.badge { background: var(--gold); color: #fff; border-radius: 99px; font-size: .75rem; padding: 0 .5em; min-width: 1.5em; text-align: center; line-height: 1.5; }
.side .foot { margin-top: auto; padding: 10px; font-size: .85rem; color: var(--ink-3); }
.main { min-width: 0; }
.page { padding: 28px clamp(16px, 3vw, 40px) 64px; max-width: 1100px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head h1 { font-size: 2.1rem; margin: 0; }
.topbar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
}

/* ── Lists & panels ──────────────────────────────────── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 20px; margin-bottom: 16px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.rows li:last-child { border-bottom: 0; }
.rows .grow { flex: 1; min-width: 0; }
.person-chip { display: flex; align-items: center; gap: .65rem; min-width: 0; text-align: left; background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.person-chip b { font: 500 1.02rem var(--serif); display: block; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--indigo-soft); color: var(--indigo); display: grid; place-items: center; font: 600 .9rem var(--sans); flex: none; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.f { background: var(--gold-soft); color: var(--gold); }
.tag { display: inline-block; font-size: .78rem; font-weight: 500; padding: .1em .55em; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.tag.blood { background: var(--indigo-soft); color: var(--indigo); }
.tag.marriage { background: var(--gold-soft); color: var(--gold); }
.tag.step, .tag.adoptive { background: var(--surface-2); color: var(--ink-2); border: 1px dashed var(--ink-3); }
.tag.ok { background: var(--leaf-soft); color: var(--leaf); }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); }
.empty h2 { color: var(--ink); }
.filter { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filter input { max-width: 320px; }

/* ── Tree ────────────────────────────────────────────── */
.tree-page { position: relative; height: 100vh; display: flex; flex-direction: column; }
@media (max-width: 860px) { .tree-page { height: calc(100vh - 57px); } }
.tree-bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); flex-wrap: wrap; }
.tree-bar h1 { font-size: 1.35rem; margin: 0; }
.crumb { color: var(--ink-3); font-size: .9rem; }
.canvas { position: relative; flex: 1; overflow: hidden; cursor: grab; touch-action: none; background:
  radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 22px 22px; }
.canvas.dragging { cursor: grabbing; }
.canvas svg { display: block; width: 100%; height: 100%; user-select: none; }
.zoom { position: absolute; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.zoom button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 1.2rem; cursor: pointer; box-shadow: var(--shadow); }
.legend { position: absolute; left: 16px; bottom: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px 12px; font-size: .8rem; color: var(--ink-2); display: flex; gap: 14px; flex-wrap: wrap; max-width: calc(100% - 90px); }
@media (max-width: 700px) { .legend .hint { display: none; } .legend { font-size: .72rem; gap: 8px; padding: 6px 8px; } }
.legend i { display: inline-block; width: 22px; vertical-align: middle; margin-right: 5px; border-top: 2px solid var(--indigo); }
.legend i.m { border-top-color: var(--gold); }
.legend i.a { border-top-style: dashed; border-top-color: var(--ink-3); }

/* SVG tree elements */
.gen-band { fill: var(--surface); opacity: .55; }
.gen-label { font: 500 12px var(--sans); fill: var(--ink-3); }
.edge { fill: none; stroke: var(--indigo); stroke-width: 1.6; }
.edge.adoptive, .edge.foster { stroke: var(--ink-3); stroke-dasharray: 5 4; }
.edge.ped { stroke: var(--indigo-2); opacity: .8; }
.spouse-line { stroke: var(--gold); stroke-width: 2; }
.spouse-line.former { stroke: var(--ink-3); stroke-dasharray: 3 4; }
.ring { fill: var(--paper); stroke: var(--gold); stroke-width: 2.2; }
.ring.former { stroke: var(--ink-3); stroke-dasharray: 3 3; }
.ring-label { font: 600 10px var(--sans); fill: var(--gold); }
.card rect.bg { fill: var(--surface); stroke: var(--line); stroke-width: 1; }
.card:hover rect.bg, .card:focus rect.bg { stroke: var(--indigo-2); }
.card:focus { outline: none; }
.card:focus rect.bg { stroke-width: 2.5; }
.card.focus rect.bg { stroke: var(--indigo); stroke-width: 2.5; }
.card.me rect.bg { fill: var(--indigo-soft); }
.card .edgebar { fill: var(--indigo); }
.card.marriage .edgebar { fill: var(--gold); }
.card.step .edgebar, .card.adoptive .edgebar, .card.path .edgebar { fill: var(--ink-3); }
.card.deceased .name { fill: var(--ink-2); }
.card .name { font: 500 14px var(--serif); fill: var(--ink); }
.card .meta { font: 11px var(--sans); fill: var(--ink-3); }
.card .rel { font: 500 11px var(--sans); fill: var(--indigo-2); }
.card.marriage .rel { fill: var(--gold); }
.card .av { fill: var(--indigo-soft); }
.card.female .av { fill: var(--gold-soft); }
.card .avt { font: 600 12px var(--sans); fill: var(--indigo); }
.card.female .avt { fill: var(--gold); }
.card .more { font: 600 10px var(--sans); fill: var(--indigo-2); }
.card { cursor: pointer; }
.add-node rect { fill: transparent; stroke: var(--ink-3); stroke-dasharray: 4 4; }
.add-node text { font: 500 12px var(--sans); fill: var(--ink-3); }
.add-node:hover rect { stroke: var(--indigo-2); }
.add-node:hover text { fill: var(--indigo-2); }

/* ── Drawer & modal ──────────────────────────────────── */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--surface);
  border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 50; overflow-y: auto;
  padding: 20px 22px 40px; transform: translateX(100%); transition: transform .22s ease;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.drawer-head .avatar { width: 64px; height: 64px; font-size: 1.3rem; }
.drawer-head h2 { margin: 0; font-size: 1.55rem; }
.close { position: absolute; top: 12px; right: 12px; }
.facts { display: grid; grid-template-columns: 9.5em 1fr; gap: .35rem .8rem; margin: 0 0 1rem; font-size: .95rem; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.section-title { font: 600 .82rem var(--sans); color: var(--ink-3); margin: 1.4rem 0 .5rem; letter-spacing: .02em; }
.path { font-family: var(--serif); font-style: italic; color: var(--ink-2); }
.contact-box { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; }
.modal-back { position: fixed; inset: 0; background: rgba(14, 19, 37, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-m); width: 100%; max-width: 620px; max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; box-shadow: var(--shadow); position: relative; }
.modal h2 { padding-right: 40px; }

/* ── Wizard ──────────────────────────────────────────── */
.wizard { max-width: 760px; margin: 0 auto; padding: 32px 16px 80px; }
.steps { display: flex; gap: 6px; margin: 0 0 24px; padding: 0; list-style: none; flex-wrap: wrap; }
.steps li { font-size: .85rem; padding: .3em .7em; border-radius: 99px; background: var(--surface-2); color: var(--ink-3); }
.steps li[aria-current=step] { background: var(--indigo); color: #fff; }
@media (prefers-color-scheme: dark) { .steps li[aria-current=step] { color: #0e1325; } }
.steps li.done { background: var(--indigo-soft); color: var(--indigo); }
.person-form { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 16px; background: var(--surface); margin-bottom: 12px; position: relative; }
.person-form h3 { font-size: 1.1rem; }
.spouse-block { border-left: 3px solid var(--gold-bright); }
.child-block { margin-left: 18px; border-left: 3px solid var(--indigo-soft); }

/* ── Matches ─────────────────────────────────────────── */
.match { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: stretch; }
.match .side-rec { border: 1px solid var(--line); border-radius: var(--radius-s); padding: 12px; }
.match .side-rec.mine { border-color: var(--indigo-2); }
.match .vs { align-self: center; font: italic 1.1rem var(--serif); color: var(--ink-3); }
@media (max-width: 640px) { .match { grid-template-columns: 1fr; } .match .vs { justify-self: center; } }
.evidence { margin: .8rem 0; padding-left: 1.1em; color: var(--ink-2); font-size: .92rem; }
.meter { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: .4rem 0; }
.meter b { display: block; height: 100%; background: var(--leaf); }

/* ── Chat ────────────────────────────────────────────── */
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.msg { padding: 10px 12px; border-radius: var(--radius-m); max-width: 90%; white-space: pre-wrap; }
.msg.user { background: var(--indigo); color: #fff; align-self: flex-end; }
@media (prefers-color-scheme: dark) { .msg.user { color: #0e1325; } }
.msg.assistant { background: var(--surface-2); }

/* ── Toasts ──────────────────────────────────────────── */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: .7em 1.1em; border-radius: var(--radius-s); box-shadow: var(--shadow); font-size: .95rem; max-width: min(92vw, 520px); }
.toast.err { background: var(--danger); color: #fff; }

/* ── Report (print) ──────────────────────────────────── */
.report h1 { font-size: 2.4rem; }
.report table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.report th, .report td { text-align: left; padding: .45em .5em; border-bottom: 1px solid var(--line); vertical-align: top; }
.report th { font-weight: 600; color: var(--ink-2); }
@media print {
  .side, .topbar, .no-print, #toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; color: #000; }
  .page { max-width: none; padding: 0; }
  .report table { font-size: 10pt; }
  .report tr { break-inside: avoid; }
}

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

/* ── Record Lens ─────────────────────────────────────── */
.lens-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 24px; align-items: start; margin: 1.2rem 0 1.6rem; }
@media (max-width: 720px) { .lens-grid { grid-template-columns: 1fr; } }
.lens-preview { border: 1px dashed var(--line); border-radius: var(--radius-m); min-height: 200px; display: grid; place-items: center; background: var(--surface); overflow: hidden; }
.lens-preview img { width: 100%; height: auto; display: block; }
.lens-tips { padding-left: 1.1em; margin-top: 1.2rem; }
.lens-transcript { white-space: pre-wrap; font: .9rem/1.5 var(--serif); background: var(--surface-2); padding: 12px; border-radius: var(--radius-s); }
.lens-archives summary { cursor: pointer; color: var(--indigo-2); }
label.btn { cursor: pointer; }

/* ── Launch additions: banners, consent, two-factor, prices, legal pages ── */
.banner { display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; justify-content: space-between;
  background: var(--gold-soft); color: var(--ink); border-bottom: 1px solid var(--line); padding: .7rem 1.2rem; font-size: .92rem; }
.banner.warn { position: sticky; top: 0; z-index: 60; justify-content: center; text-align: center; }
.consent { margin: .4rem 0 1rem; }
.consent .check { align-items: flex-start; }
.consent .check input { margin-top: .25rem; flex: none; }
.qr { width: 200px; max-width: 70vw; margin: .8rem 0; padding: 8px; background: #fff; border-radius: var(--radius-s); border: 1px solid var(--line); }
.qr svg { display: block; width: 100%; height: auto; }
pre.codes { font-size: 1rem; letter-spacing: .08em; background: var(--surface); border: 1px dashed var(--line); padding: .8rem 1rem; border-radius: var(--radius-s); columns: 2; }
.row-fields { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.row-fields input { max-width: 220px; }
.plan .price { font-family: var(--serif, inherit); font-size: 1.6rem; margin: .1em 0 .2em; color: var(--ink); }
.legal h1 { margin-bottom: .2em; }
.legal h2 { margin-top: 1.8em; font-size: 1.3rem; }
.legal table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 1rem 0; }
.legal th, .legal td { text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); padding: .5em .4em; }
.legal .draft { background: var(--danger-soft); color: var(--danger); padding: .6em .8em; border-radius: var(--radius-s); font-size: .9rem; }
blockquote.small { margin: .4rem 0; padding-left: .8rem; border-left: 3px solid var(--line); color: var(--ink-2); }

/* ── Add-ons ─────────────────────────────────────────── */
.ico { display: inline-flex; line-height: 0; }
.addons-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 1.4rem; }
.addons-bar h2 { margin: 0; }
.pass-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: .6rem; }
.pass-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: .7rem; box-shadow: var(--shadow); }
.pass-card.clan { background: linear-gradient(160deg, var(--indigo-soft), var(--surface) 55%); border-color: color-mix(in srgb, var(--indigo) 30%, var(--line)); }
.pass-card p { margin: 0; color: var(--ink-2); }
.pass-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pass-top h3 { margin: 0; font-size: 1.35rem; }
.pass-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .45rem; }
.pass-list li { display: flex; align-items: center; gap: .55rem; }
.pass-list .ico { color: var(--indigo); }
.price-line { font-size: 1.25rem; }
.price-line b { font-family: var(--serif); font-weight: 600; }
.pass-card .btn, .addon-foot .btn { align-self: flex-start; }
.have { display: flex; align-items: center; gap: .4rem; color: var(--leaf); font-weight: 500; margin: 0; }
.addon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-top: .6rem; }
.addon-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: .6rem; }
.addon-card.soon { background: var(--paper); border-style: dashed; }
.addon-card p { margin: 0; color: var(--ink-2); font-size: .95rem; }
.addon-card ul { margin: 0; padding-left: 1.1em; color: var(--ink-2); font-size: .9rem; }
.addon-head { display: flex; gap: .8rem; align-items: center; }
.addon-head h3 { margin: 0 0 .15rem; font-size: 1.1rem; }
.addon-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--indigo-soft); color: var(--indigo); flex: none; }
.addon-card.soon .addon-ico { background: var(--gold-soft); color: var(--gold); }
.addon-foot { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; padding-top: .4rem; }
.addon-foot .btn[aria-pressed=true] { color: var(--leaf); border-color: var(--leaf); }
.free-list { list-style: none; padding: 0; margin: .5rem 0 0; columns: 2; column-gap: 24px; }
.free-list li { display: flex; gap: .45rem; align-items: flex-start; margin-bottom: .45rem; break-inside: avoid; }
.free-list .ico { color: var(--leaf); margin-top: .15em; }
.mine h2 { margin-top: 0; }
.upgrade-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: .6rem 0; }
.upgrade-note p { margin: 0; }
@media (max-width: 760px) { .pass-grid { grid-template-columns: 1fr; } .free-list { columns: 1; } }

/* ── Root Gallery ────────────────────────────────────── */
.gallery-meter { margin-bottom: .8rem; }
.meter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.meter { width: 160px; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--gold-bright); }
.gallery-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.gallery-filters input[type=search] { flex: 1 1 220px; min-width: 0; }
.gallery-filters select { flex: 0 1 auto; width: auto; max-width: 100%; }
.gallery-filters .check { margin: 0 .3rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.g-tile { all: unset; box-sizing: border-box; cursor: pointer; position: relative; display: block; border-radius: 12px; overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; box-shadow: var(--shadow); }
.g-tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.g-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.g-tile:hover img { transform: scale(1.04); }
.g-cap { position: absolute; inset: auto 0 0 0; padding: 28px 12px 10px; background: linear-gradient(to top, rgba(10, 12, 30, .82), rgba(10, 12, 30, 0)); color: #fff; display: grid; gap: 2px; font-size: .82rem; }
.g-cap b { font-size: .95rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-cap span { opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-badge { position: absolute; top: -18px; right: 10px; background: rgba(10, 12, 30, .7); padding: 2px 8px; border-radius: 99px; font-size: .72rem; opacity: 1 !important; }
.gallery-empty { grid-column: 1 / -1; }
.modal.wide { max-width: 980px; }
.g-view { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.g-view figure { margin: 0; background: #0b0d1c; border-radius: 10px; overflow: hidden; display: grid; place-items: center; }
.g-view figure img { max-width: 100%; max-height: 70vh; display: block; }
.g-meta p { margin: 0 0 .6rem; }
.g-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: .8rem; }
.g-tags a { text-decoration: none; }
.g-meta .btn-row { margin-top: .6rem; gap: .4rem; flex-wrap: wrap; }
.g-date { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.tag-pick { max-height: 190px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-s); padding: 4px 10px; margin-top: 6px; }
.g-form .seg { margin-top: 4px; }
@media (max-width: 760px) {
  .g-view { grid-template-columns: 1fr; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .g-cap { padding: 22px 8px 8px; font-size: .75rem; }
  .gallery-filters select { flex: 1 1 45%; }
}
.g-date > * { width: 100%; max-width: none; min-width: 0; }
/* Tap the picture in a person's panel to add or change it */
.avatar-edit { all: unset; position: relative; cursor: pointer; border-radius: 50%; flex: none; display: inline-flex; }
.avatar-edit:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.avatar-cam { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--indigo); color: #fff; border: 2px solid var(--surface); }
@media (prefers-color-scheme: dark) { .avatar-cam { color: #0e1325; } }

/* ── Home ────────────────────────────────────────────── */
.page.home { max-width: 1240px; }
.hm-loading { display: grid; gap: 16px; }
.hm-skel { height: 140px; border-radius: 18px; background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: hm-shimmer 1.4s infinite linear; }
.hm-skel.big { height: 240px; }
@keyframes hm-shimmer { to { background-position: -200% 0; } }
.hm-hero { position: relative; border-radius: 22px; overflow: hidden; color: #fff; margin-bottom: 18px;
  background: radial-gradient(120% 140% at 100% 0%, rgba(242, 179, 61, .35), transparent 50%), radial-gradient(90% 120% at 0% 100%, rgba(178, 58, 110, .45), transparent 55%), linear-gradient(135deg, #140186 0%, #2a1a9e 55%, #3d1f86 100%); }
.hm-hero::after { content: ""; position: absolute; inset: 0; background: url(img/hero-blur.jpg) center / cover; opacity: .16; mix-blend-mode: screen; pointer-events: none; }
.hm-hero-in { position: relative; z-index: 1; padding: 26px 28px 22px; display: grid; gap: 16px; grid-template-columns: 1fr 1.1fr; align-items: center; }
.hm-hello { display: flex; align-items: center; gap: 16px; }
.hm-hello .hm-face { border: 3px solid rgba(255, 255, 255, .85); box-shadow: 0 0 0 4px rgba(242, 179, 61, .55); font-size: 1.3rem; }
.hm-greet { margin: 0; opacity: .85; font-size: 1.02rem; }
.hm-hero h1 { margin: 0; font-size: 2.4rem; color: #fff; line-height: 1.05; }
.hm-proverb { margin: 0; padding: 14px 18px; border-left: 3px solid #f2b33d; background: rgba(255, 255, 255, .08); border-radius: 0 12px 12px 0; }
.hm-proverb p { margin: 0 0 .3rem; font-family: var(--serif); font-style: italic; font-size: 1.12rem; line-height: 1.4; color: #fff; max-width: none; }
.hm-proverb cite { font-style: normal; font-size: .8rem; opacity: .75; }
.hm-stats { display: flex; gap: 8px; flex-wrap: wrap; grid-column: 1 / -1; }
.hm-stat { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); padding: .3em .8em; border-radius: 99px; font-size: .88rem; }
.hm-stat b { color: #ffd98a; }
.hm-quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; grid-column: 1 / -1; }
.hm-qbtn { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: .55rem; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .95); color: #140186; font-weight: 600; font-size: .95rem; transition: transform .15s ease, box-shadow .15s ease; }
.hm-qbtn span { font-size: 1.35rem; line-height: 1; }
.hm-qbtn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px -10px rgba(0, 0, 0, .5); }
.hm-qbtn:focus-visible { outline: 3px solid #f2b33d; outline-offset: 2px; }
.hm-waiting { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.hm-wait { flex: 1 1 260px; padding: 12px 16px; border-radius: 14px; background: var(--gold-soft); color: var(--ink); text-decoration: none; border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }
.hm-wait b { color: var(--gold); font-size: 1.15rem; margin-right: .2rem; }
.hm-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.hm-col { display: grid; gap: 18px; min-width: 0; }
.hm-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.hm-card h2 { font-size: 1.2rem; margin: 0; }
.hm-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.hm-muted { color: var(--ink-3); }
.hm-face { display: inline-grid; place-items: center; border-radius: 50%; overflow: hidden; background: var(--indigo-soft); color: var(--indigo); font-weight: 600; font-size: .85rem; flex: none; }
.hm-face img { width: 100%; height: 100%; object-fit: cover; }
.hm-rel { display: inline-block; margin-left: .4rem; font-size: .75rem; font-weight: 500; padding: .05em .5em; border-radius: 99px; background: var(--indigo-soft); color: var(--indigo); vertical-align: .1em; }

/* Games */
.hm-games { background: linear-gradient(140deg, #fff7e6 0%, var(--surface) 45%); border-color: color-mix(in srgb, var(--gold) 30%, var(--line)); }
.hm-game-main { display: flex; gap: 16px; align-items: center; }
.hm-kicker { margin: 0 0 .2rem; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.hm-games h2 { font-size: 1.45rem; }
.hm-games p { color: var(--ink-2); }
.hm-play { background: linear-gradient(135deg, #b23a6e, #140186); border: 0; font-size: 1.02rem; padding: .7em 1.3em; }
.hm-dice { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 2rem; flex: none; }
.hm-dice span { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); animation: hm-bob 3s ease-in-out infinite; }
.hm-dice span:nth-child(2) { animation-delay: .6s; } .hm-dice span:nth-child(3) { animation-delay: 1.2s; grid-column: 1 / -1; justify-self: center; }
@keyframes hm-bob { 50% { transform: translateY(-5px) rotate(-4deg); } }
.hm-board { list-style: none; padding: 0; margin: 14px 0 6px; display: grid; gap: 6px; }
.hm-board li { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; background: var(--paper); }
.hm-board li.me { background: var(--indigo-soft); }
.hm-rank { width: 1.6rem; text-align: center; }
.hm-more-games { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.hm-soon-game { padding: .35em .8em; border-radius: 10px; background: var(--paper); font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.hm-soon-game small { display: block; font-weight: 400; font-size: .7rem; color: var(--ink-3); }

/* Elders */
.hm-elder { background: linear-gradient(160deg, var(--gold-soft), var(--surface) 60%); }
.hm-note { padding: 12px 0; border-bottom: 1px solid var(--line); }
.hm-note:last-of-type { border-bottom: 0; }
.hm-note-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.hm-note-head small { display: block; }
.hm-note audio, .hm-post audio { width: 100%; height: 40px; }
.hm-note video, .hm-post video { width: 100%; border-radius: 12px; max-height: 360px; background: #000; }
.hm-note p { margin: .4rem 0; }
.hm-prompt { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px dashed color-mix(in srgb, var(--gold) 50%, var(--line)); }
.hm-prompt span { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); font-weight: 600; }
.hm-prompt p { margin: .2rem 0 0; font-family: var(--serif); font-size: 1.05rem; }
.hm-empty-elder p { color: var(--ink-2); margin: 0; }

/* Calendar */
.hm-cal { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.hm-cal li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; }
.hm-cal li.soon { background: var(--gold-soft); }
.hm-date { width: 48px; flex: none; text-align: center; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.hm-date b { display: block; font-size: 1.15rem; padding-top: 3px; }
.hm-date small { display: block; background: #b23a6e; color: #fff; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; padding: 1px 0; }

/* Memory */
.hm-memory { padding: 0; overflow: hidden; }
.hm-memory a { display: block; position: relative; color: #fff; text-decoration: none; }
.hm-memory img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.hm-mem-cap { position: absolute; inset: auto 0 0 0; padding: 40px 16px 14px; background: linear-gradient(to top, rgba(8, 10, 28, .85), transparent); display: grid; gap: 2px; }
.hm-mem-cap span { font-size: .78rem; opacity: .85; }
.hm-mem-cap b { font-family: var(--serif); font-size: 1.15rem; font-weight: 500; }
.hm-memory.empty { padding: 18px 20px; }
.hm-memory.empty p { margin: 0 0 .6rem; }

/* Next steps */
.hm-next { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.hm-next button { all: unset; box-sizing: border-box; width: 100%; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--leaf-soft); color: var(--leaf); font-weight: 500; }
.hm-next button:hover { filter: brightness(.97); }
.hm-next button:focus-visible { outline: 3px solid var(--focus); }

/* Board */
.hm-composer { all: unset; box-sizing: border-box; cursor: text; width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-3); margin-bottom: 14px; }
.hm-composer:focus-visible { outline: 3px solid var(--focus); }
.hm-posts { display: grid; gap: 12px; }
.hm-post { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; border-top: 4px solid var(--indigo); background: var(--surface); }
.hm-post.tone-gold { border-top-color: #f2b33d; } .hm-post.tone-leaf { border-top-color: #1d7d61; } .hm-post.tone-berry { border-top-color: #b23a6e; } .hm-post.tone-slate { border-top-color: #737a96; }
.hm-post-head { display: flex; gap: 10px; align-items: center; }
.hm-post-head small { display: block; }
.hm-kind { font-size: .78rem; font-weight: 600; padding: .25em .7em; border-radius: 99px; background: var(--paper); white-space: nowrap; }
.hm-post h3 { margin: .7rem 0 .3rem; font-size: 1.15rem; }
.hm-post p { margin: .3rem 0; }
.hm-when { color: var(--ink-2); font-size: .92rem; }
.hm-about { display: inline-flex; align-items: center; gap: 6px; margin: .3rem 0; padding: .2em .7em .2em .25em; border-radius: 99px; background: var(--indigo-soft); color: var(--indigo); text-decoration: none; font-size: .85rem; }
.hm-post-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: 12px; margin-top: .5rem; display: block; }
.hm-post-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: .6rem; }
.hm-react { display: flex; gap: 6px; flex-wrap: wrap; }
.hm-react button { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: .3em .7em; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: .95rem; min-height: 34px; transition: transform .12s ease; }
.hm-react button span { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.hm-react button[aria-pressed=true] { background: var(--indigo-soft); border-color: var(--indigo-2); }
.hm-react button:active { transform: scale(1.15); }
.hm-react button:focus-visible { outline: 3px solid var(--focus); }
.hm-empty-board { text-align: center; padding: 20px 10px; color: var(--ink-2); }

/* Composer and recorder */
.hm-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: .8rem; }
.hm-kinds button { all: unset; box-sizing: border-box; cursor: pointer; padding: .4em .8em; border-radius: 99px; border: 1px solid var(--line); font-size: .88rem; min-height: 36px; display: inline-flex; align-items: center; }
.hm-kinds button[aria-pressed=true] { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.hm-kinds button:focus-visible { outline: 3px solid var(--focus); }
.hm-rec { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: .6rem 0 1rem; }
.hm-rec audio, .hm-rec video { width: 100%; border-radius: 12px; }
.hm-recbtn { all: unset; box-sizing: border-box; cursor: pointer; flex: 1 1 140px; display: grid; justify-items: center; gap: 4px; padding: 16px 10px; border-radius: 14px; border: 1px dashed var(--line); background: var(--paper); font-weight: 600; text-align: center; }
.hm-recbtn span { font-size: 1.8rem; }
.hm-recbtn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.hm-recbtn:hover, .hm-recbtn:focus-within, .hm-recbtn:focus-visible { border-color: var(--indigo-2); background: var(--indigo-soft); }
.hm-pulse { width: 90px; height: 90px; border-radius: 50%; display: grid; place-items: center; font-size: 2.4rem; background: #fde8ef; animation: hm-pulse 1.4s ease-in-out infinite; margin: 0 auto; }
@keyframes hm-pulse { 50% { box-shadow: 0 0 0 16px rgba(178, 58, 110, .15); } }
.hm-rec-bar { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: center; }
.hm-dot { width: 10px; height: 10px; border-radius: 50%; background: #d92d20; animation: hm-blink 1s steps(2) infinite; }
@keyframes hm-blink { 50% { opacity: 0; } }
.hm-clock { font-variant-numeric: tabular-nums; font-weight: 600; }

/* RootHunt */
.modal.rh-modal { max-width: 560px; }
.rh-intro { text-align: center; padding: 10px 0; position: relative; }
.rh-big { font-size: 3.4rem; line-height: 1; margin-bottom: .4rem; }
.rh-top { display: flex; justify-content: space-between; font-size: .9rem; color: var(--ink-2); }
.rh-score { font-weight: 600; color: var(--gold); }
.rh-time { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 8px 0 14px; }
.rh-time-fill { display: block; height: 100%; background: linear-gradient(90deg, #1d7d61, #f2b33d); transition: width .25s linear; }
.rh-time-fill.low { background: #d92d20; }
.rh-photo { display: grid; place-items: center; margin-bottom: 10px; }
.rh-photo img { width: 150px; height: 150px; object-fit: cover; border-radius: 50%; border: 4px solid var(--gold-soft); }
.rh-q { text-align: center; font-size: 1.35rem; margin: .2rem 0 1rem; }
.rh-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rh-opts button { all: unset; box-sizing: border-box; cursor: pointer; text-align: center; padding: 14px 10px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface); font-weight: 600; transition: transform .12s ease, border-color .12s ease; }
.rh-opts button:hover:not(:disabled) { border-color: var(--indigo-2); transform: translateY(-2px); }
.rh-opts button:focus-visible { outline: 3px solid var(--focus); }
.rh-opts button.right { background: var(--leaf-soft); border-color: var(--leaf); color: var(--leaf); }
.rh-opts button.wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.rh-opts button:disabled { cursor: default; }
.rh-feedback { text-align: center; margin-top: 12px; min-height: 40px; }
.rh-verdict { font-weight: 700; font-size: 1.1rem; margin: 0 0 .2rem; }
.rh-verdict.ok { color: var(--leaf); } .rh-verdict.no { color: var(--danger); }
.rh-fact { color: var(--ink-2); font-size: .92rem; margin: 0 0 .6rem; }
.rh-go { font-size: 1.05rem; padding: .7em 2em; }
.rh-confetti { position: absolute; inset: -20px 0 auto; height: 0; pointer-events: none; }
.rh-confetti i { position: absolute; top: 0; left: calc(var(--k) * 4.2%); width: 8px; height: 14px; border-radius: 2px; background: hsl(calc(var(--k) * 37), 85%, 58%); animation: rh-fall 1.8s ease-in calc(var(--k) * 40ms) both; }
@keyframes rh-fall { from { transform: translateY(-10px) rotate(0); opacity: 1; } to { transform: translateY(260px) rotate(540deg); opacity: 0; } }

@media (max-width: 960px) {
  /* One column on phones: games and the elders first, then dates, then the board */
  .hm-grid { display: flex; flex-direction: column; }
  .hm-col { display: contents; }
  .hm-grid .o1 { order: 1; } .hm-grid .o2 { order: 2; } .hm-grid .o3 { order: 3; } .hm-grid .o4 { order: 4; } .hm-grid .o5 { order: 5; } .hm-grid .o6 { order: 6; }
  .hm-hero-in { grid-template-columns: 1fr; padding: 20px 18px; }
  .hm-quick { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .hm-hero h1 { font-size: 1.9rem; }
  .hm-dice { display: none; }
  .hm-card { padding: 16px; border-radius: 16px; }
  .rh-opts { grid-template-columns: 1fr; }
  .hm-qbtn { padding: 11px 12px; font-size: .9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hm-dice span, .hm-pulse, .hm-dot, .rh-confetti i, .hm-skel { animation: none; }
}
@media (prefers-color-scheme: dark) {
  .hm-games { background: linear-gradient(140deg, #2a2412 0%, var(--surface) 45%); }
  .hm-qbtn { background: rgba(255, 255, 255, .92); }
  .hm-pulse { background: #42221f; }
}

/* Relatives grouped by relationship */
.rel-group { margin-bottom: 18px; }
.rel-group-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.rel-group-head h2 { font-size: 1.15rem; margin: 0; display: flex; align-items: center; gap: .5rem; }
.rel-count { font-family: var(--sans); font-size: .78rem; font-weight: 600; background: var(--indigo-soft); color: var(--indigo); border-radius: 99px; padding: .05em .55em; }
.rel-empty { margin: 0 0 4px; padding: 10px 14px; border: 1px dashed var(--line); border-radius: var(--radius-m); }
.rel-empty { max-width: none; }

/* ── Origins & Heritage ──────────────────────────────── */
.page.og { max-width: 1180px; }
.og-hero { border-radius: 20px; padding: 26px 28px; margin-bottom: 18px; color: #fff; display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; align-items: flex-end;
  background: radial-gradient(90% 140% at 100% 0%, rgba(242, 179, 61, .45), transparent 55%), linear-gradient(135deg, #5b2a0e 0%, #8a4b14 45%, #1d7d61 100%); }
.og-hero h1 { color: #fff; margin: 0 0 .3rem; font-size: 2.3rem; }
.og-hero p { margin: .2rem 0; opacity: .92; max-width: 60ch; }
.og-hero .hm-kicker { color: #ffd98a; }
.og-hero-side { display: grid; justify-items: end; gap: 4px; text-align: right; }
.og-hero-side b { font-size: 2.2rem; font-family: var(--serif); line-height: 1; }
.og-hero-side .btn { margin-top: 8px; background: #fff; color: #5b2a0e; border-color: #fff; }
.og-clan-big { font-family: var(--serif); font-size: 1.15rem; }
.og-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.og-card { display: grid; gap: 6px; padding: 18px; border-radius: 18px; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-top: 5px solid #8a4b14; transition: transform .15s ease; }
.og-card:hover { transform: translateY(-3px); }
.og-card.og-c1 { border-top-color: #1d7d61; } .og-card.og-c2 { border-top-color: #b23a6e; } .og-card.og-c3 { border-top-color: #f2b33d; } .og-card.og-c4 { border-top-color: #140186; }
.og-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.og-card h2 { margin: 0; font-size: 1.35rem; }
.og-where, .og-meta { margin: 0; color: var(--ink-3); font-size: .88rem; }
.og-clan { margin: 0; font-size: .92rem; }
.og-faces { display: flex; align-items: center; margin: 4px 0; }
.og-faces .hm-face { margin-right: -8px; border: 2px solid var(--surface); }
.og-faces span:last-child { margin-left: 16px; font-size: .9rem; color: var(--ink-2); }
.og-start ul { padding-left: 1.1em; color: var(--ink-2); }
.og-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-bottom: 10px; }
.og-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.og-sec h2 { font-size: 1.1rem; margin: 0 0 .4rem; }
.og-sec p { margin: 0; white-space: pre-line; color: var(--ink-2); max-width: none; }
.og-praise { grid-column: 1 / -1; background: linear-gradient(135deg, var(--gold-soft), var(--surface)); }
.og-praise p { font-family: var(--serif); font-style: italic; font-size: 1.2rem; color: var(--ink); }
.og-history { grid-column: 1 / -1; }
.og-h2 { margin: 1.6rem 0 .7rem; font-size: 1.3rem; }
.og-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.og-person { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.og-person small { display: block; }
@media (max-width: 600px) { .og-hero { padding: 20px 18px; } .og-hero h1 { font-size: 1.8rem; } .og-hero-side { justify-items: start; text-align: left; } }

/* ── Family Union ────────────────────────────────────── */
.page.fu { max-width: 1100px; }
.fu-hero { border-radius: 20px; padding: 24px 26px; margin-bottom: 16px; color: #fff; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-end;
  background: radial-gradient(90% 140% at 100% 0%, rgba(242, 179, 61, .4), transparent 55%), linear-gradient(135deg, #0f4d3b 0%, #1d7d61 50%, #140186 100%); }
.fu-hero h1 { color: #fff; margin: 0 0 .3rem; font-size: 2.1rem; }
.fu-hero p { margin: .2rem 0; opacity: .92; max-width: 62ch; }
.fu-hero .hm-kicker { color: #ffd98a; }
.fu-hero .tag { background: rgba(255, 255, 255, .18); color: #fff; }
.fu-small h1 { font-size: 1.8rem; }
.fu-card { border-top-color: #1d7d61; }
.fu-empty ul { padding-left: 1.1em; color: var(--ink-2); }
.fu-tabs { margin-bottom: 14px; }
.fu-view { display: grid; gap: 12px; }
.fu-view > .panel, .fu-view > article { margin-bottom: 0; }
.fu-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.fu-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 2px; }
.fu-stat b { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.fu-stat span { color: var(--ink-3); font-size: .85rem; }
.fu-stat.due { background: var(--gold-soft); }
.fu-pay { border-left: 4px solid #1d7d61; }
.fu-meet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fu-meet h3, .fu-levy h3 { margin: 0 0 .2rem; }
.fu-meet p, .fu-levy p { margin: .2rem 0; }
.fu-meet details, .fu-levy details { margin-top: .6rem; }
.fu-meet summary, .fu-levy summary { cursor: pointer; font-weight: 600; }
.fu-bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: .6rem 0 .3rem; }
.fu-bar span { display: block; height: 100%; background: linear-gradient(90deg, #1d7d61, #f2b33d); }
.fu-pending { display: inline-flex; gap: 6px; align-items: center; font-size: .85rem; background: var(--gold-soft); border-radius: 8px; padding: 2px 6px; }
@media (max-width: 760px) { .fu-stats { grid-template-columns: 1fr 1fr; } }

/* ── Print shop: editor ──────────────────────────────── */
.page.pr { max-width: 1300px; }
.pr-hero { border-radius: 20px; padding: 24px 26px; margin-bottom: 18px; color: #fff;
  background: radial-gradient(90% 140% at 100% 0%, rgba(242, 179, 61, .45), transparent 55%), linear-gradient(135deg, #3d1f86 0%, #b23a6e 100%); }
.pr-hero h1 { color: #fff; margin: 0 0 .3rem; font-size: 2.1rem; }
.pr-hero p { margin: 0; opacity: .92; max-width: 62ch; }
.pr-hero .hm-kicker { color: #ffd98a; }
.pr-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pr-kind { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: .4rem; box-shadow: var(--shadow); }
.pr-kind h2 { margin: 0; font-size: 1.25rem; }
.pr-kind p { margin: 0; color: var(--ink-2); }
.pr-kind .btn { align-self: flex-start; margin-top: auto; }
.pr-kind-ico { font-size: 2.2rem; }
.pr-price { font-weight: 600; color: var(--ink) !important; margin: .4rem 0 !important; }
.pr-bar { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.pr-bar h1 { margin: 0; font-size: 1.7rem; }
.pr-bar p { margin: .2rem 0 0; }
.pr-layout { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 18px; align-items: start; }
.pr-form { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; max-height: calc(100vh - 120px); overflow-y: auto; position: sticky; top: 12px; }
.pr-preview-wrap { min-width: 0; }
.pr-preview { --scale: .5; display: grid; gap: 14px; justify-items: center; }
.pr-preview .pp { zoom: var(--scale); box-shadow: 0 6px 24px rgba(0, 0, 0, .18); }
.pr-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pr-photos button { all: unset; cursor: pointer; border-radius: 8px; overflow: hidden; aspect-ratio: 1; border: 3px solid transparent; }
.pr-photos button[aria-pressed=true] { border-color: var(--indigo); }
.pr-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pr-tribute { display: grid; gap: 6px; padding: 10px; border: 1px dashed var(--line); border-radius: 10px; margin-bottom: 8px; }
.pr-tribute .btn { justify-self: start; }
@media (max-width: 900px) { .pr-layout { grid-template-columns: 1fr; } .pr-form { position: static; max-height: none; } }

/* ── Print shop: the printed pages (real paper sizes) ── */
.pp { position: relative; overflow: hidden; background: #fffdf8; color: #1b1b2b; font-family: var(--serif); box-sizing: border-box; flex: none; }
.pp-in { position: absolute; inset: 0; padding: 12mm; display: flex; flex-direction: column; box-sizing: border-box; }
.pp h1, .pp h2, .pp h3 { font-family: var(--serif); color: inherit; margin: 0; }
.pp p { max-width: none; }
.pp-wm { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; font: 700 22mm/1 var(--sans); color: rgba(178, 58, 110, .14); transform: rotate(-28deg); letter-spacing: 2mm; white-space: nowrap; }
.th-indigo { --pp-a: #140186; --pp-b: #b8860b; --pp-bg: #fffdf8; }
.th-earth { --pp-a: #5b2a0e; --pp-b: #1d7d61; --pp-bg: #f6eddc; }
.th-classic { --pp-a: #111; --pp-b: #555; --pp-bg: #fff; }
.th-royal { --pp-a: #4b1c7a; --pp-b: #c9a227; --pp-bg: #fbf8ff; }
.pp { background: var(--pp-bg); }
.pp h2 { color: var(--pp-a); font-size: 7mm; margin-bottom: 4mm; border-bottom: .4mm solid var(--pp-b); padding-bottom: 2mm; }
/* Poster */
.pp-poster .pp-in { padding: 12mm 14mm 9mm; border: 3mm double var(--pp-b); inset: 6mm; }
.pp-poster-head { text-align: center; margin-bottom: 5mm; }
.pp-poster-head h1 { font-size: 15mm; color: var(--pp-a); letter-spacing: .3mm; }
.pp-poster-head p { margin: 1mm 0 0; font-style: italic; font-size: 5.5mm; color: var(--pp-b); }
.pp-tree-wrap { flex: 1; min-height: 0; display: grid; }
.pp-tree { width: 100%; height: 100%; }
.pp-tree .ln { stroke: var(--pp-a); stroke-width: 1.6; fill: none; opacity: .7; }
.pp-tree .card { fill: #fff; stroke: var(--pp-a); stroke-width: 1.4; }
.pp-tree .card.late { fill: #f4f1ea; }
.pp-tree .ph { fill: #ece8f7; }
.pp-tree .ini { font: 600 15px var(--sans); fill: var(--pp-a); }
.pp-tree .nm { font: 600 13px var(--serif); fill: #1b1b2b; }
.pp-tree .yr { font: 11px var(--sans); fill: #555; }
.pp-tree .sp { font: italic 10.5px var(--serif); fill: var(--pp-b); }
.pp-foot { display: flex; justify-content: space-between; font: 3.2mm var(--sans); color: #666; margin-top: 3mm; }
/* Programme (A5) */
.pp-programme .pp-in { padding: 11mm 11mm; font-size: 3.7mm; line-height: 1.5; }
.pg-cover { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 3mm; border: .6mm solid var(--pp-b); margin: -3mm; padding: 6mm; }
.pg-heading { font-size: 5mm; letter-spacing: 1mm; text-transform: uppercase; color: var(--pp-b); margin: 0; }
.pg-portrait { width: 70mm; height: 88mm; border-radius: 35mm 35mm 4mm 4mm; overflow: hidden; border: 1.2mm solid var(--pp-b); background: #eee; display: grid; place-items: center; font-size: 20mm; }
.pg-portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.15); }
.pg-cover h1 { font-size: 9mm; color: var(--pp-a); }
.pg-epithet { font-style: italic; margin: 0; color: #444; }
.pg-dates { display: flex; gap: 4mm; align-items: center; margin: 0; font-size: 4mm; }
.pg-dates small { display: block; font: 2.6mm var(--sans); text-transform: uppercase; letter-spacing: .6mm; color: #777; }
.pg-dash { color: var(--pp-b); }
.pg-service { text-align: center; font-style: italic; margin-bottom: 4mm; }
.pg-service p { margin: 0; }
.pg-order { margin: 0; padding-left: 6mm; }
.pg-order li { padding: 1.2mm 0; border-bottom: .2mm dotted #bbb; }
.pg-text p { margin: 0 0 2.5mm; text-align: justify; }
.pg-tribute { margin-bottom: 5mm; }
.pg-from { text-align: right; font-style: italic; color: var(--pp-a); margin: 0; }
.pg-family p { margin: 0 0 2.5mm; }
.pg-family b { display: block; color: var(--pp-a); font-size: 3.4mm; text-transform: uppercase; letter-spacing: .4mm; }
.pg-photos { flex: 1; display: grid; gap: 2.5mm; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; }
.pg-photos.n1 { grid-template-columns: 1fr; } .pg-photos.n5, .pg-photos.n6, .pg-photos.n7, .pg-photos.n8, .pg-photos.n9 { grid-template-columns: 1fr 1fr 1fr; }
.pg-photos figure { margin: 0; overflow: hidden; border-radius: 1.5mm; position: relative; background: #eee; }
.pg-photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pg-photos figcaption { position: absolute; inset: auto 0 0 0; background: rgba(0, 0, 0, .55); color: #fff; font: 2.4mm var(--sans); padding: 1mm 1.5mm; }
.pg-lines { flex: 1; display: grid; gap: 0; }
.pg-lines span { border-bottom: .2mm solid #ccc; }
.pg-back { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 2mm; }
.pg-back blockquote { font-style: italic; font-size: 4.5mm; margin: 0 0 10mm; color: var(--pp-a); }
.pg-small { font: 3mm var(--sans); color: #777; margin: 0; }
/* Book (A4) */
.pp-book .pp-in { padding: 18mm 18mm; font-size: 4mm; line-height: 1.55; }
.pp-book h2 { font-size: 9mm; }
.pp-book h3 { color: var(--pp-a); font-size: 5.5mm; margin: 4mm 0 1.5mm; }
.bk-cover { flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 6mm; border: 1mm solid var(--pp-b); margin: -6mm; padding: 10mm; }
.bk-cover-img { width: 140mm; height: 110mm; overflow: hidden; border: 1.5mm solid #fff; box-shadow: 0 1mm 4mm rgba(0, 0, 0, .25); }
.bk-cover-img img { width: 100%; height: 100%; object-fit: cover; filter: sepia(.25); }
.bk-cover h1 { font-size: 16mm; color: var(--pp-a); }
.bk-sub { font-style: italic; font-size: 6mm; color: var(--pp-b); margin: 0; }
.bk-year { font: 4mm var(--sans); letter-spacing: 1mm; color: #777; margin: 0; }
.bk-person { display: grid; grid-template-columns: 38mm 1fr; gap: 6mm; padding: 5mm 0; border-bottom: .3mm solid #ddd; }
.bk-person img, .bk-ini { width: 38mm; height: 46mm; object-fit: cover; border-radius: 1.5mm; }
.bk-ini { display: grid; place-items: center; background: #eee; color: var(--pp-a); font: 600 12mm var(--sans); }
.bk-person h3 { margin-top: 0; }
.bk-meta { font: 3.4mm var(--sans); color: #666; margin: 0 0 2mm; }
.bk-person p { margin: 0 0 1.5mm; }
.bk-photos { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); gap: 5mm; }
.bk-photos figure { margin: 0; display: flex; flex-direction: column; min-height: 0; }
.bk-photos img { flex: 1; min-height: 0; width: 100%; object-fit: cover; border: 1mm solid #fff; box-shadow: 0 .5mm 2mm rgba(0, 0, 0, .2); }
.bk-photos figcaption { font: 3mm var(--sans); color: #555; padding-top: 1.5mm; }

/* Only the document prints */
#print-root { display: none; }
@media print {
  body.printing-doc > *:not(#print-root) { display: none !important; }
  body.printing-doc #print-root { display: block; }
  body.printing-doc { background: #fff; margin: 0; }
  #print-root .pp { break-after: page; page-break-after: always; box-shadow: none; zoom: 1; }
  #print-root .pp:last-child { break-after: auto; page-break-after: auto; }
  .pp, .pp * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
