:root{--series-font:"Hiragino Sans","Noto Sans JP","Yu Gothic",sans-serif;--sans:"Hiragino Sans","Noto Sans JP","Yu Gothic",sans-serif}
.player-header,.player-controls,.series-next,.series-return{font-family:var(--series-font)}
.world-1{--world-color:#215e91;--world-soft:#c9efff;--world-shadow:#6eafcb}
.world-2{--world-color:#a34d29;--world-soft:#ffe0c4;--world-shadow:#cd996c}
.world-3{--world-color:#645497;--world-soft:#e6dcff;--world-shadow:#ab96c8}
.world-4{--world-color:#256977;--world-soft:#c8f2e6;--world-shadow:#79b9b2}
.world-5{--world-color:#a95723;--world-soft:#ffedaf;--world-shadow:#d2b365}
a.series-next{display:flex;flex-direction:column;text-decoration:none;cursor:pointer;transition:transform .15s,box-shadow .15s}
a.series-next:hover{transform:translateY(-2px);outline:2px solid currentColor;outline-offset:3px}
a.next-world.series-next{background:#fff7d899;border-radius:0;padding:0 1.2cqw;color:var(--ink);border:0;border-left:.25cqw solid var(--accent)}
.series-next-arrow{font-style:normal;margin-left:.4em}
.series-return{display:inline-block;color:var(--accent-color,#9b4c24);font-size:1.5cqw;font-weight:750;text-decoration:underline;text-underline-offset:.25em;margin-top:1cqw}
.navigation .arrow-button[data-cross-chapter]{outline:2px dashed currentColor;outline-offset:3px}

/* One overview for the complete adventure, isolated from chapter palettes. */
dialog#overview.series-overview{font-family:var(--series-font);color:#233d53;background:#f3f9f5;width:min(1160px,calc(100vw - 48px));max-width:none;max-height:90dvh;padding:0;border:3px solid #416275;border-radius:16px;box-shadow:0 8px 0 #6b96aa,0 20px 90px #193b5555;overflow:auto;scrollbar-color:#7c9dac #e3eceb;color-scheme:light}
#overview.series-overview::backdrop{background:#17384ccc;backdrop-filter:blur(5px)}
.series-overview .series-overview-top{position:sticky;top:0;z-index:3;padding:22px 28px 18px;background:#f3f9f5f7;border-bottom:2px solid #b8cdd0;backdrop-filter:blur(12px)}
.series-overview .dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:0}
.series-overview .series-kicker{display:block;font-size:11px;color:#54728a;margin-bottom:7px;letter-spacing:.06em}
.series-overview .dialog-heading h2{font-size:30px;line-height:1.2;color:#233d53;margin:0;font-weight:850;letter-spacing:-.025em}
.series-overview .series-total{display:block;font-size:15px;color:#506e7c;margin-top:8px}
.series-overview .close-button{flex-shrink:0;width:42px;height:42px;background:#245e83;color:white;border:2px solid #244f6a;border-radius:8px;box-shadow:0 3px 0 #8fb4c5;font-size:22px}
.series-overview .series-jump{display:flex;gap:8px;margin-top:17px;flex-wrap:wrap}
.series-overview .series-jump-button{background:var(--world-soft);color:var(--world-color);font-family:var(--series-font);border:1.5px solid var(--world-shadow);border-radius:8px;font-size:15px;line-height:1.4;padding:8px 11px;font-weight:750}
.series-overview .series-jump-button[aria-pressed=true]{outline:2px solid var(--world-color);outline-offset:2px}
.series-overview .series-jump-button:hover{filter:brightness(.96)}
.series-overview .series-home{display:flex;justify-content:space-between;align-items:center;gap:15px;margin:24px 28px 0;padding:18px 20px;border:2px solid #86adbd;background:#e0f1f6;border-radius:10px;text-decoration:none;color:#28516d}
.series-overview .series-home strong{font-size:20px;color:inherit}
.series-overview .series-home span{font-size:15px;color:#476e80}
.series-overview #overview-grid{display:block;padding:0 28px 30px;margin:0}
.series-overview .series-group{scroll-margin-top:202px;padding-top:30px}
.series-overview .series-group-heading{display:flex;align-items:center;justify-content:space-between;padding:0 0 13px;border-bottom:2px solid var(--world-shadow);margin-bottom:15px}
.series-overview .series-group-title{display:flex;align-items:center;gap:16px;text-decoration:none;color:var(--world-color)}
.series-overview .series-group-title .mono{font-size:12px;white-space:nowrap;background:var(--world-soft);padding:9px 10px;border-radius:6px}
.series-overview .series-group-title h3{font-size:24px;font-weight:800;color:inherit;margin:0}
.series-overview .series-group-count{font-size:15px;font-weight:700;color:var(--world-color);white-space:nowrap}
.series-overview .series-cards{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:13px}
.series-overview .series-slide{display:grid;grid-template-columns:66px minmax(0,1fr);gap:12px;padding:12px;min-height:144px;text-decoration:none;color:#263e4d;background:#fffef7;border:1.5px solid #bbccd0;border-radius:9px;box-shadow:0 3px 0 #d8e3e3;transition:transform .15s,box-shadow .15s}
.series-overview .series-slide:hover{transform:translateY(-2px);box-shadow:0 5px 0 var(--world-shadow);border-color:var(--world-color)}
.series-overview .series-slide[aria-current=page]{background:var(--world-soft);outline:2px solid var(--world-color);outline-offset:1px}
.series-overview .series-slide-preview{position:relative;height:120px;display:flex;align-items:center;justify-content:center;overflow:hidden;background:var(--world-soft);border-radius:5px}
.series-overview .series-slide-preview img{display:block;max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain}
.series-overview .series-slide-copy{align-self:center;min-width:0}
.series-overview .series-slide-number{font-size:11px;color:var(--world-color);display:block;margin-bottom:8px}
.series-overview .series-slide-copy strong{font-size:16px;line-height:1.55;color:#263e4d;display:block;font-weight:750;overflow-wrap:anywhere}
.series-overview .series-slide-copy small{font-size:12px;color:#617c87;display:block;margin-top:7px;line-height:1.4}
.series-overview .series-text-preview{font-size:11px;color:var(--world-color)}
.series-overview .series-video{position:absolute;bottom:3px;left:3px;right:3px;font-size:10px;color:white;background:#23405bcc;border-radius:3px;padding:3px;text-align:center}
.series-overview :is(a,button):focus-visible{outline:3px solid #226da4;outline-offset:3px}
@media(max-width:1000px){.series-overview .series-cards{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:700px){
 dialog#overview.series-overview{width:calc(100vw - 20px);max-height:94dvh;border-width:2px;border-radius:12px}
 .series-overview .series-overview-top{padding:17px 16px 15px}.series-overview .dialog-heading h2{font-size:25px}.series-overview .series-total{font-size:14px}
 .series-overview .series-jump{gap:7px}.series-overview .series-jump-button{font-size:13px;padding:7px 9px}.series-overview .series-kicker{font-size:9px}
 .series-overview .series-home{margin:18px 16px 0;padding:14px;align-items:flex-start;flex-direction:column;gap:4px}.series-overview .series-home strong{font-size:20px}
 .series-overview #overview-grid{padding:0 16px 24px}.series-overview .series-group{scroll-margin-top:243px;padding-top:25px}.series-overview .series-group-title{gap:9px}.series-overview .series-group-title h3{font-size:20px}.series-overview .series-group-title .mono{font-size:9px;padding:7px}.series-overview .series-group-count{font-size:13px}
 .series-overview .series-cards{grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}.series-overview .series-slide{grid-template-columns:1fr;gap:9px;padding:11px;min-height:0}.series-overview .series-slide-preview{height:106px}.series-overview .series-slide-copy strong{font-size:15px;line-height:1.5}.series-overview .series-slide-copy small{font-size:12px}.series-overview .series-slide-number{margin-bottom:5px;font-size:10px}
 a.next-world.series-next{padding:3cqw 4cqw;border-radius:2cqw;border-width:1px}.series-return{font-size:16px;margin-top:14px}
}
@media(prefers-reduced-motion:reduce){.series-overview .series-slide,a.series-next{transition:none}}

.series-next br{display:initial}

/* Japanese manifest-driven slides. The app captures always remain fully visible. */
.manifest-slide{font-family:var(--sans)}
.manifest-layout{height:45.9cqw;display:grid;grid-template-columns:minmax(0,1.22fr) minmax(25cqw,.78fr);gap:3.2cqw;align-items:center;padding:2.2cqw 0 3.6cqw}
.manifest-copy{min-width:0;padding:0}
.manifest-copy .chapter-ticket{display:inline-block;margin:0 0 1.1cqw;padding:.42cqw .72cqw;border:1px solid var(--rule);font-size:.7cqw;letter-spacing:.06em}
.manifest-copy h1,.manifest-copy h2{margin:0;color:var(--ink);font-weight:850;letter-spacing:-.045em;line-height:1.28;text-wrap:balance;overflow-wrap:anywhere}
.manifest-copy h1{font-size:4.25cqw}
.manifest-copy h2{font-size:2.85cqw}
.manifest-copy .subtitle{font-size:1.38cqw;line-height:1.58;margin:1.05cqw 0 1.35cqw;color:var(--ink);font-weight:650;text-wrap:balance}
.manifest-body{max-width:46cqw}
.manifest-body p{font-size:1.05cqw;line-height:1.72;margin:.72cqw 0 0;color:var(--soft);letter-spacing:0;overflow-wrap:anywhere}
.manifest-body p:first-child{margin-top:0}
.manifest-media{height:40.2cqw;display:flex;align-items:center;justify-content:center;gap:1.15cqw;min-width:0;isolation:isolate}
.manifest-media::before{content:'';position:absolute;inset:1cqw;border:1px solid color-mix(in srgb,var(--rule) 55%,transparent);z-index:-1;pointer-events:none}
.manifest-media .shot{height:100%;min-width:0;flex:1;display:flex;align-items:center;justify-content:center;margin:0;position:relative;z-index:1}
.manifest-media .shot img,.manifest-media .shot video{display:block;width:auto;height:auto;max-width:100%;max-height:39cqw;object-fit:contain;border:1px solid color-mix(in srgb,var(--rule) 55%,transparent);box-shadow:0 .7cqw 2.4cqw #0003;background:transparent}
.manifest-media .shot img{cursor:zoom-in}
.manifest-media .app-icon img{width:22cqw;height:22cqw;object-fit:contain;border:0;box-shadow:.8cqw .8cqw 0 color-mix(in srgb,var(--rule) 40%,transparent)}
.has-two-shots .manifest-media .shot img{max-height:36.5cqw}
.has-video .manifest-media{gap:.8cqw}
.has-video .manifest-media .shot img,.has-video .manifest-media .shot video{max-height:35.5cqw}
.text-only-slide .manifest-layout{grid-template-columns:minmax(0,1.55fr) minmax(20cqw,.45fr);gap:5cqw}
.text-only-slide .manifest-copy{padding-left:3cqw}
.text-only-slide .manifest-copy h2{font-size:3.35cqw}
.text-only-slide .manifest-body{max-width:58cqw}
.text-only-slide .manifest-body p{font-size:1.22cqw;line-height:1.78;padding:.55cqw 0 .75cqw;border-bottom:1px solid var(--rule)}
.text-art{display:flex;flex-direction:column;align-items:center;gap:1cqw;color:var(--accent)}
.text-art img{width:20cqw;height:20cqw;object-fit:contain;filter:drop-shadow(.3cqw .5cqw .2cqw #0002)}
.text-art .mono{font-size:.8cqw}
.manifest-slide .start-button{margin-top:1.35cqw}
.manifest-slide.chapter-finale .manifest-copy h2{font-size:3.25cqw}
.manifest-slide.chapter-finale .manifest-media{filter:none}

@media(max-width:680px) and (orientation:portrait){
 .manifest-layout,.text-only-slide .manifest-layout{height:auto;display:flex;flex-direction:column;gap:6cqw;align-items:stretch;padding:7cqw 0 8cqw}
 .text-only-slide .manifest-copy{padding-left:0}
 .manifest-copy .chapter-ticket{font-size:2.1cqw;padding:1.3cqw 2cqw;margin-bottom:3cqw}
 .manifest-copy h1{font-size:10cqw}.manifest-copy h2,.text-only-slide .manifest-copy h2,.manifest-slide.chapter-finale .manifest-copy h2{font-size:7.3cqw;line-height:1.35}
 .manifest-copy .subtitle{font-size:4cqw;line-height:1.65;margin:3cqw 0 4cqw}
 .manifest-body{max-width:none}.manifest-body p,.text-only-slide .manifest-body p{font-size:3.2cqw;line-height:1.85;margin-top:3cqw;padding:0;border:0}
 .manifest-media{height:auto;min-height:80cqw;gap:3cqw;padding:3cqw 0}
 .manifest-media::before{inset:0 2cqw}
 .manifest-media .shot img,.manifest-media .shot video{max-height:none;width:64cqw;height:auto}
 .has-two-shots .manifest-media .shot img{width:40cqw;max-height:none}.has-two-shots .manifest-media{align-items:flex-start}
 .has-video .manifest-media{display:grid;grid-template-columns:1fr 1fr;min-height:0}.has-video .manifest-media .shot img,.has-video .manifest-media .shot video{width:39cqw;max-height:none}
 .manifest-media .app-icon img{width:52cqw;height:52cqw}
 .text-art img{width:58cqw;height:58cqw}.text-art .mono{font-size:2.4cqw}
 .manifest-slide .start-button{margin-top:5cqw}
}

@media print{
 .manifest-slide{print-color-adjust:exact;-webkit-print-color-adjust:exact}
 .manifest-media .shot img,.manifest-media .shot video{box-shadow:none}
}

/* Wordmark: brand half links to the site, guide half back to the deck cover. */
.wordmark a{text-decoration:none}
.wordmark-brand{display:flex;align-items:center;gap:inherit}
.wordmark a:hover{text-decoration:underline;text-underline-offset:3px}

/* ---------------------------------------------------------------------------
   Phone fit: one slide = one screen.
   The portrait rules in styles.css reflow a 16:9 slide into a tall stack that
   ran 1.2-1.9x the deck height (worse in chapters 2-5), so every slide had to
   be scrolled. Here the slide fills the deck exactly - fixed top strip,
   flexible content, footer pinned - and slideshow.js shrinks the content block
   (fitSlide) by just enough that it fits.
   Selectors are #deck-prefixed on purpose: this is an override layer, and the
   per-chapter sheets size their screenshots with 3-class selectors such as
   `.big-screen .lesson-screen .shot img` that outrank a bare `.shot img`.
   Images cap with max-height rather than height so a wide graphic keeps its
   own (width-limited) height instead of sitting in a letterboxed slot, while a
   tall phone screenshot is bounded by the screen instead of by how much copy
   sits above it. Tapping one still opens the full-size lightbox.
   Keep `overflow-y:auto` on .slide: if the fit script or `zoom` is
   unavailable, a slide scrolls as it used to instead of clipping.
   --------------------------------------------------------------------------- */
@media(max-width:680px) and (orientation:portrait){
  .player-header{height:46px}
  .player-controls{height:56px}
  #deck{height:calc(100dvh - 108px);overflow:hidden}
  #deck .slide{display:flex;flex-direction:column;height:100%;min-height:0;padding:0 5cqw;overflow-y:auto;overflow-x:hidden}
  /* The #deck prefix above outranks styles.css's `.slide[hidden]{display:none}`,
     so the inactive slides need it restored here or the deck renders as one
     tall stack of every slide. */
  #deck .slide[hidden]{display:none}
  #deck .slide-top{flex:0 0 auto;height:auto;min-height:0;padding:2.5cqw 0 0}
  #deck .content{flex:1 1 auto;min-height:0;padding-top:3cqw}
  #deck .slide-footer{flex:0 0 auto;min-height:0;margin-top:2.5cqw}
  #deck .split,#deck .split.reverse,#deck .dual .split,#deck .cover-layout{gap:3.5cqw}
  #deck .visual{padding:0}
  #deck .visual:before{display:none}
  #deck .shot{gap:1.5cqw}
  #deck .shot img,#deck .shot video{width:auto;height:auto;max-width:100%;max-height:31dvh;object-fit:contain}
  #deck .paired-shots .shot img{width:auto;max-height:27dvh}
  #deck p,#deck .dual p{line-height:1.75;margin:2cqw 0 0}
  #deck .subtitle,#deck .dual .subtitle{margin:2.5cqw 0 3cqw;line-height:1.5}
  #deck .station{min-height:18cqw}
  #deck .loop-arrow{line-height:1}
}

/* Short phones (a 640px-tall Android leaves ~530px for a slide): buy the fit
   back from the chrome and the screenshot before the type has to shrink. */
@media(max-width:680px) and (orientation:portrait) and (max-height:700px){
  .player-header{height:42px}
  .player-controls{height:50px}
  #deck{height:calc(100dvh - 96px)}
  #deck .slide{padding:0 4cqw}
  #deck .shot img,#deck .shot video{max-height:25dvh}
  /* The finale slides put a decorative aria-hidden mascot in the flow, where
     it costs ~120px the copy needs on a short screen. Drop it there rather
     than shrink the type or cut a line of copy; the chapter art elsewhere is
     absolutely positioned and unaffected. */
  #deck .lesson-mascot{display:none}
  /* The chapter-1 game-loop diagram is spacing-bound, not min-height-bound:
     its five stations size to their own text, so the room comes from the
     padding and gaps around them. */
  #deck .station{min-height:16cqw;padding:2cqw 4cqw}
  #deck .loop-stations{gap:1.5cqw}
  #deck .game-loop{margin-top:4cqw}
  #deck .world-map .map-intro{margin-top:4cqw}
  #deck .chapter-road{gap:3cqw;padding-top:3cqw;margin-top:3cqw}
  #deck .paired-shots .shot img{max-height:22dvh}
  #deck .split,#deck .split.reverse,#deck .dual .split,#deck .cover-layout{gap:2.5cqw}
  #deck .slide-footer{margin-top:1.5cqw}
}
