:root {
  /* Palette drawn from the DarkPraxis emblem: near-black ground, parchment
     cream, antique gold, and an oxblood/brick ring. */
  --bg: #0d0b0f;
  --bg-2: #151016;
  --panel: #191420;
  --panel-2: #221b29;
  --ink: #ece0c4;          /* parchment cream (skull / linework) */
  --ink-dim: #c6b691;
  --muted: #8f8168;
  --gold: #cda15a;         /* antique gold */
  --gold-dim: #9a7d45;
  --oxblood: #7c2733;      /* emblem ring, deep brick */
  --oxblood-deep: #5a1b25;
  --ember: #c96140;        /* torch / ember accent */
  --line: #2a2230;
  --danger: #c25a5a;
  --radius: 10px;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --body: 'EB Garamond', Georgia, serif;
  --topbar-h: 63px; /* topbar height (mobile overrides below) — anchors sticky sub-headers */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(120% 90% at 50% -10%, #1a1411 0%, var(--bg) 60%) fixed;
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.55;
  min-height: 100vh;
  /* clip, not hidden: hidden makes body a scroll container, which silently
     disables position:sticky for the topbar and sub-headers. */
  overflow-x: clip;
  max-width: 100%;
}

.hidden { display: none !important; }

/* ── Candlelight ambiance ── a persistent, GPU-cheap layer of warm glow, a
   slow flicker, and a vignette. Sits behind all content; brightest on Read
   and Mori. Honors prefers-reduced-motion. ── */
#ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  opacity: 0.7; transition: opacity 1.4s ease;
  box-shadow: inset 0 0 190px 44px rgba(0, 0, 0, 0.55);
  background: radial-gradient(130% 80% at 50% 118%, rgba(201, 97, 64, 0.10), transparent 60%);
}
#ambient::before, #ambient::after {
  content: ''; position: absolute; border-radius: 50%;
  filter: blur(64px); mix-blend-mode: screen; will-change: opacity, transform;
}
#ambient::before {
  width: 48vmax; height: 48vmax; left: -14vmax; bottom: -18vmax;
  background: radial-gradient(circle, rgba(201, 97, 64, 0.5), rgba(124, 39, 51, 0.16) 55%, transparent 70%);
  animation: candle-flicker 6s ease-in-out infinite;
}
#ambient::after {
  width: 42vmax; height: 42vmax; right: -14vmax; bottom: -20vmax;
  background: radial-gradient(circle, rgba(205, 161, 90, 0.4), rgba(124, 39, 51, 0.12) 55%, transparent 70%);
  animation: candle-flicker 7.5s ease-in-out infinite reverse;
}
@keyframes candle-flicker {
  0%, 100% { opacity: 0.42; transform: translateY(0) scale(1); }
  20% { opacity: 0.56; transform: translateY(-1.2%) scale(1.03); }
  45% { opacity: 0.36; transform: translateY(0.6%) scale(0.985); }
  68% { opacity: 0.52; transform: translateY(-0.6%) scale(1.02); }
  85% { opacity: 0.44; transform: translateY(0.3%) scale(1); }
}
body[data-view="read"] #ambient,
body[data-view="mori"] #ambient { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  #ambient::before, #ambient::after { animation: none; opacity: 0.46; }
}
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }
.dim { color: var(--ink-dim); }

button {
  font-family: var(--body);
  cursor: pointer;
}

/* subtle parchment texture via noise-ish overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(rgba(200, 161, 90, 0.03) 1px, transparent 1px);
  background-size: 3px 3px;
  z-index: 0;
}

/* ── Gate ── */
.gate {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg);
  z-index: 100;
}
.gate-card {
  text-align: center;
  padding: 3rem 2.5rem;
  max-width: 360px;
}
.gate-card h1 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.15em;
  font-size: 2.2rem;
  margin: 0.3rem 0 0.2rem;
}
.gate-icon {
  width: 132px;
  height: 132px;
  border-radius: 28px;
  object-fit: cover;
  box-shadow: 0 0 44px rgba(124, 39, 51, 0.35), 0 0 22px rgba(205, 161, 90, 0.22),
    0 10px 34px rgba(0, 0, 0, 0.6);
}
.gate-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.motto {
  margin-top: 1.6rem;
  font-family: var(--serif);
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  text-transform: lowercase;
  color: var(--gold-dim);
  opacity: 0.75;
}

input, textarea, select {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  font-family: var(--body);
  font-size: 1rem;
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--gold-dim);
}

button:not(.ghost):not(.nav-btn):not(.link):not(.brand):not(.door):not(.mode-btn):not(.lb-close):not(.lb-nav) {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  border-radius: var(--radius);
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  transition: all 0.15s ease;
}
button:not(.ghost):not(.nav-btn):not(.link):not(.brand):not(.door):not(.mode-btn):not(.lb-close):not(.lb-nav):hover {
  border-color: var(--gold);
  color: var(--ink);
  box-shadow: 0 0 18px rgba(200, 161, 90, 0.15);
}
button:disabled { opacity: 0.4; cursor: not-allowed; }

.ghost {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.1rem;
}
.ghost:hover { color: var(--ink); }
.link {
  background: none;
  border: none;
  color: var(--gold);
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: inherit;
}
.danger-btn { border-color: var(--danger) !important; color: var(--danger) !important; }

/* ── Top bar ── */
.app { position: relative; z-index: 1; }
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  padding-top: calc(1rem + env(safe-area-inset-top));
  padding-left: max(1.5rem, env(safe-area-inset-left));
  padding-right: max(1.5rem, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(13, 11, 15, 0.92);
  backdrop-filter: blur(8px);
  z-index: 10;
  max-width: 100%;
}
.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--serif);
  letter-spacing: 0.18em;
  color: var(--gold);
  font-size: 1.15rem;
}
.brand:hover { color: var(--ink); }
.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  margin-right: 0.55rem;
  object-fit: cover;
  border: 1px solid var(--gold-dim);
}
.nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 0.4rem 0.9rem;
  font-size: 1rem;
  letter-spacing: 0.05em;
  border-bottom: 2px solid transparent;
}
.nav-btn.active { color: var(--gold); border-bottom-color: var(--gold-dim); }
.nav-btn:hover { color: var(--ink); }

/* A view sub-header (e.g. "‹ decks" on a long deck page) that stays reachable
   while scrolling — pinned just below the sticky topbar. */
.sticky-head {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h));
  z-index: 5;
  background: rgba(13, 11, 15, 0.92);
  backdrop-filter: blur(8px);
  margin: 0 -1rem;
  padding: 0.45rem 1rem;
  border-bottom: 1px solid var(--line);
}

/* ── Threshold (home hub) ── */
.threshold { max-width: 760px; margin: 0 auto; }
.threshold-head { text-align: center; margin: 1.5rem 0 2rem; }
.threshold-emblem {
  width: 92px; height: 92px; border-radius: 16px;
  object-fit: cover; border: 1px solid var(--gold-dim);
  box-shadow: 0 0 40px rgba(205, 161, 90, 0.15);
}
.threshold-head .view-title { margin: 0.8rem 0 0.3rem; }
.threshold-head .motto {
  color: var(--muted); font-style: italic; letter-spacing: 0.08em; font-size: 0.9rem;
}
.door-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.9rem;
}
.door {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem;
  text-align: left;
  background: linear-gradient(160deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.door:hover {
  border-color: var(--gold-dim);
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35);
}
/* ── Mode toggle (Read view: deck draws vs lay your own) ── */
.mode-toggle {
  display: flex; gap: 0; margin: 0.4rem 0 0.8rem;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  width: fit-content; max-width: 100%;
}
.mode-btn {
  background: transparent; border: none; color: var(--muted);
  padding: 0.55rem 1rem; font-size: 0.95rem; cursor: pointer;
}
.mode-btn + .mode-btn { border-left: 1px solid var(--line); }
.mode-btn.active { background: var(--panel-2); color: var(--gold); }

.ask-card {
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius);
  background: radial-gradient(120% 140% at 50% -20%, rgba(205, 161, 90, 0.12), var(--panel) 70%);
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.6rem;
  text-align: center;
}
.ask-label {
  color: var(--gold); font-size: 0.72rem; letter-spacing: 0.22em; text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.ask-question {
  font-family: var(--serif); font-size: 1.5rem; line-height: 1.35; color: var(--ink);
  margin: 0 0 0.7rem;
}
.door-glyph { font-size: 1.7rem; line-height: 1; color: var(--gold); }
.door-name {
  font-family: var(--serif); font-size: 1.35rem; color: var(--ink);
  letter-spacing: 0.04em;
}
.door-blurb { color: var(--muted); font-size: 0.92rem; }

/* ── Views ── */
.view {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
  position: relative;
  z-index: 1; /* above the candlelight ambiance */
}
.view.wide { max-width: 1100px; }

h2.view-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.8rem;
  letter-spacing: 0.04em;
  margin: 0 0 1.2rem;
}

/* ── Unload ── */
.unload-box textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  font-size: 1.15rem;
  line-height: 1.6;
  background: var(--bg-2);
}
.unload-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 0.75rem;
}
.unload-actions input[type='text'] { flex: 1; }

.entry {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-top: 1rem;
  background: var(--panel);
}
.entry .meta {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.entry .body { white-space: pre-wrap; }
.entry .reflection {
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
  color: var(--ink-dim);
  font-style: italic;
  white-space: pre-wrap;
}
.entry .entry-actions { margin-top: 0.7rem; display: flex; gap: 0.75rem; }
.section-divider {
  display: flex; align-items: center; gap: 1rem;
  margin: 2rem 0 0.5rem; color: var(--muted);
}
.section-divider::before, .section-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

/* ── Spirits ── */
.spirit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.spirit-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.2rem;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.spirit-card:hover { border-color: var(--gold-dim); box-shadow: 0 0 22px rgba(0,0,0,0.4); }
.monogram {
  width: 64px; height: 64px; margin: 0 auto 0.8rem;
  display: grid; place-items: center;
  border: 1px solid var(--gold-dim);
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 1.8rem;
  color: var(--gold);
  background: radial-gradient(circle, rgba(200,161,90,0.08), transparent);
}
.spirit-card .name { font-family: var(--serif); font-size: 1.3rem; }
.spirit-card .domain { color: var(--muted); font-size: 0.9rem; margin-top: 0.2rem; }
.spirit-card .last { color: var(--gold-dim); font-size: 0.78rem; margin-top: 0.5rem; }

/* summon */
.summon-card {
  border: 1px dashed var(--gold-dim);
  display: grid; place-items: center;
  min-height: 160px; color: var(--gold);
  font-family: var(--serif); font-size: 1.1rem;
}

/* ── Chat ── */
.chat-header {
  display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem;
  flex-wrap: wrap;
}
.chat-header .name { font-family: var(--serif); font-size: 1.5rem; }
.chat-header .domain { color: var(--muted); font-size: 0.9rem; }
.chat-header .spacer { flex: 1; }
.toggle {
  display: inline-flex; align-items: center; gap: 0.4rem;
  color: var(--ink-dim); font-size: 0.85rem;
}
.messages {
  display: flex; flex-direction: column; gap: 0.9rem;
  margin-bottom: 1rem;
}
.msg { max-width: 85%; padding: 0.7rem 1rem; border-radius: var(--radius); white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--oxblood); color: #f2e7e0; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg .speak { margin-top: 0.4rem; font-size: 0.75rem; }
.chat-input { display: flex; gap: 0.6rem; }
.chat-input textarea { flex: 1; min-height: 52px; resize: vertical; }
.session-note {
  color: var(--muted); font-style: italic; font-size: 0.9rem;
  margin-bottom: 1rem; border-left: 2px solid var(--gold-dim); padding-left: 0.8rem;
}

/* ── Decks ── */
.deck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1.2rem;
}
.deck-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--panel);
  transition: all 0.15s ease;
}
.deck-tile:hover { border-color: var(--gold-dim); }
.deck-tile .thumb {
  aspect-ratio: 3 / 4; background: var(--bg-2);
  display: grid; place-items: center; color: var(--muted);
  background-size: cover; background-position: center;
}
.deck-tile .info { padding: 0.7rem 0.9rem; }
.deck-tile .info .t { font-family: var(--serif); font-size: 1.15rem; }
.deck-tile .info .s { font-size: 0.8rem; color: var(--muted); }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.9rem;
}
.tarot {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.tarot .art {
  aspect-ratio: 3 / 4;
  background: var(--bg-2);
  display: grid; place-items: center;
  color: var(--muted); font-size: 0.8rem;
  background-size: cover; background-position: center;
  position: relative;
}
.tarot .art.pending::after {
  content: '· conjuring ·';
  color: var(--gold-dim);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:0.3} 50%{opacity:0.9} }
.tarot .cap { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.tarot .cap .nm { font-family: var(--serif); }
.tarot .reroll { font-size: 0.72rem; padding: 0.2rem 0.4rem; margin-top:0.3rem; }

.progress {
  height: 6px; background: var(--panel); border-radius: 3px; overflow: hidden;
  margin: 0.5rem 0 1.5rem;
}
.progress > div { height: 100%; background: linear-gradient(90deg, var(--oxblood), var(--gold)); transition: width 0.4s ease; }

.status-badge { font-size: 0.75rem; padding: 0.1rem 0.5rem; border-radius: 999px; border: 1px solid var(--line); }
.status-badge.generating { color: var(--ember); border-color: var(--ember); }
.status-badge.complete { color: var(--gold); border-color: var(--gold-dim); }
.status-badge.partial { color: var(--danger); border-color: var(--danger); }

/* draw mode */
.draw-controls { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.spread-cards { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; margin: 1.5rem 0; }
.flip { perspective: 1000px; width: 150px; }
.flip .inner {
  position: relative; width: 100%; aspect-ratio: 3/4;
  transform-style: preserve-3d; transition: transform 0.7s;
}
.flip.revealed .inner { transform: rotateY(180deg); }
.flip .face {
  position: absolute; inset: 0; backface-visibility: hidden;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--gold-dim);
  display: grid; place-items: center; background-size: cover; background-position: center;
}
.flip .back { background: linear-gradient(135deg, #241a2e, #120e18); color: var(--gold); font-size: 1.6rem; }
.flip .front { transform: rotateY(180deg); background: var(--bg-2); }
.flip .front.reversed { transform: rotateY(180deg) rotate(180deg); }
.flip-caption { text-align: center; font-size: 0.8rem; margin-top: 0.4rem; color: var(--ink-dim); }
.interpretation {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.2rem 1.4rem; background: var(--panel); white-space: pre-wrap;
  margin-top: 1rem; line-height: 1.7;
}

/* ── Modal ── */
.modal-back {
  position: fixed; inset: 0; background: rgba(5,4,7,0.7);
  display: grid; place-items: center; z-index: 200; padding: 1rem;
}
.modal {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.8rem; width: 100%;
  max-width: min(460px, calc(100vw - 2rem));
  max-height: 86dvh; overflow-y: auto; overflow-x: hidden;
  overflow-wrap: break-word;
}
.modal h3 { font-family: var(--serif); font-weight: 500; margin-top: 0; }
.modal .row { display: flex; gap: 0.75rem; margin-top: 1.2rem; justify-content: flex-end; }
.modal textarea, .modal input { width: 100%; margin-top: 0.5rem; }
.field { margin-top: 0.9rem; }
.field label { display: block; color: var(--ink-dim); font-size: 0.9rem; margin-bottom: 0.2rem; }

/* ── 🪄 Enhance wand (prompt fields) ── */
.wand-row { display: flex; gap: 0.4rem; align-items: stretch; }
.wand-row input, .wand-row textarea { flex: 1; min-width: 0; }
.wand {
  flex-shrink: 0; font-size: 1.15rem; padding: 0 0.55rem;
  border: 1px solid var(--line) !important; border-radius: var(--radius);
  background: var(--panel);
}
.wand:hover:not(:disabled) { border-color: var(--gold-dim) !important; }
.wand-col { display: flex; flex-direction: column; gap: 0.4rem; }
.wand-col .wand { flex: 1; }

/* ── Drawn-card strip (inline in the reading conversation) ── */
.drawn-strip {
  display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center;
  margin: 0.7rem auto; padding: 0.6rem 0;
}

/* ── Reading distillation ── */
.synthesis {
  background: var(--panel);
  border: 1px solid var(--gold-dim);
  border-left: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  white-space: pre-wrap;
  line-height: 1.65;
  color: var(--ink-dim);
  margin: 0.6rem 0;
}
.synthesis strong { color: var(--gold); }

/* ── Usage tracker (Settings) ── */
.usage-period {
  color: var(--muted); font-size: 0.75rem; letter-spacing: 0.12em;
  text-transform: lowercase; margin: 0.9rem 0 0.3rem;
}
.usage-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.usage-table th {
  text-align: left; color: var(--muted); font-weight: normal; font-size: 0.75rem;
  letter-spacing: 0.08em; padding: 0.25rem 0.5rem; border-bottom: 1px solid var(--line);
}
.usage-table td { padding: 0.35rem 0.5rem; border-bottom: 1px solid var(--line); color: var(--ink-dim); }
.usage-table td:last-child { color: var(--gold); white-space: nowrap; }

/* ── Card-art lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 260;
  background: rgba(5, 4, 7, 0.88); backdrop-filter: blur(6px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.8rem; padding: 1.2rem; cursor: zoom-out;
}
.lightbox img {
  max-width: min(92vw, 560px); max-height: 78dvh; object-fit: contain;
  border-radius: 12px; border: 1px solid var(--gold-dim);
  box-shadow: 0 12px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(205, 161, 90, 0.12);
}
.lightbox img.reversed { transform: rotate(180deg); }
.lb-cap { font-family: var(--serif); color: var(--ink); font-size: 1.1rem; text-align: center; }
.lb-close {
  position: absolute; top: calc(0.8rem + env(safe-area-inset-top)); right: 1rem;
  background: var(--panel); border: 1px solid var(--gold-dim); color: var(--gold);
  border-radius: 50%; width: 42px; height: 42px; font-size: 1.1rem; cursor: pointer;
}
[data-lightbox] { cursor: zoom-in; }

/* ── Toast ── */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--gold-dim); color: var(--ink);
  padding: 0.7rem 1.2rem; border-radius: var(--radius); z-index: 300;
  box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.toast.err { border-color: var(--danger); color: var(--danger); }

.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; font-style: italic; }
.spinner { color: var(--gold-dim); }
.warn-banner {
  background: rgba(110,34,51,0.25); border: 1px solid var(--oxblood);
  color: var(--ink-dim); padding: 0.6rem 1rem; border-radius: var(--radius);
  font-size: 0.9rem; margin-bottom: 1.2rem;
}

/* ── Grimoire / lore spirits ── */
.spirit-card.lore { border-color: var(--oxblood); }
.spirit-card.lore:hover { border-color: var(--ember); }
.bound {
  color: var(--oxblood); font-size: 0.72rem; letter-spacing: 0.08em; margin-top: 0.35rem;
}
#grimoire-list { max-height: 58vh; overflow-y: auto; margin: 0.5rem 0; padding-right: 0.4rem; }
.grim-entry { border-top: 1px solid var(--line); padding: 0.8rem 0; }
.grim-entry:first-child { border-top: none; }
.grim-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; }
.grim-name { font-family: var(--serif); font-size: 1.2rem; color: var(--gold); }
.grim-rank {
  font-size: 0.7rem; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase;
  text-align: right;
}
.grim-domain { font-style: italic; color: var(--ink-dim); font-size: 0.9rem; }
.grim-lore { font-size: 0.88rem; color: var(--ink-dim); margin-top: 0.3rem; }
.grim-actions { margin-top: 0.45rem; }
.ritual-box {
  border: 1px solid var(--oxblood);
  background: rgba(124, 39, 51, 0.12);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  margin: 0.7rem 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
}
input[type='file'] { color: var(--ink-dim); font-size: 0.85rem; }

/* ── Read: card rows ── */
.card-row { display: flex; gap: 0.5rem; margin-bottom: 0.5rem; align-items: center; }
.card-row .card-name { flex: 1; min-width: 0; }
.orient {
  background: var(--panel); border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: var(--radius); padding: 0.55rem 0.7rem; font-size: 0.82rem; white-space: nowrap;
}
.orient.reversed { border-color: var(--oxblood); color: var(--ember); }
.rm-row { font-size: 1rem; padding: 0.2rem 0.45rem; }

.deck-tile.owned .thumb { font-size: 1.6rem; cursor: pointer; }

/* Spread tiles (named cards, physical mode) */
.tcard {
  width: 96px; border: 1px solid var(--gold-dim); border-radius: 8px;
  background: linear-gradient(160deg, #241a2e, #140f1c); overflow: hidden;
}
.tcard-inner { aspect-ratio: 3 / 4; display: grid; place-items: center; padding: 0.4rem; text-align: center; }
.tcard-name { font-family: var(--serif); font-size: 0.85rem; color: var(--ink); }
.tcard.has-art { width: 120px; }
.tcard.has-art .tcard-inner { padding: 0; }
.tcard-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.tcard.rev .tcard-inner { transform: rotate(180deg); }
.tcard-cap { font-size: 0.62rem; text-align: center; color: var(--muted); padding: 0.2rem; letter-spacing: 0.04em; }
.tcard.rev .tcard-cap { color: var(--ember); }
.tcard.drawn-new { border-color: var(--ember); box-shadow: 0 0 14px rgba(201, 97, 64, 0.4); }

/* Arranged spread (geometric layout) */
.spread-grid {
  display: grid; gap: 0.5rem 0.4rem; justify-items: center; align-items: start;
  margin: 0.6rem auto; max-width: 100%;
}
.gcell { display: flex; flex-direction: column; align-items: center; width: 100%; }
.tcard.mini { width: 100%; max-width: 72px; }
.tcard.mini .tcard-name { font-size: 0.66rem; }
.tcard.mini.has-art { max-width: 104px; }
.gpos { font-size: 0.58rem; color: var(--muted); text-align: center; margin-top: 0.2rem; line-height: 1.15; }
.tcard.cross { transform: rotate(90deg); }
.tcard.cross.rev { transform: rotate(270deg); }
.spread-grid.flips .flip { width: 100%; max-width: 96px; }
.spread-grid.flips .flip-caption { max-width: 100px; }
.extras-label {
  text-align: center; color: var(--muted); font-size: 0.72rem; letter-spacing: 0.12em;
  text-transform: lowercase; margin: 0.9rem 0 0.3rem;
}

/* Long content wraps — never push the page sideways. */
.msg, .interpretation, .body, .reflection, .grim-lore, .entry, .session-note {
  overflow-wrap: anywhere;
}
img, canvas, video { max-width: 100%; }

/* ── Mori floating button (app-logo FAB) ── */
#mori-fab {
  position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 50;
  width: 60px; height: 60px; border-radius: 50%; padding: 0; overflow: hidden;
  border: 1px solid var(--gold-dim); background: var(--panel); cursor: pointer;
  box-shadow: 0 0 22px rgba(124, 39, 51, 0.35), 0 6px 20px rgba(0, 0, 0, 0.55);
}
#mori-fab img { width: 100%; height: 100%; object-fit: cover; display: block; }
#mori-fab:hover { border-color: var(--gold); box-shadow: 0 0 28px rgba(205, 161, 90, 0.3); }

@media (max-width: 600px) {
  body { font-size: 17px; }
  .view { padding: 1.2rem 1rem 5.5rem; } /* bottom room for the FAB */
  :root { --topbar-h: 54px; }
  .topbar {
    padding: 0.7rem 0.7rem;
    padding-top: calc(0.7rem + env(safe-area-inset-top));
    padding-left: max(0.7rem, env(safe-area-inset-left));
    padding-right: max(0.7rem, env(safe-area-inset-right));
    gap: 0.4rem;
  }
  .brand { font-size: 0; } /* hide the wordmark, keep the emblem */
  .brand-icon { margin-right: 0; width: 30px; height: 30px; }
  .nav {
    flex: 1; min-width: 0; overflow-x: auto; flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-btn { padding: 0.4rem 0.55rem; font-size: 0.95rem; white-space: nowrap; }
  .modal { padding: 1.2rem; }
  .flip { width: 116px; }
  .spread-cards { gap: 0.6rem; }
  #mori-fab { width: 54px; height: 54px; }
  .chat-header { gap: 0.5rem; }
}

/* Archived decks: present but dimmed. */
.archived-grid .deck-tile { opacity: 0.55; filter: saturate(0.5); }
.archived-grid .deck-tile:hover { opacity: 0.85; }

/* Lightbox gallery: chevrons, counter, crossfade */
#lightbox-img { transition: opacity 0.09s ease; }
#lightbox-img.lb-fading { opacity: 0; }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: var(--panel); border: 1px solid var(--gold-dim); color: var(--gold);
  border-radius: 50%; width: 44px; height: 44px; font-size: 1.5rem; line-height: 1;
  cursor: pointer; z-index: 1; opacity: 0.85;
}
.lb-prev { left: max(0.5rem, env(safe-area-inset-left)); }
.lb-next { right: max(0.5rem, env(safe-area-inset-right)); }
.lb-nav:hover { opacity: 1; border-color: var(--gold); }
.lb-count {
  color: var(--muted); font-size: 0.8rem; letter-spacing: 0.12em;
}
.lb-regen {
  font-size: 0.85rem; padding: 0.35rem 0.9rem;
  border: 1px solid var(--gold-dim); border-radius: 999px;
}
.lb-regen:disabled { opacity: 0.6; cursor: wait; }

/* Daily spend cap meter (Settings → usage) */
.cap-meter { margin-bottom: 1rem; }
.cap-bar {
  height: 6px; border-radius: 999px; background: var(--panel-2);
  border: 1px solid var(--line); overflow: hidden;
}
.cap-fill { height: 100%; background: var(--gold-dim); transition: width 0.3s ease; }
.cap-meter.capped .cap-fill { background: var(--danger); }
.cap-text { color: var(--muted); font-size: 0.85rem; margin-top: 0.35rem; }
.cap-meter.capped .cap-text { color: var(--danger); }

/* Miscount flag on pip cards (from the count audit / settled generations) */
.miscount {
  color: var(--danger); font-size: 0.75em; margin-left: 0.4em;
  letter-spacing: 0.05em; cursor: help; white-space: nowrap;
}

/* Painter provenance marks (♊ Gemini / ⌬ GPT) */
.painter { color: var(--muted); font-size: 0.78em; margin-left: 0.35em; cursor: help; }
.lb-painter { color: var(--gold-dim); }
.engine-note { color: var(--muted); font-size: 0.85rem; margin-bottom: 0.9rem; }
.engine-note .painter { margin-left: 0; }

/* Provider wire tests (Settings) */
.wire { font-size: 0.9rem; padding: 0.3rem 0; color: var(--ink-dim); border-bottom: 1px solid var(--line); }
.wire.ok { color: var(--ink-dim); }
.wire.ok strong { color: var(--gold); }
.wire.bad { color: var(--danger); }
.wire.dim { color: var(--muted); font-size: 0.8rem; }

/* Lightbox mend row (surgical edits) */
.lb-mend { display: flex; gap: 0.5rem; width: min(92vw, 560px); }
.lb-mend input { flex: 1; min-width: 0; font-size: 0.85rem; }
.lb-mend button { white-space: nowrap; border: 1px solid var(--gold-dim); border-radius: 999px; padding: 0.35rem 0.9rem; font-size: 0.85rem; }

/* ── Empowered cards: the pulsing glow ── */
@keyframes emp-pulse {
  0%, 100% { box-shadow: 0 0 10px 1px var(--emp, #e0b341), 0 0 28px 5px color-mix(in srgb, var(--emp, #e0b341) 40%, transparent); }
  50% { box-shadow: 0 0 18px 5px var(--emp, #e0b341), 0 0 48px 12px color-mix(in srgb, var(--emp, #e0b341) 60%, transparent); }
}
.emp, .flip.emp {
  animation: emp-pulse 2.4s ease-in-out infinite;
  border-radius: 10px;
}
.flip.emp-late { animation-delay: 1.4s; } /* let the flip reveal land first */
.emp-cap {
  color: var(--emp, var(--gold));
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-align: center;
  margin-top: 0.3rem;
  cursor: help;
  text-shadow: 0 0 8px color-mix(in srgb, var(--emp, var(--gold)) 50%, transparent);
}
.emp-mark { color: var(--gold); cursor: help; }
.rite-line { color: var(--muted); font-size: 0.85rem; margin-top: 0.35rem; }
.rite-line.vigil { color: var(--gold-dim); }
.rite-line.lunar-live { color: var(--gold); }

/* ── The lunar veil: the room changes while the moon's reading holds ── */
body { transition: color 1.8s ease; }
body.lunar-full {
  /* moonlight: cool silver-blue ground, silvered ink, gold gives way to moonsilver */
  --bg: #121826;
  --bg-2: #1a2233;
  --panel: #1b2436;
  --panel-2: #232f46;
  --ink: #eef2fa;
  --ink-dim: #c3cde0;
  --muted: #8d99b3;
  --gold: #cdd8ec;
  --gold-dim: #93a3c0;
  --line: #2c3850;
  background: radial-gradient(120% 90% at 50% -10%, #2c3a58 0%, var(--bg) 62%) fixed;
}
body.lunar-full::before {
  background-image: radial-gradient(rgba(205, 216, 236, 0.045) 1px, transparent 1px);
}
body.lunar-new {
  /* umbra: the deepest dark, ashen-violet ink, embers dimmed to dusk */
  --bg: #050409;
  --bg-2: #0a0814;
  --panel: #0e0b18;
  --panel-2: #151021;
  --ink: #cbc6dd;
  --ink-dim: #9d97b8;
  --muted: #6b6585;
  --gold: #8f88b5;
  --gold-dim: #5f5a80;
  --line: #221d33;
  background: radial-gradient(120% 90% at 50% -10%, #100c20 0%, var(--bg) 65%) fixed;
}
body.lunar-new::before {
  background-image: radial-gradient(rgba(143, 136, 181, 0.035) 1px, transparent 1px);
}

/* ── Unload: entries grouped by day, expandable, with dialogue threads ── */
.day-divider {
  color: var(--gold-dim); font-family: var(--serif); font-size: 0.95rem;
  letter-spacing: 0.06em; margin: 1.4rem 0 0.5rem; padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--line);
}
.entry-head {
  display: flex; align-items: baseline; gap: 0.6rem; cursor: pointer;
  padding: 0.15rem 0; user-select: none;
}
.entry-head .etime { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
.entry-head .epreview {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; color: var(--ink-dim);
}
.entry-head .ebadges { color: var(--gold-dim); font-size: 0.8rem; white-space: nowrap; }
.entry-head .echev { color: var(--muted); transition: transform 0.15s ease; }
.entry:not(.collapsed) .echev { transform: rotate(90deg); }
.entry.collapsed .entry-body { display: none; }
.entry-body { margin-top: 0.5rem; }
.entry-thread { margin-top: 0.8rem; border-top: 1px solid var(--line); padding-top: 0.8rem; }
.ethread-msgs { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.7rem; }
.entry-thread .chat-input { margin-top: 0.2rem; }

/* Burn buttons: quiet until armed */
.link.burn { color: var(--muted); }
.link.burn[data-armed] { color: var(--danger); }

/* ── The bones: casting circle ── */
.bones-cloth { max-width: 440px; margin: 0.5rem auto 1rem; position: relative; }
.bones-cloth svg { width: 100%; height: auto; display: block; position: relative; z-index: 1; }
.bones-cloth .bones-legend { position: relative; z-index: 1; }
/* A tinted or painted cloth: the surface sits behind the casting circle. */
.bones-cloth.has-surface, .bones-cloth.tinted { padding: 0.6rem; border-radius: 16px; background: var(--cloth-bg, transparent); }
.bones-cloth.has-surface { box-shadow: inset 0 0 60px rgba(0,0,0,0.55), 0 4px 18px rgba(0,0,0,0.4); overflow: hidden; }
.cloth-surface {
  position: absolute; inset: 0; z-index: 0; border-radius: 16px;
  background-size: cover; background-position: center; opacity: 0.5;
}
.bones-cloth.has-surface .cloth-surface::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(60% 60% at 50% 50%, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.62) 100%);
}
.bones-cloth .ring { fill: none; stroke: var(--cloth-ring, var(--gold-dim)); }
.bones-cloth .ring.rim { stroke-width: 1.6; fill: rgba(205, 161, 90, 0.03); }
.bones-cloth .ring.mid { stroke-width: 0.8; opacity: 0.45; stroke-dasharray: 2 5; }
.bones-cloth .ring.heart { stroke-width: 0.8; opacity: 0.6; stroke-dasharray: 2 5; }
.bone-piece circle { fill: var(--panel); stroke: var(--cloth-ink, var(--gold)); stroke-width: 1.4; }
.bone-piece text {
  fill: var(--cloth-ink, var(--gold)); font-family: var(--serif); font-size: 10.5px;
  letter-spacing: 0.08em; text-anchor: middle;
}
.bone-piece.silent { opacity: 0.32; }
.bone-piece.silent circle { stroke: var(--muted); }
.bone-piece.silent text { fill: var(--muted); }
.bones-legend {
  text-align: center; color: var(--muted); font-size: 0.75rem;
  letter-spacing: 0.06em; margin-top: 0.4rem;
}

/* Painted bone tokens on the cloth */
.bone-piece.token image { filter: drop-shadow(0 2px 5px rgba(0,0,0,0.55)); }
.bone-piece.token.facedown image { filter: grayscale(0.7) brightness(0.55) drop-shadow(0 2px 5px rgba(0,0,0,0.55)); }
.bone-piece.token .down-ring { fill: none; stroke: var(--muted); stroke-width: 1; opacity: 0.7; }
.bone-piece.token.silent { opacity: 0.35; }

/* Pouch cover banner on the detail page */
.pouch-cover { position: relative; max-width: 320px; margin: 0.4rem auto 1rem; }
.pouch-cover img { width: 100%; border-radius: 12px; display: block; }
.pouch-cover-blank {
  aspect-ratio: 1; border: 1px dashed var(--gold-dim); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-style: italic;
}
.pouch-cover .reroll { position: absolute; right: 0.5rem; bottom: 0.5rem; }
.pouch-thumb { background-color: var(--panel-2); }

/* ── The Devil's Deck: Satanic meditation ── */
.ritual-altar {
  border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.1rem;
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  margin: 0.6rem 0 1rem;
}
.ritual-controls { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.7rem; }
.ritual-controls select { flex: 0 1 auto; }
.ritual-controls #ritual-draw { margin-left: auto; }
.ritual-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ritual-tile .info .s { font-style: italic; }
.ritual-glyph {
  aspect-ratio: 3 / 4; display: flex; align-items: center; justify-content: center;
  font-size: 2.6rem; color: var(--gold); background: radial-gradient(120% 90% at 50% 25%, var(--panel-2) 0%, var(--bg-2) 100%);
  border-radius: 8px 8px 0 0;
}
.ritual-glyph.big { aspect-ratio: auto; font-size: 4.5rem; padding: 1.6rem 0; border-radius: 12px; width: 100%; max-width: 260px; margin: 0 auto; }
.ritual-art { aspect-ratio: 3 / 4; background-size: cover; background-position: center; border-radius: 8px 8px 0 0; cursor: zoom-in; }
.ritual-art.big { aspect-ratio: 3 / 4; max-width: 260px; margin: 0 auto; border-radius: 12px; box-shadow: 0 6px 22px rgba(0,0,0,0.45); }
/* A drawn card, laid out to sit with */
.ritual-card {
  display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem;
  background: var(--panel); margin: 0.4rem 0 1rem;
}
.ritual-card > .ritual-art, .ritual-card > .ritual-glyph { flex: 0 0 200px; }
.ritual-card-body { flex: 1 1 260px; min-width: 240px; }
.ritual-name { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); letter-spacing: 0.02em; }
.ritual-theme { color: var(--gold-dim); font-style: italic; margin: 0.15rem 0 0.7rem; }
.ritual-reflection { color: var(--ink-dim); line-height: 1.65; margin: 0.4rem 0; }
.ritual-questions { list-style: none; padding: 0; margin: 0.8rem 0 0; }
.ritual-questions li {
  color: var(--ink); padding: 0.35rem 0 0.35rem 1.3rem; position: relative; line-height: 1.5;
  border-top: 1px solid var(--line);
}
.ritual-questions li::before { content: '⛧'; position: absolute; left: 0; color: var(--gold-dim); font-size: 0.85rem; top: 0.4rem; }
.ritual-rite {
  margin-top: 0.9rem; padding: 0.55rem 0.8rem; border-left: 3px solid var(--gold-dim);
  background: var(--panel-2); border-radius: 8px; color: var(--muted); font-size: 0.9rem;
}
.ritual-detail { text-align: left; }
.ritual-detail .ritual-glyph.big, .ritual-detail .ritual-art.big { margin: 0 auto 0.6rem; }
.ritual-tile.retired { opacity: 0.45; }
/* After a pull: hand the matter onward to the cards or the bones */
.ritual-carry-row {
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center;
  margin: 0.2rem 0 0.8rem; padding: 0.5rem 0.8rem;
  border: 1px dashed var(--line); border-radius: 10px;
}
.ritual-carry-label { color: var(--muted); font-style: italic; font-size: 0.85rem; }
.ritual-carry-row .ghost { font-size: 0.95rem; }

/* The Grimoire: the running book of rites */
.rite-row { border: 1px solid var(--line); border-radius: 12px; margin: 0.55rem 0; background: var(--panel); overflow: hidden; }
.rite-head { display: flex; gap: 0.7rem; align-items: baseline; padding: 0.7rem 1rem; cursor: pointer; flex-wrap: wrap; }
.rite-head:hover { background: var(--panel-2); }
.rite-name { font-family: var(--serif); font-size: 1.1rem; color: var(--ink); }
.rite-intent { color: var(--muted); font-style: italic; font-size: 0.85rem; flex: 1; min-width: 8rem; }
.rite-date { color: var(--muted); font-size: 0.75rem; }
.rite-body { padding: 0.2rem 1rem 0.9rem; border-top: 1px solid var(--line); }
.rite-text { color: var(--ink-dim); line-height: 1.65; }
.rite-text strong { color: var(--gold); letter-spacing: 0.04em; }
.rite-actions { display: flex; gap: 0.7rem; margin-top: 0.6rem; align-items: center; flex-wrap: wrap; }
.rite-offering {
  margin: 0.7rem 0 0.2rem; padding: 0.6rem 0.85rem; border-radius: 8px;
  background: rgba(201, 97, 64, 0.08); border-left: 3px solid var(--ember);
  color: var(--ink-dim); font-size: 0.9rem; line-height: 1.5;
}
.rite-offering b { color: var(--gold); font-weight: 600; }
.rite-witness { font-family: var(--serif); font-size: 1.2rem; color: var(--ink); font-style: italic; }

/* ── The Library ── */
.doc-row {
  display: flex; align-items: baseline; gap: 0.7rem; flex-wrap: wrap;
  padding: 0.8rem 1rem; margin: 0.5rem 0; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
}
.doc-row:hover { background: var(--panel-2); border-color: var(--gold-dim); }
.doc-icon { font-size: 1.3rem; }
.doc-name { font-family: var(--serif); font-size: 1.15rem; color: var(--ink); flex: 1; min-width: 10rem; }
.doc-meta { color: var(--muted); font-size: 0.8rem; }
.doc-full {
  white-space: pre-wrap; font-size: 0.9rem; line-height: 1.6; color: var(--ink-dim);
  max-height: 60vh; overflow-y: auto; margin-top: 0.8rem; padding: 1rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2);
}

/* Dictation mic */
.mic-btn { font-size: 1.2rem; align-self: center; flex: 0 0 auto; padding: 0.2rem 0.4rem; border-radius: 8px; }
.mic-btn.listening {
  color: var(--ember);
  animation: mic-pulse 1.1s ease-in-out infinite;
  background: rgba(201, 97, 64, 0.12);
}
@keyframes mic-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) { .mic-btn.listening { animation: none; } }

/* ── The Weave: cloths ── */
.cloth-thumb { background-color: var(--panel-2); display: flex; align-items: center; justify-content: center; }
.cloth-swatch { font-size: 1.6rem; border: 1.5px solid var(--gold-dim); border-radius: 50%; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; }
.cloth-swatch-big {
  max-width: 420px; aspect-ratio: 16 / 9; margin: 0.4rem auto 1rem;
  border: 1px solid var(--gold-dim); border-radius: 14px;
  box-shadow: inset 0 0 50px rgba(0,0,0,0.5);
}
.cloth-tone {
  max-width: 560px; margin: 1rem auto 0; padding: 0.9rem 1.1rem;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--gold-dim);
  border-radius: 10px; color: var(--ink-dim); font-style: italic; line-height: 1.55;
}
.cloth-tone-label {
  font-style: normal; font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 0.4rem;
}
/* Combined read laid on a cloth */
.combo-surface { position: relative; border-radius: 16px; }
.combo-surface.has-surface, .combo-surface.tinted { padding: 1rem 0.6rem; background: var(--cloth-bg, transparent); }
.combo-surface.has-surface { overflow: hidden; box-shadow: inset 0 0 70px rgba(0,0,0,0.55); }
.combo-surface .cloth-surface { border-radius: 16px; opacity: 0.4; }
.combo-surface > .combo-row, .combo-surface > .combo-aside { position: relative; z-index: 1; }

/* ── Combined read: bones thrown over a spread ── */
.combo-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin: 0.5rem 0 1rem; }
.combo-cell { width: 128px; text-align: center; }
.combo-cell .tcard { margin: 0 auto; }
.combo-cap { font-size: 0.78rem; color: var(--ink-dim); margin-top: 0.35rem; }
.combo-bones { display: flex; flex-wrap: wrap; gap: 0.25rem; justify-content: center; margin-top: 0.35rem; min-height: 1.2rem; }
.combo-none { color: var(--muted); font-size: 0.72rem; font-style: italic; }
.bonechip {
  display: inline-block; font-size: 0.66rem; letter-spacing: 0.08em; padding: 0.12rem 0.4rem;
  border: 1px solid var(--gold-dim); border-radius: 999px; color: var(--gold); cursor: help; white-space: nowrap;
}
.bonechip.down { border-style: dashed; color: var(--muted); }
.bonechip.mute { border-color: var(--line); color: var(--muted); opacity: 0.7; }
.combo-aside { text-align: center; margin: 0.4rem 0; font-size: 0.8rem; }
.combo-aside-label { color: var(--muted); letter-spacing: 0.06em; margin-right: 0.4rem; }
.combo-aside.silent { opacity: 0.75; }

/* Threshold question: dismiss + Sanctum history */
.ask-card { position: relative; }
/* Keep the centered label clear of the corner mark on narrow screens. */
.ask-card .ask-label { padding: 0 2.4rem; }
.ask-dismiss {
  position: absolute; top: 0.45rem; right: 0.45rem;
  width: 1.7rem; height: 1.7rem; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 50%;
  color: var(--gold-dim); font-size: 0.8rem; opacity: 0.75;
  transition: all 0.15s ease;
}
.ask-dismiss:hover {
  color: var(--gold); opacity: 1;
  border-color: var(--gold-dim);
  background: rgba(205, 161, 90, 0.08);
}
.asked-row { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.asked-q { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); }
.asked-meta { color: var(--muted); font-size: 0.78rem; margin-top: 0.2rem; }
.asked-tag { letter-spacing: 0.06em; }
.asked-tag.took { color: var(--gold); }
.asked-tag.set { color: var(--muted); }
.asked-tag.open { color: var(--ink-dim); }

/* ── The solar veils: the room turns with the year ── */
body.solar-spring { --bg: #131a10; --bg-2: #1b2416; --panel: #1c2717; --panel-2: #24321c; --ink: #e8f0d8; --ink-dim: #c4d3a6; --muted: #8ba06d; --gold: #a8cf6a; --gold-dim: #7d9c4a; --line: #2d3a22; background: radial-gradient(120% 90% at 50% -10%, #2c3a1c 0%, var(--bg) 62%) fixed; }
body.solar-summer { --bg: #201804; --bg-2: #2b2107; --panel: #2a2109; --panel-2: #362a0c; --ink: #fbf1d4; --ink-dim: #e6cf94; --muted: #b39a5c; --gold: #f2c14e; --gold-dim: #c79a34; --line: #3a2e12; background: radial-gradient(120% 90% at 50% -10%, #4a3410 0%, var(--bg) 60%) fixed; }
body.solar-autumn { --bg: #1c1109; --bg-2: #26160c; --panel: #26160d; --panel-2: #321d10; --ink: #f2ddc4; --ink-dim: #d6b088; --muted: #a67c53; --gold: #c8792e; --gold-dim: #9c5f24; --line: #38230f; background: radial-gradient(120% 90% at 50% -10%, #3d2410 0%, var(--bg) 62%) fixed; }
body.solar-winter { --bg: #0a0f18; --bg-2: #101724; --panel: #121a2a; --panel-2: #182236; --ink: #dde6f5; --ink-dim: #aab9d5; --muted: #71809d; --gold: #7fa0cf; --gold-dim: #57708f; --line: #22304a; background: radial-gradient(120% 90% at 50% -10%, #1a2b48 0%, var(--bg) 64%) fixed; }
