/* astrobot — vintage-celestial
 * Gold leaf and aged parchment ink on a midnight-vellum ground.
 * Display: IM Fell DW Pica (a revival of 17th-c. Oxford type — inked, woodcut feel).
 * Body: EB Garamond. Data/context: a warm system monospace.
 */

:root {
  --ink:        #0a0c17;   /* midnight vellum ground */
  --ink-raised: #12162a;   /* engraved plate ground */
  --ink-soft:   #181d33;
  --gold:       #c9a24b;   /* leaf gold — primary ink */
  --gold-bright:#e7ce84;   /* gilt highlight */
  --gold-dim:   #8a7536;   /* tarnished gold — rules, hairlines */
  --parchment:  #e9e0cb;   /* aged paper — body text */
  --parchment-dim: #b9b09a;
  --verdigris:  #7fa08a;   /* copper patina — secondary accent */
  --wax:        #9e4636;   /* sealing wax — rare warm accent */
  --clash:      #c17b6b;   /* dusty clash red — friction aspects */

  --frame:      var(--gold-dim);
  --shadow:     0 18px 48px rgba(0, 0, 0, .55);

  --display: "IM Fell DW Pica", Georgia, serif;
  --blackletter: "UnifrakturMaguntia", "IM Fell DW Pica", Georgia, serif;
  --sc:      "IM Fell DW Pica SC", "IM Fell DW Pica", Georgia, serif;
  --body:    "EB Garamond", Georgia, "Times New Roman", serif;
  --mono:    ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;

  --maxw: 1140px;

  /* ---- Type scale ---------------------------------------------------- */
  /* The eyebrow (.82rem) lives in the protected frontispiece — it is the
     only value below this scale and is intentionally not referenced here. */
  --fs-label: 0.9rem;    /* SC/uppercase letter-spaced labels              */
  --fs-sm:    0.95rem;   /* small readable text — hints, notes, captions   */
  --fs-body:  1.125rem;  /* primary body                                   */
  --fs-lg:    1.35rem;   /* secondary headings, card names                 */
  --fs-xl:    1.5rem;    /* card titles, rite-step titles                  */
}

* { box-sizing: border-box; }

/* Text selection in the title gilt. */
::selection { background: var(--gold-bright); color: var(--ink); }
::-moz-selection { background: var(--gold-bright); color: var(--ink); }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--ink);
  color: var(--parchment);
  font-family: var(--body);
  font-size: var(--fs-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* Force monochrome text presentation for astrological glyphs (U+2648–U+2653,
     planets, aspects) instead of color emoji — fits the engraved look. */
  font-variant-emoji: text;
}

/* ---- Starfield ------------------------------------------------------
 * A faint, slow-drifting field of gilt and parchment stars over the
 * midnight-vellum ground. Three parallax layers — their box-shadow star
 * lists are generated in app.js (initStarfield) — drift at different
 * speeds for depth. Each layer loops seamlessly: an ::after pseudo
 * duplicates the same stars one field-height below, and the layer is
 * translated up by exactly one field height. Two ambient nebula glows
 * sit behind, unchanged from the original wash. Whisper, not glare.
 * Sits behind everything (z-index:-1) so the body ground paints first,
 * stars over it, all content above. Honors prefers-reduced-motion. */
.starfield {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(63, 76, 140, .22), transparent 70%),
    radial-gradient(900px 600px at 90% 110%, rgba(127, 160, 138, .1), transparent 70%);
}

/* Each layer is a single 1–3px dot at the origin; the whole field is
   painted with box-shadow (set as --star-shadows in JS). */
.starfield__layer {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--star-size, 1px);
  height: var(--star-size, 1px);
  border-radius: 50%;
  background: transparent;
  box-shadow: var(--star-shadows);
  will-change: transform;
  animation: starfield-drift var(--drift, 160s) linear infinite;
}
/* Seamless loop: identical star set one field-height below. Custom props
   (--star-shadows, --star-size, --field-h) inherit into the pseudo. */
.starfield__layer::after {
  content: "";
  position: absolute;
  top: var(--field-h, 2000px);
  left: 0;
  width: var(--star-size, 1px);
  height: var(--star-size, 1px);
  border-radius: 50%;
  box-shadow: var(--star-shadows);
}

.starfield__layer--sm { --star-size: 1px; --drift: 120s; opacity: .85; }
.starfield__layer--md { --star-size: 2px; --drift: 160s; opacity: .75; }
.starfield__layer--lg {
  --star-size: 3px;
  --drift: 220s;
  opacity: .65;
  filter: drop-shadow(0 0 2px rgba(201, 162, 75, .35)); /* faint gilt halo on the nearest, largest stars */
}

@keyframes starfield-drift {
  from { transform: translateY(0); }
  to   { transform: translateY(calc(-1 * var(--field-h, 2000px))); }
}

/* An occasional, faint shooting star — long gaps, low opacity, diagonal.
   Visible for only a sliver of the cycle so it stays a rare event. */
.starfield__comet {
  position: absolute;
  top: 8%;
  left: -160px;
  width: 150px;
  height: 1px;
  opacity: 0;
  transform: rotate(18deg);
  background: linear-gradient(90deg,
    rgba(231, 206, 132, 0) 0%,
    rgba(201, 162, 75, .35) 65%,
    rgba(233, 224, 203, .8) 100%);
  filter: drop-shadow(0 0 3px rgba(201, 162, 75, .35));
  animation: starfield-comet 23s ease-in infinite;
  animation-delay: 7s;
}

@keyframes starfield-comet {
  0%   { opacity: 0; transform: translate3d(0, 0, 0) rotate(18deg); }
  3%   { opacity: .7; }
  9%   { opacity: .55; }
  12%  { opacity: 0; transform: translate3d(72vw, 40vh, 0) rotate(18deg); }
  100% { opacity: 0; transform: translate3d(72vw, 40vh, 0) rotate(18deg); }
}

@media (prefers-reduced-motion: reduce) {
  /* Static field: no drift, no comet. Stars still render via box-shadow. */
  .starfield__layer { animation: none; will-change: auto; }
  .starfield__comet { display: none; }
}

a { color: var(--gold-bright); text-underline-offset: 3px; }
a:hover { color: var(--parchment); }

/* ---- Engraved plate frame (shared) ---------------------------------- */

.plate-frame {
  position: relative;
  background: var(--ink-raised);
  border: 1px solid var(--frame);
  box-shadow: inset 0 0 0 4px var(--ink-raised), inset 0 0 0 5px rgba(201, 162, 75, .35), var(--shadow);
}
.plate-frame::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(201, 162, 75, .28);
  pointer-events: none;
}

/* ---- Frontispiece --------------------------------------------------- */

.frontispiece {
  max-width: var(--maxw);
  margin: clamp(1.5rem, 4vw, 3rem) auto 0;
  padding: 0 1.25rem;
}
.frontispiece__inner {
  padding: clamp(2rem, 6vw, 4.5rem) clamp(1.25rem, 5vw, 4rem);
  text-align: center;
}

.eyebrow {
  font-family: var(--sc);
  letter-spacing: .26em;
  text-transform: uppercase;
  font-size: .82rem;
  color: var(--gold);
  margin: 0 0 1.4rem;
}

.zodiac-band {
  font-size: clamp(1.1rem, 3.4vw, 1.8rem);
  letter-spacing: .35em;
  color: var(--gold);
  text-indent: .35em;
  opacity: .9;
  margin-bottom: .6rem;
  filter: drop-shadow(0 0 10px rgba(201, 162, 75, .25));
}

.title {
  font-family: var(--blackletter);
  font-weight: 400;
  font-size: clamp(3.8rem, 14vw, 7.6rem);
  line-height: .96;
  margin: .08em 0 .22em;
  color: var(--gold-bright);
  letter-spacing: .03em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .7), 0 0 30px rgba(201, 162, 75, .28);
}

.lede {
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
  font-style: italic;
  color: var(--parchment);
  max-width: 34ch;
  margin: 0 auto 1.8rem;
}

.link-pill {
  display: inline-block;
  font-family: var(--sc);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: var(--fs-label);
  color: var(--gold-bright);
  text-decoration: none;
  padding: .55rem 1.4rem;
  border: 1px solid var(--gold-dim);
}
.link-pill:hover { background: rgba(201, 162, 75, .12); color: var(--gold-bright); }

/* ---- Sections ------------------------------------------------------- */

main { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

.section { margin-top: clamp(3rem, 8vw, 5.5rem); }

.section-head { text-align: center; margin-bottom: 2.2rem; }
.section-mark {
  display: block;
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: .3rem;
}
.section-title {
  font-family: var(--blackletter);
  font-weight: 400;
  font-size: clamp(2.25rem, 6.4vw, 3.5rem);
  letter-spacing: .02em;
  margin: 0 0 .35rem;
  color: var(--gold-bright);
}
.section-blurb {
  margin: 0 auto;
  max-width: 48ch;
  color: var(--parchment-dim);
  font-style: italic;
}

.rule-glyph {
  border: 0;
  height: 1.6rem;
  margin: clamp(3rem, 7vw, 5rem) auto 0;
  max-width: 360px;
  background: none;
  text-align: center;
  position: relative;
}
.rule-glyph::before {
  content: "✶ ☾ ✶";
  letter-spacing: .8em;
  color: var(--gold-dim);
  font-size: 1rem;
}

/* ---- Playground ----------------------------------------------------- */

.playground {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: clamp(1.25rem, 3vw, 2.25rem);
  align-items: start;
}

.controls {
  padding: 1.6rem 1.5rem;
  position: sticky;
  top: 1rem;
}

/* Roll-a-random-identity shortcut */
.roll-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  width: 100%;
  margin: 0 0 1.4rem;
  padding: .7rem 1rem;
  font-family: var(--sc);
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: var(--fs-label);
  color: var(--gold-bright);
  background: rgba(201, 162, 75, .08);
  border: 1px solid var(--gold-dim);
  border-radius: 0;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.roll-button:hover {
  background: rgba(201, 162, 75, .18);
  box-shadow: inset 0 0 0 1px rgba(231, 206, 132, .4), 0 0 18px rgba(201, 162, 75, .2);
}
.roll-button:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.roll-button:active { transform: translateY(1px); }
.roll-button__die { font-size: 1.1rem; line-height: 1; }
.roll-button:hover .roll-button__die { animation: roll-tumble .5s ease; }
@keyframes roll-tumble {
  0% { transform: rotate(0); }
  100% { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .roll-button__die { animation: none !important; }
}

.field-group {
  border: 0;
  border-top: 1px solid rgba(201, 162, 75, .2);
  margin: 0 0 1.2rem;
  padding: 1.1rem 0 0;
}
.field-group:first-of-type { border-top: 0; padding-top: 0; }
.field-group legend {
  font-family: var(--sc);
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: var(--fs-label);
  color: var(--gold);
  padding: 0;
  margin-bottom: .7rem;
}

.field { display: block; margin-bottom: .9rem; }
.field:last-child { margin-bottom: 0; }
.field__label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--parchment-dim);
  margin-bottom: .3rem;
}
.field__label strong { color: var(--gold-bright); font-style: normal; }

.field-row { display: flex; gap: .8rem; }
/* min-width:0 lets number/date inputs shrink below their intrinsic width
   inside the flex row (iOS/Safari otherwise overflows the plate). */
.field-row .field { flex: 1; min-width: 0; margin-bottom: 0; }
.field-row--color { align-items: center; }

input[type="date"],
input[type="time"],
input[type="number"],
input[type="text"],
select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  font-family: var(--body);
  font-size: var(--fs-body);
  color: var(--parchment);
  background: var(--ink);
  border: 1px solid var(--gold-dim);
  border-radius: 0;
  padding: .55rem .65rem;
  color-scheme: dark;
}
input:focus, select:focus {
  outline: 2px solid var(--gold-bright);
  outline-offset: 1px;
  border-color: var(--gold-bright);
}

input[type="color"] {
  width: 56px;
  height: 44px;
  padding: 3px;
  background: var(--ink);
  border: 1px solid var(--gold-dim);
  cursor: pointer;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--gold);
  cursor: pointer;
}

.hint {
  font-size: var(--fs-sm);
  color: var(--parchment-dim);
  font-style: italic;
  margin: .5rem 0 0;
  line-height: 1.35;
}
/* In the color row the hint sits beside the picker — no top margin so it
   centers against the swatch (row uses align-items: center). */
.field-row--color .hint { margin: 0; }

.linklike {
  background: none;
  border: 0;
  padding: 0;
  color: var(--verdigris);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.compat-nomatch {
  margin: .35rem 0 .2rem;
  font-size: var(--fs-sm);
}

/* ---- Readout / plates ----------------------------------------------- */

.readout { display: flex; flex-direction: column; gap: 1.25rem; }

.plate {
  margin: 0;
  padding: 1.4rem;
  text-align: center;
}
.wheel {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
}
.wheel--compact { min-height: 240px; }
.wheel svg { max-width: 100%; height: auto; }

.plate__caption {
  font-family: var(--sc);
  letter-spacing: .08em;
  font-size: var(--fs-label);
  color: var(--gold);
  margin-top: 1rem;
}

.house-note {
  font-size: var(--fs-sm);
  color: var(--parchment-dim);
  font-style: italic;
  text-align: center;
  margin: -.4rem 0 0;
}

.card { padding: 1.3rem 1.4rem; }
.card__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--fs-xl);
  color: var(--gold-bright);
  margin: 0 0 .9rem;
}

.readout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Placements list */
.placement-list { list-style: none; margin: 0; padding: 0; }
.placement {
  display: grid;
  grid-template-columns: 1.6rem 5.5rem 1fr;
  align-items: baseline;
  gap: .5rem;
  padding: .35rem 0;
  border-bottom: 1px dotted rgba(201, 162, 75, .18);
}
.placement:last-child { border-bottom: 0; }
.placement__glyph { font-size: 1.2rem; color: var(--gold); text-align: center; }
.placement__label {
  font-family: var(--sc);
  letter-spacing: .08em;
  font-size: var(--fs-label);
  text-transform: uppercase;
  color: var(--parchment-dim);
}
.placement__value { color: var(--parchment); }
.placement__value em { color: var(--gold); font-style: italic; }
.placement--summary { grid-template-columns: 1.6rem 1fr; }
.placement--summary .placement__label { display: none; }
.placement--summary .placement__value { grid-column: 2; }

/* House-meanings legend */
.house-legend { padding: 0; }
.house-legend__summary {
  font-family: var(--sc);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: var(--fs-label);
  color: var(--gold);
  cursor: pointer;
  padding: 1rem 1.3rem;
  list-style: none;
}
.house-legend__summary::-webkit-details-marker { display: none; }
.house-legend__summary::before {
  content: "\229E";
  color: var(--gold-dim);
  margin-right: .5rem;
}
.house-legend[open] .house-legend__summary::before { content: "\229F"; }
.house-legend__summary:hover { color: var(--gold-bright); }
.house-legend__list {
  list-style: none;
  margin: 0;
  padding: 0 1.3rem 1.2rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .35rem 1.4rem;
  font-size: var(--fs-sm);
  color: var(--parchment-dim);
}
.house-legend__num {
  display: inline-block;
  min-width: 2.4rem;
  font-family: var(--sc);
  letter-spacing: .04em;
  color: var(--gold);
}

/* Color swatch */
.swatch-row { display: flex; align-items: center; gap: .7rem; margin-bottom: 1rem; }
.swatch {
  width: 2.4rem;
  height: 2.4rem;
  flex: none;
  border: 1px solid var(--gold-dim);
  box-shadow: inset 0 0 0 2px var(--ink-raised);
}
.swatch__name {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  color: var(--parchment-dim);
}

/* Mood dials */
/* One grid for all rows: names share a column sized to the longest ("playfulness")
   so nothing overflows into the bars, and the pip gauges align. Content-width. */
.dials {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;   /* name | flexible gap → bars far right */
  align-items: center;
  column-gap: .8rem;
  row-gap: .5rem;
  max-width: 100%;
}
.dial { display: contents; }
.dial__name {
  font-family: var(--sc);
  letter-spacing: .06em;
  font-size: var(--fs-label);
  text-transform: uppercase;
  color: var(--parchment-dim);
}
.dial__gauge { margin: 0; display: flex; gap: .3rem; justify-self: end; }
.pip {
  width: 1.5rem;
  height: .55rem;
  border: 1px solid var(--gold-dim);
  background: transparent;
}
.pip--on { background: var(--gold); box-shadow: 0 0 6px rgba(201, 162, 75, .4); }

/* Context block */
.context .honesty {
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--verdigris);
  border-left: 2px solid var(--verdigris);
  padding-left: .8rem;
  margin: 0 0 1rem;
}
.havoc-toggle {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: var(--fs-sm);
  color: var(--gold);
  cursor: pointer;
  margin: 0 0 .75rem;
  accent-color: var(--gold);
}
.context-block {
  font-family: var(--mono);
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--parchment);
  background: var(--ink);
  border: 1px solid rgba(201, 162, 75, .2);
  padding: 1rem;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
}

/* ---- Make your own (the rite) --------------------------------------- */

/* A vertical ledger of four ordered steps. The numbering is real: the flow
   is a sequence (roll → prompt → paste → result), so the engraved seals carry
   order, not decoration. */
.rite {
  list-style: none;
  counter-reset: rite;
  margin: 0 auto;
  padding: 0;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.rite-step {
  display: grid;
  grid-template-columns: 4.4rem 1fr;
  gap: 1.1rem;
  padding: 1.5rem 1.6rem;
  position: relative;
}
.rite-step[hidden] { display: none; }

/* Connecting hairline between consecutive seals. */
.rite-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: calc(1.6rem + 2.2rem);
  top: 4.6rem;
  bottom: -1.5rem;
  width: 1px;
  background: linear-gradient(to bottom, rgba(201, 162, 75, .45), rgba(201, 162, 75, .08));
}

.rite-step__seal {
  width: 4.4rem;
  height: 4.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, rgba(201, 162, 75, .14), var(--ink) 72%);
  box-shadow: inset 0 0 0 3px var(--ink-raised), 0 0 14px rgba(201, 162, 75, .12);
}
.rite-step__num {
  font-family: var(--sc);
  letter-spacing: .08em;
  font-size: var(--fs-body);
  color: var(--gold-bright);
  line-height: 1;
}
.rite-step__sigil {
  font-size: .9rem;
  color: var(--gold);
  margin-top: .2rem;
  line-height: 1;
}

.rite-step__body { min-width: 0; }
.rite-step__title {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--fs-xl);
  color: var(--gold-bright);
  margin: .15rem 0 .5rem;
}
.rite-step__lead {
  font-size: var(--fs-sm);
  color: var(--parchment-dim);
  margin: 0 0 1.1rem;
}
.rite-step__lead code {
  font-family: var(--mono);
  font-size: 0.9em;
  color: var(--gold);
}

/* Rolled-chart readout inside step I */
.rite-rolled { margin-top: 1.2rem; }
.rite-rolled__born {
  font-family: var(--sc);
  letter-spacing: .04em;
  font-size: var(--fs-label);
  color: var(--gold);
  margin: 0 0 1rem;
}
.rite-rolled__plate { margin-bottom: 1.1rem; }
.rite-rolled .placement-list { margin-bottom: 1.1rem; }

.rite-field-label {
  display: block;
  font-family: var(--sc);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: var(--fs-label);
  color: var(--gold);
  margin-bottom: .5rem;
}

/* Textareas reuse the engraved context-block look but stay editable. */
textarea.rite-textarea {
  display: block;
  width: 100%;
  resize: vertical;
  color-scheme: dark;
}
textarea.rite-textarea:focus {
  outline: 2px solid var(--gold-bright);
  outline-offset: 1px;
  border-color: var(--gold-bright);
}

.rite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-top: .9rem;
}

.ledger-button {
  font-family: var(--sc);
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: var(--fs-label);
  color: var(--gold-bright);
  background: rgba(201, 162, 75, .08);
  border: 1px solid var(--gold-dim);
  border-radius: 0;
  padding: .6rem 1.1rem;
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease, color .15s ease;
}
.ledger-button:hover {
  background: rgba(201, 162, 75, .18);
  box-shadow: inset 0 0 0 1px rgba(231, 206, 132, .4), 0 0 14px rgba(201, 162, 75, .18);
}
.ledger-button:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}
.ledger-button:active { transform: translateY(1px); }
.ledger-button--go {
  background: rgba(201, 162, 75, .16);
  color: var(--ink);
  background-color: var(--gold);
  border-color: var(--gold-bright);
}
.ledger-button--go:hover { background-color: var(--gold-bright); color: var(--ink); }
.ledger-button--ghost {
  background: transparent;
  color: var(--parchment-dim);
}
.ledger-button--ghost:hover { color: var(--wax); box-shadow: none; background: rgba(158, 70, 54, .1); }

.rite-error {
  font-size: var(--fs-sm);
  color: var(--wax);
  font-style: italic;
  border-left: 2px solid var(--wax);
  padding-left: .8rem;
  margin: .9rem 0 0;
}
.rite-error[hidden] { display: none; }

@media (max-width: 560px) {
  .rite-step {
    grid-template-columns: 1fr;
    gap: .8rem;
  }
  .rite-step:not(:last-child)::before { display: none; }
  .rite-step__seal {
    width: 3.4rem;
    height: 3.4rem;
  }
}

/* ---- Gallery -------------------------------------------------------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.gallery-card { padding: 1.4rem; display: flex; flex-direction: column; }
.gallery-card__head { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; }
.gallery-card__glyph {
  font-size: 2.2rem;
  color: var(--gold);
  line-height: 1;
  filter: drop-shadow(0 0 8px rgba(201, 162, 75, .25));
}
.gallery-card__name {
  font-family: var(--display);
  font-weight: 400;
  font-size: var(--fs-lg);
  color: var(--gold-bright);
  margin: 0;
  line-height: 1.1;
}
.gallery-card__model {
  font-family: var(--mono);
  font-size: var(--fs-label);
  color: var(--parchment-dim);
  margin: .15rem 0 0;
}
.plate--compact { margin: 0 0 .9rem; padding: 0; text-align: center; }
.gallery-card__persona { font-style: italic; margin: 0 0 1rem; }
.tarot-line {
  font-family: var(--sc);
  font-size: var(--fs-label);
  letter-spacing: .05em;
  color: var(--verdigris);
  margin: .35rem 0 .7rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .3rem;
}
.tarot-cards {
  display: flex;
  gap: 1.5rem;               /* the pair spans the full width with a clear gap */
  align-items: flex-start;
}
.tarot-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;                   /* each card grows to fill half the row */
  min-width: 0;
}
.tarot-card img {
  display: block;
  width: 100%;
  max-width: 240px;
  height: auto;
  border: 1px solid rgba(201, 162, 75, .65);
  box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.4);
  background: #1a1510;
}
.tarot-plaque {
  width: 100%;
  margin-bottom: .5rem;
  padding: .3rem .4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  border: 1px solid rgba(201, 162, 75, .65);   /* double outline, matching the cards */
  border-radius: 2px;
  background: linear-gradient(180deg, #1b1610, #100d08);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(201, 162, 75, .15), 0 1px 3px rgba(0, 0, 0, .4);
  text-align: center;
}
.tarot-plaque__role {
  font-family: var(--sc);
  font-size: .72rem;            /* small plaque label */
  letter-spacing: .12em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--verdigris);
}
.tarot-plaque__name {
  font-family: var(--sc);
  font-size: var(--fs-label);
  letter-spacing: .02em;
  color: var(--gold-bright);
  line-height: 1.15;
}
.tarot-caption {
  font-family: var(--sc);
  font-size: var(--fs-sm);
  letter-spacing: .05em;
  color: var(--verdigris);
  line-height: 1.3;
}
/* pair stays full-width and flexes on mobile too */
.gallery-card__summary {
  font-size: var(--fs-sm);
  color: var(--gold);
  border-top: 1px dotted rgba(201, 162, 75, .25);
  border-bottom: 1px dotted rgba(201, 162, 75, .25);
  padding: .6rem 0;
  margin: 0 0 1rem;
}
.gallery-card__mood { margin-top: auto; }
.mood-tag {
  display: block;
  font-family: var(--sc);
  letter-spacing: .06em;
  font-size: var(--fs-label);
  text-transform: uppercase;
  color: var(--verdigris);
  margin-bottom: .35rem;
}
.mood-tag:last-of-type { margin-bottom: .7rem; }
.mood-tag--aspect { color: var(--gold); }
.mood-tag__glyph { font-size: 1em; }
.dials--compact { column-gap: .6rem; row-gap: .35rem; }
.dials--compact .pip { width: 1.15rem; height: .5rem; }
.dials--compact .dial__name { font-size: var(--fs-label); }

.gallery-error {
  grid-column: 1 / -1;
  text-align: center;
  font-style: italic;
  color: var(--parchment-dim);
  border: 1px solid var(--gold-dim);
  padding: 2rem;
}
.gallery-error code {
  font-family: var(--mono);
  font-size: .85em;
  color: var(--gold-bright);
}

/* ---- Colophon ------------------------------------------------------- */

.colophon {
  max-width: var(--maxw);
  margin: clamp(3rem, 8vw, 5rem) auto 0;
  padding: 2.5rem 1.25rem 3rem;
  text-align: center;
  border-top: 1px solid rgba(201, 162, 75, .2);
}
.colophon__glyphs {
  display: block;
  font-size: 1.4rem;
  letter-spacing: .5em;
  color: var(--gold);
  text-indent: .5em;
  margin-bottom: .9rem;
}
.colophon p {
  font-size: var(--fs-sm);
  color: var(--parchment-dim);
  font-style: italic;
  max-width: 50ch;
  margin: 0 auto;
}

/* ---- Responsive ----------------------------------------------------- */

@media (max-width: 880px) {
  .playground { grid-template-columns: 1fr; }
  .controls { position: static; }
}

@media (max-width: 560px) {
  body { font-size: 1.05rem; }
  .readout-grid { grid-template-columns: 1fr; }
  .placement { grid-template-columns: 1.5rem 4.8rem 1fr; }
  .gallery-grid { grid-template-columns: 1fr; }
  .plate-frame::after { inset: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Daily horoscope reading line */
.reading-line {
  margin: .7rem 0 0;
  font-family: var(--body);
  font-style: italic;
  font-size: var(--fs-sm);
  color: var(--gold);
  line-height: 1.45;
}

/* Havoc note in How It Works — breathing room above */
.how-havoc { margin-top: 1.75rem; }

/* Mint-Your-Own: best-experience note */
.myo-note {
  max-width: 62ch;
  margin: 0 auto 1.6rem;
  padding: .85rem 1.1rem;
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  background: rgba(201, 162, 75, .06);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
  text-align: center;
  font-size: var(--fs-sm);
  line-height: 1.5;
  color: var(--parchment-dim);
}
.myo-note strong { color: var(--gold-bright); font-weight: 600; }
.myo-note a { color: var(--verdigris); }

/* ---- Compatibility (synastry) --------------------------------------- */

.compat-form {
  max-width: 52ch;
  margin: 0 auto;
  padding: 1.6rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.compat-form .field-row { margin-bottom: 0; }
.compat-form .roll-button { margin: .4rem 0 0; }

.compat-result {
  max-width: 52ch;
  margin: 2rem auto 0;
}
.compat-result[hidden] { display: none; }

.compat-score {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .6rem;
}
.compat-score__num {
  font-family: var(--display);
  font-size: var(--fs-xl);
  color: var(--gold-bright);
  line-height: 1;
}
.compat-score__verdict {
  font-family: var(--sc);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: var(--fs-label);
  color: var(--verdigris);
}

.compat-meter {
  height: 6px;
  background: var(--ink-soft);
  border: 1px solid var(--gold-dim);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 1.2rem;
}
.compat-meter__fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}
.compat-meter__fill--high { background: var(--verdigris); }
.compat-meter__fill--mid  { background: var(--gold); }
.compat-meter__fill--low  { background: var(--clash); }

.compat-summary {
  font-size: var(--fs-sm);
  color: var(--parchment-dim);
  font-style: italic;
  margin: 0 0 .5rem;
}

.compat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .7rem;
  margin: 1rem 0;
}

.compat-aspect {
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5);
  border-radius: 2px;
  padding: .6rem .5rem;
  text-align: center;
  background: var(--ink-raised);
}
.compat-aspect--good    { border-top: 2px solid var(--verdigris); }
.compat-aspect--hard    { border-top: 2px solid var(--clash); }
.compat-aspect--neutral { border-top: 2px solid var(--gold-dim); }

.compat-aspect__pair {
  font-family: var(--sc);
  font-size: var(--fs-label);
  letter-spacing: .1em;
  color: var(--verdigris);
  display: block;
  margin-bottom: .4rem;
  text-transform: uppercase;
}
.compat-aspect__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .3rem;
}
.compat-aspect__side,
.compat-aspect__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  flex: 1;
}
.compat-aspect__glyph { font-size: var(--fs-lg); line-height: 1; }
.compat-aspect__glyph--agent { color: var(--gold-bright); }
.compat-aspect__glyph--you   { color: var(--verdigris); }
.compat-aspect__glyph--asp   { color: var(--parchment-dim); font-size: var(--fs-body); }
.compat-aspect__who {
  font-family: var(--sc);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--parchment-dim);
}
.compat-aspect__tone {
  display: inline-block;
  margin-top: .45rem;
  font-family: var(--sc);
  font-size: .7rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: .12rem .5rem;
  border-radius: 999px;
}
.compat-aspect--good .compat-aspect__tone    { color: var(--verdigris); background: rgba(127, 160, 138, .14); }
.compat-aspect--hard .compat-aspect__tone    { color: var(--clash); background: rgba(193, 123, 107, .15); }
.compat-aspect--neutral .compat-aspect__tone { color: var(--parchment-dim); background: rgba(201, 162, 75, .10); }

.compat-romance {
  border: 1px solid var(--gold-dim);
  border-radius: 2px;
  background: rgba(201, 162, 75, .06);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .4);
  padding: .85rem 1rem;
  margin-top: .5rem;
}
.compat-romance[hidden] { display: none; }
.compat-romance__label {
  font-family: var(--sc);
  letter-spacing: .1em;
  text-transform: uppercase;
  font-size: var(--fs-label);
  color: var(--gold);
  margin: 0 0 .7rem;
}

/* ---- Typeahead (offline city search) -------------------------------- */

.field--typeahead { position: relative; }
.typeahead-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 15rem;
  overflow-y: auto;
  z-index: 30;
  background: var(--ink-raised);
  border: 1px solid var(--gold-dim);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .5);
  list-style: none;
  margin: 0;
  padding: .25rem 0;
  border-radius: 2px;
}
.typeahead-list li { padding: .4rem .7rem; cursor: pointer; font-size: var(--fs-sm); color: var(--parchment); }
.typeahead-list li.is-active,
.typeahead-list li:hover { background: rgba(201, 162, 75, .14); color: var(--gold-bright); }

/* ---- How-It-Works step IV: optional badge + link -------------------- */

.rite-step__tag {
  font-family: var(--sc);
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--gold);
  padding: .1rem .45rem;
  border-radius: 999px;
  vertical-align: middle;
  margin-left: .5rem;
}
.rite-step__link { color: var(--verdigris); white-space: nowrap; }

/* ---- Colophon credit ------------------------------------------------ */

.colophon__credit { margin-top: .4rem; }
