/* The three YWY stories use whole episode frames, with readable bounded pages. */
#game #playroom-focus.fit-activity.activity-book.episode-reader{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto minmax(0,1fr) 48px!important;gap:5px!important}
#game #playroom-focus.fit-activity.activity-library.episode-shelf-root{grid-template-columns:minmax(0,1fr)!important;grid-template-rows:auto minmax(0,1fr)!important;gap:5px!important}
#game .fit-activity.episode-reader #play-stage,#game .fit-activity.episode-shelf-root #play-stage{grid-column:1!important;grid-row:2!important}
#game .fit-activity.episode-reader #play-tools{grid-column:1!important;grid-row:3!important;align-self:center;display:flex!important;flex-direction:row!important;flex-wrap:nowrap!important;height:48px!important;gap:8px!important;max-width:600px;justify-self:center}
#game .fit-activity.episode-reader #play-tools{display:grid!important;grid-template-columns:52px 44px 52px 52px!important;width:auto!important;direction:ltr}
#game .fit-activity.episode-reader #book-shelf{grid-column:auto!important;max-width:none!important;justify-self:auto;min-height:48px!important}
#game .fit-activity.episode-reader #book-count{font-size:16px;text-align:center;white-space:nowrap}
#game .fit-activity.episode-reader #play-feedback,#game .fit-activity.episode-shelf-root #play-feedback{display:none!important}
#game .episode-reader .open-book{box-sizing:border-box;width:100%;max-width:1100px;height:100%;max-height:620px;min-height:0!important;margin:0!important;padding:12px!important;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);grid-template-rows:minmax(0,1fr);gap:18px;direction:ltr;align-items:center;border-radius:5px 13px 13px 5px;overflow:visible}
#game .episode-reader .book-art{box-sizing:border-box;width:100%;height:auto!important;min-height:0;max-height:100%;max-width:100%;aspect-ratio:var(--art-ratio);background-size:contain!important;background-position:center!important;background-repeat:no-repeat!important;margin:0!important;align-self:center;border-radius:4px;box-shadow:none}
#game .episode-reader .book-page{direction:rtl;align-self:center;min-height:0;padding:0 2px!important;display:block;position:relative}
#game .episode-reader .book-page h2{font-size:clamp(20px,1.8vw,26px);line-height:1.2;margin:0 0 6px!important}
#game .episode-reader .book-page p{font-size:clamp(16px,1.45vw,21px);line-height:1.45;margin:0!important}
#game .episode-reader .book-number,#game .episode-reader .page-corner{display:none}
#game .episode-reader .open-book:after{left:calc(47.6% - 7px);width:14px;top:0;bottom:0;opacity:.6}
#game .episode-reader .leaf-art{background-size:contain!important;background-position:center!important;background-repeat:no-repeat!important}
#game .episode-reader .book-leaf{max-height:100%;overflow:hidden}
#game .episode-shelf{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:minmax(0,1fr);align-items:center;gap:18px;width:100%;max-width:1000px;height:100%;max-height:420px;padding:12px 15px 22px!important;box-sizing:border-box}
#game .episode-shelf:after{bottom:6px;height:18px}
#game #playroom-focus .episode-shelf .story-cover{width:100%!important;height:100%;max-height:350px;min-height:0!important;display:flex;flex-direction:column;padding:0 0 14px!important;transform:rotate(-1deg);border-radius:3px 10px 10px 3px;box-shadow:4px 4px #f7edd1,7px 7px #5d4939,9px 10px 12px #422d3a35}
#game #playroom-focus .episode-shelf .story-cover:nth-child(2){transform:rotate(1deg)}
#game .episode-shelf .cover-art{box-sizing:border-box;margin:10px 8px 8px 12px;min-height:0;max-height:none;aspect-ratio:1;flex:1;background-color:#fff2d9;background-size:contain!important;background-repeat:no-repeat!important;background-position:center!important;border-radius:3px}
#game .episode-shelf .story-cover b{font-size:clamp(16px,2vw,23px);line-height:1.25;margin:0!important;padding:0 8px}
#game .episode-shelf .story-cover small{font-size:13px;line-height:1.3;margin:6px 0 0;padding:0 8px}
#game .fit-activity.episode-shelf-root #play-tools{display:none!important}
#game .puzzle-stacked .puzzle-layout{flex-direction:column!important}
#game .puzzle-stacked .puzzle-reference{order:-1}
#game .activity-puzzle .puzzle-reference span{aspect-ratio:1672/941}
#game .activity-puzzle .puzzle-frame{aspect-ratio:1672/941}
@media(max-width:650px) and (orientation:portrait){
 #game .episode-reader .open-book{grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);gap:8px;max-width:440px;max-height:620px}
 #game .episode-reader .book-art{width:100%;max-height:none}
 #game .episode-reader .book-page{padding:0!important}
 #game .episode-reader .book-page h2{font-size:20px}#game .episode-reader .book-page p{font-size:16px;line-height:1.45}
 #game .episode-reader .open-book:after{left:2px;width:7px}
 #game .episode-shelf{gap:12px;padding:8px 6px 20px!important;max-height:300px}
 #game .episode-shelf .story-cover small{display:none}
 #game .episode-shelf .cover-art{margin:8px 5px 8px 8px}
 #game .episode-shelf .story-cover b{font-size:16px;padding:0 5px}
}
@media(orientation:landscape) and (max-height:600px){
 #game .episode-reader .book-page h2{font-size:19px}#game .episode-reader .book-page p{font-size:16px;line-height:1.4}
 #game .episode-reader .open-book{gap:18px}
 #game .episode-shelf{padding:3px 8px 12px!important;gap:16px;max-height:none}
 #game .episode-shelf .story-cover small{display:none}
 #game .episode-shelf .story-cover b{font-size:16px;line-height:20px}
 #game #playroom-focus .episode-shelf .story-cover{padding-bottom:5px!important}
 #game .episode-shelf .cover-art{margin:5px 6px 4px}
}
#game .episode-reader .open-book{border:0!important}
#game .fit-activity.episode-reader #book-count{min-width:0!important;width:44px!important;padding:0!important}
#game .episode-shelf .cover-art{margin:10px 8px 8px 12px!important}
@media(max-width:650px) and (orientation:portrait){#game .episode-shelf .cover-art{margin:8px 5px 8px 8px!important}}
@media(orientation:landscape) and (max-height:600px){#game .episode-shelf .cover-art{margin:5px 6px 4px!important}}
@media(orientation:landscape) and (max-height:360px){#game .episode-reader .open-book{padding:6px 12px!important}#game .episode-reader .book-page p{line-height:1.35}}
#game .activity-puzzle .puzzle-tile.selected{transform:none}
/* Phone shelf: wide board books keep the full YWY scene recognizable. */
@media(max-width:650px) and (orientation:portrait){
 #game .episode-shelf{grid-template-columns:minmax(0,1fr);grid-template-rows:repeat(3,minmax(0,1fr));max-height:360px;gap:12px;padding:8px 8px 18px!important}
 #game #playroom-focus .episode-shelf .story-cover{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);grid-template-rows:minmax(0,1fr);align-items:center;padding:5px!important;max-height:none;gap:7px;direction:ltr;transform:rotate(-.5deg)}
 #game #playroom-focus .episode-shelf .story-cover:nth-child(2){transform:rotate(.5deg)}
 #game .episode-shelf .cover-art{width:100%;height:auto;max-height:100%;aspect-ratio:1672/941;margin:0!important;flex:none;align-self:center}
 #game .episode-shelf .story-cover b{font-size:18px;line-height:1.25;direction:rtl;padding:0 8px 0 0;margin:0!important}
}

#game .activity-puzzle .puzzle-layout{max-width:none!important}#game .puzzle-wide .puzzle-reference small{font-size:14px;line-height:18px}

#game .activity-book #book-count{display:inline-flex;direction:ltr;justify-content:center;align-items:center;gap:3px}#game .activity-puzzle .puzzle-reference small{line-height:12px}#game .puzzle-wide .puzzle-reference small{line-height:18px}

/* Arabic sequence controls: increasing pages go left, without mirroring words. */
#game .activity-book #play-tools{direction:ltr}
#game .activity-book #book-next{order:-1;direction:rtl}
#game .activity-book #book-prev{order:1;direction:rtl}
#game .activity-book #book-shelf{direction:rtl}
#game .activity-book .open-book{position:relative}
#game .activity-book .book-page-zone{position:absolute!important;top:0!important;bottom:0!important;width:50%!important;height:100%!important;min-width:0!important;min-height:44px!important;margin:0!important;padding:0!important;border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;z-index:3;cursor:pointer;touch-action:pan-y}
#game .activity-book .page-next-zone{left:0;right:auto}
#game .activity-book .page-prev-zone{right:0;left:auto}
#game .activity-book .book-page-zone:disabled{cursor:default;opacity:1}
#game .activity-book .book-page-zone:focus-visible{outline:3px dashed #5f8b91;outline-offset:-5px}
#game .activity-book .book-leaf{pointer-events:none;z-index:4}
#game .activity-book .book-image-status{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:5;padding:6px 12px;border-radius:9px;background:#fff9e9eF;color:#294c60;font:16px Thmanyah;pointer-events:none}
#game .activity-book .book-image-status[hidden]{display:none!important}
#game .activity-book .book-image-status button{pointer-events:auto;min-height:44px;font:16px Thmanyah}
#game .activity-book .book-art.image-loading{opacity:.3}
#game .episode-reader .book-art,#game .episode-reader .leaf-art{border:0!important;border-radius:0!important;box-shadow:none!important;-webkit-mask-image:url('assets/playroom/book-brush-mask.svg');mask-image:url('assets/playroom/book-brush-mask.svg');-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}
/* Every new picture keeps the full native frame and the same large tile geometry. */
#game .activity-puzzle .puzzle-tile:disabled{opacity:1;filter:none;cursor:default}
#game .activity-puzzle .puzzle-continue{position:absolute;inset:0;width:100%;height:100%;border:0;background:transparent;box-shadow:none;z-index:3;min-width:44px;min-height:44px}
#game .activity-puzzle .puzzle-continue:focus-visible{outline:3px dashed #356d60;outline-offset:-8px}
#game .activity-puzzle #puzzle-next{order:-1}
#game .activity-puzzle #puzzle-count{font-size:15px!important;line-height:20px!important}
#game .activity-puzzle #play-tools{direction:ltr;flex-wrap:nowrap!important}
#game .activity-puzzle #play-tools>*{direction:rtl}
#game .activity-puzzle #puzzle-retry{order:1}
#game .fit-activity.short-play.activity-puzzle #play-tools{grid-template-columns:1fr!important;gap:6px!important}
#game .fit-activity.short-play.activity-puzzle #puzzle-count{grid-row:1;white-space:nowrap;width:100%;text-align:center}
#game .fit-activity.short-play.activity-puzzle #puzzle-next{grid-row:2}
#game .fit-activity.short-play.activity-puzzle #puzzle-retry{grid-row:3}
