/* A shared paper-and-cloth picture album for the hub and Hersenen. */
dialog.storybook-dialog { width: min(1060px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; border: 1px solid #aa80c6; border-radius: 24px; padding: clamp(14px, 2.5vw, 24px); color: #eadef3; background: radial-gradient(ellipse at 50% 0,#64437b,#2c203e 80%); box-shadow: 0 28px 100px #100820aa; }
dialog.storybook-dialog::backdrop { background: #100c22c9; backdrop-filter: blur(9px); }
.storybook-dialog .album-heading h2, .storybook-dialog .hub-album-heading h2 { color: #fff2d9; font-size: clamp(1.35rem, 3vw, 2rem); }
.storybook-dialog .eyebrow, .storybook-dialog .hub-album-heading p { color: #d5b2e9; }
.storybook-dialog #albumStatus, .storybook-dialog #hubAlbumStatus { color: #f2d9a1; font-size: .85rem; margin: 12px 0; }
.storybook-dialog .album-player-picker { margin-top: 12px; font-size: .8rem; }
.storybook-dialog .album-player-picker select { min-height: 40px; }
.storybook-dialog .album-player-picker button { min-width: 0; font-size: .8rem; }
.storybook-dialog .album-heading button, .storybook-dialog .hub-album-heading button { flex: 0 0 42px; min-width: 42px; width: 42px; height: 42px; min-height: 42px; padding: 0; }
.storybook-dialog .album-instructions { color: #cbb8d8; font-size: .75rem; margin: 8px 0 16px; }
.storybook-dialog .storybook-grid { display: block; margin-top: 14px; }
.book-stage { position: relative; perspective: 1800px; padding: 10px; border-radius: 10px 18px 18px 10px; background: linear-gradient(90deg,#422451,#8c599d 49%,#4a295a 50%,#6d4380); box-shadow: 0 14px 30px #08051077, 4px 5px 0 #c9bca5, 7px 8px 0 #8b7893; }
.book-spread { position: relative; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); transform-style: preserve-3d; }
.book-spread::after { content: ""; pointer-events: none; position: absolute; z-index: 3; top: 0; bottom: 0; left: calc(50% - 15px); width: 30px; background: linear-gradient(90deg,transparent,#6c4d3433 42%,#6c4d3455 50%,#fff7de55 58%,transparent); }
.book-paper { position: relative; display: flex; flex-direction: column; min-width: 0; padding: clamp(12px,2vw,22px); background-color: #fbf2dd; background-image: radial-gradient(#a7854912 .7px,transparent .7px),linear-gradient(90deg,#f4e6c7,#fffaeb 12%,#fbf1d9); background-size: 5px 5px,100% 100%; box-shadow: inset 0 0 22px #a37c3920; }
.book-paper-left { border-radius: 4px 0 0 5px; padding-right: clamp(15px,2.5vw,28px); }
.book-paper-right { border-radius: 0 5px 5px 0; padding-left: clamp(15px,2.5vw,28px); }
.book-paper-heading { color: #aa8b59; font-size: .52rem; font-weight: 900; letter-spacing: .12em; border-bottom: 1px solid #d9c6a4; padding-bottom: 10px; margin-bottom: 14px; }
.book-pockets { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: clamp(10px,2vw,22px); flex: 1; }
.storybook-dialog .book-pockets > button { position: relative; display: flex; flex-direction: column; justify-content: center; min-width: 0; gap: 7px; min-height: 0; width: 100%; padding: 7px; border: 1px solid #e0cc9c; border-radius: 3px; color: #79613f; background: #fffcf2; box-shadow: 1px 3px 5px #7c5d2927; font: 800 .6rem/1.3 "Outfit",sans-serif; text-align: center; }
.storybook-dialog .book-pockets > button.earned, .storybook-dialog .book-pockets > button.is-earned { transform: rotate(-2deg); border: 2px solid #ddb64e; background: #fffaf0; }
.storybook-dialog .book-pockets > button:nth-child(even) { transform: rotate(1.5deg); }
.storybook-dialog .book-pockets > button.earned::before, .storybook-dialog .book-pockets > button.is-earned::before { content: ""; position: absolute; top: -6px; left: 30%; width: 40%; height: 14px; transform: rotate(-4deg); background: #e3c78088; box-shadow: 0 1px 2px #95764922; }
.storybook-dialog .book-pockets > button.locked, .storybook-dialog .book-pockets > button.is-locked { opacity: 1; transform: none; border: 1px dashed #bba477; background: #f0e4cb88; box-shadow: inset 0 0 12px #a7833920; color: #a38d66; }
.storybook-dialog .book-pockets img, .storybook-dialog .book-pockets .card-back, .storybook-dialog .book-pockets .hub-card-back { display: grid; place-items: center; width: 100%; height: auto; aspect-ratio: 1; min-height: 0; max-height: 23dvh; object-fit: contain; border-radius: 0; }
.storybook-dialog .book-pockets .card-back, .storybook-dialog .book-pockets .hub-card-back { color: #c4ad7d; font-size: 2rem; background: radial-gradient(ellipse,#e4d4b0,transparent 70%); text-shadow: 0 1px 0 #fff7e2; }
.book-paper-number { display: block; margin-top: 14px; color: #ad9468; font-family: Georgia,serif; font-size: .7rem; text-align: center; }
.book-end-pocket { display: grid; place-content: center; white-space: pre-line; text-align: center; padding: 15px; color: #b79b65; font: italic .85rem/1.8 Georgia,serif; }
.book-cover { position: absolute; z-index: 5; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 32px; border: 2px solid #cfae68; border-left: 12px solid #382044; border-radius: 6px 16px 16px 6px; color: #ffe7a1; background: repeating-linear-gradient(30deg,#ffffff04 0,#ffffff04 1px,transparent 1px,transparent 4px),radial-gradient(ellipse at 70% 15%,#9260a8,#5c3472 60%,#3f244e); box-shadow: inset 0 0 0 10px #ffffff08,inset 0 0 0 12px #ddbc6955,4px 8px 15px #13081b66; transform-origin: left center; pointer-events: none; backface-visibility: hidden; opacity: 0; transform: rotateY(-110deg); }
.book-cover::before { content: ""; position: absolute; inset: 24px; border: 1px solid #d9b76a66; border-radius: 40% 40% 3px 3px; pointer-events: none; }
.book-cover-emblem { font-size: clamp(2rem,7vw,5rem); text-shadow: 0 3px 0 #2c183f,0 0 30px #fada7c44; }
.book-cover strong { max-width: 80%; text-align: center; font: 900 clamp(1.5rem,4vw,3rem)/1.15 "Outfit",sans-serif; text-shadow: 0 2px 0 #2c183f; }
.book-cover > span:not(.book-cover-emblem) { font-size: .65rem; letter-spacing: .18em; font-weight: 800; }
.book-cover-ornament { margin-top: 20px; }
.book-opening .book-cover { animation: pictureAlbumOpen 1900ms 80ms cubic-bezier(.3,.1,.2,1) both; }
.book-closing .book-cover { animation: pictureAlbumClose 1000ms ease-in-out both; }
.book-closing .book-stage { animation: pictureAlbumAway 1000ms ease-in both; }
.book-navigation { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 24px 0 2px; }
.storybook-dialog .book-navigation button { min-width: 0; min-height: 42px; padding: 9px 15px; border: 1px solid #b390ce55; border-radius: 99px; color: #f9edff; background: #ffffff12; font: 800 .75rem "Outfit",sans-serif; cursor: pointer; }
.storybook-dialog .book-navigation button:disabled { opacity: .3; cursor: default; }
.book-page-label { color: #d3bddf; font-size: .7rem; text-align: center; }
.book-spread.turn-forward { animation: picturePageTurn 340ms ease-in-out; transform-origin: left; }
.book-spread.turn-back { animation: picturePageTurn 340ms ease-in-out reverse; transform-origin: right; }
@keyframes pictureAlbumOpen { 0%,55% { opacity: 1; transform: rotateY(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: rotateY(-110deg); } }
@keyframes pictureAlbumClose { 0% { opacity: 0; transform: rotateY(-110deg); } 15% { opacity: 1; } 55%,100% { opacity: 1; transform: rotateY(0); } }
@keyframes pictureAlbumAway { 0%,90% { transform: none; opacity: 1; } 100% { transform: scale(.96); opacity: .35; } }
@keyframes picturePageTurn { 0%,100% { opacity: 1; transform: rotateY(0); } 50% { opacity: .3; transform: rotateY(-12deg); } }
@media (max-width: 640px) { .book-spread { grid-template-columns: 1fr; } .book-spread::after { left: 0; width: 14px; background: linear-gradient(90deg,#6c4d3444,transparent); } .book-paper-left { padding: 14px 14px 14px 20px; } .book-pockets { gap: 14px; } .book-stage { padding: 7px; } .storybook-dialog .book-pockets img, .storybook-dialog .book-pockets .card-back, .storybook-dialog .book-pockets .hub-card-back { max-height: 23dvh; } }
@media (prefers-reduced-motion: reduce) { .book-cover { display: none; } .book-opening .book-cover, .book-closing .book-cover, .book-closing .book-stage, .book-spread.turn-forward, .book-spread.turn-back { animation: none; } }

.book-closing > :not(.storybook-grid) { pointer-events: none; }
.book-closing .book-navigation { pointer-events: none; }
.book-spread.turn-forward::before, .book-spread.turn-back::before { content: ""; position: absolute; z-index: 4; top: 0; bottom: 0; left: 50%; width: 50%; border: 1px solid #e8d8b9; background: linear-gradient(90deg,#e3d1ad,#fff8e5 15%,#f6ecd4); box-shadow: -10px 0 25px #79562d33; transform-origin: left; animation: pictureLeafTurn 340ms ease-in-out both; }
.book-spread.turn-back::before { left: 0; transform-origin: right; animation-name: pictureLeafBack; }
@keyframes pictureLeafTurn { from { transform: rotateY(0); opacity: .2; } 40% { opacity: .9; } to { transform: rotateY(-175deg); opacity: .1; } }
@keyframes pictureLeafBack { from { transform: rotateY(0); opacity: .2; } 40% { opacity: .9; } to { transform: rotateY(175deg); opacity: .1; } }
@media (max-width: 640px) { .book-spread.turn-forward::before, .book-spread.turn-back::before { left: 0; width: 100%; } }
@media (prefers-reduced-motion: reduce) { .book-spread.turn-forward::before, .book-spread.turn-back::before { display: none; } }

/* The book is the entire scene; no surrounding dialog or form. */
dialog.storybook-dialog.book-ready {
  position: fixed; inset: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none;
  margin: 0; padding: 0; overflow: hidden; border: 0; border-radius: 0;
  background: transparent; box-shadow: none;
}
dialog.storybook-dialog.book-ready::backdrop { background: #171124ed; backdrop-filter: blur(10px); }
dialog.storybook-dialog.book-ready > :not(.storybook-grid) { display: none; }
dialog.storybook-dialog.book-ready .storybook-grid {
  position: absolute; inset: 0; display: grid; place-items: center; margin: 0;
  padding: 48px 70px 40px; overflow: hidden;
}
.book-ready .book-stage { width: min(100%, 1000px, calc((100dvh - 100px) * 1.65)); padding: 8px; max-height: 100%; }
.book-ready .book-spread { aspect-ratio: 1.65; }
.book-ready .book-paper { min-height: 0; overflow: hidden; padding: clamp(12px,2vw,24px); }
.book-ready .book-paper-left { padding-right: clamp(18px,3vw,32px); }
.book-ready .book-paper-right { padding-left: clamp(18px,3vw,32px); }
.book-ready .book-paper-heading { flex: 0 0 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-bottom: 8px; margin-bottom: 12px; font-size: .55rem; }
.book-ready .book-pockets { min-height: 0; grid-template-rows: repeat(2,minmax(0,1fr)); gap: clamp(8px,2vw,20px); }
.storybook-dialog.book-ready .book-pockets > button { min-height: 0; overflow: hidden; padding: 5px; gap: 5px; }
.storybook-dialog.book-ready .book-pockets img,
.storybook-dialog.book-ready .book-pockets .card-back,
.storybook-dialog.book-ready .book-pockets .hub-card-back { flex: 1; width: 100%; height: 0; min-height: 0; max-height: none; aspect-ratio: auto; object-fit: contain; }
.storybook-dialog.book-ready .book-pockets > button > span:last-child { flex: 0 0 auto; font-size: clamp(.45rem,.9vw,.6rem); line-height: 1.25; }
.book-ready .book-paper-number { flex: 0 0 auto; margin-top: 10px; font-size: .6rem; }
.book-ready .book-navigation { position: absolute; inset: 0; display: block; margin: 0; pointer-events: none; }
.storybook-dialog.book-ready .book-navigation .book-arrow { position: absolute; top: 50%; display: grid; place-items: center; width: 44px; height: 60px; min-height: 44px; padding: 0; border: 1px solid #f6e0bb22; border-radius: 99px; background: #ffffff0b; color: #f5e7d3; font: 400 42px/1 Georgia,serif; transform: translateY(-50%); pointer-events: auto; }
.book-ready .book-arrow-prev { left: 14px; }
.book-ready .book-arrow-next { right: 14px; }
.storybook-dialog.book-ready .book-navigation .book-arrow:disabled { opacity: .15; pointer-events: none; }
.book-ready .book-page-label { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); color: #c4b4cf; font-size: .65rem; white-space: nowrap; }
.storybook-dialog.book-ready .book-scene-close { position: absolute; top: 10px; right: 14px; display: grid; place-items: center; width: 36px; height: 36px; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: #ffffff0b; color: #e2d5eb; font: 400 26px/1 sans-serif; cursor: pointer; z-index: 10; }
.storybook-dialog.book-ready button:focus-visible { outline: 2px solid #f4d381; outline-offset: 3px; }
.book-ready .book-cover { overflow: hidden; }
.book-ready .book-cover > strong { font-size: clamp(1.3rem,4vw,2.8rem); }
@media (max-width: 640px) {
  dialog.storybook-dialog.book-ready .storybook-grid { padding: 46px 32px 36px; }
  .book-ready .book-stage { width: min(100%, 480px, calc((100dvh - 90px) * .73)); padding: 6px; }
  .book-ready .book-spread { aspect-ratio: .73; }
  .book-ready .book-paper-left { padding: 14px 10px 10px 18px; }
  .book-ready .book-paper-heading { font-size: .48rem; margin-bottom: 12px; }
  .book-ready .book-pockets { gap: 10px; }
  .storybook-dialog.book-ready .book-navigation .book-arrow { width: 28px; height: 52px; border: 0; background: transparent; font-size: 38px; }
  .book-ready .book-arrow-prev { left: 2px; }
  .book-ready .book-arrow-next { right: 2px; }
  .storybook-dialog.book-ready .book-pockets > button > span:last-child { font-size: .45rem; }
}
.book-ready .storybook-grid:empty::before { content: attr(data-message); max-width: 340px; padding: 24px; color: #daccdf; font-size: .9rem; line-height: 1.6; text-align: center; }
/* Retain an exit control while cards are loading or a connection fails. */
dialog.storybook-dialog.book-ready > .album-heading,
dialog.storybook-dialog.book-ready > .hub-album-heading { display: contents; }
.book-ready > .album-heading > div, .book-ready > .hub-album-heading > div { display: none; }
.storybook-dialog.book-ready .album-heading > button,
.storybook-dialog.book-ready .hub-album-heading > button { position: fixed; z-index: 20; top: 10px; right: 14px; width: 36px; height: 36px; min-width: 0; min-height: 0; border: 0; background: #282030; color: #e2d5eb; font: 400 26px/1 sans-serif; box-shadow: none; }
.book-ready .book-scene-close { visibility: hidden; }

/* Explicit scene tracks keep navigation from shrinking or displacing the book. */
dialog.storybook-dialog.book-ready .storybook-grid { display: flex; flex-direction: row; align-items: center; justify-content: center; }
.book-ready .book-stage { flex: 0 1 1100px; width: min(1100px, calc(100vw - 140px), calc((100dvh - 100px) * 1.65)); max-width: min(calc(100vw - 140px), calc((100dvh - 100px) * 1.65)); margin: auto; }
@media (max-width: 640px) { .book-ready .book-stage { flex-basis: 480px; width: min(480px, calc(100vw - 64px), calc((100dvh - 90px) * .73)); max-width: min(calc(100vw - 64px), calc((100dvh - 90px) * .73)); } }

/* Light navigation and a restrained page transition; the book stays still. */
.storybook-dialog.book-ready .book-navigation .book-arrow {
  width: 44px; height: 44px; padding: 10px; border: 0; border-radius: 6px;
  background: transparent; color: #d3c3dc; box-shadow: none; line-height: 1;
  transition: color 150ms ease, background-color 150ms ease;
}
.book-arrow svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.storybook-dialog.book-ready .book-navigation .book-arrow:not(:disabled):hover { color: #fff3df; background: #ffffff09; }
.storybook-dialog.book-ready .book-navigation .book-arrow:disabled { opacity: .12; }
.book-spread.turn-forward::before, .book-spread.turn-back::before { display: none; }
.book-spread.turn-forward { transform-origin: center; animation: albumPageOutNext 130ms ease-in both; }
.book-spread.turn-back { transform-origin: center; animation: albumPageOutPrev 130ms ease-in both; }
.book-spread.turn-enter-forward { animation: albumPageInNext 170ms ease-out both; }
.book-spread.turn-enter-back { animation: albumPageInPrev 170ms ease-out both; }
@keyframes albumPageOutNext { to { opacity: 0; transform: translateX(-8px); } }
@keyframes albumPageOutPrev { to { opacity: 0; transform: translateX(8px); } }
@keyframes albumPageInNext { from { opacity: 0; transform: translateX(8px); } to { opacity: 1; transform: none; } }
@keyframes albumPageInPrev { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) { .storybook-dialog.book-ready .book-navigation .book-arrow { width: 30px; height: 44px; padding: 5px 3px; } }
@media (prefers-reduced-motion: reduce) { .book-spread.turn-forward, .book-spread.turn-back, .book-spread.turn-enter-forward, .book-spread.turn-enter-back { animation: none; } }

.book-stage { touch-action: pan-y pinch-zoom; }
.book-stage img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; }

/* Touch gestures belong to the album, including on empty card pockets. */
html.picture-album-scroll-locked { overflow: hidden; overscroll-behavior: none; }
.storybook-dialog.book-ready, .storybook-dialog.book-ready .storybook-grid,
.storybook-dialog.book-ready .book-stage, .storybook-dialog.book-ready .book-pockets > button { touch-action: none; overscroll-behavior: none; }
.book-pockets > button > img, .book-pockets .card-back, .book-pockets .hub-card-back { pointer-events: none; }

/* The same gold collectible frame used when a BreinCard is won. */
.storybook-dialog.book-ready .book-pockets > button.album-gold-card {
  display: flex; flex-direction: column; justify-content: flex-start; gap: 4px; min-height: 0;
  padding: 6px; overflow: hidden; border: 1px solid #fff0aa; border-radius: 9px;
  background: linear-gradient(125deg,#a16c1f,#ffe59a 18%,#fff8c9 35%,#cf9e37 55%,#ffebaa 76%,#a97629);
  box-shadow: 1px 3px 7px #6e461f44,inset 0 0 0 2px #c99737; color: #69451e;
  transform: rotate(-1.5deg); text-align: left;
}
.storybook-dialog .book-pockets > button.album-gold-card:nth-child(even) { transform: rotate(1deg); }
.storybook-dialog .book-pockets > button.album-gold-card::before { display: none; }
.album-gold-header { flex: 0 0 auto; display: flex; justify-content: space-between; gap: 3px; width: 100%; padding: 2px; font-size: clamp(.28rem,.6vw,.43rem); font-weight: 900; letter-spacing: .03em; }
.album-gold-art { display: flex; flex: 1 1 0; min-height: 0; width: 100%; padding: 2px; border: 1px solid #b88c3b; border-radius: 4px; background: radial-gradient(circle,#fffdf3,#f2e4ff); }
.storybook-dialog.book-ready .book-pockets .album-gold-art img { display: block; flex: 1; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.album-gold-info { flex: 0 0 auto; display: grid; gap: 3px; padding: 5px; width: 100%; border: 1px solid #fae9b7; border-radius: 4px; background: linear-gradient(135deg,#fffae8,#fff1c8); }
.album-gold-edition { color: #997536; font-size: clamp(.23rem,.45vw,.35rem); letter-spacing: .04em; }
.album-gold-info strong { color: #4e3265; font: 900 clamp(.5rem,1.2vw,.85rem)/1.1 "Outfit",sans-serif; }
.storybook-dialog.book-ready .book-pockets > button.album-gold-card > .album-gold-footer { flex: 0 0 auto; padding: 1px 2px; width: 100%; color: #755020; font-size: clamp(.22rem,.4vw,.3rem); line-height: 1.2; text-align: center; }
@media (max-width: 640px) { .storybook-dialog.book-ready .book-pockets > button.album-gold-card { padding: 5px; gap: 3px; } .album-gold-header { font-size: .32rem; } .album-gold-info strong { font-size: .6rem; } .album-gold-edition { font-size: .25rem; } }

/* Rare collection: an unearned illustration is never inserted into the page. */
.storybook-dialog .book-pockets > .glitter-card.is-locked { background: linear-gradient(145deg,#f8efff,#eefafa); color: #483858; border: 2px dashed #b398cf; padding: 8px; }
.storybook-dialog .glitter-lock { font-size: 1.5rem; color: #9273b8; }
.storybook-dialog .glitter-task { font-size: clamp(10px,1.05vw,13px); font-weight: 600; line-height: 1.35; }
.storybook-dialog .glitter-progress { font-size: 10px; color: #644187; font-weight: 900; }
.storybook-dialog .book-pockets > .glitter-card.is-earned { border-color: #ba85df; background: linear-gradient(125deg,#fbebaf,#e5c2f8,#b3f0ef,#f9cce3); }
@media(max-width:640px) {
  .storybook-dialog .glitter-task { font-size: 10px; line-height: 1.25; }
}
.storybook-dialog.book-ready .book-pockets > button.album-gold-card.glitter-card {
  border-color: #f3d8ff;
  background: linear-gradient(125deg,#b688d0,#ffe9aa 18%,#f4d8fa 35%,#a2e5e4 55%,#ffd7ed 76%,#b688d0);
  box-shadow: 1px 3px 9px #6a348c55,inset 0 0 0 2px #d6a9e8;
}
.storybook-dialog .glitter-card.earned::after, .storybook-dialog .glitter-card.is-earned::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg,transparent 35%,#ffffff55 49%,transparent 63%);
  background-size: 300% 100%; animation: glitterSheen 6s ease-in-out infinite;
}
@keyframes glitterSheen { 0%,25% { background-position: 150% 0; } 75%,100% { background-position: -150% 0; } }
@media(prefers-reduced-motion:reduce) { .storybook-dialog .glitter-card::after { animation: none; opacity: .25; } }

/* Card-stock divider tabs belong to the book, extending from its page edge. */
.book-has-index .book-spread { z-index: 2; }
.book-index-tabs {
  position: absolute; z-index: 1; top: 12%; left: calc(100% - 13px);
  display: flex; flex-direction: column; gap: 12px; width: 48px;
}
.book-index-tabs button {
  position: relative; display: flex; align-items: center; justify-content: center;
  writing-mode: vertical-rl; white-space: nowrap; text-orientation: mixed;
  width: 42px; min-width: 0; height: clamp(88px,16dvh,132px); min-height: 0;
  margin: 0; padding: 10px 7px 10px 14px; border: 1px solid #b38a4d;
  border-left: 0; border-radius: 0 9px 9px 0; color: #61441f;
  background: repeating-linear-gradient(0deg,#ffffff12 0 1px,transparent 1px 4px),linear-gradient(90deg,#a37b3d,#d4af6a 25%,#e8cb8d 88%,#c29d5d);
  box-shadow: inset -2px 0 1px #fff4cb66,2px 3px 3px #160d2144;
  font: 900 clamp(10px,1.2vw,12px)/1.1 "Outfit",sans-serif; letter-spacing: .04em;
  cursor: pointer; transition: width 160ms ease,filter 160ms ease;
}
.book-index-tabs button[data-brain-tab="glitter"] {
  border-color: #9676ac; color: #4c345f;
  background: repeating-linear-gradient(25deg,#ffffff16 0 1px,transparent 1px 4px),linear-gradient(105deg,#92749d,#dabbea 35%,#cfebe6 64%,#e6c9ee 90%,#ab85ba);
}
.book-index-tabs button[aria-pressed="true"] {
  width: 48px; filter: brightness(1.12);
  box-shadow: inset -2px 0 1px #fff8e9aa,3px 4px 4px #160d2155;
}
.book-index-tabs button:hover { filter: brightness(1.16); }
.book-index-tabs button:focus-visible { outline: 2px solid #fff1bd; outline-offset: 3px; }
@media(max-width:640px) {
  .book-index-tabs { left: calc(100% - 12px); width: 38px; top: 10%; gap: 10px; }
  .book-index-tabs button { width: 33px; height: clamp(90px,17dvh,125px); padding-left: 12px; font-size: 10px; border-radius: 0 7px 7px 0; }
  .book-index-tabs button[aria-pressed="true"] { width: 38px; }
}
@media(prefers-reduced-motion:reduce) { .book-index-tabs button { transition: none; } }

/* Navigation follows the actual book centre, including on smaller screens. */
.storybook-dialog.book-ready .book-stage > .book-navigation {
  position: absolute; inset: auto; top: 50%; left: 50%; width: 100vw; height: 0;
  transform: translateX(-50%); z-index: 4; pointer-events: none;
}
.storybook-dialog.book-ready .book-navigation .book-arrow {
  top: 0; bottom: auto; transform: translateY(-50%);
  display: grid; place-items: center; width: 50px; height: 58px; padding: 11px;
  border: 1px solid #d6bfdc88; border-radius: 14px;
  background: linear-gradient(145deg,#554160,#30253e); color: #fff0d1;
  box-shadow: 0 5px 16px #10091966,inset 0 1px 0 #ffffff22;
  pointer-events: auto; transition: background 150ms ease,box-shadow 150ms ease;
}
.storybook-dialog.book-ready .book-navigation .book-arrow svg { width: 28px; height: 28px; stroke-width: 2.4; }
.storybook-dialog.book-ready .book-navigation .book-arrow:not(:disabled):hover {
  color: #fff8e7; background: linear-gradient(145deg,#755782,#493459);
  box-shadow: 0 5px 20px #10091988,0 0 0 2px #e9ca9e44;
}
.storybook-dialog.book-ready .book-navigation .book-arrow:disabled { opacity: .3; pointer-events: none; box-shadow: none; }
/* Leave the middle of the book edge clear for the page arrows. */
.book-index-tabs { top: 7%; height: 34%; gap: 8px; }
.book-index-tabs button { flex: 1; height: auto; min-height: 0; padding-top: 5px; padding-bottom: 5px; }
@media(max-width:640px) {
  .storybook-dialog.book-ready .book-navigation .book-arrow { width: 30px; height: 48px; padding: 4px; border-radius: 9px; }
  .storybook-dialog.book-ready .book-navigation .book-arrow-prev { left: 1px; }
  .storybook-dialog.book-ready .book-navigation .book-arrow-next { right: 1px; }
  .storybook-dialog.book-ready .book-navigation .book-arrow svg { width: 23px; height: 23px; }
  .book-index-tabs { top: 7%; height: 34%; }
  .book-index-tabs button { height: auto; font-size: 9px; }
}

/* Locked glitter cards read like a card: symbols, challenge, then caption. */
:is(#brainAlbum, #hubAlbumDialog).storybook-dialog.book-ready .book-pockets > button.glitter-card:is(.locked, .is-locked) {
  display: grid; grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr) auto;
  align-items: stretch; align-content: stretch; justify-items: stretch;
  padding: clamp(7px,1.1vw,13px); gap: 6px; border: 1px dashed #b59acd; border-radius: 7px;
  color: #483858; background: linear-gradient(150deg,#f7f1fc,#f0f8fa); text-align: center;
}
:is(#brainAlbum, #hubAlbumDialog).book-ready .glitter-card > .glitter-lock {
  display: block; align-self: start; width: 100%; margin: 0; padding: 0 0 5px;
  border-bottom: 1px solid #b59acd30; font-size: clamp(16px,1.8vw,23px); line-height: 1.1; letter-spacing: .12em; color: #9673b6;
}
:is(#brainAlbum, #hubAlbumDialog).book-ready .glitter-placeholder-body {
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 7px;
  min-width: 0; min-height: 0; padding: 1px; overflow-wrap: anywhere;
}
:is(#brainAlbum, #hubAlbumDialog).book-ready .glitter-placeholder-body .glitter-task {
  display: block; max-width: 30ch; font: 600 clamp(10px,1.05vw,13px)/1.4 "Outfit",sans-serif; color: #483858; text-wrap: pretty;
}
:is(#brainAlbum, #hubAlbumDialog).book-ready .glitter-placeholder-body .glitter-progress {
  display: block; font: 800 clamp(8px,.85vw,10px)/1.3 "Outfit",sans-serif; color: #79558f;
}
:is(#brainAlbum, #hubAlbumDialog).storybook-dialog.book-ready .book-pockets > button.glitter-card > .glitter-placeholder-footer {
  display: block; width: 100%; align-self: end; padding-top: 6px; border-top: 1px solid #b59acd30;
  font: 800 clamp(8px,.8vw,10px)/1.3 "Outfit",sans-serif; color: #76568a;
}
@media (max-width:980px) and (min-height:561px) {
  .book-glitter-collection.book-ready .book-pockets { grid-template-columns: minmax(0,1fr); grid-template-rows: repeat(2,minmax(0,1fr)); }
  :is(#brainAlbum, #hubAlbumDialog).book-ready .glitter-placeholder-body .glitter-task { font-size: 12px; line-height: 1.3; }
  :is(#brainAlbum, #hubAlbumDialog).book-ready .glitter-placeholder-body { gap: 4px; }
}
@media (max-height:560px) {
  :is(#brainAlbum, #hubAlbumDialog).book-ready .glitter-card > .glitter-lock { font-size: 15px; padding-bottom: 3px; }
  :is(#brainAlbum, #hubAlbumDialog).book-ready .glitter-placeholder-body { gap: 3px; }
  :is(#brainAlbum, #hubAlbumDialog).book-ready .glitter-placeholder-body .glitter-task { font-size: 10px; line-height: 1.25; }
}

@media (max-width:360px), (max-height:400px) {
  .book-glitter-collection.book-ready .book-pockets { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); }
}

/* Personal cover: paper seals and scratches pressed into the cloth. */
.book-opening .book-cover { animation-duration: 3600ms; pointer-events: auto; }
@keyframes pictureAlbumOpen {
  0%,65% { opacity: 1; transform: rotateY(0); }
  87% { opacity: 1; }
  100% { opacity: 0; transform: rotateY(-110deg); }
}
.book-cover-sticker {
  position: absolute; top: 9%; left: 8%; width: clamp(76px,12vw,132px); aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 12px 8px; border: 5px solid #fff5cc; border-radius: 50%;
  color: #705016; background: linear-gradient(130deg,#fff7c9,#f9d56a 47%,#e9b844 72%,#fff0ae);
  box-shadow: 2px 5px 5px #170a2655,inset 0 0 0 1px #aa7b3580,inset 0 2px 3px #ffffffa0;
  transform: rotate(-12deg); text-align: center; font-family: "Outfit",sans-serif;
}
.book-cover .book-cover-sticker > small { font-size: clamp(7px,.85vw,10px); font-weight: 900; letter-spacing: .02em; line-height: 1.2; }
.book-cover .book-cover-sticker > strong { max-width: none; color: inherit; font: 900 clamp(10px,1.35vw,17px)/1.1 "Outfit",sans-serif; text-shadow: none; }
.book-cover .book-cover-sticker .sticker-star { font-size: clamp(14px,2vw,25px); line-height: 1; }
.book-cover-sticker::after { content: ''; position: absolute; right: 1px; bottom: 5px; width: 20%; height: 20%; border-radius: 45% 10% 55% 10%; background: linear-gradient(140deg,#e3d7b7,#fffdf0 58%,#b19d7560 64%,transparent 70%); transform: rotate(18deg); }
.book-cover-sticker.sticker-glitter { left: auto; right: 8%; top: 12%; transform: rotate(10deg); color: #63417e; border-color: #f8f0ff; background: linear-gradient(130deg,#f8efff,#d7b8ed 27%,#c3ece7 50%,#fae4ad 72%,#e7c6f2); }
.book-cover-tallies { position: absolute; bottom: 7%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: 70%; max-width: 420px; color: #c4a5ce; text-shadow: 0 1px 0 #25112e,0 -1px 0 #e3c5ed33; }
.book-cover .book-tally-caption { font: 800 clamp(8px,1vw,12px)/1.2 "Outfit",sans-serif; letter-spacing: .1em; text-transform: uppercase; }
.book-cover-tallies svg { display: block; width: auto; max-width: 100%; height: 48px; overflow: visible; }
.book-cover-tallies .tally-highlight { fill: none; stroke: #e5bd55; stroke-width: 4.3; stroke-linecap: butt; opacity: .35; }
.book-cover-tallies .tally-scratch { fill: none; stroke: #f5d772; stroke-width: 3.1; stroke-linecap: butt; stroke-linejoin: round; }
.book-cover-tallies small { font: 600 8px/1.2 "Outfit",sans-serif; letter-spacing: .02em; }
.book-cover-description { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
@media(max-width:980px) {
  .book-cover-sticker { width: 78px; padding: 9px 4px; border-width: 3px; top: 8%; left: 7%; }
  .book-cover-sticker.sticker-glitter { top: 10%; right: 7%; }
  .book-cover .book-cover-sticker > strong { font-size: 11px; }
  .book-cover .book-cover-sticker > small { font-size: 7px; }
  .book-cover .book-cover-sticker .sticker-star { font-size: 18px; }
  .book-cover-tallies { width: 78%; bottom: 7%; gap: 4px; }
  .book-cover-tallies svg { height: 38px; }
  .book-cover-emblem { font-size: 2rem; }
}
@media(max-height:560px) {
  .book-cover-sticker { width: 58px; gap: 1px; padding: 6px 2px; border-width: 2px; top: 8%; left: 5%; }
  .book-cover-sticker.sticker-glitter { right: 5%; top: 8%; }
  .book-cover .book-cover-sticker > strong { font-size: 8px; }
  .book-cover .book-cover-sticker > small { font-size: 5px; }
  .book-cover .book-cover-sticker .sticker-star { font-size: 12px; }
  .book-cover-emblem, .book-cover-ornament { display: none; }
  .book-cover { gap: 7px; }
  .book-ready .book-cover > strong { max-width: 58%; font-size: 1.1rem; }
  .book-cover-tallies { bottom: 6%; gap: 2px; }
  .book-cover-tallies svg { height: 24px; }
  .book-cover .book-tally-caption { font-size: 7px; }
}
@media(prefers-reduced-motion:reduce) { .book-opening .book-cover { animation: none; pointer-events: none; } }
.book-cover > span.book-cover-sticker { letter-spacing: normal; }
