/* The Sala scene: canvases stacked under and over the live TV and the notebook. */
html, body { margin: 0; height: 100%; overflow: hidden; background: #140c0b; }
body { -webkit-tap-highlight-color: transparent; }
#stage { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(ellipse at 60% 40%, #2a1a16, #120a09 70%); }
#stage canvas { position: absolute; left: 0; top: 0; pointer-events: none; }
#paint, #fg, #glow { opacity: 0; transition: opacity .9s ease; }
#stage.ready #paint, #stage.ready #fg { opacity: 1; }
#stage.ready #glow { opacity: 1; animation: glow-flicker 9s steps(1) infinite; }
#glow { mix-blend-mode: screen; }
@keyframes glow-flicker {
  0%, 31%, 33%, 70%, 72%, 100% { opacity: 1; }
  32% { opacity: .9; }
  71% { opacity: .94; }
}

/* the live screen and the glass over it, both mapped onto the painted quad */
#screen, #glass, #note { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#glass {
  pointer-events: none; border-radius: 20px / 26px;
  background:
    radial-gradient(ellipse 110% 100% at 50% 50%, transparent 58%, rgba(10, 16, 40, .22) 86%, rgba(6, 8, 20, .5) 100%),
    linear-gradient(118deg, rgba(255, 255, 255, .13) 0%, rgba(255, 255, 255, .05) 22%, transparent 34%),
    radial-gradient(ellipse 30% 18% at 82% 86%, rgba(255, 200, 140, .12), transparent 70%);
}
#osd {
  position: absolute; right: 6%; top: 7%; padding: .2em .45em;
  font: 700 15px/1 ui-monospace, "SFMono-Regular", Menlo, monospace; letter-spacing: .08em;
  color: #8dff9f; text-shadow: 0 0 6px rgba(80, 255, 120, .8), 0 0 1px #000;
  opacity: 0; transition: opacity .3s;
}
#osd.on { opacity: 1; }

/* the checklist, handwritten on the notebook page */
#note {
  box-sizing: border-box; padding: 8px 10px 0 58px;
  font: 500 27px/40px Caveat, "Segoe Print", "Bradley Hand", cursive; color: #2b2f5a;
  background: repeating-linear-gradient(to bottom, transparent 0 38px, rgba(90, 120, 200, .32) 38px 40px);
  opacity: 0; transition: opacity .9s;
}
#stage.ready #note { opacity: 1; }
#note .title { margin: 0; font-weight: 700; }
#note ul { list-style: none; margin: 0; padding: 0; }
#note label { display: flex; align-items: center; gap: 12px; cursor: pointer; white-space: nowrap; }
#note input { position: absolute; opacity: 0; width: 1px; height: 1px; }
#note i {
  flex: none; width: 22px; height: 22px; border: 2.5px solid #3a3f6e; border-radius: 4px 6px 3px 5px;
  transform: rotate(-3deg); position: relative;
}
#note input:checked + i::after {
  content: ""; position: absolute; left: 3px; top: -8px; width: 10px; height: 20px;
  border: solid #b8402c; border-width: 0 4px 4px 0; transform: rotate(40deg); border-radius: 2px;
}
#note input:checked ~ span { text-decoration: line-through 2px rgba(60, 64, 110, .7); color: #4a4e78; }
#note input:focus-visible + i { outline: 2px solid #c47a2a; outline-offset: 3px; }
#note a { color: #8a3a22; text-decoration: none; font-weight: 700; display: inline-block; margin-left: 2px; }
#note a:hover, #note a:focus-visible { text-decoration: underline; }

/* invisible buttons over the painted knobs, remote and headphones */
.hot { position: absolute; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; }
.hot:focus-visible { outline: 2px solid rgba(255, 214, 150, .85); outline-offset: 2px; }
#toast {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); padding: 7px 14px; border-radius: 99px;
  font: 600 14px/1.2 system-ui, sans-serif; color: #ffe9cf; background: rgba(30, 18, 14, .78);
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
#toast.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  #stage.ready #glow { animation: none; }
}

/* full screen: top-left, clear of the room switcher (top-right) */
#cheia {
  position: fixed; z-index: 41; top: max(12px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left));
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 9px; border-radius: 999px;
  border: 1px solid rgba(255, 220, 180, .22); background: rgba(22, 13, 8, .7); color: #f3dcb8; cursor: pointer;
  font: 700 13px/1 system-ui, sans-serif; box-shadow: 0 4px 12px rgba(0, 0, 0, .35); -webkit-tap-highlight-color: transparent;
}
#cheia svg { width: 17px; height: 17px; }
#cheia:hover { background: rgba(40, 24, 15, .82); }
#cheia:focus-visible { outline: 2px solid rgba(255, 214, 150, .85); outline-offset: 2px; }
#cheia.on span::after { content: " · sair"; }
#cheia[hidden] { display: none; }
#toast.longo { white-space: normal; width: min(340px, calc(100vw - 32px)); text-align: center; line-height: 1.35; }

/* the TV up close (phones on their side) */
.tv-perto { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 10px;
  background: rgba(10, 6, 4, .78); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tv-perto-box { display: flex; flex-direction: column; gap: 8px; width: min(96vw, 150vh); }
.tv-perto-tela { width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 70px); border-radius: 18px; overflow: hidden; }
.tv-perto-bar { display: flex; align-items: center; justify-content: center; gap: 10px; color: #f3dcb8; font: 700 13px/1 system-ui, sans-serif; }
.tv-perto-bar button { min-width: 40px; height: 34px; border-radius: 999px; border: 1px solid rgba(255, 220, 180, .25); background: rgba(30, 18, 12, .8);
  color: #f3dcb8; font: 700 16px/1 system-ui, sans-serif; cursor: pointer; }
.tv-perto-ch { min-width: 140px; text-align: center; letter-spacing: .04em; }
.tv-perto-x { margin-left: 8px; }
