/* layout base */
:root {
  --bg: #000000;
  --panel-bg: #171717;
  --header-bg: #0d4f1d;
  --text: #ffffff;
  --muted: #bfbfbf;
  --input-bg: #ffffff;
  --input-text: #000000;
  --btn-bg: #3a3a3a;
  --btn-text: #ffffff;
  --shadow: rgba(0,0,0,0.6);
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  background: #000;
}

body { overflow: hidden; }

/* área do jogo (preenche 100%) */
#game {
  position: fixed;
  inset: 0;
  background: #000;
}

#videoCanvas,
#game canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;   /* nitidez pra pixel-art */
  image-rendering: crisp-edges; /* compat extra (ignorado onde não existir) */
}

/* painéis */
.panel { display: none; width: 100%; height: 100%; }
.panel.active { display: flex; align-items: center; justify-content: center; }

/* cartão de conexão */
.card {
  width: min(480px, 92vw);
  background: var(--panel-bg);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px var(--shadow);
  overflow: hidden;
}

.card-header {
  background: var(--header-bg);
  color: var(--text);
  text-align: center;
  padding: 14px 16px;
  font-size: 20px;
  font-weight: 600;
}

.card-body { padding: 18px 16px 20px; }

.input-text {
  width: 100%;
  height: 40px;
  border-radius: 4px;
  border: none;
  background: var(--input-bg);
  color: var(--input-text);
  padding: 0 12px;
  font-size: 16px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(0,0,0,0.15);
}

.input-text::placeholder { color: var(--muted); font-style: italic; }

.btn-primary {
  width: 100%;
  height: 40px;
  margin-top: 12px;
  border: none;
  border-radius: 4px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:active { transform: translateY(1px); }



/* o wrapper que vai para fullscreen */
.stage { position: relative; width: 100%; height: 100%; }

/* o canvas é dimensionado via JS; não precisa z-index alto */
#videoCanvas { display:block; }

/* overlay acima do canvas */
.menu{
  position:absolute; inset:0;
  display:grid; place-items:center;
  background:rgba(0,0,0,.55);
  z-index: 9999;               /* acima de qualquer coisa do stage */
  transition: opacity .12s ease;
}
.menu.hidden{
  opacity:0; visibility:hidden; pointer-events:none;
}
.menu-box{ min-width: 320px; padding:16px; border-radius:12px; background:#111; color:#fff; }
.menu-list{ list-style:none; margin:0; padding:0; }
.menu-item{ display:flex; gap:10px; align-items:center; padding:10px 12px; cursor:pointer; }
.menu-item.active{ background:#1d2837; border-radius:8px; }
.menu-ico{ width:20px; height:20px; }


/* wrapper que vai pro fullscreen */
#stage { position: fixed; /* tamanho pelo JS */ }

/* canvas ocupa o stage; fica por baixo */
#videoCanvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }

/* overlay acima do canvas */
#menuOverlay { position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0,0,0,.55); z-index: 2; transition: opacity .12s ease; }
#menuOverlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* submenus */
.menu-item.has-submenu { position: relative; }
.menu-item.has-submenu::after {
  content: "›"; margin-left: auto; opacity: .7;
}
.submenu {
  position: absolute; top: 0; left: 100%;
  margin-left: 8px; min-width: 260px;
  background: #111; border-radius: 8px; box-shadow: 0 8px 24px var(--shadow);
  list-style: none; padding: 6px 0; display: none; z-index: 10000;
}
.submenu.right { left: 100%; }            /* só pra semântica */
.menu-item.has-submenu:hover .submenu,
.menu-item.has-submenu[aria-expanded="true"] .submenu { display: block; }

.submenu .menu-item { padding: 8px 12px; }
.submenu .menu-item:hover { background: #1d2837; }

.slot-status { color: var(--muted); margin-left: 6px; font-size: 12px; }

/* item “nenhum save” */
.menu-item[aria-disabled="true"], .empty-hint {
  opacity: .6; pointer-events: none;
}


/* === UI BLOCKER forte === */
.ui-blocker {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(1px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
}
.ui-blocker.hidden { display: none; }
.ui-blocker-box {
  background: rgba(20,20,20,0.95);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 20px 28px;
  color: #fff;
  font-size: 18px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  gap: 14px;
}
.ui-blocker .spinner {
  width: 22px; height: 22px;
  border: 3px solid rgba(255,255,255,0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ui-blocker .msg { letter-spacing: .2px; }

/* Toastify: nada crítico — só garante fonte/elevação harmonizados com o tema */
.toastify {
  font-family: inherit;
  box-shadow: 0 12px 26px rgba(0,0,0,.25);
  border-radius: 10px;
}

/* HUD de debug de rede (TN Cast) */
.net-debug {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 40;
  pointer-events: none;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
}

.net-debug-box {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.70);
  color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  font-weight: 500;
  min-width: 120px;
  justify-content: flex-end;
}

/* cores por qualidade */
.net-debug-box.net-bad {
  background: rgba(220, 50, 50, 0.90);
}

.net-debug-box.net-medium {
  background: rgba(230, 150, 40, 0.90);
}

.net-debug-box.net-good {
  background: rgba(40, 170, 80, 0.90);
}

/* escondido por padrão */
.net-debug.hidden {
  display: none;
}
