/* Last stylesheet: touch layouts also apply to tablets and wide phone landscapes. */
#safe-area-measure{position:fixed;inset:0;visibility:hidden;pointer-events:none;padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
body[data-touch=true]{
  --touch-top:max(16px,calc(env(safe-area-inset-top,0px) + 8px));
  --touch-left:max(16px,calc(env(safe-area-inset-left,0px) + 12px));
  --touch-right:max(16px,calc(env(safe-area-inset-right,0px) + 12px));
  --touch-bottom:max(20px,calc(env(safe-area-inset-bottom,0px) + 12px));
}
body[data-touch=true] #experience{height:100vh;height:100dvh}
body[data-touch=true] .topbar{
  top:var(--touch-top);left:var(--touch-left);right:var(--touch-right);gap:12px;
}
body[data-touch=true] .identity{min-width:0;gap:10px}
body[data-touch=true] .museum-mark{flex:none;width:27px;height:34px}
body[data-touch=true] .identity h1{font-size:16px;letter-spacing:.1em}
body[data-touch=true] .identity p{font-size:7px;letter-spacing:.04em;margin-top:7px}
body[data-touch=true] .identity p span{padding:0 3px}
body[data-touch=true] .header-actions{flex:none;gap:5px}
body[data-touch=true] .header-actions .icon-button{width:44px;min-width:44px;height:44px;min-height:44px}
body[data-touch=true] .mode-pill{
  top:calc(var(--touch-top) + 60px);max-width:calc(100% - var(--touch-left) - var(--touch-right));
  padding:7px 12px;font-size:9px;
}
body[data-touch=true] #mode-label{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
body[data-touch=true] .view-location{display:none}
body[data-touch=true] .toolbar{
  bottom:var(--touch-bottom);max-width:calc(100% - var(--touch-left) - var(--touch-right));
  gap:5px;padding:8px 10px;border-radius:10px;
}
body[data-touch=true] .toolbar button{flex-shrink:0;min-height:44px;font-size:11px;padding-inline:11px}
body[data-touch=true] .toolbar .primary{min-width:106px}
body[data-touch=true] .toolbar .manual-button,body[data-touch=true] .toolbar .reset-button{
  width:44px;min-width:44px;height:44px;padding:0;
}
body[data-touch=true] .manual-button>span{display:none}
body[data-touch=true] .tour-meta{min-width:81px;padding-right:5px}
body[data-touch=true] .tour-meta .eyebrow{font-size:7px}
body[data-touch=true] .tour-meta>span:last-child{font-size:9px}
body[data-touch=true] .toolbar-divider{margin-right:4px}
body[data-touch=true] .touch-controls{
  left:var(--touch-left);bottom:calc(var(--touch-bottom) + 96px);
}
body[data-touch=true] .move-pad{width:132px;height:132px;transform:none}
body[data-touch=true] .move-pad button{width:44px;height:44px;min-width:44px;min-height:44px}
body[data-touch=true] .move-pad [data-move=forward]{left:44px;top:0}
body[data-touch=true] .move-pad [data-move=back]{left:44px;bottom:0}
body[data-touch=true] .move-pad [data-move=left]{left:0;top:44px}
body[data-touch=true] .move-pad [data-move=right]{right:0;top:44px}
body[data-touch=true] .pad-center{left:61px;top:61px}
body[data-touch=true] .touch-look-hint{padding-top:8px;font-size:9px}
body[data-touch=true] .hint{
  bottom:calc(var(--touch-bottom) + 76px);width:max-content;
  max-width:calc(100% - var(--touch-left) - var(--touch-right));font-size:9px;text-align:center;
}
body[data-touch=true] .quiet-credit{
  right:var(--touch-right);bottom:calc(env(safe-area-inset-bottom,0px) + 3px);
  max-width:calc(100% - var(--touch-left) - var(--touch-right));font-size:7px;text-align:right;
}
body[data-touch=true] .restore-ui{right:var(--touch-right);bottom:var(--touch-bottom);min-height:44px}
/* Keep welcome actions reachable when browser chrome or a small screen reduces the height. */
body[data-touch=true] .intro{
  left:calc(var(--touch-left) + 8px);right:var(--touch-right);bottom:calc(var(--touch-bottom) + 28px);
  max-height:calc(100vh - var(--touch-top) - var(--touch-bottom) - 96px);
  max-height:calc(100dvh - var(--touch-top) - var(--touch-bottom) - 96px);
  overflow:auto;overscroll-behavior:contain;touch-action:pan-y;
  padding:4px 5px 6px 0;scroll-padding-block:10px;scrollbar-width:thin;
}
body[data-touch=true] .intro-actions{flex-wrap:wrap;gap:10px}
body[data-touch=true] .entry-primary,body[data-touch=true] .entry-secondary{min-height:48px}
body[data-touch=true] .intro-details{flex-wrap:wrap;row-gap:8px;line-height:1.7}
/* Touch control center: a bounded sheet, with tabs and close action outside its scroll area. */
body[data-touch=true] .help-panel.modal-panel{
  top:auto;left:auto;right:var(--touch-right);bottom:var(--touch-bottom);
  width:min(440px,calc(100% - var(--touch-left) - var(--touch-right)));
  max-width:none;min-height:0;
  max-height:min(calc(100vh - 96px),calc(100vh - var(--touch-top) - var(--touch-bottom)));
  max-height:min(calc(100dvh - 96px),calc(100dvh - var(--touch-top) - var(--touch-bottom)));
  padding:22px 20px 20px;border-radius:18px;
}
body[data-touch=true] .modal-panel .tab-panel{
  flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;
  padding-bottom:5px;scroll-padding-block:12px;
}
body[data-touch=true] .modal-panel .control-tabs button{min-height:44px}
body[data-touch=true] .setting-field select{min-height:44px;font-size:16px}
body[data-touch=true] .setting-field input[type=range]{height:44px;min-height:44px}
body[data-touch=true] .setting-switch>label{min-height:64px}
/* A failed load adds a retry action; the whole card remains scrollable within the safe viewport. */
body[data-touch=true] .loading-layer{
  position:fixed;padding:var(--touch-top) var(--touch-right) var(--touch-bottom) var(--touch-left);
  grid-template:minmax(0,1fr) / minmax(0,1fr);overflow:hidden;
}
body[data-touch=true] .loading-card{
  min-width:0;min-height:0;width:min(330px,100%);max-height:100%;padding:8px 5px;
  overflow:auto;overscroll-behavior:contain;touch-action:pan-y;scroll-padding-block:12px;scrollbar-width:thin;
}
body[data-touch=true] .loading-card button{min-height:44px}
body[data-touch=true] .ui-notice{
  bottom:calc(var(--touch-bottom) + 82px);max-width:calc(100% - var(--touch-left) - var(--touch-right));
}
@media(max-width:700px){
  body[data-touch=true] .help-panel.modal-panel{left:var(--touch-left);right:var(--touch-right);width:auto}
}
@media(max-width:360px){
  body[data-touch=true] .identity{gap:7px}
  body[data-touch=true] .museum-mark{width:24px}
  body[data-touch=true] .identity h1{font-size:13px}
  body[data-touch=true] .identity p{font-size:6px}
  body[data-touch=true] .header-actions{gap:0}
  body[data-touch=true] .toolbar{padding-inline:8px}
}
@media(max-height:670px) and (orientation:portrait){
  body[data-touch=true] .intro h2{font-size:clamp(44px,17vw,64px);margin:15px 0;line-height:.94}
  body[data-touch=true] .intro-tagline{font-size:18px;margin:15px 0 11px}
  body[data-touch=true] .intro-description{font-size:10px;line-height:1.8}
  body[data-touch=true] .intro-actions{margin-top:18px}
  body[data-touch=true] .intro-details{margin-top:15px;font-size:7px}
  body[data-touch=true] .intro-eyebrow{display:none}
  body[data-touch=true] .entry-primary,body[data-touch=true] .entry-secondary{min-height:44px;padding-inline:16px;font-size:11px}
  body[data-touch=true] .entry-secondary>span{display:none}
}
@media(orientation:landscape) and (max-height:600px){
  body[data-touch=true] .mode-pill{top:calc(var(--touch-top) + 52px)}
  body[data-touch=true] .touch-controls{left:var(--touch-left);bottom:var(--touch-bottom)}
  body[data-touch=true] .move-pad{transform:none}
  body[data-touch=true] .touch-look-hint,body[data-touch=true] .hint{display:none}
  body[data-touch=true] .toolbar{
    left:auto;right:var(--touch-right);bottom:var(--touch-bottom);transform:none;
    max-width:calc(100% - var(--touch-left) - var(--touch-right) - 148px);gap:4px;padding:8px;
  }
  body[data-touch=true] .toolbar .primary{min-width:100px;padding-inline:10px}
  body[data-touch=true] .toolbar .tour-meta,body[data-touch=true] .toolbar .toolbar-divider{display:none}
  body[data-touch=true] .intro h2{font-size:clamp(36px,7vw,60px);margin:10px 0;line-height:1}
  body[data-touch=true] .intro h2 br{display:none}
  body[data-touch=true] .intro h2 em{margin-left:10px}
  body[data-touch=true] .intro-tagline{font-size:16px;margin:10px 0}
  body[data-touch=true] .intro-actions{margin-top:12px}
  body[data-touch=true] .intro-description,body[data-touch=true] .intro-details,body[data-touch=true] .intro-eyebrow{display:none}
  body[data-touch=true] .entry-primary,body[data-touch=true] .entry-secondary{min-height:44px;font-size:11px;padding-inline:18px}
  body[data-touch=true] .entry-secondary>span{display:none}
  body[data-touch=true] .help-panel.modal-panel{
    left:auto;width:min(420px,calc(100% - var(--touch-left) - var(--touch-right)));
    max-height:calc(100vh - var(--touch-top) - var(--touch-bottom));
    max-height:calc(100dvh - var(--touch-top) - var(--touch-bottom));padding:16px 20px;
  }
  body[data-touch=true] .modal-panel .help-heading .eyebrow{display:none}
  body[data-touch=true] .modal-panel .help-heading h2{font-size:21px;margin:5px 0 0}
  body[data-touch=true] .control-tabs{margin-top:10px}
}
/* A compact two-row toolbar also fits a narrow split view without reducing targets. */
@media(orientation:landscape) and (max-height:600px) and (max-width:420px){
  body[data-touch=true] .toolbar{
    display:grid;grid-template-columns:48px 48px;max-width:none;gap:4px;padding:8px;
  }
  body[data-touch=true] .toolbar .primary{grid-column:1 / -1;width:100%;min-width:100px}
  body[data-touch=true] .toolbar .manual-button,body[data-touch=true] .toolbar .reset-button{justify-self:center}
}
@media(max-height:520px){
  body[data-touch=true] .loading-monogram{font-size:44px;line-height:1;margin-bottom:16px}
  body[data-touch=true] .loading-monogram>span{font-size:39px;top:7px}
  body[data-touch=true] .loading-card h2{font-size:20px;line-height:1.4;margin:18px 0 12px}
  body[data-touch=true] .loading-card p{font-size:10px;line-height:1.7;margin:8px 0}
  body[data-touch=true] .loading-card progress{margin:16px 0 12px}
  body[data-touch=true] .loading-card .load-note{font-size:9px;margin:6px 0}
  body[data-touch=true] .loading-card button{margin-top:12px}
}
