/* v04: the 3D stage in its three places (behind the lock screen, inside a video bubble, full screen) + the play HUD */
.stage {
  position: fixed !important; inset: 0; z-index: 2;
  --ct: 0px; --cr: 0px; --cb: 0px; --cl: 0px; --rad: 20px;
}
.stage.mode-bg { pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
body.has-pitch .stage.mode-bg { opacity: 1; }
.stage.mode-off { display: none; }
.stage.mode-bubble { pointer-events: none; clip-path: inset(var(--ct) var(--cr) var(--cb) var(--cl) round var(--rad)); }
.stage.mode-full { z-index: 12; clip-path: inset(0 0 0 0 round 0); transition: clip-path .55s var(--ease); }
.stage.mode-shrink { z-index: 12; pointer-events: none; clip-path: inset(var(--ct) var(--cr) var(--cb) var(--cl) round var(--rad)); transition: clip-path .5s var(--ease), opacity .3s ease .45s; }
.stage.mode-shrink.is-gone { opacity: 0; }

/* the play button + caption drawn on the live video bubble (inside the stage, so it sits on the 3D) */
.deco {
  position: absolute; left: var(--bx, 0); top: var(--by, 0); width: var(--bw, 0); height: var(--bh, 0);
  pointer-events: none; display: none; color: #fff;
}
.stage.mode-bubble .deco { display: block; }
.deco::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .25), transparent 35%, transparent 60%, rgba(0, 0, 0, .6)); }
.deco__play {
  position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px;
  border-radius: 50%; display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); color: var(--ink);
  box-shadow: 0 0 0 0 rgba(255, 255, 255, .55);
  animation: ring 1.8s ease-out infinite;
}
.deco__play svg { margin-left: 4px; }
.stage.is-auto .deco__play { animation: none; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); } 100% { box-shadow: 0 0 0 22px rgba(255, 255, 255, 0); } }
.deco__top { position: absolute; left: 10px; top: 10px; padding: 5px 9px; border-radius: 999px; background: rgba(0, 0, 0, .5); font-size: 12px; font-weight: 700; }
.deco__cap { position: absolute; left: 12px; right: 12px; bottom: 11px; font-size: 13px; font-weight: 700; line-height: 1.25; text-shadow: 0 1px 6px rgba(0, 0, 0, .6); }
.deco__cap small { display: block; font-weight: 500; opacity: .85; font-size: 12px; }

/* ---------- the HUD over the play ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; display: none; }
.stage.mode-full .hud, .stage.mode-shrink .hud { display: block; }
.stage.mode-shrink .hud { opacity: 0; transition: opacity .2s; }
.hud__row {
  position: absolute; left: 0; right: 0; top: 0;
  padding: calc(var(--sat) + 12px) 12px 0;
  display: flex; align-items: flex-start; gap: 8px;
  max-width: 980px; margin: 0 auto;
}
.hud__row .av { --s: 34px; box-shadow: 0 0 0 2px rgba(255, 255, 255, .9), 0 4px 12px rgba(0, 0, 0, .3); }
.hud__msgs { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; justify-items: start; align-content: start; min-height: 64px; }
.hud.is-press .hud__msgs { min-height: 110px; }
.hb {
  max-width: 100%; padding: 9px 14px; border-radius: 19px;
  background: rgba(255, 255, 255, .95); color: var(--ink);
  font-size: 18px; font-weight: 700; line-height: 1.2;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .28);
  transform-origin: 0 50%;
}
.hb.pop { animation: pop .38s var(--spring) both; }
.hb small { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 1px; }
.hb.typing { display: inline-flex; gap: 5px; padding: 13px 15px; }
.hb.typing i { width: 8px; height: 8px; border-radius: 50%; background: #8e8e93; animation: dot 1.1s infinite ease-in-out; }
.hb.typing i:nth-child(2) { animation-delay: .15s; } .hb.typing i:nth-child(3) { animation-delay: .3s; }
.hb--p { background: var(--red); color: #fff; font-size: 17px; }
.hb--p.is-hot { animation: jitter .18s linear infinite; }
@keyframes jitter { 25% { transform: translate(1px, -1px) rotate(-1deg); } 75% { transform: translate(-1px, 1px) rotate(1deg); } }
.hud__ctx { max-width: 100%; font-size: 12px; font-weight: 700; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); padding-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.timer {
  flex: none; position: relative; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(10, 14, 24, .62); color: #fff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .3);
  opacity: 0; transform: scale(.6); transition: opacity .25s, transform .35s var(--spring);
}
.timer.on { opacity: 1; transform: none; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 4; }
.timer .tr { stroke: rgba(255, 255, 255, .18); }
.timer .tv { stroke: #fff; stroke-linecap: round; stroke-dasharray: 163.4; transition: stroke .3s; }
.timer b { position: relative; font: 800 16px/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.timer.is-low .tv { stroke: var(--red); }
.timer.is-low { animation: beat .5s ease-in-out infinite; }
@keyframes beat { 50% { transform: scale(1.08); } }

/* pressure: red closes in from the edges, the side he comes from glows */
.hud__vig {
  position: absolute; inset: 0; opacity: calc(var(--press-u, 0) * 1.1); will-change: opacity;
  background: radial-gradient(120% 85% at 50% 55%, transparent 45%, rgba(255, 30, 30, .55) 100%);
}
.hud__edge { position: absolute; top: 0; bottom: 0; width: 26%; opacity: 0; transition: opacity .25s; will-change: opacity; }
.hud__edge.l { left: 0; background: linear-gradient(90deg, rgba(255, 40, 40, .7), transparent); }
.hud__edge.r { right: 0; background: linear-gradient(270deg, rgba(255, 40, 40, .7), transparent); }
.hud__edge.b { left: 0; right: 0; width: auto; top: auto; height: 30%; background: linear-gradient(0deg, rgba(255, 40, 40, .7), transparent); }
.hud[data-threat=left] .hud__edge.l, .hud[data-threat=right] .hud__edge.r, .hud[data-threat=behind] .hud__edge.b { opacity: 1; animation: glow .6s ease-in-out infinite alternate; }
@keyframes glow { to { opacity: .45; } }

/* after the tap: your reply + his reaction, right under the question */
.hud__me { position: absolute; right: 12px; top: calc(var(--sat) + 86px); display: grid; justify-items: end; gap: 6px; max-width: 78%; }
.hud.is-press .hud__me { top: calc(var(--sat) + 128px); }
.hud__me .hb { background: var(--out); color: #fff; transform-origin: 100% 50%; position: relative; }
.hud__me .hb.is-none { background: rgba(255, 255, 255, .9); color: var(--ink-2); }
.hud__me .tb { left: -20px; top: -16px; border-color: rgba(255, 255, 255, .9); }
.burst { position: absolute; font-size: 44px; pointer-events: none; animation: burst 1.1s var(--ease) both; margin: -22px 0 0 -22px; }
@keyframes burst { 0% { opacity: 0; transform: scale(.3); } 25% { opacity: 1; transform: scale(1.25); } 100% { opacity: 0; transform: translateY(-90px) scale(1); } }

/* the engine's markers, in chat colours: white dots with a blue letter and a ring that breathes
   (hidden for the one frame before the engine places them) */
.stage.is-placing .pt-mk { visibility: hidden; }
.mk { position: relative; width: 56px; height: 56px; display: grid; place-items: center; }
.mk__ring { position: absolute; inset: -6px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .85); animation: breathe 1.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.3s); }
.mk__dot {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  background: #fff; color: var(--out); font: 900 22px/1 var(--font);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .45), inset 0 -3px 0 rgba(27, 124, 255, .18);
  transition: transform .25s var(--spring), background .2s, color .2s;
  animation: mkIn .45s var(--spring) both; animation-delay: calc(var(--i) * 70ms);
}
.pt-mk:active .mk__dot { transform: scale(.88); }
@keyframes breathe { 50% { transform: scale(1.14); opacity: .45; } }
@keyframes mkIn { from { transform: scale(0); } }
.pt-mk.is-pro .mk__dot { background: var(--green); color: #fff; transform: scale(1.12); }
.pt-mk.is-pro .mk__ring { border-color: var(--green); }
.pt-mk.is-mine .mk__dot { background: #fff; color: var(--red); box-shadow: 0 0 0 4px var(--red), 0 6px 18px rgba(0, 0, 0, .45); }
.pt-mk.is-mine .mk__ring, .pt-mk.is-dim .mk__ring { display: none; }
.pt-stage.pt-answered .mk__ring { animation: none; }
.pt-mk[data-edge=l]::before { border-right-color: #fff; }
.pt-mk[data-edge=r]::before { border-left-color: #fff; }
/* the option's words under the marker, like a chat chip (never takes a tap: it can sit over a neighbour) */
.mk__tag {
  position: absolute; top: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 136px; padding: 4px 9px; border-radius: 12px;
  background: rgba(255, 255, 255, .96); color: var(--ink);
  font: 700 13.5px/1.2 var(--font); text-align: center; letter-spacing: -.01em;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.pt-mk[data-tag=l] .mk__tag { left: -10px; transform: none; text-align: left; }
.pt-mk[data-tag=r] .mk__tag { left: auto; right: -10px; transform: none; text-align: right; }
/* pinned to a side (the spot is off screen): several can stack on one edge, so the words sit beside, inwards */
.pt-mk[data-edge=l] .mk__tag { left: calc(100% + 8px); right: auto; top: 50%; transform: translateY(-50%); text-align: left; }
.pt-mk[data-edge=r] .mk__tag { right: calc(100% + 8px); left: auto; top: 50%; transform: translateY(-50%); text-align: right; }
.pt-mk.is-pro .mk__tag { background: var(--green); color: #fff; }
.pt-mk.is-mine .mk__tag { background: #fff; color: var(--red); box-shadow: 0 0 0 2px var(--red), 0 4px 12px rgba(0, 0, 0, .35); }
@media (max-width: 600px) { .hud__match { display: none; } }
.pt-paths path { stroke: rgba(255, 255, 255, .8); }
.pt-paths ellipse { fill: rgba(255, 255, 255, .22); }

@media (min-width: 900px) {
  .hud__row { padding-top: 22px; }
  .hb { font-size: 21px; }
  .hud__me { right: max(24px, calc(50% - 470px)); top: 104px; max-width: 420px; }
  .hud.is-press .hud__me { top: 146px; }
}
