/* Mobile reading only: reserve space for fixed controls and retain brand styles. */
@media(max-width:760px){
 html{scroll-padding-bottom:calc(var(--mobile-reading-clearance,96px) + 16px)}
 body.has-reading-controls{padding-bottom:var(--mobile-reading-clearance,calc(96px + env(safe-area-inset-bottom)))}
 .story-controls,.guide-controls{box-sizing:border-box;max-width:calc(100% - 24px);padding:6px;background:#f7f3e9fa;border:1px solid #c8b88e66;border-radius:32px;box-shadow:0 3px 16px #203e3020;gap:6px}
 .story-controls .story-back{flex:0 1 108px;width:auto;min-width:0;min-height:44px;height:auto;padding:8px 10px;white-space:normal;text-align:center;line-height:1.4}
 .story-controls #story-top-button{flex:0 0 44px;width:44px;height:44px;min-height:44px;padding:0}
 .guide-controls .guide-control{min-width:0;white-space:normal;text-align:center;line-height:1.4;padding-block:8px}
 .guide-controls .guide-top{flex:0 0 44px;padding:0}
 .story-article p{font-size:17px;line-height:1.9;word-break:keep-all;overflow-wrap:break-word}
 .story-article h3{line-height:1.6}
 .article-toc{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:4px 12px}
 .article-toc a{min-height:44px;line-height:1.5;font-size:13px}
 .story-card,.story-main,.intro-content,.guide-controls>*{min-width:0}
 .story-card h2,.story-card h3{overflow-wrap:break-word}
 .story-article section,.story-main>h2{scroll-margin-bottom:calc(var(--mobile-reading-clearance,96px) + 16px)}
 .section-shortcuts a{min-height:44px;display:inline-flex;align-items:center;justify-content:center}
}
@media(max-width:360px){
 .story-layout{padding-inline:16px}
 .story-controls,.guide-controls{max-width:calc(100% - 16px);gap:4px;padding:5px}
 .story-controls .story-back{flex-basis:96px;padding-inline:7px}
 .guide-control{padding-inline:9px}
 #international-guide{padding:24px 18px}
}

/* Keep the fixed language selector above, rather than over, the sticky shortcuts. */
@media(max-width:700px){
 html[data-site-language] #main .section-shortcuts{
  padding-top:calc(max(9px,env(safe-area-inset-top)) + var(--mobile-language-height,48px) + 8px);
  padding-bottom:6px;
 }
 html[data-site-language] #main .section-shortcuts a{flex:1 1 0;min-width:0;padding-inline:4px;white-space:normal;text-align:center;line-height:1.45}
 html[data-site-language] .danha-language button{min-height:40px}
}
/* Explicit width prevents a left:50% fixed dock shrinking to half the viewport. */
@media(max-width:760px){
 .story-controls{width:min(340px,calc(100% - 24px));max-width:calc(100% - 24px);align-items:center}
 .story-controls .story-back{flex:1 1 0;width:auto;min-width:0;white-space:nowrap;padding:8px 6px;word-break:keep-all}
 .story-controls #story-top-button{flex:0 0 44px}
}
@media(max-width:360px){.story-controls{width:calc(100% - 16px);max-width:calc(100% - 16px)}.story-controls .story-back{flex-basis:0}}
