/*
 * Idealmate — visual system
 * Themes live in :root (purple and pink, the default) and [data-theme="…"] blocks.
 * Every colour is a variable, so a theme is only a new block of variables.
 * The variables are named --jade and --celadon for historical reasons; read them
 * as "primary" and "surface". Seal is reserved for liking and the match moment.
 * Type: Noto Serif SC (headings) / Noto Sans SC (text) so English and Chinese share one voice.
 */
:root {
  /* Warm purple and pink (default) */
  --ink: #2b1f30;
  --mist: #6f6276;
  --jade: #7c4d92;
  --jade-deep: #5d3870;
  --celadon: #f4e9f5;
  --celadon-deep: #e9d7ec;
  --paper: #fdfafc;
  --line: #e2cfe4;
  --seal: #cc4680;
  --danger: #a32a3f;
  --ring: rgba(124, 77, 146, 0.18);
  --veil: rgba(43, 31, 48, 0.62);
  /* Placeholder avatar tones, picked by user ID. Light enough for --ink text on each. */
  --av-0: #f3d9ec; --av-1: #e6d9f7; --av-2: #f7dfe0;
  --av-3: #dde3f7; --av-4: #f6e6d4; --av-5: #d9eee9;

  --serif: "Noto Serif SC", "Noto Sans Arabic", "Songti SC", "STSong", Georgia, serif;
  --sans: "Noto Sans SC", "Noto Sans Arabic", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;

  --s-1: 0.875rem;
  --s0: 1rem;
  --s1: 1.25rem;
  --s2: 1.5625rem;
  --s3: 1.953rem;
  --s4: 2.441rem;

  --gap: 1.25rem;
  --rail: 13.5rem;
  --measure: 38rem;
}

/* Ink and jade on cool paper — the original look. */
[data-theme="jade"] {
  --ink: #1d2a2e;
  --mist: #5a6a67;
  --jade: #2f6b5e;
  --jade-deep: #22524a;
  --celadon: #e4eee8;
  --celadon-deep: #d3e3da;
  --paper: #fbfcfa;
  --line: #c9d7cf;
  --seal: #b23a2b;
  --danger: #8f2a20;
  --ring: rgba(47, 107, 94, 0.18);
  --veil: rgba(29, 42, 46, 0.62);
  --av-0: #d3e8de; --av-1: #dfe9d2; --av-2: #d6e4ec;
  --av-3: #ece5d3; --av-4: #e3dcec; --av-5: #f1dcd6;
}

/* Warm sand and terracotta. */
[data-theme="sand"] {
  --ink: #2d2620;
  --mist: #6e6154;
  --jade: #9a5b32;
  --jade-deep: #7a4525;
  --celadon: #f3ebe0;
  --celadon-deep: #e7dac8;
  --paper: #fdfbf7;
  --line: #ddcdb8;
  --seal: #b23a2b;
  --danger: #8f2a20;
  --ring: rgba(154, 91, 50, 0.18);
  --veil: rgba(45, 38, 32, 0.62);
  --av-0: #f1dcc6; --av-1: #e9d9c9; --av-2: #f0d6cf;
  --av-3: #dfe3cd; --av-4: #d8e1e3; --av-5: #eadbe3;
}

[data-theme-pick][aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
[data-locale][aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--s0)/1.6 var(--sans);
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5em;
  letter-spacing: 0.005em;
}
h1 { font-size: var(--s3); }
h2 { font-size: var(--s1); margin-top: 2rem; }
h3 { font-size: var(--s0); }
p { margin: 0 0 1em; max-width: var(--measure); }

a { color: var(--jade-deep); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

img { max-width: 100%; display: block; }

:focus-visible { outline: 3px solid var(--jade); outline-offset: 2px; border-radius: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; z-index: 50; }
.skip:focus { left: 0; }

.lede { color: var(--mist); font-size: var(--s1); line-height: 1.5; }
.muted, .hint, small { color: var(--mist); font-size: var(--s-1); }
.fineprint { color: var(--mist); font-size: var(--s-1); }

/* ------------------------------------------------------------------ shell */
/* The top bar spans the page and carries identity: the brand, and who you are signed in as.
   The rail below carries the places you move between all day. */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem clamp(1.25rem, 4vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky; top: 0; z-index: 30;
}
.topbar-actions { display: flex; gap: 1.25rem; align-items: center; }
.brand {
  font-family: var(--serif); font-weight: 700; font-size: var(--s1);
  color: var(--ink); text-decoration: none;
}

.has-shell .shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: calc(100vh - 3.6rem);
}
.rail {
  position: sticky; top: 3.6rem; height: calc(100vh - 3.6rem);
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.75rem 1.25rem;
  background: var(--celadon);
}
.rail ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.rail a {
  display: block; padding: 0.45rem 0.75rem; border-radius: 0.4rem;
  color: var(--ink); text-decoration: none;
}
.rail a:hover { background: var(--celadon-deep); }
.rail a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.rail-foot { margin-top: auto; display: grid; gap: 0.25rem; font-size: var(--s-1); }
.rail-foot a, .rail-foot .linklike { padding: 0.25rem 0.75rem; text-align: left; }

/* The account menu: a native <details>, so it opens without script. */
.account-menu { position: relative; }
.account-menu > summary {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.3rem 0.6rem 0.3rem 0.3rem; border-radius: 999px;
  cursor: pointer; list-style: none;
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover { background: var(--celadon); }
.account-menu > summary::after {
  content: ""; width: 0.45rem; height: 0.45rem; flex: none;
  border-right: 2px solid var(--mist); border-bottom: 2px solid var(--mist);
  transform: rotate(45deg) translateY(-0.12rem);
}
.account-menu[open] > summary::after { transform: rotate(-135deg) translateY(-0.12rem); }
.account-name { font-weight: 500; }
.account-wrap { position: relative; }
.avatar {
  display: grid; place-items: center; flex: none;
  width: 2.5rem; height: 2.5rem; border-radius: 50%; overflow: hidden;
  font: 700 1.1rem/1 var(--serif); color: var(--ink); object-fit: cover;
}
.avatar-t0 { background: var(--av-0); } .avatar-t1 { background: var(--av-1); }
.avatar-t2 { background: var(--av-2); } .avatar-t3 { background: var(--av-3); }
.avatar-t4 { background: var(--av-4); } .avatar-t5 { background: var(--av-5); }
.avatar-none { background: var(--celadon); color: var(--mist); }
/* Sits on the avatar's lower outer corner; the summary's padding is 0.3rem and the avatar 2.5rem. */
.avatar-add {
  position: absolute; z-index: 1; top: 1.95rem; inset-inline-start: 1.95rem;
  display: grid; place-items: center; width: 1.05rem; height: 1.05rem; border-radius: 50%;
  font: 700 0.85rem/1 var(--sans); text-decoration: none;
  background: var(--paper); color: var(--jade-deep); box-shadow: 0 0 0 2px var(--jade);
  opacity: 0.9;
}
.avatar-add:hover, .avatar-add:focus-visible { opacity: 1; }
.account-drop {
  position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 40;
  min-width: 12rem; padding: 0.4rem;
  display: grid; gap: 0.1rem;
  background: var(--paper); border: 1.5px solid var(--line);
  border-radius: 0.5rem; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
.account-drop a, .account-drop .linklike {
  padding: 0.5rem 0.75rem; border-radius: 0.35rem;
  color: var(--ink); text-decoration: none; text-align: left; font: inherit;
}
.account-drop a:hover, .account-drop .linklike:hover { background: var(--celadon); }
.account-drop a[aria-current="page"] { font-weight: 700; }

main { padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem) 5rem; min-width: 0; }
main:focus { outline: none; }

.narrow { max-width: 32rem; margin: 0 auto; }
.narrowish { max-width: 68rem; }
.page-head { margin-bottom: 1.75rem; display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: end; justify-content: space-between; }
.page-head .lede { margin: 0; flex-basis: 100%; max-width: none; }
/* ------------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.75rem; padding: 0 1.35rem;
  border: 1.5px solid transparent; border-radius: 999px;
  font: 500 var(--s0)/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn-small { min-height: 2.25rem; padding: 0 1rem; font-size: var(--s-1); }
.btn-primary { background: var(--jade); color: #fff; }
.btn-primary:hover { background: var(--jade-deep); color: #fff; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--ink); color: var(--ink); }
.btn-like { background: transparent; color: var(--seal); border-color: var(--seal); }
.btn-like:hover { background: var(--seal); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn[disabled] { opacity: 0.55; cursor: progress; }

.linklike {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--jade-deep); font: inherit; text-decoration: underline; text-underline-offset: 0.18em;
}
.linklike.muted { color: var(--mist); }

.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.stack { display: grid; gap: 1.1rem; }
.stack > .btn { justify-self: start; }

label { display: grid; gap: 0.35rem; font-weight: 500; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
legend { font-weight: 500; margin-bottom: 0.5rem; padding: 0; }

input[type=text], input[type=email], input[type=password], input[type=number], input[type=date],
input[type=tel], input[type=search], input:not([type]), select, textarea {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.8rem;
  border: 1.5px solid var(--line);
  border-radius: 0.45rem;
  background: #fff;
  color: var(--ink);
  font: 400 var(--s0)/1.4 var(--sans);
}
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--jade); outline: none; box-shadow: 0 0 0 3px var(--ring); }
[aria-invalid="true"] { border-color: var(--danger) !important; }

.check { display: flex; gap: 0.6rem; align-items: baseline; font-weight: 400; }
.check input { flex: none; accent-color: var(--jade); width: 1.05rem; height: 1.05rem; }
.check small { display: block; flex-basis: 100%; padding-left: 1.65rem; margin-top: -0.35rem; }
fieldset .check { flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.chip { display: inline-block; font-weight: 400; }
.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip span {
  display: inline-block; padding: 0.35rem 0.85rem;
  border: 1.5px solid var(--line); border-radius: 999px;
  cursor: pointer; user-select: none;
}
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.chip input:focus-visible + span { outline: 3px solid var(--jade); outline-offset: 2px; }

.range { display: flex; align-items: center; gap: 0.5rem; }
.range input { max-width: 6.5rem; }

/* ------------------------------------------------------------------ match preferences */
.pref-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.35rem; }
.pref-head .field-label { font-weight: 500; }
/* A legend can't live inside a flex row, so this row holds only the toggle and pulls up beside it. */
.pref-head-legend { margin-top: -2rem; justify-content: flex-end; pointer-events: none; }
.pref-head-legend .strength-pill { pointer-events: auto; }

.strength-pill { display: inline-block; font-weight: 400; }
.strength-pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.strength-pill span {
  display: inline-block; padding: 0.2rem 0.75rem;
  border: 1.5px solid var(--line); border-radius: 999px;
  color: var(--mist); font-size: var(--s-1); cursor: pointer; user-select: none;
  white-space: nowrap;
}
.strength-pill input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.strength-pill input:focus-visible + span { outline: 3px solid var(--jade); outline-offset: 2px; }

/* Each preference is its own block, so one set of options doesn't run into the next. */
.prefs-form { gap: 0.85rem; }
.prefs-form > .field {
  border: 1px solid var(--line); border-radius: 0.55rem;
  padding: 1rem 1.15rem; margin: 0;
  background: #fff;
}
.prefs-form > .field .pref-head { margin-bottom: 0.6rem; }
.prefs-form > .field > legend { font-weight: 500; padding: 0; }
/* A required deal-breaker is visible at a glance down the column. */
.prefs-form > .field:has(input[name^="req:"]:checked) { border-color: var(--ink); background: var(--celadon); }

.field-error { color: var(--danger); font-weight: 500; }
.form-error { color: var(--danger); font-weight: 500; margin: 0; }

.field-group { border-top: 1px solid var(--line); padding-top: 1.25rem; margin-top: 0.5rem; gap: 1.1rem; }
.field-group > legend { font-family: var(--serif); font-size: var(--s1); float: left; width: 100%; margin-bottom: 0.25rem; }

/* Collapsible group on the profile editor */
.group-box { border-top: 1px solid var(--line); margin-top: 0.5rem; }
.group-box > summary {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.85rem 0.15rem; cursor: pointer; list-style: none;
  font-family: var(--serif); font-weight: 700; font-size: var(--s1);
}
.group-box > summary::-webkit-details-marker { display: none; }
.group-box > summary::after {
  content: ""; width: 0.5rem; height: 0.5rem; margin-left: auto; flex: none;
  border-right: 2px solid var(--mist); border-bottom: 2px solid var(--mist);
  transform: rotate(45deg) translate(-0.15rem, -0.15rem); transition: transform 0.15s;
}
.group-box[open] > summary::after { transform: rotate(-135deg) translate(-0.1rem, -0.1rem); }
.group-box .group-count { color: var(--mist); font: 400 var(--s-1) var(--sans); }
.group-box > .field-group { border-top: 0; margin-top: 0; padding-top: 0; padding-bottom: 1.25rem; }
.group-box > .group-body { padding: 0 0.15rem 1.5rem; }
.group-box > .group-body > h3:first-child { margin-top: 0; }
.group-box > .group-body h3 { margin-top: 1.5rem; }

.field { display: grid; gap: 0.4rem; }
.field-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.field-head label { font-weight: 500; }
select.vis { width: auto; min-height: 2rem; padding: 0.2rem 0.5rem; font-size: var(--s-1); color: var(--mist); }
.strength { font-size: var(--s-1); color: var(--mist); }

.badge {
  display: inline-block; margin-left: 0.5rem; padding: 0.05rem 0.5rem;
  border-radius: 999px; background: var(--celadon); color: var(--jade-deep);
  font: 500 0.75rem/1.6 var(--sans); vertical-align: middle;
}
.badge-premium { background: var(--ink); color: var(--paper); }
.pill { display: inline-block; padding: 0.3rem 0.9rem; border-radius: 999px; background: var(--celadon); font-size: var(--s-1); }

.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.plain-list li { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

.empty { color: var(--mist); padding: 2rem 0; }

#toast {
  position: fixed; left: 50%; bottom: 1.5rem; z-index: 60;
  /* Fully below the screen when hidden, however short the toast is. */
  transform: translate(-50%, calc(100% + 2rem));
  visibility: hidden;
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 0.75rem 1.25rem; border-radius: 0.5rem;
  background: var(--ink); color: var(--paper);
  transition: transform 0.2s ease, visibility 0.2s;
}
#toast.show { transform: translate(-50%, 0); visibility: visible; }
#toast[data-kind="error"] { background: var(--danger); }

/* ------------------------------------------------------------------ home */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 2rem; align-items: center;
  max-width: 68rem; margin: 3rem auto 4rem;
}
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.15; max-width: 16ch; }
.seal-demo { margin: 0; display: grid; place-items: center; min-height: 14rem; }
.pillars {
  max-width: 68rem; margin: 0 auto 3rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 2.5rem;
  border-top: 1px solid var(--line); padding-top: 2rem;
}
.pillars h2 { margin-top: 0; }
.home .fineprint, main > .fineprint { max-width: 68rem; margin: 0 auto; }

/* The seal: the product's one loud mark */
.seal {
  display: inline-grid; place-items: center;
  width: 9.5rem; height: 9.5rem; border-radius: 50%;
  border: 3px solid var(--seal);
  box-shadow: inset 0 0 0 5px var(--paper), inset 0 0 0 7px var(--seal);
  color: var(--seal);
  font: 700 var(--s2)/1.1 var(--serif);
  text-align: center; padding: 1rem;
  transform: rotate(-8deg);
}

/* ------------------------------------------------------------------ cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 2rem var(--gap);
}
.card { display: grid; align-content: start; gap: 0.7rem; transition: opacity 0.25s, transform 0.25s; }
.card.gone { opacity: 0; transform: scale(0.97); }
.card-photo { display: block; aspect-ratio: 1; overflow: hidden; border-radius: 0.6rem; background: var(--celadon); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.no-photo {
  display: grid; place-items: center; width: 100%; height: 100%;
  font: 700 3rem/1 var(--serif); color: var(--jade);
  background: var(--celadon);
}
.no-photo.small { width: 2.5rem; height: 2.5rem; border-radius: 50%; font-size: 1.1rem; }
.no-photo.big { aspect-ratio: 1; border-radius: 0.6rem; }
.card-body { display: grid; gap: 0.2rem; }
.card-body h3 { margin: 0; font-size: var(--s1); }
.card-body h3 a { color: var(--ink); text-decoration: none; }
.card-body h3 a:hover { text-decoration: underline; }
.card-meta, .card-status { margin: 0; color: var(--mist); font-size: var(--s-1); }
.card-intent { margin: 0; font-size: var(--s-1); }
.card-match { margin-top: 0.4rem; font-size: var(--s-1); }
.card-match .pct { font-weight: 700; color: var(--jade-deep); }
.card-match ul { margin: 0.2rem 0 0; padding-left: 1.1rem; color: var(--mist); }
.card-actions { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.card-actions .btn { flex: 1; }
.card-status.is-online { color: var(--jade-deep); font-weight: 500; }
.card-status.is-online::before {
  content: ""; display: inline-block; vertical-align: middle;
  width: 0.5rem; height: 0.5rem; margin-right: 0.35rem;
  border-radius: 50%; background: #3aa76d;
}
[dir="rtl"] .card-status.is-online::before { margin-right: 0; margin-left: 0.35rem; }

/* ------------------------------------------------------------------ search */
.search-layout { display: grid; grid-template-columns: 17rem minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.filters { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); overflow: auto; padding-right: 0.5rem; }
.filter { border-top: 1px solid var(--line); padding: 0.6rem 0; }
.filter summary { cursor: pointer; font-weight: 500; }
.filter[open] summary { margin-bottom: 0.6rem; }
.inline-form { display: flex; gap: 0.5rem; }
.inline-form input { min-width: 14rem; }
#more { margin-top: 2rem; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 0.25rem; margin-bottom: 2rem; border-bottom: 1px solid var(--line); }
.tabs button {
  background: none; border: 0; padding: 0.6rem 1rem; cursor: pointer;
  font: 500 var(--s0) var(--sans); color: var(--mist);
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ------------------------------------------------------------------ member */
.member-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.gallery img { aspect-ratio: 1; object-fit: cover; border-radius: 0.4rem; }
.gallery img:first-child { grid-column: 1 / -1; aspect-ratio: 1; max-height: 32rem; border-radius: 0.6rem; }
.member-intro h1 { font-size: var(--s4); margin-bottom: 0.25rem; }
.member-actions { margin: 1.5rem 0 1rem; }
.member-safety { font-size: var(--s-1); gap: 1.25rem; }
.member-body { max-width: var(--measure); margin-top: 3rem; }
.about { white-space: pre-line; font-size: var(--s1); line-height: 1.6; }
.prompt { margin: 1.75rem 0; padding: 1.25rem 1.5rem; background: var(--celadon); border-radius: 0.5rem; }
.prompt p { margin: 0; }
.prompt-q { font-family: var(--serif); font-weight: 700; margin-bottom: 0.4rem !important; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.55rem 2rem; margin-top: 2rem; }
.details dt { color: var(--mist); }
.details dd { margin: 0; }
.member-section { border-top: 1px solid var(--line); }
.member-section > summary {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.85rem 0.15rem; cursor: pointer; list-style: none;
  font-family: var(--serif); font-weight: 700;
}
.member-section > summary::-webkit-details-marker { display: none; }
.member-section > summary::after {
  content: ""; width: 0.5rem; height: 0.5rem; margin-left: auto; flex: none;
  border-right: 2px solid var(--mist); border-bottom: 2px solid var(--mist);
  transform: rotate(45deg) translate(-0.15rem, -0.15rem); transition: transform 0.15s;
}
.member-section[open] > summary::after { transform: rotate(-135deg) translate(-0.1rem, -0.1rem); }
.member-section .sec-count { color: var(--mist); font: 400 var(--s-1) var(--sans); margin-left: 0; }
.member-section .details { margin-top: 0; margin-bottom: 1.25rem; }

dialog {
  border: 0; border-radius: 0.75rem; padding: 1.75rem;
  width: min(30rem, calc(100vw - 2rem)); color: var(--ink);
}
dialog::backdrop { background: var(--veil); }
dialog h2 { margin-top: 0; }

/* ------------------------------------------------------------------ match moment */
.match-moment {
  position: fixed; inset: 0; z-index: 70;
  display: grid; place-items: center;
  background: var(--paper); opacity: 0.97;
}
.match-box { display: grid; justify-items: center; gap: 1.25rem; text-align: center; padding: 1.5rem; }
.match-line { font: 700 var(--s2)/1.3 var(--serif); margin: 0; }
.seal-stamp { animation: stamp 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
@keyframes stamp {
  0% { transform: rotate(-8deg) scale(1.6); opacity: 0; }
  60% { transform: rotate(-8deg) scale(0.94); opacity: 1; }
  100% { transform: rotate(-8deg) scale(1); }
}

/* admin */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.5rem; margin-bottom: 2rem; }
.panel { background: var(--celadon); border-radius: 0.6rem; padding: 1.25rem; }
.panel h2 { margin-top: 0; }
.admin-toolbar { justify-content: space-between; margin-bottom: 0.75rem; }
.admin-toolbar input[type=search] { max-width: 20rem; }
.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: var(--s-1); }
.admin-table th { text-align: left; font-weight: 500; color: var(--mist); border-bottom: 1px solid var(--line); padding: 0.5rem; }
.admin-table td { border-bottom: 1px solid var(--line); padding: 0.5rem; vertical-align: middle; }
.admin-photo img { width: 3rem; height: 3rem; object-fit: cover; border-radius: 0.4rem; }
.admin-login code { display: block; font-size: 0.8rem; word-break: break-all; }
code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; background: var(--paper); padding: 0.1rem 0.35rem; border-radius: 0.25rem; }

/* admin members */
.admin-tools { margin-bottom: 1.5rem; }
.admin-tools > summary { cursor: pointer; font-weight: 500; }
.admin-tools[open] > summary { margin-bottom: 1rem; }
.admin-tools .admin-grid { margin-bottom: 0; }
.admin-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem 1rem; margin-bottom: 1rem; }
.admin-filters label, .admin-filters fieldset { font-size: var(--s-1); }
.admin-filters select, .admin-filters input { min-height: 2.35rem; padding: 0.3rem 0.6rem; }
.admin-filters .range input { width: 5rem; }
.admin-filters .grow { flex: 1; min-width: 12rem; }
.admin-filters legend { margin-bottom: 0.35rem; }
.inline-label { display: flex; align-items: center; gap: 0.5rem; font-size: var(--s-1); font-weight: 400; }
.inline-label select { width: auto; min-height: 2.25rem; padding: 0.2rem 0.5rem; }
.lang-select { width: auto; min-height: 2.25rem; padding: 0.2rem 0.6rem; font-size: var(--s-1); }
.admin-toolbar p { margin: 0; }
.admin-actions { white-space: nowrap; }
.admin-actions .btn { margin-right: 0.5rem; }
.pager { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; justify-content: center; margin: 1.5rem 0; }
.pager-btn { min-width: 2.25rem; height: 2.25rem; border: 1.5px solid var(--line); border-radius: 0.4rem; background: transparent; cursor: pointer; font: inherit; color: var(--ink); }
.pager-btn.is-current { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.pager-btn:disabled { opacity: 0.4; cursor: default; }
.pager-gap { color: var(--mist); padding: 0 0.25rem; }
.md-box { width: min(46rem, 100%); max-height: calc(100vh - 2rem); }
.md-box:focus { outline: none; }
.md-head { position: relative; padding-right: 5rem; }
.md-head h2 { margin: 0; }
.md-head p { margin: 0.25rem 0 0; }
.md-close { position: absolute; top: 0; right: 0; }
.md-photos { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.md-photos figure { margin: 0; }
.md-photos img { width: 6rem; height: 6rem; object-fit: cover; border-radius: 0.4rem; }
.md-photos figcaption { font-size: 0.75rem; color: var(--mist); }
.md-section { border-top: 1px solid var(--line); padding-top: 0.75rem; }
.md-section h3 { margin: 0 0 0.5rem; }
.md-section .details { margin-top: 0; font-size: var(--s-1); }
.md-section .details .badge { margin-left: 0.4rem; }
.md-section .prompt { margin: 0.75rem 0; padding: 0.75rem 1rem; }

/* page-level notices (script failures, no-JS fallback) */
.notice, .noscript {
  margin: 0 0 1.25rem; padding: 0.8rem 1rem; border-radius: 0.45rem;
  background: #f6e7e4; color: var(--danger); font-weight: 500; max-width: none;
}
.notice-ok { background: var(--celadon); color: var(--jade-deep); }
.noscript { margin: 0; border-radius: 0; text-align: center; }

/* measurement units */
.unit-input { display: inline-flex; align-items: center; gap: 0.4rem; }
.unit-input select { width: auto; min-width: 8rem; }
.unit-input input[type=number] { max-width: 7rem; }
.unit-suffix { color: var(--mist); font-size: var(--s-1); }
.unit-toggle { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; font-size: var(--s-1); }
.unit-toggle-label { color: var(--mist); margin-right: 0.35rem; }
.unit-toggle button {
  border: 1.5px solid var(--line); background: transparent; color: var(--ink);
  padding: 0.2rem 0.75rem; border-radius: 999px; cursor: pointer; font: inherit;
}
.unit-toggle button.is-on { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.field-group > .unit-toggle { margin-bottom: 0.25rem; }
.units-setting .unit-toggle-label { display: none; }

/* photo cropper */
.crop-modal {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center; padding: 1rem;
  background: var(--veil);
}
.crop-box {
  width: min(26rem, 100%); max-height: calc(100vh - 2rem); overflow: auto;
  background: var(--paper); border-radius: 0.75rem; padding: 1.25rem;
  display: grid; gap: 0.75rem;
}
.crop-title { margin: 0; font-size: var(--s1); }
.crop-box .hint { margin: 0; }
.crop-stage {
  /* Square at any screen height (a max-height would break the ratio and distort the crop). */
  position: relative; overflow: hidden; aspect-ratio: 1;
  width: min(100%, calc(60vh * 0.8)); margin: 0 auto;
  background: #111; border-radius: 0.4rem; cursor: grab; touch-action: none; user-select: none;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage img { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.crop-grid {
  position: absolute; inset: 0; pointer-events: none;
  background:
          linear-gradient(to right, transparent 33.1%, rgba(255,255,255,.45) 33.3%, transparent 33.5%, transparent 66.5%, rgba(255,255,255,.45) 66.7%, transparent 66.9%),
          linear-gradient(to bottom, transparent 33.1%, rgba(255,255,255,.45) 33.3%, transparent 33.5%, transparent 66.5%, rgba(255,255,255,.45) 66.7%, transparent 66.9%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
}
.crop-controls { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.crop-zoom { display: flex; align-items: center; gap: 0.6rem; flex: 1; font-weight: 400; }
.crop-zoom input { flex: 1; accent-color: var(--jade); }
.crop-actions { justify-content: flex-end; }
.photo-actions { flex-wrap: wrap; }
.photo-move { position: absolute; top: 0.4rem; right: 0.4rem; display: flex; gap: 0.2rem; }
.move-btn {
  width: 1.75rem; height: 1.75rem; padding: 0; line-height: 1;
  border: 0; border-radius: 50%; cursor: pointer;
  background: var(--ink); color: var(--paper); font: 500 0.9rem/1 var(--sans);
}
.move-btn:disabled { opacity: 0.35; cursor: default; }
[dir="rtl"] .photo-move { right: auto; left: 0.4rem; }

/* prompt answers: as many as they like, two suggested */
.prompt-count { margin: 0; font-weight: 500; color: var(--jade-deep); }
.prompt-count.is-over { color: var(--danger); }
.prompt-count.is-soft { color: var(--mist); font-weight: 400; }
.prompt-field.is-locked { color: var(--mist); }
.prompt-field textarea:disabled { background: var(--celadon); border-style: dashed; cursor: not-allowed; }

/* ------------------------------------------------------------------ onboarding */
.steps { list-style: none; padding: 0; margin: 0 0 2.5rem; display: flex; gap: 0.5rem; counter-reset: step; }
.steps li {
  flex: 1; counter-increment: step;
  padding-top: 0.6rem; border-top: 3px solid var(--line);
  font-size: var(--s-1); color: var(--mist);
}
.steps li::before { content: counter(step) ". "; }
.steps li.done { border-top-color: var(--jade); }
.steps .step-name { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; }
.steps button.step-name:not(:disabled) { cursor: pointer; text-decoration: underline; text-underline-offset: 0.18em; }
.steps button.step-name:disabled { cursor: default; }
.step-nav { margin-top: 1.5rem; }
.steps li[aria-current="step"] { border-top-color: var(--ink); color: var(--ink); font-weight: 500; }

.photo-grid { list-style: none; padding: 0; margin: 0 0 0.75rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0.75rem; }
.photo-grid li { position: relative; }
.photo-grid img { aspect-ratio: 1; object-fit: cover; border-radius: 0.6rem; }
.photo-grid .is-primary img { outline: 3px solid var(--jade); outline-offset: 2px; }
.photo-state {
  position: absolute; top: 0.4rem; left: 0.4rem;
  background: var(--ink); color: var(--paper); font-size: 0.75rem;
  padding: 0.1rem 0.5rem; border-radius: 999px;
}
.photo-actions { display: flex; justify-content: space-between; gap: 0.5rem; font-size: var(--s-1); margin-top: 0.35rem; }
.photo-main { color: var(--jade-deep); font-weight: 500; }
.photo-add label {
  display: grid; place-items: center; aspect-ratio: 1; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: 0.6rem; color: var(--jade-deep);
}
.photo-add label:hover { border-color: var(--jade); background: var(--celadon); }
.photo-add label:focus-within { outline: 3px solid var(--jade); outline-offset: 2px; }

.city-picker { position: relative; }
.city-results {
  position: absolute; z-index: 5; left: 0; right: 0; top: 100%;
  list-style: none; margin: 0.25rem 0 0; padding: 0.25rem 0;
  background: #fff; border: 1.5px solid var(--line); border-radius: 0.45rem;
}
.city-results li { padding: 0.45rem 0.8rem; cursor: pointer; }
.city-results li:hover, .city-results li:focus { background: var(--celadon); outline: none; }

/* ------------------------------------------------------------------ chat */
/* The chat page fills the viewport exactly, so the composer stays at the bottom and never scrolls away. */
main:has(.chat-layout) { padding-top: 1.5rem; padding-bottom: 0; overflow: hidden; }
.chat-layout {
  display: grid; grid-template-columns: 16rem minmax(0, 1fr); gap: 0;
  height: calc(100vh - 3rem);
  height: calc(100dvh - 3rem);
  margin: 0;
  border: 1px solid var(--line); border-radius: 0.6rem; overflow: hidden;
}
.conv-list { background: var(--celadon); padding: 1.25rem 0.75rem; overflow: auto; }
.conv-list h1 { font-size: var(--s1); padding: 0 0.5rem; }
#conversations { list-style: none; margin: 0; padding: 0; }
#conversations a { display: flex; align-items: center; gap: 0.65rem; padding: 0.5rem; border-radius: 0.45rem; color: var(--ink); text-decoration: none; }
#conversations img { width: 2.75rem; height: 2.75rem; border-radius: 50%; object-fit: cover; flex: none; }
#conversations .conv-text { min-width: 0; flex: 1; display: grid; gap: 0.1rem; }
#conversations .conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
#conversations .conv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#conversations .conv-when { color: var(--mist); font-size: 0.75rem; flex: none; }
#conversations .conv-sub { color: var(--mist); font-size: var(--s-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#conversations li.active > a { background: var(--celadon-deep); }
#conversations li.unread .conv-name { font-weight: 700; }
/* The dot hangs off the row, not the name, so a long name can't clip it. */
#conversations li.unread .conv-top::after {
  content: ""; flex: none; align-self: center;
  width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--seal);
}

/* Flex, not fixed grid rows: the banner and "older" button hide and unhide,
   which would shift positional rows and strand the composer mid-page. */
.thread { display: flex; flex-direction: column; min-height: 0; }
/* Both occupy the same cell of .chat-layout, so the hidden one can't open a second row. */
.thread, .thread-placeholder { grid-column: 2; grid-row: 1; }
.thread-placeholder { display: none; align-self: center; justify-self: center; color: var(--mist); }
.thread[hidden] + .thread-placeholder { display: block; }
.thread-head { display: flex; justify-content: space-between; align-items: center; padding: 0.9rem 1.25rem; border-bottom: 1px solid var(--line); }
.thread-who { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.thread-who:hover .who-name { text-decoration: underline; }
.thread-who[data-typing]::after {
  content: attr(data-typing);
  align-self: center;
  font: 400 var(--s-1) var(--sans); color: var(--mist);
}
.who-photo { width: 2.5rem; height: 2.5rem; border-radius: 50%; object-fit: cover; }
.who-text { display: grid; gap: 0.05rem; }
.who-name { font: 700 var(--s1) var(--serif); color: var(--ink); }
.who-meta { font: 400 var(--s-1) var(--sans); color: var(--mist); }

.thread-actions { display: flex; gap: 1.25rem; font-size: var(--s-1); }
.safety-banner { margin: 0; padding: 0.75rem 1.25rem; background: #f6e7e4; color: var(--danger); font-size: var(--s-1); }
#older { align-self: center; margin: 0.75rem 0 0; font-size: var(--s-1); }
.messages {
  list-style: none; margin: 0; padding: 1.25rem;
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.msg { max-width: min(34rem, 80%); display: grid; gap: 0.2rem; }
.msg.mine { align-self: flex-end; justify-items: end; }
.bubble { padding: 0.6rem 0.95rem; border-radius: 1rem 1rem 1rem 0.25rem; background: var(--celadon); white-space: pre-wrap; overflow-wrap: anywhere; }
.mine .bubble { background: var(--jade); color: #fff; border-radius: 1rem 1rem 0.25rem 1rem; }
.bubble.unsent { background: transparent; border: 1px dashed var(--line); color: var(--mist); font-style: italic; }
.msg-meta { display: flex; gap: 0.75rem; font-size: 0.75rem; color: var(--mist); }
.composer { display: flex; gap: 0.6rem; padding: 0.9rem 1.25rem; border-top: 1px solid var(--line); align-items: end; }
.composer textarea { min-height: 2.75rem; max-height: 9rem; }
.thread-closed { margin: 0; padding: 1rem 1.25rem; border-top: 1px solid var(--line); color: var(--mist); }

.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2rem; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .search-layout, .member-head, .hero { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; }
  .seal-demo { min-height: 10rem; }
}

@media (max-width: 720px) {
  .has-shell .shell { display: block; padding-bottom: 4.5rem; }
  /* Hidden visually, not from screen readers: it is the menu button's only name. */
  .account-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 40;
    height: auto; padding: 0.35rem 0.5rem; flex-direction: row; gap: 0;
    border-top: 1px solid var(--line);
  }
  .rail .brand, .rail-foot { display: none; }
  .rail ul { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .rail a { text-align: center; padding: 0.55rem 0.25rem; font-size: var(--s-1); }
  main { padding-top: 1.5rem; }
  /* 1.5rem top gap plus the 4.5rem the fixed bottom rail occupies. */
  .chat-layout { grid-template-columns: 1fr; height: calc(100vh - 6rem); height: calc(100dvh - 6rem); margin: 0; }
  .chat-layout .conv-list { display: block; }
  .chat-layout:has(.thread:not([hidden])) .conv-list { display: none; }
  .thread, .thread-placeholder { grid-column: 1; }
  .composer { padding-bottom: calc(0.9rem + env(safe-area-inset-bottom)); }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1.5rem 0.9rem; }
  .inline-form input { min-width: 0; }
  .details { grid-template-columns: 1fr; gap: 0.1rem; }
  .details dd { margin-bottom: 0.6rem; }
}

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

/* ---------------------------------------------------------------- right-to-left */
[dir="rtl"] .admin-stats span { direction: rtl; }
[dir="rtl"] .has-shell .shell { grid-template-columns: minmax(0, 1fr) var(--rail); }
[dir="rtl"] .account-drop { right: auto; left: 0; }
/* The summary's padding is physical, so in RTL the avatar starts 0.6rem in, not 0.3rem. */
[dir="rtl"] .avatar-add { inset-inline-start: 2.25rem; }
[dir="rtl"] .rail { order: 2; }
[dir="rtl"] .rail-foot a, [dir="rtl"] .rail-foot .linklike { text-align: right; }
[dir="rtl"] .search-layout { grid-template-columns: minmax(0, 1fr) 17rem; }
[dir="rtl"] .filters { order: 2; padding-right: 0; padding-left: 0.5rem; }
[dir="rtl"] .admin-table th { text-align: right; }
[dir="rtl"] .badge { margin-left: 0; margin-right: 0.5rem; }
[dir="rtl"] .card-match ul { padding-left: 0; padding-right: 1.1rem; }
[dir="rtl"] .check small { padding-left: 0; padding-right: 1.65rem; }
[dir="rtl"] .md-head { padding-right: 0; padding-left: 5rem; }
[dir="rtl"] .md-close { right: auto; left: 0; }
[dir="rtl"] .photo-state { left: auto; right: 0.4rem; }
[dir="rtl"] .skip { left: auto; right: -999px; }
[dir="rtl"] .skip:focus { right: 0; }
[dir="rtl"] .admin-actions .btn { margin-right: 0; margin-left: 0.5rem; }
[dir="rtl"] .unit-toggle-label { margin-right: 0; margin-left: 0.35rem; }
[dir="rtl"] .member-section > summary::after,
[dir="rtl"] .group-box > summary::after { margin-left: 0; margin-right: auto; }
[dir="rtl"] .bubble { border-radius: 1rem 1rem 0.25rem 1rem; }
[dir="rtl"] .mine .bubble { border-radius: 1rem 1rem 1rem 0.25rem; }
[dir="rtl"] .field-group > legend { float: right; }


.plan-grid { align-items: start; display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.25rem; margin-bottom: 2.5rem; }
.plan-card { border: 1.5px solid var(--line); border-radius: 0.6rem; padding: 1.5rem; display: grid; gap: 0.6rem; align-content: start; }
.plan-card.is-current { border-color: var(--ink); background: var(--celadon); }
.plan-card h3 { margin: 0; font-size: var(--s1); }
.plan-price { margin: 0; font: 700 var(--s2) var(--serif); }
.plan-card .btn { justify-self: start; margin-top: 0.5rem; }
.term-list { list-style: none; padding: 0; margin: 0.5rem 0 0; display: grid; gap: 0.6rem; }
.term { display: grid; gap: 0.15rem; padding: 0.7rem 0; border-top: 1px solid var(--line); }
.term-length { font-weight: 500; }
.term-price { font: 700 var(--s1) var(--serif); }
.term-permonth { color: var(--mist); }
.term-buy { display: flex; gap: 0.5rem; margin-top: 0.35rem; }


.admin-nav { display: flex; gap: 0.25rem; flex-wrap: wrap; margin-bottom: 1.5rem; border-bottom: 1px solid var(--line); }
.admin-nav a {
  padding: 0.5rem 0.9rem; text-decoration: none; color: var(--mist);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.admin-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
.admin-stats { list-style: none; padding: 0; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.admin-stats li {
  min-width: 8rem; padding: 1rem 1.25rem;
  border: 1px solid var(--line); border-radius: 0.5rem;
}
.admin-stats strong { display: block; font-size: var(--s2); }
.admin-stats span { color: var(--mist); font-size: var(--s-1); }
.admin-table td > .linklike + .linklike { margin-left: 0.75rem; }



.term-group { margin-bottom: 1.25rem; }
.term-group h4 { margin: 0 0 0.35rem; font-size: var(--s0); }
.term-group .plain-list li { gap: 0.6rem; padding: 0.35rem 0; }
#term-form { margin-top: 0.5rem; }
.page.admin h3 { margin-top: 2rem; }
.btn[hidden] { display: none; }

.upgrade-moment .match-box { max-width: 26rem; }
.upgrade-moment h2 { margin-top: 0; }


[hidden] { display: none !important; }


/* The membership panel: what you pay and the one control that matters. It needs a boundary,
   or it reads as stray text above the plans rather than a summary of what you already have. */
.membership-box {
  border: 1.5px solid var(--line); border-radius: 0.6rem;
  padding: 1.25rem 1.5rem; margin-bottom: 2rem;
  background: var(--celadon);
  display: grid; gap: 0.35rem; justify-items: start;
}
.membership-box h2 { margin: 0 0 0.25rem; font-size: var(--s1); }
.membership-box p { margin: 0; }
.membership-box .mem-plan { font: 700 var(--s1) var(--serif); }
.membership-box .js-mem-cancel { margin-top: 0.5rem; }
.membership-box .notice { margin: 0.25rem 0 0; }


/* Payment methods read as a table: brand, number, expiry, action — the columns line up so
   two cards can be told apart at a glance. */
.card-table { border-collapse: collapse; margin-bottom: 1.25rem; }
.card-table td { padding: 0.7rem 1.5rem 0.7rem 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.card-table td:last-child { padding-right: 0; }
.pay-brand { font-weight: 500; }
.pay-number { font-variant-numeric: tabular-nums; }
.pay-actions { white-space: nowrap; }
.pay-actions > * + * { margin-left: 1rem; }

.pay-number { font-family: system-ui, sans-serif; }
.pay-number .dots { font-variant-numeric: normal; letter-spacing: -0.1em; margin-right: 0.45rem; }



/* The account area's front door: one card per section, each naming what it holds. */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }
.account-card {
  display: block; padding: 1.25rem 1.5rem;
  border: 1.5px solid var(--line); border-radius: 0.6rem;
  color: var(--ink); text-decoration: none;
}
.account-card:hover { border-color: var(--ink); background: var(--celadon); }
.account-card h2 { margin: 0 0 0.35rem; font-size: var(--s1); }
.account-card p { margin: 0; color: var(--mist); font-size: var(--s-1); max-width: none; }



#details-form .row { flex-wrap: nowrap; }
#details-form .row .grow { flex: 1; min-width: 0; }
@media (max-width: 720px) { #details-form .row { flex-wrap: wrap; } }


/* A readable width for forms inside a wider page, aligned with the page heading. */
.form-col { max-width: 32rem; }

.account-delete { margin-top: 2rem; font-size: var(--s-1); }
.account-delete a { color: var(--mist); }
.account-delete a:hover { color: var(--danger); }

/* Settings: one card per concern, stacked. */
.settings-grid { display: grid; gap: 1rem; max-width: 48rem; }
.settings-card {
  border: 1.5px solid var(--line); border-radius: 0.6rem;
  padding: 1.25rem 1.5rem;
  display: grid; gap: 0.75rem;
}
.settings-card h2 { margin: 0; font-size: var(--s1); }
.settings-card .hint { margin: 0; }
/* A legal document read in place over the registration form. */
.doc-dialog {
  width: min(44rem, calc(100vw - 2rem)); max-height: 85vh;
  padding: 0; display: flex; flex-direction: column;
}
.doc-dialog:not([open]) { display: none; }
.doc-dialog-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--line);
}
.doc-dialog-head h2 { margin: 0; }
.doc-dialog-body { padding: 1.25rem 1.5rem 1.75rem; overflow-y: auto; max-width: none; }

.doc-dialog {
  width: min(60rem, calc(100vw - 2rem)); max-height: 85vh;
  padding: 0; display: flex; flex-direction: column;
}

.doc-dialog-body p, .doc-dialog-body li { max-width: none; }


.js-created-codes { width: 100%; max-width: 32rem; font-family: ui-monospace, monospace; }


.plan-card .pill { justify-self: start; }
.plan-grid > .plan-card { align-content: start; }

.term-list > .term:only-child { border-top: 0; padding-top: 0; }

.consent-docs { margin: 1.5rem 0; }
.consent-out { margin-top: 2rem; }

.field .js-tz-search {
  margin-bottom: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.field .js-tz-search + select[name="timezone"] {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  margin-top: -1px;
}
/* Browsers style optgroups with their own colours; these keep a long list
   reading as one list. A closed dropdown draws its own menu, so these mostly
   apply where the list renders inline. */
select[name="timezone"] optgroup {
  font-weight: 600;
  font-style: normal;
  color: var(--ink);
  background: var(--celadon);
  padding: 0.25rem 0;
}

select[name="timezone"] option {
  color: var(--ink);
  padding: 0.35rem 0.5rem;
}

/* Completion and the preview link read as one line, but they are two separate
   things: a number and an action. They need more air between them than .row
   gives buttons in a toolbar. */
.page-head .row { gap: 1.5rem; align-items: baseline; }

/* The preview's two views are tabs, not buttons: they show the same profile
   seen two ways, which is what a tab strip means. */
.preview-modes { margin: 0 1.5rem; }

/* The picker floats above the composer rather than pushing it down, and the
   composer becomes its positioning context. */
.composer { position: relative; }

.emoji-panel {
  position: absolute;
  bottom: calc(100% + 0.5rem);
  left: 1.25rem;
  z-index: 20;
  width: min(22rem, calc(100% - 2.5rem));
  padding: 0.75rem;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 0.6rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  display: grid;
  gap: 0.5rem;
}
.emoji-panel .emoji-search { min-height: 2.25rem; }

/* The grid scrolls; the search box above it stays put. */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.1rem;
  max-height: 16rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}
/* A category heading spans the row it introduces. */
.emoji-grid h3 {
  grid-column: 1 / -1;
  margin: 0.5rem 0 0.15rem;
  font: 500 var(--s-1) var(--sans);
  color: var(--mist);
}
.emoji-grid h3:first-child { margin-top: 0; }

.emoji-grid .emoji {
  border: 0; background: none; cursor: pointer;
  font-size: 1.35rem; line-height: 1;
  padding: 0.3rem; border-radius: 0.35rem;
}
.emoji-grid .emoji:hover { background: var(--celadon); }
.emoji-none { grid-column: 1 / -1; margin: 0; color: var(--mist); font-size: var(--s-1); }

[dir="rtl"] .emoji-panel { left: auto; right: 1.25rem; }


/* "Continue with Google" and "Continue with Apple", stacked and the same width. */
.social-signin { display: grid; justify-items: center; gap: .6rem; margin-block: 1rem .25rem; }
.google-signin { display: flex; justify-content: center; min-height: 44px; }
.apple-signin {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  width: 320px; max-width: 100%; height: 40px; border: 0; border-radius: 999px;
  background: #000; color: #fff; cursor: pointer;
  font: 500 15px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
.apple-signin:hover { background: #1d1d1f; }
.apple-signin[disabled] { opacity: .6; cursor: progress; }
.apple-logo { width: 15px; height: 18px; flex: none; margin-top: -2px; }
.or-divider { display: flex; align-items: center; gap: .75rem; margin: .75rem 0; opacity: .7; }
.or-divider::before, .or-divider::after { content: ""; flex: 1; border-top: 1px solid currentColor; opacity: .35; }

/* Contact page: an address reads as plain text, with room before what follows. */
.prose address { font-style: normal; margin-bottom: 1.5rem; }

/* The footer: the policies and how to reach us, quietly, at the end of every page. */
.site-foot {
  margin-top: 4rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem;
  justify-content: center; text-align: center;
  font-size: var(--s-1); color: var(--mist);
}
.site-foot a { color: var(--mist); }
.site-foot a:hover { color: var(--ink); }

/* "Test payments": amber rather than the error red, since nothing is wrong. */
.notice-test { background: #fff4d6; color: #7a5200; }

/* Admin → Plans: a term's test and live prices, one line each, under the term. */
.term-modes { flex-basis: 100%; display: grid; gap: .15rem; padding-left: 1rem; }

/* ---------------------------------------------------------- account deleted */
.bye { display: flex; justify-content: center; padding: 3rem 1rem 4rem; }
.bye-card {
  width: 100%; max-width: 33rem; text-align: center;
  background: #fff; border: 1.5px solid var(--line); border-radius: 1.25rem;
  padding: 2.5rem 2rem 2rem; box-shadow: 0 10px 30px var(--ring);
}
.bye-icon {
  width: 4rem; height: 4rem; margin: 0 auto 1.25rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--celadon); color: var(--jade);
}
.bye-card h1 { margin: 0 0 0.75rem; font-size: var(--s3); }
.bye-card p { margin: 0 auto 0.9rem; color: var(--mist); }
.bye-date { color: var(--jade-deep); white-space: nowrap; }
.bye-store {
  text-align: start; margin: 0.25rem 0 1.1rem; padding: 0.75rem 0.9rem; border-radius: 0.75rem;
  background: #fff4d6; color: #7a5200; font-size: var(--s-1);
}
.bye-actions { display: grid; gap: 0.6rem; margin-top: 1.4rem; }
.bye-actions .btn { width: 100%; }
.bye-help { margin-top: 1.1rem; font-size: var(--s-1); }


/* Short pages: the footer sits at the bottom of the screen, not just under the content. */
body:not(.has-shell) main {
  min-height: calc(100vh - 3.6rem);
  min-height: calc(100dvh - 3.6rem);
  display: flex; flex-direction: column;
}
body:not(.has-shell) main > .site-foot { margin-top: auto; }

body:not(.has-shell) main > * { width: 100%; }

/* ==========================================================================
   Home page designs (Admin → Settings → Home page design)
   Partials: app/Views/home/{banner,editorial,split,minimal}.php
   Everything uses the theme variables, so jade and sand follow automatically.
   No images: shapes are CSS gradients and inline SVG (CSP-safe).
   ========================================================================== */

.hd { --hd-max: 1120px; --hd-radius: 22px; color: var(--ink); }
.hd *, .hd *::before, .hd *::after { box-sizing: border-box; }

/* Full-width sections break out of the page container, but only when there is no
   side rail; next to the rail they simply fill the content column. */
.hd-bleed { position: relative; }
body:not(.has-shell) .hd-bleed { margin-inline: calc(50% - 50vw); width: 100vw; }
body:has(.hd-bleed) { overflow-x: clip; }

.hd-section { max-width: var(--hd-max); margin: 0 auto; padding: 56px 20px; }
.hd-title { font-family: var(--serif); font-weight: 700; letter-spacing: -0.01em; line-height: 1.12; margin: 0 0 18px; }
.hd-lead { font-size: 1.15rem; line-height: 1.6; margin: 0 0 28px; max-width: 34em; }
.hd-kicker { text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.78rem; font-weight: 600; margin: 0 0 16px; }
.hd-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.hd-h2 { font-family: var(--serif); font-size: clamp(1.6rem, 3vw, 2.1rem); text-align: center; margin: 0 0 36px; }
.hd-icon { width: 24px; height: 24px; display: block; }

.hd .btn { padding-inline: 22px; }
.hd-btn-light { background: #fff; color: var(--jade-deep); border-color: #fff; }
.hd-btn-light:hover, .hd-btn-light:focus-visible { background: var(--paper); color: var(--jade-deep); }
.hd-btn-ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.7); }
.hd-btn-ghost:hover, .hd-btn-ghost:focus-visible { background: rgba(255, 255, 255, 0.12); color: #fff; border-color: #fff; }

.hd-badge {
  display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 14px;
  color: var(--jade); background: color-mix(in srgb, var(--jade) 10%, transparent); margin-bottom: 16px;
}

/* ---------- Banner ---------- */
.hd--banner .hd-band {
  overflow: hidden; color: #fff; isolation: isolate;
  background:
          radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--seal) 70%, transparent), transparent 60%),
          radial-gradient(900px 600px at -10% 110%, color-mix(in srgb, var(--jade-deep) 90%, transparent), transparent 60%),
          linear-gradient(120deg, var(--jade-deep), var(--jade) 45%, var(--seal));
  padding: clamp(64px, 11vw, 136px) 20px clamp(96px, 12vw, 150px);
}
.hd--banner .hd-band-inner { position: relative; z-index: 1; max-width: var(--hd-max); margin: 0 auto; }
.hd--banner .hd-title { font-size: clamp(2.3rem, 6vw, 4.4rem); max-width: 13em; }
.hd--banner .hd-accent { font-style: italic; font-weight: 600; color: color-mix(in srgb, var(--seal) 22%, #fff); }
.hd--banner .hd-lead { color: rgba(255, 255, 255, 0.88); }
.hd--banner .hd-kicker { color: rgba(255, 255, 255, 0.8); }
.hd-rings {
  position: absolute; z-index: 0; width: min(64vw, 680px); height: auto; inset-inline-end: -12vw; top: -18%;
  fill: none; stroke: rgba(255, 255, 255, 0.16); stroke-width: 1.2;
  animation: hd-turn 90s linear infinite;
}
.hd-rings circle:nth-child(2) { stroke-dasharray: 2 10; stroke-width: 2; }
.hd-rings circle:nth-child(4) { stroke-dasharray: 60 24; }
.hd-rings--b { width: min(40vw, 420px); inset-inline-end: auto; inset-inline-start: -10vw; top: auto; bottom: -30%; animation-direction: reverse; }
.hd-wave { position: absolute; z-index: 1; left: 0; right: 0; bottom: -1px; width: 100%; height: 70px; fill: var(--paper); }
@keyframes hd-turn { to { transform: rotate(360deg); } }

.hd-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: -110px; position: relative; z-index: 2; }
.hd-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--hd-radius);
  padding: 30px 26px; box-shadow: 0 18px 40px -18px color-mix(in srgb, var(--jade-deep) 35%, transparent);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.hd-card:hover { transform: translateY(-4px); box-shadow: 0 24px 48px -18px color-mix(in srgb, var(--jade-deep) 45%, transparent); }
.hd-card h2 { font-family: var(--serif); font-size: 1.25rem; margin: 0 0 8px; }
.hd-card p { color: var(--mist); line-height: 1.6; margin: 0; }

.hd-steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; counter-reset: hd-step; position: relative; }
.hd-steps::before {
  content: ""; position: absolute; top: 28px; left: 16%; right: 16%; height: 0;
  border-top: 2px dashed color-mix(in srgb, var(--jade) 35%, transparent);
}
.hd-steps li { text-align: center; position: relative; counter-increment: hd-step; }
.hd-step-icon {
  display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--paper); color: var(--jade); border: 2px solid color-mix(in srgb, var(--jade) 40%, transparent); position: relative;
}
.hd-step-icon::after {
  content: counter(hd-step); position: absolute; top: -6px; inset-inline-end: -6px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--seal); color: #fff; font-size: 0.75rem; font-weight: 700; display: grid; place-items: center;
}
.hd-steps h3 { font-size: 1.1rem; margin: 0 0 6px; }
.hd-steps p { color: var(--mist); margin: 0 auto; max-width: 22em; line-height: 1.55; }

.hd-closing {
  text-align: center; border-radius: 28px; padding: 56px 24px; color: var(--ink);
  background:
          radial-gradient(600px 220px at 50% 0%, color-mix(in srgb, var(--seal) 14%, transparent), transparent 70%),
          color-mix(in srgb, var(--jade) 8%, var(--paper));
  border: 1px solid color-mix(in srgb, var(--jade) 18%, transparent);
}
.hd-closing h2 { font-family: var(--serif); font-size: clamp(1.6rem, 3.4vw, 2.3rem); margin: 0 0 10px; }
.hd-closing p { color: var(--mist); margin: 0 0 24px; }

/* ---------- Editorial ---------- */
.hd--editorial .hd-paper {
  background-color: color-mix(in srgb, var(--seal) 4%, var(--paper));
  /* Faint paper grain: an SVG noise tile as a data: URI, which the CSP allows. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.35 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.hd-ed { max-width: var(--hd-max); margin: 0 auto; padding: 28px 24px 72px; }
.hd-ed-issue { display: flex; align-items: center; gap: 16px; font-size: 0.78rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mist); }
.hd-ed-rule { flex: 1; border-top: 1px solid var(--ink); opacity: 0.35; }
.hd-ed-brand { font-family: var(--serif); letter-spacing: 0.08em; text-transform: none; font-size: 1rem; color: var(--ink); }

.hd-ed-hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(28px, 5vw, 72px); align-items: center; padding: clamp(40px, 7vw, 88px) 0 clamp(36px, 6vw, 72px); }
.hd--editorial .hd-title { font-size: clamp(2.6rem, 7.2vw, 5.6rem); line-height: 1.02; letter-spacing: -0.025em; font-weight: 600; }
.hd--editorial .hd-accent { display: inline; font-style: italic; font-weight: 500; color: var(--seal); }
.hd--editorial .hd-lead { color: var(--mist); font-size: 1.2rem; border-inline-start: 3px solid var(--seal); padding-inline-start: 18px; }
.hd-textlink { color: var(--ink); font-weight: 600; text-decoration: none; border-bottom: 1.5px solid currentColor; padding-bottom: 2px; margin-inline-start: 8px; }
.hd-textlink:hover { color: var(--jade); }

.hd-ed-art { position: relative; justify-self: center; width: min(100%, 380px); }
.hd-arch {
  position: relative; aspect-ratio: 3 / 4; border-radius: 999px 999px 18px 18px; overflow: hidden;
  background: linear-gradient(180deg, color-mix(in srgb, var(--jade) 16%, var(--paper)), color-mix(in srgb, var(--seal) 18%, var(--paper)));
  border: 1px solid color-mix(in srgb, var(--jade) 25%, transparent);
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--jade-deep) 55%, transparent);
}
.hd-arch::after { content: ""; position: absolute; inset: 12px; border-radius: inherit; border: 1px solid rgba(255, 255, 255, 0.7); pointer-events: none; }
.hd-orb { position: absolute; width: 58%; aspect-ratio: 1; border-radius: 50%; mix-blend-mode: multiply; filter: saturate(1.1); }
.hd-orb--a { top: 30%; left: 8%; background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--jade) 55%, #fff), var(--jade)); opacity: 0.85; }
.hd-orb--b { top: 40%; right: 8%; background: radial-gradient(circle at 60% 40%, color-mix(in srgb, var(--seal) 55%, #fff), var(--seal)); opacity: 0.8; animation: hd-breathe 9s ease-in-out infinite; }
.hd-arch-lines { position: absolute; inset: 0; width: 100%; height: 100%; fill: none; stroke: rgba(255, 255, 255, 0.75); stroke-width: 0.8; }
@keyframes hd-breathe { 50% { transform: translate(-6%, -4%); } }

.hd-seal-stamp {
  position: absolute; left: -26px; bottom: 34px; width: 92px; height: 92px; transform: rotate(-8deg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border-radius: 10px; background: var(--seal); color: #fff;
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--seal) 80%, transparent), inset 0 0 0 5px var(--seal), inset 0 0 0 7px rgba(255, 255, 255, 0.85);
}
[dir="rtl"] .hd-seal-stamp { left: auto; right: -26px; transform: rotate(8deg); }
.hd-seal-stamp span { display: block; font-family: var(--serif); font-weight: 700; font-size: 1.55rem; line-height: 1; }
.hd-quote { margin: 0 auto; padding: clamp(36px, 6vw, 64px) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; position: relative; }
.hd-quote::before { content: "\201C"; display: block; font-family: var(--serif); font-size: 6rem; line-height: 0.6; color: var(--seal); opacity: 0.85; margin-bottom: 8px; }
.hd-quote p { font-family: var(--serif); font-style: italic; font-size: clamp(1.5rem, 3.6vw, 2.4rem); line-height: 1.35; max-width: 24em; margin: 0 auto; }

.hd-ed-principles { padding: clamp(40px, 6vw, 72px) 0 24px; display: grid; grid-template-columns: 1fr 2.4fr; gap: 32px; }
.hd-ed-label { font-size: 0.8rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mist); margin: 6px 0 0; font-weight: 600; }
.hd-ed-principles ol { list-style: none; margin: 0; padding: 0; }
.hd-ed-principles li { display: grid; grid-template-columns: 72px 1fr 1.4fr; gap: 20px; align-items: baseline; padding: 22px 0; border-top: 1px solid var(--line); }
.hd-ed-principles li:last-child { border-bottom: 1px solid var(--line); }
.hd-num { font-family: var(--serif); font-size: 2rem; font-style: italic; color: var(--seal); line-height: 1; }
.hd-ed-principles h3 { font-family: var(--serif); font-size: 1.3rem; margin: 0; }
.hd-ed-principles p { color: var(--mist); margin: 0; line-height: 1.6; }

.hd-ed-end { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; padding-top: 40px; }
.hd-ed-end p { font-family: var(--serif); font-size: clamp(1.4rem, 3vw, 2rem); margin: 0; }

/* ---------- Split ---------- */
.hd-split { display: grid; grid-template-columns: 1fr 1fr; min-height: min(78vh, 720px); }
.hd-split-panel {
  color: #fff; display: flex; align-items: center; justify-content: flex-end;
  background:
          radial-gradient(500px 400px at 0% 100%, color-mix(in srgb, var(--seal) 45%, transparent), transparent 70%),
          linear-gradient(160deg, var(--jade), var(--jade-deep));
  padding: 64px clamp(20px, 5vw, 72px);
}
.hd-split-copy { max-width: 520px; }
.hd--split .hd-title { font-size: clamp(2.2rem, 4.6vw, 3.8rem); }
.hd--split .hd-accent { font-style: italic; color: color-mix(in srgb, var(--seal) 28%, #fff); }
.hd--split .hd-kicker { color: rgba(255, 255, 255, 0.78); }
.hd--split .hd-lead { color: rgba(255, 255, 255, 0.88); }

.hd-split-art {
  position: relative; overflow: hidden;
  background:
          radial-gradient(circle at 70% 30%, color-mix(in srgb, var(--seal) 14%, transparent), transparent 45%),
          radial-gradient(circle at 30% 80%, color-mix(in srgb, var(--jade) 12%, transparent), transparent 45%),
          var(--paper);
  min-height: 460px;
}
.hd-pcard {
  position: absolute; width: min(56%, 270px); padding: 18px 18px 20px; border-radius: 20px;
  background: var(--paper); border: 1px solid var(--line);
  box-shadow: 0 30px 50px -24px color-mix(in srgb, var(--jade-deep) 45%, transparent);
  display: flex; flex-direction: column; gap: 10px;
}
.hd-pcard--a { top: 14%; left: 10%; transform: rotate(-6deg); animation: hd-float 8s ease-in-out infinite; }
.hd-pcard--b { top: 34%; right: 9%; transform: rotate(5deg); animation: hd-float 8s ease-in-out -4s infinite; }
@keyframes hd-float { 50% { translate: 0 -10px; } }
.hd-avatar { display: block; width: 100%; aspect-ratio: 4 / 3; border-radius: 14px; margin-bottom: 4px; }
.hd-avatar--a { background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--paper) 85%, transparent) 0 17%, transparent 18%), radial-gradient(ellipse 40% 34% at 50% 100%, color-mix(in srgb, var(--paper) 85%, transparent) 0 98%, transparent 100%), linear-gradient(135deg, color-mix(in srgb, var(--jade) 60%, #fff), var(--jade)); }
.hd-avatar--b { background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--paper) 85%, transparent) 0 17%, transparent 18%), radial-gradient(ellipse 40% 34% at 50% 100%, color-mix(in srgb, var(--paper) 85%, transparent) 0 98%, transparent 100%), linear-gradient(135deg, color-mix(in srgb, var(--seal) 55%, #fff), var(--seal)); }
.hd-line { display: block; height: 9px; border-radius: 9px; background: color-mix(in srgb, var(--ink) 12%, transparent); }
.hd-line--w40 { width: 40%; } .hd-line--w50 { width: 50%; } .hd-line--w60 { width: 60%; } .hd-line--w70 { width: 70%; }
.hd-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.hd-chip { font-size: 0.75rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--mist); }
.hd-chip.is-shared { background: color-mix(in srgb, var(--seal) 12%, transparent); border-color: color-mix(in srgb, var(--seal) 35%, transparent); color: var(--ink); font-weight: 600; }
.hd-shared {
  position: absolute; left: 50%; bottom: 10%; transform: translateX(-50%); z-index: 2; white-space: nowrap;
  display: flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--paper); font-weight: 600; font-size: 0.9rem;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.4);
}
.hd-shared .hd-icon { width: 20px; height: 20px; color: var(--seal); }
.hd-dot { position: absolute; border-radius: 50%; }
.hd-dot--1 { width: 14px; height: 14px; top: 10%; right: 22%; background: var(--seal); }
.hd-dot--2 { width: 8px; height: 8px; bottom: 26%; left: 12%; background: var(--jade); }
.hd-dot--3 { width: 40px; height: 40px; top: 62%; left: 44%; border: 2px solid color-mix(in srgb, var(--jade) 40%, transparent); }

.hd-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; }
.hd-row3 h2 { font-family: var(--serif); font-size: 1.2rem; margin: 0 0 8px; }
.hd-row3 p { color: var(--mist); line-height: 1.6; margin: 0; }

/* ---------- Minimal ---------- */
.hd-calm { overflow: hidden; display: grid; place-items: center; min-height: min(82vh, 760px); padding: 72px 20px; isolation: isolate; }
.hd-calm-inner { position: relative; z-index: 1; max-width: 720px; text-align: center; }
.hd--minimal .hd-title { font-size: clamp(2.3rem, 6vw, 4.2rem); font-weight: 600; }
.hd--minimal .hd-lead { color: var(--mist); margin-inline: auto; }
.hd--minimal .hd-actions { justify-content: center; }
.hd-blob { position: absolute; z-index: 0; border-radius: 50%; filter: blur(60px); opacity: 0.55; }
.hd-blob--a { width: 420px; height: 420px; top: -80px; left: -60px; background: color-mix(in srgb, var(--jade) 45%, transparent); }
.hd-blob--b { width: 360px; height: 360px; bottom: -100px; right: -40px; background: color-mix(in srgb, var(--seal) 40%, transparent); animation: hd-breathe 14s ease-in-out infinite; }
.hd-blob--c { width: 220px; height: 220px; top: 40%; left: 58%; background: color-mix(in srgb, var(--celadon) 70%, transparent); }
.hd-pillline { list-style: none; padding: 0; margin: 48px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 0; color: var(--mist); font-size: 0.95rem; }
.hd-pillline li + li::before { content: "·"; margin: 0 14px; color: var(--seal); font-weight: 700; }

/* ---------- Small screens ---------- */
@media (max-width: 860px) {
  .hd-cards, .hd-steps, .hd-row3 { grid-template-columns: 1fr; }
  .hd-cards { margin-top: -80px; }
  .hd-steps::before { display: none; }
  .hd-ed-hero { grid-template-columns: 1fr; }
  .hd-ed-art { width: min(80%, 300px); }
  .hd-ed-principles { grid-template-columns: 1fr; gap: 8px; }
  .hd-ed-principles li { grid-template-columns: 52px 1fr; }
  .hd-ed-principles li p { grid-column: 2; }
  .hd-split { grid-template-columns: 1fr; }
  .hd-split-panel { justify-content: flex-start; }
  .hd-split-art { min-height: 480px; }
  .hd-pcard { width: min(58%, 230px); padding: 12px 12px 14px; gap: 8px; }
  .hd-pcard--a { top: 6%; left: 5%; }
  .hd-pcard--b { top: 24%; right: 5%; }
  .hd-shared { bottom: 5%; }
  .hd-dot--3 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .hd-rings, .hd-orb--b, .hd-pcard, .hd-blob--b { animation: none; }
  .hd-card { transition: none; }
}

/* ---------- Admin: design picker ---------- */
.hd-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-top: 12px; }
.hd-option { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1.5px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--paper); }
.hd-option:hover { border-color: color-mix(in srgb, var(--jade) 50%, var(--line)); }
.hd-option input { position: absolute; opacity: 0; pointer-events: none; }
.hd-option:has(input:checked) { border-color: var(--jade); box-shadow: 0 0 0 3px color-mix(in srgb, var(--jade) 18%, transparent); }
.hd-option:has(input:focus-visible) { outline: 2px solid var(--jade); outline-offset: 2px; }
.hd-option-name { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.hd-option-live { display: none; font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #fff; background: var(--jade); padding: 2px 7px; border-radius: 999px; }
.hd-option:has(input:checked) .hd-option-live { display: inline-block; }
.hd-option-desc { font-size: 0.85rem; color: var(--mist); line-height: 1.45; margin: 0; }
.hd-option-preview { font-size: 0.85rem; margin-top: auto; }

/* Thumbnails: tiny sketches of each layout. */
.hd-thumb { position: relative; height: 96px; border-radius: 9px; overflow: hidden; background: var(--paper); border: 1px solid var(--line); }
.hd-thumb i { position: absolute; display: block; border-radius: 3px; }
.hd-thumb--classic i:nth-child(1) { left: 12%; top: 18%; width: 52%; height: 10px; background: var(--ink); opacity: 0.75; }
.hd-thumb--classic i:nth-child(2) { left: 12%; top: 36%; width: 38%; height: 6px; background: var(--mist); opacity: 0.5; }
.hd-thumb--classic i:nth-child(3) { left: 12%; top: 50%; width: 22%; height: 9px; background: var(--jade); border-radius: 9px; }
.hd-thumb--classic i:nth-child(4) { left: 12%; right: 12%; top: 74%; height: 12px; background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--jade) 18%, transparent) 0 30%, transparent 30% 35%); }
.hd-thumb--banner i:nth-child(1) { inset: 0 0 52% 0; border-radius: 0; background: linear-gradient(120deg, var(--jade-deep), var(--jade), var(--seal)); }
.hd-thumb--banner i:nth-child(2) { left: 10%; top: 16%; width: 46%; height: 8px; background: #fff; }
.hd-thumb--banner i:nth-child(3) { left: 10%; top: 30%; width: 18%; height: 7px; background: #fff; border-radius: 7px; opacity: 0.9; }
.hd-thumb--banner i:nth-child(4) { left: 8%; right: 8%; top: 40%; height: 34%; background: repeating-linear-gradient(90deg, var(--paper) 0 30%, transparent 30% 35%); box-shadow: 0 4px 8px -4px rgba(0, 0, 0, 0.3); }
.hd-thumb--editorial { background: color-mix(in srgb, var(--seal) 5%, var(--paper)); }
.hd-thumb--editorial i:nth-child(1) { left: 8%; top: 22%; width: 48%; height: 12px; background: var(--ink); opacity: 0.8; }
.hd-thumb--editorial i:nth-child(2) { left: 8%; top: 40%; width: 36%; height: 12px; background: var(--seal); opacity: 0.85; }
.hd-thumb--editorial i:nth-child(3) { right: 10%; top: 14%; width: 26%; height: 66%; border-radius: 999px 999px 4px 4px; background: linear-gradient(180deg, color-mix(in srgb, var(--jade) 30%, var(--paper)), color-mix(in srgb, var(--seal) 30%, var(--paper))); }
.hd-thumb--editorial i:nth-child(4) { right: 30%; bottom: 14%; width: 14px; height: 14px; background: var(--seal); transform: rotate(-8deg); }
.hd-thumb--split i:nth-child(1) { inset: 0 50% 0 0; border-radius: 0; background: linear-gradient(160deg, var(--jade), var(--jade-deep)); }
.hd-thumb--split i:nth-child(2) { left: 8%; top: 34%; width: 32%; height: 8px; background: #fff; }
.hd-thumb--split i:nth-child(3) { left: 58%; top: 18%; width: 22%; height: 46%; background: var(--paper); border: 1px solid var(--line); transform: rotate(-6deg); }
.hd-thumb--split i:nth-child(4) { left: 70%; top: 34%; width: 22%; height: 46%; background: var(--paper); border: 1px solid var(--line); transform: rotate(5deg); }
.hd-thumb--minimal i:nth-child(1) { left: -10%; top: -20%; width: 60%; height: 90%; border-radius: 50%; background: color-mix(in srgb, var(--jade) 30%, transparent); filter: blur(10px); }
.hd-thumb--minimal i:nth-child(2) { right: -10%; bottom: -30%; width: 50%; height: 90%; border-radius: 50%; background: color-mix(in srgb, var(--seal) 28%, transparent); filter: blur(10px); }
.hd-thumb--minimal i:nth-child(3) { left: 25%; right: 25%; top: 36%; height: 10px; background: var(--ink); opacity: 0.75; }
.hd-thumb--minimal i:nth-child(4) { left: 40%; right: 40%; top: 58%; height: 8px; background: var(--jade); border-radius: 8px; }

/* ---------- Fixes for the real site (main padding, global p width, badge wrap) ---------- */
body:not(.has-shell) .hd > .hd-bleed:first-child { margin-top: -2.5rem; }
:where(.hd) p { max-width: none; }
.hd-option-name { flex-wrap: wrap; }
.settings-card--wide { grid-column: 1 / -1; }

/* ==========================================================================
   Home palettes. "site" uses the site theme; the others recolour the home page only.
   ========================================================================== */
.hd-pal { --hd-violet: color-mix(in srgb, var(--jade) 50%, var(--seal)); --hd-sky: var(--celadon-deep); color: var(--ink); }

/* Pink, violet and purple. */
.hd-pal[data-palette="blossom"] {
  --ink: #2a1636; --mist: #6f5a7d;
  --jade: #8a3fc0; --jade-deep: #55208a;
  --seal: #e8559d; --hd-violet: #b26bf0; --hd-sky: #f7c7e3;
  --celadon: #f8ecfb; --celadon-deep: #efd6f7;
  --paper: #fffafd; --line: #f0daf2; --ring: rgba(138, 63, 192, 0.2);
}
/* Ocean blues, from navy to sky. */
.hd-pal[data-palette="ocean"] {
  --ink: #0f2138; --mist: #566a84;
  --jade: #2563d1; --jade-deep: #123a86;
  --seal: #1fb3e0; --hd-violet: #4f86f7; --hd-sky: #bfe6fb;
  --celadon: #eaf3fd; --celadon-deep: #d4e6fa;
  --paper: #f8fbff; --line: #d7e4f3; --ring: rgba(37, 99, 209, 0.2);
}
/* Dusk: indigo blue into violet, with a rose glow. */
.hd-pal[data-palette="twilight"] {
  --ink: #1b1a3a; --mist: #5f5d82;
  --jade: #4b4fd6; --jade-deep: #262882;
  --seal: #d65fb5; --hd-violet: #8a5cf0; --hd-sky: #c9d2ff;
  --celadon: #eeefff; --celadon-deep: #dcdcfb;
  --paper: #fbfbff; --line: #dfe0f5; --ring: rgba(75, 79, 214, 0.2);
}
.hd-pal .btn-primary { background: var(--jade); }
.hd-pal .btn-primary:hover { background: var(--jade-deep); }

/* Shared extras */
.hd-glass {
  background: color-mix(in srgb, #fff 58%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid color-mix(in srgb, #fff 75%, transparent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 24px 60px -28px color-mix(in srgb, var(--jade-deep) 55%, transparent);
}
.hd-btn-grad {
  color: #fff; border: 0;
  background: linear-gradient(100deg, var(--jade), var(--hd-violet) 50%, var(--seal));
  background-size: 160% 100%; background-position: 0 0;
  box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--seal) 70%, transparent);
  transition: background-position 0.4s ease, transform 0.2s ease;
}
.hd-btn-grad:hover, .hd-btn-grad:focus-visible { color: #fff; background-position: 100% 0; transform: translateY(-1px); }
.hd-btn-glass { color: var(--ink); background: color-mix(in srgb, #fff 55%, transparent); border: 1px solid color-mix(in srgb, #fff 80%, transparent); }
.hd-btn-glass:hover { color: var(--ink); background: #fff; }

/* ---------- Aurora ---------- */
.hd-au { overflow: hidden; isolation: isolate; padding: clamp(56px, 9vw, 110px) 20px clamp(64px, 9vw, 110px); background: color-mix(in srgb, var(--celadon) 70%, var(--paper)); }
.hd-au-mesh { position: absolute; inset: -10%; z-index: -1; filter: blur(70px) saturate(130%); }
.hd-au-blob { position: absolute; border-radius: 50%; opacity: 0.75; }
.hd-au-blob--1 { width: 46vw; height: 46vw; left: -6vw; top: -10vw; background: var(--hd-violet); animation: hd-drift-a 22s ease-in-out infinite alternate; }
.hd-au-blob--2 { width: 40vw; height: 40vw; right: -8vw; top: 0; background: var(--seal); animation: hd-drift-b 26s ease-in-out infinite alternate; }
.hd-au-blob--3 { width: 38vw; height: 38vw; left: 28vw; bottom: -14vw; background: var(--jade); opacity: 0.55; animation: hd-drift-a 30s ease-in-out -8s infinite alternate-reverse; }
.hd-au-blob--4 { width: 30vw; height: 30vw; right: 18vw; bottom: -6vw; background: var(--hd-sky); animation: hd-drift-b 24s ease-in-out -5s infinite alternate; }
@keyframes hd-drift-a { to { transform: translate(8vw, 6vw) scale(1.12); } }
@keyframes hd-drift-b { to { transform: translate(-7vw, 5vw) scale(0.9); } }

.hd-au-float { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.hd-au-heart, .hd-au-spark { position: absolute; color: #fff; opacity: 0.8; }
.hd-au-heart .hd-icon { width: 100%; height: 100%; fill: color-mix(in srgb, #fff 45%, transparent); }
.hd-au-heart--1 { width: 34px; height: 34px; left: 9%; top: 22%; animation: hd-bob 7s ease-in-out infinite; }
.hd-au-heart--2 { width: 22px; height: 22px; right: 12%; top: 16%; animation: hd-bob 9s ease-in-out -3s infinite; }
.hd-au-heart--3 { width: 26px; height: 26px; right: 22%; bottom: 30%; animation: hd-bob 8s ease-in-out -5s infinite; }
.hd-au-spark .hd-icon { width: 100%; height: 100%; }
.hd-au-spark--1 { width: 26px; height: 26px; left: 20%; bottom: 36%; animation: hd-twinkle 3.5s ease-in-out infinite; }
.hd-au-spark--2 { width: 18px; height: 18px; right: 30%; top: 10%; animation: hd-twinkle 4.5s ease-in-out -2s infinite; }
@keyframes hd-bob { 50% { transform: translateY(-14px) rotate(-8deg); } }
@keyframes hd-twinkle { 50% { opacity: 0.2; transform: scale(0.7) rotate(20deg); } }

.hd-au-inner { position: relative; z-index: 1; max-width: var(--hd-max); margin: 0 auto; }
.hd-au-hero { max-width: 780px; margin: 0 auto; text-align: center; border-radius: 32px; padding: clamp(32px, 6vw, 64px) clamp(22px, 5vw, 56px); }
.hd-au-pill {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 22px; padding: 7px 16px; border-radius: 999px;
  background: color-mix(in srgb, #fff 70%, transparent); color: var(--jade-deep); font-size: 0.85rem; font-weight: 600;
}
.hd-au-pill .hd-icon { width: 16px; height: 16px; color: var(--seal); fill: var(--seal); }
.hd--aurora .hd-title { font-size: clamp(2.3rem, 5.6vw, 4.2rem); font-weight: 700; }
.hd--aurora .hd-accent, .hd--starlight .hd-accent {
  background: linear-gradient(95deg, var(--seal), var(--hd-violet) 55%, var(--jade));
  -webkit-background-clip: text; background-clip: text; color: transparent; font-style: italic;
}
.hd--aurora .hd-lead { color: var(--mist); margin-inline: auto; }
.hd--aurora .hd-actions { justify-content: center; }

.hd-au-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 44px; }
.hd-au-tile { border-radius: 24px; padding: 26px 24px; transition: transform 0.25s ease; }
.hd-au-tile:hover { transform: translateY(-5px); }
.hd-au-tile h2 { font-size: 1.15rem; margin: 0 0 8px; }
.hd-au-tile p { color: var(--mist); margin: 0; line-height: 1.6; }
.hd-au-ico {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; margin-bottom: 14px; color: #fff;
  background: linear-gradient(135deg, var(--jade), var(--seal));
  box-shadow: 0 10px 20px -10px color-mix(in srgb, var(--seal) 80%, transparent);
}

.hd-au-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.hd-au-steps li { position: relative; padding: 28px 24px 24px; border-radius: 22px; background: var(--paper); border: 1px solid var(--line); }
.hd-au-steps li::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--seal) 55%, transparent), transparent 40%, color-mix(in srgb, var(--jade) 45%, transparent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
.hd-au-num {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; margin-bottom: 14px;
  font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: #fff;
  background: linear-gradient(135deg, var(--hd-violet), var(--seal));
}
.hd-au-steps h3 { font-size: 1.1rem; margin: 0 0 6px; }
.hd-au-steps p { color: var(--mist); margin: 0; line-height: 1.55; }

.hd-au-endwrap { padding-top: 8px; }
.hd-au-end {
  position: relative; overflow: hidden; isolation: isolate; text-align: center; color: #fff; border-radius: 32px;
  padding: clamp(44px, 7vw, 76px) 24px;
  background: linear-gradient(120deg, var(--jade-deep), var(--jade) 35%, var(--hd-violet) 65%, var(--seal));
}
.hd-au-end-glow { position: absolute; z-index: -1; width: 60%; aspect-ratio: 1; left: 20%; top: -60%; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.35), transparent 65%); }
.hd-au-end h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin: 0 0 10px; color: #fff; }
.hd-au-end p { color: rgba(255, 255, 255, 0.88); margin: 0 0 26px; }

/* ---------- Starlight ---------- */
.hd-sky {
  overflow: hidden; isolation: isolate; color: #fff;
  background:
          radial-gradient(900px 500px at 75% 30%, color-mix(in srgb, var(--hd-violet) 45%, transparent), transparent 65%),
          radial-gradient(700px 400px at 10% 90%, color-mix(in srgb, var(--seal) 30%, transparent), transparent 65%),
          linear-gradient(180deg, color-mix(in srgb, var(--jade-deep) 45%, #05040f) 0%, color-mix(in srgb, var(--jade-deep) 75%, #0d0a24) 55%, color-mix(in srgb, var(--jade) 70%, #160f33) 100%);
  padding: clamp(64px, 10vw, 120px) 20px clamp(120px, 14vw, 170px);
}
.hd-stars { position: absolute; inset: 0; z-index: -1; pointer-events: none; }
.hd-stars--far {
  background-image:
          radial-gradient(1px 1px at 20px 30px, #fff 50%, transparent 51%),
          radial-gradient(1px 1px at 120px 80px, rgba(255, 255, 255, 0.8) 50%, transparent 51%),
          radial-gradient(1px 1px at 60px 150px, rgba(255, 255, 255, 0.7) 50%, transparent 51%),
          radial-gradient(1.5px 1.5px at 170px 20px, #fff 50%, transparent 51%),
          radial-gradient(1px 1px at 190px 170px, rgba(255, 255, 255, 0.6) 50%, transparent 51%),
          radial-gradient(1px 1px at 90px 110px, rgba(255, 255, 255, 0.5) 50%, transparent 51%);
  background-size: 210px 210px; opacity: 0.8; animation: hd-twinkle-bg 6s ease-in-out infinite;
}
.hd-stars--near {
  background-image:
          radial-gradient(2px 2px at 40px 60px, #fff 50%, transparent 51%),
          radial-gradient(1.5px 1.5px at 260px 140px, #fff 50%, transparent 51%),
          radial-gradient(2px 2px at 330px 40px, color-mix(in srgb, var(--hd-sky) 80%, #fff) 50%, transparent 51%),
          radial-gradient(1.5px 1.5px at 150px 300px, #fff 50%, transparent 51%);
  background-size: 380px 380px; animation: hd-twinkle-bg 4s ease-in-out -2s infinite;
}
@keyframes hd-twinkle-bg { 50% { opacity: 0.45; } }
.hd-shoot {
  position: absolute; z-index: -1; height: 2px; width: 160px; border-radius: 2px; opacity: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), transparent);
  transform: rotate(-24deg);
}
.hd-shoot--1 { top: 18%; left: 62%; animation: hd-shoot 9s ease-in 2s infinite; }
.hd-shoot--2 { top: 8%; left: 30%; animation: hd-shoot 13s ease-in 6s infinite; }
@keyframes hd-shoot {
  0% { opacity: 0; transform: rotate(-24deg) translateX(0); }
  2% { opacity: 1; }
  8% { opacity: 0; transform: rotate(-24deg) translateX(-360px); }
  100% { opacity: 0; transform: rotate(-24deg) translateX(-360px); }
}

.hd-sky-inner { position: relative; max-width: var(--hd-max); margin: 0 auto; display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.hd--starlight .hd-title { font-size: clamp(2.3rem, 5.4vw, 4.2rem); }
.hd--starlight .hd-accent { background: linear-gradient(95deg, #fff, color-mix(in srgb, var(--seal) 55%, #fff) 50%, color-mix(in srgb, var(--hd-sky) 70%, #fff)); -webkit-background-clip: text; background-clip: text; }
.hd--starlight .hd-kicker { color: color-mix(in srgb, var(--hd-sky) 70%, #fff); }
.hd--starlight .hd-lead { color: rgba(255, 255, 255, 0.82); }

.hd-sky-art { position: relative; width: 100%; max-width: 460px; justify-self: center; }
.hd-moon {
  position: absolute; top: -6%; right: 4%; width: 74px; height: 74px; border-radius: 50%;
  box-shadow: inset -18px 10px 0 0 #fff6e6; filter: drop-shadow(0 0 18px rgba(255, 240, 210, 0.55));
  transform: rotate(-20deg);
}
.hd-const { width: 100%; height: auto; overflow: visible; }
.hd-const-lines path { fill: none; stroke: rgba(255, 255, 255, 0.45); stroke-width: 1.2; stroke-dasharray: 600; stroke-dashoffset: 600; animation: hd-draw 3.2s ease-out 0.3s forwards; }
.hd-const-lines path:nth-child(2) { animation-delay: 0.6s; }
.hd-const-stars circle { fill: #fff; filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.9)); }
.hd-const-stars circle:nth-child(3n) { animation: hd-twinkle-bg 3s ease-in-out infinite; }
.hd-const-halo { fill: color-mix(in srgb, var(--seal) 35%, transparent); filter: blur(10px); animation: hd-pulse 4s ease-in-out infinite; transform-origin: 200px 162px; }
.hd-const-meet { fill: #fff; filter: drop-shadow(0 0 10px #fff) drop-shadow(0 0 22px var(--seal)); }
.hd-const-glint { stroke: rgba(255, 255, 255, 0.7); stroke-width: 1; stroke-linecap: round; }
@keyframes hd-draw { to { stroke-dashoffset: 0; } }
@keyframes hd-pulse { 50% { transform: scale(1.35); opacity: 0.6; } }

.hd-sky-hills { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 110px; z-index: 0; }
.hd-hill-b { fill: color-mix(in srgb, var(--jade-deep) 70%, #05040f); opacity: 0.9; }
.hd-hill-f { fill: var(--paper); }

.hd-sl-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 36px; text-align: center; }
.hd-sl-row h2 { font-size: 1.2rem; margin: 0 0 8px; }
.hd-sl-row p { color: var(--mist); margin: 0 auto; line-height: 1.6; max-width: 22em; }
.hd-sl-star {
  position: relative; display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
  color: #fff; background: radial-gradient(circle at 35% 30%, var(--hd-violet), var(--jade-deep));
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--hd-violet) 14%, transparent), 0 14px 30px -12px var(--jade-deep);
}
.hd-sl-star::after { content: ""; position: absolute; top: 2px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--seal); box-shadow: 0 0 10px var(--seal); }

.hd-sl-end {
  position: relative; overflow: hidden; isolation: isolate; text-align: center; color: #fff; border-radius: 32px;
  padding: clamp(48px, 7vw, 80px) 24px;
  background:
          radial-gradient(600px 260px at 50% 120%, color-mix(in srgb, var(--seal) 45%, transparent), transparent 70%),
          linear-gradient(180deg, color-mix(in srgb, var(--jade-deep) 55%, #05040f), color-mix(in srgb, var(--jade) 60%, #120d2e));
}
.hd-sl-end h2 { color: #fff; font-size: clamp(1.7rem, 3.6vw, 2.5rem); margin: 0 0 10px; }
.hd-sl-end p { color: rgba(255, 255, 255, 0.85); margin: 0 0 26px; }

@media (max-width: 860px) {
  .hd-au-tiles, .hd-au-steps, .hd-sl-row { grid-template-columns: 1fr; }
  .hd-sky-inner { grid-template-columns: 1fr; }
  .hd-sky-art { max-width: 340px; }
  .hd-au-blob { filter: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hd-au-blob, .hd-au-heart, .hd-au-spark, .hd-stars, .hd-shoot, .hd-const-halo, .hd-const-stars circle { animation: none !important; }
  .hd-shoot { display: none; }
  .hd-const-lines path { animation: none; stroke-dashoffset: 0; }
}

/* ---------- Admin: new thumbnails and the palette picker ---------- */
.hd-thumb--aurora { background: linear-gradient(120deg, color-mix(in srgb, var(--jade) 35%, #fff), color-mix(in srgb, var(--seal) 35%, #fff)); }
.hd-thumb--aurora i:nth-child(1) { left: 22%; right: 22%; top: 18%; bottom: 18%; border-radius: 10px; background: rgba(255, 255, 255, 0.6); border: 1px solid #fff; }
.hd-thumb--aurora i:nth-child(2) { left: 32%; right: 32%; top: 36%; height: 8px; background: var(--ink); opacity: 0.7; }
.hd-thumb--aurora i:nth-child(3) { left: 38%; right: 38%; top: 54%; height: 8px; border-radius: 8px; background: linear-gradient(90deg, var(--jade), var(--seal)); }
.hd-thumb--aurora i:nth-child(4) { right: 10%; top: 10%; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: -120px 50px 0 -2px #fff; }
.hd-thumb--starlight { background: linear-gradient(180deg, color-mix(in srgb, var(--jade-deep) 45%, #05040f), color-mix(in srgb, var(--jade) 65%, #160f33)); }
.hd-thumb--starlight i:nth-child(1) { left: 10%; top: 34%; width: 38%; height: 8px; background: #fff; }
.hd-thumb--starlight i:nth-child(2) { left: 10%; top: 50%; width: 18%; height: 7px; border-radius: 7px; background: #fff; opacity: 0.85; }
.hd-thumb--starlight i:nth-child(3) { right: 16%; top: 22%; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset -5px 3px 0 0 #fff6e6; }
.hd-thumb--starlight i:nth-child(4) { right: 34%; top: 54%; width: 4px; height: 4px; border-radius: 50%; background: #fff; box-shadow: 14px -10px 0 #fff, 28px 4px 0 #fff, -12px 12px 0 rgba(255,255,255,.7), 40px -22px 0 rgba(255,255,255,.8), 0 0 10px #fff; }

.hd-palettes { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.hd-swatch { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 1.5px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--paper); font-weight: 500; }
.hd-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.hd-swatch:has(input:checked) { border-color: var(--jade); box-shadow: 0 0 0 3px var(--ring); }
.hd-swatch:has(input:focus-visible) { outline: 2px solid var(--jade); outline-offset: 2px; }
.hd-dots { display: flex; }
.hd-dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--paper); margin-inline-start: -7px; }
.hd-dots i:first-child { margin-inline-start: 0; }
.hd-swatch--site i:nth-child(1) { background: var(--jade-deep); } .hd-swatch--site i:nth-child(2) { background: var(--jade); } .hd-swatch--site i:nth-child(3) { background: var(--seal); }
.hd-swatch--blossom i:nth-child(1) { background: #55208a; } .hd-swatch--blossom i:nth-child(2) { background: #b26bf0; } .hd-swatch--blossom i:nth-child(3) { background: #e8559d; }
.hd-swatch--ocean i:nth-child(1) { background: #123a86; } .hd-swatch--ocean i:nth-child(2) { background: #2563d1; } .hd-swatch--ocean i:nth-child(3) { background: #1fb3e0; }
.hd-swatch--twilight i:nth-child(1) { background: #262882; } .hd-swatch--twilight i:nth-child(2) { background: #8a5cf0; } .hd-swatch--twilight i:nth-child(3) { background: #d65fb5; }
.hd-subhead { font-family: var(--serif); font-weight: 700; margin: 22px 0 0; }


/* ---------- Admin → Home page: tabs ---------- */
.hm .page-head h1 { margin-bottom: 0; }
.hm-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1.5px solid var(--line); margin: 0 0 1.5rem; }
.hm-tabs [role="tab"] {
  background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1.5px;
  padding: 0.7rem 1.1rem; font: 500 var(--s0)/1.2 var(--sans); color: var(--mist); cursor: pointer;
}
.hm-tabs [role="tab"]:hover { color: var(--ink); }
.hm-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--jade); font-weight: 600; }
.hm-panel > .hint:first-child { margin-top: 0; }
.hm .hd-subhead { font-size: var(--s1); margin: 2rem 0 0.25rem; }
.hm .hd-picker { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.hm.narrowish { max-width: 72rem; }

/* ---------- Uploaded photos (Admin → Home page text & photos) ---------- */
.hd-photo { display: block; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.hd-pos-top { object-position: 50% 15%; }
.hd-pos-center { object-position: 50% 50%; }
.hd-pos-bottom { object-position: 50% 85%; }

/* Banner: the photo under a see-through wash of the palette, so white text stays readable. */
.hd-band.has-photo { background: var(--jade-deep); }
.hd-band-photo { position: absolute; inset: 0; z-index: -2; }
.hd-band.has-photo::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
          linear-gradient(100deg, color-mix(in srgb, var(--jade-deep) 92%, transparent) 0%,
          color-mix(in srgb, var(--jade) 72%, transparent) 45%, color-mix(in srgb, var(--seal) 35%, transparent) 100%);
}
.hd-band.has-photo .hd-rings { opacity: 0.55; }

/* Aurora: the photo shows through the colour clouds; the glass card keeps text readable. */
.hd-au-photo { position: absolute; inset: 0; z-index: -2; }
.hd-au.has-photo .hd-au-mesh { opacity: 0.55; }

/* Split: the photo fills the right half, with the "shared values" pill floating on it. */
.hd-split-art.has-photo { background: var(--celadon); }
.hd-split-photo { position: absolute; inset: 0; }
.hd-split-art.has-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.28)); pointer-events: none; }
.hd-split-art.has-photo .hd-shared { z-index: 2; }

/* Editorial: the photo inside the arch frame. */
.hd-arch.has-photo { background: var(--celadon); }
.hd-arch-photo { position: absolute; inset: 0; }

/* ---------- Admin: Home page text & photos ---------- */
.hc-head-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.hc-lang { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; margin-bottom: 1rem; }
.hc-lang select { width: auto; min-width: 12rem; }
.hc-group { border: 1px solid var(--line); border-radius: 0.75rem; padding: 1.1rem 1.25rem 1.25rem; margin: 0 0 1rem; background: #fff; }
.hc-group > legend { font-family: var(--serif); font-weight: 700; font-size: var(--s1); padding: 0 0.35rem; margin-left: -0.35rem; }
.hc-fields { display: grid; gap: 0.9rem; }
.hc-field { align-content: start; }
.hc-fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.hc-field textarea { min-height: 4.5rem; }
.hc-field input::placeholder, .hc-field textarea::placeholder { color: color-mix(in srgb, var(--mist) 70%, transparent); }
.hc-sub { font-weight: 600; margin: 0.4rem 0 -0.3rem; color: var(--mist); font-size: var(--s-1); text-transform: uppercase; letter-spacing: 0.06em; }
.hc-save { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 0.75rem; align-items: center; padding: 0.9rem 0; background: linear-gradient(transparent, var(--paper) 35%); }
.hc-photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; }
.hc-photo { border: 1px solid var(--line); border-radius: 0.75rem; padding: 1rem; background: #fff; display: grid; gap: 0.7rem; align-content: start; }
.hc-photo h3 { margin: 0; }
.hc-frame { position: relative; border-radius: 0.6rem; overflow: hidden; background: var(--celadon); border: 1px dashed var(--line); display: grid; place-items: center; color: var(--mist); font-size: var(--s-1); text-align: center; padding: 0; }
.hc-frame--hero { aspect-ratio: 16 / 7; }
.hc-frame--portrait { aspect-ratio: 4 / 5; max-height: 320px; }
.hc-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hc-frame span { padding: 1rem; }
.hc-photo .row { gap: 0.5rem; }
.hc-file { position: absolute; width: 1px; height: 1px; opacity: 0; }
@media (max-width: 700px) { .hc-fields-2 { grid-template-columns: 1fr; } }



/* ---------- Admin → Home page → Photos: library per slot ---------- */
.hc-slot { border: 1px solid var(--line); border-radius: 0.85rem; background: #fff; padding: 1.25rem; margin: 0 0 1.25rem; }
.hc-slot-head { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.hc-slot-head h2 { margin: 0 0 0.2rem; font-size: var(--s1); }
.hc-slot-head .hint { margin: 0; }
.hc-live { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.hc-live-side { display: grid; gap: 0.75rem; align-content: start; }
.hc-live-label { margin: 0; font-weight: 600; }
.hc-live-label::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--jade); margin-right: 0.45rem; vertical-align: 0.05em; }
.hc-lib-title { margin: 1.5rem 0 0.6rem; font-size: var(--s0); }
.hc-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.75rem; }
.hc-item { position: relative; border: 1.5px solid var(--line); border-radius: 0.6rem; overflow: hidden; background: var(--celadon); }
.hc-item.is-primary { border-color: var(--jade); box-shadow: 0 0 0 3px var(--ring); }
.hc-item img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hc-slot[data-slot="portrait"] .hc-item img { aspect-ratio: 4 / 5; }
.hc-item-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0.4rem 0.45rem; background: #fff; }
.hc-item-bar .btn { min-height: 1.9rem; padding: 0 0.7rem; font-size: 0.8rem; }
.hc-badge { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #fff; background: var(--jade); padding: 0.2rem 0.5rem; border-radius: 999px; }
.hc-del { background: none; border: 0; padding: 0.25rem; cursor: pointer; color: var(--mist); border-radius: 0.35rem; line-height: 0; }
.hc-del:hover { color: var(--danger); background: var(--celadon); }
.hc-del svg { width: 18px; height: 18px; }
.hc-item.is-busy { opacity: 0.55; pointer-events: none; }
.hc-item--uploading { display: grid; place-items: center; aspect-ratio: 4 / 3; color: var(--mist); font-size: var(--s-1); border-style: dashed; }
@media (max-width: 700px) { .hc-live { grid-template-columns: 1fr; } }
.hc-live-side .linklike { justify-self: start; text-align: start; }


/* ---------- Admin → Home page: choose, then Apply ---------- */
/* "Live" now marks what visitors see; the outline marks the choice not yet applied. */
.hm .hd-option .hd-option-live,
.hm .hd-option:has(input:checked) .hd-option-live { display: none; }
.hm .hd-option.is-live .hd-option-live { display: inline-block; }
.hm .hd-option:has(input:checked):not(.is-live) { border-style: dashed; }
.hm .hd-swatch.is-live::after {
  content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--jade);
  margin-inline-start: 0.1rem; box-shadow: 0 0 0 2px color-mix(in srgb, var(--jade) 25%, transparent);
}
.hd-apply {
  position: sticky; bottom: 1rem; z-index: 20; margin-top: 1.5rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem;
  padding: 0.85rem 1rem 0.85rem 1.25rem; border-radius: 0.9rem;
  background: var(--ink); color: var(--paper); box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.45);
}
.hd-apply[hidden] { display: none; }
.hd-apply p { margin: 0; font-weight: 500; }
.hd-apply-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hd-apply .btn-quiet { color: var(--paper); border-color: color-mix(in srgb, var(--paper) 40%, transparent); }
.hd-apply .btn-quiet:hover { color: var(--paper); border-color: var(--paper); }




/* ---------- "Your session has ended": sign in again over the page ---------- */
.relogin .match-box { text-align: start; width: min(26rem, calc(100vw - 2rem)); }
.relogin .match-box h2 { margin-top: 0; }
.relogin form { margin-top: 1rem; }
.relogin form .btn { width: 100%; }
.relogin-other { margin: 0.9rem 0 0; font-size: var(--s-1); text-align: center; }





/* ---------- Admin → Members: accounts waiting to be erased ---------- */
.md-deletions { margin: 0 0 1.5rem; border: 1px solid var(--line); border-radius: 0.75rem; background: #fff; padding: 0.75rem 1rem; }
.md-deletions > summary { cursor: pointer; font-weight: 600; }
.md-deletions .admin-table { margin-top: 0.75rem; }
.md-section h4 { margin: 1rem 0 0.4rem; font-size: var(--s0); }
.md-section textarea { width: 100%; }

/* ---------- Admin → Members pages and the member page (am-) ---------- */
.am-subnav { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1.5px solid var(--line); margin: 0 0 1.25rem; }
.am-subnav a {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.65rem 1rem; margin-bottom: -1.5px; border-bottom: 3px solid transparent;
  color: var(--mist); text-decoration: none; font-weight: 500;
}
.am-subnav a:hover { color: var(--ink); }
.am-subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--jade); font-weight: 600; }
.am-count {
  display: inline-block; min-width: 1.6rem; padding: 0.05rem 0.45rem; border-radius: 999px;
  background: var(--celadon); color: var(--jade-deep); font-size: 0.75rem; font-weight: 600; text-align: center;
}
.am-lede { margin-top: 0; }
.am-demo-tools { margin-bottom: 1.75rem; }
.am-more { text-align: center; margin: 1rem 0; }

/* one member */
.am-head { display: flex; gap: 1.25rem; align-items: center; margin: 0.5rem 0 1.5rem; }
/* Uses .avatar (photo, initial on a tone, or silhouette); only the size differs. */
.am-head-photo { width: 5rem; height: 5rem; font-size: 2.2rem; }
.am-head h1 { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.am-head h1 .badge { margin: 0; }
.am-head p { margin: 0.3rem 0 0; }
.am-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1.5px solid var(--line); margin: 0 0 1.5rem; }
.am-tabs [role="tab"] {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: none; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1.5px;
  padding: 0.7rem 1rem; font: 500 var(--s0)/1.2 var(--sans); color: var(--mist); cursor: pointer;
}
.am-tabs [role="tab"]:hover { color: var(--ink); }
.am-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--jade); font-weight: 600; }
.am-panel { display: grid; gap: 1.25rem; }
.am-panel[hidden] { display: none; }
.am-panel .md-section .admin-table { margin-top: 0.25rem; }
.am-deletion { background: #f6e7e4; border-radius: 0.6rem; padding: 1rem 1.25rem; border-top: 0; }
.am-deletion textarea { width: 100%; }

.am-person { display: flex; align-items: center; gap: 0.6rem; min-width: 12rem; }
.am-avatar { flex: none; width: 2.4rem; height: 2.4rem; border-radius: 50%; overflow: hidden; background: var(--celadon); }
.am-avatar img { width: 100%; height: 100%; object-fit: cover; }
.am-person-text { display: grid; gap: 0.1rem; }
.am-person-name .badge { margin-left: 0.15rem; font-size: 0.7rem; }
.am-person-meta { font-size: 0.8rem; }
.am-tags { display: inline-flex; gap: 0.3rem; flex-wrap: wrap; }

.am-switch { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; overflow: hidden; justify-self: start; }
.am-switch button { border: 0; background: transparent; padding: 0.45rem 1rem; font: inherit; color: var(--mist); cursor: pointer; }
.am-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* reading a conversation */
.am-private { margin: 0; padding: 0.75rem 1rem; background: var(--celadon); border-radius: 0.5rem; color: var(--jade-deep); }
.am-reason { width: min(32rem, 100%); display: grid; gap: 0.75rem; }
.am-reason h2 { margin: 0; font-size: var(--s1); }
.am-reason .hint { margin: 0; }
.am-demo-login { margin-top: 0.25rem; }
.am-demo-pw, .am-demo-actions { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; }
.am-demo-pw code { word-break: break-all; }
.am-reason textarea, .am-reason input[type="text"] { width: 100%; }
.am-reason-actions { justify-content: flex-end; gap: 0.5rem; }
.am-thread { border: 1.5px solid var(--line); border-radius: 0.75rem; padding: 1rem 1.25rem; }
.am-thread[hidden] { display: none; }
.am-thread-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.am-thread-head h3 { margin: 0; }
.am-thread > p { margin: 0.35rem 0; }
.am-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: var(--s-1); }
.am-key::before { content: ""; display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 0.25rem; margin-right: 0.35rem; vertical-align: -0.1rem; }
.am-key-member::before { background: var(--jade); }
.am-key-other::before { background: var(--celadon-deep); }
.am-messages { max-height: 70vh; padding: 1rem 0.25rem; }
.am-messages .msg-meta { flex-wrap: wrap; align-items: center; }
.am-messages .msg-meta .badge { margin: 0; font-size: 0.7rem; }
.am-was-unsent { outline: 2px dashed var(--seal); outline-offset: 2px; }

@media (max-width: 40rem) {
  .am-head-photo { width: 3.5rem; height: 3.5rem; font-size: 1.6rem; }
  .am-tabs [role="tab"], .am-subnav a { padding: 0.55rem 0.7rem; }
}


/* ---------- Curly quotes/apostrophes: Latin width outside Chinese, Japanese, Korean ---------- */
@font-face {
  font-family: "IM Punct";
  src: local("Segoe UI"), local("Helvetica Neue"), local("Helvetica"), local("Arial"), local("Roboto");
  unicode-range: U+2018-201F, U+2032-2033;
}
@font-face {
  font-family: "IM Punct Serif";
  src: local("Georgia"), local("Times New Roman"), local("Noto Serif");
  unicode-range: U+2018-201F, U+2032-2033;
}
html:not([lang|="zh"]):not([lang|="ja"]):not([lang|="ko"]) {
  --sans: "IM Punct", "Noto Sans SC", "Noto Sans Arabic", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --serif: "IM Punct Serif", "Noto Serif SC", "Noto Sans Arabic", "Songti SC", "STSong", Georgia, serif;
}


/* ---------- Coloured top bar, tinted footer pinned to the bottom ---------- */
.topbar {
  background: var(--jade);
  border-bottom-color: var(--jade-deep);
  color: #fff;
}
.topbar .brand,
.topbar > a,
.topbar-actions > a,
.topbar .account-menu > summary { color: #fff; }
.topbar .account-menu > summary:hover,
.topbar .account-menu[open] > summary { background: rgba(255, 255, 255, 0.16); }
.topbar .account-menu > summary::after { border-color: rgba(255, 255, 255, 0.85); }
.topbar .btn-primary { background: #fff; border-color: #fff; color: var(--jade-deep); }
.topbar .btn-quiet { color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.topbar .btn-quiet:hover { background: rgba(255, 255, 255, 0.12); }

/* Main is a column, so the footer can sit at the bottom on short pages too. */
main:not(:has(.chat-layout)) {
  display: flex; flex-direction: column;
  min-height: calc(100vh - 3.6rem);
  min-height: calc(100dvh - 3.6rem);
  padding-bottom: 0;
}
main > * { width: 100%; }

/* The footer: a tinted band across the full width of the content area. */
main > .site-foot {
  margin: auto calc(-1 * clamp(1.25rem, 4vw, 3.5rem)) 0;
  width: auto;
  padding: 1.25rem clamp(1.25rem, 4vw, 3.5rem) 1.5rem;
  background: var(--celadon);
  border-top: 1px solid var(--line);
}
main > .site-foot { margin-top: auto; }
main > :nth-last-child(2) { margin-bottom: 4rem; }

/* ---------- Help page (/help) and the contact form ---------- */
.faq { display: grid; gap: 0.5rem; margin-bottom: 1.5rem; }
.faq-item { border: 1.5px solid var(--line); border-radius: 0.75rem; background: #fff; }
.faq-item > summary {
  cursor: pointer; list-style: none; padding: 0.85rem 1.1rem; font-weight: 500;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: ""; flex: none; width: 0.5rem; height: 0.5rem;
  border-right: 2px solid var(--mist); border-bottom: 2px solid var(--mist);
  transform: rotate(45deg) translateY(-0.15rem); transition: transform 0.15s;
}
.faq-item[open] > summary::after { transform: rotate(-135deg) translateY(-0.1rem); }
.faq-item[open] > summary { color: var(--jade-deep); }
.faq-a { padding: 0 1.1rem 0.9rem; }
.faq-a p { margin: 0 0 0.5rem; }
.help-more { margin-top: 2.5rem; padding: 1.5rem; border-radius: 0.9rem; background: var(--celadon); }
.help-more h2 { margin-top: 0; }

.contact-help { padding: 0.85rem 1.1rem; border-radius: 0.75rem; background: var(--celadon); }
.contact-form { max-width: 34rem; margin-top: 1.5rem; }
.contact-form select, .contact-form input, .contact-form textarea { width: 100%; }
.contact-form .hint { margin: -0.4rem 0 0; }
.contact-sent { margin-top: 1.5rem; padding: 1.5rem; border-radius: 0.9rem; background: var(--celadon); }
.contact-sent:focus { outline: none; }
.contact-sent h2 { margin-top: 0; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Admin → Support ---------- */
.sp-list { display: grid; gap: 0.9rem; }
.sp-card { border: 1.5px solid var(--line); border-radius: 0.75rem; padding: 1rem 1.15rem; background: #fff; }
.sp-card.sp-new { border-left: 4px solid var(--jade); }
.sp-card.sp-done { opacity: 0.7; }
.sp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.sp-head .badge { margin: 0; }
.sp-from { margin: 0.5rem 0; font-size: var(--s-1); }
.sp-message { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0.25rem 0 0.75rem; max-width: 60rem; }
.sp-actions { gap: 0.5rem; flex-wrap: wrap; }


/* ---------- Legal pages (terms, privacy, refunds, guidelines): centred, a bit wider ---------- */
body[data-page="legal"] main > :not(.site-foot) {
  width: 100%;
  max-width: 50rem;
  margin-inline: auto;
}
body[data-page="legal"] main p,
body[data-page="legal"] main li { max-width: 46rem; }


body[data-page="legal"] main .narrow,
body[data-page="legal"] main .prose { max-width: 50rem; }


/* Very wide screens (large monitors at 100% scaling): scale the whole site up a little,
   so text and columns aren't tiny islands. Everything is in rem, so it all grows together. */
@media (min-width: 2000px) { html { font-size: 118.75%; } }  /* 19px */
@media (min-width: 2600px) { html { font-size: 137.5%; } }   /* 22px */
@media (min-width: 3200px) { html { font-size: 162.5%; } }   /* 26px */

/* Help, Contact and legal pages inside the mobile app: no top bar above them. */
.in-app main { padding-top: 1.5rem; min-height: 100vh; min-height: 100dvh; }

/* ---------------------------------------------------------------- admin: moderation */
.admin-stats a { color: inherit; text-decoration: none; display: block; }
.admin-home-mod { margin-top: 2rem; padding: 1rem 1.25rem; border: 1px solid var(--line); border-radius: 12px; }
.admin-home-mod.is-overdue { border-color: var(--danger); }
.admin-home-mod h2 { margin-top: 0; font-size: var(--s1); }
.mod-overdue { background: var(--danger); color: #fff; }
.mod-queue td.nowrap, .mod-queue th { white-space: nowrap; }
.mod-queue td { vertical-align: top; }
/* Details is the only long column: it wraps, within limits, and the table scrolls sideways on a phone. */
.mod-queue td:nth-child(5) { min-width: 12rem; max-width: 26rem; overflow-wrap: anywhere; }
.mod-protected { margin: 0.5rem 0; }
.mod-queue tr.mod-row-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.mod-actions { gap: 0.5rem; flex-wrap: wrap; margin: 0.5rem 0; }
.mod-form { margin: 0.75rem 0 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; max-width: 40rem; }
.mod-form h4 { margin: 0 0 0.5rem; }
.mod-form label { display: block; margin-bottom: 0.75rem; }
.mod-form label > span { display: block; margin-bottom: 0.25rem; font-size: var(--s-1); }
.mod-form textarea { width: 100%; }
.mod-form input[type=number] { width: 7rem; }
.mod-form .row { gap: 0.5rem; }
.mod-member-status { margin: 0.25rem 0 0.5rem; }
.mod-evidence { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.mod-evidence li { padding: 0.5rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; max-width: 40rem; }
.mod-evidence li.by-member { border-color: var(--danger); }
.mod-evidence p { margin: 0; }
.mod-msg { white-space: pre-wrap; overflow-wrap: anywhere; }
.notice-member { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.notice-member p { margin: 0; }

/* ------------------------------------------------------------------ admin: testing (QA tracker)
   Status colours are fixed rather than taken from the theme: green, red and amber have to
   keep their meaning whichever palette is on. Every status also carries an icon and a word. */
.qa {
  --qa-pass: #1f6b3e; --qa-pass-bg: #e3f3e8;
  --qa-fail: #a32a3f; --qa-fail-bg: #fbe4e8;
  --qa-blocked: #7a5200; --qa-blocked-bg: #fff4d6;
  --qa-quiet: var(--mist); --qa-quiet-bg: #fff;
}
.qa .badge { margin-left: 0; }
.qa-roundbar { margin-bottom: 0.75rem; }
.qa-roundbar p { margin: 0; }
.qa-roundlinks { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; margin-inline-start: auto; }

.qa-ready { border: 1.5px solid var(--line); border-radius: 0.75rem; padding: 1rem 1.15rem; margin: 0 0 1.5rem; background: #fff; }
.qa-ready h2 { margin-top: 0; }
.qa-verdict { font-size: var(--s1); margin: 0 0 0.75rem; padding: 0.5rem 0.8rem; border-radius: 0.5rem; }
.qa-verdict.is-yes { background: var(--qa-pass-bg); color: var(--qa-pass); }
.qa-verdict.is-no { background: var(--qa-fail-bg); color: var(--qa-fail); }
.qa-stats { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; align-items: baseline; margin-bottom: 0.75rem; }
.qa-stat { margin: 0; display: grid; }
.qa-stat-value { font: 600 var(--s2)/1.1 var(--sans); }
.qa-stat-main .qa-stat-value { font-size: var(--s3); }
.qa-stat-label { color: var(--mist); font-size: var(--s-1); }
.qa-stat-note { color: var(--mist); font-size: var(--s-1); align-self: end; }
.qa-table-wrap { overflow-x: auto; }
.qa-progress, .qa-results { width: 100%; border-collapse: collapse; font-size: var(--s-1); }
.qa-progress th, .qa-progress td, .qa-results th, .qa-results td { text-align: start; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.qa-progress thead th, .qa-results thead th { color: var(--mist); font-weight: 500; }
.qa-progress tbody th { font-weight: 500; }
.qa-bar { display: flex; height: 0.4rem; border-radius: 999px; background: var(--line); overflow: hidden; margin-bottom: 0.2rem; min-width: 4rem; }
.qa-bar-pass { background: var(--qa-pass); }
.qa-bar-bad { background: var(--qa-fail); }
.qa-bad { color: var(--qa-fail); font-weight: 600; }
.qa-p0 h3 { font-size: var(--s0); margin: 1rem 0 0.4rem; }
.qa-issues { margin: 0; padding-inline-start: 1.1rem; display: grid; gap: 0.35rem; }
.qa-issue-note { display: block; }

.qa-filters { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; margin-bottom: 0.75rem; }
.qa-search { flex: 1 1 16rem; }
.qa-search input { width: 100%; }

.qa-cat { margin-bottom: 0.5rem; }
.qa-cat > summary, .qa-group > summary { display: flex; gap: 0.5rem; align-items: baseline; cursor: pointer; list-style: none; padding: 0.4rem 0; }
.qa-cat > summary::-webkit-details-marker, .qa-group > summary::-webkit-details-marker { display: none; }
.qa-cat > summary::before, .qa-group > summary::before { content: "▸"; color: var(--mist); }
.qa-cat[open] > summary::before, .qa-group[open] > summary::before { content: "▾"; }
.qa-cat > summary h2 { margin: 0; font-size: var(--s2); }
.qa-group { margin-inline-start: 0.75rem; }
.qa-group > summary h3 { margin: 0; font-size: var(--s0); }
.qa-add { margin: 0.25rem 0 0.75rem; }

.qa-case { border: 1.5px solid var(--line); border-radius: 0.6rem; padding: 0.7rem 0.85rem; margin: 0 0 0.6rem; background: #fff; }
.qa-case.is-archived { opacity: 0.65; }
.qa-case.is-target { outline: 3px solid var(--jade); outline-offset: 2px; }
.qa-case-head { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.qa-code { font: 600 var(--s-1)/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.qa-pr-P0 { background: var(--qa-fail-bg); color: var(--qa-fail); }
.qa-claude { background: var(--ink); color: var(--paper); }
.qa-case-title { margin: 0.35rem 0 0.55rem; font-weight: 500; }
.qa-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; }
.qa-btn {
  display: grid; gap: 0.05rem; text-align: start; min-height: 2.75rem; padding: 0.3rem 0.55rem;
  border: 1.5px solid var(--line); border-radius: 0.5rem; background: var(--qa-quiet-bg); color: var(--ink);
  font: inherit; font-size: var(--s-1); cursor: pointer;
}
.qa-btn:focus-visible { outline: 3px solid var(--jade); outline-offset: 2px; }
.qa-btn[disabled] { cursor: default; }
.qa-btn.is-off { border-style: dashed; color: var(--mist); background: transparent; cursor: default; }
.qa-btn-pl { color: var(--mist); font-size: 0.75rem; }
.qa-btn-st { font-weight: 600; overflow-wrap: anywhere; }
.qa-btn.qa-st-not_tested .qa-btn-st, .qa-btn.qa-st-na .qa-btn-st { color: var(--qa-quiet); font-weight: 500; }
.qa-btn.qa-st-pass { border-color: var(--qa-pass); background: var(--qa-pass-bg); }
.qa-btn.qa-st-pass .qa-btn-st { color: var(--qa-pass); }
.qa-btn.qa-st-fail { border-color: var(--qa-fail); background: var(--qa-fail-bg); }
.qa-btn.qa-st-fail .qa-btn-st { color: var(--qa-fail); }
.qa-btn.qa-st-blocked { border-color: var(--qa-blocked); background: var(--qa-blocked-bg); }
.qa-btn.qa-st-blocked .qa-btn-st { color: var(--qa-blocked); }
.qa-menu { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.4rem; padding: 0.4rem; border: 1.5px solid var(--line); border-radius: 0.5rem; background: var(--paper); }
.qa-menu button { min-height: 2.5rem; padding: 0 0.75rem; border: 1.5px solid var(--line); border-radius: 0.45rem; background: #fff; font: inherit; font-size: var(--s-1); cursor: pointer; }
.qa-menu .qa-st-pass { color: var(--qa-pass); }
.qa-menu .qa-st-fail { color: var(--qa-fail); }
.qa-menu .qa-st-blocked { color: var(--qa-blocked); }
.qa-menu button:focus-visible { outline: 3px solid var(--jade); outline-offset: 1px; }
.qa-more { margin-top: 0.5rem; }
.qa-more > summary { cursor: pointer; color: var(--jade-deep); font-size: var(--s-1); }
.qa-more-body h4 { margin: 0.75rem 0 0.2rem; font-size: var(--s-1); color: var(--mist); }
.qa-more-body p { margin: 0; }
.qa-pre { white-space: pre-line; overflow-wrap: anywhere; }
.qa-check { margin-top: 0.5rem !important; overflow-wrap: anywhere; }
.qa-history { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.4rem; font-size: var(--s-1); }
.qa-history li { border-inline-start: 3px solid var(--line); padding-inline-start: 0.5rem; }
.qa-history li.qa-st-pass { border-color: var(--qa-pass); }
.qa-history li.qa-st-fail { border-color: var(--qa-fail); }
.qa-history li.qa-st-blocked { border-color: var(--qa-blocked); }

.qa-dialog { width: min(36rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); overflow-y: auto; }
.qa-dialog fieldset { border: 0; padding: 0; margin: 0; }
.qa-dialog legend { font-weight: 500; margin-bottom: 0.35rem; }
.qa-status-pick { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.qa-pick { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.6rem; border: 1.5px solid var(--line); border-radius: 0.45rem; font-weight: 400; cursor: pointer; }
.qa-pick:has(input:checked) { border-color: var(--ink); font-weight: 600; }
.qa-pick.qa-st-pass { color: var(--qa-pass); }
.qa-pick.qa-st-fail { color: var(--qa-fail); }
.qa-pick.qa-st-blocked { color: var(--qa-blocked); }
.qa-pick.qa-st-not_tested .qa-icon::before { content: "○"; }
.qa-pick.qa-st-pass .qa-icon::before { content: "✓"; }
.qa-pick.qa-st-fail .qa-icon::before { content: "✗"; }
.qa-pick.qa-st-blocked .qa-icon::before { content: "⚠"; }
.qa-pick.qa-st-na .qa-icon::before { content: "—"; }
.qa-fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.qa-rounds { display: grid; gap: 0.9rem; }
.qa-round { border: 1.5px solid var(--line); border-radius: 0.75rem; padding: 0.9rem 1.1rem; background: #fff; }
.qa-round.is-closed { opacity: 0.8; }
.qa-round h2 { margin: 0; font-size: var(--s1); }
.qa-round p { margin: 0.3rem 0 0; }
.qa-round .row { margin-top: 0.6rem; }
.qa-report h2 { margin-top: 1.75rem; }
.qa-results tr.qa-st-fail td, .qa-results tr.qa-st-blocked td { color: var(--qa-fail); }

@media (max-width: 40rem) {
  .qa-fields-2 { grid-template-columns: 1fr; }
  .qa-group { margin-inline-start: 0; }
  .qa-btn { padding: 0.3rem 0.4rem; }
  .qa-roundlinks { margin-inline-start: 0; }
}

@media print {
  .topbar, .rail, .skip, .site-foot, #toast, .no-print, .notice-member { display: none !important; }
  body, .qa-ready, .qa-case { background: #fff; }
  .shell, main { display: block; margin: 0; padding: 0; max-width: none; }
  .qa-report h2 { break-after: avoid; }
  .qa-results tr, .qa-issues li { break-inside: avoid; }
  .qa-table-wrap { overflow: visible; }
}
