/* ============================================================================
   The Chronicon · Celestial Table.
   Midnight enamel, aged brass and ivory archival paper. Spectral carries the
   folio; IBM Plex Mono is reserved for dates and game measurements.
   Type accents and rarity seals retain their existing, distinct meanings.
   ============================================================================ */

@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/plexmono-400.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/plexmono-600.woff2") format("woff2"); }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/spectral-500.woff2") format("woff2"); }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/spectral-600.woff2") format("woff2"); }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/spectral-400i.woff2") format("woff2"); }

:root {
  --ae-mark: "ae-chronicon-cards-fc942a";
  --bg:      #040d13;
  --bg-2:    #091a22;
  --panel:   #0c2028;
  --ink:     #e8e6d9;
  --bone:    #efeadd;
  --muted:   #a0afb2;
  --muted-2: #c3cfcd;
  --ember:   #ba654a;
  --ember-hot: #e69b76;
  --hair:    rgba(201,173,114,0.3);
  --hair-2:  rgba(201,173,114,0.13);
  --gold:    #d6bb82;
  --paper:   #efeadd;
  --paper-ink: #172b30;
  --paper-muted: #4a5656;
  --paper-image: url("art/world/ivory-paper-768.b9337091.webp");

  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --serif: "Spectral", "Iowan Old Style", Palatino, Georgia, serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --pad: 16px;
}
@media (min-width: 640px) { :root { --pad: 24px; } }
@media (min-width: 1100px) { :root { --pad: 32px; } }

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* beat class display:grid on .grid/.spiral */
html { -webkit-text-size-adjust: 100%; color-scheme: dark; scrollbar-color: #8e805f #091a22; }
body {
  margin: 0;
  min-height: 100%;
  /* viewport-fit=cover claims the notch; give it back on the sides so
     landscape phones don't set content under the camera housing */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--ember-hot); text-decoration: none; cursor: pointer; text-underline-offset: .2em; }
a:hover { text-decoration: underline; }
b { font-weight: 600; }
.nowrap { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--ember-hot); outline-offset: 2px; border-radius: 3px; }
.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; }
.sr-only:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; min-width: 44px; min-height: 44px; clip: auto; padding: .5rem .8rem; background: var(--panel); z-index: 60; }
summary { min-height: 44px; padding-block: 10px; font-size: 14px; cursor: pointer; color: var(--muted-2); }
input, select, textarea { font-size: 16px; caret-color: var(--ember-hot); }
::selection { background: var(--gold); color: var(--bg); }

/* ---------- suite nav ---------- */
.suite {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 72px; gap: 0 8px;
  padding: 5px clamp(16px, 3.6vw, 56px); border-bottom: 1px solid var(--hair);
  font-family: var(--serif); font-size: 16px; background: #040d13;
  --ink: #e8e6d9; --muted-2: #c3cfcd; --ember-hot: #d6bb82;
}
.suite__dot { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; padding: 8px; color: var(--muted-2); }
.suite > .suite__dot { grid-row: 1; align-self: start; }
.suite > .suite__dot:first-child { grid-column: 1; justify-self: start; gap: 20px; font: 500 22px/1 var(--serif); letter-spacing: .27em; text-transform: uppercase; padding-left: 0; color: #efeadd; }
.suite__seal { display: block; flex: none; width: 44px; height: 44px; }
.suite > .suite__dot:nth-child(2) { grid-column: 2; }
.suite__dot:hover { color: var(--ink); text-decoration: none; }
a.brand { display: inline-flex; align-items: center; min-height: 44px; }
.suite__dot.is-current { color: var(--ember-hot); }
.suite__links { display: none; }
.suite__menu { grid-column: 3; grid-row: 1; }
.suite__menu[open] { grid-column: 1 / -1; }
.suite__menu > summary { width: 72px; margin-left: auto; padding: 0 8px; line-height: 44px; list-style-position: inside; }
.suite__menu > div { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-block: 8px; }
@media (min-width: 1100px) {
  .suite { display: flex; align-items: center; padding-block: 4px; }
  .suite > .suite__dot:first-child { margin-right: auto; }
  .suite__links { display: flex; gap: 16px; }
  .suite__menu { display: none; }
}
@media (max-width: 1099px) {
  .suite > .suite__dot:first-child { gap: 10px; font-size: 16px; letter-spacing: .16em; }
  .suite__seal { width: 32px; height: 32px; }
}
@media (max-width: 359px) {
  .suite > .suite__dot:first-child { gap: 8px; font-size: 14px; letter-spacing: .12em; }
  .suite__seal { width: 28px; height: 28px; }
}

/* ---------- masthead ---------- */
.masthead { max-width: 74rem; margin: 0 auto; padding: clamp(1.4rem, 5vw, 3rem) var(--pad) 0; text-align: center; }
.masthead__brand { display: flex; align-items: center; justify-content: center; gap: 0.7rem; }
.brand { font-family: var(--serif); font-weight: 500; letter-spacing: 0.3em; color: var(--muted-2); font-size: 0.85rem; }
.brand:hover { color: var(--bone); text-decoration: none; }
.brand__x { color: inherit; }
.masthead__setcode { font-size: 0.58rem; letter-spacing: 0.24em; color: var(--muted); border: 1px solid var(--hair); border-radius: 999px; padding: 0.15rem 0.6rem; }
.masthead__title {
  font-family: var(--serif); font-weight: 500; letter-spacing: -0.025em;
  font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.04; margin: 0.7rem 0 0;
  color: var(--bone); text-wrap: balance;
}
.masthead__sub { max-width: 46rem; margin: 0.8rem auto 0; color: var(--muted-2); font-size: 0.82rem; }
.masthead__sub b { color: var(--ember-hot); font-weight: 400; }
.masthead--collection { max-width: 82rem; padding-top: 40px; text-align: left; }
.home__browse { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.home__browse > a { display: inline-flex; align-items: center; min-height: 44px; }
.first-move { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 32px; align-items: center; }
.first-move > .card { width: 100%; }
@media (max-width: 639px) {
  .first-move { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .first-move > .card { max-width: 280px; margin-inline: auto; }
}
.masthead--collection .masthead__title { margin: 0; font-size: clamp(36px, 4.5vw, 64px); }
.masthead--collection .masthead__sub { max-width: none; margin: 8px 0; font: 16px/1.5 var(--sans); }
.collection-meta { margin: 0; color: var(--muted); font: 12px/1.5 var(--sans); }
.collection-meta .masthead__setcode { font: inherit; letter-spacing: 0; border: 0; padding: 0; }

/* ---------- toolbar ---------- */
.toolbar {
  max-width: 82rem; margin: 16px auto 0; padding: 0 var(--pad);
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: start;
}
.toolbar__search { flex: 1 1 160px; min-width: 0; }
#search {
  width: 100%; background: var(--bg-2); border: 1px solid var(--hair); border-radius: 8px;
  color: var(--ink); font-family: var(--sans); font-size: 16px; padding: 8px 12px; min-height: 44px;
}
#search::placeholder { color: var(--muted); }
#search:focus { border-color: var(--ember); }
#collectionFilters, #collectionHelp { font-family: var(--sans); }
#collectionFilters[open], #collectionHelp[open] { flex-basis: 100%; }
#collectionHelp { margin-right: auto; }
.collection-filter-body { display: grid; gap: 16px; padding-block: 8px 16px; }
.collection-help-body { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-bottom: 16px; }
.collection-view-label { font-size: 14px; }
.collection-count { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; width: 100%; }
.collection-count .countline { margin: 0; padding: 0; font: 12px/1.5 var(--sans); }
#undiscoveredToggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font: 14px/1.4 var(--sans); cursor: pointer; }
#showUndiscovered { width: 20px; height: 20px; min-height: 20px; margin: 0; accent-color: var(--ember-hot); cursor: pointer; }
.collection { min-height: 400px; padding-top: 16px; }
#collectionLoading { color: var(--muted-2); font-family: var(--sans); }
body:has(#collectionLoading:not([hidden])) .collection-scope p { min-width: 15ch; min-height: 1.6em; }
body:has(#collectionLoading:not([hidden])) .collection-count { min-height: 44px; }
@media (max-width: 338px) {
  body:has(#collectionLoading:not([hidden])) .collection-count { min-height: 70px; }
}
.binder-empty { max-width: 34rem; margin: 16px auto; text-align: center; font-family: var(--sans); }
.binder-empty h2 { font: 600 24px/1.2 var(--serif); margin: 16px 0 8px; }
.binder-empty p { margin: 8px 0 16px; color: var(--muted-2); }
.binder-empty__sleeve { width: 96px; margin: 0 auto; }
.binder-empty__sleeve .card-sleeve__label { display: none; }

.toolbar__filters { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  --accent: var(--gold);
  display: inline-flex; align-items: center; gap: 0.35em;
  font-size: 14px; line-height: 1.4;
  color: var(--muted-2); background: var(--bg-2);
  border: 1px solid var(--hair); border-radius: 999px; padding: 0.28rem 0.6rem;
  cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.chip i { color: var(--accent); font-style: normal; font-size: 0.9em; }
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip.is-on { color: #fff; border-color: var(--accent); background: color-mix(in oklab, var(--accent) 14%, var(--bg-2)); }

.toolbar__right { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--hair); border-radius: 8px; overflow: hidden; max-width: 100%; }
.seg { background: var(--bg-2); color: var(--muted-2); border: 0; font-family: var(--sans); font-size: 14px; line-height: 1.4; padding: 8px 12px; cursor: pointer; min-height: 44px; }
.seg + .seg { border-left: 1px solid var(--hair); }
.seg:hover { color: var(--ink); }
.seg.is-on { background: color-mix(in oklab, var(--ember) 20%, var(--bg-2)); color: #fff; }
.sortwrap { font-size: 14px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 8px; }
#sort { background: var(--bg-2); color: var(--ink); border: 1px solid var(--hair); border-radius: 8px; font-family: var(--sans); font-size: 16px; padding: 8px; }
.btn-rules { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; background: transparent; color: var(--muted-2); border: 1px solid var(--hair); border-radius: 4px; font-family: var(--sans); font-size: 14px; line-height: 1.4; padding: 10px 16px; cursor: pointer; text-decoration: none; transition: background .18s ease, border-color .18s ease, color .18s ease; }
.btn-rules:is(:hover, :focus-visible) { color: var(--bone); border-color: var(--gold); text-decoration: none; }
.btn-rules--big { background: var(--bone); border-color: var(--bone); color: var(--bg); }
.btn-rules--big:is(:hover, :focus-visible) { background: var(--gold); border-color: var(--gold); color: var(--bg); }
.ui-link { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 0; background: none; border: 0; color: var(--muted-2); font: 14px/1.4 var(--sans); text-decoration: underline; text-underline-offset: .2em; cursor: pointer; }
.ui-link:is(:hover, :focus-visible) { color: var(--ember-hot); }
.toolbar :is(button, input, select) { min-height: 44px; }

.countline { max-width: 82rem; margin: 8px auto 0; padding: 0 var(--pad); color: var(--muted); font-size: 12px; }

/* ============================================================================
   THE CARD
   ============================================================================ */
main { max-width: 82rem; margin: 0 auto; padding: 1.2rem var(--pad) 4rem; }
.grid {
  display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 500px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 768px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grid__error { color: var(--muted); font-size: 0.9rem; line-height: 1.6; }
.card--enter { opacity: 0; transform: translateY(10px); }

.card {
  /* First Cycle faces, pinned. The page around the card re-themed to Celestial
     Table; the card itself keeps its approved peat/ember tokens scoped here so
     every surface deals the same deck Alex already made. */
  --bg: #0a0806; --bg-2: #130d09; --panel: #14100b;
  --ink: #ece5d8; --bone: #f2ecdf; --muted: #8a8074; --muted-2: #b3aa9c;
  --ember: #e14b22; --ember-hot: #ff6a33;
  --hair: rgba(236,229,216,0.12); --hair-2: rgba(236,229,216,0.06);
  --gold: #e0be74;
  --accent: var(--gold);
  --foil-rest: 0;
  --foil-max: 0;
  position: relative; aspect-ratio: 5 / 7; width: 100%;
  border-radius: 14px; cursor: pointer;
  transition: transform .25s cubic-bezier(.2,.7,.2,1), opacity .5s ease;
}
.card:focus { outline: none; }
.card:focus-visible { outline: 2px solid var(--ember-hot); outline-offset: 4px; }

/* the frame: hairline + peat panel + type-tinted top edge */
.card__frame {
  position: absolute; inset: 0; border-radius: inherit; overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, color-mix(in oklab, var(--accent) 18%, var(--panel)) 0%, var(--panel) 46%),
    var(--panel);
  border: 1px solid var(--hair);
  box-shadow: 0 14px 34px -20px #000, inset 0 1px 0 rgba(255,255,255,0.04);
  display: flex; flex-direction: column;
  padding: 0.62rem 0.62rem 0.5rem;
}
.card::after { /* accent top rule */
  content: ""; position: absolute; left: 12px; right: 12px; top: 0; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.7;
}

/* head */
.card__head { flex: none; display: flex; align-items: flex-start; gap: 0.4rem; }
.card__no { font-size: 0.54rem; letter-spacing: 0.1em; color: var(--muted); flex: none; padding-top: 0.15rem; font-variant-numeric: tabular-nums; }
.card__title { flex: 1 1 auto; min-width: 0; }
.card__name {
  font-family: var(--serif); font-weight: 600; font-size: clamp(0.82rem, 1.5vw, 1.02rem);
  line-height: 1.05; margin: 0; color: var(--bone);
  letter-spacing: 0.002em; text-wrap: balance;
  /* Reserve the two lines most names take (36 of 58 at desktop width). Head
     height feeds straight into the art window now that the art absorbs all
     variance — without this, a one-line name buys its card a taller hero than
     its neighbours and the row's art strip goes ragged. Not a clamp: six names
     genuinely run to three lines and a card's name is the one thing that must
     never be truncated. */
  min-height: 2.1em;
}
.card__kicker { display: block; font-size: 0.52rem; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-top: 0.2rem; }
.card__type {
  flex: none; display: inline-flex; align-items: center; gap: 0.25em;
  font-size: 0.5rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent); border-radius: 999px;
  padding: 0.16rem 0.4rem; white-space: nowrap;
}
.card__type i { font-style: normal; font-size: 1.15em; line-height: 1; }

/* art window */
.card__art {
  /* The card's one shock absorber. At 5/7 the content runs ~9px over at 1440 and
     ~25px over at 768 (narrower columns, more wrapping). Someone has to pay;
     when flex split the shrink between art and body, the body's share came out
     of live text — first the flavor slicing mid-line, then, once the flavor was
     pinned, the transit sliding under the opaque stats row. The art is the only
     block that degrades gracefully (object-fit: cover crops a few percent), so
     every text sibling is flex: none and the entire deficit lands here. */
  flex: 0 1 auto; min-height: 0;
  position: relative; margin-top: 0.5rem; border-radius: 8px; overflow: hidden;
  aspect-ratio: 4 / 2.7;
  box-shadow: inset 0 0 0 1px var(--hair), inset 0 12px 30px -20px #000;
  background: #0a0806;
}
.card__art canvas,
.card__art-img {
  display: block; width: 100%; height: 100%;
}
/* painted heroes: cover the window + grade into peat/ember suite */
.card__art-img {
  object-fit: cover; object-position: center 40%;
  filter: contrast(1.06) saturate(0.94) brightness(0.96);
}
/* soft vignette so AI stills sit under the rarity chip like procedural art */
.card__art::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 100% at 50% 40%, transparent 42%, rgba(10,8,6,0.42) 100%),
    linear-gradient(180deg, rgba(10,8,6,0.12) 0%, transparent 28%, transparent 62%, rgba(10,8,6,0.35) 100%);
  box-shadow: inset 0 0 0 1px var(--hair);
}
.card--mythic .card__art-img,
.card--legendary .card__art-img {
  filter: contrast(1.08) saturate(1) brightness(1);
}
.card__rarity {
  position: absolute; right: 0.4rem; bottom: 0.4rem;
  z-index: 3;
  font-size: 0.5rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bone); background: rgba(10,8,6,0.6); backdrop-filter: blur(3px);
  border: 1px solid var(--hair); border-radius: 999px; padding: 0.1rem 0.42rem;
  display: inline-flex; align-items: center; gap: 0.3em;
}
.card__rarity .pip { color: var(--metal, var(--muted)); letter-spacing: -0.1em; }

/* The glance ladder. A 1px frame tint is invisible at grid size, so the two
   carriers the eye actually lands on do the work: the art window's rim takes
   the tier's metal, and the chip becomes a foil stamp — outlined in gold for
   rare, struck solid for legendary and mythic. Type never touches either. */
.card--uncommon .card__art { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--metal) 40%, transparent), inset 0 12px 30px -20px #000; }
.card--rare .card__art,
.card--legendary .card__art { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--metal) 68%, transparent), inset 0 12px 30px -20px #000; }
.card--rare .card__rarity { border-color: color-mix(in oklab, var(--metal) 55%, transparent); color: color-mix(in oklab, var(--metal) 60%, var(--bone)); }
.card--legendary .card__rarity, .card--mythic .card__rarity {
  background: var(--metal);
  border-color: transparent; color: #14100b; font-weight: 600;
}
.card--legendary .card__rarity .pip, .card--mythic .card__rarity .pip { color: #14100b; }

/* text box */
.card__body { flex: 1 0 auto; display: flex; flex-direction: column; margin-top: 0.5rem; }
.card__flavor {
  font-family: var(--serif); font-style: italic; font-size: 0.66rem; line-height: 1.35;
  color: var(--muted-2); margin: 0 0 0.4rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  /* Hold exactly the two lines the clamp promises. Left to flex, this box gets
     squeezed to ~1.2 lines by a two-line title and `overflow: hidden` slices the
     second line through its middle instead of ellipsing it. Fixing the height
     also parks the card's slack above .card__transit (margin-top: auto), which
     keeps .card__stats a constant offset off the bottom however the title wraps. */
  flex: none; height: 2.7em;
}
.card__transit {
  margin-top: auto; border-top: 1px solid var(--hair); padding-top: 0.4rem;
  font-size: 0.6rem; line-height: 1.32; color: var(--muted-2);
}
.card__transit-name {
  display: block; font-family: var(--mono); font-weight: 600; font-size: 0.58rem;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.15rem;
}
/* Two lines, not three. At 5/7 the card is ~9px short of holding a two-line
   title, a two-line kicker, the art window, a two-line flavor AND three lines of
   transit: .card__transit spilled past .card__body and .card__stats — opaque and
   later in the flex column — painted over the third line on 18 of 58 cards. The
   ability is never lost: the detail modal renders transit.text unclamped. */
.card__transit-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* stats */
.card__stats {
  flex: none;
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1px; margin-top: 0.5rem;
  background: var(--hair); border-radius: 6px; overflow: hidden; border: 1px solid var(--hair);
}
.stat { background: var(--panel); padding: 0.3rem 0.3rem; text-align: center; }
.stat b { display: block; font-size: 0.86rem; color: var(--bone); font-variant-numeric: tabular-nums; font-weight: 600; line-height: 1; }
.stat span { display: block; font-size: 0.46rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 0.18rem; }
.stat--sev b { color: var(--ember-hot); }
.stat--conf b { font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.04em; padding-top: 0.16rem; }
.card__cite { flex: none; font-size: 0.5rem; color: var(--muted); margin-top: 0.34rem; text-align: center; letter-spacing: 0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card__cite::before { content: "✎ "; color: var(--accent); }

/* Physical finishes: foil belongs to the art and metal edges, never the text.
   Resting finishes remain visible on touch and with reduced motion. */
.card--rare .card__art::before,
.card--legendary .card__art::before,
.card--mythic .card__art::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  mix-blend-mode: screen; background-position: var(--mx, 50%) var(--my, 38%);
}

/* Cosmos foil: irregular discs in the painting, not confetti across the face. */
.card--rare .card__art::before {
  background-image: linear-gradient(115deg, #80a0bd 10%, #d8e4ec 33%, #a89bca 47%, #d8bc87 62%, #89b1b8 78%);
  background-size: 180% 180%; opacity: .48;
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='190' height='170'%3E%3Cg fill='white'%3E%3Ccircle cx='14' cy='23' r='1.4'/%3E%3Ccircle cx='76' cy='12' r='2.5'/%3E%3Ccircle cx='147' cy='39' r='1.8'/%3E%3Ccircle cx='42' cy='79' r='3.2'/%3E%3Ccircle cx='109' cy='63' r='1.1'/%3E%3Ccircle cx='174' cy='98' r='2.6'/%3E%3Ccircle cx='20' cy='145' r='2.1'/%3E%3Ccircle cx='93' cy='132' r='3.7'/%3E%3Ccircle cx='142' cy='158' r='1.2'/%3E%3C/g%3E%3C/svg%3E");
  mask-size: 190px 170px;
}
.card--rare:is(:hover,:focus-within) .card__art::before { opacity: .8; }

/* Secret-style diagonal engraving catches a narrow silver reflection. */
.card--legendary .card__art::before {
  background-image: radial-gradient(ellipse at var(--mx, 50%) var(--my, 38%), #f2edcf 0, #d8c6b688 19%, #9fbbc333 35%, transparent 61%);
  background-size: 100% 100%; opacity: .52;
  mask-image: repeating-linear-gradient(135deg, transparent 0 3px, #000 3.2px 3.6px, transparent 3.8px 6px);
}
.card--legendary:is(:hover,:focus-within) .card__art::before { opacity: .72; }
.card--legendary .card__art::after {
  background: linear-gradient(115deg, transparent 25%, #eee6ca44 42%, #fff8e97a 45%, transparent 49%);
  background-size: 240% 180%; background-position: var(--mx, 50%) var(--my, 38%);
  mix-blend-mode: screen;
}

/* Authored filaments and rings carry the Mythic finish, not image brightness.
   A CSS pearlescent base remains when GPU enhancement is unavailable. */
.card--mythic .card__art::before {
  background-image: linear-gradient(115deg, #8bc9e2 8%, #ecd5a8 24%, #dfb4e7 38%, #c7f0e0 50%, #f4e7ad 64%, #b9b1ee 78%, #b7e5ed 92%),
    repeating-radial-gradient(ellipse at 35% 45%, #fff8 0 1px, transparent 1.6px 4px);
  background-blend-mode: screen; background-size: 180% 180%, 100% 100%;
  mask-size: cover; mask-position: center 40%; mask-repeat: no-repeat; opacity: .78;
}
.card__material { position: absolute; inset: 0; z-index: 1; opacity: 0; pointer-events: none; }
.card[data-material="ready"] .card__material { opacity: 1; }

/* One fixed metal per rarity. Type retains its own independent accent. */
.card--common { --metal: #a49c8e; }
.card--uncommon { --metal: #b9c4cc; }
.card--rare { --metal: #c3cde0; }
.card--legendary { --metal: #e7c67d; }
.card--mythic { --metal: #e0def4; }

.card--uncommon .card__frame {
  border-color: #8d969e;
  box-shadow: 0 14px 34px -20px #000, inset 0 0 0 1px #b9c4cc38;
  background: linear-gradient(125deg, #b9c4cc18, transparent 36%, #b9c4cc0a 65%, transparent), var(--panel);
}
/* Type accents, mirroring the values build-cards.mjs writes onto every card.
   They live in the stylesheet rather than a style attribute because the CSP
   (style-src 'self') refuses inline styles, and the binder is prerendered into
   index.html. tools/prerender.mjs fails if these drift from the data. */
.card--astronomical, .chip[data-key="astronomical"] { --accent: #e0be74; }
.card--mudflood,     .chip[data-key="mudflood"]     { --accent: #7f9fb2; }
.card--volcanic,     .chip[data-key="volcanic"]     { --accent: #ff6a33; }
.card--red-fallout,  .chip[data-key="red-fallout"]  { --accent: #d0472b; }
.card--vanishing,    .chip[data-key="vanishing"]    { --accent: #a790c4; }
.card--plague,       .chip[data-key="plague"]       { --accent: #9aa26a; }
.card--war-reset,    .chip[data-key="war-reset"]    { --accent: #c6ad8e; }
.card--displacement, .chip[data-key="displacement"] { --accent: #9fb7e6; }
.card--intruder,     .chip[data-key="intruder"]     { --accent: #ff6a33; }

/* Broad gold and prismatic edges distinguish the top tiers at ordinary size.
   No coloured glow outside the physical card. */
.card--rare .card__frame {
  border-color: #8c9baa;
  box-shadow: 0 14px 34px -20px #000, inset 0 0 0 1px #b9c4cc40;
}
.card--legendary .card__frame {
  border-color: #c6a15c;
  box-shadow: 0 18px 44px -18px #000, inset 0 0 0 2px #e7c67d66;
  background: radial-gradient(ellipse at 12% 0, #75603c44, transparent 60%), var(--panel);
}
.card--mythic .card__frame {
  border-color: #d9d9e3;
  box-shadow: 0 18px 44px -18px #000, inset 0 0 0 2px #e0def478;
  background: radial-gradient(ellipse at 15% 0, #a6a0d22b, transparent 60%), var(--panel);
}
.card--legendary::after, .card--mythic::after {
  inset: 0; height: auto; border-radius: inherit; padding: 2px; pointer-events: none; opacity: 1;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
.card--legendary::after {
  background: linear-gradient(125deg, #795120, #f0d895 24%, #aa7b36 46%, #ebcf8c 68%, #72502a);
}
.card--mythic::after {
  padding: 3px;
  background: linear-gradient(125deg, #c9e8ec, #d9bfe8 20%, #f3e6b2 36%, #b6e5d9 52%, #c4c0ed 68%, #f2d3af 85%, #b8e1ed);
  background-size: 180% 180%; background-position: var(--mx, 50%) var(--my, 38%);
}
.card--legendary .card__name { color: #f3dfac; }
.card--mythic .card__name { color: #fff; }

/* ============================================================================
   SPIRAL VIEW
   ============================================================================ */
.spiralview { display: flex; flex-direction: column-reverse; align-items: center; }
.spiral { position: relative; width: min(88vmin, 700px); aspect-ratio: 1; margin: 0.4rem auto 2rem; }
.spiral canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.spiral__nodes { position: absolute; inset: 0; }
.spiral__node {
  position: absolute; transform: translate(-50%, -50%);
  width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: color-mix(in oklab, var(--accent) 60%, var(--panel));
  border: 1px solid var(--accent); cursor: pointer;
  box-shadow: 0 0 0 3px rgba(10,8,6,0.6);
  transition: transform .15s, box-shadow .2s;
}
.spiral__node:hover, .spiral__node:focus-visible { transform: translate(-50%, -50%) scale(1.5); box-shadow: 0 0 14px 2px var(--accent); z-index: 5; outline: none; }
.spiral__node[data-now="1"] { background: var(--ember-hot); border-color: #fff; box-shadow: 0 0 14px 3px var(--ember); }
.spiral__node .spoke-lab { position: absolute; left: 50%; top: -1.3rem; transform: translateX(-50%); font-size: 0.5rem; color: var(--muted-2); white-space: nowrap; opacity: 0; transition: opacity .15s; pointer-events: none; }
.spiral__node:hover .spoke-lab, .spiral__node:focus-visible .spoke-lab { opacity: 1; }
.spiral__hint { text-align: center; color: var(--muted); font-size: 0.66rem; max-width: 34rem; margin: 0.5rem auto 0; }
/* .spiralview is column-reverse, so in the DOM this sits between the hint and
   the clock and renders under the clock, above the hint. */
.spiral__legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 0.9rem; max-width: 34rem; margin: 0.7rem auto 0; }
.spiral__legend-item { display: inline-flex; align-items: center; gap: 0.34rem; font-size: 0.54rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.spiral__legend-dot {
  width: 0.5rem; height: 0.5rem; border-radius: 50%; flex: none;
  background: color-mix(in oklab, var(--accent) 60%, var(--panel));
  border: 1px solid var(--accent);
}
.spiral__legend-item.is-now .spiral__legend-dot { background: var(--ember-hot); border-color: #fff; box-shadow: 0 0 6px 1px var(--ember); }

/* ============================================================================
   MODAL (detail + rules)
   ============================================================================ */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: clamp(0.8rem, 3vw, 2rem); }
.modal[hidden] { display: none; }
.modal__scrim { position: absolute; inset: 0; background: rgba(4,3,2,0.78); animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.modal__panel {
  position: relative; z-index: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 24px;
  max-width: 60rem; width: 100%; max-height: calc(100dvh - 32px);
  background: linear-gradient(180deg, var(--bg-2), var(--bg));
  border: 1px solid var(--hair); border-radius: 16px; padding: 16px;
  overflow: auto; animation: rise .3s cubic-bezier(.2,.7,.2,1);
}
.modal__close { position: sticky; top: 0; grid-column: 1 / -1; justify-self: end; display: block; margin-left: auto; z-index: 6; background: var(--bg-2); color: var(--muted-2); border: 1px solid var(--hair); border-radius: 8px; width: 44px; height: 44px; cursor: pointer; font-size: 16px; }
.modal__close:hover { color: var(--ink); border-color: var(--muted); }
.modal__stage { display: grid; place-items: center; align-content: start; perspective: 1200px; min-width: 0; }
.modal__stage > .bigcard, .modal__stage > canvas { grid-row: 1; grid-column: 1; }
.card-view-controls { grid-row: 2; display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
.card-view-controls .btn-rules { min-height: 44px; font-size: 14px; letter-spacing: 0; padding-inline: 8px; }
.modal__read { min-width: 0; }

/* the big flippable card in the modal */
.bigcard, .modal__stage canvas.card3d { width: min(34vw, 320px, calc((100dvh - 112px) * 63 / 88)); aspect-ratio: 63 / 88; }
.bigcard { transform-style: preserve-3d; transition: transform .7s cubic-bezier(.2,.8,.2,1); cursor: pointer; }
.bigcard.is-flipped { transform: rotateY(180deg); }
.bigcard__face { position: absolute; inset: 0; backface-visibility: hidden; }
.bigcard__face--back { transform: rotateY(180deg); }
.flip-hint { grid-row: 3; max-width: 320px; text-align: center; font-size: 12px; line-height: 1.5; color: var(--muted-2); margin-top: 0.7rem; }

/* the WebGL inspect view (card3d.js) — same footprint as .bigcard, print-face aspect */
.modal__stage canvas.card3d { display: block; border-radius: 14px; cursor: grab; touch-action: none; opacity: 0; transition: opacity .3s ease; }
.modal__stage canvas.card3d.is-live { opacity: 1; }
.modal__stage canvas.card3d:active { cursor: grabbing; }
.modal__stage canvas.card3d:focus-visible { outline: 2px solid var(--accent, #ff6a33); outline-offset: 4px; }


/* the read-column beside the big card */
.read__eyebrow { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.read__name { font-family: var(--serif); font-weight: 600; font-size: clamp(1.3rem, 4vw, 2rem); line-height: 1.05; margin: 0.3rem 0 0.2rem; color: var(--bone); }
.read__kicker { color: var(--muted); font-size: 14px; letter-spacing: 0.02em; }
.read__flavor { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--muted-2); margin: 16px 0; }
.read__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(5rem, 1fr)); gap: 1px; background: var(--hair); border: 1px solid var(--hair); border-radius: 8px; overflow: hidden; margin: 0.8rem 0; }
.read__cell { background: var(--panel); padding: 0.55rem 0.5rem; text-align: center; }
.read__cell b { display: block; font-size: 1.2rem; color: var(--bone); font-variant-numeric: tabular-nums; }
.read__cell.sev b { color: var(--ember-hot); }
.read__cell span { display: block; font-size: 12px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.read__cell.conf b { font-size: 14px; text-transform: uppercase; padding-top: 4px; }
.read__transit { border-left: 2px solid var(--accent); padding: 0.2rem 0 0.2rem 0.7rem; margin: 0.8rem 0; }
.read__transit h3 { margin: 0 0 8px; font-size: 14px; letter-spacing: 0.02em; text-transform: uppercase; color: var(--accent); }
.read__transit p { margin: 0; font: 16px/1.6 var(--sans); color: var(--muted-2); }
.read__world { margin: 0.9rem 0 0; padding: 0; list-style: none; }
.read__world li { font: 16px/1.6 var(--sans); color: var(--muted-2); padding: 8px 0 8px 16px; border-top: 1px solid var(--hair-2); position: relative; }
.read__world li::before { content: "·"; position: absolute; left: 0.2rem; color: var(--accent); }
.read__src { margin-top: 16px; font-size: 14px; color: var(--muted); }
.read__src b { color: var(--muted-2); font-weight: 400; }

/* ---------- attestation: the open question on a Partial spoke ----------
   A Partial card is the Chronicon logging a return nobody's surviving account
   describes. The styling treats that as an invitation, not an error: the panel
   is quiet and dashed — an outline waiting to be filled — while a strengthened
   record is drawn solid, in the gold the set reserves for what the sky did. */
.attest { margin-top: 1rem; padding: 0.85rem 0.95rem; border-radius: 8px; }
.attest h3 { margin: 0 0 0.35rem; font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; font-family: var(--mono); font-weight: 400; }
.attest--open { border: 1px dashed var(--hair); background: color-mix(in oklab, var(--bone) 3%, transparent); }
.attest--open h4 { color: var(--muted-2); }
.attest--open p { margin: 0 0 0.7rem; font-size: 0.72rem; line-height: 1.55; color: var(--muted); }
.attest__cta {
  display: inline-block; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ember-hot); border: 1px solid var(--ember);
  border-radius: 8px; padding: 0.42rem 0.8rem;
}
.attest__cta:hover { background: color-mix(in oklab, var(--ember) 16%, transparent); }
.attest__note { display: block; margin-top: 0.5rem; font-size: 0.58rem; color: var(--muted); }
.attest--held { border: 1px solid var(--hair); background: color-mix(in oklab, var(--gold) 5%, transparent); }
.attest--held h4 { color: var(--gold); }
.attest--held ul { margin: 0; padding: 0; list-style: none; }
.attest--held li { font-size: 0.7rem; color: var(--muted-2); padding: 0.26rem 0 0.26rem 0.9rem; position: relative; }
.attest--held li::before { content: "·"; position: absolute; left: 0.16rem; color: var(--gold); }
.attest__by { color: var(--muted); font-size: 0.92em; }
.attest__pending { margin: 0.6rem 0 0; font-size: 0.62rem; color: var(--muted); font-style: italic; }

/* the call to arms in the toolbar — dormant until it is switched on */
.chip--partial { --accent: var(--muted-2); }
.chip--partial.is-on { --accent: var(--gold); color: #fff; border-color: var(--gold); background: color-mix(in oklab, var(--gold) 14%, var(--bg-2)); }

/* ---------- rules sheet ---------- */
.modal__panel--sheet { max-width: 52rem; display: block; }
.modal__panel--sheet > .modal__close { margin-bottom: 8px; }
.rules h2 { font-family: var(--serif); font-weight: 600; font-size: clamp(1.4rem, 4vw, 2.1rem); margin: 0 0 0.2rem; color: var(--bone); }
.rules .lede { color: var(--muted-2); font-size: 16px; margin: 0 0 24px; max-width: 40rem; }
.rules h3 { font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ember-hot); margin: 24px 0 8px; }
.rules p, .rules li { font-size: 16px; line-height: 1.7; color: var(--muted-2); }
.rules ol, .rules ul { margin: 0.3rem 0; padding-left: 1.2rem; }
.rules li { margin: 0.3rem 0; }
.rules b { color: var(--ink); }
.rules .typekey { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.5rem; margin: 0.6rem 0; }
.rules .typekey > div { --accent: var(--gold); display: flex; gap: 0.5rem; align-items: baseline; font-size: 0.72rem; border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--hair)); border-radius: 8px; padding: 0.5rem 0.6rem; }
.rules .typekey i { font-style: normal; font-size: 1.1rem; line-height: 1; color: var(--accent); }
.rules .typekey b { display: block; color: var(--ink); }
.rules__note { margin-top: 24px; font-size: 14px; line-height: 1.6; color: var(--muted); }

.modal--guide .modal__panel { max-width: 1000px; }
.modal--guide h2 { font: 600 clamp(1.4rem, 4vw, 2rem)/1.2 var(--serif); padding-right: 32px; margin: 0 0 12px; color: var(--bone); }
.modal--guide p { font: 15px/1.5 var(--sans); color: var(--muted-2); }
.modal--guide video { display: block; width: 100%; aspect-ratio: 8 / 5; background: #000; margin-block: 16px; }
.modal--guide video[hidden] { display: none; }
.modal--guide video::cue { font-size: clamp(12px, 2vw, 28px); }
.guide-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.guide-tabs .btn-rules, .guide-chapters .btn-rules { min-height: 44px; font-size: 14px; letter-spacing: 0; text-align: left; white-space: normal; }
.guide-tabs [aria-pressed="true"] { color: var(--bone); border-color: var(--gold); }
.guide-chapters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); list-style: none; padding: 0; gap: 8px; margin-block: 16px; }
.guide-chapters button { width: 100%; }
#guideTranscript h3 { font: 600 18px/1.4 var(--serif); color: var(--bone); margin-top: 24px; }

.colophon { max-width: 76rem; margin: 0 auto; padding: 32px var(--pad) 40px; border-top: 1px solid var(--hair); text-align: center; }
.colophon p { color: var(--muted); font: 12px/1.8 var(--sans); }
.colophon a { display: inline-flex; align-items: center; min-height: 44px; }

/* 404 */
.nf { min-height: 80svh; display: grid; place-items: center; text-align: center; padding: 4rem 2rem; background: linear-gradient(#040d13aa, #040d13e8), url("art/world/celestial-table-1536.69d2354e.webp") center / cover; max-width: none; }
.nf__code { display: inline-block; }
.nf .masthead__title { margin-top: 1rem; }
.nf__back { display: inline-flex; align-items: center; min-height: 44px; margin-top: 24px; font-family: var(--mono); letter-spacing: 0.04em; text-transform: uppercase; font-size: 14px; }

/* ============================================================================
   RESPONSIVE / MOTION
   ============================================================================ */
@media (max-width: 640px) {
  .masthead__setcode { font-size: 12px; }
  .card__no { font-size: 0.6rem; }
  .card__kicker { font-size: 0.6rem; }
  /* the card frame's print furniture: on a phone the card runs 328px wide —
     larger than the physical object — so the furniture can afford ~9.3px
     where the print design uses the equivalent of 6pt */
  .card__type { font-size: 0.58rem; }
  .card__rarity { font-size: 0.58rem; }
  .card__transit-name { font-size: 0.6rem; }
  .stat span { font-size: 0.54rem; }
  .card__cite { font-size: 0.56rem; }
}
@media (max-width: 767px) {
  .modal__panel { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) and (orientation: portrait) {
  .bigcard, .modal__stage canvas.card3d { width: min(70vw, 260px); }
}
@media (pointer: coarse) {
  .chip { padding-block: 0.42rem; }
  .brand { display: inline-block; padding-block: 0.3rem; }
  .nf__back { padding: 0.6rem 0.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.08s !important; }
  .card { transform: none !important; }
}
.card--physical { aspect-ratio: 63 / 88; border-radius: 2.2% / 1.6%; overflow: hidden; background: #14100b; box-shadow: 0 12px 24px -12px #000; }
.card--physical::after { content: none; }
.card__print { display: block; width: 100%; height: 100%; object-fit: contain; }
.card--physical .card__material { width: 100%; height: 100%; filter: none; border-radius: inherit; }


/* the cycles — hidden until the edition actually has more than one */
#seriesFilter[hidden] { display: none !important; }
#seriesFilter .seg.is-on { background: color-mix(in oklab, var(--gold) 22%, var(--bg-2)); color: #fff; }

/* ---------- arrival: The Deal ---------- */
/* One ~1.9s ritual at the door: the clock turns, today's card rises face-up,
   the deck deals into the binder. The grid's layout never changes — the whole
   ritual is transforms and a fixed overlay, so CLS is 0 by construction.
   arrival.js drives the timeline with body classes and inline transforms;
   everything here is presentation for those states. */
#arrival {
  position: fixed; inset: 0; z-index: 70; pointer-events: none;
  background: radial-gradient(120% 90% at 50% -10%, rgba(26,17,9,0.97), rgba(6,4,3,0.955) 55%);
  opacity: 1; transition: opacity 0.55s ease;
}
#arrival.is-lifting { opacity: 0; }
/* the face-down deck: card backs stacked under the day card, sized by JS */
.arrival__back {
  position: absolute; transform: translate(-50%, -50%); border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
/* while the ritual runs: no pointer interaction with cards
   so the material system cannot fight the choreography. The day card sits above the
   overlay. Transformed cards already form stacking contexts, so z-index binds. */
body.arrival-active .card { pointer-events: none; }
body.arrival-active .card[data-day-card] { z-index: 72; }
body.arrival-active .card[data-day-card] { transition: box-shadow 0.4s ease; }
body.arrival-active .card[data-day-card].is-lit {
  box-shadow: 0 0 46px 8px rgba(255,106,51,0.34), 0 0 12px 1px rgba(255,106,51,0.4);
}
/* the face-down cover injected over the day card's frame; removed at the flip's
   edge-on midpoint, which is what sells the turn without true 3D backfaces */
.arrival__cover {
  position: absolute; inset: 0; z-index: 9; border-radius: inherit;
  overflow: hidden;
}
/* deal phase: transforms transition home; each card carries its own stagger */
body.arrival-deal .card { transition: transform 0.65s cubic-bezier(0.2, 0.7, 0.2, 1); transition-delay: var(--deal-delay, 0s); }
body.arrival-deal .card[data-day-card] { transition-delay: 0s; }
/* the title is present from the first paint but held low until the turn */
body.arrival-active .masthead { opacity: 0.28; transition: opacity 0.6s ease; }
body.arrival-active.arrival-titled .masthead { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  /* no movement at all: the overlay crossfades, the day card is ringed, done.
     arrival.js also branches and never writes transforms under this query. */
  body.arrival-active .card, body.arrival-deal .card { transition: none; }
  #arrival { transition: opacity 0.5s ease; }
}

/* ============================================================================
   CARD IDENTITY — rarity you can read before anything moves
   One physical card, 63:88, drawn by card-view.js on every surface: the hand
   you play from, the collection, the inspector, the link preview and the print
   front. Rarity is carried three ways at once — a word, a seal and a frame —
   so it survives greyscale, a phone and prefers-reduced-motion. It is never a
   draw chance: every card in the set is dealt from the same deck.
   ========================================================================= */
.card { aspect-ratio: 63/88; }

/* the seal: original geometry, one shape per tier */
.card__rarity { display: inline-flex; align-items: center; gap: 0.32rem; }
.card__seal { width: 13px; height: 13px; flex: none; color: var(--metal, var(--muted)); }
.card__rarity-word { font-family: var(--mono); letter-spacing: 0.1em; }
.card--legendary .card__seal, .card--mythic .card__seal { color: #14100b; }

/* common — one straight frame and nothing else. Quiet, never cheap. */
.card--common .card__frame { border-color: color-mix(in oklab, var(--bone) 16%, var(--hair)); }

/* uncommon — a double rule and two clipped upper corners */
.card--uncommon .card__frame { clip-path: polygon(11px 0, calc(100% - 11px) 0, 100% 11px, 100% 100%, 0 100%, 0 11px); }
.card--uncommon .card__art { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--bone) 22%, transparent); }

/* rare — a stepped frame and paired brackets on the leading corners */
.card--rare .card__frame::before, .card--rare .card__frame::after {
  content: ""; position: absolute; width: 13px; height: 13px;
  border: 1.4px solid color-mix(in oklab, var(--metal) 70%, transparent); opacity: 0.9;
}
.card--rare .card__frame::before { top: 7px; left: 7px; border-right: 0; border-bottom: 0; }
.card--rare .card__frame::after { top: 7px; right: 7px; border-left: 0; border-bottom: 0; }

/* mythic — a continuous orbit frame, unmistakable across a room */
.card--mythic .card__frame { outline: 1px solid color-mix(in oklab, var(--metal) 55%, transparent); outline-offset: -6px; }

/* ---------- the inspector's native <dialog> ---------- */
dialog.modal {
  border: 0; padding: 16px; margin: auto;
  width: 100%; max-width: 100vw; max-height: 100dvh;
  background: transparent; color: var(--ink); overflow: hidden;
}
dialog.modal::backdrop { background: rgba(4,3,2,0.8); }
dialog.modal:not([open]) { display: none; }
dialog.modal .modal__panel { margin: auto; }
.bigcard__flip { margin-top: 0.9rem; }
.read__chron { margin-top: 1rem; }
.read__chron h3 { font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ember-hot); margin: 0 0 8px; }
.read__chron p { color: var(--muted-2); font: 16px/1.7 var(--sans); margin: 0; }
.read__note { margin-top: 16px; font: 14px/1.6 var(--sans); color: var(--muted); border-left: 2px solid var(--hair); padding-left: 12px; }
.read__note b { color: var(--muted-2); font-weight: 600; }

/* Celestial Table: an illustrated instrument, live cards, then a quiet folio. */
.home { max-width: none; margin: 0; padding: 0; }
.home__open { position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0, 38fr) minmax(0, 62fr); gap: 16px; min-height: 690px; padding: 30px clamp(24px, 3.6vw, 56px) 48px; overflow: clip; }
.home__scene { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; z-index: -1; pointer-events: none; }
.home__say { position: relative; z-index: 2; align-self: start; min-width: 0; }
.home__title { margin: 12px 0 0; font: 500 clamp(44px, 4.6vw, 68px)/.88 var(--serif); letter-spacing: -.04em; text-transform: uppercase; color: var(--bone); }
.home__title > span { display: block; }
.home__sub { display: flex; align-items: center; gap: 20px; margin: 20px 0 0; font: 500 clamp(15px, 1.4vw, 22px)/1.4 var(--serif); letter-spacing: .28em; text-transform: uppercase; color: var(--bone); }
.home__sub::after { content: ""; width: 56px; height: 1px; background: var(--gold); }
.home__lede { font: 500 clamp(18px, 1.55vw, 24px)/1.4 var(--serif); color: var(--bone); margin: 22px 0 0; max-width: 36ch; }
.home__blurb { font: 500 16px/1.55 var(--serif); color: var(--muted-2); margin: 8px 0 0; max-width: 43ch; }
.home__acts { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; margin: 24px 0 0; }
.home .btn-rules { min-height: 50px; padding: 12px 24px; font: 500 17px/1.4 var(--serif); }
.home__learn { display: inline-flex; align-items: center; min-height: 44px; color: var(--muted-2); font-size: 17px; text-decoration: underline; }
.home__acts .btn-rules--big::after { content: ""; width: 24px; height: 14px; margin-left: 20px; background: currentColor; clip-path: polygon(0 45%, 83% 45%, 62% 6%, 68% 0, 100% 50%, 68% 100%, 62% 94%, 83% 55%, 0 55%); }
.home__today { font: 12px/1.65 var(--mono); color: var(--muted-2); margin: 14px 0 0; max-width: 45ch; min-height: 3.3em; width: fit-content; padding: 4px 8px; background: #040d13e8; border-radius: 3px; }
.home__resume { margin: 4px 0 0; min-height: 44px; }
.home__resume[hidden] { display: block !important; visibility: hidden; }
.home__edition { font-family: var(--serif); font-size: 15px; color: var(--bone); text-shadow: 0 2px 6px #040d13; }
.home__showcase { position: relative; align-self: center; min-width: 0; padding-top: 20px; }
.home__tableau { position: relative; height: min(37vw, 570px); }
.home__tableau .card { width: 100%; }
.card-preview { display: block; color: inherit; text-decoration: none; cursor: pointer; min-width: 0; }
.card-preview:hover { text-decoration: none; }
.home__tableau > .card-preview { position: absolute; width: 35%; filter: drop-shadow(0 18px 14px #0009); }
.home__tableau > .card-preview:nth-child(1) { left: 33%; top: 0; z-index: 3; transform: rotate(7deg); }
.home__tableau > .card-preview:nth-child(2) { left: 3%; top: 88px; z-index: 2; transform: rotate(-10deg); }
.home__tableau > .card-preview:nth-child(3) { right: -2%; top: 90px; z-index: 1; transform: rotate(12deg); }
.card-preview:focus-visible { outline: 2px solid var(--gold); outline-offset: 6px; border-radius: 14px; }
.home__reference { position: relative; z-index: 4; display: flex; width: fit-content; min-height: 44px; align-items: center; margin-left: auto; padding-inline: 12px; font-size: 14px; color: var(--bone); text-decoration: underline; cursor: pointer; background: #040d13c9; border-radius: 4px; }
.home__carousel-controls { display: none; gap: 12px; }
.home__band { padding: 40px clamp(24px, 3.6vw, 56px); background: var(--paper) var(--paper-image) center / 768px; color: var(--paper-ink); --bone: #172b30; --ink: #172b30; --muted: #4a5656; --muted-2: #3c4c4f; --gold: #735626; --ember-hot: #82472f; --hair: #c5bea9; }
.home__band + .home__band { border-top: 1px solid #c5bea9; }
.home__facts { margin: 0 0 8px; font: 500 15px/1.5 var(--serif); color: var(--paper-ink); }
.home__h { font: 500 clamp(32px, 3.65vw, 56px)/1.1 var(--serif); letter-spacing: -.025em; color: var(--bone); margin: 0 0 24px; }
.home__note { font: 16px/1.7 var(--sans); color: var(--muted-2); max-width: 68ch; margin: 0 0 24px; }
.home__three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px; }
.home__three article + article { border-left: 1px solid #c5bea9; padding-left: 40px; }
.home__diagram { width: 100%; max-width: 360px; height: 80px; color: var(--paper-ink); margin-bottom: 12px; }
.home__three h3 { font: 500 26px/1.2 var(--serif); color: var(--bone); margin: 0 0 12px; }
.home__three p { font: 15px/1.7 var(--sans); color: var(--muted-2); margin: 0; max-width: 43ch; }
.home__rarity { display: flex; flex-wrap: wrap; gap: 20px 40px; padding-block: 8px; }
.home__rarity > span { display: inline-flex; align-items: center; gap: 12px; color: var(--gold); font-size: 18px; }
.home__rarity .card__seal { width: 28px; height: 28px; color: currentColor; }
.home__adaptation { max-width: 68ch; }
.home__band--source { display: grid; grid-template-columns: 1fr 1fr; column-gap: 64px; }
.home__band--source .home__h { grid-row: span 3; max-width: 12ch; }
.home__band--source .home__acts { grid-column: 2; margin-top: 0; }
@media (min-width: 1700px) {
  .home__open { padding-inline: max(56px, calc((100vw - 1536px) / 2)); }
}
@media (max-width: 1199px) and (min-width: 960px) {
  .home__open { grid-template-columns: 40fr 60fr; min-height: 650px; }
  .home__lede, .home__blurb { max-width: 30ch; }
  .home__acts { flex-direction: column; align-items: flex-start; }
  .home__tableau > .card-preview { width: 41%; }
  .home__tableau > .card-preview:nth-child(1) { left: 28%; }
  .home__tableau > .card-preview:nth-child(2) { left: 5%; }
  .home__tableau > .card-preview:nth-child(3) { right: -4%; }
}
@media (max-width: 959px) {
  .home__open { grid-template-columns: 1fr; padding-top: 24px; gap: 8px; min-height: 0; }
  .home__scene { object-position: 65% bottom; opacity: .8; }
  .home__say { max-width: 620px; }
  .home__title { font-size: clamp(40px, 8.5vw, 68px); }
  .home__say::before { content: ""; position: absolute; inset: -24px -24px -8px; background: #040d13e8; z-index: -1; }
  .home__resume { min-height: 0; }
  .home__resume[hidden] { display: none !important; }
  .home__showcase { padding-top: 24px; }
  .home__tableau { display: flex; gap: 12px; height: auto; overflow-x: auto; padding: 12px 8px 24px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
  .home__tableau > .card-preview { position: relative; flex: 0 0 280px; width: 280px; inset: auto; transform: none; scroll-snap-align: start; }
  .home__tableau > .card-preview:nth-child(n) { inset: auto; transform: none; }
  .home__carousel-controls { display: flex; }
  .home__reference { margin-top: -46px; }
  .home__three { gap: 24px; }
  .home__three article + article { padding-left: 24px; }
}
@media (max-width: 639px) {
  .home__open { padding-inline: 20px; padding-bottom: 28px; }
  .home__sub { letter-spacing: .2em; }
  .home__acts { gap: 8px 20px; }
  .home__today { font-size: 11px; }
  .home__tableau > .card-preview { flex-basis: min(78vw, 300px); width: min(78vw, 300px); }
  .home__reference { margin: 8px 0 0; padding-inline: 0; background: none; }
  .home__band { padding: 32px 24px; }
  .home__three, .home__band--source { grid-template-columns: 1fr; gap: 28px; }
  .home__three article + article { padding: 24px 0 0; border-left: 0; border-top: 1px solid #c5bea9; }
  .home__band--source .home__h { grid-row: auto; margin-bottom: 0; max-width: none; }
  .home__band--source .home__acts { grid-column: auto; }
  .home__diagram { height: 65px; }
}

/* ============================================================================
   THE RULEBOOK — one page, generated from the engine
   Long-form reading, so the page leaves the mono house voice behind for the
   body text and keeps it for the headings and the numbers.
   ========================================================================= */
body:has(.rulebook) {
  --bg: #efeadd; --bg-2: #e6e0ce; --panel: #e8e2d2;
  --ink: #172b30; --bone: #172b30; --muted: #586365; --muted-2: #364b50;
  --gold: #735626; --ember: #82472f; --ember-hot: #82472f;
  --hair: #c5bea9; --hair-2: #d4ccb7;
  background: var(--paper) var(--paper-image) center / 768px; color-scheme: light;
}
.rulebook { font-family: var(--sans); max-width: calc(72ch + 2 * var(--pad)); margin: 0 auto; padding: 56px var(--pad) 64px; }
.rulebook__head { border-bottom: 1px solid var(--hair); padding-bottom: 24px; margin-bottom: 24px; }
.rulebook__lede { font-family: var(--sans); font-size: 1.05rem; line-height: 1.65; color: var(--muted-2); margin: 1rem 0 0; }
.rulebook__acts { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.4rem 0 0; }
.rulebook__acts .btn-rules { min-height: 44px; display: inline-flex; align-items: center; text-decoration: none; }
.rulebook__contents { margin-top: 24px; }
.rulebook__toc ol { margin: 0; padding-left: 24px; columns: 2; column-gap: 32px; }
.rulebook__toc li { font-family: var(--mono); font-size: 14px; break-inside: avoid; }
.rulebook__toc a { display: inline-flex; align-items: center; min-height: 44px; }
.rulebook__sec { margin-bottom: 40px; scroll-margin-top: 24px; }
.rulebook__sec h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(1.6rem, 3vw, 2.2rem); color: var(--bone); margin: 0 0 1rem; }
.rulebook__sec p { font-family: var(--sans); font-size: 1rem; line-height: 1.7; color: var(--muted-2); margin: 0 0 0.8rem; max-width: 44rem; }
.rulebook__note { font-family: var(--sans); font-size: 0.9rem; line-height: 1.7; color: var(--muted); border-top: 1px solid var(--hair); padding-top: 1.4rem; }

/* the five seals, said once, where the collection is browsed */
.raritykey { display: flex; flex-wrap: wrap; gap: 0.5rem 1.1rem; max-width: 78rem; margin: 0.4rem auto 0; padding: 0 var(--pad); }
.raritykey span { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.raritykey .card__seal { width: 14px; height: 14px; }
.raritykey .r-common { color: var(--muted); }
.raritykey .r-uncommon { color: color-mix(in oklab, var(--bone) 70%, var(--muted)); }
.raritykey .r-rare { color: var(--gold); }
.raritykey .r-legendary { color: color-mix(in oklab, var(--ember-hot) 42%, var(--gold)); }
.raritykey .r-mythic { color: color-mix(in oklab, #fff 62%, var(--ember-hot)); }

/* ============================================================================
   THE COST OF 82 CARDS ON A PHONE
   The collection paints every card in the set. Two things made that expensive
   enough to fail a performance budget: a backdrop-filter on every rarity tag
   (82 separate blur passes) and full layout for cards nobody has scrolled to.
   ========================================================================= */
.card__rarity { backdrop-filter: none; background: rgba(10, 8, 6, 0.78); }
.grid > .card, .grid > .binder-slot { width: 100%; max-width: 300px; justify-self: center; }
.grid .card { content-visibility: auto; contain-intrinsic-size: auto 420px; }
.binder-slot { content-visibility: auto; cursor: pointer; border-radius: 14px; }
.binder-slot:focus-visible { outline: 2px solid var(--ember-hot); outline-offset: 4px; }
.card-sleeve { width: 100%; color: var(--muted-2); }
.card-sleeve .card__print { height: auto; aspect-ratio: 63 / 88; border-radius: 2.2% / 1.6%; }
.card-sleeve__label { display: block; font: 12px/1.6 var(--mono); text-align: center; padding: 8px; }
.collection-scope { width: 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
.collection-scope p { margin: 0; color: var(--muted-2); font-size: 12px; }
.collection-scope .segmented { flex-wrap: nowrap; }
.collection-scope .seg { min-height: 44px; font-size: 14px; white-space: normal; }
.source-reference { max-width: 80rem; margin: 1rem auto; padding: 0 var(--pad); }
.source-reference summary { min-height: 44px; cursor: pointer; color: var(--gold); }
.source-reference article { max-width: 72ch; padding: 1.5rem 0; border-bottom: 1px solid var(--hair); }
.source-reference article h2 { font: 600 1.4rem/1.3 var(--serif); }
.source-reference article p { font-size: 14px; }
