/* Jogar pelo celular (jogar.html): o saguão e a sala com o controle de toque. */
.play-me {
  display: flex;
  align-items: center;
  gap: 14px;
}
.play-me .avatar {
  flex: none;
}
.play-me b {
  display: block;
  font-size: 1.15rem;
}
.play-me small {
  color: var(--muted);
}
.plan-chip {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}
.invite {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--accent);
  background: rgb(var(--accent-rgb) / 0.08);
}
#play-invites,
#play-pads {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
body.in-stage {
  overflow: hidden;
}

/* ------------------------------------------------------------------ a sala */
#stage {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  color: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overflow: hidden;
}
#stage-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.stage-top {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 62vw;
  padding: 5px 6px 5px 14px;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.22);
  background: rgb(6 17 28 / 0.6);
  backdrop-filter: blur(14px);
  font-size: 12px;
}
#stage-title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#stage-role {
  flex: none;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent, #b1ff69);
  color: #06111c;
  font-weight: 700;
}
#stage.watching #stage-role {
  background: #5b6b7c;
  color: #fff;
}
.stage-top button {
  flex: none;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 0.25);
  background: rgb(255 255 255 / 0.08);
  color: #fff;
  font: inherit;
  font-weight: 600;
}
#stage-status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: 80vw;
  padding: 12px 20px;
  border-radius: 18px;
  background: rgb(6 17 28 / 0.82);
  border: 1px solid rgb(255 255 255 / 0.2);
  text-align: center;
}
#stage-reactions {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.reaction {
  position: absolute;
  bottom: 30%;
  display: grid;
  justify-items: center;
  font-size: 34px;
  animation: reaction-up 2.6s ease-out forwards;
}
.reaction small {
  font-size: 11px;
  opacity: 0.85;
}
.reaction.lane-0 {
  left: 30%;
}
.reaction.lane-1 {
  left: 40%;
}
.reaction.lane-2 {
  left: 50%;
}
.reaction.lane-3 {
  left: 60%;
}
.reaction.lane-4 {
  left: 70%;
}
@keyframes reaction-up {
  to {
    transform: translateY(-38vh);
    opacity: 0;
  }
}

/* O controle: medidas em vmin, para caber deitado e em pé. */
.pad-key {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid rgb(255 255 255 / 0.4);
  background: rgb(255 255 255 / 0.1);
  color: rgb(255 255 255 / 0.9);
  font: 700 4.4vmin 'Segoe UI', system-ui, sans-serif;
  touch-action: none;
}
.pad-key.down {
  background: var(--accent, #b1ff69);
  border-color: var(--accent, #b1ff69);
  color: #06111c;
}
.pad-left,
.pad-right {
  position: absolute;
  bottom: max(4vmin, env(safe-area-inset-bottom));
  width: 46vmin;
  height: 62vmin;
}
.pad-left {
  left: max(3vmin, env(safe-area-inset-left));
}
.pad-right {
  right: max(3vmin, env(safe-area-inset-right));
}
.pad-key.face {
  width: 14vmin;
  height: 14vmin;
}
.pad-right .a {
  right: 14vmin;
  bottom: 0;
}
.pad-right .b {
  right: 0;
  bottom: 13vmin;
}
.pad-right .x {
  right: 28vmin;
  bottom: 13vmin;
}
.pad-right .y {
  right: 14vmin;
  bottom: 26vmin;
}
.pad-key.dir {
  width: 12vmin;
  height: 12vmin;
  border-radius: 3vmin;
}
.pad-left .up {
  left: 12vmin;
  bottom: 50vmin;
}
.pad-left .down {
  left: 12vmin;
  bottom: 26vmin;
}
.pad-left .left {
  left: 0;
  bottom: 38vmin;
}
.pad-left .right {
  left: 24vmin;
  bottom: 38vmin;
}
#stage-stick {
  position: absolute;
  left: 4vmin;
  bottom: 0;
  width: 24vmin;
  height: 24vmin;
  border-radius: 50%;
  border: 1.5px solid rgb(255 255 255 / 0.3);
  background: rgb(255 255 255 / 0.06);
  touch-action: none;
}
#stage-knob {
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.45);
  pointer-events: none;
}
.pad-key.bump {
  top: max(14vmin, calc(env(safe-area-inset-top) + 12vmin));
  width: 17vmin;
  height: 9vmin;
  border-radius: 4.5vmin;
  font-size: 3.4vmin;
}
.pad-key.lb {
  left: max(3vmin, env(safe-area-inset-left));
}
.pad-key.lt {
  left: calc(max(3vmin, env(safe-area-inset-left)) + 19vmin);
}
.pad-key.rb {
  right: max(3vmin, env(safe-area-inset-right));
}
.pad-key.rt {
  right: calc(max(3vmin, env(safe-area-inset-right)) + 19vmin);
}
.pad-key.mid {
  bottom: max(4vmin, env(safe-area-inset-bottom));
  width: 17vmin;
  height: 7.5vmin;
  border-radius: 4vmin;
  font-size: 2.8vmin;
}
.pad-key.select {
  left: calc(50% - 19vmin);
}
.pad-key.start {
  left: calc(50% + 2vmin);
}
#stage-emojis {
  position: absolute;
  left: 50%;
  bottom: max(5vmin, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: none;
  gap: 6px;
  padding: 6px;
  border-radius: 999px;
  background: rgb(6 17 28 / 0.7);
  border: 1px solid rgb(255 255 255 / 0.2);
}
#stage-emojis .emoji {
  width: 11vmin;
  height: 11vmin;
  max-width: 54px;
  max-height: 54px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.1);
  font-size: 5.5vmin;
}
#stage-padonly[hidden] {
  display: none;
}
/* Só controle: a imagem do jogo some daqui (a pessoa olha para a TV do amigo). */
#stage.pad-only #stage-video {
  visibility: hidden;
}
#stage.pad-only {
  background: radial-gradient(ellipse at 50% 40%, #12283a, #050b13);
}
/* Assistindo: o controle sai e ficam as reações. */
#stage.watching .pad-left,
#stage.watching .pad-right,
#stage.watching .pad-key {
  display: none;
}
#stage.watching #stage-emojis {
  display: flex;
}
/* Em pé: a imagem fica no alto e o controle embaixo, sem cobrir o jogo. */
@media (orientation: portrait) {
  #stage-video {
    height: 56.25vw;
    top: max(54px, calc(env(safe-area-inset-top) + 46px));
  }
  .pad-key.bump {
    top: auto;
    bottom: calc(max(4vmin, env(safe-area-inset-bottom)) + 70vmin);
  }
  .pad-key.mid {
    bottom: calc(max(4vmin, env(safe-area-inset-bottom)) + 84vmin);
  }
}
