/* The TV page: a 1920x1080 stage scaled to fit the screen (fit() in tv.js). Everything inside is
   placed in stage pixels. */

#app { position: fixed; inset: 0; background: #000; overflow: hidden; }
#stage {
  position: absolute; left: 0; top: 0; width: 1920px; height: 1080px;
  transform-origin: 0 0; overflow: hidden; background: #05070d;
  font-size: 40px;
}
#pics, #pics .pic, #rain, #black, #flash, #layer { position: absolute; inset: 0; width: 100%; height: 100%; }
#pics .pic { object-fit: cover; opacity: 0; transition: opacity 1s ease; }
#pics .pic.on { opacity: 1; }
#pics.dim .pic, #pics .pic.stay-dim { filter: brightness(.35) blur(3px); }
#pics.slow .pic { transition: opacity 3.5s ease; }
/* A slow push towards the gates as the inspector arrives. */
#pics.push .pic.on { transform: scale(1.12); transition: opacity 1s ease, transform 10s linear; }
#rain { pointer-events: none; }
/* Above the characters and words, so a fade to black takes everything with it. */
#black { background: #000; opacity: 0; pointer-events: none; z-index: 5; }
#flash { background: #dfe9ff; opacity: 0; mix-blend-mode: screen; pointer-events: none; z-index: 6; }
#stage.lit #pics .pic { filter: brightness(1.9) contrast(1.15) saturate(.7); }
#stage.lit #pics.dim .pic { filter: brightness(.9) blur(3px); }
#layer > * { position: absolute; }

#loading {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 40px;
}
#stage[data-mode="loading"] #loading { display: flex; }
#loading h1, .title h1 { font-family: var(--title); font-weight: 400; color: var(--gold-soft); margin: 0; text-shadow: 0 6px 0 #000, 0 0 40px rgba(0, 0, 0, .9); }
#loading h1 { font-size: 90px; }
#loading .bar { width: 700px; height: 22px; border: 3px solid var(--gold); border-radius: 12px; overflow: hidden; }
#loadbar { height: 100%; width: 0; background: var(--gold); transition: width .2s; }

/* ---------- Title and captions ---------- */
.title { inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.title h1 { font-size: 130px; line-height: 1.05; }
.title p { font-size: 44px; font-weight: 800; color: #fff; text-shadow: 0 3px 8px #000; margin-top: 50px; animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.caption {
  left: 50%; bottom: 110px; transform: translateX(-50%);
  font-family: var(--title); font-size: 96px; color: #fff; white-space: nowrap;
  text-shadow: 0 5px 0 #000, 0 0 30px rgba(0, 0, 0, .95);
  animation: rise .9s ease both;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 30px); } }

/* ---------- The suspects come out of the dark ---------- */
.entrant {
  left: 50%; bottom: 0; height: 930px; transform: translateX(-50%);
  filter: brightness(0); transition: filter 1.2s ease .5s;
}
.entrant.lit { filter: brightness(1) drop-shadow(0 0 40px rgba(255, 220, 150, .35)); }
.namecard {
  left: 1060px; width: 740px; top: 360px; color: #fff; text-shadow: 0 5px 0 #000, 0 0 30px #000;
  opacity: 0; transition: opacity .6s ease 1.3s, transform .6s ease 1.3s; transform: translateX(-40px);
}
.namecard.on { opacity: 1; transform: none; }
.namecard.left { left: 120px; text-align: right; transform: translateX(40px); }
.namecard b { display: block; white-space: nowrap; font-family: var(--title); font-weight: 400; font-size: 120px; line-height: 1; color: var(--gold-soft); }
.namecard span { display: block; white-space: nowrap; font-size: 54px; font-weight: 800; }
.lineup { left: 0; right: 0; bottom: 0; height: 760px; display: flex; justify-content: center; align-items: flex-end; gap: 10px; }
.lineup figure { margin: 0; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.lineup img { height: 640px; }
.lineup figcaption { font-weight: 900; font-size: 40px; color: #fff; text-shadow: 0 3px 6px #000; margin-top: 6px; }

/* ---------- The case: plan, QR code ---------- */
.case { inset: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 50px; align-items: center; padding: 50px 60px; }
.case .plan { width: min(1200px, calc(970px * var(--ratio, 1.5))); --plan-font: 25px; }
.case .right { display: flex; flex-direction: column; align-items: center; text-align: center; color: #fff; }
.case h2 { font-family: var(--title); font-weight: 400; font-size: 100px; color: var(--gold-soft); margin: 0 0 30px; text-shadow: 0 5px 0 #000; }
.case .qr { width: 470px; background: #fff; border-radius: 24px; padding: 18px; box-shadow: 0 10px 40px rgba(0, 0, 0, .7); }
.case .url { margin-top: 26px; font-size: 40px; line-height: 1.2; font-weight: 900; color: var(--gold-soft); }

/* ---------- The reveal ---------- */
.big-q { inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
.big-q b { font-family: var(--title); font-weight: 400; font-size: 420px; line-height: 1; color: var(--gold-soft); text-shadow: 0 10px 0 #000; animation: breathe 2.4s ease-in-out infinite; }
.big-q span { font-size: 70px; font-weight: 900; }
.big-q .show-answer { margin-top: 56px; font-size: 60px; padding: .45em 1.3em; cursor: pointer; }
.big-q .show-answer:disabled { opacity: .45; cursor: default; }
.culprit { bottom: 0; height: 960px; filter: brightness(0); transition: filter 1.4s ease .4s; }
.culprit.lit { filter: brightness(1) drop-shadow(0 0 50px rgba(255, 90, 60, .55)); }
.verdict { color: #fff; text-shadow: 0 5px 0 #000, 0 0 30px #000; opacity: 0; transition: opacity .7s ease 1.4s; }
.verdict.on { opacity: 1; }
.verdict b { display: block; font-family: var(--title); font-weight: 400; font-size: 170px; line-height: 1; color: #ffb1a0; }
.verdict span { font-size: 60px; font-weight: 900; }

.board {
  background: var(--paper); color: var(--ink); border: 10px solid var(--wood); border-radius: 26px;
  box-shadow: 0 16px 60px rgba(0, 0, 0, .8);
}
.proof { inset: 40px 70px; display: flex; flex-direction: column; gap: 24px; }
.proof h3 { margin: 0; font-family: var(--title); font-weight: 400; font-size: 84px; color: var(--gold-soft); text-shadow: 0 5px 0 #000; }
.proof .row { display: flex; gap: 40px; align-items: center; }
.says { display: flex; align-items: center; gap: 30px; padding: 26px 36px; }
.says .face { width: 190px; height: 190px; flex: 0 0 auto; }
.says q { font-size: 58px; font-weight: 800; line-height: 1.2; quotes: '“' '”'; }
.says.small .face { width: 110px; height: 110px; }
.says.small q { font-size: 42px; }
.but {
  font-size: 66px; font-weight: 900; color: #fff; text-shadow: 0 4px 0 #000;
  background: var(--red); border-radius: 20px; padding: 18px 40px; align-self: flex-start;
  animation: rise2 .7s ease .4s both;
}
@keyframes rise2 { from { opacity: 0; transform: translateY(30px); } }
.proof .pic { width: 500px; height: 500px; border-radius: 20px; border: 10px solid var(--wood); box-shadow: 0 10px 40px rgba(0, 0, 0, .7); }
.proof .plan { width: min(1000px, calc(610px * var(--ratio, 1.5))); --plan-font: 19px; flex: 0 0 auto; }
.plan .cell.route { box-shadow: inset 0 0 0 7px #ffd27a; z-index: 1; }
.plan .cell .step-no {
  position: absolute; right: 6px; bottom: 4px; width: 46px; height: 46px; border-radius: 50%;
  background: var(--red); color: #fff; font-size: 28px; display: grid; place-items: center; z-index: 3;
}

.story-row { inset: 60px 60px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 30px; align-items: stretch; }
.panel { display: flex; flex-direction: column; align-items: center; padding: 26px 22px; text-align: center; opacity: 0; transform: translateY(40px); transition: .7s ease; }
.panel.on { opacity: 1; transform: none; }
.panel .time { font-family: var(--title); font-size: 90px; color: var(--red); line-height: 1; }
.panel .faces { display: flex; gap: 10px; margin: 20px 0; }
.panel .face { width: 150px; height: 150px; }
.panel p { margin: 0; font-size: 44px; font-weight: 800; line-height: 1.25; }

.secrets { inset: 40px 80px; display: flex; flex-direction: column; gap: 18px; }
.secret { display: flex; align-items: center; gap: 30px; padding: 14px 30px; }
.secret .face { width: 150px; height: 150px; }
.secret img.clue { width: 160px; height: 160px; border-radius: 14px; border: 6px solid var(--wood); }
.secret p { margin: 0; font-size: 50px; font-weight: 800; flex: 1; }
.secret .over p { font-size: inherit; font-weight: inherit; }   /* the words on a paper thumbnail keep the paper's own size */

/* ---------- Controls ---------- */
#mute, #full, #qrBtn {
  position: fixed; top: 10px; z-index: 5; width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); background: rgba(0, 0, 0, .45); color: #fff; font-size: 22px;
  opacity: .5;
}
#mute { right: 66px; }
#qrBtn { right: 120px; font-size: 24px; }
#full { right: 12px; }
#mute:hover, #full:hover, #qrBtn:hover { opacity: 1; }
/* Previous and Next, side by side in the middle of the bottom edge, within reach from the middle of the screen. */
#nav { position: fixed; left: 50%; bottom: 1.2vh; transform: translateX(-50%); z-index: 3; display: flex; gap: 2vh; }
#nav[hidden] { display: none; }
#nav button {
  min-width: 24vh; height: max(46px, 7vh); padding: 0 2.4vh; border-radius: 1.6vh;
  border: 2px solid rgba(255, 255, 255, .45); background: rgba(0, 0, 0, .6); color: #fff;
  font: 800 max(18px, 2.8vh) var(--body); opacity: .85; cursor: pointer; touch-action: manipulation;
}
#nav button:hover, #nav button:active { opacity: 1; }
#vol {
  position: fixed; top: 10px; right: 174px; z-index: 5; width: 130px; height: 46px; margin: 0;
  accent-color: #e8c675; opacity: .5; cursor: pointer;
}
#vol:hover, #vol:focus-visible { opacity: 1; }

/* The QR code on demand, over whatever step is showing (for a team that has to open the page again). */
#qrBig { position: fixed; inset: 0; z-index: 4; background: rgba(0, 0, 0, .75); display: flex; align-items: center; justify-content: center; }
#qrBig[hidden] { display: none; }
#qrBig .qr-card { background: #fff; border-radius: 3vh; padding: 3vh; text-align: center; box-shadow: 0 10px 50px rgba(0, 0, 0, .8); }
#qrBig img { width: min(70vh, 80vw); display: block; }
#qrBig p { margin: 1.5vh 0 0; font: 900 4vh var(--body); color: var(--ink); }

/* ---------- The intro: built from layers, so any victim works in any room ---------- */
.mapzoom { inset: 0; display: flex; align-items: center; justify-content: center; }
.mapzoom .plan { width: calc(1000px * var(--ratio, 1.5)); transition: transform 3.6s cubic-bezier(.5, 0, .3, 1); will-change: transform; }
.mapzoom .plan.zoom { transform: scale(3); }
.victimfig { bottom: 16px; transform: translateX(-50%); filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .6)); opacity: 0; transition: opacity 1s ease; }
.victimfig.shown, .drink.shown { opacity: 1; }
.drink { bottom: 340px; width: 250px; height: 250px; border-radius: 50%; background: #fff; border: 8px solid var(--gold); box-shadow: 0 10px 40px rgba(0, 0, 0, .7); overflow: hidden; display: grid; place-items: center; opacity: 0; transition: opacity 1s ease; }
.drink img { width: 88%; }
.chalk { transform: translate(-50%, -50%); opacity: .92; filter: drop-shadow(0 0 3px rgba(0, 0, 0, .35)); }
.spilled { width: 210px; transform: translate(-50%, -50%); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); }
/* The stone's blank face in intro-stone: x 38-62%, y 14-78% of the 1920x1080 stage. */
.stone { left: 730px; width: 460px; top: 170px; height: 640px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; color: #3b352d; }
.stone .cameo { width: 190px; height: 240px; border-radius: 50%; overflow: hidden; border: 6px solid #8d8678; box-shadow: inset 0 0 14px rgba(0, 0, 0, .5); background: #c9c4b8; display: grid; place-items: center; }
.stone .cameo img { width: 108%; filter: grayscale(1) contrast(1.05); mix-blend-mode: multiply; }
.stone b { font-family: var(--title); font-weight: 400; font-size: 76px; line-height: 1.05; white-space: nowrap; text-shadow: 0 2px 0 rgba(255, 255, 255, .55); }
.stone span { font-family: var(--title); font-size: 40px; text-shadow: 0 1px 0 rgba(255, 255, 255, .55); }
@keyframes fadein { from { opacity: 0; } }

.cluepic { position: relative; container-type: inline-size; flex: 0 0 auto; }
.cluepic img { width: 100%; height: 100%; display: block; }
.proof .cluepic.pic { width: 470px; height: 470px; border-radius: 20px; border: 10px solid var(--wood); box-shadow: 0 10px 40px rgba(0, 0, 0, .7); overflow: hidden; }
.secret .cluepic.clue { width: 160px; height: 160px; border-radius: 14px; border: 6px solid var(--wood); overflow: hidden; }

/* ---------- The stage select ---------- */
#picker { position: fixed; inset: 0; z-index: 8; overflow: auto; padding: 24px; background: radial-gradient(ellipse at 50% 20%, var(--night-2), var(--night) 70%); text-align: center; }
#picker[hidden] { display: none; }
#picker h1 { font-family: var(--title); font-weight: 400; color: var(--gold-soft); margin: 0 0 12px; font-size: clamp(32px, 6vw, 64px); }
#stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 16px; max-width: 1200px; margin: 18px auto 0; }
#stages button { border: 3px solid var(--wood-light); border-radius: 14px; background: rgba(40, 24, 12, .85); color: var(--gold-soft); padding: 0; overflow: hidden; }
#stages button:hover, #stages button:focus-visible { border-color: var(--gold); outline: none; }
#stages img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; display: block; }
#stages span { display: block; padding: 10px; font-family: var(--title); font-size: clamp(20px, 2.6vw, 28px); }

/* Already on screen: no fade-in, for the moment the scene is redrawn under the fade to black. */
.still { animation: none !important; transition: none !important; }
#picker .credit { margin: 22px 0 0; font-size: 13px; opacity: .65; }
#picker .credit a { color: inherit; }
