/* AskACIM, "The Reading Room". Tokens follow docs/brand/DESIGN_SYSTEM.md (sections 1 to 4). */
:root {
  color-scheme: light dark;

  /* Base palette */
  --c-paper: #FBF8F1;
  --c-cream: #F4EEE2;
  --c-sand: #E6DCCB;
  --c-sand-deep: #CDBFA8;
  --c-ink: #2B2925;
  --c-ink-soft: #4A453E;
  --c-stone: #6B655C;
  --c-gold: #A8864E;
  --c-gold-ink: #7D6234;

  /* Semantic */
  --bg-page: var(--c-paper);
  --bg-raised: var(--c-cream);
  --bg-hover: var(--c-sand);
  --bg-inverse: var(--c-ink);
  --text-primary: var(--c-ink);
  --text-soft: var(--c-ink-soft);
  --text-secondary: var(--c-stone);
  --text-inverse: var(--c-paper);
  --text-reference: var(--c-gold-ink);
  --text-link-hover: #46576A;
  --text-action: #46576A;
  --border-subtle: var(--c-sand);
  --border-strong: var(--c-sand-deep);
  --accent-line: var(--c-gold);
  --focus-ring: #46576A;
  --state-error: #9A3B2E;
  --primary-hover: var(--c-ink-soft);

  /* Deck families (decorative bands and washes only) */
  --deck-mind: #66727C;
  --deck-shift: #B77D68;
  --deck-guidance: #7D8B7B;
  --deck-remembrance: #718A95;

  /* Type */
  --font-serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --t-display: clamp(2.5rem, 1.6rem + 3.9vw, 4rem);
  --t-h1: clamp(2rem, 1.4rem + 2.6vw, 3rem);
  --t-h2: clamp(1.625rem, 1.2rem + 1.7vw, 2.25rem);
  --t-h3: clamp(1.3125rem, 1.1rem + 0.9vw, 1.625rem);
  --t-lead: clamp(1.1875rem, 1.05rem + 0.55vw, 1.375rem);
  --t-body-serif: clamp(1.0625rem, 1rem + 0.2vw, 1.125rem);
  --t-body: 1rem;
  --t-small: 0.875rem;
  --t-label: 0.8125rem;
  --t-micro: 0.75rem;
  --measure: 68ch;

  /* Spacing, radius, elevation, motion */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px; --r-pill: 999px;
  --e-1: 0 1px 0 rgba(43, 41, 37, .06);
  --e-2: 0 1px 2px rgba(43, 41, 37, .06), 0 8px 24px rgba(43, 41, 37, .06);
  --e-3: 0 2px 4px rgba(43, 41, 37, .08), 0 16px 40px rgba(43, 41, 37, .10);
  --ease-out: cubic-bezier(.2, .7, .2, 1);
  --ease-in-out: cubic-bezier(.45, 0, .25, 1);
  --d-fast: 120ms; --d-base: 200ms; --d-slow: 400ms; --d-flip: 600ms;
}

/* Dark mode: the reading room at night. Warm, low glare, never blue-black. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-page: #1C1A17; --bg-raised: #26231F; --bg-hover: #33302A;
    --bg-inverse: #EDE7DC; --text-primary: #EDE7DC; --text-soft: #CFC7B9; --text-secondary: #A9A196;
    --text-inverse: #1C1A17; --text-reference: #C9A96E; --text-link-hover: #93A6BB; --text-action: #93A6BB;
    --border-subtle: #33302A; --border-strong: #4A453E; --accent-line: #C9A96E;
    --focus-ring: #93A6BB; --state-error: #E08A7A; --primary-hover: #D6CEBF;
    --e-1: 0 1px 0 rgba(0, 0, 0, .3);
    --e-2: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --e-3: 0 2px 4px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  --bg-page: #1C1A17; --bg-raised: #26231F; --bg-hover: #33302A;
  --bg-inverse: #EDE7DC; --text-primary: #EDE7DC; --text-soft: #CFC7B9; --text-secondary: #A9A196;
  --text-inverse: #1C1A17; --text-reference: #C9A96E; --text-link-hover: #93A6BB; --text-action: #93A6BB;
  --border-subtle: #33302A; --border-strong: #4A453E; --accent-line: #C9A96E;
  --focus-ring: #93A6BB; --state-error: #E08A7A; --primary-hover: #D6CEBF;
}

@media (prefers-reduced-motion: reduce) {
  :root { --d-fast: 0ms; --d-base: 0ms; --d-slow: 0ms; --d-flip: 200ms; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
body.page-deck { display: block; height: auto; min-height: 100%; }

:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 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;
}

/* Small-caps labels: margin labels, family names, "You" */
.eyebrow, .label-bot, .who, .fam-name, .slot-label, .dlg-slot, .dlg-label {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--t-label);
  line-height: 1.3;
  letter-spacing: .06em;
  font-variant-caps: all-small-caps;
  color: var(--text-secondary);
}

/* Header and wordmark */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  min-height: 64px; padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--border-subtle); background: var(--bg-page);
}
.wordmark {
  font-family: var(--font-serif); font-size: 1.75rem; line-height: 1;
  color: var(--text-primary); text-decoration: none; letter-spacing: -0.01em; white-space: nowrap;
}
.wordmark:hover { color: var(--text-link-hover); }
.wm-ask { font-style: italic; }
.wm-acim { font-variant-caps: small-caps; letter-spacing: .06em; font-weight: 500; }
.wordmark .logo { display: block; height: 88px; width: auto; }
/* The logo's wordmark is dark, so give it a light backing on dark backgrounds. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wordmark .logo { background: #f6f1e7; border-radius: 12px; padding: 4px 6px; }
}
:root[data-theme="dark"] .wordmark .logo { background: #f6f1e7; border-radius: 12px; padding: 4px 6px; }
.nav { display: flex; align-items: center; gap: var(--s-5); }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: 15px; font-weight: 600; color: var(--text-primary); text-decoration: none;
  border-bottom: 1px solid transparent;
}
.nav a:hover { color: var(--text-link-hover); }
.nav a[aria-current="page"] { border-bottom-color: var(--accent-line); }
/* The language link sits after the page links, a step quieter than them. */
.nav a.lang { font-weight: 500; color: var(--text-secondary); }
.nav a.lang:hover { color: var(--text-link-hover); }

.quiet {
  background: none; border: 0; color: var(--text-secondary); cursor: pointer;
  font: 500 15px/1 var(--font-sans); min-height: 44px; padding: 0 var(--s-2);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em;
}
.quiet:hover { color: var(--text-primary); }

/* Conversation */
#chat { flex: 1; overflow-y: auto; padding: var(--s-5) var(--s-5) var(--s-6); }
.toolbar { display: flex; justify-content: flex-end; max-width: 680px; margin: 0 auto var(--s-2); }
.wrap { max-width: 680px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s-6); }

.welcome { margin: var(--s-6) 0 var(--s-5); }
.greet {
  margin: var(--s-2) 0 0; font-family: var(--font-serif); font-weight: 400;
  font-size: var(--t-display); line-height: 1.1; letter-spacing: -0.01em; text-wrap: balance;
}
.hint {
  margin: var(--s-4) 0 var(--s-6); max-width: 36ch;
  font-family: var(--font-serif); font-size: var(--t-lead); line-height: 1.5;
}
.chips-label { margin: 0 0 var(--s-3); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: var(--r-pill);
  padding: var(--s-2) var(--s-4); min-height: 44px;
  font: 400 15px/1.3 var(--font-sans); text-align: left; cursor: pointer;
}
.chip:hover { background: var(--bg-hover); }

.noscript { max-width: 520px; margin: var(--s-7) auto; }
.noscript h2 { font-family: var(--font-serif); font-weight: 500; font-size: var(--t-h3); margin: 0 0 var(--s-3); }
.noscript p { color: var(--text-secondary); }

.msg { display: flex; }
.msg.user { flex-direction: row; }
.msg.bot { flex-direction: column; }

/* User message: a labelled sans block, no bubble shape, left rule */
.stack { display: flex; flex-direction: column; flex: 1; min-width: 0; gap: var(--s-1); }
.who { padding-left: 2px; }
.msg.user .bubble {
  max-width: 100%; background: var(--bg-raised); color: var(--text-primary);
  border-left: 2px solid var(--border-strong); border-radius: var(--r-sm);
  padding: var(--s-3) var(--s-4); font-family: var(--font-sans); font-size: var(--t-body);
  line-height: 1.5; white-space: pre-wrap; word-wrap: break-word;
}

/* Assistant answer: written on a sheet of papyrus in black ink, opened by a gold ornament rule.
   The sheet keeps its warm tone in both themes, so the ink is always the dark ink of the page. */
.msg.bot .bubble {
  max-width: min(100%, calc(var(--measure) + 2 * var(--s-5)));
  padding: var(--s-5) var(--s-5) var(--s-6);
  font-family: var(--font-serif); font-size: var(--t-body-serif);
  line-height: 1.6; color: #1F1A13; white-space: pre-wrap; word-wrap: break-word;
  background:
    radial-gradient(ellipse at 18% 10%, rgba(255, 250, 230, .65), transparent 55%),
    radial-gradient(ellipse at 90% 95%, rgba(120, 84, 36, .14), transparent 60%),
    repeating-linear-gradient(90deg, rgba(120, 84, 36, .025) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(0deg, rgba(110, 74, 30, .04) 0 2px, transparent 2px 11px),
    linear-gradient(165deg, #F1E4C4, #E2CDA2);
  border-radius: 3px 12px 5px 10px / 10px 4px 12px 5px;
  box-shadow:
    inset 0 0 0 1px rgba(125, 98, 52, .28),
    inset 0 0 34px rgba(120, 84, 36, .22),
    0 1px 2px rgba(60, 40, 10, .14),
    0 10px 26px -12px rgba(60, 40, 10, .35);
}
.msg.bot .bubble::before {
  content: ""; display: block; width: 32px; height: 1px;
  background: var(--accent-line); margin-bottom: var(--s-4);
}
.msg.bot .bubble.error {
  font-family: var(--font-sans); font-size: var(--t-body); color: var(--state-error);
  background: none; box-shadow: none; padding: 0; border-radius: 0;
}
.msg.bot .bubble.error::before { display: none; }
.label-bot { margin: var(--s-3) 0 0; }
/* Sits on top of the papyrus sheet that holds each reply. */
.voice {
  margin: 0 0 var(--s-2); font-family: var(--font-sans); font-weight: 600; font-size: var(--t-label);
  letter-spacing: .06em; font-variant-caps: all-small-caps; color: var(--text-secondary);
}

.typing { display: inline-flex; align-items: center; gap: var(--s-2); font-family: var(--font-sans); font-size: var(--t-small); color: var(--text-secondary); white-space: normal; }
.dots { display: inline-flex; gap: 5px; }
.dots span {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-secondary); opacity: .4; animation: blink 1.2s infinite;
}
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

/* The gold pen tip that travels with the ink while a line is being written; it is removed when the answer is complete. */
.nib {
  display: inline-block; width: 2px; height: 1.15em; margin-left: 2px; border-radius: 1px;
  background: linear-gradient(var(--c-gold), var(--c-gold-ink));
  vertical-align: -0.2em; transform: rotate(-14deg);
  animation: nib-pulse 1.1s ease-in-out infinite;
}
@keyframes nib-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* Composer */
footer.composer {
  border-top: 1px solid var(--border-subtle); background: var(--bg-page);
  padding: var(--s-3) var(--s-5) var(--s-3);
}
#captcha-box { max-width: 680px; margin: 0 auto var(--s-2); display: flex; justify-content: center; }
#captcha-box[hidden] { display: none; }
form#ask { max-width: 680px; margin: 0 auto; display: flex; gap: var(--s-2); align-items: flex-end; }
textarea {
  flex: 1; resize: none; min-height: 48px; max-height: 160px;
  padding: var(--s-3) var(--s-4); border: 1px solid var(--border-strong); border-radius: var(--r-lg);
  background: var(--bg-raised); color: var(--text-primary); box-shadow: var(--e-1);
  font: 400 16px/1.5 var(--font-sans); overflow-y: hidden;
}
textarea::placeholder { color: var(--text-secondary); opacity: 1; }
textarea:focus { outline: 2px solid var(--focus-ring); outline-offset: 3px; border-color: var(--text-primary); }
#send {
  background: var(--bg-inverse); color: var(--text-inverse); border: 0; border-radius: var(--r-md);
  min-height: 48px; min-width: 48px; padding: 0 var(--s-5);
  font: 600 16px/1 var(--font-sans); cursor: pointer;
}
#send:hover { background: var(--primary-hover); }
#send:disabled { opacity: .4; cursor: not-allowed; }
.note {
  max-width: 680px; margin: var(--s-2) auto 0; color: var(--text-secondary);
  font-size: var(--t-micro); line-height: 1.4;
}

/* ---------- Deck page ---------- */

/* Compact header and intro, so the cards are the main item. */
body.page-deck .top { min-height: 56px; padding: var(--s-2) var(--s-5); }
body.page-deck .wordmark { font-size: 1.5rem; }
body.page-deck .wordmark .logo { height: 56px; }
.deck-main { max-width: 960px; margin: 0 auto; padding: var(--s-4) var(--s-5) var(--s-9); }
.deck-intro { max-width: 40rem; }
.deck-intro h1 {
  margin: var(--s-1) 0 var(--s-1); font-family: var(--font-serif); font-weight: 500;
  font-size: var(--t-h2); line-height: 1.15; letter-spacing: -0.01em;
}
.deck-intro .clarify { margin: 0; color: var(--text-soft); font-size: var(--t-small); }
.deck-intro .about { margin-top: var(--s-2); }
.deck-intro .about summary {
  display: inline-flex; align-items: center; min-height: 44px; cursor: pointer;
  font-size: var(--t-small); font-weight: 600; color: var(--text-primary); list-style: none;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em;
}
.deck-intro .about summary::-webkit-details-marker { display: none; }
.deck-intro .about summary::after { content: "Show"; margin-left: var(--s-2); font-weight: 400; color: var(--text-secondary); }
.deck-intro .about[open] summary::after { content: "Hide"; }
.deck-intro .about summary:lang(es)::after { content: "Mostrar"; }
.deck-intro .about[open] summary:lang(es)::after { content: "Ocultar"; }
.deck-intro .about .lead { margin: var(--s-2) 0 0; font-family: var(--font-serif); font-size: var(--t-body-serif); line-height: 1.6; max-width: var(--measure); }

/* The hand */
.hand-stage { display: flex; flex-direction: column; align-items: center; gap: var(--s-4); margin-top: var(--s-5); }
.hand {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(12px, 3vw, 32px); width: 100%;
}
.hand-col { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); min-width: 0; }
.slot-label { margin: 0; text-align: center; text-wrap: balance; color: var(--text-soft); }

/* Each card is a button once it can be opened. Hover lifts it, and the press is reversed when released. */
button.dcard {
  appearance: none; display: block; width: 100%; margin: 0; padding: 0; border: 0;
  background: none; font: inherit; color: inherit; cursor: default;
  position: relative; aspect-ratio: 7 / 10; perspective: 1200px; border-radius: var(--r-lg);
  -webkit-tap-highlight-color: transparent;
}
.dcard-inner {
  position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform var(--d-flip) var(--ease-out);
}
.dcard.is-up .dcard-inner { transform: rotateY(180deg); }
.side {
  position: absolute; inset: 0; overflow: hidden; border-radius: var(--r-lg);
  background: var(--bg-raised); box-shadow: var(--e-2);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: box-shadow var(--d-base) var(--ease-out);
}
.side-back img { display: block; width: 100%; height: 100%; object-fit: cover; }
.side-front {
  transform: rotateY(180deg); display: flex; flex-direction: column;
  padding: 0 clamp(10px, 2.4vw, 18px) clamp(12px, 2.6vw, 18px);
  border-top: 5px solid var(--fam, var(--border-strong));
}
.fam-mind { --fam: var(--deck-mind); }
.fam-shift { --fam: var(--deck-shift); }
.fam-guidance { --fam: var(--deck-guidance); }
.fam-remembrance { --fam: var(--deck-remembrance); }
.face-top {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 6px;
  padding: 8px 0 6px; border-bottom: 1px solid var(--border-subtle);
}
.face-top .fam-name { font-size: 0.6875rem; letter-spacing: .04em; }
.card-id { margin-left: auto; font-size: 0.6875rem; color: var(--text-secondary); letter-spacing: .04em; font-variant-numeric: lining-nums tabular-nums; }
.art {
  flex: 1; min-height: 0; margin: 10px 0; border-radius: var(--r-sm); overflow: hidden;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--fam, var(--border-strong)) 14%, var(--bg-page));
  color: var(--c-gold);
}
.art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.art .mark { width: 34%; height: auto; opacity: .8; }
.card-title {
  margin: 0; font-family: var(--font-serif); font-weight: 500; text-align: center;
  font-size: clamp(1.05rem, 0.8rem + 1vw, 1.5rem); line-height: 1.15; text-wrap: balance;
}

/* Only revealed cards respond to the pointer. */
button.dcard.is-ready { cursor: pointer; transition: transform var(--d-base) var(--ease-out); }
button.dcard.is-ready:active { transform: translateY(-2px) scale(1.01); }
button.dcard.is-ready:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 4px; }
@media (hover: hover) {
  button.dcard.is-ready:hover { transform: translateY(-6px) scale(1.025); }
  button.dcard.is-ready:hover .side { box-shadow: var(--e-3); }
}

/* One gentle pass while the cards are shuffled: each column drifts a little, then settles. Not a loop. */
.hand.is-shuffling .dcard {
  animation: shuffle 2s var(--ease-in-out) both;
}
@keyframes shuffle {
  0%   { transform: none; }
  35%  { transform: translate(calc(var(--sx, 1) * -14px), -6px) rotate(calc(var(--sx, 1) * -2.5deg)); }
  70%  { transform: translate(calc(var(--sx, 1) * 10px), 4px) rotate(calc(var(--sx, 1) * 1.5deg)); }
  100% { transform: none; }
}

.status { margin: 0; min-height: 2.2em; text-align: center; color: var(--text-soft); font-size: var(--t-small); max-width: 36rem; }

/* The hint after the draw: bold, in the action colour, with a pointer, so it reads as something to click. */
.cta {
  display: flex; align-items: center; justify-content: center; gap: var(--s-2); margin: 0;
  font-size: var(--t-body); font-weight: 700; color: var(--text-action);
}
.cta-icon { width: 20px; height: 20px; flex: 0 0 auto; fill: currentColor; }

/* The breathing instructions rise over the middle of the hand, hold, then dissolve away before the next one. */
.hand-wrap { position: relative; width: 100%; max-width: 880px; }
.breath {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  display: flex; align-items: center; justify-content: center; padding: var(--s-4);
  /* A light veil over the cards, so the words read without a box around them. */
  background: color-mix(in srgb, var(--bg-page) 72%, transparent);
  opacity: 0; filter: blur(4px); transform: translateY(4px);
  transition: opacity 700ms var(--ease-in-out), filter 700ms var(--ease-in-out), transform 700ms var(--ease-in-out);
}
.breath.is-on { opacity: 1; filter: none; transform: none; }
.breath-text {
  margin: 0; max-width: 20rem; text-align: center; text-wrap: balance;
  font-family: var(--font-serif); font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem); line-height: 1.3; color: var(--text-primary);
}

.hand-actions { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); }
.btn {
  min-height: 48px; padding: 0 var(--s-5); border-radius: var(--r-md); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  font: 600 16px/1 var(--font-sans); color: var(--text-primary);
  background: transparent; border: 1px solid var(--border-strong);
}
.btn.primary { background: var(--bg-inverse); color: var(--text-inverse); border-color: transparent; }
.btn.primary:hover { background: var(--primary-hover); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* Reflection panel for one card */
.card-dialog {
  border: 0; border-radius: var(--r-lg); padding: 0;
  width: min(580px, calc(100% - 32px)); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  background: var(--bg-page); color: var(--text-primary); box-shadow: var(--e-3); overflow-y: auto;
}
.card-dialog::backdrop { background: rgba(28, 26, 23, .5); }
.card-dialog[open] { animation: dlg-in var(--d-base) var(--ease-out); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.dlg { padding: var(--s-6); border-top: 5px solid var(--fam, var(--border-strong)); }
.dlg-top { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: var(--s-2); }
.dlg-slot { margin: 0; }
.dlg-meta { margin: 0; color: var(--text-soft); font-size: var(--t-small); font-variant-numeric: lining-nums; }
.dlg-art {
  display: block; width: min(100%, 200px); height: auto; margin: var(--s-4) auto 0;
  border-radius: var(--r-sm); box-shadow: var(--e-2);
}
.dlg-title {
  margin: var(--s-4) 0 var(--s-2); font-family: var(--font-serif); font-weight: 500;
  font-size: var(--t-h2); line-height: 1.15;
}
.dlg-title:focus { outline: none; }
.dlg-headline { margin: 0 0 var(--s-2); font-family: var(--font-serif); font-style: italic; font-size: var(--t-lead); line-height: 1.4; }
.dlg-summary { margin: 0; color: var(--text-soft); font-size: var(--t-body); }
.dlg-block { margin-top: var(--s-5); }
.dlg-label { margin: 0 0 var(--s-2); }
.dlg-text { margin: 0; font-family: var(--font-serif); font-size: var(--t-body-serif); line-height: 1.6; max-width: var(--measure); }
.dlg-question {
  margin: 0; padding-left: var(--s-4); border-left: 2px solid var(--accent-line);
  font-family: var(--font-serif); font-style: italic; font-size: var(--t-lead); line-height: 1.5; max-width: var(--measure);
}
.dlg-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-6); }

.site-foot {
  max-width: 960px; margin: 0 auto; padding: var(--s-7) var(--s-5) var(--s-8);
  border-top: 1px solid var(--border-subtle); color: var(--text-secondary); font-size: var(--t-small);
}
.site-foot p { margin: 0 0 var(--s-3); max-width: 60ch; }
.site-foot a { color: var(--text-primary); }
.site-foot a:hover { color: var(--text-link-hover); }

/* Cookie notice (shown once, above the page) and cookie policy page */
.note a, .cookie-notice a, .policy a { color: var(--text-primary); }
.note a:hover, .cookie-notice a:hover, .policy a:hover { color: var(--text-link-hover); }

.cookie-notice {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3);
  padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-raised); color: var(--text-soft); font-size: var(--t-small); line-height: 1.5;
}
.cookie-notice p { margin: 0; max-width: 62ch; flex: 1 1 320px; }
.cookie-accept {
  min-height: 44px; min-width: 96px; padding: 0 var(--s-5); border: 0; border-radius: var(--r-md);
  background: var(--bg-inverse); color: var(--text-inverse); cursor: pointer;
  font: 600 15px/1 var(--font-sans);
}
.cookie-accept:hover { background: var(--primary-hover); }

.policy { max-width: 680px; margin: 0 auto; padding: var(--s-6) var(--s-5) var(--s-8); }
.policy h1 {
  margin: var(--s-1) 0 var(--s-2); font-family: var(--font-serif); font-weight: 500;
  font-size: clamp(2rem, 1.6rem + 2vw, 2.5rem); line-height: 1.15; text-wrap: balance;
}
.policy h2 {
  margin: var(--s-6) 0 var(--s-2); font-family: var(--font-serif); font-weight: 500;
  font-size: 1.375rem; line-height: 1.3;
}
.policy p, .policy li {
  font-family: var(--font-serif); font-size: var(--t-body-serif); line-height: 1.6; color: var(--text-soft);
}
.policy p { margin: 0 0 var(--s-3); }
.policy ul { margin: 0 0 var(--s-3); padding-left: var(--s-5); }
.policy code {
  font-family: ui-monospace, Consolas, monospace; font-size: .85em;
  background: var(--bg-raised); padding: 1px 5px; border-radius: var(--r-sm);
}
.policy-updated { margin: 0 0 var(--s-5); color: var(--text-secondary); font-size: var(--t-small); }
.policy-table { width: 100%; border-collapse: collapse; margin: var(--s-3) 0 var(--s-4); font-size: var(--t-small); }
.policy-table th, .policy-table td {
  text-align: left; vertical-align: top; padding: var(--s-3); border-bottom: 1px solid var(--border-subtle);
}
.policy-table thead th { color: var(--text-secondary); font-weight: 600; font-size: var(--t-label); letter-spacing: .04em; }
.policy-table tbody th { font-weight: 600; white-space: nowrap; }
.policy-table tbody th code { font-size: .9em; }
.policy-back { margin-top: var(--s-7); }

@media (max-width: 480px) {
  .cookie-notice { padding: var(--s-3) var(--s-4); }
  .policy { padding: var(--s-5) var(--s-4) var(--s-7); }
  .policy-table thead { display: none; }
  .policy-table, .policy-table tbody, .policy-table tr, .policy-table th, .policy-table td { display: block; width: 100%; }
  .policy-table tr { padding: var(--s-3) 0; border-bottom: 1px solid var(--border-subtle); }
  .policy-table th, .policy-table td { border: 0; padding: 2px 0; }
  .policy-table td::before { content: attr(data-label); display: block; color: var(--text-secondary); font-size: var(--t-micro); }
}

@media (max-width: 480px) {
  .top { padding: var(--s-2) var(--s-4); }
  #chat { padding: var(--s-4); }
  footer.composer { padding: var(--s-3) var(--s-4); }
  .wordmark { font-size: 1.5rem; }
  .wordmark .logo { height: 72px; }
  body.page-deck .wordmark .logo { height: 48px; }
  .nav { gap: var(--s-4); }
  .msg.bot .bubble { font-size: 1.0625rem; padding: var(--s-4) var(--s-4) var(--s-5); }
  .deck-main { padding: var(--s-3) var(--s-4) var(--s-8); }
  .hand { gap: 12px; }
  .slot-label { font-size: 0.6875rem; }
  .dlg { padding: var(--s-5); }
  .site-foot { padding: var(--s-6) var(--s-4); }
}

@media (prefers-reduced-motion: reduce) {
  .dcard-inner { transition-duration: 200ms; }
  .hand.is-shuffling .dcard { animation: none; }
  .dots span { animation: none; opacity: .6; }
  .nib { animation: none; }
  .breath { transition-duration: 200ms; filter: none; transform: none; }
}
