/* One instruction sheet per screen, with optional magnification. */
body.reading { overflow: hidden; }
body.reading .content { padding-top: 14px; padding-bottom: 14px; }
#stepView:not(.hidden) { height: calc(100dvh - 106px); display: flex; flex-direction: column; gap: 10px; }
#stepView > .step-heading { margin: 0; align-items: center; gap: 10px; flex-shrink: 0; }
.step-heading > div:first-child { min-width: 0; flex: 1; }
#stepView .step-heading h1 { font-size: 24px; line-height: 1.15; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#stepView .chapter-kicker, #completeIndicator { display: none; }
#showDetails { flex-shrink: 0; }
#stepView .viewer { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 0; box-shadow: none; }
#stepView .viewer-toolbar { flex-shrink: 0; padding: 6px 10px; }
#stepView .viewer-toolbar .group:first-child { display: none; }
#stepView .viewer-toolbar .group:last-child { width: 100%; justify-content: space-between; }
#stepView .viewer-stage { flex: 1; min-height: 0; height: auto; padding: 0; background: #e5e0d7; }
#stepView .viewer-stage img { width: 100%; height: 100%; margin: 0; object-fit: contain; box-shadow: none; }
#stepView .viewer-stage.zoomed img { margin: 0 auto; object-fit: fill; }
#stepView .viewer-stage:not(.zoomed) { overflow: hidden; touch-action: pan-y pinch-zoom; }
#stepView .viewer-footer { display: none; }
#stepView .bottomnav { position: static; flex-shrink: 0; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; }
#stepView .bottomnav .mobile-only { display: inline-flex; }
#stepView .bottomnav .btn { min-height: 52px; }
#stepView .bottomnav .btn.primary { flex: 1; max-width: none; }
#stepView .bottomnav .complete { flex: 1; }
#detailsDialog .task p { font-size: 19px; }
body.large #detailsDialog .task p { font-size: 22px; }
#detailsDialog .panel-row { grid-template-columns: 1fr; }
#detailsDialog .smalllinks { padding-bottom: 15px; }
@media (max-width: 820px) {
  body.reading .content { padding: 0; }
  #stepView:not(.hidden) { position: fixed; top: 68px; bottom: 0; left: 0; right: 0; height: auto;
    padding: 10px max(10px,env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left)); gap: 8px; }
  #stepView .step-heading h1 { font-size: 18px; margin-bottom: 4px; }
  #stepView #stepSource { display: none; }
  #stepView .tag { font-size: 12px; padding: 2px 8px; }
  #showDetails { font-size: 13px; padding: 8px; }
  #stepView .viewer { border-radius: 12px; }
  #stepView .viewer-toolbar .btn { font-size: 13px; }
  #stepView .bottomnav { gap: 8px; }
  #stepView .bottomnav .btn { font-size: 15px; padding: 8px; }
}
@media (max-height: 520px) and (max-width: 1100px) {
  .mobile-only { display: inline-flex; }
  .tools .hide-mobile { display: none; }
  .topbar .tools { flex-wrap: nowrap; }
  .mark { display: none; }
  #stepView:not(.hidden) { position: fixed; bottom: 0; left: 0; right: 0; height: auto; padding: 5px 10px 8px; }
  .sidebar { position: fixed; top: 48px; left: 0; bottom: 0; z-index: 40; width: min(345px,87vw); height: calc(100dvh - 48px); transform: translateX(-105%); }
  .sidebar.open { transform: translateX(0); }
  .navshade.open { display: block; position: fixed; inset: 48px 0 0; background: #172b3055; z-index: 30; }

  .topbar { height: 48px; }
  #stepView:not(.hidden) { top: 48px; padding-top: 5px; gap: 5px; }
  #stepView .step-heading h1 { font-size: 16px; -webkit-line-clamp: 1; }
  #stepView .step-meta { display: none; }
  #stepView .viewer-toolbar .btn, #showDetails { min-height: 36px; height: 36px; }
  #stepView .bottomnav .btn { min-height: 40px; height: 40px; }
}
@media print {
  body.reading { overflow: visible; }
  #stepView:not(.hidden) { position: static; display: block; height: auto; }
  #stepView .viewer-stage { height: auto; overflow: visible; }
  #stepView .viewer-stage img { width: auto !important; height: auto !important; max-height: 250mm; max-width: 100%; margin: auto; }
  #showDetails, #stepView .bottomnav { display: none; }
}
.toast { opacity: 0; visibility: hidden; }
.toast.visible { opacity: 1; visibility: visible; }
