/* =========================================================
   GRINGO • LIVE — tema neon azul/vermelho
   ========================================================= */
:root {
  --bg: #05060d;
  --ink: #eef3ff;
  --ink-dim: #9aa6c7;
  --blue: #1fa8ff;
  --cyan: #52e4ff;
  --violet: #8b3dff;
  --magenta: #ff2bd6;
  --red: #ff2a4d;
  --orange: #ff7a1a;
  --glass: rgba(9, 11, 26, 0.62);
  --line: rgba(120, 170, 255, 0.18);

  --gutter: clamp(16px, 12vw, 300px);
  --chat-w: clamp(300px, 23vw, 380px);
  --gap: 14px;
  --chrome: 290px; /* altura de tudo que não é o vídeo (header, barras, rodapé) */

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Rajdhani", system-ui, sans-serif;
  font-weight: 600;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
code { font-family: ui-monospace, monospace; color: var(--cyan); }

/* ---------------- Fundo ---------------- */
.bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.bg__art {
  position: absolute; inset: -40px;
  background: url("assets/gringo-wide.webp") center / cover no-repeat;
  /* desfoque estático: rasterizado uma vez e reaproveitado pela GPU */
  filter: blur(22px) saturate(1.5) brightness(0.42);
  transform: translateZ(0);
}
.bg__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(82, 228, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 228, 255, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 60%, #000 10%, transparent 75%);
}
.bg__scan {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.025) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.bg__vignette {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 0% 50%, rgba(31, 168, 255, 0.28), transparent 45%),
    radial-gradient(ellipse at 100% 50%, rgba(255, 42, 77, 0.28), transparent 45%),
    radial-gradient(ellipse at 50% 50%, transparent 30%, rgba(3, 4, 10, 0.85) 100%);
}

/* ---------------- Personagens ---------------- */
.crew { position: fixed; inset: 0; z-index: 1; pointer-events: none; }
.pig {
  position: absolute;
  top: var(--top);
  width: calc(var(--size) * clamp(120px, 13vw, 270px));
}
.pig--l { left: clamp(-40px, calc((var(--gutter) - 13vw * var(--size)) / 2), 40px); }
.pig--r { right: clamp(-40px, calc((var(--gutter) - 13vw * var(--size)) / 2), 40px); }
.pig::before {
  content: "";
  position: absolute; inset: 8%;
  border-radius: 50%;
  filter: blur(26px);
  opacity: 0.55;
}
.pig--l::before { background: var(--blue); }
.pig--r::before { background: var(--red); }
.pig__img {
  position: relative;
  width: 100%;
  background-repeat: no-repeat;
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 72%, transparent 100%);
  rotate: var(--tilt);
  will-change: transform;
  animation: float 7s ease-in-out infinite;
  animation-delay: var(--delay);
}
@keyframes float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -12px, 0); }
}

/* ---------------- Página ---------------- */
.page {
  position: relative; z-index: 2;
  min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center;
  padding: 10px var(--gutter) 12px;
}

/* Header */
.top {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.top__side { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Redes sociais */
.social {
  display: flex; gap: 6px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--glass);
}
.social__link {
  --c: var(--cyan);
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  color: var(--ink);
  transition: color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.social__link svg { width: 19px; height: 19px; }
.social__link:hover, .social__link:focus-visible {
  color: var(--c);
  background: color-mix(in srgb, var(--c) 16%, transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--c) 45%, transparent);
  transform: translateY(-2px);
  outline: none;
}
.social--instagram { --c: #ff4f9a; }
.social--twitch    { --c: #a970ff; }
.social--kick      { --c: #53fc18; }
.social--tiktok    { --c: #25f4ee; }
.social--discord   { --c: #7c87ff; }
.social--livepix   { --c: #ffb020; }
.top__side--right { justify-content: flex-end; }

.logo { margin: 0; position: relative; line-height: 0; }
.logo::before {
  content: "";
  position: absolute; inset: 18% 6%;
  background: linear-gradient(90deg, var(--blue), var(--violet), var(--red));
  filter: blur(34px);
  opacity: 0.55;
  will-change: opacity;
  animation: pulse 4s ease-in-out infinite;
}
.logo__art {
  position: relative;
  display: block;
  width: clamp(220px, 27vw, 460px);
  background-repeat: no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 52% 56% at 50% 50%, #000 62%, transparent 100%);
          mask-image: radial-gradient(ellipse 52% 56% at 50% 50%, #000 62%, transparent 100%);
  filter: drop-shadow(0 0 18px rgba(82, 228, 255, 0.35));
}
@keyframes pulse { 50% { opacity: 0.85; } }

/* Status */
.status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 12px;
  font-family: "Orbitron", sans-serif;
  font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
}
.status__dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink-dim);
}
.status[data-state="live"] { border-color: rgba(255, 42, 77, 0.6); box-shadow: 0 0 24px rgba(255, 42, 77, 0.35); }
.status[data-state="live"] .status__dot { background: var(--red); box-shadow: 0 0 0 0 var(--red); animation: ping 1.6s infinite; }
.status[data-state="loading"] .status__dot { background: var(--cyan); animation: blink 1s infinite; }
@keyframes ping { 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes blink { 50% { opacity: 0.2; } }

/* Botões */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  font-family: "Orbitron", sans-serif; font-size: 13px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  border-radius: 10px;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.btn svg { width: 18px; height: 18px; }
.btn--twitch {
  color: #fff;
  background: linear-gradient(135deg, var(--violet), #9146ff 50%, var(--magenta));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.15) inset, 0 8px 28px rgba(145, 70, 255, 0.45);
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.15); }
.btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

.icon-btn {
  display: grid; place-items: center;
  width: 30px; height: 30px;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover, .icon-btn[aria-pressed="true"] { color: var(--cyan); border-color: var(--cyan); background: rgba(82, 228, 255, 0.08); }

/* ---------------- Palco (vídeo + chat) ---------------- */
.stage {
  position: relative;
  margin-top: 8px;
  width: min(100%, 1680px, calc((100dvh - var(--chrome)) * 16 / 9 + var(--chat-w) + var(--gap) * 3));
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--chat-w);
  gap: var(--gap);
  padding: var(--gap);
  border-radius: 20px;
  background: rgba(7, 9, 22, 0.86);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(31, 168, 255, 0.12);
  contain: layout;
}
/* borda neon (estática: não repinta o palco a cada quadro) */
.stage::before {
  content: "";
  position: absolute; inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: linear-gradient(115deg, var(--blue), var(--cyan) 22%, var(--violet) 45%, var(--magenta) 62%, var(--red) 80%, var(--orange));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

/* cantos HUD */
.hud { position: absolute; width: 22px; height: 22px; border: 2px solid var(--cyan); pointer-events: none; filter: drop-shadow(0 0 6px var(--cyan)); }
.hud--tl { top: -7px; left: -7px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.hud--tr { top: -7px; right: -7px; border-left: 0; border-bottom: 0; border-top-right-radius: 6px; border-color: var(--red); filter: drop-shadow(0 0 6px var(--red)); }
.hud--bl { bottom: -7px; left: -7px; border-right: 0; border-top: 0; border-bottom-left-radius: 6px; }
.hud--br { bottom: -7px; right: -7px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; border-color: var(--red); filter: drop-shadow(0 0 6px var(--red)); }

.panel {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(3, 4, 12, 0.7);
  border: 1px solid var(--line);
}
.panel--video { border-color: rgba(31, 168, 255, 0.35); }
.panel--chat  { border-color: rgba(255, 42, 77, 0.35); }

.panel__bar {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(31,168,255,0.10), transparent 60%);
}
.panel--chat .panel__bar { background: linear-gradient(90deg, rgba(255,42,77,0.12), transparent 70%); }
.tag {
  font-family: "Orbitron", sans-serif; font-size: 11px; font-weight: 900; letter-spacing: 0.2em;
  color: var(--cyan);
}
.panel--chat .tag { color: var(--red); }
.panel__title {
  flex: 1; min-width: 0;
  font-size: 15px; color: var(--ink-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.panel__actions { display: flex; gap: 6px; }

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}
.player iframe, .player #twitchPlayer, .player #twitchPlayer iframe,
.chat iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
}
.chat { position: relative; flex: 1; min-height: 0; background: #0e0e10; }
.chat__hint {
  margin: 0;
  padding: 7px 12px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-dim);
  background: #0b0b0e;
  border-top: 1px solid var(--line);
}
.chat__hint a { color: var(--cyan); text-decoration: underline; text-underline-offset: 2px; }
.icon-btn--chat { color: var(--ink); border-color: rgba(255, 42, 77, 0.5); }
.icon-btn--chat:hover { color: #fff; border-color: var(--red); background: rgba(255, 42, 77, 0.15); }

.placeholder {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 14px;
  text-align: center; padding: 24px;
  color: var(--ink-dim); font-size: 17px;
  background: radial-gradient(ellipse at center, rgba(31,168,255,0.12), transparent 70%);
}
.placeholder p { margin: 0; }
.placeholder .err { color: var(--ink); line-height: 1.5; }
.loader {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid rgba(82, 228, 255, 0.15);
  border-top-color: var(--cyan);
  border-right-color: var(--red);
  animation: rot 0.9s linear infinite;
}
@keyframes rot { to { transform: rotate(360deg); } }

.icon-btn--wide { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; align-items: center; }
.icon-btn__label { font-family: "Orbitron", sans-serif; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; }
.icon-btn .i-off { display: none; }
body.theater .icon-btn .i-on { display: none; }
body.theater .icon-btn .i-off { display: block; }

/* Esconder chat */
body.nochat .stage { grid-template-columns: minmax(0, 1fr); width: min(100%, 1680px, calc((100dvh - var(--chrome)) * 16 / 9 + var(--gap) * 2)); }
body.nochat .panel--chat { display: none; }

/* Modo teatro: vídeo e chat ocupam a janela inteira */
body.theater { overflow: hidden; }
body.theater .bg,
body.theater .crew,
body.theater .top,
body.theater .foot,
body.theater .hud { display: none; }
body.theater .page { padding: 0; }
body.theater .stage,
body.theater.nochat .stage {
  width: 100vw; height: 100dvh;
  margin: 0; padding: 0; gap: 0;
  border-radius: 0;
  box-shadow: none;
  background: #000;
}
body.theater .stage::before { border-radius: 0; padding: 0 0 2px; }
body.theater .panel { border-radius: 0; border-width: 0; }
body.theater .panel--chat { border-left: 1px solid rgba(255, 42, 77, 0.35); }
body.theater .player { aspect-ratio: auto; flex: 1; min-height: 0; }

/* Rodapé */
.foot {
  width: 100%;
  margin-top: auto;
  padding-top: 12px;
  display: flex; align-items: center; gap: 14px;
  font-family: "Orbitron", sans-serif; font-size: 11px; letter-spacing: 0.22em;
  color: var(--ink-dim);
}
.foot b { color: var(--red); }
.foot__line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--blue), transparent 40%, transparent 60%, var(--red)); opacity: 0.6; }
.foot a:hover { color: var(--cyan); }

.noscript { position: fixed; inset: auto 0 0; z-index: 9; margin: 0; padding: 12px; text-align: center; background: var(--red); }

/* ---------------- Responsivo ---------------- */
@media (max-width: 1180px) {
  :root { --gutter: clamp(16px, 7vw, 120px); }
  .pig { opacity: 0.55; }
}

@media (max-width: 900px) {
  :root { --gutter: 16px; --gap: 10px; }
  .bg__art { background-image: url("assets/gringo-tall.webp"); }
  .crew { display: none; }
  .top { grid-template-columns: 1fr 1fr; row-gap: 10px; }
  .logo { grid-column: 1 / -1; grid-row: 1; justify-self: center; }
  .logo__art { width: min(78vw, 380px); }
  .top__side--left { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .top__side--right { grid-column: 1 / -1; grid-row: 3; justify-content: center; }
  .social__link { width: 40px; height: 40px; }
  body.theater .stage { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  body.theater .panel--chat { height: auto; min-height: 0; border-left: 0; border-top: 1px solid rgba(255, 42, 77, 0.35); }
  body.theater .player { aspect-ratio: 16 / 9; flex: none; }
  body.theater.nochat .stage { grid-template-rows: 1fr; }
  body.theater.nochat .player { aspect-ratio: auto; flex: 1; }
  .stage { width: 100%; grid-template-columns: 1fr; }
  .panel--chat { height: 62dvh; min-height: 380px; }
  .hud { display: none; }
  .btn { padding: 9px 14px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
