/* MediO — Lobby-shaped home (cream discs + red q400) + Reader flip */

:root {
  --page: #f5f2eb;
  --ink: #1c1917;
  --mo-red: #B8292B;
  --mo-red-deep: #7a1518;
  --mo-red-night: #3a0a0c;
  --mo-primer: #f0c4c0;
  --mo-icon: #f5f5f5;
  --mo-chrome: var(--mo-red);
  --mo-chrome-deep: var(--mo-red-deep);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --q400-h: 6rem;
  --mo-font: Fredoka, system-ui, sans-serif;
  --label-stroke: transparent;
  color-scheme: light;
}

/* MediO Red (house) · Glow · Bones — temporary contrast cycle on q400 */
body.theme-medio-red {
  --page: #f5f2eb;
  --ink: #1c1917;
  --mo-chrome: var(--mo-red);
  --mo-chrome-deep: var(--mo-red-deep);
  --mo-primer: #f0c4c0;
  --mo-icon: #f5f5f5;
  --label-stroke: transparent;
  color-scheme: light;
}

body.theme-huglo {
  --page: #0a0a0a;
  --ink: #f5f5f5;
  --mo-chrome: #000000;
  --mo-chrome-deep: #000000;
  --mo-primer: #ffffff;
  --mo-icon: #f5f5f5;
  --label-stroke: #1c1917;
  color-scheme: dark;
}

body.theme-bones {
  --page: #f5f2eb;
  --ink: #1c1917;
  --mo-chrome: #38322e;
  --mo-chrome-deep: #1c1917;
  --mo-primer: #ede1c9;
  --mo-icon: #f5f2eb;
  --label-stroke: #1c1917;
  color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--mo-font);
}

body {
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--mo-red);
  color: #fff;
  padding: 0.5rem 0.75rem;
  z-index: 100;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.shell {
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* —— Header (Lobby-quiet) —— */
.mo-head {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.65rem clamp(0.75rem, 2.5vw, 1.5rem) 0.25rem;
}
.mo-head__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
  padding: 0.2rem 0.35rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}
.mo-head__brand:hover,
.mo-head__brand:focus-visible {
  background: color-mix(in srgb, var(--mo-red) 14%, transparent);
  outline: none;
}
body.theme-huglo .mo-head__name {
  -webkit-text-stroke: 2px #1c1917;
  paint-order: stroke fill;
}
.mo-head__brand img {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #f5f5f5, 0 0 0 3px color-mix(in srgb, var(--mo-red) 35%, #d3c8c0);
}
.mo-head__titles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  text-align: left;
}
.mo-head__name {
  font: 600 1.45rem / 1 var(--mo-font);
  color: var(--mo-red);
}
.mo-head__tag {
  font: 500 0.95rem / 1.15 var(--mo-font);
  color: color-mix(in srgb, var(--ink) 62%, transparent);
}

/* —— Stage / discs (osbard.com shape, 3 doors) —— */
.mo-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  padding: 0.75rem clamp(0.65rem, 2.5vw, 1.5rem);
  padding-bottom: calc(var(--q400-h) + 0.85rem);
  overflow: auto;
}

.home {
  width: 100%;
  max-width: 72rem;
  margin: 0 auto;
}

.mo-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 2.5vw, 1.5rem);
  align-items: center;
  width: 100%;
}

.mo-col {
  /* Same MediO red as the three rings — one brand family on this home. */
  --lane: var(--mo-red);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  padding: 0.65rem 0.55rem 0.85rem;
  border: 0;
  border-radius: 1rem;
  background: transparent;
  color: var(--lane);
  font: inherit;
  cursor: pointer;
  transition: transform 0.35s var(--ease);
  animation: mo-rise 0.55s ease-out both;
}
.mo-col:nth-child(1) { animation-delay: 0.05s; }
.mo-col:nth-child(2) { animation-delay: 0.12s; }
.mo-col:nth-child(3) { animation-delay: 0.19s; }

.mo-col__label {
  margin: 0;
  font-family: var(--mo-font);
  font-weight: 700;
  font-size: clamp(2rem, 2.2vw + 1rem, 2.75rem);
  letter-spacing: 0.02em;
  line-height: 1.1;
  /* Glow / Bones: ink outline so MediO red still reads for low vision / colorblind */
  -webkit-text-stroke: 2px var(--label-stroke);
  paint-order: stroke fill;
}

.mo-col__frame {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: visible;
  background: #f5f5f5;
  box-shadow:
    0 0 0 3px #f5f5f5,
    0 0 0 5px color-mix(in srgb, var(--lane) 42%, #d3c8c0);
  transition:
    box-shadow 0.28s var(--ease),
    transform 0.28s var(--ease);
}

.mo-col__art {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  background: #fff8f4;
}

.mo-col__hint {
  font-size: 1.25rem;
  font-weight: 500;
  opacity: 0.78;
  color: var(--ink);
}

.mo-col:hover .mo-col__frame,
.mo-col.is-glow .mo-col__frame,
.mo-col:focus-visible .mo-col__frame {
  transform: scale(1.06);
  box-shadow:
    0 0 0 3px rgba(245, 245, 245, 0.95),
    0 0 18px color-mix(in srgb, var(--lane) 85%, transparent),
    0 0 36px color-mix(in srgb, var(--lane) 55%, transparent);
}

.mo-col:focus-visible { outline: none; }

@keyframes mo-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 720px) {
  .mo-cols {
    grid-template-columns: 1fr;
    max-width: 16rem;
    margin: 0 auto;
  }
  .mo-col__label { font-size: 1.85rem; }
  .mo-col__hint { font-size: 1.1rem; }
}

/* —— Red q400 —— */
.mo-q400 {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: var(--q400-h);
  background: linear-gradient(180deg, var(--mo-chrome) 0%, var(--mo-chrome-deep) 100%);
  color: var(--mo-icon);
  box-shadow: 0 -1px 0 rgba(245, 245, 245, 0.12);
}

.mo-q400__glow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 3.5rem;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    color-mix(in srgb, var(--mo-red) 0%, transparent) 20%,
    color-mix(in srgb, var(--mo-red) 40%, transparent) 100%
  );
  transition: opacity 0.4s var(--ease);
}
.mo-q400.is-glow .mo-q400__glow { opacity: 1; }

.mo-q400__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--q400-h) minmax(0, 1fr);
  align-items: center;
  column-gap: 0.65rem;
  height: 100%;
  padding: 0 0.85rem;
  max-width: 90rem;
  margin: 0 auto;
}

.mo-q400__side {
  display: flex;
  align-items: center;
  min-width: 0;
  height: 100%;
  gap: 0.85rem;
}
.mo-q400__side--left { justify-content: flex-end; }
.mo-q400__side--right { justify-content: flex-start; }

.mo-q400__book {
  display: none;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.shell[data-view="home"] .mo-q400__home,
.shell[data-view="library"] .mo-q400__home,
.shell[data-view="reader"] .mo-q400__home,
.shell[data-view="player"] .mo-q400__home,
.shell[data-view="home"] .mo-q400__lobby,
.shell[data-view="library"] .mo-q400__lobby,
.shell[data-view="reader"] .mo-q400__lobby,
.shell[data-view="player"] .mo-q400__lobby {
  display: none;
}

.shell[data-view="home"] .mo-q400__book,
.shell[data-view="library"] .mo-q400__book,
.shell[data-view="reader"] .mo-q400__book,
.shell[data-view="player"] .mo-q400__book {
  display: flex;
}

.mo-q400__cluster {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.75rem;
}

.mo-q400__ctrl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: calc(var(--q400-h) * 60 / 96);
  height: calc(var(--q400-h) * 60 / 96);
  min-width: calc(var(--q400-h) * 60 / 96);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0.45rem;
  background: transparent;
  color: #fff;
  font-size: calc(var(--q400-h) * 48 / 96);
  line-height: 1;
  cursor: pointer;
}

.mo-q400__ctrl i {
  font-size: inherit;
  line-height: 1;
  filter:
    drop-shadow(0 0 0.5px rgba(0, 0, 0, 0.5))
    drop-shadow(0 0 1px rgba(245, 245, 245, 0.38));
}

.mo-q400__ctrl:hover:not(:disabled),
.mo-q400__ctrl:focus-visible:not(:disabled) {
  transform: scale(1.08);
  outline: none;
}

.mo-q400__ctrl[aria-pressed="true"] {
  transform: scale(1.08);
  filter: drop-shadow(0 0 8px rgba(240, 196, 192, 0.9));
}

.mo-q400__ctrl:disabled {
  opacity: 0.32;
  cursor: default;
}

.mo-q400__popwrap {
  position: relative;
  display: flex;
  flex: 0 0 auto;
}

.mo-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.55rem);
  z-index: 5;
  min-width: 12.5rem;
  padding: 0.55rem 0.6rem 0.65rem;
  border: 1px solid rgba(245, 245, 245, 0.28);
  border-radius: 8px;
  background: var(--mo-red-night);
  color: #f5f5f5;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.mo-pop[hidden] { display: none; }

.mo-pop--icons { min-width: 8.5rem; }

.mo-pop__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  margin-bottom: 0.4rem;
}

.mo-pop__title {
  margin: 0;
  padding: 0 1.6rem;
  font: 600 1.15rem / 1 var(--mo-font);
  text-align: center;
}

.mo-pop__close {
  position: absolute;
  right: 0;
  top: 50%;
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: #f5f5f5;
  font-size: 1.15rem;
  transform: translateY(-50%);
  cursor: pointer;
}

.mo-pop__close:hover,
.mo-pop__close:focus-visible {
  background: rgba(245, 245, 245, 0.12);
  outline: none;
}

.mo-pop__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.mo-pop__opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 3.6rem;
  padding: 0.4rem 0.3rem;
  border: 1px solid rgba(245, 245, 245, 0.28);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.22);
  color: #f5f5f5;
  font: 500 1.05rem / 1.1 var(--mo-font);
  cursor: pointer;
}

.mo-pop__opt i {
  font-size: 1.45rem;
  line-height: 1;
}

.mo-pop__opt--icon { min-height: 3.2rem; }

.mo-pop__opt:hover,
.mo-pop__opt:focus-visible {
  border-color: #f0c4c0;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.mo-pop__opt[aria-pressed="true"] {
  border-color: #f0c4c0;
  box-shadow: 0 0 0 1px #f0c4c0;
}

.mo-pop__opt:disabled {
  opacity: 0.32;
  cursor: default;
}

body.is-boo {
  --q400-h: 5rem;
}

.shell[data-view="reader"] .mo-stage,
.shell[data-view="player"] .mo-stage {
  background-image: var(--mo-stage-image, none);
  background-size: cover;
  background-position: center;
}
.shell[data-view="reader"] .mo-stage {
  flex-direction: column;
  align-items: stretch;
  padding: 0.35rem 0.85rem calc(var(--q400-h) + 0.4rem);
}

.reader__stage,
.player-stage {
  transform: scale(var(--mo-book-zoom, 1));
  transform-origin: center center;
}

.reader.is-single .flip-page.is-under { display: none; }

.mo-q400__contrast {
  display: inline-grid;
  place-items: center;
  width: calc(var(--q400-h) * 0.55);
  height: calc(var(--q400-h) * 0.55);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mo-icon);
  cursor: pointer;
  opacity: 0.92;
}
.mo-q400__contrast:hover,
.mo-q400__contrast:focus-visible {
  opacity: 1;
  outline: none;
  box-shadow: 0 0 0 2px rgba(245, 245, 245, 0.55);
}
.mo-q400__contrast-icon {
  display: block;
  width: 1.55rem;
  height: 1.55rem;
}

.mo-q400__lobby {
  color: #f5f5f5;
  text-decoration: none;
  font: 500 1rem / 1 var(--mo-font);
  opacity: 0.85;
}
.mo-q400__lobby:hover { opacity: 1; text-decoration: underline; }

.mo-q400__paw {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--q400-h);
  height: var(--q400-h);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--mo-primer);
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(245, 245, 245, 0.4);
  transition: box-shadow 0.28s var(--ease), transform 0.28s var(--ease);
}
.mo-q400__paw:hover,
.mo-q400__paw:focus-visible {
  transform: scale(1.04);
  box-shadow:
    0 0 0 3px rgba(245, 245, 245, 0.75),
    0 0 18px rgba(184, 41, 43, 0.85),
    0 0 36px rgba(240, 196, 192, 0.65);
  outline: none;
}
.mo-q400__paw img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  border-radius: 50%;
}
.mo-q400__paw[aria-pressed="true"] {
  box-shadow:
    0 0 0 3px rgba(245, 245, 245, 0.75),
    0 0 18px rgba(184, 41, 43, 0.85);
}

@media (max-width: 640px) {
  .mo-q400__mark { display: none; }
}

/* —— Inner panels (Library / Reader / Player) —— */
.panel {
  width: min(56rem, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  animation: mo-rise 0.35s ease-out both;
}
.panel[hidden] { display: none; }
.panel__head { padding: 0.2rem 0 0.75rem; }
.panel__title {
  margin: 0;
  font: 600 1.85rem / 1.15 var(--mo-font);
  color: var(--mo-red);
}
.panel__lede {
  margin: 0.25rem 0 0;
  font: 500 1.05rem / 1.35 var(--mo-font);
  opacity: 0.8;
}
.panel__lede:empty { display: none; }
.panel__body--empty {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 8rem;
  padding: 1.5rem 1rem;
  text-align: center;
}
.panel__body--empty[hidden],
.player-stage[hidden],
#player-audio[hidden],
#player-video[hidden] {
  display: none !important;
}
.shelf {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  min-height: 0;
}
.shelf:empty { display: none; }
.shelf-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  width: min(100%, 18rem);
  margin: 0;
  padding: 1rem 1.05rem 1.1rem;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}
.shelf-card__title {
  margin: 0;
  font: 600 1.35rem / 1.2 var(--mo-font);
  color: var(--mo-red);
}
.shelf-card__kind {
  margin: 0;
  font: 500 1.05rem / 1.3 var(--mo-font);
}
.shelf-card__row {
  display: flex;
  gap: 0.45rem;
  margin-top: 0.35rem;
}
.shelf-card__play {
  background: transparent;
  color: var(--mo-red);
  box-shadow: inset 0 0 0 2px var(--mo-red);
}
.shelf-card.is-open {
  box-shadow: 0 0 0 2px var(--mo-red), 0 8px 22px rgba(0, 0, 0, 0.12);
}
.shelf-open { align-self: flex-start; margin-top: 1rem; }
.shelf-card__row .shelf-open { margin-top: 0; align-self: center; }
#view-reader .reader__bar .reader__open,
#player-stage .reader__open { display: none !important; }
#view-library .panel__head,
#view-player .panel__head { display: none; }
.desk-mark {
  width: min(18rem, 70%);
  height: auto;
  flex: 0 0 auto;
}
.panel.is-filled > .desk-mark,
#view-reader.is-filled .desk-mark {
  width: 4.5rem;
  margin: 0.1rem auto 0.35rem;
}
#view-library,
#view-player {
  flex: 1;
  width: 100%;
  max-width: none;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}
#view-library.is-filled,
#view-player.is-filled {
  justify-content: flex-start;
  align-items: stretch;
  gap: 0.75rem;
}
#view-library:not(.is-filled) .shelf-open {
  margin-top: 0;
  align-self: center;
}
#view-player:not(.is-filled) #player-empty {
  flex: 0 0 auto;
  min-height: 0;
  padding: 0;
}
.shell[data-view="library"] .mo-stage,
.shell[data-view="player"] .mo-stage {
  flex-direction: column;
  align-items: stretch;
}

/* —— Reader / flipbook —— */
.panel--reader {
  gap: 0.35rem;
  width: 100%;
  max-width: none;
  flex: 1;
  min-height: 0;
}
#view-reader .panel__head { display: none; }
#view-reader .reader__btn,
#view-player .reader__btn,
#player-autoplay { display: none; }
.reader {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 0.65rem;
}
.reader__stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  perspective: 1800px;
  padding: 0;
}
#view-reader:not(.is-filled) .reader {
  justify-content: center;
  align-items: center;
  gap: 1.25rem;
}
#view-reader:not(.is-filled) .reader__stage {
  flex: 0 0 auto;
}
#view-reader:not(.is-filled) .reader__bar,
#view-reader:not(.is-filled) #flipbook,
#view-reader:not(.is-filled) #reader-engine { display: none; }
#view-reader.is-filled .reader-empty { display: none !important; }
.reader-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.flipbook {
  position: relative;
  width: min(100%, 46rem);
  height: calc(100dvh - var(--q400-h) - 7.5rem);
  max-height: 100%;
  margin: 0 auto;
  transform-style: preserve-3d;
}
#flipbook:empty { display: none; }
.flip-page {
  position: absolute;
  inset: 0;
  border-radius: 2px 8px 8px 2px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  transform-origin: left center;
  backface-visibility: hidden;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  user-select: none;
  touch-action: none;
}
.flip-page img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  pointer-events: none;
}
.flip-page__label {
  margin: auto;
  padding: 1rem;
  font: 600 1.35rem / 1.35 var(--mo-font);
  text-align: center;
  color: var(--mo-red-deep);
  white-space: pre-line;
}
.flip-page.is-under { z-index: 1; }
.flip-page.is-leaf {
  z-index: 3;
  cursor: grab;
}
.flip-page.is-leaf.is-drag { cursor: grabbing; }
.flip-page.is-back {
  z-index: 2;
  transform: rotateY(-180deg);
}
.flip-page::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0.1), transparent 18%, transparent 82%, rgba(0,0,0,0.05));
}
.reader__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.25rem 0 0.35rem;
}
.reader__btn,
.reader__open {
  border: 0;
  border-radius: 8px;
  font: 600 1.05rem / 1 var(--mo-font);
  cursor: pointer;
}
.reader__btn {
  width: 2.6rem;
  height: 2.6rem;
  background: color-mix(in srgb, var(--mo-red) 14%, #fff);
  color: var(--mo-red-deep);
  font-size: 1.5rem;
}
.reader__btn:disabled { opacity: 0.35; cursor: default; }
.reader__folio {
  margin: 0;
  min-width: 6.5rem;
  text-align: center;
  font: 500 1.05rem / 1 var(--mo-font);
}
.reader__open {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  background: var(--mo-red);
  color: #fff;
}
.reader__open:hover,
.reader__btn:not(:disabled):hover { filter: brightness(1.06); }

.reader__engine,
.player-engine {
  width: 100%;
  min-height: 0;
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
}
#player-engine:empty {
  display: none;
  min-height: 0;
}

.reader__engine[hidden] { display: none; }

.flipio-pdf {
  width: 100%;
  height: 100%;
  min-height: 0;
  --fb-bg: transparent;
  --fb-paper: #fffaf2;
}
.flipio-pdf .fb-tools,
.flipio-pdf .fb-counter,
.flipio-pdf .fb-nav { display: none !important; }

.stpf-shell {
  --page-w: 400px;
  --page-h: 560px;
  --slide: 520ms;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --paper: #fffaf2;
  --leather: #5c3d24;
  --leather-hi: #7a5535;
  --leather-lo: #3d2818;
  --gold: #e8c76b;
  position: relative;
  width: calc(var(--page-w) * 2);
  height: var(--page-h);
  max-width: 100%;
  display: grid;
  place-items: center;
}
.stpf-shell__stage {
  width: calc(var(--page-w) * 2);
  height: var(--page-h);
  transform: translateX(0);
  transition: transform var(--slide) var(--ease);
  will-change: transform;
}
.stpf-shell[data-pose='cover-front'] .stpf-shell__stage {
  transform: translateX(calc(var(--page-w) * -0.5));
}
.stpf-shell[data-pose='open'] .stpf-shell__stage { transform: translateX(0); }
.stpf-shell[data-pose='cover-back'] .stpf-shell__stage {
  transform: translateX(calc(var(--page-w) * 0.5));
}
.stpf-gutter {
  display: none;
  position: absolute;
  top: 0;
  height: 100%;
  left: 50%;
  width: 16%;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 4;
  background: linear-gradient(to right,
    rgba(40, 24, 12, 0) 0%,
    rgba(40, 24, 12, 0.12) 30%,
    rgba(30, 16, 8, 0.38) 48%,
    rgba(20, 10, 4, 0.5) 50%,
    rgba(30, 16, 8, 0.38) 52%,
    rgba(40, 24, 12, 0.12) 70%,
    rgba(40, 24, 12, 0) 100%);
}
.stpf-shell[data-pose='open']:not(.is-single) .stpf-gutter { display: block; }
.stpf-shell.is-single,
.stpf-shell.is-single .stpf-shell__stage {
  width: var(--page-w);
}
:fullscreen .shell[data-view='reader'] .mo-head {
  min-height: 0;
  padding: 0.15rem 0.75rem;
}
:fullscreen .shell[data-view='reader'] .mo-head__titles { display: none; }
:fullscreen .shell[data-view='reader'] .mo-stage {
  padding: 0.1rem 0.3rem calc(var(--q400-h) + 0.1rem);
}
:fullscreen .shell[data-view='reader'] .reader { gap: 0.15rem; }
:fullscreen .shell[data-view='reader'] .reader__bar { padding: 0; }
:fullscreen .shell[data-view='reader'] #view-reader.is-filled .desk-mark { display: none; }
.stpf-page img.stpf-page__sheet {
  object-fit: contain;
  background: #fff;
}
.stpf-page {
  background: var(--paper);
  color: #2a1c12;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(90, 60, 30, 0.12);
}
.stpf-page--hard {
  background:
    radial-gradient(120% 80% at 70% 20%, rgba(255, 220, 160, 0.12), transparent 50%),
    linear-gradient(215deg, var(--leather-hi), var(--leather) 45%, var(--leather-lo));
  color: var(--gold);
}
.stpf-page img,
.stpf-page video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.stpf-page__html {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.stpf-page__label {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 1rem;
  text-align: center;
  font-weight: 600;
  font-size: 1.15rem;
}

.shell[data-view="player"] .mo-stage {
  align-items: flex-start;
}
.panel--player { width: min(52rem, 100%); }
.player-stage {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
}
.player-meta {
  margin: 0;
  font: 500 1.05rem / 1.3 var(--mo-font);
  text-align: center;
}
.player-cover {
  width: min(100%, 16rem);
  max-height: 18rem;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
}
.player-cover[hidden] { display: none !important; }

.mo-pip {
  position: fixed;
  z-index: 35;
  right: 1rem;
  bottom: calc(var(--q400-h) + 1rem);
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.45rem;
  border-radius: 12px;
  background: #2a1214;
  color: #fff;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
}
.mo-pip[hidden] { display: none !important; }
.mo-pip__screen {
  border-radius: 8px;
  overflow: hidden;
  background: #111;
}
.mo-pip__screen img,
.mo-pip__screen video {
  display: block;
  width: 100%;
  max-height: 11rem;
  object-fit: contain;
  background: #111;
}
.mo-pip__title {
  margin: 0.4rem 0.2rem 0.15rem;
  font: 500 1.05rem / 1.2 var(--mo-font);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mo-pip__title:empty { display: none; }
.mo-pip__back {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  cursor: pointer;
}
.mo-pip__back i { font-size: 1.15rem; }
#player-audio,
#player-video {
  width: min(100%, 40rem);
}
#mo-pip audio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}
.mo-doc {
  width: min(100%, 42rem);
  height: min(68vh, 36rem);
  border: 0;
  border-radius: 2px 8px 8px 2px;
  background: #fffaf2;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.mo-stage-video {
  width: min(100%, 48rem);
  max-height: min(68vh, 36rem);
  background: #111;
  border-radius: 8px;
}
.player-chapters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  width: min(100%, 40rem);
}
.player-chapters[hidden] { display: none !important; }
.player-chapter {
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  background: #fff;
  color: var(--mo-red-deep);
  font: 500 1.15rem/1.2 var(--mo-font);
  cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--mo-primer);
}
.player-chapter.is-on {
  background: var(--mo-red);
  color: #fff;
  box-shadow: none;
}
.panel__body--empty .reader__open {
  margin-top: 0.75rem;
}

@media (prefers-reduced-motion: reduce) {
  .mo-col,
  .panel { animation: none; }
  .mo-col:hover .mo-col__frame { transform: none; }
  .stpf-shell__stage { transition: none !important; }
}
