/* ==================================================
   Memória da Marina — tema OS SIMPSONS
   Céu de Springfield, amarelo Simpsons, donut rosa,
   azul da Marge e quadro-negro do Bart.
   ================================================== */
:root {
  --ceu: #70d1fe;
  --ceu2: #b9e8ff;
  --amarelo: #ffd90f;      /* amarelo Simpsons */
  --amarelo-escuro: #e8a33d;
  --rosa: #f14e90;         /* cobertura do donut */
  --rosa2: #ff7bac;
  --azul: #107dc0;         /* cabelo da Marge */
  --azul-escuro: #0b5c8e;
  --laranja: #f26f22;      /* camiseta do Bart */
  --vermelho: #e23d2e;     /* Duff */
  --verde-quadro: #2f6b4f; /* quadro-negro do Bart */
  --madeira: #a0622d;
  --ink: #232323;
  --muted: #33566e;
  --card: #ffffff;
  --border: rgba(0, 0, 0, 0.1);
  --grad: linear-gradient(135deg, #f14e90, #ff7bac);
  --radius: 20px;
  --sombra-btn: 0 8px 20px rgba(241, 78, 144, 0.4);
  --fonte-logo: 'Luckiest Guy', 'Baloo 2', cursive;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Baloo 2', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, var(--ceu) 0%, var(--ceu2) 55%, #e2f5ff 100%) fixed;
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.45;
}

/* nuvens da abertura ☁️ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 190px 62px at 12% 9%, rgba(255, 255, 255, 0.95) 60%, transparent 61%),
    radial-gradient(ellipse 150px 55px at 26% 13%, rgba(255, 255, 255, 0.9) 60%, transparent 61%),
    radial-gradient(ellipse 230px 70px at 88% 6%, rgba(255, 255, 255, 0.85) 60%, transparent 61%),
    radial-gradient(ellipse 160px 55px at 72% 15%, rgba(255, 255, 255, 0.75) 60%, transparent 61%),
    radial-gradient(ellipse 200px 60px at 45% 55%, rgba(255, 255, 255, 0.35) 60%, transparent 61%),
    radial-gradient(ellipse 180px 60px at 8% 78%, rgba(255, 255, 255, 0.4) 60%, transparent 61%),
    radial-gradient(ellipse 210px 65px at 92% 84%, rgba(255, 255, 255, 0.4) 60%, transparent 61%);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* ---------- layout ---------- */
.page {
  max-width: 520px;
  margin: 0 auto;
  padding: 22px 18px calc(104px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.topbar h1 {
  font-family: var(--fonte-logo);
  font-size: 1.7rem;
  font-weight: 400;
  line-height: 1.1;
  color: var(--azul);
  text-shadow: 2px 2px 0 rgba(255, 255, 255, 0.7);
  letter-spacing: 0.02em;
}
.topbar .sub { color: var(--muted); font-size: 0.9rem; font-weight: 600; }

.voltar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: var(--card);
  border: 2px solid var(--border);
  font-size: 1.1rem;
  box-shadow: 0 3px 8px rgba(16, 60, 100, 0.12);
}

/* ---------- componentes ---------- */
.card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 8px 22px rgba(16, 60, 100, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 26px;
  border: none;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--sombra-btn);
  transition: transform 0.15s ease, filter 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.6; filter: grayscale(0.4); box-shadow: none; }
.btn-lg { padding: 18px 34px; font-size: 1.15rem; }
.btn-bloco { width: 100%; }
.btn-ghost {
  background: #fff;
  color: var(--azul);
  border: 2px solid rgba(16, 125, 192, 0.35);
  box-shadow: 0 3px 10px rgba(16, 60, 100, 0.1);
}

label.campo { display: block; margin-bottom: 14px; font-weight: 700; font-size: 0.95rem; }
label.campo span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }

input[type="text"], textarea, input:not([type]) {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  background: #f4f8fc;
  border: 2px solid rgba(16, 125, 192, 0.18);
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s ease;
}
input:focus, textarea:focus { border-color: var(--rosa); }
textarea { resize: none; min-height: 72px; }
::placeholder { color: rgba(51, 86, 110, 0.55); }

/* ---------- navegação inferior ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  padding: 8px 8px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 2px solid rgba(16, 125, 192, 0.15);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 56px;
  padding: 4px 6px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}
.nav-item .nav-emoji { font-size: 1.35rem; line-height: 1; }
.nav-item.ativo { color: var(--rosa); }
.nav-jogar .nav-emoji {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--grad);
  border: 3px solid #fff;
  box-shadow: var(--sombra-btn);
  margin-top: -22px;
  font-size: 1.5rem;
}

/* ---------- boas-vindas ---------- */
.welcome {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 22px calc(30px + env(safe-area-inset-bottom));
  text-align: center;
}
.welcome-inner { max-width: 420px; width: 100%; }
.welcome-kicker {
  display: inline-block;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid rgba(226, 61, 46, 0.35);
  color: var(--vermelho);
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(16, 60, 100, 0.12);
}
/* título no estilo do logo dos Simpsons */
.welcome-title {
  font-family: var(--fonte-logo);
  font-size: clamp(2.6rem, 12vw, 3.6rem);
  font-weight: 400;
  line-height: 1.02;
  margin-bottom: 20px;
  color: var(--amarelo);
  -webkit-text-stroke: 2px #262626;
  text-shadow:
    3px 3px 0 var(--vermelho),
    5px 5px 0 rgba(0, 0, 0, 0.18);
  letter-spacing: 0.02em;
}
.polaroid {
  display: inline-block;
  background: #fff;
  padding: 10px 10px 14px;
  border-radius: 10px;
  transform: rotate(-2.5deg);
  box-shadow: 0 18px 40px rgba(11, 60, 100, 0.35);
  margin-bottom: 22px;
  max-width: 300px;
}
.polaroid img { border-radius: 5px; width: 100%; }
.polaroid-caption {
  display: block;
  margin-top: 9px;
  color: var(--azul);
  font-weight: 800;
  font-size: 0.95rem;
}
.welcome-sub { color: var(--muted); margin-bottom: 26px; font-size: 1rem; font-weight: 600; }

/* ---------- home ---------- */
.hero-home { text-align: center; margin-bottom: 20px; }
.hero-home h1 {
  font-family: var(--fonte-logo);
  font-size: 2.1rem;
  font-weight: 400;
  line-height: 1.1;
  color: var(--amarelo);
  -webkit-text-stroke: 1.5px #262626;
  text-shadow: 2.5px 2.5px 0 var(--vermelho);
  letter-spacing: 0.02em;
}
.hero-home p { color: var(--muted); font-weight: 600; }

.chips { display: flex; gap: 10px; justify-content: center; margin: 16px 0 22px; flex-wrap: wrap; }
.chip {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  box-shadow: 0 3px 8px rgba(16, 60, 100, 0.1);
}
.chip b { color: var(--ink); }

.acoes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.acao {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 16px rgba(16, 60, 100, 0.1);
}
.acao:active { transform: scale(0.97); }
.acao-emoji { font-size: 1.9rem; line-height: 1.2; }
.acao-titulo { font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.acao-desc { color: var(--muted); font-size: 0.82rem; line-height: 1.35; font-weight: 600; }
.acao-destaque {
  grid-column: 1 / -1;
  background: var(--amarelo);
  border: 3px solid var(--amarelo-escuro);
  box-shadow: 0 10px 24px rgba(232, 163, 61, 0.45);
}
.acao-destaque .acao-titulo { color: #262626; }
.acao-destaque .acao-desc { color: rgba(38, 38, 38, 0.75); }
.aviso-fotos {
  margin-top: 8px;
  display: inline-block;
  background: rgba(38, 38, 38, 0.14);
  color: #262626;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 800;
}

/* ---------- enviar foto ---------- */
.file-drop {
  display: block;
  border: 3px dashed rgba(241, 78, 144, 0.55);
  border-radius: var(--radius);
  background: rgba(255, 123, 172, 0.08);
  min-height: 170px;
  cursor: pointer;
  overflow: hidden;
  margin-bottom: 16px;
  position: relative;
}
.file-drop-vazio {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  padding: 16px;
}
.file-drop-vazio .icone { font-size: 2.4rem; }
#preview { width: 100%; max-height: 340px; object-fit: contain; background: #e8f4fc; }

.sucesso-envio { text-align: center; padding: 34px 20px; }
.sucesso-envio .icone { font-size: 3.4rem; }
.sucesso-envio h2 {
  font-family: var(--fonte-logo);
  font-size: 1.6rem;
  font-weight: 400;
  margin: 8px 0 6px;
  color: var(--azul);
}
.sucesso-envio p { color: var(--muted); margin-bottom: 20px; font-weight: 600; }
.sucesso-envio .botoes { display: flex; flex-direction: column; gap: 10px; }

.erro-msg {
  background: #fdecea;
  border: 2px solid rgba(226, 61, 46, 0.4);
  color: #c0392b;
  border-radius: 14px;
  padding: 11px 15px;
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 14px;
}

/* ---------- galeria ---------- */
.foto-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: 0 8px 20px rgba(16, 60, 100, 0.12);
}
.foto-img { width: 100%; max-height: 420px; object-fit: cover; }
.foto-body { padding: 15px 16px 16px; }
.foto-legenda { font-size: 1.02rem; font-weight: 700; margin-bottom: 4px; }
.foto-meta { color: var(--muted); font-size: 0.82rem; margin-bottom: 12px; font-weight: 600; }
.foto-meta b { color: var(--azul); }

.comentarios { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.comentario {
  background: #f2f8fc;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 0.88rem;
}
.comentario b { color: var(--rosa); }
.comentario .quando { color: var(--muted); font-size: 0.72rem; margin-left: 6px; }

.form-comentario { display: flex; flex-direction: column; gap: 8px; }
.form-comentario .linha { display: flex; gap: 8px; }
.form-comentario .linha input { flex: 1; }
.btn-enviar-com {
  flex-shrink: 0;
  width: 48px;
  border: none;
  border-radius: 14px;
  background: var(--grad);
  color: #fff;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--sombra-btn);
}

.vazio { text-align: center; padding: 50px 24px; color: var(--muted); font-weight: 600; }
.vazio .icone { font-size: 3rem; margin-bottom: 8px; }
.vazio h2 {
  font-family: var(--fonte-logo);
  color: var(--azul);
  font-size: 1.5rem;
  font-weight: 400;
  margin-bottom: 6px;
}
.vazio .btn { margin-top: 18px; }

/* ---------- jogo ---------- */
.jogo-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.placar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 10px rgba(16, 60, 100, 0.12);
}
#cronometro { color: var(--vermelho); font-size: 1.15rem; }
#pares { color: var(--rosa); }

.grade {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.mcard {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  perspective: 700px;
  -webkit-tap-highlight-color: transparent;
}
.mcard-inner {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  transform-style: preserve-3d;
  transition: transform 0.45s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.mcard.aberta .mcard-inner,
.mcard.certa .mcard-inner { transform: rotateY(180deg); }
.mcard-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 14px;
  overflow: hidden;
}
/* verso da carta: azul da Marge com bolinhas + donut */
.mcard-back {
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--azul);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.25) 5px, transparent 6px),
    radial-gradient(rgba(255, 255, 255, 0.25) 5px, transparent 6px);
  background-size: 42px 42px;
  background-position: 0 0, 21px 21px;
  border: 3px solid var(--azul-escuro);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.35);
}
.mcard-back span {
  font-size: 2.5rem;
  line-height: 1;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.3));
}
.mcard-front { transform: rotateY(180deg); background: #e8f4fc; }
.mcard-front img { width: 100%; height: 100%; object-fit: cover; }
.mcard.certa .mcard-inner { box-shadow: 0 0 0 3px var(--amarelo), 0 0 22px rgba(255, 217, 15, 0.65); border-radius: 14px; }
.mcard.certa { animation: pulinho 0.45s ease; }
.mcard.erro { animation: treme 0.35s ease; }

@keyframes pulinho {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes treme {
  20% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  80% { transform: translateX(-3px); }
}

/* contagem regressiva */
.contagem {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(16, 125, 192, 0.9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.contagem span {
  font-family: var(--fonte-logo);
  font-size: clamp(3.4rem, 22vw, 7rem);
  font-weight: 400;
  color: var(--amarelo);
  -webkit-text-stroke: 2px #262626;
  text-shadow: 4px 4px 0 var(--vermelho);
  white-space: nowrap;
  animation: contagem-pulso 0.8s ease infinite;
}
@keyframes contagem-pulso {
  0% { transform: scale(0.55); opacity: 0; }
  35% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 0.9; }
}

/* animação de par encontrado */
.match-pop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  background: rgba(11, 60, 100, 0.6);
}
.match-pop-card {
  background: #fff;
  border: 4px solid var(--amarelo);
  border-radius: 26px;
  padding: 24px 26px;
  text-align: center;
  max-width: 320px;
  width: 100%;
  animation: pop-in 0.38s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 24px 60px rgba(11, 40, 80, 0.45);
}
.match-pop-card img {
  width: 148px;
  height: 148px;
  object-fit: cover;
  border-radius: 18px;
  border: 4px solid var(--amarelo);
  margin: 0 auto 12px;
}
.match-pop-card .titulo {
  font-family: var(--fonte-logo);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--laranja);
}
.match-pop-card .fotografo { font-size: 1.3rem; font-weight: 800; color: var(--rosa); line-height: 1.15; }
.match-pop-card .legenda { color: var(--muted); font-size: 0.9rem; margin-top: 6px; font-weight: 600; }
@keyframes pop-in {
  0% { transform: scale(0.5) rotate(-4deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* tela final */
.fim { text-align: center; padding-top: 12px; }
.fim .medalha { font-size: 4.2rem; line-height: 1; }
.fim h2 {
  font-family: var(--fonte-logo);
  font-size: 2.4rem;
  font-weight: 400;
  margin: 6px 0 2px;
  color: var(--amarelo);
  -webkit-text-stroke: 1.5px #262626;
  text-shadow: 3px 3px 0 var(--vermelho);
}
.fim .fim-frase { color: var(--laranja); font-weight: 800; font-size: 1.05rem; margin-bottom: 2px; }
.fim .fim-detalhe { color: var(--muted); margin-bottom: 14px; font-weight: 600; }
.fim .fim-nome { font-size: 1.2rem; font-weight: 800; }
.fim .fim-tempo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--grad);
  color: #fff;
  border-radius: 999px;
  padding: 10px 26px;
  font-size: 1.5rem;
  font-weight: 800;
  margin: 10px 0 22px;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--sombra-btn);
}
.fim .botoes { display: flex; flex-direction: column; gap: 10px; max-width: 320px; margin: 0 auto; }

/* ---------- ranking: quadro-negro do Bart ---------- */
.quadro {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.06), transparent 60%),
    var(--verde-quadro);
  border: 10px solid var(--madeira);
  border-radius: 14px;
  padding: 18px 14px 14px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.3), 0 10px 26px rgba(16, 60, 100, 0.25);
}
.quadro-frase {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-align: center;
  border-bottom: 2px dashed rgba(255, 255, 255, 0.25);
  padding-bottom: 10px;
  margin-bottom: 12px;
  line-height: 1.6;
}
.quadro .rank-item {
  background: transparent;
  border: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  box-shadow: none;
  margin-bottom: 2px;
  color: #fff;
}
.quadro .rank-item:last-child { border-bottom: none; }
.quadro .rank-item.top1 { background: rgba(255, 217, 15, 0.16); }
.quadro .rank-item.me { background: rgba(255, 123, 172, 0.2); }
.quadro .rank-nome { color: #fff; }
.quadro .rank-quando { color: rgba(255, 255, 255, 0.55); }
.quadro .rank-pos { color: rgba(255, 255, 255, 0.75); }
.quadro .rank-tempo { color: var(--amarelo); }

.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
}
.rank-pos {
  flex-shrink: 0;
  width: 40px;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
}
.rank-pos .medalha { font-size: 1.5rem; }
.rank-info { flex: 1; min-width: 0; }
.rank-nome { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-quando { font-size: 0.75rem; }
.rank-tempo { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- confete (granulado de donut) ---------- */
.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  overflow: hidden;
}
.confete {
  position: absolute;
  top: -18px;
  border-radius: 999px;
  opacity: 0;
  animation: queda linear forwards;
}
@keyframes queda {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0.85; transform: translateY(108vh) rotate(680deg); }
}
