/* Viiva — visual de jogo: cores vivas, botões 3D que afundam, mascote, trilha e animação em tudo */
:root {
  --fundo: #FFFFFF; --fundo2: #F4F7F0; --tinta: #3C3C3C; --suave: #8A8F86; --linha: #E5E5E5;
  --verde: #3DBE5B; --verde-e: #2A9A43; --verde-c: #E3F7E7;
  --sol: #FFC233; --sol-e: #E0A100; --sol-c: #FFF5D6;
  --ceu: #3CB4F0; --ceu-e: #1E93CF; --ceu-c: #E2F4FD;
  --coral: #FF6B5B; --coral-e: #E04A3A; --coral-c: #FFE6E3;
  --roxo: #A570FF; --roxo-e: #8250DF; --roxo-c: #F1E8FF;
  --terra: #C77D4A; --fogo: #FF9600; --laranja: #FF9600; --laranja-e: #D97A00; --laranja-c: #FFEBD1;
  --raio: 18px; --txt: "Nunito", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fundo: #131F24; --fundo2: #1A2A30; --tinta: #F1F7FB; --suave: #8FA3AD; --linha: #37464F;
    --verde-c: #1E3A27; --sol-c: #3A3218; --ceu-c: #163243; --coral-c: #3D1F1C; --roxo-c: #2B2142;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fundo); color: var(--tinta); font: 700 17px/1.4 var(--txt); }
body { min-height: 100dvh; padding: env(safe-area-inset-top) 0 calc(86px + env(safe-area-inset-bottom)); overflow-x: hidden; }
body.cheia { padding-bottom: env(safe-area-inset-bottom); }
main { max-width: 520px; margin: 0 auto; padding: 12px 16px 28px; }
h1, h2, h3 { margin: 0; font-weight: 900; letter-spacing: -.01em; }
h1 { font-size: 30px; line-height: 1.1; } h2 { font-size: 24px; } h3 { font-size: 19px; }
p { margin: 6px 0; } .suave { color: var(--suave); } .peq { font-size: 14px; } .centro { text-align: center; }
button { font: inherit; cursor: pointer; border: 0; color: inherit; background: none; }

/* botão 3D (afunda ao tocar) */
.bt { --c: var(--verde); --e: var(--verde-e); display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 54px;
  padding: 0 22px; border-radius: 16px; background: var(--c); color: #fff; font-weight: 900; font-size: 17px; letter-spacing: .06em; text-transform: uppercase;
  box-shadow: 0 5px 0 var(--e); transition: transform .06s, box-shadow .06s; text-decoration: none; }
.bt:active { transform: translateY(5px); box-shadow: 0 0 0 var(--e); }
.bt.sol { --c: var(--sol); --e: var(--sol-e); color: #4A3500; } .bt.ceu { --c: var(--ceu); --e: var(--ceu-e); }
.bt.coral { --c: var(--coral); --e: var(--coral-e); } .bt.roxo { --c: var(--roxo); --e: var(--roxo-e); }
.bt.branco { --c: var(--fundo); --e: var(--linha); color: var(--ceu); border: 2px solid var(--linha); }
.bt:disabled { --c: var(--linha); --e: #cfcfcf; color: var(--suave); }
.cartao { background: var(--fundo); border: 2px solid var(--linha); border-radius: var(--raio); padding: 16px; margin: 14px 0; }
input, textarea { font: 700 17px var(--txt); color: var(--tinta); background: var(--fundo2); border: 2px solid var(--linha); border-radius: 14px; padding: 13px 14px; width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--ceu); }

/* barra de cima: ofensiva, gotas, xp */
.hud { position: sticky; top: 0; z-index: 4; background: var(--fundo); display: flex; justify-content: space-between; align-items: center;
  padding: 10px 2px 12px; border-bottom: 2px solid var(--linha); margin: -12px -2px 6px; }
.hud .item { display: flex; align-items: center; gap: 5px; font-weight: 900; font-size: 18px; }
.hud .fogo { color: var(--fogo); } .hud .gota { color: var(--ceu); } .hud .raio { color: var(--sol-e); }
.hud .apagado { filter: grayscale(1); opacity: .45; }
.chama { display: inline-block; animation: chama 1.1s ease-in-out infinite alternate; transform-origin: 50% 90%; }
@keyframes chama { from { transform: scale(1) rotate(-4deg); } to { transform: scale(1.12) rotate(4deg); } }

/* mascote Vivi */
.vivi { display: block; overflow: visible; }
.vivi .corpo { transform-origin: 50% 95%; animation: respira 2.6s ease-in-out infinite; }
.vivi.pula .corpo { animation: pula .7s cubic-bezier(.3, 1.6, .5, 1) infinite; }
.vivi.murcha .corpo { animation: murcha 2.4s ease-in-out infinite; }
.vivi.anda .corpo { animation: anda .5s ease-in-out infinite alternate; }
.vivi .olho { transform-box: fill-box; transform-origin: center; animation: pisca 4.2s infinite; }
.vivi .folha-e { transform-origin: 70% 100%; animation: abana 1.8s ease-in-out infinite alternate; transform-box: fill-box; }
.vivi .folha-d { transform-origin: 30% 100%; animation: abana 1.8s ease-in-out infinite alternate-reverse; transform-box: fill-box; }
@keyframes respira { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.03, .97); } }
@keyframes pula { 0%, 100% { transform: translateY(0) scale(1.05, .95); } 45% { transform: translateY(-22%) scale(.96, 1.06); } }
@keyframes murcha { 0%, 100% { transform: rotate(-6deg) translateY(3%); } 50% { transform: rotate(6deg) translateY(3%); } }
@keyframes anda { from { transform: rotate(-7deg) translateY(-2%); } to { transform: rotate(7deg) translateY(1%); } }
@keyframes pisca { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes abana { from { transform: rotate(-8deg); } to { transform: rotate(10deg); } }
.fala { position: relative; background: var(--fundo); border: 2px solid var(--linha); border-radius: 16px; padding: 12px 14px; font-weight: 800; animation: surge .35s cubic-bezier(.3, 1.5, .5, 1); }
.fala::before { content: ""; position: absolute; left: -10px; top: 22px; border: 8px solid transparent; border-right-color: var(--linha); border-left: 0; }
.fala::after { content: ""; position: absolute; left: -7px; top: 23px; border: 7px solid transparent; border-right-color: var(--fundo); border-left: 0; }
.conversa { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; margin: 10px 0 4px; }
@keyframes surge { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* trilha do dia */
.unidade { background: var(--verde); color: #fff; border-radius: 16px; padding: 14px 16px; box-shadow: 0 5px 0 var(--verde-e); margin: 8px 0 18px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.unidade small { display: block; opacity: .9; font-weight: 700; }
.trilha { position: relative; display: grid; justify-items: center; gap: 58px; padding: 46px 0 10px; }
.no { position: relative; width: 78px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-size: 34px;
  --c: var(--ceu); --e: var(--ceu-e); background: var(--c); box-shadow: 0 7px 0 var(--e); transition: transform .08s, box-shadow .08s; }
.no:active { transform: translateY(6px); box-shadow: 0 1px 0 var(--e); }
.no.feita { --c: var(--sol); --e: var(--sol-e); } .no.feita::after { content: "✓"; position: absolute; right: -4px; bottom: -6px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--verde); color: #fff; font-size: 17px; display: grid; place-items: center; border: 3px solid var(--fundo); }
.no.atual { animation: chama-no 1.6s ease-in-out infinite; }
.no.atual::before { content: ""; position: absolute; inset: -11px; border-radius: 50%; border: 6px solid var(--linha); border-top-color: var(--c); animation: gira 3s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
@keyframes chama-no { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.balao-no { position: absolute; bottom: calc(100% + 16px); left: 50%; transform: translateX(-50%); background: var(--fundo); border: 2px solid var(--linha); color: var(--c);
  border-radius: 12px; padding: 7px 12px; font-weight: 900; font-size: 14px; white-space: nowrap; letter-spacing: .05em; animation: flutua 1.4s ease-in-out infinite; z-index: 2; }
.balao-no::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 8px solid transparent; border-top-color: var(--linha); }
@keyframes flutua { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -5px); } }
.rotulo-no { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); font-size: 13px; font-weight: 900; white-space: nowrap; color: var(--suave); }
.bau { font-size: 52px; filter: grayscale(.6); opacity: .7; } .bau.aberto { filter: none; opacity: 1; animation: pula-bau .9s ease-in-out infinite; }
@keyframes pula-bau { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(6deg) scale(1.12); } }

/* missões */
.missao { display: grid; grid-template-columns: 44px 1fr 36px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 2px solid var(--linha); }
.missao:last-child { border-bottom: 0; } .missao .ic { font-size: 30px; text-align: center; }
.prog { position: relative; height: 18px; border-radius: 99px; background: var(--linha); overflow: hidden; margin-top: 6px; }
.prog i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: var(--sol); transition: width .8s cubic-bezier(.3, 1.3, .5, 1); }
.prog i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 4px; height: 4px; border-radius: 9px; background: rgba(255, 255, 255, .45); }
.prog span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 18px; font-weight: 900; color: var(--tinta); mix-blend-mode: normal; }
.prog.verde i { background: var(--verde); }

/* sessão */
.sessao-topo { display: grid; grid-template-columns: 36px 1fr 60px; gap: 12px; align-items: center; margin-bottom: 8px; }
.sessao-topo .x { font-size: 26px; color: var(--suave); }
.combo { font-weight: 900; color: var(--fogo); text-align: right; font-size: 15px; }
.anel { position: relative; width: min(72vw, 270px); aspect-ratio: 1; margin: 4px auto; }
.anel svg.arco { width: 100%; height: 100%; transform: rotate(-90deg); }
.anel .meio { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; }
.anel .tempo { font-size: 50px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.estado { text-align: center; font-weight: 900; padding: 12px 14px; border-radius: 16px; margin: 10px 0; transition: background .3s; }
.estado.ok { background: var(--verde-c); color: var(--verde-e); } .estado.nao { background: var(--coral-c); color: var(--coral-e); animation: treme .4s; }
@keyframes treme { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.sensores { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.sensores span { font-size: 13px; font-weight: 800; padding: 6px 11px; border-radius: 99px; border: 2px solid var(--linha); color: var(--suave); }
.sensores span.vivo { color: var(--verde-e); border-color: var(--verde-c); background: var(--verde-c); }
.foto-pede { border-color: var(--sol); background: var(--sol-c); }
textarea.diario { min-height: 38vh; font-size: 18px; line-height: 1.6; font-weight: 600; resize: vertical; }
.marco { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; pointer-events: none; }
.marco b { font-size: 34px; font-weight: 900; color: var(--fogo); background: var(--fundo); border: 3px solid var(--sol); border-radius: 20px; padding: 14px 22px;
  animation: marco 1.6s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes marco { 0% { transform: scale(.3); opacity: 0; } 20% { transform: scale(1.08); opacity: 1; } 75% { transform: scale(1); opacity: 1; } 100% { transform: scale(.9) translateY(-40px); opacity: 0; } }
.mais { position: fixed; font-weight: 900; color: var(--verde); pointer-events: none; animation: sobe 1.2s ease-out forwards; z-index: 15; }
@keyframes sobe { to { transform: translateY(-70px); opacity: 0; } }

/* fim de prática / ofensiva / nível */
.fim { text-align: center; padding-top: 4vh; }
.fim h1 { color: var(--sol-e); font-size: 32px; margin: 10px 0 18px; }
.placas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 24px; }
.placa { border: 2px solid var(--c, var(--sol)); border-radius: 16px; overflow: hidden; background: var(--c, var(--sol)); }
.placa small { display: block; color: #fff; font-weight: 900; font-size: 12px; padding: 4px 0; letter-spacing: .06em; text-transform: uppercase; }
.placa b { display: block; background: var(--fundo); padding: 12px 0; font-size: 24px; border-radius: 14px 14px 0 0; color: var(--c, var(--sol-e)); }
.fogo-grande { font-size: 120px; line-height: 1; animation: pula .9s cubic-bezier(.3, 1.6, .5, 1) 3; display: inline-block; }
.num-grande { font-size: 76px; font-weight: 900; color: var(--fogo); line-height: 1; }
.semana { display: flex; justify-content: center; gap: 8px; margin: 18px 0; }
.semana div { display: grid; justify-items: center; gap: 4px; font-size: 13px; color: var(--suave); }
.semana i { width: 34px; height: 34px; border-radius: 50%; background: var(--linha); display: grid; place-items: center; font-style: normal; font-size: 16px; }
.semana i.on { background: var(--fogo); color: #fff; animation: surge .4s cubic-bezier(.3, 1.6, .5, 1) backwards; }
.confete { position: fixed; top: -14px; width: 10px; height: 16px; border-radius: 3px; animation: cai linear forwards; z-index: 30; pointer-events: none; }
@keyframes cai { to { transform: translateY(112vh) rotate(800deg); } }

/* liga */
.liga-topo { text-align: center; padding: 10px 0 4px; } .liga-topo .trofeu { font-size: 74px; animation: chama-no 2s ease-in-out infinite; display: inline-block; }
.pos { display: grid; grid-template-columns: 34px 46px 1fr auto; gap: 10px; align-items: center; padding: 10px 6px; border-radius: 14px; }
.pos.eu { background: var(--verde-c); } .pos .n { font-weight: 900; text-align: center; color: var(--suave); }
.pos .av { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; font-weight: 900; color: #fff; }

/* jardim, humor, cronograma */
.humor { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 3px; }
.humor button { aspect-ratio: 1; padding: 0; border-radius: 10px; border: 2px solid var(--linha); font-weight: 900; font-size: 14px; box-shadow: 0 3px 0 var(--linha); }
.humor button.on { background: var(--ceu); border-color: var(--ceu-e); color: #fff; box-shadow: 0 3px 0 var(--ceu-e); }
.linha-crono { display: grid; grid-template-columns: 30px 1fr 52px; grid-template-areas: "ic nome liga" ". hora hora"; gap: 8px 10px; align-items: center; padding: 12px 0; border-bottom: 2px solid var(--linha); }
.linha-crono > :nth-child(1) { grid-area: ic; font-size: 24px; } .linha-crono > :nth-child(2) { grid-area: nome; } .linha-crono > :nth-child(5) { grid-area: liga; }
.linha-crono .hm { grid-area: hora; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; } .linha-crono .hm label { font-size: 12px; color: var(--suave); }
.interruptor { width: 52px; height: 30px; border-radius: 99px; background: var(--linha); position: relative; }
.interruptor::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; }
.interruptor.on { background: var(--verde); } .interruptor.on::after { left: 25px; }
.item-hist { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 2px solid var(--linha); }
.item-hist .ic { font-size: 28px; text-align: center; }

/* abas */
#abas { position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around; background: var(--fundo); border-top: 2px solid var(--linha);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom)); z-index: 6; }
#abas[hidden] { display: none; }
#abas button { display: grid; place-items: center; width: 62px; height: 52px; border-radius: 14px; font-size: 28px; border: 2px solid transparent; filter: grayscale(.4); }
#abas button.on { border-color: var(--ceu); background: var(--ceu-c); filter: none; }
#abas button span { display: none; }
#aviso { position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 40;
  background: var(--tinta); color: var(--fundo); padding: 11px 18px; border-radius: 14px; font-weight: 800; transition: .25s; max-width: 92vw; text-align: center; }
#aviso.on { opacity: 1; transform: translateX(-50%); }
.entra { animation: entra .4s cubic-bezier(.3, 1.3, .5, 1) backwards; }
@keyframes entra { from { transform: translateY(18px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
