/* What the dashboard (/casa/) and the editor (/casa/editar/) share: a camera, live; the chooser when
   two lights are as near the finger; the label where the finger was; the toast. The colours and
   faces come from the page (--carbon, --display...). */

.toast {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  margin: 0;
  padding: 12px 18px;
  max-width: min(520px, calc(100% - 40px));
  background: var(--carbon);
  color: #fff;
  border-radius: 14px;
  box-shadow:
    0 4px 0 var(--carbon-edge),
    var(--lift);
  font: 500 15px/1.35 var(--text);
  text-align: center;
  z-index: 5;
}
.toast[hidden] {
  display: none;
}

/* two lights as near the finger: which one? */
.chooser {
  position: absolute;
  z-index: 8;
  display: grid;
  gap: 4px;
  padding: 6px;
  border-radius: 16px;
  background: var(--carbon);
  box-shadow: 0 4px 0 var(--carbon-edge), var(--lift);
  animation: pop 0.16s cubic-bezier(0.2, 0.9, 0.3, 1.3);
  transform-origin: var(--tip) 100%;
}
.chooser.down {
  transform-origin: var(--tip) 0;
}
.chooser::after {
  content: "";
  position: absolute;
  left: calc(var(--tip) - 8px);
  border: 8px solid transparent;
}
.chooser.up::after {
  top: 100%;
  border-top-color: var(--carbon);
}
.chooser.down::after {
  bottom: 100%;
  border-bottom-color: var(--carbon);
}
@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.88);
  }
}
.choice {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  padding: 8px 12px 8px 8px;
  border: 0;
  border-radius: 11px;
  background: rgb(255 255 255 / 0.06);
  color: #fff;
  text-align: left;
}
.choice:active {
  background: rgb(255 255 255 / 0.16);
}
.choice svg {
  width: 30px;
  height: 30px;
}
.choice:not(.on) svg {
  filter: grayscale(1) brightness(1.4);
  opacity: 0.6;
}
.choice span {
  font: 600 17px/1.1 var(--display);
  letter-spacing: 0.01em;
}
.choice em {
  font: 600 13px/1 var(--display);
  font-style: normal;
  letter-spacing: 0.04em;
  padding: 5px 8px;
  border-radius: 8px;
  background: rgb(255 255 255 / 0.1);
  color: rgb(255 255 255 / 0.85);
}
.choice.on em {
  background: var(--c);
  color: var(--carbon);
}
/* a ring opening out from what just switched */
.plano .pulse {
  fill: none;
  stroke: #fff;
  pointer-events: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 0.65s ease-out forwards;
}
@keyframes pulse {
  from {
    opacity: 0.95;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(var(--grow));
  }
}

/* what just happened, where the finger was */
.bubble {
  position: absolute;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px 7px 9px;
  border-radius: 999px;
  background: var(--carbon);
  color: #fff;
  font: 600 15px/1 var(--display);
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 3px 0 var(--carbon-edge), var(--lift);
  animation: bubble 1.7s ease forwards;
}
.bubble i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #80878b;
}
.bubble.on i {
  background: var(--c);
  box-shadow: 0 0 10px 2px var(--c);
}
@keyframes bubble {
  0% {
    opacity: 0;
    transform: translate(-50%, calc(-100% - 10px)) scale(0.9);
  }
  12%,
  78% {
    opacity: 1;
    transform: translate(-50%, calc(-100% - 18px)) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-100% - 26px)) scale(1);
  }
}

/* --- a camera, live: a card over the board; a tap makes it fullscreen ------------------------------ */
.live-card {
  position: absolute;
  left: 24px;
  bottom: 24px;
  z-index: 6;
  width: min(460px, 48%);
  padding: 10px;
  border-radius: 18px;
  background: var(--carbon);
  color: #fff;
  box-shadow: 0 5px 0 var(--carbon-edge), var(--lift);
  animation: rise 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.live-card[hidden] {
  display: none;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}
.live-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 2px 10px 4px;
}
.live-bar h2 {
  margin: 0;
  flex: 1;
  font: 600 20px/1 var(--display);
  letter-spacing: 0.02em;
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px 4px 7px;
  border-radius: 999px;
  background: rgb(199 50 59 / 0.18);
  color: #ff9ca2;
  font: 600 14px/1 var(--display);
  letter-spacing: 0.04em;
}
.live-pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff4b55;
  animation: livedot 1.4s ease-in-out infinite;
}
.live-card[data-state="connecting"] .live-pill i,
.live-card[data-state="error"] .live-pill i {
  background: #80878b;
  animation: none;
}
@keyframes livedot {
  50% {
    opacity: 0.35;
  }
}
.live-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.12);
  display: grid;
  place-items: center;
}
.live-close svg {
  width: 16px;
  height: 16px;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.live-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #0d1012;
  cursor: zoom-in;
}
.live-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.live-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.live-card[data-via="webrtc"] .live-video {
  opacity: 1;
}
.live-card[data-via="webrtc"] .live-img {
  display: none;
}
.live-card.full .live-video {
  object-fit: contain;
}
.live-q {
  padding: 3px 7px;
  border-radius: 6px;
  border: 1.5px solid rgb(255 255 255 / 0.5);
  font: 700 12px/1 var(--display);
  letter-spacing: 0.06em;
  color: rgb(255 255 255 / 0.85);
}
.live-q[hidden] {
  display: none;
}
.live-snap {
  filter: blur(4px) saturate(0.7) brightness(0.7);
  transform: scale(1.04);
  transition: opacity 0.4s ease;
}
.live-card[data-state="live"] .live-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.live-card[data-via="webrtc"] .live-video {
  opacity: 1;
}
.live-card[data-via="webrtc"] .live-img {
  display: none;
}
.live-card.full .live-video {
  object-fit: contain;
}
.live-q {
  padding: 3px 7px;
  border-radius: 6px;
  border: 1.5px solid rgb(255 255 255 / 0.5);
  font: 700 12px/1 var(--display);
  letter-spacing: 0.06em;
  color: rgb(255 255 255 / 0.85);
}
.live-q[hidden] {
  display: none;
}
.live-snap {
  opacity: 0;
}
.live-status {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgb(18 22 24 / 0.72);
  font: 500 14px/1 var(--text);
  transition: opacity 0.3s ease;
}
.live-card[data-state="live"] .live-status {
  opacity: 0;
}
.live-expand {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgb(18 22 24 / 0.6);
  display: grid;
  place-items: center;
}
.live-expand svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
}
/* fullscreen: the picture whole, the bar over it, out of the way until a tap */
.live-card.full {
  position: fixed;
  inset: 0;
  width: auto;
  padding: 0;
  border-radius: 0;
  background: #000;
  z-index: 50;
  animation: none;
  display: grid;
}
.live-card.full .live-frame {
  aspect-ratio: auto;
  height: 100%;
  border-radius: 0;
  cursor: default;
}
.live-card.full .live-frame img {
  object-fit: contain;
}
.live-card.full .live-expand {
  display: none;
}
.live-card.full .live-bar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  padding: calc(14px + env(safe-area-inset-top)) 18px 30px;
  background: linear-gradient(rgb(0 0 0 / 0.6), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.live-card.full.chrome .live-bar {
  opacity: 1;
  pointer-events: auto;
}
.live-card.full .live-bar h2 {
  font-size: 26px;
}
