/* Palpites SP: a landing é a conversa do grupo. O visitante vê o dia que vai receber
   (palpite de manhã, resultado à tarde) e o botão de entrar fica onde estaria a caixa de digitar.
   Fonte e cores do JB SUL; público de +40: nada abaixo de 16px, contraste AA. */

:root {
  --fundo: #f7f6f3;
  --papel-chat: #ebe4d6;
  --balao: #ffffff;
  --azul: #072538;
  --azul-2: #0e3a5a;
  --texto: #102a3d;
  --muted: #52657a;
  --muted-claro: #afc0d2;
  --ouro: #94591a;
  --ouro-claro: #dba44c;
  --aviso: #fff1d6;
  --aviso-texto: #5c4210;
  --info: #dfe8f0;
  --vidro: rgba(11, 20, 26, 0.58);
  --linha: #e3e9ef;
  --verde: #25d366;
  --verde-hover: #1fc05b;
  --lido: #3b82c4;
  --sombra-balao: 0 1px 2px rgba(20, 20, 20, 0.12);
  --rabo: 4px 20px 20px 20px;
  /* cores de cada estado (o build.py troca por estado): cabeçalho do grupo e destaque */
  --tema: var(--azul);
  --whats-barra: #075e54;
  --acento: var(--ouro);
  /* duas fontes: o que imita o WhatsApp usa a fonte do celular (Roboto no Android,
     San Francisco no iPhone, Segoe UI no Windows), como o próprio WhatsApp; o resto é Sora */
  --fonte-whats: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fonte-nossa: "Sora", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--fundo);
  -webkit-text-size-adjust: 100%;
  scrollbar-color: #b9c6d3 transparent;
  accent-color: var(--azul);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--fonte-nossa);
  font-size: 1.125rem;
  line-height: 1.5;
}

::selection {
  background: var(--aviso);
  color: var(--azul);
}

h1,
p,
figure {
  margin: 0;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--azul);
  outline-offset: 3px;
}

/* ---------- botão de entrar ---------- */

.botao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 640px;
  min-height: 60px;
  margin: 0 auto;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--verde);
  box-shadow: 0 2px 6px rgba(20, 20, 20, 0.16);
  color: var(--azul);
  font-size: 1.25rem;
  font-weight: 800;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.botao:hover {
  background: var(--verde-hover);
}

.botao:active {
  transform: scale(0.98);
}

.botao svg {
  width: 28px;
  height: 28px;
  flex: none;
}

/* ---------- ficha do grupo (só no computador) ---------- */

.perfil {
  display: none;
}

/* ---------- conversa ---------- */

.conversa {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background-color: var(--papel-chat);
  /* desenhos de fundo do chat: coroa e trevo, bem apagados */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cg fill='none' stroke='%23072538' stroke-opacity='.08' stroke-width='2' stroke-linejoin='round' stroke-linecap='round'%3E%3Cpath d='M16 34 23 41 30 31 37 41 44 34 42 48H18z'/%3E%3Cpath d='M18 52h24'/%3E%3Ccircle cx='98' cy='92' r='6'/%3E%3Ccircle cx='108' cy='92' r='6'/%3E%3Ccircle cx='103' cy='86' r='6'/%3E%3Ccircle cx='103' cy='98' r='6'/%3E%3Cpath d='M103 104c0 6 2 10 6 13'/%3E%3C/g%3E%3C/svg%3E");
}

/* tudo o que é "WhatsApp": cabeçalho, mensagens e avisos */
.topo,
.mensagens {
  font-family: var(--fonte-whats);
}

.topo {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: var(--whats-barra); /* o verde do WhatsApp */
  color: #fff;
}

/* a foto do grupo, redonda como no WhatsApp */
.topo__avatar,
.perfil__avatar {
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  background: var(--tema);
}

/* sem foto do estado: a coroa dourada sobre a cor do estado */
.avatar-coroa {
  display: grid;
  place-items: center;
  color: var(--ouro-claro);
}

.avatar-coroa svg {
  width: 60%;
  height: 60%;
  fill: currentColor;
}

.topo__avatar {
  width: 46px;
  height: 46px;
}

.topo__nome {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
}

.topo__selo {
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--ouro-claro);
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

.topo__meta {
  font-size: 1rem;
  line-height: 1.3;
  color: var(--muted-claro);
}

.chat {
  flex: 1;
  padding: 18px 12px 24px;
}

.mensagens {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

/* ---------- balões ---------- */

.msg {
  position: relative;
  align-self: flex-start;
  max-width: min(90%, 520px);
  padding: 10px 14px 8px;
  border-radius: var(--rabo);
  background: var(--balao);
  box-shadow: var(--sombra-balao);
}

/* o rabinho do balão, no canto de cima */
.msg::before {
  content: "";
  position: absolute;
  top: 0;
  left: -7px;
  width: 8px;
  height: 12px;
  background: var(--balao);
  clip-path: polygon(100% 0, 0 0, 100% 100%);
}

.msg__autor {
  font-size: 1rem;
  font-weight: 700;
  color: var(--acento);
}

.msg__titulo {
  margin-top: 2px;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--azul);
}

.msg__rodape {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  font-size: 1rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lido {
  width: 20px;
  height: 14px;
  color: var(--lido);
}

/* mensagem de um participante: no WhatsApp cada pessoa tem o nome numa cor própria */
.msg--membro .msg__autor {
  color: #6a4a9c;
}

.msg--membro-2 .msg__autor {
  color: #0e7064;
}

.msg--membro-3 .msg__autor {
  color: #2f6f8f;
}

/* espaço só entre os parágrafos do texto, não depois do nome nem antes da hora */
.msg--membro p + p {
  margin-top: 10px;
}

.msg--membro .msg__autor + p {
  margin-top: 2px;
}

.msg--membro p + .msg__rodape {
  margin-top: 6px;
}

/* mensagens com a foto redonda de quem escreve ao lado, como nos grupos do WhatsApp */
.linha {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.linha .msg {
  max-width: min(calc(100% - 44px), 520px);
}

.avatar-letra,
.avatar-mini {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.avatar-mini {
  object-fit: cover;
  background: var(--tema);
}

.avatar-letra {
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
}

.avatar-letra--1 { background: #6a4a9c; }
.avatar-letra--2 { background: #0e7064; }
.avatar-letra--3 { background: #2f6f8f; }

.emojis {
  font-size: 1.6rem;
  line-height: 1.2;
}

/* abertura: a primeira mensagem é o título da página */
.msg--abertura {
  max-width: min(96%, 600px);
  padding: 12px 18px 14px;
}

.msg--abertura h1 {
  margin-top: 4px;
  font-size: clamp(2.1rem, 9.6vw, 3.4rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.03em;
  color: var(--azul);
  text-wrap: balance;
}

.msg--abertura em {
  font-style: normal;
  color: var(--acento);
}

.msg__lema {
  margin-top: 10px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}

/* palpite: a foto dos bichos, como foto mandada no grupo */
.msg--palpite {
  width: min(90%, 420px);
}

.msg__foto {
  position: relative;
  /* foto quadrada, como chega no WhatsApp */
  aspect-ratio: 1 / 1;
  margin: 6px -8px 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #0b2233;
}

.msg__foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

/* no resultado a foto é cortada mais baixa, para a conversa não ficar comprida */
.msg__foto--larga {
  aspect-ratio: 4 / 3;
}

.msg__foto--larga img {
  object-position: 50% 35%;
}

.palpite__bicho {
  font-weight: 600;
  color: var(--texto);
}

.dezenas {
  display: flex;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.dezenas li {
  min-width: 56px;
  padding: 4px 10px;
  border: 2px solid var(--info);
  border-radius: 10px;
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--azul);
}

.palpite__milhar {
  margin-top: 12px;
  font-size: clamp(3.6rem, 17vw, 5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--azul);
}

.palpite__milhar span {
  display: block;
  margin-bottom: 2px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--muted);
}

/* resultado: a tabela do 1º ao 5º prêmio */
.msg--resultado {
  width: min(90%, 420px);
}

.resultado {
  width: 100%;
  margin-top: 6px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.resultado th,
.resultado td {
  padding: 7px 6px;
  border-bottom: 1px solid var(--linha);
  text-align: left;
}

.resultado tbody th {
  width: 3ch;
  font-weight: 800;
  color: var(--acento);
}

.resultado td:nth-child(2) {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--azul);
}

.resultado small {
  margin-left: 4px;
  font-size: 1rem;
  color: var(--muted);
}

.resultado tr:last-child > * {
  border-bottom: 0;
}

/* palpite e resultado ficam borrados (só com zeros por baixo); o aviso por cima leva para o grupo */
.bloqueio {
  position: relative;
  margin-top: 6px;
}

.bloqueio .resultado {
  margin-top: 0;
  user-select: none;
}

.bloqueio .resultado td,
.borrado {
  filter: blur(10px);
  user-select: none;
}

/* o aviso por cima do borrado, como a foto ainda não baixada no WhatsApp:
   círculo e etiquetas cinza-escuro translúcidos, letra branca */
.bloqueio__aviso {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  text-align: center;
  text-decoration: none;
  color: #fff;
}

.bloqueio__aviso svg {
  width: 48px;
  height: 48px;
  padding: 12px;
  border-radius: 50%;
  background: var(--vidro);
}

.bloqueio__aviso span,
.bloqueio__aviso u {
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--vidro);
  line-height: 1.3;
}

.bloqueio__aviso span {
  font-weight: 700;
}

.bloqueio__aviso u {
  font-weight: 600;
  text-underline-offset: 3px;
}

.bloqueio__aviso:hover svg,
.bloqueio__aviso:hover span,
.bloqueio__aviso:hover u {
  background: rgba(11, 20, 26, 0.7);
}

/* fechamento */
.fecho {
  margin-top: 2px;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--azul);
}

/* avisos do sistema e separador de dia, centralizados como no app */
.sistema,
.dia span {
  align-self: center;
  border-radius: 12px;
  font-size: 1rem;
  text-align: center;
}

.sistema {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 92%;
  margin: 4px 0;
  padding: 8px 14px;
  background: var(--info);
  color: var(--azul);
}

.sistema--aviso {
  background: var(--aviso);
  color: var(--aviso-texto);
}

.sistema svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.dia {
  display: flex;
  justify-content: center;
  margin: 6px 0;
}

.dia span {
  padding: 5px 14px;
  background: var(--info);
  font-weight: 700;
  color: var(--azul);
}

/* ---------- rodapé e caixa de entrar ---------- */

.rodape {
  max-width: 640px;
  margin: 32px auto 0;
  font-size: 1rem;
  text-align: center;
  color: var(--muted);
}


.rodape__ilustrativo {
  margin: 0 auto 14px;
  font-weight: 600;
}

.rodape__aviso {
  max-width: 62ch;
  margin: 0 auto 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(7, 37, 56, 0.12);
  line-height: 1.55;
}

.rodape a {
  font-weight: 700;
  color: var(--azul);
}

.compor {
  position: sticky;
  bottom: 0;
  z-index: 10;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--papel-chat);
  border-top: 1px solid rgba(7, 37, 56, 0.08);
}

/* ---------- computador: ficha do grupo à esquerda, conversa à direita ---------- */

@media (min-width: 960px) {
  body {
    display: grid;
    grid-template-columns: minmax(360px, 420px) 1fr;
  }

  .perfil {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100dvh;
    padding: 56px 40px 32px;
    background: var(--balao);
    border-right: 1px solid var(--linha);
    text-align: center;
    overflow-y: auto;
  }

  .perfil__avatar {
    width: 148px;
    height: 148px;
  }

  .perfil__nome {
    margin-top: 20px;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    color: var(--azul);
  }

  .perfil__meta {
    margin-top: 6px;
    color: var(--muted);
  }

  .perfil__meta strong {
    color: var(--azul);
  }

  .perfil .botao {
    margin-top: 28px;
  }

  .perfil__lista {
    align-self: stretch;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
    text-align: left;
  }

  .perfil__lista li {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--linha);
    font-weight: 600;
    color: var(--azul);
  }

  .perfil__lista li:last-child {
    border-bottom: 0;
  }

  .perfil__lista svg {
    width: 26px;
    height: 26px;
    flex: none;
    color: var(--acento);
  }

  .chat {
    padding: 28px 32px 32px;
  }

  .topo {
    padding: 14px 32px;
  }

  .compor {
    padding: 14px 32px;
  }
}

/* ---------- movimento: as mensagens chegam uma a uma, como no grupo ---------- */

@media (prefers-reduced-motion: no-preference) {
  .mensagens > li {
    animation: chegar 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .mensagens > li:nth-child(2) { animation-delay: 0.12s; }
  .mensagens > li:nth-child(3) { animation-delay: 0.24s; }
  .mensagens > li:nth-child(4) { animation-delay: 0.4s; }
  .mensagens > li:nth-child(5) { animation-delay: 0.56s; }
  .mensagens > li:nth-child(6) { animation-delay: 0.72s; }
  .mensagens > li:nth-child(7) { animation-delay: 0.86s; }
}

@keyframes chegar {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}
