/* Books pop-up (category cards, bookshelf with spines), the book reader (cover, page turn) and the new-thing halo. */
.modal.books { width: min(1000px, 100%); }

/* step 1: category cards */
.cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.cat { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 0 0 10px; text-align: center; background: var(--cream); border: 3px solid var(--wood); border-radius: 12px; box-shadow: inset 2px 2px 0 #FFF4E2, 0 4px 0 var(--wood-d); overflow: hidden; transition: transform .1s; }
@media (hover: hover) { .cat:hover { transform: translateY(-3px); } } .cat:active { transform: translateY(1px); }
.cat .art { align-self: stretch; display: grid; place-items: center; padding: 14px 0 10px; background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, white), var(--c)); border-bottom: 3px solid var(--wood); }
.cat-ic { width: 72px; height: 72px; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgba(78, 44, 24, .35)); animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.cat b { font-family: var(--pixel); font-size: 20px; padding: 0 8px; }
.cat small { padding: 0 10px; font-size: calc(13px + var(--more)); color: #7A5A3C; }
.cat .count { font-weight: 700; color: var(--ink); }
.pips { display: flex; gap: 3px; align-items: flex-end; height: 22px; padding: 0 8px; flex-wrap: wrap; justify-content: center; }
.pips i { width: 7px; height: 20px; background: #CDBEA8; border: 2px solid #A99880; border-radius: 2px; }
.pips i.on { background: var(--c); border-color: var(--wood); }

/* step 2: the bookcase */
.shelf-note { min-height: 1.4em; }
.case { margin: 6px 0 10px; padding: 10px 12px 0; background: color-mix(in srgb, var(--c) 28%, #6B3F24); border: 4px solid var(--wood); border-radius: 8px; box-shadow: inset 0 0 0 3px var(--wood-d); }
.shelf-row { display: flex; align-items: flex-end; gap: 6px; justify-content: flex-start; padding: 8px 6px 0; min-height: 206px; margin-bottom: 10px; background: var(--wood-d); border-bottom: 10px solid #A8703F; box-shadow: inset 0 -3px 0 #C58A56; border-radius: 4px 4px 0 0; }
.spine { position: relative; width: 78px; height: var(--h); display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 8px 4px 6px; background: var(--c); border: 3px solid #3A2210; border-radius: 4px 4px 2px 2px; box-shadow: inset 4px 0 0 rgba(255, 255, 255, .28), inset -4px 0 0 rgba(0, 0, 0, .22), 0 0 0 0 transparent; color: #FFF8E8; transition: transform .1s; }
.spine::before, .spine::after { content: ''; position: absolute; left: 0; right: 0; height: 5px; background: rgba(255, 240, 200, .75); }
.spine::before { top: 10px; } .spine::after { bottom: 30px; }
@media (hover: hover) { .spine:hover { transform: translateY(-6px); } }
.spine .t { flex: 1; writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 800; font-size: 15px; line-height: 1.15; text-shadow: 0 1px 0 rgba(0, 0, 0, .45); min-height: 0; overflow: hidden; margin: 22px 0 14px; text-align: center; }
.spine small { font: 700 12px var(--font); background: #FFF4E2; color: var(--ink); border-radius: 4px; padding: 1px 5px; z-index: 1; }
.spine.open { filter: saturate(.8) brightness(.96); }
.spine.known small { background: #DDEBC8; color: var(--green); }
.spine.silhouette { background: #8E8070; border-color: #5A4E42; color: #CDBFAE; box-shadow: inset 4px 0 0 rgba(255, 255, 255, .12), inset -4px 0 0 rgba(0, 0, 0, .25); cursor: help; }
.spine.silhouette::before, .spine.silhouette::after { background: rgba(0, 0, 0, .18); }

/* the reader: a leather cover, cream pages with stacked edges, a ribbon */
.modal.reader { width: min(860px, 100%); }
.tome { position: relative; padding: 12px; background: #8B5A3C; border: 4px solid var(--wood-d); border-radius: 12px; box-shadow: inset 0 0 0 3px #A8703F, 0 5px 0 var(--wood-d); }
.pages { position: relative; display: grid; grid-template-columns: 1fr 1fr; min-height: 340px; perspective: 1800px; background: #F6E8CF; border-radius: 4px; box-shadow: 4px 4px 0 #E8D2AE, 8px 8px 0 #D8BE98, 0 0 0 2px #D8BE98; }
.pages.one { grid-template-columns: 1fr; min-height: 380px; overflow: hidden; }
.pages::after { content: ''; position: absolute; top: 0; bottom: 0; left: calc(50% - 14px); width: 28px; background: linear-gradient(90deg, transparent, rgba(107, 63, 36, .28) 46%, rgba(78, 44, 24, .4) 50%, rgba(107, 63, 36, .28) 54%, transparent); pointer-events: none; z-index: 4; }
.pages.one::after { display: none; }
.slot { position: relative; background: #F6E8CF; }
.slot.l { border-radius: 4px 0 0 4px; } .slot.r { border-radius: 0 4px 4px 0; }
.page { position: absolute; inset: 0; padding: 18px 22px 30px; font-size: calc(16px + var(--more)); line-height: 1.45; background: #F6E8CF; overflow: auto; }
.page p { margin: 0 0 .7em; }
.page h3 { margin: 0 0 8px; font-size: 20px; color: var(--wood); }
.page .no { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font: 600 13px var(--pixel); color: #A98A62; }
.page .pros { margin-top: 10px; }
.flip { position: absolute; top: 0; bottom: 0; transform-style: preserve-3d; z-index: 3; }
.flip.r { left: 50%; right: 0; transform-origin: left center; } .flip.l { left: 0; right: 50%; transform-origin: right center; } .flip.full { left: 0; right: 0; transform-origin: left center; }
.flip .face { position: absolute; inset: 0; backface-visibility: hidden; background: #F6E8CF; box-shadow: 0 0 14px rgba(78, 44, 24, .35); }
.flip .face .page { inset: 0; }
.flip .back { transform: rotateY(180deg); }
.ribbon { position: absolute; top: 8px; left: 50%; width: 14px; height: 70px; margin-left: -7px; background: var(--red); z-index: 5; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); box-shadow: 0 0 0 2px #9C3A3A; pointer-events: none; }
/* the cover is a .flip (right half, hinged at the spine): front = leather, back = page 1 */
.cover { z-index: 6; }
.cover .front { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; padding: 20px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 70%, #6B3F24), color-mix(in srgb, var(--c) 40%, #4E2C18)); border: 4px solid var(--wood-d); border-radius: 0 10px 10px 0; box-shadow: inset 0 0 0 4px #E8B86A, inset 10px 0 0 rgba(0, 0, 0, .2); color: #FFF4E2; }
.cover.full .front { border-radius: 4px 10px 10px 4px; }
.cover b { font: 600 28px var(--pixel); text-shadow: 0 2px 0 rgba(0, 0, 0, .4); } .cover small { font-size: 16px; opacity: .85; }
.tome { perspective: 1800px; }
@media (max-width: 760px) { .ribbon { display: none; } .cat-ic { width: 56px; height: 56px; } .cats { grid-template-columns: 1fr 1fr; gap: 8px; } .cat b { font-size: 17px; }
  .spine { width: 62px; padding: 8px 2px 6px; } .spine .t { font-size: 14px; } .shelf-row { gap: 4px; padding: 8px 4px 0; } .case { padding: 8px 6px 0; }
  .page { padding: 14px 14px 30px; } .cover b { font-size: 22px; } }

/* new-thing halo (fx.js): a warm glow and small particles floating up, until the player has looked at it */
.halo { position: relative; z-index: 2; animation: halo-pulse 1.8s ease-in-out infinite; }
.halo.halo-off { animation: none; box-shadow: none; transition: box-shadow .5s; }
.halo-p { position: absolute; width: 4px; height: 4px; background: #FFF2C0; box-shadow: 0 0 4px #FFE08A; left: var(--x); bottom: 40%; opacity: 0; pointer-events: none; animation: halo-float 2.4s linear infinite; animation-delay: var(--d); }
.halo-off .halo-p { display: none; }
@keyframes halo-pulse { 50% { box-shadow: 0 0 0 4px rgba(255, 224, 138, .8), 0 0 22px 6px rgba(255, 224, 138, .9); } 0%, 100% { box-shadow: 0 0 0 2px rgba(255, 224, 138, .5), 0 0 10px 2px rgba(255, 224, 138, .5); } }
@keyframes halo-float { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(-46px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .halo-p { display: none; } .halo { animation: none; box-shadow: 0 0 0 3px rgba(255, 224, 138, .8), 0 0 14px 4px rgba(255, 224, 138, .8); } .cat-ic { animation: none; } }

/* "Skill learned" pop-up (reader.js unlocked): label + book, title, lesson, "You can now" card, a green and a red card, one wide button */
.modal.unlock-pop { padding: 24px 20px 20px; }
.unlock { display: flex; flex-direction: column; align-items: center; }
.unlock-label { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #8A6A4A; }
.unlock .big-icon { width: 80px; height: 80px; margin: 8px 0 12px; } /* the glow animation is in style.css */
.unlock h2 { margin: 0; font-size: 24px; line-height: 1.2; text-wrap: balance; }
.unlock .lesson { align-self: stretch; text-align: center; margin: 16px 0 0;font-size: calc(17px + var(--more)); font-weight: 800; line-height: 1.35; text-wrap: balance; }
.unlock .can { align-self: stretch; margin-top: 18px; padding: 10px 14px 12px; text-align: left; background: #FFF4E2; border: 2px solid var(--cream-d); border-radius: 10px; }
.unlock .can small, .tone-head { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.unlock .can small { color: #8A6A4A; }
.unlock .can p { margin: 4px 0 0; line-height: 1.35; }
.tones { align-self: stretch; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; text-align: left; }
.tone { padding: 10px 12px 12px; border: 2px solid; border-radius: 10px; }
.tone.good { background: color-mix(in srgb, var(--green) 18%, var(--cream)); border-color: color-mix(in srgb, var(--green) 55%, var(--cream)); } .tone.good .tone-head { color: var(--green); }
.tone.bad { background: color-mix(in srgb, var(--orange) 22%, var(--cream)); border-color: color-mix(in srgb, var(--red) 55%, var(--cream)); } .tone.bad .tone-head { color: #B23A33; }
.tone-head { display: flex; align-items: center; gap: 8px; }
.tone p { margin: 6px 0 0; line-height: 1.3; font-size: calc(15px + var(--more)); }
.tone-ic { position: relative; flex: none; width: 20px; height: 20px; }
.tone.good .tone-ic { background: var(--green); border-radius: 50%; } /* check mark: two borders of a turned box */
.tone.good .tone-ic::after { content: ''; position: absolute; left: 7px; top: 3px; width: 5px; height: 10px; border: solid #FFF4E2; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.tone.bad .tone-ic { background: var(--red); clip-path: polygon(50% 0, 100% 100%, 0 100%); } /* warning triangle with a bar and a dot */
.tone.bad .tone-ic::before { content: ''; position: absolute; left: 9px; top: 7px; width: 3px; height: 6px; background: #FFF4E2; }
.tone.bad .tone-ic::after { content: ''; position: absolute; left: 9px; top: 15px; width: 3px; height: 3px; background: #FFF4E2; }
.unlock .wide { width: 100%; margin-top: 20px; }
@media (max-aspect-ratio: 1/1), (max-width: 760px) { .tones { grid-template-columns: 1fr; } }

/* book card (books.js card): the green and the red line share one box, same text size as the lines above, one full-width button */
.book-card .pros { margin: 12px 0 0; padding: 10px 14px; font-size: inherit; line-height: 1.35; background: #FFF4E2; border: 2px solid var(--cream-d); border-radius: 10px; }
.book-card .pros > div { display: flex; gap: 8px; }
.book-card .pros > div + div { margin-top: 6px; }
.book-card .pros > div::before { flex: none; }
.book-card .wide { width: 100%; margin-top: 14px; }

/* air between the book and the Back / Next row (the tome shadow and the button edge touched) */
.tome + .spread { margin-top: 14px; }
