/* Output screens: the output windows and the template editor's preview. Templates set fonts, colours and positions. */
body.output { margin: 0; height: 100vh; background: #000; overflow: hidden; cursor: none; user-select: none; }
body.output.show-mouse { cursor: default; }
.stage { position: absolute; inset: 0; overflow: hidden; container-type: size; background: #000; color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif; }
.stage .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.stage .layer { position: absolute; display: flex; flex-direction: column; white-space: pre-line; overflow: hidden;
  opacity: 0; transition: opacity 300ms ease; will-change: opacity; z-index: 2; }
.stage .layer.on { opacity: 1; }
/* An old layer's band stays solid while the new layer fades in over it; only its words fade. */
.stage .layer.top { z-index: 3; }
.stage .layer > .words, .stage .layer > .heading, .stage .layer > .caption { transition: opacity 300ms ease; }
.stage .layer.cut, .stage .layer.cut > * { transition: none; }
/* A slide's own text boxes: a layer over the whole screen that fades with the words. */
.stage .extras { position: absolute; inset: 0; z-index: 2; opacity: 0; transition: opacity 300ms ease; will-change: opacity; pointer-events: none; }
.stage .extras.on { opacity: 1; }
.stage .xbox { position: absolute; display: flex; flex-direction: column; white-space: pre-line; overflow: hidden; }
.stage .caption { margin-top: .4em; font-weight: 500; opacity: .85; }
.stage .heading { margin-bottom: .4em; font-weight: 600; opacity: .85; }
.stage .caption:empty, .stage .heading:empty { display: none; }

/* The stage monitor: every part is a box placed by the layout (left, top, width, height, size, colour, line-up set by screen.ts). */
[data-role="confidence"] .part { position: absolute; display: flex; flex-direction: column; overflow: hidden; line-height: 1.2; box-sizing: border-box; }
[data-role="confidence"] .label, [data-role="confidence"] .memo, [data-role="confidence"] .credit { display: block; white-space: nowrap; text-overflow: ellipsis; }
[data-role="confidence"] .memo { font-weight: 600; }
[data-role="confidence"] .memo:empty { visibility: hidden; }
[data-role="confidence"] .clock { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
[data-role="confidence"] .timer-box { flex-direction: row; align-items: flex-start; }
[data-role="confidence"] .timer { display: inline-flex; align-items: baseline; gap: .5em; padding: .1em .55em; border-radius: .3em;
  background: #1d1f23; white-space: nowrap; max-width: 100%; box-sizing: border-box; overflow: hidden; }
[data-role="confidence"] .timer[hidden] { display: none; }
[data-role="confidence"] .timer small { font-size: .7em; color: #9aa0a6; max-width: 16em; overflow: hidden; text-overflow: ellipsis; }
[data-role="confidence"] .timer small.over { color: #ff6b6b; font-weight: 700; text-transform: uppercase; }
[data-role="confidence"] .timer small:empty { display: none; }
[data-role="confidence"] .timer b { font-size: 1.6em; font-weight: 700; font-variant-numeric: tabular-nums; }
[data-role="confidence"] .timer[data-state="soon"] b { color: #f2b33d; }
[data-role="confidence"] .timer[data-state="over"] { background: #5c1414; }
[data-role="confidence"] .timer[data-state="over"] b { color: #ff6b6b; }
[data-role="confidence"] .layer { transition: none; }
[data-role="confidence"] .next { display: block; border-top: 2px solid #2a2c30; padding-top: .3em; white-space: pre-line; }
[data-role="confidence"] .next b { color: #c9a227; font-weight: 600; }

/* Behind the words: a template's background, or a media slide's picture or video. */
.stage .backdrop { z-index: -2; position: absolute; inset: 0; opacity: 0; transition: opacity .5s ease; overflow: hidden; }
.stage .backdrop.on { opacity: 1; }
.stage .backdrop.top { z-index: -1; }
.stage .backdrop > img, .stage .backdrop > video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .backdrop > webview { position: absolute; inset: 0; width: 100%; height: 100%; display: flex; border: 0; background: #fff; }
/* A page is drawn by its own process, which a negative z-index hides: a backdrop holding one sits at 0 (below the words, which come later), and the words' layers sit above it. */
.stage .backdrop.has-page { z-index: 0; }
.stage .backdrop.has-page.top { z-index: 1; }
/* Where a web page or camera doesn't run (small previews): its address or device name, with an icon. */
.stage .backdrop > .live-placeholder { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2cqh; padding: 6%; background: #1c2230; color: #dfe6f3; text-align: center; }
.stage .live-placeholder-icon svg { width: 14cqh; height: 14cqh; display: block; }
.stage .live-placeholder-text { font-size: 5cqh; max-width: 100%; overflow-wrap: anywhere; line-height: 1.2; }
.stage .backdrop > .cover { object-fit: cover; }
.stage .backdrop > .contain { object-fit: contain; }
[data-role="confidence"] .media-thumb { max-width: 60%; max-height: 100%; object-fit: contain; border-radius: .4cqh; }

/* Stage Message: the operator's words in the stage monitor's bottom-right corner. */
[data-role="confidence"] .stage-message { position: absolute; right: 2%; bottom: 3%; max-width: 46%; box-sizing: border-box; padding: .35em .7em;
  font-size: 6cqh; font-weight: 700; line-height: 1.15; text-align: center; white-space: pre-line; overflow-wrap: anywhere;
  color: #fff; background: #b3261e; border: .08em solid #fff; border-radius: .25em; box-shadow: 0 .1em .5em rgba(0, 0, 0, .6); }
[data-role="confidence"] .stage-message[hidden] { display: none; }
[data-role="confidence"] .stage-message.flashing { animation: message-flash .5s steps(1, end) 6; }
[data-role="confidence"] .stage-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
[data-role="confidence"] .stage-flash.flashing { animation: screen-flash .6s steps(1, end) 5; }
@keyframes message-flash { 0% { background: #fff; color: #b3261e; } 50% { background: #b3261e; color: #fff; } }
@keyframes screen-flash { 0% { opacity: .9; } 50% { opacity: 0; } }
