/* Zyrenicus Fictioneer chapter shell v1.49.6
 * Final chapter-only authority for the reading panel, action alignment, and
 * Fictioneer footer navigation. Loaded after cohesion and Cosmos styles.
 */

body.single-fcn_chapter.zy-cohesion-view {
  --zy-chapter-nav-bg: linear-gradient(180deg, rgba(37, 44, 58, 0.97), rgba(15, 19, 27, 0.99));
  --zy-chapter-nav-bg-hover: linear-gradient(180deg, rgba(47, 56, 72, 0.99), rgba(19, 24, 33, 1));
  --zy-chapter-nav-border: rgba(222, 228, 244, 0.16);
  --zy-chapter-nav-border-next: rgba(247, 214, 141, 0.24);
  --zy-chapter-nav-text: rgba(244, 247, 252, 0.94);
  --zy-chapter-nav-accent: rgba(255, 226, 160, 0.94);
  --zy-chapter-nav-shadow: 0 12px 25px rgba(0, 0, 0, 0.21), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Remove only the obsolete decorative wrapper pseudo-elements. Fictioneer
 * retains ownership of the real reader's position, overflow, and box model. */
body.single-fcn_chapter.zy-cohesion-view .main__wrapper::before,
body.single-fcn_chapter.zy-cohesion-view .main__wrapper::after {
  content: none !important;
  display: none !important;
}

/* Keep Fictioneer controls as the base component, but normalize icon and text
 * boxes so mixed Font Awesome, SVG, and child-theme glyphs share one baseline. */
body.single-fcn_chapter.zy-cohesion-view .chapter__actions :is(.button, a.button, .popup-menu-toggle) {
  box-sizing: border-box;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  line-height: 1;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__actions--top :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle) {
  min-height: 2.3rem;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__actions :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle) > :is(
  i,
  svg,
  .icon,
  [class$="__icon"],
  [class$="__glyph"]
) {
  flex: 0 0 auto;
  line-height: 1;
  vertical-align: middle;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__actions :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle) > svg {
  display: block;
  width: 1em;
  height: 1em;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__actions :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle) > :is(
  .label,
  .text,
  .button__label,
  [class$="__label"]
) {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  line-height: 1.1;
}

body.single-fcn_chapter.zy-cohesion-view .zy-extra-nav-button__glyph,
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cosmos-toggle__state {
  display: inline-grid;
  place-items: center;
}

/* The bottom rail keeps Fictioneer's left/centre/right structure. Empty sides
 * remain empty, so first and final chapters do not invent placeholder controls. */
body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
  --zy-footer-nav-gap: clamp(0.48rem, 1.35vw, 0.78rem);
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: var(--zy-footer-nav-gap) !important;
  margin-top: clamp(1.3rem, 3vw, 2.1rem);
  padding: clamp(0.54rem, 1.4vw, 0.74rem);
  border-radius: 20px;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom > .chapter__actions-container {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 0.42rem;
  width: auto;
  min-width: 0;
  max-width: 100%;
  overflow: visible;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(
  .chapter__actions-left,
  .chapter__actions-center,
  .chapter__actions-right
) {
  display: flex;
  align-items: center;
  min-width: 0;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .chapter__actions-left {
  grid-column: 1;
  justify-content: flex-end;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .chapter__actions-center {
  grid-column: 2;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.42rem;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .chapter__actions-right {
  grid-column: 3;
  justify-content: flex-start;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(
  .chapter__actions-left,
  .chapter__actions-center,
  .chapter__actions-right
):empty {
  display: none;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button {
  position: relative;
  isolation: isolate;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.52rem !important;
  width: min(100%, 12.5rem) !important;
  min-width: 0 !important;
  max-width: 12.5rem !important;
  min-height: 46px !important;
  padding: 0.55rem 0.82rem !important;
  overflow: hidden;
  border: 1px solid var(--zy-chapter-nav-border);
  border-radius: 14px !important;
  background: var(--zy-chapter-nav-bg);
  color: var(--zy-chapter-nav-text);
  box-shadow: var(--zy-chapter-nav-shadow);
  text-align: center;
  text-decoration: none;
  white-space: normal;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background 180ms ease, filter 180ms ease;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button--next {
  flex-direction: row-reverse;
  border-color: var(--zy-chapter-nav-border-next);
  box-shadow: var(--zy-chapter-nav-shadow), 0 0 20px rgba(245, 205, 110, 0.08);
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button:hover,
body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button:focus-visible {
  border-color: rgba(255, 226, 160, 0.34);
  background: var(--zy-chapter-nav-bg-hover);
  box-shadow: var(--zy-chapter-nav-shadow), 0 0 22px rgba(245, 205, 110, 0.10);
  filter: brightness(1.035);
  transform: translateY(-1px);
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button--prev:hover,
body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button--prev:focus-visible {
  box-shadow: var(--zy-chapter-nav-shadow), 0 0 20px rgba(176, 207, 255, 0.09);
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button:focus-visible {
  outline: 2px solid rgba(255, 226, 160, 0.48);
  outline-offset: 3px;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button:active {
  filter: brightness(0.99);
  transform: translateY(0);
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button__icon {
  position: relative;
  z-index: 1;
  display: inline-grid;
  place-items: center;
  flex: 0 0 1.72rem;
  width: 1.72rem;
  height: 1.72rem;
  border: 1px solid rgba(255, 226, 160, 0.19);
  border-radius: 999px;
  background: radial-gradient(circle at 35% 30%, rgba(255, 232, 184, 0.18), rgba(255, 232, 184, 0.04) 54%, rgba(0, 0, 0, 0.12));
  color: var(--zy-chapter-nav-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 12px rgba(241, 202, 110, 0.07);
  font-family: Arial, sans-serif;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button--prev .zy-chapter-nav-button__icon::before {
  content: "←";
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button--next .zy-chapter-nav-button__icon::before {
  content: "→";
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button.is-locked .zy-chapter-nav-button__icon::before {
  content: "✦";
  font-size: 0.74rem;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button__copy {
  position: relative;
  z-index: 1;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button__eyebrow {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-family: "Cinzel", var(--ff-heading);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.1em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Next remains visually primary through border colour, not permanent motion. */


/* Keep any parent-theme centre utilities compact and secondary. */
body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(.button, a.button):not(.zy-chapter-nav-button) {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  max-width: min(11rem, 100%);
  min-height: 34px;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  font-size: 0.64rem;
  line-height: 1;
  letter-spacing: 0.08em;
  white-space: nowrap;
  opacity: 0.88;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(.button, a.button):not(.zy-chapter-nav-button):hover,
body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(.button, a.button):not(.zy-chapter-nav-button):focus-visible {
  opacity: 1;
}

body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom :is(.button, a.button):not(.zy-chapter-nav-button) :is(.button__label, .label, .text) {
  min-width: 0;
  overflow: visible;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view {
  --zy-chapter-nav-bg: linear-gradient(180deg, rgba(255, 252, 245, 0.97), rgba(244, 237, 225, 0.99));
  --zy-chapter-nav-bg-hover: linear-gradient(180deg, rgba(255, 255, 250, 0.99), rgba(244, 236, 221, 1));
  --zy-chapter-nav-border: rgba(181, 144, 65, 0.17);
  --zy-chapter-nav-border-next: rgba(181, 144, 65, 0.24);
  --zy-chapter-nav-text: rgba(59, 50, 39, 0.94);
  --zy-chapter-nav-accent: rgba(132, 91, 24, 0.94);
  --zy-chapter-nav-shadow: 0 12px 24px rgba(95, 63, 19, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.84);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button__icon {
  border-color: rgba(160, 113, 31, 0.18);
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.92), rgba(229, 208, 167, 0.26) 62%, rgba(165, 120, 42, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 12px rgba(181, 140, 60, 0.08);
}


@media (max-width: 1023px) {
  body.single-fcn_chapter.zy-cohesion-view .chapter__actions {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (max-width: 720px) {
  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
    padding: 0.5rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 0.46rem !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .chapter__actions-left {
    grid-column: 1;
    grid-row: 1;
    justify-content: stretch;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .chapter__actions-right {
    grid-column: 2;
    grid-row: 1;
    justify-content: stretch;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .chapter__actions-center {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button {
    width: 100% !important;
    max-width: none !important;
    min-height: 42px !important;
    padding-inline: 0.62rem !important;
  }
}

@media (max-width: 380px) {
  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button {
    gap: 0.38rem !important;
    padding-inline: 0.48rem !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button__icon {
    flex-basis: 1.52rem;
    width: 1.52rem;
    height: 1.52rem;
    font-size: 0.76rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button__eyebrow {
    font-size: 0.69rem;
    letter-spacing: 0.07em;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button {
    transition: none;
  }

}

/* Chapter-header authority.
 * The chapter identity is primary, the reading controls are a compact one-line
 * utility rail, and the constellation is secondary navigation below both. */
body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top {
  width: 100%;
  margin: 0.72rem auto 0.42rem;
  padding: 0.36rem 0.42rem;
  border: 1px solid rgba(222, 228, 244, 0.14);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(31, 37, 49, 0.96), rgba(14, 18, 26, 0.98));
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top .chapter__actions-container {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: clamp(0.24rem, 0.7vw, 0.38rem) !important;
  min-height: 0;
  overflow: visible;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle) {
  flex: 0 1 auto !important;
  min-width: 0 !important;
  min-height: 2.04rem !important;
  height: 2.04rem;
  padding: 0.3rem 0.54rem !important;
  border-radius: 999px;
  box-shadow: none;
  white-space: nowrap;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(.anchor.button, .button--bookmark, .button--fullscreen, .open, .popup-menu-toggle) {
  min-width: 2.04rem !important;
  padding-inline: 0.46rem !important;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top .button._navigation {
  min-width: 0 !important;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top .zy-chapter-cosmos-toggle.is-inline-actions {
  margin: 0;
  min-height: 2.04rem !important;
  height: 2.04rem;
  padding: 0.24rem 0.44rem !important;
  box-shadow: none;
}

/* The chapter map should read as a compact navigation instrument, not a second
 * hero panel. Its JS sets the track width so 8–14 chapters use the available
 * rail while shorter books remain centred and proportionate. */
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation {
  border-radius: 16px;
  box-shadow: 0 9px 22px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__header {
  margin-bottom: 0.24rem;
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__fact {
  min-height: 1.34rem;
  padding: 0.18rem 0.54rem;
}

/* Light mode uses deliberately flatter surfaces. Dark-mode glow shadows looked
 * acceptable against black but became obvious grey halos on the paper palette. */
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top {
  border-color: rgba(151, 112, 45, 0.18);
  background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(244, 238, 228, 0.98));
  box-shadow: 0 4px 12px rgba(91, 63, 22, 0.05);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(.button, a.button, .popup-menu-toggle) {
  border-color: rgba(151, 112, 45, 0.16) !important;
  background: rgba(255, 253, 248, 0.82) !important;
  color: rgba(61, 51, 39, 0.94) !important;
  box-shadow: none !important;
  text-shadow: none !important;
  filter: none;
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(.button, a.button, .popup-menu-toggle):hover,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(.button, a.button, .popup-menu-toggle):focus-visible {
  border-color: rgba(145, 101, 30, 0.3) !important;
  background: rgba(255, 255, 252, 0.98) !important;
  box-shadow: 0 2px 8px rgba(91, 63, 22, 0.06) !important;
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cosmos-toggle.is-inline-actions {
  border-color: rgba(151, 112, 45, 0.18);
  background: rgba(255, 250, 239, 0.88);
  color: rgba(91, 63, 22, 0.94);
  box-shadow: none;
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cosmos-toggle__label,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cosmos-toggle__state {
  color: rgba(114, 75, 18, 0.94);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cosmos-toggle__state {
  border-color: rgba(151, 112, 45, 0.18);
  background: rgba(181, 137, 56, 0.08);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation {
  border-color: rgba(151, 112, 45, 0.16);
  background:
    radial-gradient(circle at 14% 22%, rgba(100, 142, 196, 0.08), transparent 24%),
    radial-gradient(circle at 82% 76%, rgba(181, 137, 56, 0.09), transparent 25%),
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(243, 237, 227, 0.98));
  box-shadow: 0 5px 14px rgba(91, 63, 22, 0.055);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__eyebrow {
  color: rgba(70, 59, 45, 0.92);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__meta,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__fact {
  color: rgba(82, 70, 55, 0.7);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__readout {
  border-color: rgba(151, 112, 45, 0.13);
  background: rgba(255, 255, 252, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
  color: rgba(61, 51, 39, 0.9);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__fact {
  border-color: rgba(151, 112, 45, 0.12);
  background: rgba(255, 255, 252, 0.58);
}

/* Metallic clipping belongs to the dark Cosmos presentation. On the paper
 * palette it washes text towards white and turns the glow stack into a halo. */
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__story-link,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__title,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__author,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__author a {
  background: none !important;
  background-image: none !important;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  filter: none;
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__story-link {
  color: #665a4b !important;
  text-shadow: none;
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__title {
  color: #74561f !important;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__author,
:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__author a {
  color: #756b60 !important;
  text-shadow: none;
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment {
  stroke: rgba(145, 104, 38, 0.42);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__number {
  color: rgba(91, 72, 47, 0.78);
  text-shadow: none;
}

@media (max-width: 720px) {
  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top {
    margin-top: 0.62rem;
    padding: 0.32rem 0.34rem;
  }

  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top .chapter__actions-container {
    justify-content: flex-start !important;
  }

  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle) {
    min-height: 2rem !important;
    height: 2rem;
  }
}


/* Intrinsic-width containment.
 * Fictioneer's header is a grid and browser grid items default to min-width:
 * auto. A full action row or a JS-sized constellation could therefore enlarge
 * the entire chapter column on narrow screens instead of scrolling internally. */
body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links,
body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > *,
body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top,
body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .zy-chapter-constellation,
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__viewport {
  min-width: 0;
  max-width: 100%;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top {
  overflow: visible;
}

body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top .chapter__actions-container {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

@media (max-width: 480px) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__header {
    gap: 0.4rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__eyebrow,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__meta {
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    white-space: nowrap;
  }
}

/* v1.47.4 panel-width responsiveness.
 * Fictioneer can narrow the chapter reading surface without narrowing the
 * browser viewport. Viewport media queries therefore miss the exact state in
 * which the bespoke chapter controls need to reflow. The real Fictioneer reading wrapper is the
 * named `zy-reader` inline-size container so controls respond to the panel they actually
 * occupy. Existing viewport media queries remain as fallbacks for browsers
 * without container-query support. */
body.single-fcn_chapter.zy-cohesion-view .main__wrapper {
  container-name: zy-reader;
  container-type: inline-size;
}

@container zy-reader (max-width: 760px) {
  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top {
    padding: 0.34rem;
  }

  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top .chapter__actions-container {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 0.32rem !important;
    overflow-x: visible;
    overflow-y: visible;
  }

  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(
    .chapter__actions-left,
    .chapter__actions-center,
    .chapter__actions-right
  ) {
    display: flex;
    flex: 0 1 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.32rem;
    min-width: 0;
  }

  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle) {
    flex: 0 1 auto !important;
    max-width: 100%;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation {
    --zy-constellation-node-gap: 0.62rem;
    padding-inline: 0.68rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__header {
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.28rem 0.72rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__meta {
    margin-left: auto;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__readout {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(8.5rem, 100%), 1fr));
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__fact {
    min-width: 0;
    padding-inline: 0.48rem;
    text-align: center;
  }


  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
    padding: 0.5rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 0.46rem !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .chapter__actions-left {
    grid-column: 1;
    grid-row: 1;
    justify-content: stretch;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .chapter__actions-right {
    grid-column: 2;
    grid-row: 1;
    justify-content: stretch;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .chapter__actions-center {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button {
    width: 100% !important;
    max-width: none !important;
    min-height: 42px !important;
    padding-inline: 0.62rem !important;
  }
}

@container zy-reader (max-width: 560px) {
  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top {
    border-radius: 13px;
    padding: 0.3rem;
  }

  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top .chapter__actions-container {
    gap: 0.28rem !important;
  }

  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(.button, a.button, .popup-menu-toggle, .zy-chapter-cosmos-toggle) {
    min-height: 1.94rem !important;
    height: 1.94rem;
    padding-inline: 0.42rem !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-cosmos-toggle.is-inline-actions {
    padding-inline: 0.38rem !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation {
    --zy-constellation-track-padding-inline: 0.55rem;
    --zy-constellation-track-padding-block: 0.92rem;
    padding: 0.52rem 0.56rem 0.58rem;
    border-radius: 14px;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__eyebrow,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__meta {
    font-size: 0.66rem;
    letter-spacing: 0.11em;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__readout {
    min-height: 0;
    padding: 0.32rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    line-height: 1.28;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__facts {
    gap: 0.28rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__fact {
    min-height: 1.42rem;
    font-size: 0.6rem;
    letter-spacing: 0.055em;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__viewport {
    mask-image: linear-gradient(90deg, transparent 0, #000 0.55rem, #000 calc(100% - 0.55rem), transparent 100%);
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 0.55rem, #000 calc(100% - 0.55rem), transparent 100%);
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-utility-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-utility-actions .zy-extra-nav-button {
    width: 100%;
    min-width: 0;
  }
}

@container zy-reader (max-width: 420px) {
  body.single-fcn_chapter.zy-cohesion-view header.chapter__headline.layout-links > .chapter__actions--top :is(
    .chapter__actions-left,
    .chapter__actions-center,
    .chapter__actions-right
  ) {
    flex: 1 1 100%;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation {
    --zy-node-offset-scale: 0.78;
    padding-inline: 0.48rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.2rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__meta {
    margin-left: 0;
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__facts {
    grid-template-columns: minmax(0, 1fr);
  }

  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__tooltip {
    max-width: calc(100% - 0.65rem);
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button {
    gap: 0.38rem !important;
    padding-inline: 0.48rem !important;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button__icon {
    flex-basis: 1.52rem;
    width: 1.52rem;
    height: 1.52rem;
    font-size: 0.76rem;
  }

  body.single-fcn_chapter.zy-cohesion-view .chapter__footer.chapter__actions--bottom .zy-chapter-nav-button__eyebrow {
    font-size: 0.69rem;
    letter-spacing: 0.07em;
  }
}

/* Chapter constellation position emphasis.
 * Keep the map compact and navigational, but make current/next position read
 * more clearly without adding another canvas or coupling effects to scroll. */
body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__readout {
  border-radius: 10px;
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__fact {
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment.is-next {
  animation: zy-constellation-next-route 4.8s linear infinite;
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__node.is-current .zy-chapter-constellation__link::after {
  content: "";
  position: absolute;
  inset: 0.12rem;
  border: 1px solid rgba(255, 226, 166, 0.38);
  border-right-color: rgba(255, 226, 166, 0.08);
  border-bottom-color: rgba(255, 226, 166, 0.14);
  border-radius: 50%;
  box-shadow: 0 0 9px rgba(255, 214, 140, 0.12);
  pointer-events: none;
  opacity: 0.72;
  animation: zy-constellation-current-orbit 9s linear infinite;
}

body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__node.is-current.is-locked .zy-chapter-constellation__link::after {
  border-color: rgba(255, 180, 102, 0.4);
  border-right-color: rgba(255, 180, 102, 0.08);
  border-bottom-color: rgba(255, 180, 102, 0.14);
  box-shadow: 0 0 9px rgba(255, 166, 76, 0.14);
}

:root[data-mode="light"] body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__node.is-current .zy-chapter-constellation__link::after {
  border-color: rgba(139, 96, 27, 0.4);
  border-right-color: rgba(139, 96, 27, 0.08);
  border-bottom-color: rgba(139, 96, 27, 0.14);
  box-shadow: none;
}

@keyframes zy-constellation-next-route {
  to { stroke-dashoffset: -16; }
}

@keyframes zy-constellation-current-orbit {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce), (forced-colors: active) {
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__segment.is-next,
  body.single-fcn_chapter.zy-cohesion-view .zy-chapter-constellation__node.is-current .zy-chapter-constellation__link::after {
    animation: none;
  }
}
