/* WinsVue Screen — tema WinsVue (navy, índigo e azul da logo) */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #020814;
  --bg-2: #050c22;
  --navy: #000916;
  --indigo: #1b1a66;
  --indigo-2: #2a28a0;
  --surface: rgba(86, 143, 254, .04);
  --surface-2: rgba(86, 143, 254, .085);
  --line: rgba(180, 200, 255, .09);
  --line-2: rgba(180, 200, 255, .18);
  --text: #eef2ff;
  --text-2: #97a2c8;
  --text-3: #5c6690;

  --blue: #568ffe;
  --blue-soft: #8fb3ff;
  --brand: linear-gradient(120deg, #3d6fe8 0%, #568ffe 55%, #7fa8ff 100%);
  --brand-glow: rgba(86, 143, 254, .45);
  --on-brand: #000916;

  --live: #ff4d5e;
  --danger: #f04452;
  --danger-2: #b91c2c;

  --r-lg: 20px;
  --r: 14px;
  --r-sm: 10px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --font-display: "Chakra Petch", "Inter", system-ui, sans-serif;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(86, 143, 254, .18); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Marca: símbolo W + WINS [VUE] Screen ---------- */

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1;
}

.brand-mark {
  height: 22px;
  width: auto;
  flex: none;
  filter: drop-shadow(0 2px 10px rgba(86, 143, 254, .35));
}

.brand-name { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.brand-name b { font-weight: 700; font-style: italic; letter-spacing: .4px; font-size: 1.08em; }

.brand-tag {
  font-style: normal;
  font-weight: 700;
  font-size: .6em;
  letter-spacing: .6px;
  padding: 3px 6px 2px 8px;
  color: var(--on-brand);
  background: var(--blue);
  border-radius: 0 3px 3px 3px;
  clip-path: polygon(5px 0, 100% 0, 100% 100%, 0 100%, 0 5px);
}

.brand-product {
  margin-left: 3px;
  font-family: var(--font);
  font-weight: 500;
  font-size: .76em;
  color: var(--text-2);
}

.brand-lg { font-size: 30px; gap: 14px; }
.brand-lg .brand-mark { height: 38px; }

/* ---------- Lobby ---------- */

#lobby {
  position: relative;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 56px 20px 28px;
  isolation: isolate;
}

/* Fundo índigo com faixas de luz, no clima da vinheta WinsVue */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 75% at 65% 40%, #1d1c70 0%, #131254 38%, #080b2c 72%, var(--bg) 100%);
}

.streak {
  position: absolute;
  border-radius: 50%;
  filter: blur(42px);
  mix-blend-mode: screen;
}
.streak.s1 {
  width: 75vmax; height: 16vmax;
  right: -18vmax; top: 8%;
  background: linear-gradient(90deg, transparent, rgba(86, 143, 254, .38), transparent);
  transform: rotate(-28deg);
  animation: drift 18s ease-in-out infinite alternate;
}
.streak.s2 {
  width: 62vmax; height: 12vmax;
  right: -12vmax; top: 46%;
  background: linear-gradient(90deg, transparent, rgba(124, 112, 255, .32), transparent);
  transform: rotate(-36deg);
  animation: drift 23s ease-in-out infinite alternate-reverse;
}
.streak.s3 {
  width: 55vmax; height: 34vmax;
  left: -18vmax; bottom: -12vmax;
  background: radial-gradient(closest-side, rgba(42, 40, 160, .55), transparent);
}

@keyframes drift {
  from { translate: 0 0; }
  to   { translate: -4vmax 3vmax; }
}

/* Triângulos da logo, bem apagados */
.tri {
  position: absolute;
  aspect-ratio: 1.15;
  background: var(--blue);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.tri.t1 { width: 26vmax; left: -6vmax; bottom: -4vmax; opacity: .06; }
.tri.t2 { width: 9vmax; right: 7vmax; top: 9vh; opacity: .1; }

.lobby-inner {
  width: 100%;
  max-width: 460px;
  margin: auto 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.tag {
  margin-top: 30px;
  padding: 5px 11px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: var(--blue);
  background: rgba(86, 143, 254, .08);
  border: 1px solid rgba(86, 143, 254, .22);
}

h1 {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: clamp(34px, 7vw, 46px);
  line-height: 1.04;
  letter-spacing: -1.2px;
  font-weight: 800;
}

h1 .hl {
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  margin-top: 14px;
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.6;
}

.lobby-card {
  width: 100%;
  margin-top: 28px;
  padding: 22px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, rgba(14, 20, 58, .78), rgba(6, 10, 32, .82));
  border: 1px solid var(--line);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }

.field input {
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line);
  font-size: 15px;
  transition: border-color .15s, box-shadow .15s;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus { outline: none; border-color: rgba(86, 143, 254, .55); box-shadow: 0 0 0 4px rgba(86, 143, 254, .14); }

#codeInput {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 6px;
  text-transform: uppercase;
}
#codeInput::placeholder { letter-spacing: 2px; font-size: 15px; font-weight: 500; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  gap: 4px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line);
}
.tab {
  padding: 9px 8px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  transition: background .15s, color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  transition: transform .12s, filter .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .6; cursor: progress; }

.btn-primary {
  color: var(--on-brand);
  background: var(--brand);
  box-shadow: 0 10px 30px -10px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 14px 36px -10px var(--brand-glow), inset 0 1px 0 rgba(255, 255, 255, .35); }

.btn-soft {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  padding: 11px 16px;
  font-size: 14px;
}
.btn-soft:hover { background: rgba(86, 143, 254, .12); }

.perks {
  list-style: none;
  width: 100%;
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.perks li {
  padding: 12px;
  border-radius: var(--r);
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.perks b { font-family: var(--font-display); font-size: 16px; color: var(--blue-soft); }
.perks span { font-size: 12px; color: var(--text-2); }

.lobby-foot { margin-top: 28px; font-size: 12.5px; color: var(--text-3); text-align: center; }

/* ---------- Sala ---------- */

#room {
  height: 100%;
  display: grid;
  grid-template-columns: 272px 1fr;
  background:
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(86, 143, 254, .08), transparent 70%),
    var(--bg);
}

#panel {
  border-right: 1px solid var(--line);
  background: rgba(4, 9, 26, .78);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
}

.invite {
  padding: 14px;
  border-radius: var(--r);
  background: linear-gradient(160deg, rgba(86, 143, 254, .12), rgba(86, 143, 254, .04));
  border: 1px solid rgba(86, 143, 254, .2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.invite-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--text-2); }
.invite-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  margin: 0 -10px;
  border-radius: var(--r-sm);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 5px;
  color: var(--text);
  transition: background .15s;
}
.invite-code svg { color: var(--blue); opacity: .8; }
.invite-code:hover { background: rgba(0, 0, 0, .25); }
.invite-hint { font-size: 11.5px; color: var(--text-3); }

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-2);
}
.pill {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 11.5px;
  text-align: center;
  color: var(--on-brand);
  background: var(--brand);
}

#people {
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: -8px -6px 0;
  padding: 0 6px;
}

.person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  transition: background .15s;
}
.person:hover { background: var(--surface); }
.person-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-name small { color: var(--text-3); font-weight: 500; margin-left: 4px; }
.person-badges { display: flex; gap: 4px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--blue-soft);
}
.badge svg { width: 13px; height: 13px; }
.badge.live { background: rgba(255, 77, 94, .14); color: #ff8a95; }
button.badge { cursor: pointer; }
button.badge.live:hover { background: rgba(255, 77, 94, .24); }

.avatar {
  --size: 34px;
  width: var(--size);
  height: var(--size);
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: calc(var(--size) * .42);
  color: var(--on-brand);
}

/* ---------- Palco ---------- */

#main {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#mobileBar { display: none; }

#stage {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 18px 18px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#focus {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  grid-auto-rows: minmax(0, 1fr);
}

#rail {
  flex: none;
  height: 128px;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  transition: height .2s, opacity .2s;
}
#rail:empty { display: none; }
#rail .tile { width: 208px; flex: none; }
#stage.rail-hidden #rail { height: 0; opacity: 0; overflow: hidden; }

#railToggle {
  display: none;
  align-self: center;
  margin: -4px 0;
  padding: 2px 12px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--line);
  align-items: center;
  gap: 4px;
}
#railToggle svg { width: 16px; height: 16px; }
#railToggle:hover { color: var(--text); background: var(--surface-2); }
#stage.has-rail #railToggle { display: inline-flex; }

.tile {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: var(--r);
  overflow: hidden;
  background: #060c24;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.tile:hover { border-color: var(--line-2); }
.tile.is-screen { background: #000; }

.tile video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}
.tile.is-cam video { object-fit: cover; }
.tile.mirror video { transform: scaleX(-1); }
.tile:not(.has-video) video { display: none; }

.tile-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(86, 143, 254, .1), transparent 60%),
    #060c24;
}
.tile.has-video .tile-placeholder { display: none; }
.tile-placeholder .avatar { --size: clamp(44px, 22%, 96px); }

.tile-label {
  position: absolute;
  left: 10px;
  bottom: 10px;
  max-width: calc(100% - 20px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  background: rgba(2, 6, 22, .74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tile-label .live-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 3px rgba(255, 77, 94, .25);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(255, 77, 94, 0); } }

.tile-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity .15s;
}
.tile:hover .tile-actions, .tile:focus-within .tile-actions { opacity: 1; }
.tile-btn {
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(2, 6, 22, .74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.tile-btn svg { width: 18px; height: 18px; }
.tile-btn:hover { background: rgba(86, 143, 254, .35); }

#rail .tile-label { font-size: 11.5px; left: 7px; bottom: 7px; padding: 3px 7px; }
#rail .tile-actions { display: none; }

.tile:fullscreen { border: 0; border-radius: 0; }
.tile:fullscreen video { object-fit: contain; }

.tap-sound {
  position: absolute;
  top: 10px; left: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--on-brand);
  background: var(--blue);
}

/* Palco vazio */
.empty-stage {
  grid-column: 1 / -1;
  border-radius: var(--r-lg);
  border: 1px dashed var(--line-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 24px;
  background:
    radial-gradient(ellipse 50% 60% at 50% 100%, rgba(86, 143, 254, .1), transparent 70%);
}
.empty-stage .empty-icon {
  width: 64px; height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--blue);
  background: rgba(86, 143, 254, .08);
  border: 1px solid rgba(86, 143, 254, .2);
  margin-bottom: 4px;
}
.empty-stage .empty-icon svg { width: 30px; height: 30px; }
.empty-stage h2 { font-family: var(--font-display); font-size: 22px; letter-spacing: -.4px; }
.empty-stage p { max-width: 380px; color: var(--text-2); font-size: 14px; line-height: 1.55; }
.empty-actions { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.empty-actions .btn { padding: 11px 16px; font-size: 14px; }

/* ---------- Dock de controles ---------- */

#dock {
  align-self: center;
  margin: 14px 0 18px;
  padding: 8px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(8, 14, 40, .86);
  border: 1px solid var(--line);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.dock-btn {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--text);
  transition: background .15s, transform .1s, box-shadow .15s;
}
.dock-btn svg { width: 24px; height: 24px; }
.dock-btn:hover { background: rgba(86, 143, 254, .14); }
.dock-btn:active { transform: scale(.95); }
.dock-btn:disabled { opacity: .35; cursor: not-allowed; }

.dock-btn.on {
  color: var(--on-brand);
  background: var(--brand);
  box-shadow: 0 8px 24px -8px var(--brand-glow);
}
.dock-btn.muted { color: #ffb3ba; background: rgba(240, 68, 82, .16); }
.dock-btn.leave { width: 64px; color: #fff; background: var(--danger); }
.dock-btn.leave:hover { background: var(--danger-2); }

.dock-sep { width: 1px; height: 30px; background: var(--line-2); margin: 0 2px; }

.dock-btn::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, 4px);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text);
  background: #0c163a;
  border: 1px solid var(--line-2);
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s, transform .12s;
}
.dock-btn:hover::after { opacity: 1; transform: translate(-50%, 0); }
.dock-btn[aria-expanded="true"]::after { display: none; }

.dock-btn-tag {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 1px 4px;
  border-radius: 5px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--blue-soft);
  background: rgba(0, 9, 22, .75);
  pointer-events: none;
}
.dock-btn.on .dock-btn-tag { color: var(--on-brand); background: rgba(255, 255, 255, .45); }

/* ---------- Menu de qualidade ---------- */

#dock { position: relative; }

#qualityMenu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(320px, calc(100vw - 32px));
  padding: 6px;
  border-radius: var(--r);
  background: #0a1233;
  border: 1px solid var(--line-2);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .95);
  animation: toast-in .16s ease-out;
}
.quality-head {
  padding: 8px 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.quality-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  text-align: left;
}
.quality-item:hover, .quality-item:focus-visible { background: var(--surface-2); }
.quality-check { width: 18px; height: 18px; flex: none; color: var(--blue); visibility: hidden; }
.quality-check svg { width: 18px; height: 18px; }
.quality-item[aria-checked="true"] .quality-check { visibility: visible; }
.quality-item[aria-checked="true"] b { color: var(--blue-soft); }
.quality-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.quality-text b { font-size: 14px; font-weight: 600; }
.quality-text small { font-size: 12px; color: var(--text-2); }

/* ---------- Toasts ---------- */

#toasts {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
}
.toast {
  max-width: 420px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  background: #0b1438;
  border: 1px solid rgba(86, 143, 254, .28);
  box-shadow: 0 14px 40px -12px rgba(0, 0, 0, .8);
  animation: toast-in .22s ease-out;
}
.toast.error { background: #2a0d12; border-color: rgba(240, 68, 82, .45); }
.toast.leaving { animation: toast-out .2s ease-in forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- Responsivo ---------- */

@media (max-width: 820px) {
  #room { grid-template-columns: 1fr; }
  #panel { display: none; }

  #mobileBar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }
  .invite-chip {
    padding: 6px 12px;
    border-radius: 99px;
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: 3px;
    background: var(--surface-2);
    border: 1px solid rgba(86, 143, 254, .25);
  }

  #stage { padding: 12px 12px 0; }
  #rail { height: 96px; }
  #rail .tile { width: 150px; }
  #dock { margin: 10px 0 14px; gap: 6px; }
  .dock-btn { width: 48px; height: 48px; }
  .dock-btn::after { display: none; }
  .tile-actions { opacity: 1; }
}

@media (max-width: 420px) {
  .perks { grid-template-columns: 1fr; }
  #lobby { padding-top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
