/* overlay.css — transparente: va encima del video (Twitch) o en OBS. */

/* Geist (Vercel, OFL: fonts/OFL-Geist.txt), incluida en el zip */
@font-face {
  font-family: "Geist";
  src: url("fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Iconos SVG (icons.js) */
.i { width: 1.1em; height: 1.1em; flex: none; fill: currentColor; vertical-align: -0.18em; }

:root {
  --lob: rgb(230, 57, 70);
  color-scheme: light dark;
}

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
  font: 600 16px/1.3 "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ?bg=1 simula un video detras (para probar en local). */
body.fake-video {
  background:
    radial-gradient(circle at 30% 40%, #3a4a6b 0, transparent 50%),
    radial-gradient(circle at 75% 70%, #5b3a55 0, transparent 45%),
    linear-gradient(135deg, #1c2233, #2b2034);
}

[hidden] { display: none !important; }

/* ---------------- Langosta ---------------- */

.lobster-pos {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  /* left/top y el transform de .lobster-body los anima overlay.js (easing) */
  z-index: 3;
  pointer-events: none;
}

.lobster-body {
  width: clamp(80px, 16vmin, 220px);
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45));
}

/* "appear" dura solo lo que la animacion de entrada: overlay.js la quita
   en animationend. Si se quedara, esta regla (mas especifica) taparia
   para siempre a otras animaciones. */
.lobster-pos.appear .lobster-art { animation: pop-in 350ms cubic-bezier(0.3, 1.6, 0.5, 1); }

/* La imagen de la pose (public/assets/poses). set_color la tine con una
   capa de color recortada con la forma de la imagen (mask) y mezclada en
   modo "color": conserva luces y sombras. */
.lobster-img-wrap { position: relative; isolation: isolate; }
.lobster-img { display: block; width: 100%; height: auto; }
.lobster-tint {
  position: absolute;
  inset: 0;
  background: var(--lob);
  mix-blend-mode: color;
  -webkit-mask: var(--pose-img) center / 100% 100% no-repeat;
  mask: var(--pose-img) center / 100% 100% no-repeat;
  transition: background 300ms;
}

/* El temblor (shake_lobster) lo dibuja overlay.js cuadro a cuadro. */

@keyframes pop-in { from { transform: scale(0.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------- Globo de dialogo ---------------- */

/* top/left los pone overlay.js (placeBubble): encima de la langosta segun
   su tamano y giro actuales, o debajo si arriba no entra. */
.bubble {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  z-index: 1; /* sobre la langosta, por si igual se tocan */
  transform: translateX(-50%);
  width: max-content;
  max-width: min(340px, 40vw);
  /* Globo de comic: capa gris claro (--edge, el borde) con la capa blanca
     (.bubble-text) adentro. Asi el borde de la capa blanca se mezcla con
     el gris y no queda ninguna rayita oscura (con border, o con capas de
     fondo, el antialias dejaba ver el stream entre el blanco y el borde). */
  --ink: #10233a;
  --edge: #e6eaef; /* borde casi blanco, apenas gris */
  --stroke: 2px; /* grosor del borde */
  padding: var(--stroke);
  border-radius: 1.2em;
  background: var(--edge);
  color: var(--ink);
  font-size: clamp(14px, 2.3vmin, 24px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-align: center;
  overflow-wrap: anywhere;
  box-shadow: 0 4px 0 rgba(16, 35, 58, 0.16), 0 12px 24px rgba(0, 0, 0, 0.35);
}
.bubble-text {
  display: block;
  padding: 0.5em 0.95em 0.55em;
  border-radius: calc(1.2em - var(--stroke));
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255, 255, 255, 0.95), transparent 60%),
    linear-gradient(180deg, #ffffff, #eef5ff);
}
/* Colita con borde: ::before es el borde (gris claro) y ::after el relleno
   (blanco), que tapa el borde del globo donde se unen. --tail-x la corre
   para que siga apuntando a la langosta (overlay.js). */
.bubble::before,
.bubble::after {
  content: "";
  position: absolute;
  left: calc(50% + var(--tail-x, 0px));
  border-style: solid;
  border-color: transparent;
}
.bubble::before { top: calc(100% - 1px); margin-left: -11px; border-width: 12px 11px 0; border-top-color: var(--edge); }
.bubble::after { top: calc(100% - 3px); margin-left: -10px; border-width: 11px 10px 0; border-top-color: #eef5ff; }
.bubble.below::before { top: auto; bottom: calc(100% - 1px); border-width: 0 11px 12px; border-bottom-color: var(--edge); }
.bubble.below::after { top: auto; bottom: calc(100% - 3px); margin-left: -10px; border-width: 0 10px 11px; border-bottom-color: #fff; }

/* ---------------- Efecto de fondo (public/assets/effects) ---------------- */

.fx-custom {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.fx-custom img, .fx-custom video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* cubre toda la pantalla, recortando si hace falta */
  display: block;
}

/* ---------------- Estado de la ronda ---------------- */

/* Tarjeta "con pasos": titulo grande de la fase, tiempo, barra que se
   vacia y una instruccion para el chat. El color cambia con la fase
   (los mismos de styles.css). */
.status {
  --ph: #2ec4b6;
  position: absolute;
  top: 1.6vmin;
  right: 1.6vmin;
  z-index: 20; /* encima de todas las langostas */
  width: clamp(220px, 30vmin, 420px);
  padding: 1.2vmin 1.5vmin 1.3vmin;
  border-radius: 1.6vmin;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 0.6vmin solid var(--ph);
  background:
    linear-gradient(100deg, color-mix(in srgb, var(--ph) 22%, transparent), transparent 65%),
    rgba(6, 18, 31, 0.86);
  color: #eaf4ff;
  font-size: clamp(11px, 1.7vmin, 22px);
  box-shadow: 0 1vmin 3vmin rgba(0, 0, 0, 0.45), 0 0 2.4vmin color-mix(in srgb, var(--ph) 30%, transparent);
  backdrop-filter: blur(6px);
  transition: border-color 400ms, box-shadow 400ms, transform 350ms cubic-bezier(0.3, 1.5, 0.5, 1), opacity 300ms;
}
.status[data-phase="voting"] { --ph: #ffc857; }
.status[data-phase="executing"] { --ph: #ff6b4a; }
/* Entrada al cambiar de fase (si hay animaciones) */
.status.enter { transform: scale(0.92) translateY(-0.6vmin); opacity: 0.4; }
.status-line { display: flex; gap: 0.8em; align-items: center; }
.status-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 1.4em;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
.status-timer {
  margin-left: auto;
  font-family: "Geist Mono", ui-monospace, Consolas, monospace;
  font-weight: 700;
  font-size: 1.25em;
  font-variant-numeric: tabular-nums;
  color: var(--ph);
}
.status-bar {
  position: relative;
  height: 0.45em;
  margin: 0.55em 0 0.6em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.status-bar > span {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--ph);
  transform-origin: left;
  transform: scaleX(var(--left, 1));
  transition: transform 1s linear;
}
.status-sub { display: flex; flex-wrap: wrap; gap: 0.3em 0.6em; align-items: center; font-weight: 600; color: #cfe2f3; overflow-wrap: anywhere; line-height: 1.3; }
.status-count {
  padding: 0.1em 0.55em;
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 800;
  color: #06121f;
  background: var(--ph);
}
.status-count:empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  .status, .status-bar > span { transition: none; }
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 12%;
  translate: -50% 0; /* aparte de transform, que lo usa la animacion pop-in */
  z-index: 5;
  max-width: 80vw;
  padding: 12px 18px;
  border-radius: 12px;
  background: #fff3c4;
  color: #3b2a00;
  font-size: clamp(14px, 2.6vmin, 26px);
  text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  animation: pop-in 300ms cubic-bezier(0.3, 1.6, 0.5, 1);
}

.sound-btn {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 6;
  font: inherit;
  font-size: 13px;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: rgba(14, 14, 16, 0.8);
  color: #fff;
  cursor: pointer;
}


/* Iconos dentro de la tarjeta y del boton de sonido */
.status-title .i { color: var(--ph); }
.status-sub .i { color: var(--ph); }
.sound-btn { display: inline-flex; align-items: center; gap: 6px; }

/* ================================================================
   Tema oscuro tipo Google: la tarjeta de la fase gris y plana, con los
   mismos colores por fase que styles.css.
   ================================================================ */
/* Overlay de OBS: tarjeta de la fase gris Google, plana */
html:root .status {
  --ph: #8ab4f8;
  background: rgba(32, 33, 36, 0.94);
  color: #e8eaed;
  border-color: #3c4043;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 8px 3px rgba(0, 0, 0, 0.25);
  backdrop-filter: none;
}
html:root .status[data-phase="voting"] { --ph: #fdd663; }
html:root .status[data-phase="executing"] { --ph: #81c995; }
html:root .status-title { text-shadow: none; }
html:root .status-sub { color: #9aa0a6; }
html:root .status-count { color: #202124; }
html:root .status-bar { background: #3c4043; }
html:root .sound-btn { background: #303134; color: #e8eaed; }
