/* the theater button: on the picture's right edge, at mid-height, with the replay button above it (that edge is usually empty; the corner collided with labels) */
.stage .thb { position: absolute; right: 10px; top: calc(50% + 4px); z-index: 3; display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--room); color: var(--ink); cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.stage .thb:hover { background: var(--line); }
.stage .thb svg, .stage.city .thb svg { position: static; display: block; width: 13px; height: 13px; cursor: inherit; }
.stage .thb[aria-pressed="false"] .ti-out, .stage .thb[aria-pressed="true"] .ti-in { display: none; }
.stage .replay { right: 10px; top: calc(50% - 32px); }
/* a phone held upright is asked to turn: theater mode starts once it is on its side */
.turn { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: var(--s5); background: rgba(4, 12, 18, .72); }
.turn-c { display: grid; justify-items: center; gap: var(--s4); max-width: 280px; padding: var(--s5); border-radius: 12px; background: var(--room); border: 1px solid var(--line); text-align: center; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.turn-c p { font: var(--t-lg)/1.4 var(--serif); text-wrap: balance; }
.turn-i { color: var(--node); }
@media (prefers-reduced-motion: no-preference) { .turn-i { animation: turn-i 2.4s ease-in-out infinite; } @keyframes turn-i { 0%, 25% { transform: none; } 60%, 100% { transform: rotate(-90deg); } } }

/* theater mode: the stepper box fills the window. theater.js picks the layout that leaves the picture largest and sets its width, --tw:
   "side" puts the picture at the left, full height, with the stepper and the step's panel in a column beside it;
   "stack" puts it across the top, with the stepper and the panel under it. Only the panel scrolls. */
:root[data-theater] { overflow: hidden; }
:root[data-theater] #stepbar { position: fixed; inset: 0; z-index: 50; margin: 0; padding: 0; border: 0; border-radius: 0; display: grid; gap: 0; align-items: stretch; background: var(--room); }
:root[data-theater="side"] #stepbar { grid-template: auto auto minmax(0, 1fr) / var(--tw) minmax(0, 1fr); }
:root[data-theater="stack"] #stepbar { grid-template: auto auto auto minmax(0, 1fr) / minmax(0, 1fr); }
:root[data-theater] #pict { display: grid; align-content: center; background: var(--ground); }
:root[data-theater="side"] #pict { grid-area: 1 / 1 / -1 / 2; }
:root[data-theater="stack"] #pict { grid-row: 1; }
:root[data-theater] #stepbar .stv { width: var(--tw); max-width: none; margin-inline: auto; border-radius: 0; }
:root[data-theater] :is(#thead, #sctl, #panel) { grid-column: -2 / -1; }
:root[data-theater="side"] #thead { grid-row: 1; } :root[data-theater="side"] #sctl { grid-row: 2; } :root[data-theater="side"] #panel { grid-row: 3; }
:root[data-theater="stack"] #thead { grid-row: 2; } :root[data-theater="stack"] #sctl { grid-row: 3; } :root[data-theater="stack"] #panel { grid-row: 4; }
:root[data-theater] #thead { display: flex; align-items: center; gap: var(--s2); padding: 8px 12px; border-bottom: 1px solid var(--line); }
:root[data-theater] #sctl { padding: 10px 12px; border-bottom: 1px solid var(--line); }
:root[data-theater] #panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 12px 14px 24px; }
:root[data-theater="side"] #sctl .sfoot { padding-inline: 0; }
:root[data-theater="side"] #panel .sp { padding-inline: 0; }
/* the head: the result's name over the scene's, between the ways to the pages before and after */
.thead { display: none; }
.thead .tt { flex: 1; min-width: 0; display: grid; gap: 1px; text-align: center; }
.thead .tt > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thead .tp { font: var(--t-sm)/1.35 var(--sans); color: var(--soft); }
.thead .tp b { font-weight: 600; color: var(--ink); }
.thead .tp i { font-style: normal; }
.thead .ts { font: 500 var(--t-lg)/1.25 var(--serif); }
:root[data-reg="isle"] .thead .ts { font-weight: 400; }
.thead .tnav { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--soft); }
.thead .tnav:hover { background: var(--ground); color: var(--ink); }
.thead .tnav[disabled] { opacity: .3; pointer-events: none; }
/* a result's own page in theater mode: the page fills the window and scrolls, under the same head */
:root[data-theater="intro"] main { position: fixed; inset: 0; z-index: 50; overflow-y: auto; overscroll-behavior: contain; background: var(--ground); padding: 80px max(var(--s5), calc((100vw - 920px) / 2)) var(--s7); }
:root[data-theater="intro"] #thead { position: fixed; top: 0; left: 0; right: 0; z-index: 51; background: var(--room); }
:root[data-theater="stack"] #sctl { padding-block: 6px; }
/* a short window, such as a phone on its side: tighter, so more of the step's text shows without scrolling */
@media (max-height: 520px) {
  :root[data-theater] #thead { padding: 3px 8px; }
  :root[data-theater] #thead .ts { font-size: var(--t-md); }
  :root[data-theater="intro"] main { padding-top: 56px; }
  :root[data-theater] #sctl { padding: 6px 8px; gap: 6px; }
  :root[data-theater] #sctl .arrow { width: 30px; height: 30px; }
  :root[data-theater] #sctl .sd { width: 24px; height: 24px; }
  :root[data-theater] #sctl .dots { gap: 7px; }
  :root[data-theater] #sctl .sd.r::before, :root[data-theater] #sctl .sd.s::after { width: 5px; }
  :root[data-theater] #panel { padding: 8px 10px 16px; }
  :root[data-theater] #panel .sp { gap: 8px; }
  :root[data-theater] #panel .say { font-size: var(--t-md); }
  :root[data-theater] #panel .fcol { padding: 8px 12px 10px; gap: 6px; }
}
/* theater mode keeps the step groups' names and the key at any size, as on a desktop; the panel then need not repeat the phase */
:root[data-theater] .stepbar .sfoot { display: flex; }
:root[data-theater] #panel .sp-ph:not(:has(i)) { display: none; }
/* the key scrolls sideways, in one row, rather than wrapping to several lines; its dots keep their own small size */
:root[data-theater] .stepbar .sfoot { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; justify-content: safe center; padding-inline: 8px; }
:root[data-theater] .stepbar .sfoot::-webkit-scrollbar { display: none; }
:root[data-theater] .stepbar .skey { flex-wrap: nowrap; justify-content: safe center; }
:root[data-theater] .stepbar .skey > span { flex: none; white-space: nowrap; }
:root[data-theater] #sctl .skey .sd { width: 12px; height: 12px; }
