/* CineAgora — escuro e dourado. Compatível com Chrome 80+ e iOS 15+: gap só em grid; proporção com padding-bottom. */
:root {
  --fundo: #0f1115;
  --sup: #14161c;
  --sup2: #171920;
  --texto: #e9e9ee;
  --texto2: #9a9caa;
  --borda: #2c2f3a;
  --ouro: #ffc531;
  --sobre-ouro: #15161a;
  --topo-h: 54px;
  --abas-h: 58px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--fundo);
  color: var(--texto);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--ouro); outline-offset: 2px; }
.sem-js { padding: 40px 16px; text-align: center; }

/* Toque: afunda e escurece; desabilitado fica apagado. */
button, .chip, .cartao, .botao { transition: transform .08s ease, filter .08s ease; }
button:active, .chip:active, .cartao:active, .botao:active { transform: scale(.96); filter: brightness(.85); }
button:disabled { opacity: .6; cursor: default; }

/* Topo */
#topo {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  min-height: var(--topo-h);
  padding: env(safe-area-inset-top) 8px 0 14px;
  background: rgba(15, 17, 21, .97);
  border-bottom: 1px solid var(--borda);
}
.logo { font-weight: 800; font-size: 20px; letter-spacing: .2px; white-space: nowrap; }
.logo b { color: var(--ouro); }
#topo .acoes { display: flex; margin-left: auto; }
#topo .acoes button { width: 40px; height: 40px; margin-left: 2px; border-radius: 50%; font-size: 19px; }
#bt-busca-pc { display: none; }

/* Abas: embaixo no celular */
#abas {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--sup);
  border-top: 1px solid var(--borda);
}
#abas a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: var(--abas-h);
  font-size: 12px;
  color: var(--texto2);
}
#abas a span { margin-bottom: 3px; font-size: 20px; line-height: 1; }
#abas a.ativa { color: var(--ouro); font-weight: 700; }

#telas { padding-bottom: calc(var(--abas-h) + env(safe-area-inset-bottom) + 20px); }
#telas > section { min-height: 60vh; }

/* Grade de pôsteres */
.grade { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 8px; padding: 8px 12px; }
.cartao { display: block; min-width: 0; }
.cartao .moldura { position: relative; display: block; padding-bottom: 150%; overflow: hidden; border-radius: 8px; background: var(--sup2); }
.cartao .poster { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.cartao .sem-poster {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: flex-end;
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(160deg, #2a2e3a, #15171d);
}
.cartao .selos { position: absolute; top: 5px; right: 5px; display: flex; }
.cartao .selos img, .cartao .selos .rs, .cartao .selos .sigla {
  width: 22px;
  height: 22px;
  margin-left: 3px;
  border-radius: 5px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}
.cartao .selos .rs, .cartao .selos .sigla {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2f3542;
  color: var(--ouro);
  font-size: 9px;
  font-weight: 800;
}
.cartao .nome {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cartao .meta { display: block; margin-top: 2px; color: var(--texto2); font-size: 12px; }
.cartao.fora { opacity: .4; }

/* Catálogo */
.cabecalho-catalogo { padding: 8px 12px 0; }
.linha-filtros { display: flex; align-items: center; justify-content: space-between; min-height: 36px; }
.bt-filtros, .bt-ordem { padding: 6px 2px; color: var(--texto2); font-size: 14px; }
.contagem { margin: 2px 0 0; color: var(--texto2); font-size: 12px; }
.fim { margin: 0; padding: 24px 16px 8px; color: var(--texto2); font-size: 14px; text-align: center; }
.tentar-mais { padding: 16px; text-align: center; }
.sentinela { height: 1px; }
.chips { display: flex; overflow-x: auto; padding: 2px 0 6px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  margin-right: 6px;
  padding: 6px 11px;
  border: 1px solid #343846;
  border-radius: 999px;
  color: #c9cad3;
  font-size: 13px;
  white-space: nowrap;
}
.chip[aria-pressed="true"] { border-color: var(--ouro); background: var(--ouro); color: var(--sobre-ouro); font-weight: 700; }
.formato { display: grid; grid-template-columns: 1fr 1fr; margin: 6px 0 2px; padding: 3px; border-radius: 10px; background: #1b1e26; }
.formato button { padding: 7px 0; border-radius: 8px; color: var(--texto2); font-size: 14px; }
.formato button[aria-pressed="true"] { background: #2a2e3a; color: var(--ouro); font-weight: 700; }

/* Conteúdo dos painéis */
.titulo-painel { margin-bottom: 4px; font-size: 18px; }
#painel h3 { margin: 16px 0 8px; color: var(--texto); font-size: 14px; }
#painel .nota-como { margin: 8px 0 0; color: var(--texto2); font-size: 12px; }
.ops { display: flex; flex-wrap: wrap; }
.op { margin: 0 6px 6px 0; padding: 6px 11px; border: 1px solid #343846; border-radius: 999px; color: #c9cad3; font-size: 13px; }
.op[aria-pressed="true"] { border-color: var(--ouro); background: rgba(255, 197, 49, .15); color: var(--ouro); font-weight: 700; }
.anos { display: flex; flex-wrap: wrap; align-items: center; }
.anos label { margin-right: 16px; color: var(--texto2); }
.anos select { margin-left: 6px; padding: 7px 8px; border: 1px solid #343846; border-radius: 8px; background: var(--sup); color: var(--texto); font: inherit; }
.bots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.bt-limpar { padding: 10px; border: 1px solid #343846; border-radius: 10px; color: #c9cad3; font-weight: 700; }
.bots .botao { padding: 10px; }
.item-ordem { display: block; width: 100%; padding: 13px 4px; border-bottom: 1px solid var(--borda); font-size: 15px; text-align: left; }
.item-ordem[aria-pressed="true"] { color: var(--ouro); font-weight: 700; }
.lista-todos button { display: flex; align-items: center; width: 100%; padding: 8px 4px; border-bottom: 1px solid var(--borda); text-align: left; }
.lista-todos img, .lista-todos .sigla { width: 32px; height: 32px; margin-right: 10px; border-radius: 8px; }
.lista-todos .sigla { display: flex; align-items: center; justify-content: center; background: #2f3542; color: var(--ouro); font-weight: 800; }
.lista-todos button[aria-pressed="true"] { color: var(--ouro); font-weight: 700; }
.lista-todos button[aria-pressed="true"]::after { content: "✓"; margin-left: auto; }

/* Listas */
.cabecalho-listas { padding: 10px 12px 2px; }
.cabecalho-listas .formato { margin-top: 0; }
.resumo { margin: 8px 0 0; color: var(--ouro); font-size: 13px; font-weight: 700; }
.vazio { margin: 48px 24px; color: var(--texto2); text-align: center; }
@media (min-width: 900px) { .cabecalho-listas { max-width: 520px; padding: 16px 24px 4px; } }

/* Busca */
.busca { padding: 10px 12px 4px; }
#campo-busca {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--ouro);
  border-radius: 10px;
  background: #1b1e26;
  color: var(--texto);
  font: inherit;
  font-size: 16px; /* 16px evita o zoom automático do iPhone */
}
.dica, .nada, .mais-resultados { margin: 8px 12px; color: var(--texto2); font-size: 14px; }
.nada { margin-top: 32px; text-align: center; }
.mais-resultados { text-align: center; }
@media (min-width: 900px) {
  .busca { max-width: 720px; padding: 16px 24px 8px; }
  .dica, .nada, .mais-resultados { margin: 8px 24px; }
}

/* Página do título: uma coluna no celular; no PC, pôster, botões e onde assistir à esquerda */
.carregando { padding: 40px 16px; color: var(--texto2); text-align: center; }
.capa { position: relative; height: 210px; overflow: hidden; background: linear-gradient(160deg, #3a2f12, #15171d); }
.capa-img { width: 100%; height: 100%; object-fit: cover; }
.capa::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 70%;
  background: linear-gradient(180deg, rgba(15, 17, 21, 0), var(--fundo));
}
.capa button {
  position: absolute;
  top: 10px;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  font-size: 24px;
  line-height: 40px;
}
.bt-voltar { left: 10px; }
.bt-compartilhar { right: 10px; font-size: 18px; }
.corpo-titulo {
  position: relative;
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  grid-template-areas: "poster info" "botoes botoes" "onde onde" "resto resto";
  gap: 14px;
  margin-top: -64px;
  padding: 0 16px;
}
.poster-titulo {
  position: relative;
  grid-area: poster;
  padding-bottom: 150%;
  overflow: hidden;
  border-radius: 10px;
  background: var(--sup2);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .6);
}
.poster-titulo img, .poster-titulo .sem-poster { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
.poster-titulo .sem-poster {
  display: flex;
  align-items: flex-end;
  padding: 8px;
  background: linear-gradient(160deg, #2a2e3a, #15171d);
  font-size: 13px;
  font-weight: 700;
}
.info { grid-area: info; align-self: end; min-width: 0; }
.info h1 { font-size: 20px; line-height: 1.15; }
.dados, .generos { margin: 4px 0 0; color: var(--texto2); font-size: 13px; }
.classificacao { display: inline-block; min-width: 22px; padding: 1px 5px; border-radius: 4px; font-size: 12px; font-weight: 800; text-align: center; }
.nota { margin: 4px 0 0; color: var(--ouro); font-size: 14px; font-weight: 700; }
.nota small { color: var(--texto2); font-weight: 400; }
.botoes { display: grid; grid-area: botoes; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.botoes button, .botoes a {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9px 4px;
  border: 1px solid #343846;
  border-radius: 10px;
  color: #d6d7de;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.botoes [aria-pressed="true"] { border-color: var(--ouro); background: var(--ouro); color: var(--sobre-ouro); }
.bt-sortear-outro { grid-column: 1 / -1; }
.onde { grid-area: onde; min-width: 0; }
.onde h2, .resto h2 { margin: 6px 0 8px; font-size: 16px; }
.linha-onde { display: flex; align-items: center; padding: 4px 0; }
.linha-onde .rotulo { flex: 0 0 86px; color: var(--texto2); font-size: 13px; }
.logos { display: flex; flex-wrap: wrap; }
.logos img, .logos .sigla { width: 36px; height: 36px; margin: 0 6px 6px 0; border-radius: 8px; }
.logos .sigla { display: flex; align-items: center; justify-content: center; background: #2f3542; color: var(--ouro); font-weight: 800; }
.indisponivel { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--sup2); color: var(--texto2); }
.link-tmdb { color: var(--ouro); font-weight: 700; }
.fonte { margin: 8px 0 0; color: #6e717d; font-size: 12px; }
.resto { grid-area: resto; min-width: 0; }
.resto section { margin-bottom: 18px; }
.sinopse p { margin: 0; color: #c9cad3; line-height: 1.5; }
.aviso-ingles { margin-left: 6px; color: var(--texto2); font-size: 13px; }
.pessoas { display: flex; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.pessoa { flex: 0 0 76px; margin-right: 10px; text-align: center; }
.pessoa img, .pessoa .inicial { display: block; width: 64px; height: 64px; margin: 0 auto 4px; border-radius: 50%; background: #2a2c35; object-fit: cover; }
.pessoa .inicial { display: flex; align-items: center; justify-content: center; color: var(--texto2); font-size: 22px; font-weight: 700; }
.nome-pessoa { display: block; font-size: 12px; line-height: 1.2; }
.personagem { display: block; color: var(--texto2); font-size: 11px; line-height: 1.2; }
.equipe { margin: 10px 0 0; color: var(--texto2); font-size: 13px; }
.temporadas ul { margin: 0; padding: 0; list-style: none; }
.temporadas li { display: flex; justify-content: space-between; margin-bottom: 6px; padding: 9px 12px; border-radius: 10px; background: var(--sup2); font-size: 14px; }
.temporadas .detalhe { color: var(--texto2); }
.rolo { display: grid; grid-auto-columns: 112px; grid-auto-flow: column; gap: 10px; overflow-x: auto; padding-bottom: 6px; -webkit-overflow-scrolling: touch; }

/* Primeira abertura e Meus streamings */
#primeira {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 15;
  overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--fundo);
}
.titulo-meus { font-size: 20px; }
.subtitulo-meus { margin: 6px 0 16px; color: var(--texto2); font-size: 14px; }
.grade-meus { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grade-meus button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 6px;
  border: 2px solid var(--borda);
  border-radius: 12px;
  background: var(--sup2);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}
.grade-meus button img, .grade-meus button .sigla {
  width: 44px;
  height: 44px;
  margin-bottom: 6px;
  border-radius: 10px;
}
.grade-meus button .sigla { display: flex; align-items: center; justify-content: center; background: #2f3542; color: var(--ouro); font-weight: 800; }
.grade-meus button[aria-pressed="true"] { border-color: var(--ouro); }
.grade-meus button[aria-pressed="true"]::after {
  content: "✓";
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ouro);
  color: var(--sobre-ouro);
  font-size: 12px;
  font-weight: 800;
  line-height: 20px;
}
.filtro-nome {
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--borda);
  border-radius: 10px;
  background: var(--sup);
  color: var(--texto);
  font: inherit;
}
.bt-ver-todos { display: block; margin: 14px auto 0; color: var(--ouro); font-weight: 700; }
.acoes-meus { display: flex; flex-direction: column; align-items: center; margin-top: 22px; }
.acoes-meus .bt-pronto { width: 100%; max-width: 360px; padding: 12px; font-size: 16px; }
.acoes-meus .bt-pular { margin-top: 14px; padding: 6px 12px; color: var(--texto2); }

/* Ajustes e Sobre */
.ajustes { max-width: 640px; margin: 0 auto; padding: 12px 16px; }
.ajustes h1 { margin: 4px 0 14px; font-size: 20px; }
.item { display: block; width: 100%; margin-bottom: 10px; padding: 12px 14px; border-radius: 12px; background: var(--sup2); text-align: left; }
.item small { display: block; margin-top: 2px; color: var(--texto2); font-size: 13px; }
.instrucoes { margin: -2px 0 12px; padding: 10px 12px; border-radius: 10px; background: var(--sup); color: var(--texto2); font-size: 14px; }
.sobre { margin-top: 18px; padding: 16px 14px; border-radius: 12px; background: var(--sup2); }
.sobre .marca { margin: 0 0 10px; color: var(--texto); font-size: 24px; font-weight: 800; }
.sobre .marca b { color: var(--ouro); }
.sobre img.tmdb { width: auto; height: 14px; margin-bottom: 10px; }
.sobre p { margin: 0 0 8px; color: var(--texto2); font-size: 13px; }
.sobre .versao { color: #6e717d; }

/* Mensagens e botões */
.mensagem { margin: 48px 16px; color: var(--texto2); text-align: center; }
.mensagem p { margin: 0 0 14px; }
.botao, .mensagem button {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--ouro);
  color: var(--sobre-ouro);
  font-weight: 800;
}

/* Painel (sobe de baixo no celular; centralizado no PC) */
#painel { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 30; }
#painel .fundo { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0, 0, 0, .6); }
#painel .conteudo {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 88vh;
  overflow-y: auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--sup2);
}

/* Avisos */
#aviso {
  position: fixed;
  right: 12px;
  bottom: calc(var(--abas-h) + env(safe-area-inset-bottom) + 10px);
  left: 12px;
  z-index: 20;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #7a5d12;
  border-radius: 10px;
  background: #3a2d0b;
  color: #ffe39b;
  font-size: 14px;
}
#aviso .texto { flex: 1; }
#aviso button { margin-left: 10px; padding: 6px 10px; border-radius: 8px; background: rgba(255, 255, 255, .1); font-weight: 700; }
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--abas-h) + env(safe-area-inset-bottom) + 24px);
  z-index: 40;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--texto);
  color: var(--fundo);
  font-weight: 700;
  transform: translateX(-50%);
}

/* PC */
@media (min-width: 900px) {
  #topo { min-height: 62px; padding: 0 24px; }
  #abas {
    position: static;
    display: flex;
    margin-left: 32px;
    padding: 0;
    background: none;
    border: 0;
  }
  #abas a { flex-direction: row; height: 62px; margin-right: 22px; font-size: 15px; }
  #abas a span { margin: 0 6px 0 0; font-size: 16px; }
  #abas a.ativa { box-shadow: inset 0 -2px 0 var(--ouro); }
  #bt-busca-pc {
    display: block;
    width: 260px;
    margin-left: auto;
    padding: 8px 12px;
    border: 1px solid var(--borda);
    border-radius: 9px;
    color: var(--texto2);
    text-align: left;
  }
  #topo .acoes { margin-left: 8px; }
  #bt-busca { display: none; }
  #telas { padding-bottom: 32px; }
  .grade { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 14px; padding: 12px 24px; }
  #painel .conteudo {
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: 560px;
    max-height: 80vh;
    border-radius: 16px;
    transform: translate(-50%, -50%);
  }
  #aviso { right: 24px; bottom: 24px; left: auto; max-width: 440px; }
  .capa { height: 340px; }
  .corpo-titulo {
    grid-template-columns: 260px minmax(0, 1fr);
    grid-template-areas: "poster info" "poster resto" "botoes resto" "onde resto";
    grid-template-rows: auto auto auto 1fr;
    gap: 18px 36px;
    max-width: 1100px;
    margin: -150px auto 0;
    padding: 0 24px;
  }
  .info { padding-bottom: 8px; }
  .info h1 { font-size: 30px; }
  .botoes { grid-template-columns: 1fr 1fr; }
  .bt-trailer { grid-column: 1 / -1; }
  .rolo { grid-auto-columns: 140px; }
  #primeira { padding: 40px 24px; }
  #primeira > * { max-width: 760px; margin-right: auto; margin-left: auto; }
  .grade-meus { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  #toast { bottom: 32px; }
}
