/*
 * pie.css — Exactly One Pie (home/pie-game.mjs; PLAN.E L28).
 *
 * A cabinet held still while the book goes by it. The story is serif; the
 * cabinet is a little theatre with a silent-film card over its screen, and on
 * either side the voyage flows: the chapter's own words on one, its wonders
 * on the other. The screen is a canvas that wears the page's own --hub-*
 * colours, so the game is bound in whatever cover the binder put on this copy.
 */

body[data-surface='monument'] .pie-main {
  padding-block: clamp(1.2rem, 3vw, 2.4rem) 1rem;
}

.pie-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.2rem, 3vw, 2rem);
  align-items: start;
}

/* On a wide screen the title stays above, slim; the voyage comes straight after it, and the
 * telling and the keys follow below, side by side. */
@media (min-width: 62rem) {
  .pie-stage {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    column-gap: clamp(1.2rem, 3vw, 2.4rem);
  }

  .pie-copy {
    display: contents;
  }

  .pie-copy-lead {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 1.2rem;
  }

  .pie-copy .pie-copy-lead h1 {
    order: -1;
    margin: 0;
    font-size: clamp(1.9rem, 3vw, 2.5rem);
  }

  .pie-voyage {
    grid-column: 1 / -1;
    order: 1;
  }

  .pie-copy-text,
  .pie-copy-how {
    order: 2;
    padding-top: 0.6rem;
  }
}

/* ─── The voyage: the cabinet held still; the chapter's words and wonders flow past on either side ─── */
.pie-voyage {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  justify-items: center;
}

.pie-voyage > * {
  width: 100%;
  max-width: 26rem;
}

@media (min-width: 62rem) {
  .pie-voyage {
    /* The cabinet as large as the window lets the whole screen show. */
    grid-template-columns: minmax(0, 1fr) clamp(18rem, calc((100vh - 20rem) * 0.643), 25rem) minmax(0, 1fr);
    gap: clamp(1rem, 2.4vw, 2rem);
    align-items: stretch;
    justify-items: stretch;
  }

  .pie-voyage > * {
    max-width: none;
  }
}

.pie-flow {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.pie-flow-head {
  margin: 0;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hub-muted);
}

.pie-flow-head a {
  color: var(--hub-accent-deep);
}

.pie-flow-head span {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--hub-display, Georgia, serif);
  font-size: 1.05rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--hub-ink);
}

.pie-flow-window {
  position: relative;
  flex: 1;
  min-height: 10rem;
  overflow: hidden;
  mask-image: linear-gradient(180deg, transparent, #000 16%, #000 80%, transparent);
}

.pie-flow-list {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  flex-direction: column-reverse;   /* the chapter begins at the foot and comes down past the carry */
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
  transition: transform 280ms linear;
  will-change: transform;
}

.pie-flow-para {
  max-width: 34rem;
  padding: 0.25rem 0.55rem 0.25rem 0.7rem;
  border-left: 2px solid transparent;
  border-radius: 0 0.4rem 0.4rem 0;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.9rem;
  line-height: 1.55;
  color: color-mix(in srgb, var(--hub-ink) 52%, transparent);
  transition: color 400ms ease, border-color 400ms ease, background-color 400ms ease;
}

.pie-flow-para.is-passing {
  border-left-color: var(--hub-gold);
  background: linear-gradient(90deg, color-mix(in srgb, var(--hub-gold) 11%, transparent), transparent 85%);
  color: var(--hub-ink);
}

/* A wonder's own words in the passage: they light while it waits up the lanes, and stay lit once kept. */
.pie-flow-term {
  padding: 0 0.14em;
  border-radius: 0.2em;
  background: transparent;
  color: inherit;
  text-decoration: underline dotted color-mix(in srgb, var(--hub-gold) 70%, transparent);
  text-underline-offset: 0.2em;
  transition: background-color 300ms ease, color 300ms ease, box-shadow 300ms ease;
}

.pie-flow-term.is-lit,
.pie-flow-term.is-peek {
  background: color-mix(in srgb, var(--hub-gold) 32%, transparent);
  color: var(--hub-ink);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--hub-gold) 24%, transparent);
}

.pie-flow-term.is-kept {
  color: var(--hub-ink);
  text-decoration: underline solid var(--hub-gold);
  text-decoration-thickness: 2px;
}

.pie-flow-voice {
  display: block;
  margin-bottom: 0.15rem;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hub-accent-deep);
}

.pie-flow-wonder-list {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pie-flow-wonder {
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr);
  column-gap: 0.55rem;
  align-items: center;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--hub-line);
  border-radius: 0.6rem;
  background: var(--hub-panel);
  transition: border-color 300ms ease, background-color 300ms ease, opacity 400ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.pie-flow-wonder:not(.is-quiet):hover {
  border-color: color-mix(in srgb, var(--hub-gold) 65%, var(--hub-line));
  transform: translateY(-1px);
}

.pie-flow-sigil {
  grid-row: span 3;
  display: grid;
  place-items: center;
  width: 1.9rem;
  height: 1.9rem;
  border: 2px solid var(--hub-gold);
  border-radius: 50%;
  font-family: var(--font-family-heading, monospace);
  font-weight: 700;
  color: var(--hub-accent-deep);
  transition: background-color 250ms ease, color 250ms ease, transform 250ms ease;
}

.pie-flow-wonder strong {
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
}

.pie-flow-gift {
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.78rem;
  font-style: italic;
  line-height: 1.25;
  color: color-mix(in srgb, var(--hub-ink) 74%, transparent);
}

.pie-flow-state {
  font-family: var(--font-family-heading, monospace);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hub-muted);
}

.pie-flow-wonder.is-known .pie-flow-sigil {
  border-style: dashed;
}

.pie-flow-wonder.is-here {
  border-color: var(--hub-gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hub-gold) 22%, transparent);
}

.pie-flow-wonder.is-here .pie-flow-state {
  color: var(--hub-gold);
}

.pie-flow-wonder.is-kept {
  background: color-mix(in srgb, var(--hub-gold) 14%, var(--hub-panel));
}

.pie-flow-wonder.is-kept .pie-flow-sigil {
  background: var(--hub-gold);
  color: var(--hub-paper);
}

.pie-flow-wonder.is-missed {
  opacity: 0.55;
}

.pie-flow-wonder.is-quiet {
  display: block;
  font-style: italic;
  color: var(--hub-muted);
}

.pie-flow-kept,
.pie-flow-note {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

.pie-flow-kept {
  font-style: italic;
  color: var(--hub-accent-deep);
}

.pie-flow-note {
  color: var(--hub-muted);
}

@media (max-width: 61.99rem) {
  .pie-flow-window {
    min-height: 9rem;
    max-height: 9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pie-flow-list {
    transition: none;
  }
}

.pie-copy h1 {
  margin: 0.2rem 0 0.8rem;
  color: var(--hub-ink);
  font-family: var(--hub-display, Georgia, serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 400;
  line-height: 1.02;
}

.pie-copy p:not(.hub-eyebrow) {
  max-width: 36rem;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 1.05rem;
  line-height: 1.62;
}

.pie-whisper {
  font-style: italic;
  color: var(--hub-muted);
}

.pie-how {
  display: grid;
  gap: 0.45rem;
  max-width: 36rem;
  margin: 1.2rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid var(--hub-line);
  border-radius: 0.8rem;
  background: var(--hub-panel);
}

.pie-how div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 0.6rem;
}

.pie-how dt {
  color: var(--hub-gold);
  font-family: var(--font-family-heading, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-top: 0.2rem;
}

.pie-how dd {
  margin: 0;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.92rem;
  line-height: 1.45;
}

.pie-best {
  font-style: italic;
  color: var(--hub-accent-deep);
}

.pie-doors {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  font-size: 0.92rem;
}

/* The cabinet: a little theatre for the screen. */
.pie-cabinet {
  --cabinet-glow: color-mix(in srgb, var(--hub-gold) 45%, var(--hub-line));
  position: sticky;
  top: 4.5rem;
  display: grid;
  gap: 0.7rem;
  padding: 0.75rem;
  border: 1px solid var(--cabinet-glow);
  border-radius: 1.1rem;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--hub-gold) 12%, transparent), transparent 32%),
    var(--hub-panel);
  box-shadow:
    0 20px 44px rgba(12, 16, 24, 0.16),
    inset 0 1px 0 color-mix(in srgb, #ffffff 35%, transparent);
  transition: border-color 350ms ease, box-shadow 350ms ease;
}

.pie-cabinet[data-cabinet-mood='boon'] {
  --cabinet-glow: #e0a23a;
  box-shadow: 0 20px 48px rgba(224, 162, 58, 0.22), 0 0 0 2px rgba(224, 162, 58, 0.25);
}

.pie-cabinet[data-cabinet-mood='bane'] {
  --cabinet-glow: #b04558;
  box-shadow: 0 20px 48px rgba(140, 36, 56, 0.24), 0 0 0 2px rgba(176, 69, 88, 0.26);
}

.pie-cabinet[data-cabinet-mood='warm'] {
  --cabinet-glow: #f0ad58;
  box-shadow: 0 20px 48px rgba(240, 173, 88, 0.22), 0 0 0 2px rgba(240, 173, 88, 0.25);
}

.pie-cabinet[data-cabinet-mood='poise'] {
  --cabinet-glow: color-mix(in srgb, var(--hub-accent) 60%, var(--hub-gold));
}

.pie-cabinet[data-cabinet-mood='danger'] {
  --cabinet-glow: #c0392b;
  box-shadow: 0 20px 48px rgba(192, 57, 43, 0.26), 0 0 0 2px rgba(192, 57, 43, 0.32);
}

.pie-screen {
  position: relative;
  overflow: hidden;
  border-radius: 0.7rem;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--hub-ink) 20%, transparent),
    inset 0 2px 8px rgba(10, 12, 16, 0.12);
}

.pie-screen canvas {
  display: block;
  width: 100%;
  aspect-ratio: 360 / 560;
  height: auto;
  touch-action: none;   /* swipes step; taps throw */
  cursor: crosshair;
}

/* The card: a silent-film title over the screen. */
.pie-card {
  position: absolute;
  inset: 9% 7%;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.1rem;
  border: 2px solid #d9c38a;
  outline: 1px solid rgba(217, 195, 138, 0.65);
  outline-offset: -7px;
  background:
    radial-gradient(circle at 50% 18%, rgba(217, 195, 138, 0.1), transparent 65%),
    rgba(12, 12, 14, 0.9);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  color: #f3ead6;
  text-align: center;
}

.pie-card[hidden] {
  display: none;
}

.pie-card-title {
  margin: 0;
  font-family: var(--hub-display, Georgia, serif);
  font-size: clamp(1.1rem, 3.2vw, 1.4rem);
  letter-spacing: 0.06em;
  line-height: 1.28;
  text-transform: uppercase;
}

.pie-card-line {
  margin: 0;
  max-height: 10.5rem;
  overflow-y: auto;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.92rem;
  font-style: italic;
  line-height: 1.48;
  color: #e0d4b8;
}

.pie-card-line:empty {
  display: none;
}

/* Chapter leg picker inside the silent-film card. */
.pie-card-chapters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.28rem;
  max-width: 100%;
  padding: 0.2rem 0.1rem;
}

.pie-card-chapters[hidden] {
  display: none;
}

.pie-card-chapters-label {
  width: 100%;
  margin-bottom: 0.1rem;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(233, 215, 168, 0.78);
}

.pie-card-chapter-btn {
  padding: 0.18rem 0.48rem;
  border: 1px solid rgba(217, 195, 138, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #e0d4b8;
  cursor: pointer;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.pie-card-chapter-btn:hover,
.pie-card-chapter-btn:focus-visible {
  border-color: #d9c38a;
  background: rgba(217, 195, 138, 0.18);
  color: #fff4d6;
}

.pie-card-chapter-btn.is-active {
  border-color: #f2c14e;
  background: rgba(242, 193, 78, 0.25);
  color: #fff8e6;
  font-weight: 700;
}

.pie-card-action {
  padding: 0.48rem 1.2rem;
  border: 1px solid #d9c38a;
  border-radius: 999px;
  background: rgba(217, 195, 138, 0.1);
  box-shadow: none;
  color: #f3ead6;
  cursor: pointer;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 1rem;
  transition: background-color 180ms ease, transform 150ms ease;
}

.pie-card-action:hover,
.pie-card-action:focus-visible {
  background: rgba(217, 195, 138, 0.24);
  outline: 2px solid #d9c38a;
  outline-offset: 2px;
}

.pie-steps {
  display: grid;
  grid-template-columns: 0.8fr 0.8fr 1.2fr 1.2fr 0.8fr 0.8fr;
  gap: 0.35rem;
}

.pie-step {
  padding: 0.68rem 0.45rem;
  border: 1px solid var(--hub-line);
  border-radius: 0.7rem;
  background: color-mix(in srgb, var(--hub-paper) 75%, transparent);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--hub-line) 75%, transparent);
  color: var(--hub-ink);
  cursor: pointer;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.84rem;
  letter-spacing: 0.04em;
  touch-action: manipulation;
  transition: border-color 160ms ease, background-color 160ms ease, transform 100ms ease;
}

.pie-step:hover,
.pie-step:focus-visible {
  border-color: var(--hub-gold);
}

.pie-step:active {
  background: color-mix(in srgb, var(--hub-gold) 20%, transparent);
  transform: translateY(1px);
}

.pie-jump {
  border-color: color-mix(in srgb, var(--hub-accent) 60%, var(--hub-line));
  font-weight: 700;
}

.pie-throw {
  padding-inline: 0.85rem;
  border-color: color-mix(in srgb, var(--hub-gold) 70%, var(--hub-line));
  color: var(--hub-ink);
  font-weight: 700;
}

.pie-keys-touch {
  display: none;
  font-size: 0.86rem !important;
  color: var(--hub-muted);
}

@media (max-width: 61.99rem) {
  .pie-cabinet {
    position: static;
  }

  /* On a phone the game comes first; the story follows it. */
  .pie-stage .pie-voyage {
    order: -1;
  }

  .pie-voyage .pie-cabinet {
    order: -1;
  }

  .pie-keys {
    display: none;
  }

  .pie-keys-touch {
    display: block;
  }
}

.pie-sound {
  justify-self: center;
  padding: 0.25rem 0.8rem;
  border: 1px solid var(--hub-line);
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--hub-muted);
  cursor: pointer;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.pie-sound[aria-pressed='true'] {
  color: var(--hub-ink);
  border-color: color-mix(in srgb, var(--hub-gold) 60%, var(--hub-line));
}

/* The way back to where the game was found. */
.pie-return {
  justify-self: start;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.86rem;
  font-style: italic;
}

.pie-return[hidden] {
  display: none;
}

/* Doors out of a card: into the chapter, or home. */
.pie-card-links {
  display: grid;
  gap: 0.35rem;
  margin: 0;
}

.pie-card-links:empty {
  display: none;
}

.pie-card-link {
  color: #e9d7a8;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.86rem;
  text-underline-offset: 3px;
}

.pie-card-link:hover,
.pie-card-link:focus-visible {
  color: #fff4d6;
}

/* ─── The caption: places and the pies' words, under the carry ──────────
 * Like subtitles: never across the screen. A line stays, quieter, until
 * the next, so it can be read again. Who is speaking colours its edge. */
.pie-caption {
  min-height: 4.8rem;
  padding: 0.55rem 0.8rem 0.6rem;
  border: 1px solid var(--hub-line);
  border-left: 4px solid var(--hub-gold);
  border-radius: 0.6rem;
  background: var(--hub-panel);
  opacity: 0.68;
  transition: opacity 400ms ease, border-color 300ms ease, box-shadow 300ms ease;
}

.pie-caption.is-in {
  opacity: 1;
  box-shadow: 0 4px 14px rgba(12, 16, 24, 0.06);
}

.pie-toast-title {
  margin: 0;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hub-accent-deep);
}

.pie-toast-line {
  margin: 0.25rem 0 0;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 1rem;
  font-style: normal;
  line-height: 1.45;
  color: var(--hub-ink);
}

.pie-toast-line:empty {
  display: none;
}

.pie-caption[data-voice='boon'] { border-left-color: #e0a23a; }
.pie-caption[data-voice='bane'] { border-left-color: #c0392b; }
.pie-caption[data-voice='flour'] { border-left-color: var(--hub-muted); }
.pie-caption[data-voice='wonder'] { border-left-color: var(--hub-accent); }
.pie-caption[data-voice='egg'] { border-left-color: #f0ad58; }

/* Keys, plainly. */
.pie-lede {
  font-size: 1.18rem !important;
}

.pie-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.2rem;
  margin: 1rem 0 0.3rem;
  padding: 0;
  list-style: none;
}

.pie-keys li {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.95rem;
}

.pie-keys kbd {
  min-width: 1.8rem;
  padding: 0.12rem 0.4rem;
  border: 1px solid var(--hub-line);
  border-bottom-width: 3px;
  border-radius: 0.35rem;
  background: var(--hub-panel);
  color: var(--hub-ink);
  font-family: var(--font-family-heading, monospace);
  font-size: 0.8rem;
  text-align: center;
}

/* ─── The legend: what everything is ──────────────────────────────────── */
.pie-legend,
.pie-lore {
  display: grid;
  gap: 1.2rem;
  margin-top: clamp(1.5rem, 4vw, 2.6rem);
}

.pie-section-head h2 {
  margin: 0.2rem 0 0.5rem;
  color: var(--hub-ink);
  font-family: var(--hub-display, Georgia, serif);
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  font-weight: 400;
}

.pie-section-head p:not(.hub-eyebrow) {
  max-width: 44rem;
  margin: 0;
  font-family: var(--font-family-body, Georgia, serif);
  line-height: 1.55;
  color: var(--hub-muted);
}

.pie-legend-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
}

.pie-legend-group {
  --tone: var(--hub-line);
  padding: 0.9rem 1rem;
  border: 1px solid var(--hub-line);
  border-top: 4px solid var(--tone);
  border-radius: 0.8rem;
  background: var(--hub-panel);
}

.pie-legend-group.tone-hazard { --tone: #b0453a; grid-row: span 2; }
.pie-legend-group.tone-slow { --tone: var(--hub-muted); }
.pie-legend-group.tone-friend { --tone: #d9a23a; }
.pie-legend-group.tone-presence { --tone: var(--hub-berry); }
.pie-legend-group.tone-carrier { --tone: var(--hub-ink); }

.pie-legend-group h3 {
  margin: 0;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--hub-ink);
}

.pie-legend-group h3 span {
  color: var(--tone);
}

.pie-legend-group > p {
  margin: 0.2rem 0 0.7rem;
  font-size: 0.88rem;
  font-style: italic;
  color: var(--hub-muted);
}

.pie-legend-group ul {
  display: grid;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pie-legend-group li {
  display: grid;
  grid-template-columns: 2.8rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
}

.pie-legend-group canvas,
.pie-lore h3 canvas {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--hub-paper) 70%, transparent);
}

.pie-legend-group li strong {
  display: block;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.95rem;
  color: var(--hub-ink);
}

.pie-legend-group li span {
  display: block;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 0.86rem;
  line-height: 1.4;
  color: var(--hub-muted);
}

/* ─── What the pies let slip ──────────────────────────────────────────── */
.pie-lore-count {
  font-family: var(--font-family-heading, monospace) !important;
  font-size: 0.76rem !important;
  letter-spacing: 0.06em;
  color: var(--hub-accent-deep) !important;
}

.pie-lore-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
}

.pie-lore-columns > section {
  padding: 0.9rem 1rem;
  border: 1px solid var(--hub-line);
  border-radius: 0.8rem;
  background: var(--hub-panel);
}

.pie-lore h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.6rem;
  font-family: var(--font-family-body, Georgia, serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--hub-ink);
}

.pie-lore-list {
  display: grid;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pie-lore-line {
  padding: 0.5rem 0.7rem;
  border-radius: 0.5rem;
  font-family: var(--font-family-body, Georgia, serif);
  line-height: 1.45;
}

.pie-lore-line.is-said {
  border-left: 3px solid var(--hub-gold);
  background: color-mix(in srgb, var(--hub-paper) 60%, transparent);
  color: var(--hub-ink);
}

.pie-lore-line.is-said q {
  display: block;
  font-size: 0.98rem;
}

.pie-lore-ground {
  display: inline-block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

.pie-lore-line.is-ready {
  border: 1px dashed var(--hub-gold);
  color: var(--hub-accent-deep);
  font-size: 0.86rem;
  font-style: italic;
}

.pie-lore-line.is-locked {
  border: 1px dashed var(--hub-line);
  color: var(--hub-muted);
  font-size: 0.86rem;
}

.pie-lore-line.is-locked::before {
  content: 'Locked · ';
  font-family: var(--font-family-heading, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Spoken, not shown: the live region for screen readers. */
.pie-cabinet .pie-live {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.pie-copy p {
  margin: 0 0 0.75rem;
}

/* The aura's two ingredients, at the foot of the screen beside the tilt. */
.pie-aura {
  --crust: 0.6;
  --filling: 0.6;
  position: absolute;
  left: 0.55rem;
  bottom: 0.42rem;
  display: grid;
  gap: 0.16rem;
  padding: 0.24rem 0.45rem 0.24rem 0.35rem;
  border: 1px solid color-mix(in srgb, var(--hub-ink) 14%, transparent);
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--hub-paper) 78%, transparent);
  backdrop-filter: blur(4px);
  pointer-events: none;
  transition: border-color 250ms ease, box-shadow 250ms ease;
}

.pie-aura.is-rich {
  border-color: color-mix(in srgb, var(--hub-gold) 65%, transparent);
  box-shadow: 0 0 10px rgba(224, 169, 90, 0.25);
}

.pie-aura p {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0;
}

.pie-aura em {
  width: 3.1rem;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.55rem;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hub-muted);
  text-align: right;
}

.pie-aura span {
  position: relative;
  width: 4.2rem;
  height: 0.38rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hub-ink) 16%, transparent);
  overflow: hidden;
}

.pie-aura span::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg,
      transparent 13.5%, rgba(22, 29, 43, 0.35) 14%, transparent 14.5%,
      transparent 84.5%, rgba(255, 255, 255, 0.55) 85%, transparent 85.5%);
  z-index: 2;
}

.pie-aura span::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  transition: width 120ms linear;
}

.pie-aura-crust::after {
  width: calc(var(--crust) * 100%);
  background: linear-gradient(90deg, #d8be82, #f1dc9e);
}

.pie-aura-filling::after {
  width: calc(var(--filling) * 100%);
  background: linear-gradient(90deg, #4d9f97, #f4b25c);
}

.pie-aura.is-thin em {
  color: #c0392b;
  font-weight: 700;
}

/* How far the pie is tilting: a small level along the screen's foot, to the right of the ingredients. */
.pie-meter {
  --wobble: 0;
  --lean: 0;
  position: absolute;
  right: 0.65rem;
  bottom: 0.55rem;
  width: 33%;
  height: 0.52rem;
  padding: 1px;
  border: 1px solid color-mix(in srgb, var(--hub-ink) 18%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--hub-paper) 78%, transparent);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.pie-meter span {
  display: block;
  width: calc(var(--wobble) * 100%);
  height: 100%;
  border-radius: inherit;
  background: color-mix(in srgb, var(--hub-gold) calc((1 - var(--wobble)) * 100%), #c0392b);
  transition: width 80ms linear;
}

.pie-meter-lean {
  position: absolute;
  top: 50%;
  left: calc(50% + var(--lean) * 42%);
  width: 0.42rem;
  height: 0.42rem;
  border: 1.5px solid var(--hub-ink);
  border-radius: 50%;
  background: var(--hub-paper);
  transform: translate(-50%, -50%);
  opacity: calc(min(1, var(--wobble) * 2.5));
  transition: left 90ms ease-out, opacity 180ms ease;
}

.pie-meter em {
  position: absolute;
  right: calc(100% + 0.38rem);
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-family-heading, monospace);
  font-size: 0.56rem;
  font-style: normal;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hub-muted);
}


/* ─── Where the mimes lead: the passage's pie words go quiet ─────────────
 * Harder to wonder about pie: drawn hollow, as if mimed. (pie-carries.mjs) */
.pie-flow-pie {
  transition: color 300ms ease;
}

.pie-flow-list.is-mimed .pie-flow-pie,
.pie-lore-line.is-mimed .pie-flow-pie {
  color: transparent;
  -webkit-text-stroke: 0.6px color-mix(in srgb, var(--hub-ink) 55%, transparent);
  text-decoration: underline dotted color-mix(in srgb, #7a3f9a 60%, transparent);
}

/* This chapter, so far: how it will be kept, and the contest with the mimes. */
.pie-flow-now {
  display: grid;
  gap: 0.3rem;
  padding: 0.6rem 0.7rem;
  border: 1px dashed var(--hub-line);
  border-radius: 0.6rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

.pie-flow-now:empty {
  display: none;
}

.pie-flow-now-head {
  font-family: var(--font-family-heading, monospace);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--hub-muted);
}

.pie-flow-now-line {
  color: var(--hub-ink);
}

.pie-flow-now-ties {
  font-size: 0.76rem;
  color: var(--hub-muted);
}

.pie-flow-slot {
  border-bottom: 1px dotted color-mix(in srgb, var(--hub-ink) 40%, transparent);
  cursor: pointer;
  transition: color 220ms ease, border-color 220ms ease;
}

.pie-flow-slot.is-turned {
  color: var(--hub-accent-deep);
  border-bottom-color: var(--hub-gold);
}

.pie-carries-ties {
  margin: 0.7rem 0 0;
  font-size: 0.88rem;
  line-height: 1.48;
  color: var(--hub-muted);
}

.pie-carries-ties code {
  padding: 0.06rem 0.36rem;
  border: 1px solid var(--hub-line);
  border-radius: 0.3rem;
  background: var(--hub-panel);
  color: var(--hub-ink);
  font-family: var(--font-family-heading, monospace);
  font-size: 0.8em;
}

.pie-flow-now-lean,
.pie-carries-lean {
  display: flex;
  height: 0.4rem;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hub-ink) 10%, transparent);
}

:is(.pie-flow-now-lean, .pie-carries-lean) i {
  display: block;
  min-width: 2px;
}

:is(.pie-flow-now-lean, .pie-carries-lean) .is-boon { background: #d9a23a; }
:is(.pie-flow-now-lean, .pie-carries-lean) .is-bane { background: #7a3f9a; }
:is(.pie-flow-now-lean, .pie-carries-lean) .is-bone { background: #9aa3ad; }

.pie-flow-now-contest {
  color: var(--hub-accent-deep);
}

.pie-flow-now-contest.is-mimes {
  color: #7a3f9a;
  font-style: italic;
}

/* The start card: chapters the mimes hold wear a dashed edge. */
.pie-card-chapter-btn.is-held {
  border-style: dashed;
  border-color: #7a3f9a;
}

/* ─── What your carries have done to the book ─────────────────────────── */
.pie-carries {
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

.pie-carries-lede {
  font-style: italic;
  color: var(--hub-accent-deep);
}

.pie-carries-list {
  display: grid;
  gap: 0.35rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.pie-carries-row {
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) minmax(5rem, 9rem);
  gap: 0.7rem;
  align-items: center;
  max-width: none;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--hub-line);
  border-radius: 0.55rem;
  background: var(--hub-panel);
  font-size: 0.92rem;
}

.pie-carries-row.is-uncarried {
  grid-template-columns: 2rem minmax(0, 1fr);
  color: var(--hub-muted);
  background: transparent;
  border-style: dashed;
}

.pie-carries-pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0.8rem 0 0;
  font-size: 0.88rem;
  color: var(--hub-muted);
}

.pie-carries-pending-n {
  display: inline-grid;
  place-items: center;
  min-width: 1.7rem;
  height: 1.7rem;
  border: 1px dashed var(--hub-line);
  border-radius: 999px;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.72rem;
  color: var(--hub-muted);
  text-decoration: none;
}

.pie-carries-pending-n:hover,
.pie-carries-pending-n:focus-visible {
  border-color: var(--hub-gold);
  color: var(--hub-ink);
}

.pie-carries-row.is-held {
  border-color: color-mix(in srgb, #7a3f9a 55%, var(--hub-line));
}

.pie-carries-n {
  font-family: var(--font-family-heading, monospace);
  font-weight: 700;
  color: var(--hub-muted);
}

.pie-carries-chip {
  display: inline-block;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-family: var(--font-family-heading, monospace);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

.pie-carries-chip.is-mimes {
  border: 1px dashed #7a3f9a;
  color: #7a3f9a;
}

.pie-carries-chip.is-back {
  border: 1px solid var(--hub-gold);
  color: var(--hub-accent-deep);
}

.pie-carries-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.9rem 0 0;
}

:is(.pie-carries-toggle, .pie-carries-forget) {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--hub-line);
  border-radius: 999px;
  background: var(--hub-panel);
  color: var(--hub-ink);
  font-family: var(--font-family-heading, monospace);
  font-size: 0.74rem;
  cursor: pointer;
}

.pie-carries-toggle[aria-pressed='true'] {
  border-color: var(--hub-gold);
}

.pie-carries-forget:hover {
  border-color: #c0392b;
}

@media (max-width: 40rem) {
  .pie-carries-row {
    grid-template-columns: 2rem minmax(0, 1fr);
  }
  .pie-carries-row .pie-carries-lean {
    grid-column: 2;
  }
}
