/* Phone presentation: preserve the authored frames and leave vertical gestures
   to the page. Desktop keeps its full-bleed, scroll-driven chapters. */
.mobile-blend-control{display:none}
.media-start{position:absolute;z-index:12;left:50%;top:50%;transform:translate(-50%,-50%);min-height:48px;min-width:136px;padding:12px 20px;border:1px solid #ffffffb3;border-radius:28px;background:#000b;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:#fff;font:500 15px/1.4 var(--sans);cursor:pointer;white-space:nowrap}
.media-start[hidden]{display:none}
.motion-loop{position:relative}
html.media-expanded{overflow:hidden}
.chapter:has(.compare-player.expanded){z-index:100}
html.media-expanded .site-header{visibility:hidden}

@media(max-width:760px), (max-width:1000px) and (max-height:500px){
  :root{--gutter:20px}
  .chapter.act,.chapter.act.breath-section{height:auto;min-height:0;--intro:0!important;--cut:0!important;background:#000}
  .chapter.act .act-pin{position:relative;top:auto;height:auto;min-height:0;overflow:visible}
  .chapter.act .act-card,.chapter.act .act-pin::after{display:none}
  .chapter.act :is(.chapter-heading,.chapter-footer,.transport,.view-labels,.divider,.blend-labels,.ui-rail){opacity:1;translate:none}
  .chapter.act .stage canvas,.chapter.act #ui-canvas{transform:none}
  .demo-section .chapter-content{display:flex;flex-direction:column;padding:calc(var(--header) + 24px) 0 32px}
  .demo-section .chapter-heading{position:relative;inset:auto;max-width:none;margin:0 var(--gutter) 24px;pointer-events:auto;text-shadow:none}
  .demo-section .chapter-title{font-size:clamp(30px,8vw,44px);line-height:1.2;letter-spacing:-.03em;white-space:normal}
  .demo-section .chapter-heading .lede{display:block;font-size:14px;line-height:1.75;margin-top:14px;max-width:40em;color:#c6c6c6}
  .camera-pages{gap:16px;font-size:12px;margin-bottom:24px}
  .camera-pages a{min-height:44px}
  .demo-section .detail{margin-top:16px}
  .demo-section .detail summary{font-size:12px;min-height:40px}
  .demo-section .detail dl{background:#111;backdrop-filter:none}
  .demo-section .compare-player{position:relative;inset:auto;overflow:visible;min-height:0;width:100%;background:#000}
  .compare-player .stage{position:relative;inset:auto;width:100%;aspect-ratio:16/9;overflow:hidden;background-size:contain;background-color:#000}
  .compare-player .stage::after{background:none}
  .compare-player .view-labels,.compare-player .blend-labels{top:12px;left:12px;right:12px;gap:8px}
  .compare-player .view-labels strong,.compare-player .blend-version{font-size:11px;letter-spacing:0}
  .compare-player .view-labels>span{gap:6px}
  .compare-player .view-labels small{display:none}
  .compare-player .chip{font-size:10px;min-width:26px;height:18px;padding:0 4px}
  .compare-player .blend-amount{gap:6px}
  .compare-player .blend-amount output{font-size:22px;min-width:52px}
  .compare-player .blend-amount output span{font-size:12px}
  .compare-player .divider-handle{top:60%;width:38px;height:38px}
  .compare-player .transport{position:relative;inset:auto;margin:12px var(--gutter) 0;padding:0;gap:16px;min-height:52px;flex-wrap:nowrap}
  .compare-player .transport button{min-height:44px;font-size:13px}
  .compare-player .transport .toggle{min-width:44px}
  .compare-player .transport .timeline{min-width:32px;flex:1}
  .compare-player .transport .play-text{display:none}
  .compare-player .media-error{position:relative;inset:auto;margin:12px var(--gutter)}
  .demo-section .chapter-footer{position:relative;inset:auto;margin:20px var(--gutter) 0;display:flex;flex-direction:column;align-items:stretch;gap:16px;text-shadow:none}
  .demo-section .chapter-footer .cue{font-size:12px;line-height:1.7;color:#b7b7b7;letter-spacing:0}
  .demo-section .chapter-footer .next-link{justify-content:space-between;transform:none;min-height:48px;padding-top:12px;border-top:1px solid #ffffff26}
  .demo-section .chapter-footer .next-link span:first-child{display:inline}
  .blend-gesture,.breath-section .blend-hint,.blend-meter{display:none}
  .mobile-blend-control{display:flex;align-items:center;gap:16px;margin:16px var(--gutter) 0;font:500 12px/1.5 var(--sans);color:#ddd}
  .mobile-blend-control input{appearance:none;-webkit-appearance:none;flex:1;min-width:0;height:44px;background:transparent;touch-action:pan-y}
  .mobile-blend-control input::-webkit-slider-runnable-track{height:3px;background:linear-gradient(90deg,#5067ff,#fff)}
  .mobile-blend-control input::-webkit-slider-thumb{appearance:none;-webkit-appearance:none;width:24px;height:24px;margin-top:-10px;border:3px solid #fff;border-radius:50%;background:#181818;box-shadow:0 0 0 5px #ffffff10}
  .mobile-blend-control input::-moz-range-track{height:3px;background:#a6afff}
  .mobile-blend-control input::-moz-range-thumb{width:20px;height:20px;border:3px solid #fff;border-radius:50%;background:#181818}

  /* Keep the tutorial and version buttons outside the fight itself. */
  .ui-section .ui-content{display:grid;grid-template-columns:minmax(0,1fr);padding:calc(var(--header) + 24px) 0 36px}
  .ui-section .ui-rail{display:contents}
  .ui-section .ui-rail-head{grid-row:1;margin:0 var(--gutter) 28px;pointer-events:auto}
  .ui-section .ui-rail-head h2,html[lang=en] .ui-section .ui-rail-head h2{font-size:clamp(28px,7.3vw,40px);line-height:1.2}
  .ui-section .ui-lede{font-size:14px;line-height:1.7;max-width:36em}
  .ui-section .ui-workspace{position:relative;inset:auto;width:100%;height:auto;aspect-ratio:16/9;grid-row:2}
  .ui-section #ui-ambient{display:none}
  .ui-section .ui-stage{background-color:#000}
  .ui-section .ui-rail-panel{grid-row:3;margin:32px var(--gutter) 0;gap:20px;pointer-events:auto}
  .ui-section .ui-versions{--option-height:58px;--ue5-lift:12px}
  .ui-section .ui-versions button{min-height:58px;padding:12px;gap:8px}
  .ui-section .v-name{font-size:14px}
  .ui-section .ui-transport-sub{display:flex;flex-wrap:wrap;gap:8px 20px}
  .ui-section .ui-transport-sub>*{min-height:44px;font-size:12px;display:inline-flex;align-items:center}
  .ui-section[data-ui-view=bad] .ui-making-entry{display:none}
  .ui-section .ui-tips-trigger{min-height:48px;font-size:14px}
  .ui-section .ui-transport-main{gap:14px}
  .ui-tips-dialog .ui-tips-meta{position:sticky;top:-20px;padding:12px 0;background:#111;z-index:4}
  .ui-tips-dialog #ui-tips-close{width:44px;height:44px;flex:0 0 44px}
  .ui-tips-dialog[data-issue=damage] .ui-tip-comparison{grid-template-columns:1fr}
  .ui-tips-dialog .ui-tips-footer{flex-wrap:wrap}
  .ui-tip-after,.ui-tip-skip,.ui-tip-pagination button{min-height:44px}

  /* Controls lead the workspace on phones and remain reachable while reading. */
  .making-inner{display:flex;flex-direction:column;padding-top:calc(var(--header) + 24px)}
  .making-header{order:0;grid-template-columns:1fr;gap:16px;margin-bottom:24px}
  .making-header h2{font-size:32px}
  .making-intro{font-size:14px;line-height:1.7}
  .making-transport{display:contents}
  .making-controls{order:1;position:sticky;top:var(--header);z-index:12;display:flex;flex-direction:column;align-items:stretch;gap:8px;padding:12px 0;background:#000;border-bottom:1px solid #ffffff30;--control-height:44px;--control-font:13px}
  .making-view-options{width:100%;height:44px}
  .making-playback-buttons{justify-content:space-between;gap:4px;flex-wrap:wrap}
  .making-play{min-width:72px;padding:0 10px}
  .making-playback-buttons>.making-text-button{padding:0 5px}
  .making-step-buttons{display:none}
  .making-scrubber{order:2;margin:0;height:104px}
  .making-workspace{order:3;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
  .making-track-body,.making-workspace:not([data-layout=compare]) .making-track-body{min-height:220px}
  .making-feedback{order:4;flex-wrap:wrap;margin-top:16px}
  .making-status,#making-retry{order:2;margin:8px 0}
  .making-footer{order:5;flex-direction:column;gap:12px}
  .making-dialog-head{position:sticky;top:-10px;background:#000;z-index:2}
  .making-dialog-head button{min-width:44px;min-height:44px}

  .compare-player:is(:fullscreen,.expanded){position:fixed;inset:0;z-index:100;width:100%;height:100dvh;display:flex;flex-direction:column;overflow:hidden;padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom)}
  .compare-player:is(:fullscreen,.expanded) .stage{flex:1;min-height:0;aspect-ratio:auto}
  .compare-player:is(:fullscreen,.expanded) .transport{margin-bottom:8px;flex:0 0 52px}
  .compare-player:is(:fullscreen,.expanded) .view-labels,.compare-player:is(:fullscreen,.expanded) .blend-labels{top:16px}
  .hero:is(:fullscreen,.expanded) .hero-video{object-fit:contain}
  .hero:is(:fullscreen,.expanded) .hero-copy{display:none}
  .ui-section:is(:fullscreen,.expanded){overflow-y:auto;background:#000;--header:0px}
  .ui-section:is(:fullscreen,.expanded) .ui-content{padding-top:max(20px,env(safe-area-inset-top));padding-bottom:max(24px,env(safe-area-inset-bottom))}
  .pie-slice.is-active .pie-art{transform:translate(var(--pie-x),var(--pie-y)) scale(1.18)}
  #library-viewer{scroll-margin-top:calc(var(--header) + 16px)}
  .motion-loop-toggle,.motion-pair-toggle{min-height:44px;min-width:64px}
}

@media(max-width:700px){
  :root{--header:calc(96px + env(safe-area-inset-top))}
  .site-header{padding-top:calc(6px + env(safe-area-inset-top));background:linear-gradient(#000d,#0009 75%,#0000)}
  body[data-tone=light] .site-header{background:linear-gradient(#f5f5f5f5,#f5f5f5e8 75%,#f5f5f500)}
  .hero-transport{bottom:max(16px,env(safe-area-inset-bottom))}
  .hero{min-height:100svh}
  .library-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:20px 14px}
  .library-card-body b{font-size:14px}
  .motion-loop-labels .motion-media-label{font-size:11px}
}
@media(max-width:1000px) and (max-height:500px){
  :root{--header:60px}
  .site-header{height:60px;grid-template-columns:auto 1fr auto;gap:14px;padding:4px max(16px,env(safe-area-inset-right)) 4px max(16px,env(safe-area-inset-left));background:#080808eb}
  .brand-name{display:none}
  .chapter-nav{justify-content:center;gap:24px;grid-row:auto;grid-column:auto}
  .chapter-nav b{font-size:12px}.chapter-nav span{display:none}
  .language{grid-row:auto;grid-column:auto}
  .hero-copy{bottom:100px}
  .hero-lockup{font-size:52px!important}
  .hero-bottom{bottom:74px}
  .hero{min-height:100svh}
  .making-controls{position:relative;top:0}
  .compare-player .stage,.ui-section .ui-workspace{max-height:72svh;aspect-ratio:auto;height:72svh}
}
@media(prefers-reduced-motion:reduce){.pie-slice.is-active .pie-art{transform:none}}
