/* Cobrir Sílabas: visual "Caderno de adesivos" (tokens copiados de site/style.css, para o jogo ser independente) */
:root {
  --y: #ffd43b;
  --ink: #3a2a17;
  --paper: #fffdf5;
  --pink: #ff6f91;
  --sky: #4cc3ff;
  --leaf: #4ccf7a;
  --orange: #ff9f1c;
  --display: "Gluten", "Comic Sans MS", cursive;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --emoji: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  /* fundo próprio do Cobrir Sílabas (cada jogo tem o seu, veja o CLAUDE.md): turquesa com linhas tracejadas,
     como a folha de cobrir letras. A 1ª camada "apaga" um pedaço de cada linha, e sobram os tracinhos. */
  --fundo: #86dccf;
  --fundo-img: linear-gradient(90deg, #86dccf 12px, transparent 12px), linear-gradient(transparent 31px, #6cc8ba 31px);
  --fundo-tam: 22px 34px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  overflow: hidden;
  overscroll-behavior: none;
  background-color: var(--fundo);
  background-image: var(--fundo-img);
  background-size: var(--fundo-tam);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; cursor: var(--c-dedo); }
.hidden { display: none !important; }
h1, h2 { font-family: var(--display); font-weight: 800; margin: 0; line-height: 1.1; }
h1 { font-size: clamp(32px, 6vw, 46px); }

/* ---------- camadas ---------- */
.fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 50; pointer-events: none; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center;
  padding: calc(14px + var(--safe-t)) 16px 14px calc(16px + var(--safe-l));
  pointer-events: none;
}
/* no menu, que rola, uma faixa atrás do Início e do som para o texto não passar por baixo. Ela usa o mesmo fundo
   da página e some embaixo, para o texto passar por trás suavemente */
body.paging .topbar {
  padding-bottom: 22px;
  background-color: var(--fundo);
  background-image: var(--fundo-img);
  background-size: var(--fundo-tam);
  background-position: 0 0;
  -webkit-mask-image: linear-gradient(#000 75%, transparent);
  mask-image: linear-gradient(#000 75%, transparent);
}
.topbar .home-link { pointer-events: auto; }
body.playing .topbar { display: none; }

/* Botão "Início": volta para a lista de jogos do laurinha.net */
.home-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 16px 6px 10px;
  font-family: var(--display); font-weight: 800; font-size: 20px;
  color: var(--ink); text-decoration: none;
  background: var(--y); border: 3px solid var(--ink); border-radius: 999px;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.home-link svg { width: 22px; height: 22px; }
.home-link:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

/* ---------- som (sempre à mão) ---------- */
.sound-dock {
  position: fixed; z-index: 40; top: calc(12px + var(--safe-t)); right: calc(14px + var(--safe-r));
  display: flex; gap: 10px;
}
.round-btn {
  flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: var(--paper); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.round-btn svg { width: 28px; height: 28px; }
.round-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
#btnMute .off { display: none; }
#btnMute[aria-pressed="true"] { background: #ffd6de; }
#btnMute[aria-pressed="true"] .on { display: none; }
#btnMute[aria-pressed="true"] .off { display: inline; }

/* ---------- telas ---------- */
.screen {
  position: fixed; inset: 0; z-index: 1;
  display: grid; place-items: center;
  padding: calc(84px + var(--safe-t)) calc(16px + var(--safe-r)) calc(20px + var(--safe-b)) calc(16px + var(--safe-l));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.scroll { place-items: start center; }
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  padding: calc(84px + var(--safe-t)) 16px calc(16px + var(--safe-b));
  background: rgba(58, 42, 23, .35);
  overflow: auto;
}

.panel {
  display: grid; gap: 14px; justify-items: center; text-align: center;
  width: min(560px, 100%);
  padding: 24px 22px 26px;
  background: var(--paper);
  border: 4px solid var(--ink); border-radius: 26px; box-shadow: 7px 7px 0 var(--ink);
  transform: rotate(-.8deg);
  animation: pop .35s cubic-bezier(.3, 1.4, .5, 1) both;
}
@keyframes pop { from { transform: scale(.85) rotate(-3deg); opacity: 0; } }
.sub { margin: -6px 0 2px; font-weight: 800; }
.big-text { margin: 0; font-size: 22px; font-weight: 800; }

/* ---------- botões ---------- */
.btn {
  display: inline-block; font-family: var(--display); font-weight: 800; font-size: 24px; line-height: 1.1;
  background: var(--pink); color: var(--paper); border: 3px solid var(--ink); border-radius: 16px;
  padding: 8px 22px 10px; box-shadow: 4px 4px 0 var(--ink); text-decoration: none; min-height: 52px;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn.big { font-size: 34px; padding: 10px 34px 12px; border-radius: 20px; box-shadow: 5px 5px 0 var(--ink); min-height: 66px; }
.btn.alt { background: var(--sky); color: var(--ink); }
.btn.leaf { background: var(--leaf); color: var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.btns { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; }

/* modo: dois botões grandes que ficam "apertados" quando escolhidos */
.modes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: min(400px, 100%); }
.mode {
  display: grid; justify-items: center; align-content: center; gap: 4px; padding: 10px 6px; min-height: 64px;
  background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--ink);
  font-weight: 900; font-size: 17px; line-height: 1.15;
  transition: transform .12s ease, box-shadow .12s ease, background .12s;
}
.mode .mi { width: 34px; height: 34px; }
.mode[aria-checked="true"] { background: var(--leaf); transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.play { margin-top: 4px; }
.dots { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); background: #fff; }
.dots i.on { background: var(--y); box-shadow: inset 0 0 0 2px #fff6c8; }
.dots i.agora { outline: 3px solid var(--pink); outline-offset: 1px; }

/* ---------- menu: a trilha ---------- */
.menu { width: min(980px, 100%); display: grid; gap: 22px; justify-items: center; padding-bottom: 30px; }
.menu-top { width: min(560px, 100%); }
.trilha { width: 100%; display: grid; gap: 18px; }
.grupo { display: grid; gap: 12px; }
.grupo h2 {
  justify-self: start; font-size: clamp(22px, 4.6vw, 30px); background: var(--ink); color: var(--y);
  padding: 4px 16px 6px; border-radius: 14px; transform: rotate(-1.5deg);
}
.familias { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.fam {
  position: relative; display: grid; justify-items: center; align-content: center; gap: 4px;
  min-height: 136px; padding: 12px 8px 12px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 4px 4px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.fam:nth-child(4n+1) { background: #ffe3ea; transform: rotate(-1.2deg); }
.fam:nth-child(4n+2) { background: #dff3ff; transform: rotate(.9deg); }
.fam:nth-child(4n+3) { background: #ddf7e6; transform: rotate(-.5deg); }
.fam:nth-child(4n) { background: #fff0d6; transform: rotate(1.3deg); }
.fam:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }
.fam-letra { font-family: var(--display); font-weight: 800; font-size: 46px; line-height: 1; white-space: nowrap; }
.fam-letra.longo { font-size: 32px; }
.fam-letra.bem-longo { font-size: 25px; }
.fam-sil { font-weight: 900; font-size: 14px; letter-spacing: .04em; opacity: .8; }
.fam .feita {
  position: absolute; top: -12px; right: -10px; font-family: var(--emoji); font-size: 30px; line-height: 1;
  transform: rotate(12deg);
}

/* ---------- jogo ---------- */
.game {
  display: flex; flex-direction: column; gap: 10px; place-items: stretch;
  padding: calc(12px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l));
  overflow: hidden;
  touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.game-head { display: flex; align-items: center; gap: 10px; min-height: 56px; padding-right: 66px; }
body:not(.playing) .game-head { visibility: hidden; }
.round-title {
  font-size: clamp(18px, 4.6vw, 30px); background: var(--ink); color: var(--y);
  padding: 4px 16px 6px; border-radius: 14px; transform: rotate(-1.5deg);
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-head .dots { flex-wrap: nowrap; }
.palco { flex: 1; min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr); gap: 14px; }
.palco.revelar { grid-template-rows: minmax(0, 1fr) auto; }
.palco.wide.revelar { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: minmax(0, 1fr); }

/* a folha onde fica a sílaba */
.quadro {
  position: relative; min-height: 0; min-width: 0;
  background: var(--paper); border: 4px solid var(--ink); border-radius: 26px; box-shadow: 7px 7px 0 var(--ink);
}
/* a sílaba ocupa a folha toda (posição absoluta: assim o SVG nunca empurra a folha para fora da tela) */
.silaba { position: absolute; top: 8px; left: 8px; width: calc(100% - 16px); height: calc(100% - 16px); display: block; touch-action: none; overflow: visible; cursor: var(--c-lapis); }
.silaba path, .silaba line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.silaba .trilho-borda path { stroke: var(--ink); stroke-width: 31; }
.silaba .trilho-miolo path { stroke: #fff; stroke-width: 24; }
.silaba .guia path { stroke: rgba(58, 42, 23, .42); stroke-width: 4; stroke-dasharray: 0 9; }
.silaba .linhas line { stroke: rgba(58, 42, 23, .28); stroke-width: 2.5; stroke-dasharray: 10 9; }
.silaba .feitos path { stroke-width: 20; }
.silaba .feitos path.novo { animation: tracoFeito .45s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes tracoFeito { from { stroke-width: 30; } }
.silaba .risco { stroke-width: 18; opacity: .92; }
.silaba.sem .risco { stroke-width: 15; opacity: 1; }
.silaba .dot { fill: var(--leaf); stroke: var(--ink); stroke-width: 3.5; transform-box: fill-box; transform-origin: center; animation: respira 1.6s ease-in-out infinite; }
.silaba .marca.chama .dot { animation: chama .45s ease 2; }
@keyframes respira { 50% { transform: scale(1.18); } }
@keyframes chama { 50% { transform: scale(1.7); fill: var(--y); } }
.silaba .seta { stroke: var(--ink); stroke-width: 4.5; }
.silaba .estrela { fill: var(--y); stroke: var(--ink); stroke-width: 2.5; }
.silaba.pronta { animation: yay .8s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes yay {
  0% { transform: scale(1); }
  30% { transform: scale(1.1) rotate(-3deg) translateY(-8px); }
  55% { transform: scale(.97) rotate(2deg); }
  80% { transform: scale(1.02) rotate(-.5deg); }
  100% { transform: scale(1) rotate(0); }
}

/* sem pontilhado: o modelo da sílaba, num adesivo pequeno acima da folha */
.modelo {
  flex: none; align-self: center; height: clamp(58px, 12vh, 104px); padding: 6px 16px;
  background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 4px 4px 0 var(--ink);
  transform: rotate(-1deg);
}
.modelo svg { height: 100%; width: auto; display: block; }
.modelo path { fill: none; stroke: var(--ink); stroke-width: 15; stroke-linecap: round; stroke-linejoin: round; }

/* as 2 palavras que começam com a sílaba */
.exemplos { display: grid; gap: 14px; justify-items: center; align-content: center; animation: sobe .45s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes sobe { from { transform: translateY(40px); opacity: 0; } }
.cartoes { display: flex; gap: 16px; justify-content: center; }
.palco.wide .cartoes { flex-direction: column; }
.cartao {
  width: min(40vw, 24vh, 210px); container-type: inline-size;
  display: grid; justify-items: center; gap: 2px; padding: 8px 6px 10px;
  background: #fff; border: 4px solid var(--ink); border-radius: 22px; box-shadow: 5px 5px 0 var(--ink);
  transition: transform .15s ease, box-shadow .15s ease, background .15s;
}
.palco.wide .cartao { width: min(26vw, 25vh, 200px); }
.cartao:nth-child(1) { transform: rotate(-2deg); }
.cartao:nth-child(2) { transform: rotate(1.6deg); }
.cartao .fig { font-family: var(--emoji); font-size: 46cqw; line-height: 1.15; }
.cartao .pal { font-family: var(--display); font-weight: 800; font-size: 13cqw; line-height: 1.1; letter-spacing: .02em; white-space: nowrap; }
.cartao .pal.longa { font-size: 10cqw; }
.cartao .pal b { color: var(--pink); }
.cartao.falando { background: #fff6c8; transform: scale(1.07) rotate(0); box-shadow: 7px 9px 0 var(--ink), 0 0 0 8px rgba(255, 212, 59, .8); }
.palco.wide .exemplos .btn.big { font-size: 28px; padding: 8px 22px 10px; }

/* balão de fala e carimbo */
.bubble {
  position: fixed; z-index: 46; left: 50%; top: calc(76px + var(--safe-t));
  width: max-content; max-width: min(560px, calc(100% - 32px));
  transform: translate(-50%, -10px) scale(.9); opacity: 0; pointer-events: none;
  padding: 8px 20px 10px; background: var(--paper); border: 3px solid var(--ink); border-radius: 22px;
  box-shadow: 4px 4px 0 var(--ink);
  font-family: var(--display); font-weight: 800; font-size: clamp(20px, 4vw, 30px); text-align: center;
  transition: opacity .2s ease, transform .25s cubic-bezier(.3, 1.4, .5, 1);
}
.bubble.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.stamp {
  position: fixed; z-index: 55; left: 50%; top: 24%; pointer-events: none; opacity: 0;
  font-family: var(--display); font-weight: 800; font-size: clamp(56px, 14vw, 120px); line-height: 1; white-space: nowrap;
  -webkit-text-stroke: 5px var(--ink); paint-order: stroke fill; text-shadow: 6px 6px 0 var(--ink);
  transform: translate(-50%, -50%) rotate(var(--rot, -10deg)) scale(3);
}
.stamp.go { animation: stamp 1.3s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes stamp {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot)) scale(3); }
  18% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot)) scale(.92); }
  28% { transform: translate(-50%, -50%) rotate(var(--rot)) scale(1.04); }
  75% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--rot)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--rot)) scale(1.1); }
}

/* fim da família */
.party h1 { font-size: clamp(34px, 7vw, 52px); }
.medal { display: flex; gap: 6px; font-family: var(--emoji); font-size: 48px; line-height: 1; }
.medal span { animation: jump 1s cubic-bezier(.3, 1.4, .5, 1) both; }
.medal span:nth-child(2) { animation-delay: .15s; font-size: 62px; }
.medal span:nth-child(3) { animation-delay: .3s; }
@keyframes jump { from { transform: translateY(30px) scale(0) rotate(-40deg); } }

/* ---------- hover só onde existe mouse ---------- */
@media (hover: hover) {
  .home-link:hover, .home-link:focus-visible { transform: translate(-1px, -2px); box-shadow: 4px 5px 0 var(--ink); outline: none; }
  .btn:hover { transform: translate(-1px, -2px); box-shadow: 5px 6px 0 var(--ink); }
  .round-btn:hover, .mode:not([aria-checked="true"]):hover, .fam:hover { transform: translate(-1px, -2px); box-shadow: 4px 5px 0 var(--ink); }
  .cartao:not(.falando):hover { transform: translateY(-3px); }
}

@media (max-width: 520px) {
  .panel { padding: 20px 14px 22px; }
  .mode { font-size: 15px; }
  .btn.big { font-size: 30px; }
  .familias { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 12px; }
  .fam { min-height: 120px; }
  .fam-letra { font-size: 40px; }
  .game-head .dots { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stamp { display: none; }
}
