:root {
  --bg: #f3f6fc;
  --panel: #ffffff;
  --elev: #ffffff;
  --border: #dfe6f2;
  --text: #101a2e;
  --muted: #5d6a85;
  --faint: #93a0b8;
  --blue: #2f7cff;
  --blue2: #22c9ee;
  --online: #19b96f;
  --danger: #ef4444;
  --r: 18px;
  --sombra: 0 10px 30px rgba(23, 43, 99, 0.10);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  /* fonte do sistema: zero download, pinta instantaneo em qualquer aparelho */
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background:
    radial-gradient(1100px 600px at 15% -10%, rgba(47, 124, 255, 0.08), transparent 60%),
    radial-gradient(900px 500px at 95% 110%, rgba(34, 201, 238, 0.07), transparent 60%),
    var(--bg);
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ============================== Topbar ============================== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo-badge {
  width: 34px; height: 34px; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  box-shadow: 0 6px 16px rgba(47, 124, 255, 0.35);
}
.brand-name { font-size: 20px; font-weight: 900; letter-spacing: -0.5px; }
.beta {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  color: #0e93b8; border: 1px solid rgba(34, 201, 238, 0.5);
  background: rgba(34, 201, 238, 0.08);
  padding: 3px 8px; border-radius: 999px; margin-left: 2px;
}

.pills { display: flex; gap: 8px; }
.pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; color: var(--muted);
  box-shadow: 0 2px 8px rgba(23, 43, 99, 0.06);
}
.pill b { color: var(--text); }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--online); box-shadow: 0 0 8px rgba(25, 185, 111, 0.7);
  animation: pulse 2.2s ease-in-out infinite;
}

/* ============================== Stage ============================== */
.stage {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 12px;
  padding: 0 14px;
  min-height: 0;
  position: relative;
}

.panel {
  position: relative;
  background: #0d1524; /* atras do video continua escuro: video em fundo claro fica feio */
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  min-height: 0;
  box-shadow: var(--sombra);
}
.panel video {
  width: 100%; height: 100%;
  object-fit: cover; display: block; background: #0d1524;
}
#local { transform: scaleX(-1); }

.tag {
  position: absolute; top: 12px; left: 12px; z-index: 4;
  display: flex; align-items: center; gap: 7px;
  background: rgba(255, 255, 255, 0.92); border: 1px solid rgba(16, 26, 46, 0.08);
  padding: 6px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: var(--text);
}
.tag[hidden] { display: none; }
.tag-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--online); }

.status-chip {
  position: absolute; top: 12px; right: 12px; z-index: 4;
  background: rgba(255, 255, 255, 0.92); border: 1px solid rgba(16, 26, 46, 0.08);
  padding: 6px 12px; border-radius: 999px; font-size: 12px; color: var(--muted);
}
.status-chip[hidden] { display: none; }

.local-off {
  position: absolute; inset: 0; z-index: 3;
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  font-size: 13px; color: #8fa0bd; background: #0d1524;
}
.local-panel.off .local-off { display: flex; }
.local-panel.off #local { visibility: hidden; }

/* ============================== Chat flutuante ============================== */
.chat-float {
  position: absolute; left: 12px; bottom: 12px; z-index: 4;
  width: min(380px, 72%);
  max-height: 46%;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
  padding-top: 26px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 26px);
  mask-image: linear-gradient(to bottom, transparent 0, #000 26px);
  scrollbar-width: none;
}
.chat-float::-webkit-scrollbar { display: none; }

.msg {
  width: fit-content; max-width: 92%;
  padding: 8px 13px; border-radius: 14px;
  font-size: 14px; line-height: 1.35; word-wrap: break-word;
  animation: msg-in 0.18s ease-out;
}
.msg.them {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  border-bottom-left-radius: 5px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.msg.me {
  align-self: flex-end;
  background: linear-gradient(135deg, #3b86ff, #2568e8);
  border-bottom-right-radius: 5px;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.msg.sys {
  align-self: flex-start;
  background: transparent; padding: 2px 4px;
  color: rgba(255, 255, 255, 0.9); font-size: 12px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
}

.typing {
  position: absolute; left: 12px; bottom: 12px; z-index: 5;
  display: flex; align-items: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 7px 12px; border-radius: 999px;
  font-size: 12px; color: var(--muted);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.typing[hidden] { display: none; }
/* quando o "digitando" aparece, o app.js sobe o chat-float pra 52px */
.typing span {
  width: 5px; height: 5px; border-radius: 50%; background: var(--blue);
  margin-right: 3px; animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.2s; }
.typing span:nth-child(3) { animation-delay: 0.4s; }

/* ============================== Overlay ============================== */
.overlay {
  position: absolute; inset: 0; z-index: 6;
  display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 24px;
  background:
    radial-gradient(640px 420px at 50% 28%, rgba(47, 124, 255, 0.07), transparent 65%),
    rgba(247, 249, 253, 0.97);
}
.overlay[hidden], .overlay-inner[hidden] { display: none; }

.hero-logo {
  width: 84px; height: 84px; margin: 0 auto 24px;
  border-radius: 26px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  box-shadow: 0 14px 40px rgba(47, 124, 255, 0.35);
  animation: float 4s ease-in-out infinite;
}
.hero-logo svg { animation: spin-slow 18s linear infinite; }
.overlay h1 { font-size: clamp(26px, 3.4vw, 40px); font-weight: 900; letter-spacing: -1px; line-height: 1.08; margin-bottom: 14px; color: var(--text); }
.grad {
  background: linear-gradient(90deg, var(--blue), var(--blue2));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.overlay p { color: var(--muted); font-size: 15px; margin-bottom: 26px; max-width: 400px; margin-left: auto; margin-right: auto; }
.overlay .hint { font-size: 12px; color: var(--faint); margin-top: 18px; margin-bottom: 0; }

.age-gate {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  max-width: 420px; margin: 0 auto 20px;
  background: #fff; border: 1px solid var(--border);
  padding: 12px 14px; border-radius: 12px; cursor: pointer;
  font-size: 12.5px; color: var(--muted); line-height: 1.45;
  box-shadow: 0 2px 10px rgba(23, 43, 99, 0.06);
}
.age-gate b { color: var(--text); }
.age-gate input {
  margin-top: 2px; width: 16px; height: 16px; flex: 0 0 auto;
  accent-color: var(--blue); cursor: pointer;
}

.btn-start:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; transform: none; }

.btn-start {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: inherit; font-size: 17px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--blue), #1e63e0);
  border: none; border-radius: 16px; padding: 16px 46px; cursor: pointer;
  box-shadow: 0 12px 30px rgba(47, 124, 255, 0.35);
  transition: transform 0.14s, box-shadow 0.2s, filter 0.2s;
}
.btn-start:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.07); box-shadow: 0 16px 36px rgba(47, 124, 255, 0.45); }
.btn-start:active:not(:disabled) { transform: scale(0.97); }

/* radar de busca */
.radar { position: relative; width: 130px; height: 130px; margin: 0 auto 22px; display: grid; place-items: center; }
.radar .core {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue2));
  box-shadow: 0 10px 26px rgba(47, 124, 255, 0.35); z-index: 1;
}
.radar .core svg { animation: spin-fast 2.6s linear infinite; }
.radar .ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid rgba(47, 124, 255, 0.5);
  animation: radar 2.1s ease-out infinite;
}
.radar .r2 { animation-delay: 0.7s; }
.radar .r3 { animation-delay: 1.4s; }
.searching-txt { font-size: 17px; font-weight: 800; margin-bottom: 6px !important; color: var(--text) !important; }
.searching-sub { font-size: 13px !important; color: var(--faint) !important; margin-bottom: 0 !important; }

/* ============================== Controls ============================== */
.controls {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 16px;
  max-width: 1200px; width: 100%; margin: 0 auto;
}

.ctl {
  flex: 0 0 auto;
  width: 48px; height: 48px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  cursor: pointer; transition: transform 0.12s, background 0.2s, border-color 0.2s;
  box-shadow: 0 2px 8px rgba(23, 43, 99, 0.06);
}
.ctl:hover { border-color: #b9c8e6; background: #f6f9ff; }
.ctl:active { transform: scale(0.94); }
.ctl:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.ctl.stop { color: var(--danger); }
.ctl.stop:hover { border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.07); }
.ctl.off { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.5); color: var(--danger); }
.ctl.send { background: var(--blue); border-color: var(--blue); color: #fff; }
.ctl.send:hover { filter: brightness(1.1); background: var(--blue); }
.ctl.report { color: #d97706; }
.ctl.report:hover { border-color: rgba(217, 119, 6, 0.5); background: rgba(245, 158, 11, 0.08); }
.ctl.report.armed {
  background: var(--danger); border-color: var(--danger); color: #fff;
  animation: pulse 0.8s ease-in-out infinite;
}

.chatbar { flex: 1; display: flex; gap: 8px; min-width: 0; }
.chatbar input {
  flex: 1; min-width: 0;
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 16px; color: var(--text); font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.2s;
  box-shadow: 0 2px 8px rgba(23, 43, 99, 0.06);
}
.chatbar input::placeholder { color: var(--faint); }
.chatbar input:focus { border-color: var(--blue); }
.chatbar input:disabled { opacity: 0.5; }

.btn-next {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 9px;
  font-family: inherit; font-size: 16px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--blue), #1e63e0);
  border: none; border-radius: 14px; padding: 13px 30px; cursor: pointer;
  box-shadow: 0 8px 22px rgba(47, 124, 255, 0.32);
  transition: transform 0.12s, filter 0.2s, opacity 0.2s;
}
.btn-next:hover:not(:disabled) { filter: brightness(1.08); }
.btn-next:active:not(:disabled) { transform: scale(0.96); }
.btn-next:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }

/* ============================== Animações ============================== */
@keyframes radar { 0% { transform: scale(0.55); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes blink { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes spin-fast { to { transform: rotate(360deg); } }

/* respeita quem pediu menos animação no sistema */
@media (prefers-reduced-motion: reduce) {
  .hero-logo, .hero-logo svg, .radar .core svg, .radar .ring, .dot { animation: none; }
}

/* ============================== Mobile ============================== */
@media (max-width: 860px) {
  .stage { grid-template-columns: 1fr; }

  /* local vira PiP dentro do stage, estilo OmeTV mobile */
  .local-panel {
    position: absolute; top: 10px; right: 22px; z-index: 7;
    width: 108px; aspect-ratio: 3 / 4;
    border-radius: 14px;
    border: 2px solid #fff;
    box-shadow: 0 10px 24px rgba(23, 43, 99, 0.35);
  }
  .tag-you { display: none; }
  .local-off span { display: none; }

  .chat-float { width: 78%; max-height: 38%; }

  .controls { flex-wrap: wrap; }
  .chatbar { order: 5; flex-basis: 100%; }
  .btn-next { flex: 1; justify-content: center; padding: 13px 18px; }
  .overlay h1 br { display: none; }
}
