/* Components (PLAN.md §3.5, WP1 row). WP1 owns this file; page packages use these classes and never redefine them.
   .btn (--primary --ghost --quiet --sm --lg --icon) · .chip (--live, --scarcity[data-level]) · .field (__label __hint
   __error) · .input .textarea .select · .counter-ring · .seg · .sheet (on <dialog>) · .toast · .digits · .countdown ·
   .meter · .panel · .swatch · .wordmark · .icon
   Motion (§3.6): only transform, opacity and filter animate. Hover tints are an opacity layer, presses scale to .97
   in --dur-1 and release on --ease-spring. Reduced motion and Calm mode (<html data-calm>) are mirrored at the end.
   On a .themed surface the brand tokens are remapped to the theme palette (themes.css), so every component here
   follows a light or dark theme without page CSS; elsewhere the semantic tokens follow the site's light or dark scheme
   (tokens.css). The toast stays night in both schemes. */

/* ── Icon ──────────────────────────────────────────────────────────────────────────────────────────── */
.icon { display: inline-block; flex: none; vertical-align: middle; overflow: visible; color: inherit; }

/* ── Button ────────────────────────────────────────────────────────────────────────────────────────── */
.btn {
  --btn-bg: color-mix(in srgb, var(--text) 6%, transparent);
  --btn-fg: var(--text);
  --btn-bd: var(--line);
  --btn-h: 48px;
  --btn-px: 22px;
  position: relative;
  isolation: isolate;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  min-height: var(--btn-h);
  min-width: var(--btn-h);
  padding: 0 var(--btn-px);
  border: 1px solid var(--btn-bd);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 1rem/1.1 var(--font-ui);
  letter-spacing: .005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  transition: transform var(--dur-3) var(--ease-spring);
}
.btn::before {                       /* hover / press tint: an opacity layer, never a colour transition */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
}
.btn:hover { text-decoration: none; }
.btn:hover::before { opacity: .08; }
.btn:active { transform: scale(.97); transition: transform var(--dur-1) var(--ease-out); }
.btn:active::before { opacity: .14; }
.btn:focus-visible { outline: 2px solid var(--focus, var(--candle)); outline-offset: 3px; }
.btn :is(.icon, svg) { margin-inline: -.1em; }

.btn--primary {
  --btn-bg: var(--cta, var(--candle));
  --btn-fg: var(--cta-text, var(--night-900));
  --btn-bd: transparent;
  font-weight: 700;
  box-shadow: 0 1px 0 rgb(255 255 255 / .35) inset, 0 10px 30px -12px color-mix(in srgb, var(--btn-bg) 70%, transparent);
}
.btn--primary:hover::before { opacity: .12; background: #fff; }
.btn--primary:active::before { opacity: .1; background: #000; }
.btn--ghost { --btn-bg: transparent; --btn-bd: color-mix(in srgb, var(--text) 28%, transparent); }
.btn--quiet { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: color-mix(in srgb, var(--text-2) 70%, var(--text)); }
.btn--quiet:hover { color: var(--text); }
.btn--sm { --btn-h: 36px; --btn-px: 14px; font-size: .875rem; gap: .4em; }
.btn--lg { --btn-h: 60px; --btn-px: 30px; font-size: 1.125rem; letter-spacing: -.005em; }
.btn--icon { --btn-px: 0; width: var(--btn-h); }
.btn--icon.btn--sm { width: var(--btn-h); }

/* Hero CTA sheen (§3.3: one sweep every 6 s): large primary buttons only. */
.btn--primary.btn--lg::after {
  content: "";
  position: absolute;
  inset: -20% auto -20% 0;
  width: 45%;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 0%, rgb(255 255 255 / .1) 30%, rgb(255 246 214 / .7) 50%, rgb(255 255 255 / .1) 70%, transparent 100%);
  transform: translateX(-130%) skewX(-12deg);
  animation: btn-sheen 6s var(--ease-io) 1.2s infinite;
}
@keyframes btn-sheen {
  0% { transform: translateX(-130%) skewX(-12deg); }
  18%, 100% { transform: translateX(330%) skewX(-12deg); }
}

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .42;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn:disabled::before, .btn[aria-disabled="true"]::before, .btn:disabled::after { opacity: 0; animation: none; }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] > :not(.btn__spinner) { opacity: .55; }

/* ── Chip ──────────────────────────────────────────────────────────────────────────────────────────── */
.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .5em;
  min-height: 30px;
  padding: 0 .95em;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface-2) 65%, transparent);
  color: var(--text-2);
  font: 700 .75rem/1 var(--font-ui);
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
/* Selectable chips: <label class="chip"><input type="radio|checkbox">…</label> or <button class="chip" aria-pressed>. */
.chip > input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
:is(label, button).chip {
  min-height: 40px;
  padding: 0 1.05em;
  font-size: .875rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  isolation: isolate;
  overflow: hidden;
  transition: transform var(--dur-3) var(--ease-spring);
}
:is(label, button).chip::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--dur-2) var(--ease-out);
}
:is(label, button).chip:hover::after { opacity: .08; }
:is(label, button).chip:active { transform: scale(.97); transition: transform var(--dur-1) var(--ease-out); }
.chip:has(> input:checked), .chip[aria-pressed="true"], .chip[aria-checked="true"] {
  border-color: transparent;
  background: var(--cta, var(--candle));
  color: var(--cta-text, var(--night-900));
}
.chip:has(> input:focus-visible) { outline: 2px solid var(--focus, var(--candle)); outline-offset: 3px; }
.chip:has(> input:disabled), .chip:disabled { opacity: .42; cursor: not-allowed; }

.chip--live {
  border-color: transparent;
  background: linear-gradient(120deg, #E0246A, #DD2E50);          /* white on both ends is 4.5:1 or better (12 px text) */
  color: #fff;
  box-shadow: 0 0 0 1px rgb(255 61 139 / .35), 0 6px 22px -8px rgb(255 61 139 / .8);
}
.chip--live::before {
  content: "";
  width: .62em;
  height: .62em;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 .2em rgb(255 255 255 / .28);
  animation: chip-live 1.6s var(--ease-io) infinite;
}
@keyframes chip-live { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.78); } }

.chip--scarcity { --lvl: var(--success); color: var(--lvl); border-color: color-mix(in srgb, var(--lvl) 38%, transparent);
  background: color-mix(in srgb, var(--lvl) 10%, transparent); }
.chip--scarcity::before { content: ""; width: .55em; height: .55em; border-radius: 50%; background: currentColor; }
.chip--scarcity[data-level="filling"] { --lvl: var(--accent-ink); }
.chip--scarcity[data-level="almost"] { --lvl: var(--danger); }
.chip--scarcity[data-level="almost"]::before { animation: chip-live 1.2s var(--ease-io) infinite; }
.chip--scarcity[data-level="full"] { --lvl: var(--text-3); text-decoration: line-through; text-decoration-thickness: 1px; }
.chip--scarcity[data-level="full"]::before { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }

/* ── Form fields ───────────────────────────────────────────────────────────────────────────────────── */
.field { display: grid; gap: 8px; min-width: 0; }
.field__label { color: var(--text); font: 600 .9375rem/1.3 var(--font-ui); }
.field__label small, .field__optional { color: var(--text-3); font-weight: 500; }
.field__hint { color: var(--text-3); font-size: var(--step-small); line-height: 1.45; }
.field__error {
  --err: var(--danger-text, #FF9D85);
  display: flex;
  align-items: flex-start;
  gap: .45em;
  color: var(--err);
  font: 600 var(--step-small)/1.4 var(--font-ui);
}
.field__error::before {
  content: "!";
  flex: none;
  display: grid;
  place-items: center;
  width: 1.3em;
  height: 1.3em;
  margin-top: .02em;
  border-radius: 50%;
  background: var(--err);
  color: var(--bg);
  font-size: .8em;
  font-weight: 800;
}
.field__error:empty { display: none; }

.input, .textarea, .select {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--text) var(--field-mix), transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text);
  font: 400 1.0625rem/1.45 var(--font-ui);
  box-shadow: 0 1px 0 rgb(255 255 255 / .03) inset;
  appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: .85; }
.input:hover, .textarea:hover, .select:hover { border-color: color-mix(in srgb, var(--text) var(--field-mix-hover), transparent); }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible {
  outline: 2px solid var(--focus, var(--candle));
  outline-offset: 1px;
  border-color: transparent;
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent);
}
.input:disabled, .textarea:disabled, .select:disabled { opacity: .5; cursor: not-allowed; }
.textarea { min-height: 128px; resize: vertical; }
.select {
  padding-inline-end: 44px;
  background-image: var(--chevron-light, url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A9A3C9' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"));
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  cursor: pointer;
}
[dir="rtl"] .select { background-position: left 14px center; padding-inline: 16px 44px; }

/* ── Counter ring: <span class="counter-ring" style="--p:.42" data-state="ok|warn|max"><span>162</span></span> ─ */
.counter-ring {
  --ring: var(--text-3);
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  color: var(--text-2);
  font: 700 .6875rem/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.counter-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--ring) calc(min(1, max(0, var(--p, 0))) * 1turn), color-mix(in srgb, var(--text) 14%, transparent) 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
}
.counter-ring[data-state="warn"] { --ring: var(--candle); color: var(--candle); }
.counter-ring[data-state="max"] { --ring: var(--coral); color: var(--coral); animation: ring-wiggle 420ms var(--ease-out); }
@keyframes ring-wiggle {
  0%, 100% { transform: rotate(0); } 20% { transform: rotate(-10deg); } 40% { transform: rotate(8deg); }
  60% { transform: rotate(-5deg); } 80% { transform: rotate(3deg); }
}

/* ── Segmented radios: <div class="seg" role="radiogroup"><label><input type="radio">Sealed</label>…</div> ── */
.seg {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  max-width: 100%;
}
.seg > label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45em;
  min-height: 40px;
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  color: var(--text-2);
  font: 600 .9375rem/1.15 var(--font-ui);
  text-align: center;                  /* long labels wrap instead of pushing the control past a 320 px screen */
  cursor: pointer;
  isolation: isolate;
  transition: transform var(--dur-3) var(--ease-spring);
}
.seg > label::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--text);
  opacity: 0;
  transform: scale(.92);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out);
}
.seg > label:hover::before { opacity: .07; transform: none; }
.seg > label:active { transform: scale(.97); transition-duration: var(--dur-1); }
.seg > label > input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.seg > label:has(> input:checked) { color: var(--bg); }
.seg > label:has(> input:checked)::before { opacity: 1; transform: none; }
.seg > label:has(> input:focus-visible) { outline: 2px solid var(--focus, var(--candle)); outline-offset: 2px; }
.seg > label:has(> input:disabled) { opacity: .45; cursor: not-allowed; }

/* ── Sheet (on <dialog>): a bottom sheet on phones, a centred panel from 640 px ─────────────────────── */
.sheet {
  width: min(560px, 100% - 32px);
  max-height: min(88dvh, 820px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 70%, var(--surface)), var(--surface));
  color: var(--text);
  box-shadow: 0 40px 120px -30px rgb(var(--shadow-rgb) / calc(.8 * var(--shadow-a))), 0 0 0 1px rgb(255 255 255 / .04) inset;
  overflow: auto;
  overscroll-behavior: contain;
}
/* A sheet that is not built from .sheet__header / .sheet__body (those pad themselves; /g's report sheet pads its own form)
   gets one padding, with room for the home indicator: the booking dialogs put their title and text straight in. */
.sheet:not(:has(> .sheet__header, > .sheet__body, > .g-sheet__body)) {
  padding: var(--space-5) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom));
}
.sheet::backdrop { background: rgb(7 6 26 / calc(.68 * var(--scrim-a, 1))); backdrop-filter: blur(6px); }   /* an old ::backdrop inherits nothing: 1 */
.sheet[open] { animation: sheet-in var(--dur-3) var(--ease-out); }
.sheet[open]::backdrop { animation: fade-in var(--dur-3) var(--ease-out); }
.sheet__header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-5) var(--space-3);
  background: inherit;
}
.sheet__title { font: 700 1.375rem/1.15 var(--font-display); letter-spacing: -.01em; }
.sheet__body { padding: var(--space-2) var(--space-5) var(--space-5); display: grid; gap: var(--space-4); }
.sheet__actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5) calc(var(--space-5) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: inherit;
}
/* The share sheet (client/lib/share.ts, used by /g and the Ticket): the link and its Copy button on one row, then the channels */
.sheet__close { font-size: 1.5rem; line-height: 1; }
.sheet--share .share-link { display: flex; gap: var(--space-3); }
.sheet--share .share-link .input { flex: 1 1 auto; min-width: 0; }
.sheet--share .share-link .btn { flex: none; }
.sheet--share .share-channels { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.sheet--share .sheet__body { padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom)); }
.sheet__status { min-height: 1.4em; margin: 0; font-size: .9375rem; color: var(--text-2); }
.sheet__status:empty { display: none; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 639.98px) {
  .sheet {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: 28px 28px 0 0;
    border-bottom: 0;
  }
  .sheet::before {                   /* grabber */
    content: "";
    display: block;
    width: 40px;
    height: 5px;
    margin: 10px auto 0;
    border-radius: 3px;
    background: color-mix(in srgb, var(--text) 26%, transparent);
  }
  .sheet:not(:has(> .sheet__header, > .sheet__body, > .g-sheet__body)) { padding-block-start: 0; }
  .sheet:not(:has(> .sheet__header, > .sheet__body, > .g-sheet__body))::before { margin-block-end: var(--space-4); }   /* air between the grabber and the title */
  .sheet[open] { animation: sheet-up var(--dur-3) var(--ease-out); }
  .sheet__actions > .btn { flex: 1 1 auto; }
}

/* ── Toast: <div class="toast" role="status" data-tone="success|error|info">Copied</div> ─────────────── */
.toast {
  position: fixed;
  inset-inline: 0;
  bottom: calc(var(--space-6) + env(safe-area-inset-bottom));
  z-index: var(--z-toast);
  width: max-content;
  max-width: calc(100% - 2 * var(--gutter));
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: .6em;
  padding: 12px 20px;
  border: 1px solid rgb(255 255 255 / .1);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--night-950) 88%, var(--violet));
  color: var(--ink);
  font: 600 .9375rem/1.3 var(--font-ui);
  box-shadow: 0 20px 50px -16px rgb(0 0 0 / .7);
  animation: toast-in var(--dur-3) var(--ease-spring);
}
.toast::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--volt); }
.toast[data-tone="success"]::before { background: var(--lime); }
.toast[data-tone="error"]::before { background: var(--coral); }
.toast[data-state="leaving"] { opacity: 0; transform: translateY(8px); transition: opacity var(--dur-2), transform var(--dur-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }

/* ── Digits (§3.2: each digit in its own .62em box) and the countdown ───────────────────────────────── */
.digits { display: inline-flex; font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.digits__d { display: inline-block; width: .62em; text-align: center; }
.countdown {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .2em .45em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.countdown__label { color: var(--text-2); font-weight: 600; margin-inline-end: .1em; }
.countdown__parts { display: inline-flex; align-items: baseline; gap: .38em; }
.countdown__part { display: inline-flex; align-items: baseline; gap: .06em; font-weight: 700; }
.countdown__unit { color: var(--text-3); font-size: .72em; font-weight: 600; }
.countdown[data-days="0"] .countdown__part[data-unit="d"] { display: none; }
/* Until countdown.ts (or the server, given `now`) has set data-days the countdown is invisible but keeps its space: it
   cannot show a "d" tile that is about to disappear, so a countdown under 24 h never shifts sideways on load. */
.countdown:not([data-days]) { visibility: hidden; }
.countdown[data-days] { animation: countdown-in var(--dur-2) var(--ease-out) backwards; }
@keyframes countdown-in { from { opacity: 0; } }
.countdown[data-done] .countdown__parts { opacity: .55; }

/* A large tiled countdown: wrap a Countdown in .countdown-hero (sealed page, landing). */
.countdown-hero { container-type: inline-size; }
.countdown-hero .countdown { gap: var(--space-3); justify-content: center; }
.countdown-hero .countdown__label { flex-basis: 100%; text-align: center; font: 700 .8125rem/1 var(--font-ui);
  letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); }
.countdown-hero .countdown__parts { gap: clamp(6px, 1.4vw, 14px); }
.countdown-hero .countdown__part {
  position: relative;
  flex-direction: column;
  align-items: center;
  gap: .5em;
  min-width: 2.4em;
  padding: .32em .3em .5em;
  border: 1px solid var(--line);
  border-radius: .28em;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 90%, transparent) 0 50%, color-mix(in srgb, var(--surface) 90%, transparent) 50%);
  box-shadow: 0 1px 0 rgb(255 255 255 / .06) inset, 0 12px 30px -16px rgb(var(--shadow-rgb) / calc(.7 * var(--shadow-a)));
  font: 700 clamp(1.25rem, 6.6cqi, 4rem)/1 var(--font-display);   /* 4 tiles always fit their container */
  font-stretch: 80%;
}
.countdown-hero .countdown__unit { font: 700 max(10px, .3em)/1 var(--font-ui); letter-spacing: .16em; text-transform: uppercase; }

/* ── Odometer (odometer.ts): .odo > .odo__col > .odo__strip (0–9) ───────────────────────────────────── */
.odo { display: inline-flex; font-variant-numeric: tabular-nums lining-nums; line-height: 1; white-space: nowrap; }
.odo__col { position: relative; display: inline-block; width: .62em; height: 1em; overflow: hidden; text-align: center; }
.odo__strip { position: absolute; inset: 0 0 auto; display: flex; flex-direction: column; will-change: transform; }
.odo__strip > span { display: block; height: 1em; }
.odo__sep { display: inline-block; width: .3em; text-align: center; }

/* ── Meter: <span class="meter" data-level="filling" style="--v:.62"></span> (--v = 0..1 filled) ─────── */
.meter {
  --lvl: var(--lime);
  position: relative;
  display: block;
  height: 6px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text) 12%, transparent);
  overflow: hidden;
}
.meter::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--lvl) 70%, transparent), var(--lvl));
  transform-origin: left center;
  transform: scaleX(min(1, max(0, var(--v, 0))));
  transition: transform var(--dur-4) var(--ease-out);
}
[dir="rtl"] .meter::before { transform-origin: right center; }
.meter[data-level="filling"] { --lvl: var(--candle); }
.meter[data-level="almost"] { --lvl: var(--coral); }
.meter[data-level="full"] { --lvl: var(--text-3); }

/* ── Panel ─────────────────────────────────────────────────────────────────────────────────────────── */
.panel {
  position: relative;
  padding: clamp(var(--space-4), 3vw, var(--space-6));
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background:
    radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--text) 5%, transparent), transparent 60%),
    color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: 0 1px 0 rgb(255 255 255 / .05) inset, var(--shadow-1);
}

/* ── Theme swatch: radio + 80×60 mini card (ThemeSwatch.tsx) ────────────────────────────────────────── */
.swatch {
  position: relative;
  display: inline-grid;
  justify-items: center;
  gap: 8px;
  width: 92px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.swatch__input { position: absolute; top: 0; left: 50%; width: 1px; height: 1px; margin: 0; opacity: 0; }
.swatch__card {
  position: relative;
  display: grid;
  place-items: center;
  width: 80px;
  height: 60px;
  overflow: hidden;
  border-radius: 14px;
  container-type: size;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--edge) 16%, transparent), 0 8px 18px -10px rgb(var(--shadow-rgb) / calc(.8 * var(--shadow-a)));
  transition: transform var(--dur-3) var(--ease-spring);
}
.swatch:hover .swatch__card { transform: translateY(-3px); }
.swatch:active .swatch__card { transform: scale(.96); transition: transform var(--dur-1) var(--ease-out); }
.swatch__input:checked + .swatch__card {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4.5px var(--cta, var(--candle)), 0 10px 22px -10px rgb(var(--shadow-rgb) / calc(.8 * var(--shadow-a)));
}
.swatch__input:checked + .swatch__card::after {
  content: "";
  position: absolute;
  top: 5px;
  inset-inline-start: 5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cta, var(--candle)) url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B0A1A' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><path d='M20 6 9 17l-5-5'/></svg>") center / 11px no-repeat;
  box-shadow: 0 2px 6px rgb(0 0 0 / .35);
}
.swatch__input:focus-visible + .swatch__card { outline: 2px solid var(--focus, var(--candle)); outline-offset: 5px; }
.swatch__img { display: block; width: 100%; height: 100%; object-fit: cover; }   /* the baked card (ThemeSwatch.tsx): the card's own box holds the corners, ring and shadow */
.swatch__aa {
  position: relative;
  z-index: 1;
  color: var(--t-text);
  font-family: var(--t-font-name);
  font-weight: var(--t-name-weight);
  font-style: var(--t-name-style);
  font-stretch: var(--t-name-stretch);
  font-size: 27px;
  line-height: 1;
  letter-spacing: -.01em;
}
.swatch__dots { position: absolute; z-index: 1; bottom: 6px; inset-inline-end: 6px; display: flex; gap: 3px; }
.swatch__dots > i { width: 7px; height: 7px; border-radius: 50%; box-shadow: 0 0 0 1px rgb(0 0 0 / .12); }
.swatch__pop {
  /* a popular theme (ThemeSwatch popularRank): a solid candle pill on the card's top-end corner, as the checked tick sits on the top-start one.
     The candle and night are fixed colours, so the pill reads the same on every theme's card; it is decoration (the card is aria-hidden,
     the label says it in words). Sized to leave the tick's 5 + 18 px alone. */
  position: absolute;
  z-index: 2;
  top: 5px;
  inset-inline-end: 5px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--candle);
  color: var(--night-900);
  font: 700 9px/1.15 var(--font-ui);
  letter-spacing: .01em;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgb(0 0 0 / .35);
}
.swatch__name { color: var(--text-2); font: 600 .8125rem/1.2 var(--font-ui); text-align: center; }
.swatch__input:checked ~ .swatch__name { color: var(--text); }

/* ── Wordmark (Wordmark.tsx): the letters are one inline SVG in currentColor, the dot is the candle flame (§3.1), an
   HTML element laid over the artwork in percentages of it. --wm-size is the font-size the lockup replaces: it stands
   0.9 × that tall. A page may still size it by height (`.x .wordmark svg { height: 22px }`: the width follows the
   artwork's ratio and the flame follows the artwork). The flame is a gradient clipped by a mask (no SVG ids, so the
   markup never changes between renders) and animates on the compositor. ───────────────────────────────────────── */
.wordmark {
  --wm-size: 2.5rem;
  display: inline-flex;
  align-items: center;
  color: var(--text);
  line-height: 0;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
a.wordmark:hover { text-decoration: none; }
.wordmark--sm { --wm-size: 1.625rem; }
.wordmark--md { --wm-size: 2.5rem; }
.wordmark--lg { --wm-size: clamp(3.5rem, 10vw, 7.5rem); }
.wordmark__art { position: relative; display: block; flex: none; }
.wordmark__svg { display: block; width: auto; height: calc(var(--wm-size) * .9); overflow: visible; }
.wordmark__flame { position: absolute; left: 55.581%; top: 21.068%; width: 6.645%; height: 48.409%; pointer-events: none; }
.wordmark__flame::before {            /* glow */
  content: "";
  position: absolute;
  left: -43.75%;
  top: 12.9%;
  width: 187.5%;
  height: 121.1%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgb(255 138 92 / .55), rgb(255 79 139 / .16) 55%, rgb(255 61 139 / 0));
}
.wordmark__flame::after {             /* a wisp of smoke, only seen while the candle is blown out */
  content: "";
  position: absolute;
  left: 29.2%;
  top: 7%;
  width: 41.7%;
  height: 23.4%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--text) 60%, transparent), transparent);
  opacity: 0;
}
.wordmark__flame-body {
  position: absolute;
  inset: 0;
  display: block;
  background: linear-gradient(to top, #FFC94D 0%, #FF7A59 45%, #FF3D8B 100%);
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='2.8 1.2 14.4 25.6'><path d='M10.6 1.2C11.4 6.6 17.2 10.9 17.2 19.6A7.2 7.2 0 0 1 2.8 19.6C2.8 14.2 6 10.6 8 7.4C8.9 9.4 9.4 10.8 9.6 12.4C10.8 9.4 10.9 5 10.6 1.2Z'/></svg>") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='2.8 1.2 14.4 25.6'><path d='M10.6 1.2C11.4 6.6 17.2 10.9 17.2 19.6A7.2 7.2 0 0 1 2.8 19.6C2.8 14.2 6 10.6 8 7.4C8.9 9.4 9.4 10.8 9.6 12.4C10.8 9.4 10.9 5 10.6 1.2Z'/></svg>") center / 100% 100% no-repeat;
  transform-origin: 50% 92%;
}
.wordmark__flame-body::after {        /* hot core */
  content: "";
  position: absolute;
  left: 26.4%;
  top: 46.9%;
  width: 47.2%;
  height: 42.2%;
  background: #FFF3C9;
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='6.6 13.2 6.8 10.8'><path d='M10 13.2C11.6 16 13.4 17.6 13.4 20.6A3.4 3.4 0 0 1 6.6 20.6C6.6 18 8.4 16.2 10 13.2Z'/></svg>") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='6.6 13.2 6.8 10.8'><path d='M10 13.2C11.6 16 13.4 17.6 13.4 20.6A3.4 3.4 0 0 1 6.6 20.6C6.6 18 8.4 16.2 10 13.2Z'/></svg>") center / 100% 100% no-repeat;
}
.wordmark[data-animated] .wordmark__flame-body { animation: wm-flicker 2.8s var(--ease-io) infinite; }
.wordmark[data-animated] .wordmark__flame-body::after { animation: wm-core 2.8s var(--ease-io) infinite; }
.wordmark[data-animated] .wordmark__flame::before { animation: wm-glow 2.8s var(--ease-io) infinite; }
a.wordmark[data-animated]:is(:hover, :focus-visible) .wordmark__flame-body { animation: wm-blow 1.6s var(--ease-out) 1 both; }
a.wordmark[data-animated]:is(:hover, :focus-visible) .wordmark__flame::before { animation: wm-glow-out 1.6s var(--ease-out) 1 both; }
a.wordmark[data-animated]:is(:hover, :focus-visible) .wordmark__flame::after { animation: wm-smoke 1.6s var(--ease-out) 1 both; }
@keyframes wm-flicker {
  0%, 100% { transform: scale(1, 1) rotate(0deg); }
  18% { transform: scale(1.03, .96) rotate(-2.5deg); }
  37% { transform: scale(.97, 1.06) rotate(1.5deg); }
  55% { transform: scale(1.02, .98) rotate(-1deg); }
  76% { transform: scale(.98, 1.04) rotate(2deg); }
}
@keyframes wm-core { 0%, 100% { opacity: .95; } 30% { opacity: .7; } 60% { opacity: 1; } 80% { opacity: .8; } }
@keyframes wm-glow { 0%, 100% { opacity: 1; } 30% { opacity: .72; } 60% { opacity: 1; } 80% { opacity: .84; } }
/* hover: blows out (lean, shrink, vanish), stays out, relights at 900 ms with a small pop */
@keyframes wm-blow {
  0% { transform: none; opacity: 1; }
  10% { transform: rotate(-24deg) scale(.9, .7); opacity: .9; }
  18% { transform: rotate(-32deg) scale(.2, .3); opacity: 0; }
  56% { transform: scale(.1); opacity: 0; }
  64% { transform: scale(.55, .8); opacity: 1; }
  76% { transform: scale(1.12, 1.08); opacity: 1; }
  100% { transform: none; opacity: 1; }
}
@keyframes wm-glow-out { 0% { opacity: 1; } 14% { opacity: 0; } 56% { opacity: 0; } 70% { opacity: 1; } 100% { opacity: 1; } }
@keyframes wm-smoke {
  0%, 12% { opacity: 0; transform: translate(0, 0) scale(.6); }
  22% { opacity: .55; transform: translate(-6%, -12%) scale(1); }
  52% { opacity: 0; transform: translate(-30%, -60%) scale(2.2); }
  100% { opacity: 0; }
}

/* ── Reduced motion and Calm mode (§3.6): no loops, no sheen, no springs ─────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .btn, .btn:active, :is(label, button).chip, .seg > label, .swatch__card { transition: none; }
  .btn:active, :is(label, button).chip:active, .seg > label:active, .swatch:active .swatch__card, .swatch:hover .swatch__card { transform: none; }
  .btn--primary.btn--lg::after { display: none; }
  .chip--live::before, .chip--scarcity::before, .counter-ring[data-state="max"],
  .wordmark__flame-body, .wordmark__flame-body::after, .wordmark__flame::before, .wordmark__flame::after { animation: none !important; }
  .sheet[open], .sheet[open]::backdrop, .toast { animation: fade-in 250ms linear; }
  .meter::before { transition: none; }
}
:root[data-calm] :is(.btn, .btn:active, label.chip, button.chip, .seg > label, .swatch__card) { transition: none; }
:root[data-calm] :is(.btn:active, label.chip:active, button.chip:active, .seg > label:active, .swatch:active .swatch__card, .swatch:hover .swatch__card) { transform: none; }
:root[data-calm] .btn--primary.btn--lg::after { display: none; }
:root[data-calm] .chip--live::before, :root[data-calm] .chip--scarcity::before { animation: none; }
:root[data-calm] :is(.counter-ring[data-state="max"], .wordmark__flame-body),
:root[data-calm] .wordmark__flame-body::after, :root[data-calm] .wordmark__flame::before, :root[data-calm] .wordmark__flame::after { animation: none !important; }
:root[data-calm] :is(.sheet[open], .toast) { animation: fade-in 250ms linear; }
:root[data-calm] .meter::before { transition: none; }

@media (forced-colors: active) {
  canvas[aria-hidden="true"] { display: none; }              /* decorative particle canvases (§3.6) */
  .btn { border-color: ButtonText; }
  .btn--primary { forced-color-adjust: none; background: ButtonText; color: ButtonFace; }
  .chip, .seg, .input, .textarea, .select, .panel, .sheet, .toast { border-color: CanvasText; }
  .seg > label:has(> input:checked) { outline: 2px solid Highlight; }
  .counter-ring::before, .meter::before { forced-color-adjust: none; background: Highlight; }
  .wordmark__flame { forced-color-adjust: none; }       /* the letters follow the system colours; the flame keeps its own */
}
