/* Opt-in phone layout. No selectors affect the approved desktop presentation. */
body.phone-shelf-active .experience-stage {
  --phone-shelf-space: 160px;
  --phone-controls-space: 72px;
  --phone-top-space: 8px;
}
body.phone-shelf-active:not(.encounter-page) .experience-stage { --phone-top-space: 58px; }
body.phone-shelf-active #window-toggle { display: none; }
body.phone-shelf-active #viewport {
  inset: var(--phone-top-space) 0 calc(var(--phone-shelf-space) + var(--phone-controls-space) + 12px);
  width: 100%;
  height: auto;
  min-height: 0;
}
body.phone-shelf-active :is(#story-window, #panel) {
  position: absolute;
  inset: auto 8px 0;
  width: auto;
  max-width: none;
  max-height: 56%;
  margin: 0;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  overflow: hidden;
  background: rgba(255, 255, 255, .97);
  border: 1px solid #e6e5e2;
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -5px 24px rgba(0, 0, 0, .04);
  display: flex;
  flex-direction: column;
  z-index: 6;
}
body.phone-shelf-active .phone-shelf-handle {
  position: relative;
  flex: 0 0 52px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 13px 18px 4px;
  margin: 0;
  border: 0;
  background: transparent;
  color: #292a27;
  font: 13px Archivo, sans-serif;
  letter-spacing: .02em;
  touch-action: none;
  cursor: pointer;
}
body.phone-shelf-active .phone-shelf-grip {
  position: absolute;
  top: 7px;
  left: calc(50% - 16px);
  width: 32px;
  height: 3px;
  border-radius: 3px;
  background: #b5b6b1;
}
body.phone-shelf-active .phone-shelf-chevron { font-size: 24px; line-height: 1; }
body.phone-shelf-active [data-shelf-state="expanded"] .phone-shelf-chevron { transform: rotate(180deg); }
body.phone-shelf-active .phone-shelf-summary { padding: 0 18px 10px; }
body.phone-shelf-active .phone-shelf-summary h2 {
  font: 500 21px/1.18 Archivo, sans-serif;
  letter-spacing: -.025em;
  margin: 2px 0 6px;
}
body.phone-shelf-active .phone-shelf-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 44px;
  width: 100%;
  padding: 8px 0;
  color: #292a27;
  background: transparent;
  border: 0;
  border-top: 1px solid #e9e9e5;
  font: 14px Archivo, sans-serif;
  text-align: left;
}
body.phone-shelf-active .phone-shelf-action::after { content: '↗'; padding-left: 10px; }
body.phone-shelf-active .phone-shelf-content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  touch-action: pan-y;
  padding: 6px 18px 22px;
  scroll-padding-block: 12px;
}
body.phone-shelf-active :is(.phone-shelf-content, .phone-shelf-summary)[hidden] { display: none; }
body.phone-shelf-active .phone-shelf-content p { font-size: 16px; line-height: 1.55; }
body.phone-shelf-active .phone-shelf-content :is(button, .stage, summary) { min-height: 44px; }
body.phone-shelf-active :is(.scene-bottom, .scene-tools) {
  bottom: calc(var(--phone-shelf-space) + 6px);
  left: 8px;
  right: 8px;
  width: auto;
  gap: 4px;
  margin: 0;
  z-index: 5;
}
body.phone-shelf-active .scene-bottom { align-items: center; }
body.phone-shelf-active .scene-bottom p { font-size: 11px; line-height: 1.3; text-align: center; }
body.phone-shelf-active .scene-bottom > div { justify-content: center; padding: 0 4px; gap: 2px; }
body.phone-shelf-active :is(.scene-bottom, .scene-tools) button { min-height: 44px; padding: 6px 9px; font-size: 12px; }
body.phone-shelf-active .stage-list button { font-size: 13px; }
body.phone-shelf-active .range-control label { font-size: 14px; }
body.phone-shelf-active .range-control input { min-height: 24px; }
body.phone-shelf-active .experience-return { top: 6px; left: 8px; min-height: 44px; display: flex; align-items: center; }
body.phone-shelf-active.destination-venus .stage-top { display: none; }
body.phone-shelf-active.destination-venus .stage-bottom { display: none; }
body.phone-shelf-active.destination-venus .scene-tools { justify-content: center; flex-wrap: wrap; }
body.phone-shelf-active :is(.phone-shelf-handle, .phone-shelf-action):focus-visible { outline: 2px solid #617a8a; outline-offset: -3px; }
body.phone-shelf-active.dark :is(#story-window, #panel) { background: var(--paper); border-color: var(--line); }
body.phone-shelf-active.dark :is(.phone-shelf-handle, .phone-shelf-action) { color: var(--ink); border-color: var(--line); }

/* Landscape phones use adjacent reading space rather than a tiny model above it. */
@media (orientation: landscape) and (max-height: 600px) {
  body.phone-shelf-active #viewport {
    right: 44%;
    width: 56%;
    bottom: calc(var(--phone-controls-space) + 8px);
  }
  body.phone-shelf-active :is(#story-window, #panel) {
    left: 56%;
    right: 4px;
    bottom: 4px;
    max-height: calc(100% - 8px);
    border-bottom: 1px solid #e6e5e2;
    border-radius: 14px;
  }
  body.phone-shelf-active :is(.scene-bottom, .scene-tools) { right: 44%; bottom: 2px; }
  body.phone-shelf-active .scene-bottom p { display: none; }
  body.phone-shelf-active .phone-shelf-summary h2 { font-size: 18px; }
}
