/* =========================================================
   WIDGETS — peças interativas dentro do leitor
   ========================================================= */

.wg {
  margin: 0 auto 24px;
  padding: 20px clamp(14px, 3vw, 22px);
  border-radius: 18px;
  background: rgba(255, 255, 255, .045);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}
.wg-tit {
  margin-bottom: 14px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #c9b6ff;
}
.wg-sub { margin: -6px 0 14px; font-size: 14px; color: var(--tinta-fraca); }
.wg-nota {
  margin: 14px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--tinta-fraca);
}

.wg-btn {
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  font-size: 14.5px;
  padding: 11px 17px;
  border-radius: 999px;
  color: #2a0630;
  background: linear-gradient(180deg, #ffd96b, #f5a623);
  transition: transform .1s ease, filter .15s ease;
}
.wg-btn:hover:not(:disabled) { filter: brightness(1.07); }
.wg-btn:active:not(:disabled) { transform: scale(.97); }
.wg-btn:disabled { opacity: .45; cursor: default; }
.wg-btn--ghost {
  color: var(--tinta);
  background: rgba(255, 255, 255, .09);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}

/* ---------------- demos ---------------- */

.demo {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: 20px;
  align-items: center;
}
.demo--mapas, .demo--espelhos, .demo--frase { grid-template-columns: 1fr; }
@media (max-width: 560px) { .demo { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

.demo-svg { width: 100%; max-width: 200px; height: auto; display: block; }
.demo-svg--larga { max-width: 100%; }
.demo-lado { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
@media (max-width: 560px) { .demo-lado { align-items: center; } }
.demo-txt { margin: 0; font-size: 15px; line-height: 1.6; color: var(--tinta); }
.demo-saida {
  margin: 2px 0 0;
  min-height: 1.2em;
  font-size: 14.5px;
  line-height: 1.6;
  color: #ffe6b0;
}
.demo-aviso {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--tinta-fraca);
  border-left: 2px solid rgba(255, 106, 122, .5);
  padding-left: 10px;
}

/* geladeira */
.demo--fome .porta {
  transform-origin: 60px 100px;
  transition: transform .7s cubic-bezier(.2, .8, .3, 1);
}
.demo--fome.aberta .porta { transform: perspective(420px) rotateY(-105deg); }
.demo--fome .prateleiras { transition: opacity .5s .25s ease; }
.demo--fome.aberta .prateleiras { opacity: 1; }

/* frase autorrefutante */
.frase-alvo {
  margin: 0 0 16px;
  text-align: center;
  font-size: clamp(24px, 6vw, 40px);
  font-weight: 800;
  letter-spacing: -.01em;
  transition: transform .5s ease, opacity .5s ease, color .3s ease;
}
.demo--frase.quebrada .frase-alvo { color: #ff6a7a; transform: rotate(-3deg) scale(.92); }
.demo--frase.quebrada .frase-alvo::after {
  content: "";
  display: block;
  height: 3px;
  margin: -20px auto 0;
  width: 70%;
  background: #ff6a7a;
  animation: risca .4s ease forwards;
}
@keyframes risca { from { width: 0; } }
.demo--frase.descartada .frase-alvo { opacity: .25; transform: translateY(10px) scale(.9); }
.frase-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.demo--frase .demo-saida { text-align: center; margin-top: 14px; }

/* mapas */
.demo--mapas .camada-metro, .demo--mapas .camada-parque { transition: opacity .45s ease; }
.demo--mapas.parque .camada-metro { opacity: .12; }
.demo--mapas.parque .camada-parque { opacity: 1; }
.demo--mapas .demo-lado { flex-direction: row; flex-wrap: wrap; align-items: center; }
.demo--mapas .demo-saida { flex: 1 0 100%; }

/* vela */
.demo--vela .corpo {
  transform-origin: 100px 188px;
  transition: transform 2.4s ease;
}
.demo--vela.acesa .corpo { transform: scaleY(.62); }
.demo--vela .chama { transition: opacity .4s ease; transform-origin: 100px 60px; }
.demo--vela.acesa .chama { opacity: 1; animation: tremula 1.1s ease-in-out infinite; }
.demo--vela.acesa .poca { opacity: 1; transition: opacity 1.6s .8s ease; }
@keyframes tremula { 50% { transform: scale(1.08) translateY(-2px); } }
.demo--vela.tremendo .corpo { animation: nao .5s ease; }
@keyframes nao { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.tag {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .14em;
}
.tag--pot { color: #c7b6ff; background: rgba(143, 123, 255, .2); box-shadow: inset 0 0 0 1px rgba(143, 123, 255, .5); }
.tag--ato { color: #ffd86b; background: rgba(255, 216, 107, .16); box-shadow: inset 0 0 0 1px rgba(255, 216, 107, .55); }
.estado-txt { margin: 8px 0 0; font-size: 14.5px; line-height: 1.6; }

/* espelhos */
.demo--espelhos .esp rect { transition: fill .35s ease, stroke .35s ease; transition-delay: var(--d); }
.demo--espelhos.aceso .esp rect { fill: #ffe6a3; stroke: #fff3cf; }
.demo--espelhos .halo, .demo--espelhos .bulbo { transition: opacity .3s ease, fill .3s ease; }
.demo--espelhos.aceso .halo { opacity: .55; }
.demo--espelhos.aceso .bulbo { fill: #ffd86b; }
.demo--espelhos .demo-lado { flex-direction: row; flex-wrap: wrap; align-items: center; }
.demo--espelhos .demo-txt, .demo--espelhos .demo-saida { flex: 1 0 100%; }

/* buraco */
.demo--buraco .furo { transition: r .5s ease, opacity .5s ease; }
.demo--buraco.remendada .furo { r: 0; opacity: 0; }

/* ---------------- passos ---------------- */

.wg-passos { margin: 0; padding: 0; list-style: none; counter-reset: p; }
.wg-passos li {
  position: relative;
  counter-increment: p;
  padding: 0 0 16px 46px;
}
.wg-passos li::before {
  content: counter(p);
  position: absolute;
  left: 0; top: 0;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
  color: #2a0630;
  background: linear-gradient(180deg, #c9b6ff, #8f7bff);
}
.wg-passos li::after {
  content: "";
  position: absolute;
  left: 14.5px; top: 32px; bottom: 4px;
  width: 2px;
  background: linear-gradient(180deg, rgba(143, 123, 255, .7), rgba(143, 123, 255, .15));
}
.wg-passos li:last-child { padding-bottom: 0; }
.wg-passos li:last-child::after { display: none; }
.wg-passos li:last-child::before { background: linear-gradient(180deg, #ffd96b, #f5a623); }
.wg-passos span { font-size: 15.5px; line-height: 1.6; }

/* ---------------- cartas que viram ---------------- */

.wg-cartas {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
}
.carta {
  position: relative;
  min-height: 96px;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: var(--tinta);
  background: rgba(143, 123, 255, .14);
  box-shadow: inset 0 0 0 1px rgba(143, 123, 255, .4);
  transition: background .2s ease, transform .12s ease;
}
.carta:hover { background: rgba(143, 123, 255, .22); }
.carta:active { transform: scale(.98); }
.carta-f {
  display: block;
  font-size: 15.5px;
  font-weight: 800;
  color: #d9c8ff;
}
.carta-f::after {
  content: "toque";
  display: block;
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .35);
}
.carta-v {
  display: block;
  max-height: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.55;
  opacity: 0;
  transition: max-height .3s ease, opacity .25s ease, margin .3s ease;
}
.carta.aberta { background: rgba(255, 203, 46, .12); box-shadow: inset 0 0 0 1px rgba(255, 203, 46, .45); }
.carta.aberta .carta-f { color: #ffd96b; }
.carta.aberta .carta-f::after { content: ""; margin: 0; }
.carta.aberta .carta-v { max-height: 340px; opacity: 1; margin-top: 8px; }

/* ---------------- abas ---------------- */

.abas-btns {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 14px;
  scrollbar-width: none;
}
.abas-btns::-webkit-scrollbar { display: none; }
.aba-btn {
  flex: 0 0 auto;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  padding: 9px 15px;
  border-radius: 999px;
  color: var(--tinta-fraca);
  background: rgba(255, 255, 255, .06);
  transition: background .16s ease, color .16s ease;
}
.aba-btn:hover { color: var(--tinta); }
.aba-btn.on {
  color: #2a0630;
  background: linear-gradient(180deg, #ffd96b, #f5a623);
}
.aba-painel { display: none; font-size: 15.5px; line-height: 1.7; }
.aba-painel.on { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
.aba-painel p { margin: 0 0 10px; }
.aba-painel ul { margin: 0 0 10px; padding-left: 18px; }
.aba-painel li { margin-bottom: 6px; }

/* ---------------- linha do tempo ---------------- */

.wg-linha { margin: 0; padding: 0; list-style: none; }
.wg-linha li {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 0 0 18px 0;
}
.wg-linha li::before {
  content: "";
  position: absolute;
  left: 73px; top: 20px; bottom: -2px;
  width: 2px;
  background: rgba(255, 255, 255, .16);
}
.wg-linha li:last-child::before { display: none; }
.wg-linha .ano {
  flex: 0 0 66px;
  text-align: right;
  font-size: 13px;
  font-weight: 800;
  color: #c9b6ff;
  padding-top: 2px;
}
.wg-linha .corpo {
  position: relative;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.55;
}
.wg-linha .corpo::before {
  content: "";
  position: absolute;
  left: -6px; top: 6px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #8f7bff;
  box-shadow: 0 0 0 3px rgba(143, 123, 255, .2);
}
.wg-linha .corpo em { display: block; margin-top: 3px; font-size: 13.5px; color: var(--tinta-fraca); font-style: normal; }
.wg-linha .forte .corpo::before { background: #ffd96b; box-shadow: 0 0 0 4px rgba(255, 217, 107, .25); }
.wg-linha .forte .ano { color: #ffd96b; }
.wg-linha .fora { opacity: .62; }
.wg-linha .fora .corpo::before { background: #ff6a7a; box-shadow: 0 0 0 3px rgba(255, 106, 122, .2); }

/* ---------------- matriz ---------------- */

.wg-matriz-rolo { overflow-x: auto; }
.wg-matriz {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 14px;
}
.wg-matriz th, .wg-matriz td {
  padding: 10px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .1);
  text-align: center;
}
.wg-matriz thead th {
  font-size: 12px;
  font-weight: 700;
  color: var(--tinta-fraca);
  line-height: 1.3;
  vertical-align: bottom;
}
.wg-matriz tbody th {
  text-align: left;
  font-weight: 600;
  color: var(--tinta);
  min-width: 168px;
}
.wg-matriz td { font-size: 17px; font-weight: 800; }
.c-s { color: #35d6a6; }
.c-p { color: #ffd166; }
.c-n { color: #ff6a7a; }
.wg-legenda { margin: 12px 0 0; font-size: 13px; color: var(--tinta-fraca); }
.wg-legenda span { font-weight: 800; margin-left: 4px; }

/* ---------------- citações ---------------- */

.wg-citacoes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.cit {
  padding: 15px;
  border-radius: 14px;
  background: rgba(0, 0, 0, .28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.cit header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.cit header strong { font-size: 15px; }
.cit header span { font-size: 12px; font-weight: 700; color: #c9b6ff; white-space: nowrap; }
.cit p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.6; }
.cit a { font-size: 13px; font-weight: 700; color: #ff9ce8; }

/* ---------------- escada ---------------- */

.wg-escada { margin: 0; padding: 0; list-style: none; }
.wg-escada li { padding-left: calc(var(--n) * 13px); }
.wg-escada .deg {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 5px;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  background: linear-gradient(90deg, rgba(143, 123, 255, .26), rgba(143, 123, 255, .07));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
}
.wg-escada b {
  flex: 0 0 auto;
  width: 22px; height: 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-size: 12px;
  color: #2a0630;
  background: #c9b6ff;
}
.wg-escada li:last-child .deg { background: linear-gradient(90deg, rgba(255, 203, 46, .3), rgba(255, 203, 46, .08)); }
.wg-escada li:last-child b { background: #ffd96b; }

/* ---------------- checklist ---------------- */

.wg-check { display: flex; flex-direction: column; gap: 8px; }
.ck {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 13px;
  border-radius: 11px;
  cursor: pointer;
  font-size: 14.5px;
  line-height: 1.5;
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  transition: background .15s ease;
}
.ck:hover { background: rgba(255, 255, 255, .09); }
.ck input { margin-top: 3px; accent-color: #35d6a6; width: 17px; height: 17px; flex: 0 0 auto; }
.ck-placar {
  margin-top: 6px;
  padding: 14px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  background: rgba(255, 203, 46, .1);
  box-shadow: inset 0 0 0 1px rgba(255, 203, 46, .3);
}
.ck-num { font-size: 20px; color: #ffd96b; }
.ck-verdito { margin: 6px 0 0; font-size: 14px; font-weight: 400; line-height: 1.6; color: var(--tinta); }

@media (prefers-reduced-motion: reduce) {
  .demo--vela .corpo, .demo--fome .porta, .carta-v { transition: none; }
  .demo--vela.acesa .chama { animation: none; }
}

@media (max-width: 720px) {
  .wg {
    margin-bottom: 17px;
    padding: 15px 13px;
    border-radius: 15px;
  }
  .wg-btn {
    min-height: 46px;
    padding: 11px 16px;
    touch-action: manipulation;
  }
  .demo { gap: 13px; }
  .demo-svg { max-height: 190px; }
  .demo-lado { width: 100%; }
  .demo-lado .wg-btn { width: min(100%, 290px); }
  .demo--mapas .demo-lado { justify-content: center; }
  .demo--mapas .wg-btn { width: auto; }
  .frase-btns { width: 100%; }
  .frase-btns .wg-btn { flex: 1 1 180px; }
  .carta { min-height: 104px; padding: 13px; touch-action: manipulation; }
  .wg-abas .aba-btn { min-height: 44px; }
  .ck { min-height: 46px; }
}

@media (max-width: 360px) {
  .wg { padding-inline: 11px; }
  .wg-cartas { grid-template-columns: 1fr; }
  .frase-alvo { font-size: 27px; }
  .demo-svg { max-height: 170px; }
}
