.reader-header, .reader {
  max-inline-size: 760px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 34px);
}
.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-block-size: 68px;
}
.reader-header-actions { display:flex; align-items:center; gap:10px; }
.reader-header a { font-weight: 700; }
.reader { padding-block-end: 48px; }
.reader-stage { margin-block-end: 10px; color: var(--muted); font-size: .9rem; }
.reader-stage span { margin-inline: .3em; }
.reader-art {
  display: block;
  inline-size: 100%;
  block-size: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 18px;
  background: var(--sage);
}
.reader-page { margin-block-start: 24px; }
.reader-page.decision-page { margin-block-start: 28px; padding: clamp(22px, 4vw, 38px); border-radius: 20px; background: var(--sage); text-align: center; }
.decision-kicker { margin: 0 0 10px; color: var(--muted); font-size: .9rem; font-weight: 700; letter-spacing: .04em; }
.reader-page h1 { font-size: clamp(1.7rem, 5vw, 2.4rem); }
.decision-page h1 { max-inline-size: 24ch; margin-inline: auto; }
.reader-page h1:focus { outline: none; }
.reader-passage, .reader-prompt { margin-block-start: 14px; font-size: 1.12rem; }
.decision-page .reader-passage { max-inline-size: 54ch; margin-inline: auto; }
.reader-prompt { border-inline-start: 3px solid var(--amber); padding-inline-start: 14px; color: var(--muted); }
.reader-offer { margin-block-start: 22px; padding: clamp(20px, 4vw, 30px); border: 1px solid var(--line); border-radius: 18px; background: var(--sage); }
.reader-offer h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); }
.reader-offer-description { margin-block-start: 8px; color: var(--muted); }
.reader-offer-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 18px; }
.reader-offer-actions a { display: inline-flex; align-items: center; justify-content: center; min-block-size: 48px; padding: 10px 18px; border: 1px solid var(--control-border); border-radius: 100px; font-weight: 700; text-align: center; }
.reader-offer-secondary { color: var(--ink); background: transparent; }
.reader-offer-secondary:hover { background: var(--paper); }
.reader-offer-primary { border-color: var(--button-bg) !important; color: var(--button-fg); background: var(--button-bg); }
.reader-offer-primary:hover { border-color: var(--button-hover) !important; background: var(--button-hover); }
.reader-end { margin-block-start: 14px; font-weight: 700; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 20px; }
.reader-actions:empty { display: none; }
.reader-actions.decision-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-inline-size: 660px; margin: 24px auto 0; gap: 12px; }
.reader .choice-option { display: flex; align-items: center; justify-content: center; min-block-size: 76px; padding: 14px 18px; border: 1px solid var(--control-border); border-radius: 16px; background: var(--paper); color: var(--ink); text-align: center; line-height: 1.4; transition: background-color 150ms ease, color 150ms ease, transform 150ms ease; }
.reader .choice-option:hover { background: var(--button-bg); color: var(--button-fg); border-color: var(--button-bg); transform: translateY(-2px); }
.reader-navigation { display: flex; direction: ltr; justify-content: space-between; align-items: center; min-block-size: 56px; margin-block-start: 20px; }
.reader-nav-button { min-inline-size: 96px; min-block-size: 48px !important; padding: 10px 20px; border: 1px solid var(--control-border); border-radius: 100px; font-size: 1rem; }
.reader-back { background: transparent; color: var(--ink); }
.reader-back:hover { background: var(--sage); }
.reader-next { border-color: var(--button-bg); background: var(--button-bg); color: var(--button-fg); }
.reader-next:hover { background: var(--button-hover); border-color: var(--button-hover); }
.reader button, .reader-header button { cursor: pointer; font: inherit; font-weight: 700; min-block-size: 44px; }
.reader .button { border: 0; }
.reader-secondary { background: transparent; color: var(--ink); border: 1px solid var(--control-border); border-radius: 100px; padding: 8px 16px; }
.reader button:focus-visible, .reader-header button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (max-width: 500px) {
  .reader-actions:not(.decision-options) { flex-direction: column; align-items: stretch; }
  .reader-actions .button { justify-content: center; }
  .reader-actions.decision-options { grid-template-columns: 1fr; gap: 10px; }
  .reader-page.decision-page { padding: 22px 18px; }
  .reader-offer-actions { flex-direction: column; align-items: stretch; }
}
.reader-art { aspect-ratio: 1200 / 896; object-fit: contain; }
.reader-progress { display:flex; gap:5px; margin-block: 0 14px; }
.reader-progress span { flex:1; height:4px; border-radius:4px; background:var(--tick); }
.reader-progress span.active { background:var(--ink); }

:is(:root:fullscreen body, body.reader-fullscreen) {
  --ink: #f7f3e8;
  --muted: #d1ddd2;
  --paper: #26362d;
  --sage: #26362d;
  --line: #586c5f;
  --tick: #4d6256;
  --control-border: #889c90;
  --button-bg: #e7bd70;
  --button-fg: #182720;
  --button-hover: #f4cf8c;
  position: fixed;
  z-index: 9999;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: auto;
  background: #18251e;
}

:is(:root:fullscreen body, body.reader-fullscreen) .reader-header {
  position: relative;
  z-index: 10;
  flex: 0 0 auto;
  width: 100%;
  max-inline-size: none;
  min-block-size: 0;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding-block: 4px;
}
:is(:root:fullscreen body, body.reader-fullscreen) #fullscreen {
  position: relative;
  z-index: 11;
  min-block-size: 48px;
  padding-inline: 16px;
  touch-action: manipulation;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-header-actions {
  flex-wrap: wrap;
  gap: 4px;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-secondary { padding: 4px 10px; }
:is(:root:fullscreen body, body.reader-fullscreen) .reader {
  display: grid;
  flex: 1 0 0;
  grid-template-rows: auto minmax(100px, 1fr) auto;
  inline-size: 100%;
  max-inline-size: none;
  min-block-size: 0;
  padding: 0;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-stage {
  margin-inline: clamp(16px, 4vw, 34px);
  margin-block: 0;
  font-size: .8rem;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-progress { display: none; }
:is(:root:fullscreen body, body.reader-fullscreen) .reader-illustration {
  position: relative;
  min-block-size: 0;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-art {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  max-block-size: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 0;
  background: transparent;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-caption {
  max-block-size: 33vh;
  max-block-size: 33dvh;
  overflow: auto;
  padding: 8px clamp(16px, 5vw, 56px) max(8px, env(safe-area-inset-bottom));
  border-block-start: 1px solid #ffffff24;
  background: linear-gradient(145deg, #b4af8329, #121d18e8);
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-page {
  max-inline-size: 980px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  text-align: start;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-page h1 {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  max-inline-size: none;
  margin-inline: 0;
}
:is(:root:fullscreen body, body.reader-fullscreen) .decision-kicker { display: none; }
:is(:root:fullscreen body, body.reader-fullscreen) .reader-passage {
  max-inline-size: none;
  margin: 4px 0 0;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-actions,
:is(:root:fullscreen body, body.reader-fullscreen) .reader-navigation {
  margin-block-start: 6px;
  min-block-size: 0;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-navigation {
  max-inline-size: 980px;
  margin-inline: auto;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-actions.decision-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-inline-size: none;
}
:is(:root:fullscreen body, body.reader-fullscreen) .choice-option {
  min-block-size: 44px;
  padding: 7px 10px;
  background: #ffffff12;
}
.reader-ending-extras { margin-block-start: 4px; }
.reader-ending-extras summary {
  cursor: pointer;
  color: var(--muted);
  font-size: .95rem;
  padding-block: 4px;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-page:not(.decision-page):not(:has(.reader-ending-extras)) h1 {
  position: absolute;
  clip-path: inset(50%);
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  white-space: nowrap;
}
@media (min-width: 720px) {
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-caption {
    display: grid;
    grid-template-columns: minmax(0, 780px) auto;
    align-items: center;
    justify-content: center;
    column-gap: clamp(16px, 3vw, 40px);
  }
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-page {
    inline-size: 100%;
  }
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-navigation {
    margin: 0;
    gap: 8px;
  }
}
/* Give the artwork more room in the regular reader. */
.reader-header, .reader { max-inline-size: 1120px; }
.reader-illustration { max-inline-size: 100%; }
.reader-art { inline-size: 100%; max-block-size: 75vh; object-fit: contain; background: transparent; }
.reader-page, .reader-navigation { max-inline-size: 900px; margin-inline: auto; }
.reader-header #language, .reader-header #theme-toggle { min-block-size: 44px; }
.reader-brand { display:inline-flex; align-items:center; gap:8px; }
.reader-brand img { width:32px; height:32px; }
:root[data-theme='dark'] .reader-brand img, :root:fullscreen .reader-brand img, body.reader-fullscreen .reader-brand img { filter:brightness(0) invert(1); }
@media (max-height: 520px) {
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-caption { max-block-size: 45dvh; }
}
@media (max-width: 480px) {
  .reader-header { flex-wrap: wrap; gap: 4px 8px; padding-block: 8px; }
  .reader-header-actions { flex-wrap: wrap; gap: 6px; }
  .reader-brand { flex: 0 0 auto; }
  .reader-brand span { display: none; }
  .reader-header #fullscreen { white-space: nowrap; }
}
.orientation-hint { margin: 0; padding: 5px 16px; text-align: center; font-size: .85rem; line-height: 1.4; color: #f7f3e8; background: #2c4033; }
.orientation-hint[hidden] { display: none; }
@media (orientation: landscape) { .orientation-hint { display: none; } }

/* Keep the illustration the same size on every fullscreen page. */
:is(:root:fullscreen body, body.reader-fullscreen) .reader {
  grid-template-rows: auto minmax(0, 1fr) clamp(145px, 22dvh, 185px);
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-caption {
  min-block-size: 0;
  max-block-size: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #a9bbae transparent;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-caption:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -3px;
}
@media (max-height: 520px) and (orientation: landscape) {
  :is(:root:fullscreen body, body.reader-fullscreen) .reader {
    grid-template-rows: auto minmax(0, 1fr) minmax(110px, 38dvh);
  }
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-caption {
    padding-block: 6px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  :is(:root:fullscreen body, body.reader-fullscreen) .reader {
    grid-template-columns: minmax(0, 3fr) minmax(230px, 2fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-stage { grid-column: 1 / -1; }
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-caption {
    display: block;
    max-block-size: none;
    border-block-start: 0;
    border-inline-start: 1px solid #ffffff24;
    padding: 8px 14px;
  }
}

/* Consistent, compact story controls */
.reader-navigation {
  display: flex;
  direction: ltr;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.reader-navigation .reader-next { margin-left: auto; }
.reader-nav-button {
  min-inline-size: 82px;
  min-block-size: 44px !important;
  padding: 8px 17px;
  border-radius: 100px;
  font-size: .95rem;
  line-height: 1.3;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.reader .choice-option {
  min-block-size: 52px;
  padding: 10px 16px;
  border-radius: 14px;
  line-height: 1.4;
}
.reader-actions.decision-options { gap: 10px; }
:is(:root:fullscreen body, body.reader-fullscreen) .reader-caption {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 8px;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-page {
  width: 100%;
  max-inline-size: 980px;
  flex: 1 0 auto;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-navigation {
  position: sticky;
  bottom: -8px;
  z-index: 2;
  flex: 0 0 auto;
  width: 100%;
  max-inline-size: 980px;
  margin: auto auto 0;
  padding-block: 4px 8px;
  background: linear-gradient(0deg, #18251e 70%, #18251e00);
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-actions.decision-options {
  margin: 8px auto 0;
}
:is(:root:fullscreen body, body.reader-fullscreen) .choice-option {
  min-block-size: 44px;
  border-radius: 12px;
}
@media (max-height: 520px) and (orientation: landscape) {
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-navigation { bottom: -14px; }
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-caption { overflow: hidden; }
:is(:root:fullscreen body, body.reader-fullscreen) .reader-page {
  flex: 1 1 0;
  min-block-size: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #a9bbae transparent;
}
:is(:root:fullscreen body, body.reader-fullscreen) .reader-navigation {
  position: static;
  padding-block: 0;
  background: none;
}
@media (min-width: 721px) and (min-height: 521px) {
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-caption {
    display: grid;
    grid-template-columns: minmax(0, 780px) 190px;
    grid-template-rows: minmax(0, 1fr);
    align-items: center;
    justify-content: center;
    gap: 28px;
  }
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-page { max-block-size: 100%; }
  :is(:root:fullscreen body, body.reader-fullscreen) .reader-navigation { align-self: end; margin: 0; }
}
