/* ==========================================================================
   GainGerms — Design System (theme.css)
   "Ledger": an editorial, document-led theme. Restrained colour, hairline
   rules, serif display type, and no decorative gradients or glows.
   Shared tokens, base elements, and components used by every screen.
   ========================================================================== */

/* ---------- 1. Design tokens ---------- */
:root {
  /* The viewer has three states, not two: an explicit choice stamps
     data-theme on <html>, while the default "system" setting stamps nothing
     and is decided by prefers-color-scheme alone. The dark palette is
     therefore declared twice — once for each state — and the two lists must
     stay identical. */
  color-scheme: light dark;

  /* Surfaces — warm paper rather than pure white */
  --bg: #f5f2eb;
  --bg-soft: #efebe1;
  --surface: #fffdf8;
  --surface-2: #f2eee5;
  --surface-3: #e9e4d8;
  --line: rgba(28, 27, 24, .12);
  --line-strong: rgba(28, 27, 24, .22);

  /* Categorical chart series, in fixed slot order — slot 1 is always Roll, so
     a colour means the same category on every render. Validated against this
     surface for lightness, chroma, contrast, and separation under protanopia,
     deuteranopia and tritanopia; the muted set these replaced failed three of
     those, with two slots 1.5 ΔE apart for a protan reader and 7.0 for
     everyone else — indistinguishable. Do not hand-tune: re-run the validator. */
  --viz-1: #2a78d6;
  --viz-2: #eb6834;
  --viz-3: #1baf7a;
  --viz-4: #eda100;
  --viz-5: #e87ba4;
  --viz-6: #008300;
  --viz-7: #4a3aa7;

  /* Skeletons: the resting bar, and the band that sweeps across it. */
  --skeleton: #e7e2d6;
  --skeleton-sheen: #f3efe6;

  /* Ink */
  --text: #1c1b18;
  --text-dim: #55524a;
  --text-mute: #857f73;

  /* Brand — one considered accent, plus a clay secondary. No gradients. */
  --brand: #2f5d50;
  --brand-ink: #24493f;
  --brand-soft: rgba(47, 93, 80, .10);
  --brand-2: #8a5a3b;
  --brand-2-soft: rgba(138, 90, 59, .10);
  --brand-3: #4a5568;
  /* Kept for API compatibility; both resolve to flat colour, never a gradient. */
  --brand-grad: var(--brand);
  --brand-grad-soft: var(--brand-soft);
  --on-brand: #f7f5f0;

  /* Status — desaturated so nothing shouts */
  --ok: #3d6b53;
  --ok-soft: rgba(61, 107, 83, .12);
  --warn: #8a6d24;
  --warn-soft: rgba(138, 109, 36, .13);
  --danger: #9b3b32;
  --danger-soft: rgba(155, 59, 50, .11);
  --info: #3b5f7d;
  --info-soft: rgba(59, 95, 125, .11);

  /* Categorical series — muted, for charts and legends */
  --c1: #2f5d50;
  --c2: #8a5a3b;
  --c3: #4a6d8c;
  --c4: #7a6a94;
  --c5: #93704a;
  --c6: #5c7a5e;
  --c7: #8c5f6b;

  /* Shape & motion — small radii read as printed matter, not as chrome */
  --r-sm: 3px;
  --r-md: 4px;
  --r-lg: 6px;
  --r-xl: 8px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(28, 27, 24, .05);
  --shadow-md: 0 6px 20px rgba(28, 27, 24, .09);
  --shadow-glow: var(--shadow-md);
  --ease: cubic-bezier(.2, .6, .35, 1);

  /* Layout */
  --wrap: 1180px;
  --nav-h: 68px;
  --sidebar-w: 260px;

  /* Type — a serif for display, a grotesque for interface.
     Both are loaded from Google Fonts in each page's <head>, so the setting is
     identical on every OS. The stacks below still name system fallbacks with
     comparable metrics, so a blocked or slow font request degrades quietly
     rather than reflowing the page. */
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: "Source Serif 4", "Iowan Old Style", "Palatino Linotype",
                  Palatino, Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
}

/* System setting is dark, and the reader has not explicitly chosen light. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
  --bg: #16150f;
  --bg-soft: #1b1a14;
  --surface: #201e18;
  --surface-2: #262319;
  --surface-3: #2e2b20;
  --line: rgba(237, 233, 224, .13);
  --line-strong: rgba(237, 233, 224, .24);
  --viz-1: #3987e5;
  --viz-2: #d95926;
  --viz-3: #199e70;
  --viz-4: #c98500;
  --viz-5: #d55181;
  --viz-6: #008300;
  --viz-7: #9085e9;
  --skeleton: #2b2820;
  --skeleton-sheen: #383429;
  --text: #ece8de;
  --text-dim: #b3ac9c;
  --text-mute: #857f70;
  --brand: #7ba795;
  --brand-ink: #9cc3b2;
  --brand-soft: rgba(123, 167, 149, .14);
  --brand-2: #c08e63;
  --brand-2-soft: rgba(192, 142, 99, .14);
  --brand-3: #8d97a8;
  --brand-grad: var(--brand);
  --brand-grad-soft: var(--brand-soft);
  --on-brand: #14140f;
  --ok: #7fb193;
  --ok-soft: rgba(127, 177, 147, .15);
  --warn: #ceac5c;
  --warn-soft: rgba(206, 172, 92, .15);
  --danger: #d08078;
  --danger-soft: rgba(208, 128, 120, .15);
  --info: #82a6c4;
  --info-soft: rgba(130, 166, 196, .15);
  --c1: #7ba795;
  --c2: #c08e63;
  --c3: #85a6c2;
  --c4: #a99bc4;
  --c5: #c2a077;
  --c6: #93ac93;
  --c7: #c0919c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 26px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}

/* The reader explicitly chose dark — this wins over a light system setting. */
:root[data-theme="dark"] {
  --bg: #16150f;
  --bg-soft: #1b1a14;
  --surface: #201e18;
  --surface-2: #262319;
  --surface-3: #2e2b20;
  --line: rgba(237, 233, 224, .13);
  --line-strong: rgba(237, 233, 224, .24);
  --viz-1: #3987e5;
  --viz-2: #d95926;
  --viz-3: #199e70;
  --viz-4: #c98500;
  --viz-5: #d55181;
  --viz-6: #008300;
  --viz-7: #9085e9;
  --skeleton: #2b2820;
  --skeleton-sheen: #383429;
  --text: #ece8de;
  --text-dim: #b3ac9c;
  --text-mute: #857f70;
  --brand: #7ba795;
  --brand-ink: #9cc3b2;
  --brand-soft: rgba(123, 167, 149, .14);
  --brand-2: #c08e63;
  --brand-2-soft: rgba(192, 142, 99, .14);
  --brand-3: #8d97a8;
  --brand-grad: var(--brand);
  --brand-grad-soft: var(--brand-soft);
  --on-brand: #14140f;
  --ok: #7fb193;
  --ok-soft: rgba(127, 177, 147, .15);
  --warn: #ceac5c;
  --warn-soft: rgba(206, 172, 92, .15);
  --danger: #d08078;
  --danger-soft: rgba(208, 128, 120, .15);
  --info: #82a6c4;
  --info-soft: rgba(130, 166, 196, .15);
  --c1: #7ba795;
  --c2: #c08e63;
  --c3: #85a6c2;
  --c4: #a99bc4;
  --c5: #c2a077;
  --c6: #93ac93;
  --c7: #c0919c;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 8px 26px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

/* ---------- 2. Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* A faint ruled wash — the suggestion of paper, not a visible pattern. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .5;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 31px,
    var(--line) 31px 32px
  );
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 62%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 62%);
}

/* height:auto keeps a scaled-down image from keeping its attribute height,
   which would otherwise letterbox it inside its box. */
img, svg, video { max-width: 100%; height: auto; display: block; }

a {
  color: var(--brand-ink);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color .18s var(--ease);
}
a:hover { color: var(--brand); text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }
ul, ol { margin: 0 0 1rem; padding-left: 1.2rem; }
li { margin: .35rem 0; }
p { margin: 0 0 1rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.25rem 0; }

h1, h2, h3, h4, h5 {
  margin: 0 0 .6rem;
  font-family: var(--font-display);
  line-height: 1.2;
  letter-spacing: -.005em;
  font-weight: 600;
}
h1 { font-size: clamp(2rem, 4.1vw, 3.05rem); line-height: 1.12; }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.15rem); }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.4rem); }
h4 { font-size: 1.05rem; font-weight: 600; }
h5 { font-size: .95rem; font-weight: 600; }

/* Figures are financial: align them. */
.num, .tile-value, .table .num, .kv-value, .hero-stat b,
.roll-stat b, .gauge-value, .level-count, .contract-reward b {
  font-variant-numeric: tabular-nums;
}

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

::selection { background: var(--brand-soft); color: var(--text); }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 0;
  border: 4px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* ---------- 3. Layout helpers ---------- */
.wrap { width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.wrap-narrow { width: min(100% - 40px, 900px); margin-inline: auto; }
.section { padding: clamp(52px, 7vw, 96px) 0; }
.section-tight { padding: clamp(34px, 4.5vw, 60px) 0; }
.center { text-align: center; }
.muted { color: var(--text-dim); }
.small { font-size: .875rem; }
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: 20px; }
/* Grid/flex children must be allowed to shrink below their content width,
   otherwise wide tables and long links push the page sideways on mobile. */
.grid > *, .post-grid > *, .contact-grid > *, .wp-layout > *,
.cols-2 > *, .cols-2-wide > *, .cols-3-app > *, .accordion > *,
.stat-grid > *, .action-grid > *, .footer-grid > *, .hero-grid > *, .split > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(268px, 100%), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-between { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; }

/* Emphasis without a gradient: the accent colour does the work.
   Italic only as inline emphasis inside a larger line — a whole heading or a
   standalone figure set in italic reads as fussy rather than considered. */
.gradient-text { color: var(--brand); }
span.gradient-text { font-style: italic; }

/* ---------- 4. Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.25rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--btn-bg);
  color: var(--text);
  font-weight: 600;
  font-size: .92rem;
  line-height: 1.2;
  letter-spacing: .005em;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s var(--ease), border-color .18s var(--ease),
              color .18s var(--ease), opacity .18s var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--text-mute); color: var(--text); text-decoration: none; }
.btn:active { background: var(--surface-3); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}
.btn-primary:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--on-brand); }

/* `btn-blue` is the primary action throughout the app (Login, Deposit,
   Withdraw, Roll, Buy), so it shares the primary treatment. One accent means
   one unambiguous "the button to press" on every screen. */
.btn-blue {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--on-brand);
}
.btn-blue:hover { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--on-brand); }

.btn-ghost { background: transparent; }
.btn-quiet { background: transparent; border-color: var(--line); color: var(--text-dim); }
.btn-sm { padding: .45rem .8rem; font-size: .82rem; }
.btn-lg { padding: .85rem 1.6rem; font-size: .98rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: var(--on-brand); }

/* ---------- 5. Cards & surfaces ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.card-hover:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.card-flat { background: transparent; box-shadow: none; }
.card-pad-lg { padding: clamp(24px, 3.6vw, 40px); }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.panel-head h3 { margin: 0; font-size: 1.05rem; }
.panel-body { padding: 22px; }

/* Statistic tiles read as ledger entries: a rule, a figure, a caption. */
.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--brand);
  border-radius: var(--r-md);
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.tile:hover { background: var(--surface-2); }
.tile-icon {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  color: var(--brand);
}
.tile-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.tile-label {
  font-size: .72rem;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 600;
}

/* ---------- 6. Badges, pills & chips ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .5rem;
  border-radius: var(--r-sm);
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text-dim);
}
.badge-ok { color: var(--ok); background: var(--ok-soft); border-color: var(--ok); }
.badge-warn { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
.badge-info { color: var(--info); background: var(--info-soft); border-color: var(--info); }
.badge-danger { color: var(--danger); background: var(--danger-soft); border-color: var(--danger); }
.badge-muted { color: var(--text-mute); border-color: var(--line); }

/* The eyebrow is a small-caps standfirst, ruled rather than pilled. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: 0 0 .4rem;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  background: none;
  font-size: .73rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.eyebrow::before {
  content: "";
  width: 14px; height: 1px;
  background: var(--brand);
}

.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-block;
  padding: .26rem .62rem;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: .82rem;
  color: var(--text-dim);
}
a.chip:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-3); text-decoration: none; }

/* ---------- 7. Section headers ---------- */
.section-head { max-width: 680px; margin: 0 auto 40px; text-align: center; }
.section-head p { color: var(--text-dim); margin: .6rem 0 0; font-size: 1.03rem; }
.section-head .eyebrow { margin-bottom: 16px; }
.section-head-left { text-align: left; margin-inline: 0; }

/* ---------- 8. Forms ---------- */
.field { margin-bottom: 16px; }
.label {
  display: block;
  margin-bottom: .4rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.label .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%;
  padding: .72rem .9rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  color: var(--text);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--text-mute); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.textarea { min-height: 150px; resize: vertical; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23857f73' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 38px;
}
.hint { font-size: .82rem; color: var(--text-mute); margin-top: .4rem; }
.error-text { font-size: .82rem; color: var(--danger); margin-top: .35rem; display: none; }
.field.is-invalid .input,
.field.is-invalid .select,
.field.is-invalid .textarea { border-color: var(--danger); }
.field.is-invalid .error-text { display: block; }

.check { display: flex; gap: .65rem; align-items: flex-start; cursor: pointer; }
.check input[type="checkbox"] {
  flex: none;
  appearance: none;
  width: 18px; height: 18px;
  margin-top: 3px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.check input[type="checkbox"]:checked {
  background: var(--brand);
  border-color: var(--brand);
}
.check input[type="checkbox"]:checked::after {
  content: "";
  display: block;
  width: 4px; height: 9px;
  margin: 2px auto;
  border: solid var(--on-brand);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.check span { font-size: .9rem; color: var(--text-dim); }

.form-note {
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--info-soft);
  border: 1px solid var(--line);
  border-left: 2px solid var(--info);
  font-size: .88rem;
  color: var(--text-dim);
}
.form-status { margin-top: 14px; font-size: .9rem; display: none; }
.form-status.show { display: block; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--danger); }

/* ---------- 9. Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 520px; }
.table th {
  text-align: left;
  padding: 11px 16px;
  font-size: .71rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-mute);
  background: transparent;
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--text-dim); }
.table tbody tr { transition: background .14s var(--ease); }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td strong, .table td b { color: var(--text); font-weight: 600; }
.table .num { text-align: right; }
.table-empty { padding: 34px 16px; text-align: center; color: var(--text-mute); }

/* ---------- 10. Avatars & lists ---------- */
.avatar {
  flex: none;
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: .9rem;
  color: var(--on-brand);
  background: var(--brand);
}
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar-a { background: var(--c2); }
.avatar-b { background: var(--c3); }
.avatar-c { background: var(--c4); }
.avatar-d { background: var(--c6); }
.avatar-e { background: var(--c7); }

.media-list { display: flex; flex-direction: column; gap: 0; }
.media {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  transition: background .16s var(--ease);
}
.media-list > .media:last-child { border-bottom: 0; }
.media:hover { background: var(--surface-2); }
.media-title { font-weight: 600; font-size: .93rem; }
.media-sub { font-size: .8rem; color: var(--text-mute); }

/* ---------- 11. Progress ---------- */
.progress {
  height: 8px;
  border-radius: 2px;
  background: var(--surface-3);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width .8s var(--ease);
}
.progress-thin { height: 4px; }

/* ---------- 12. Public site navbar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(120%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.16rem;
  color: var(--text);
  letter-spacing: -.01em;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: var(--on-brand);
  font-family: var(--font);
  font-weight: 700;
  font-size: .88rem;
}
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  padding: .45rem .8rem;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: .92rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}
.nav-links a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-links a.active { color: var(--text); background: transparent; border-bottom-color: var(--brand); border-radius: 0; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.nav-toggle {
  display: none;
  width: 38px; height: 38px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
}
.nav-toggle span { display: block; width: 16px; height: 1.5px; background: var(--text); border-radius: 1px; position: relative; }
.nav-toggle span::before, .nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
  width: 16px; height: 1.5px;
  background: var(--text);
  border-radius: 1px;
}
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }

.subnav {
  /* min-height, not height: the row wraps on narrow screens rather than
     pushing its contents past the viewport edge. */
  min-height: 56px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.subnav-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; width: min(100% - 40px, var(--wrap)); margin-inline: auto; }
.subnav-title { display: flex; align-items: center; gap: .55rem; font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; }

/* ---------- 12b. Theme toggle ---------- */
/* Injected by assets/js/theme.js into whichever header the page has. */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  background: var(--surface);
}
.theme-toggle button {
  display: grid;
  place-items: center;
  width: 30px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.theme-toggle button:hover { color: var(--text); background: var(--surface-2); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--brand);
  color: var(--on-brand);
}
.theme-toggle svg { width: 15px; height: 15px; display: block; }

/* In the app sidebar the control sits on its own row above the footer links. */
.sidebar .theme-toggle { width: 100%; justify-content: center; margin-top: 14px; }

/* ---------- 13. Footer ---------- */
.footer {
  border-top: 1px solid var(--line-strong);
  background: var(--surface);
  padding: clamp(44px, 6vw, 68px) 0 0;
}
.footer-grid { display: grid; gap: 34px; grid-template-columns: 1.5fr 1fr 1fr 1fr; }
.footer h5 {
  font-family: var(--font);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--text-mute);
  margin-bottom: 14px;
  font-weight: 600;
}
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.footer-links a { color: var(--text-dim); font-size: .91rem; }
.footer-links a:hover { color: var(--brand); }
.footer-bottom {
  margin-top: clamp(34px, 5vw, 52px);
  padding: 20px 0;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  color: var(--text-mute);
  font-size: .86rem;
}
.socials { display: flex; gap: 8px; }
.socials a {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-dim);
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.socials a:hover { color: var(--brand); border-color: var(--line-strong); background: var(--surface-2); text-decoration: none; }

/* ---------- 14. Legal / long-form document pages ---------- */
.doc-hero {
  padding: clamp(38px, 5vw, 64px) 0 26px;
  border-bottom: 1px solid var(--line);
}
.doc-hero h1 { margin-bottom: .35rem; }
.doc-meta { color: var(--text-mute); font-size: .9rem; margin-bottom: 20px; }
.doc-callout {
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--brand);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-dim);
  font-size: .93rem;
}
.doc-toc {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: .91rem;
}
.doc-toc strong { display: block; margin-bottom: 8px; color: var(--text); }
.doc-body { padding: clamp(22px, 3.4vw, 40px); }
.doc-body section { padding: 26px 0; border-bottom: 1px solid var(--line); }
.doc-body section:first-of-type { padding-top: 6px; }
.doc-body section:last-of-type { border-bottom: 0; padding-bottom: 6px; }
.doc-body h2 { font-size: clamp(1.3rem, 2.2vw, 1.68rem); margin-bottom: 1rem; }
.doc-body h3 { font-size: 1.06rem; margin: 1.4rem 0 .5rem; color: var(--text); }
.doc-body p, .doc-body li { color: var(--text-dim); max-width: 74ch; }
.doc-body strong { color: var(--text); }
.clause { display: grid; grid-template-columns: 42px 1fr; gap: 6px 12px; margin-bottom: 1rem; }
.clause-no { font-family: var(--font-display); font-weight: 600; color: var(--brand); font-variant-numeric: tabular-nums; }
.clause p { margin: 0; }
.note {
  padding: 14px 18px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border-left: 2px solid var(--brand);
  color: var(--text-dim);
  font-size: .92rem;
}
.note-danger { border-left-color: var(--danger); background: var(--danger-soft); }
.note-warn { border-left-color: var(--warn); background: var(--warn-soft); }
.note strong { color: var(--text); }
.steps { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-dim); }
.step-no {
  flex: none;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--brand-soft);
  border: 1px solid var(--line);
  color: var(--brand);
  font-size: .78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- 15. Accordion (FAQ) ---------- */
.accordion { display: grid; gap: 0; border-top: 1px solid var(--line); }
.acc {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  transition: background .18s var(--ease);
}
.acc[open] { background: var(--surface); }
.acc summary {
  display: flex;
  overflow-wrap: anywhere;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 16px 18px 16px 0;
  cursor: pointer;
  font-weight: 600;
  font-size: .98rem;
  list-style: none;
  position: relative;
}
.acc[open] summary { padding-left: 18px; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary::after {
  content: "+";
  flex: none;
  margin-left: auto;
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--text-mute);
  transition: transform .2s var(--ease), color .2s var(--ease);
}
.acc[open] summary::after { transform: rotate(45deg); color: var(--brand); }
.acc summary:hover { color: var(--brand); }
.acc-body { padding: 0 18px 18px; color: var(--text-dim); font-size: .94rem; max-width: 76ch; overflow-wrap: anywhere; }
.acc[open] .acc-body { padding-left: 18px; }
.acc-body p:last-child { margin-bottom: 0; }

/* ---------- 16. Timeline ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 4px; top: 4px; bottom: 4px;
  width: 1px;
  background: var(--line-strong);
}
.timeline-item { position: relative; padding-bottom: 26px; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -26px; top: 7px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--brand);
}
.timeline-item h4 { margin-bottom: .25rem; }
.timeline-item p { color: var(--text-dim); margin: 0; }

/* ---------- 17. Utility ---------- */
.mt-0 { margin-top: 0 !important; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: 1rem; }
.hide { display: none !important; }
.nowrap { white-space: nowrap; }
.danger { color: var(--danger); }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- 18. Motion ---------- */
/* Restrained: content settles in, it does not spring. */
.reveal { opacity: 0; transform: translateY(8px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- 19. Responsive ---------- */
@media (max-width: 900px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .nav-toggle { display: grid; }
  .nav-links {
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 14px 20px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .7rem .8rem; border-bottom: 0; }
  .nav-links a.active { background: var(--surface-2); border-radius: var(--r-sm); }
  .nav-cta { display: flex; gap: 10px; margin-top: 10px; }
  .nav-cta .btn { flex: 1; }
  .nav-actions .btn { display: none; }
}

@media (min-width: 861px) {
  .nav-cta { display: none; }
}

@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }
}

/* ---------- Document pages: FAQ and contact ----------
   These are components, not page styles: the same FAQ, terms, privacy, about
   and contact content is rendered both on the public site and inside the
   signed-in shell, which loads app.css rather than site.css. Anything both
   shells draw belongs here, beside .doc-body and .accordion. */
/* ---------- FAQ page ---------- */
.faq-search { margin-bottom: 10px; }
.faq-search .input { padding-left: 40px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23857f73' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 14px center; }
.faq-count { font-size: .85rem; color: var(--text-mute); margin-bottom: 24px; }
.faq-group { margin-bottom: 34px; }
.faq-group h2 { font-size: 1.2rem; margin-bottom: 4px; padding-bottom: 8px; }
.acc summary .badge { margin-left: auto; margin-right: 10px; }
.faq-empty { display: none; padding: 34px; text-align: center; color: var(--text-mute); }
.faq-empty.show { display: block; }

/* ---------- Contact page ---------- */
.contact-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: clamp(24px, 4vw, 44px); align-items: start; }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--text-dim); font-size: .93rem; }
.contact-list li:last-child { border-bottom: 0; }
.contact-list b { display: block; color: var(--text); font-size: .74rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 3px; }

@media (max-width: 1000px) {
  .contact-grid { grid-template-columns: 1fr; }
}

/* ---------- Skeletons ----------
   What a value looks like before the server has said what it is.

   Two rules decide where these appear. Anything the page draws itself — a
   table row, a card, an avatar — carries an explicit `.skeleton`. Anything
   bound to a field is handled by `:empty` instead: the markup ships the
   element with nothing in it, and the moment JavaScript writes a value the
   selector stops matching and the bar becomes the number. Nothing has to
   remember to clear it.

   That also settles a worse problem. These pages used to ship plausible
   figures in the markup — the dashboard read "5,333,767 Germs" over
   "$ 161.331" until the API answered — so for the first moment of every
   visit, every reader saw a balance that was not theirs. An empty element
   cannot do that. */
@keyframes gg-skeleton-sweep { to { background-position: -200% 0; } }

.skeleton,
[data-field]:empty,
[data-wallet-field]:empty,
[data-ref-field]:empty,
[data-roll-field]:empty,
[data-level-count]:empty,
[data-level-pill]:empty,
[data-sold-out]:empty {
  display: inline-block;
  min-width: 4ch;
  height: 1em;
  vertical-align: -.14em;
  border-radius: 5px;
  /* Not selectable and not read aloud: there is no text here, only a promise
     of some. */
  user-select: none;
  background: linear-gradient(
    90deg,
    var(--skeleton) 38%,
    var(--skeleton-sheen) 50%,
    var(--skeleton) 62%
  ) 0 0 / 200% 100%;
  animation: gg-skeleton-sweep 1.5s linear infinite;
}

/* Widths, so a row of bars reads as a row of different values rather than a
   grid of identical blocks. */
.sk-xs { width: 3ch; }
.sk-sm { width: 6ch; }
.sk-md { width: 9ch; }
.sk-lg { width: 13ch; }
.sk-full { width: 100%; }
.sk-line { display: block; }
.sk-line + .sk-line { margin-top: 7px; }
.sk-circle { width: 34px; height: 34px; border-radius: 50%; min-width: 0; }

/* The sweep is decoration; the bar alone already says "not yet". */
@media (prefers-reduced-motion: reduce) {
  .skeleton,
  [data-field]:empty,
  [data-wallet-field]:empty,
  [data-ref-field]:empty,
  [data-roll-field]:empty,
  [data-level-count]:empty,
  [data-level-pill]:empty,
  [data-sold-out]:empty {
    animation: none;
    background: var(--skeleton);
  }
}
