* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  user-select: none;
}

#palco {
  position: relative;
  width: 100vw;
  height: 100vh;
  cursor: pointer;
}

#img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#sprite {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  z-index: 2;
}
#sprite.hide { display: none; }

#caption {
  position: absolute;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  padding: 28px 48px;
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 1.9rem;
  line-height: 1.45;
  text-align: center;
  max-width: min(1100px, 80vw);
  min-width: 480px;
  letter-spacing: 0.005em;
  z-index: 5;
}

#caption b { color: #ffd66b; margin-right: 6px; font-weight: 600; }
#caption i { color: rgba(255,214,107,0.75); font-size: 0.95rem; font-style: italic; margin-right: 8px; vertical-align: 0.15em; }

#counter {
  position: absolute;
  top: 16px;
  right: 24px;
  color: #fff;
  background: rgba(0,0,0,0.55);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  z-index: 5;
  cursor: copy;
  user-select: none;
  transition: background 0.2s;
}
#counter:hover { background: rgba(0,0,0,0.75); }
#counter.copiado { background: rgba(80,200,80,0.85); }

#audio-debug {
  position: absolute;
  bottom: 16px;
  right: 24px;
  color: #fff;
  background: rgba(0,0,0,0.55);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  z-index: 5;
  cursor: copy;
  user-select: none;
  transition: background 0.2s;
}
#audio-debug:hover { background: rgba(0,0,0,0.75); }
#audio-debug.copiado { background: rgba(80,200,80,0.85); }

#hint {
  position: absolute;
  top: 16px;
  left: 24px;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.5);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: opacity 0.5s;
  z-index: 5;
}
#hint.hide { opacity: 0; }

#menu, #seletor {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.82);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 10;
  cursor: default;
  padding: 40px;
  overflow-y: auto;
}
#menu.hide, #seletor.hide { display: none; }

#btn-cenas {
  position: absolute;
  bottom: 16px;
  left: 24px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  z-index: 6;
  user-select: none;
  transition: background 0.2s;
}
#btn-cenas:hover { background: rgba(0,0,0,0.8); border-color: rgba(255,214,107,0.6); }

#seletor {
  justify-content: flex-start;
  align-items: stretch;
  gap: 0;
  padding: 0;
}
.seletor-cabecalho {
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.95);
  padding: 24px 40px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  z-index: 2;
}
.seletor-cabecalho h2 {
  color: #fff;
  margin: 0 0 12px;
  font-weight: 500;
  font-size: 1.5rem;
  padding-right: 100px;
}
#seletor-busca {
  width: 100%;
  max-width: 480px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
}
#seletor-busca:focus { border-color: #ffd66b; }
#seletor-busca::placeholder { color: rgba(255,255,255,0.4); }

.seletor-lista {
  padding: 16px 40px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.seletor-grupo {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 6px 12px;
  align-items: start;
}
.seletor-grupo h3 {
  grid-column: 1 / -1;
  color: #ffd66b;
  font-size: 1.15rem;
  margin: 0 0 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.seletor-grupo h3 .sg-count {
  color: rgba(255,255,255,0.45);
  font-size: 0.75rem;
  font-weight: 400;
  margin-left: 10px;
  text-transform: none;
  letter-spacing: 0;
}

.seletor-cena {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  border-radius: 8px;
  padding: 9px 14px;
  margin-bottom: 0;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.seletor-cena:hover:not(:disabled) {
  background: rgba(255,214,107,0.12);
  border-color: #ffd66b;
}
.seletor-cena:disabled, .seletor-cena.nao-carregada {
  opacity: 0.35;
  cursor: not-allowed;
}
.seletor-cena .sc-titulo {
  font-size: 0.95rem;
  font-weight: 600;
  color: #ffd66b;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.seletor-cena.nao-carregada .sc-titulo { color: rgba(255,255,255,0.7); }
.seletor-cena .sc-personagens {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.7);
}

#seletor .fechar {
  position: absolute;
  top: 20px;
  right: 24px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: inherit;
  z-index: 3;
}
#seletor .fechar:hover { background: rgba(255,255,255,0.1); }

#menu h2 {
  color: #fff;
  margin: 0 0 24px;
  font-size: 1.8rem;
  font-weight: 500;
}

.menu-opcao {
  padding: 18px 36px;
  font-size: 1.15rem;
  background: rgba(255,255,255,0.08);
  border: 2px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  min-width: 360px;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  font-family: inherit;
}

.menu-opcao:hover {
  background: rgba(255,214,107,0.15);
  border-color: #ffd66b;
  transform: translateY(-2px);
}

.menu-opcao.escolhida {
  background: rgba(255,214,107,0.22);
  border-color: rgba(255,214,107,0.6);
}
