/*
  Base visual das animações de /tutoriais (par do animacao.js): o celular, o painel
  de passos, o quadro de gravação (#gif) e as peças do app que se repetem entre os
  tutoriais (campos, câmera do QR, aviso e o "dedo").
  As telas específicas de cada tutorial ficam no CSS da própria página (ou no uso.css).
*/

:root {
  --bezel: #0E2530;
  --bezel-ring: #0E2530;

  /* Cores do app dentro do celular: é sempre o tema claro do app, nos dois temas da página. */
  --app-navy: #0E2530;
  --app-navy-2: #143140;
  --app-teal: #2C5F5D;
  --app-lime: #C6F23D;
  --app-ink: #0A1A22;
  --app-gray: #5C6970;
  --app-light: #F4F4F4;
  --app-white: #FFFFFF;
  --app-red: #DC2626;
}
@media (prefers-color-scheme: dark) {
  :root { --bezel: #050F14; --bezel-ring: #2A4955; }
}

/* ---------- Palco ---------- */
.stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
@media (max-width: 760px) {
  .stage { grid-template-columns: minmax(0, 1fr); gap: 28px; justify-items: center; }
  .panel { width: 100%; max-width: 480px; }
}

/* ---------- Celular ---------- */
.phone {
  width: 290px; padding: 10px; border-radius: 46px; background: var(--bezel); position: relative;
  box-shadow:
    0 0 0 1px var(--bezel-ring),
    0 30px 60px -20px rgba(14, 37, 48, .45),
    0 12px 24px -12px rgba(14, 37, 48, .35);
}
.glass { width: 270px; height: 562px; border-radius: 36px; overflow: hidden; position: relative; background: var(--app-light); }
/* A tela é desenhada em 375px (largura de celular real) e reduzida para caber. */
.screen {
  width: 375px; height: 780px; transform: scale(.72); transform-origin: 0 0;
  position: relative; overflow: hidden;
  font-family: var(--font); color: var(--app-ink); font-size: 15px; line-height: 1.35;
}
.island {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 110px; height: 32px; border-radius: 20px; background: #050F14; z-index: 30;
}
.status {
  position: absolute; top: 0; left: 0; right: 0; height: 54px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 30px 0 38px; font-weight: 700; font-size: 16px; color: var(--app-ink);
  transition: background .3s ease, color .3s ease;
}
.screen.status-dark .status { background: var(--app-navy-2); color: #FFFFFF; }
.sbar { display: flex; gap: 6px; align-items: center; }
.sig { display: flex; gap: 2px; align-items: flex-end; height: 12px; }
.sig i { width: 3px; background: currentColor; border-radius: 1px; display: block; }
.sig i:nth-child(1) { height: 4px } .sig i:nth-child(2) { height: 6px } .sig i:nth-child(3) { height: 9px } .sig i:nth-child(4) { height: 12px }
.bat { width: 24px; height: 12px; border: 1.5px solid currentColor; border-radius: 4px; padding: 1.5px; position: relative; }
.bat::before { content: ''; display: block; height: 100%; width: 72%; background: currentColor; border-radius: 1.5px; }
.bat::after { content: ''; position: absolute; right: -4px; top: 3px; width: 2px; height: 4px; background: currentColor; border-radius: 0 1px 1px 0; }

.view { position: absolute; top: 54px; left: 0; right: 0; bottom: 0; }
.layer {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  opacity: 0; transform: translateX(36px); pointer-events: none;
  transition: opacity .45s ease, transform .45s cubic-bezier(.2,.7,.2,1);
}
.layer.on { opacity: 1; transform: none; }
.layer.gone { transform: translateX(-36px); }

.no-anim, .no-anim * { transition: none !important; animation: none !important; }
.pressed { transform: scale(.96); }

/* ---------- Peças do app ---------- */
.fld {
  position: relative; height: 48px; border-radius: 14px; background: var(--app-light);
  display: flex; align-items: center; padding: 0 44px 0 46px;
  font-size: 14.5px; color: var(--app-ink); transition: box-shadow .2s ease;
}
.fld .ic { position: absolute; left: 14px; font-size: 21px; color: #A9B1B5; transition: color .2s ease; }
.fld .ph { color: #A2ABAF; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fld.has .ph { display: none; }
.fld .val { white-space: nowrap; overflow: hidden; }
.fld.focus { box-shadow: 0 0 0 2px rgba(44,95,93,.35); }
.fld.focus .ic { color: var(--app-teal); }
.fld.focus .caret { display: inline-block; }
.caret { display: none; width: 1.5px; height: 19px; background: var(--app-teal); margin-left: 1px; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.spin {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid #CAD7D7; border-top-color: var(--app-teal);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Câmera lendo o QR Code colado na máquina. */
.cam { position: relative; height: 300px; border-radius: 16px; overflow: hidden; background: #10191D; }
.feed {
  position: absolute; inset: -20%; opacity: 0;
  background: linear-gradient(160deg, #DCE1E3 0%, #BCC4C7 60%, #A9B2B6 100%);
  transform: translate(14%, 18%) scale(.82) rotate(-5deg);
  transition: opacity .4s ease, transform 1.8s cubic-bezier(.3,.6,.2,1);
}
.cam.live .feed { opacity: 1; }
.cam.aim .feed { transform: none; }
.door {
  position: absolute; left: 50%; top: 76%; width: 300px; height: 300px; margin-left: -150px; border-radius: 50%;
  background: radial-gradient(circle, #34444A 0 44%, #8D979B 45% 51%, #C8CED0 52% 59%, transparent 60%);
}
.sticker {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  padding: 10px; background: #FFFFFF; border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0,0,0,.25); transition: box-shadow .25s ease;
}
.sticker canvas { display: block; width: 120px; height: 120px; image-rendering: pixelated; }
.cam.found .sticker { box-shadow: 0 0 0 5px var(--app-lime), 0 4px 10px rgba(0,0,0,.25); }
.aimbox { position: absolute; left: 50%; top: 36%; width: 176px; height: 176px; transform: translate(-50%, -50%); opacity: 0; transition: opacity .3s ease; }
.cam.live .aimbox { opacity: 1; }
.aimbox i { position: absolute; width: 30px; height: 30px; border: 4px solid rgba(255,255,255,.92); transition: border-color .25s ease; }
.aimbox i:nth-child(1) { left: 0; top: 0; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.aimbox i:nth-child(2) { right: 0; top: 0; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.aimbox i:nth-child(3) { left: 0; bottom: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.aimbox i:nth-child(4) { right: 0; bottom: 0; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.cam.found .aimbox i { border-color: var(--app-lime); }
.scanline {
  position: absolute; left: 18%; right: 18%; top: 14%; height: 2px; display: none;
  background: var(--app-lime); box-shadow: 0 0 10px var(--app-lime);
  animation: scan 1.5s ease-in-out infinite alternate;
}
.cam.live .scanline { display: block; }
.cam.found .scanline { display: none; }
@keyframes scan { to { top: 58%; } }

/* Aviso de sucesso no topo (o toastr do app). */
.toast {
  position: absolute; left: 16px; right: 16px; top: 64px; z-index: 45;
  display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-radius: 14px;
  background: #51A351; color: #FFFFFF; font-size: 14.5px; font-weight: 600;
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(-16px); transition: opacity .3s ease, transform .3s ease;
}
.toast.on { opacity: 1; transform: none; }
.toast .ms { font-size: 22px; }

/* O "dedo" que toca na tela. */
.tap {
  position: absolute; left: 0; top: 0; z-index: 50; width: 46px; height: 46px; border-radius: 50%;
  background: rgba(14,37,48,.22); border: 2.5px solid rgba(255,255,255,.95);
  box-shadow: 0 4px 14px rgba(14,37,48,.35);
  opacity: 0; transition: transform .5s cubic-bezier(.4,.1,.2,1), opacity .25s ease; pointer-events: none;
}
.tap.show { opacity: 1; }
.tap::after { content: ''; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--app-lime); opacity: 0; transform: scale(.6); }
.tap.press { background: rgba(14,37,48,.38); }
.tap.press::after { animation: ripple .45s ease-out; }
@keyframes ripple { 0% { opacity: 1; transform: scale(.6); } 100% { opacity: 0; transform: scale(1.7); } }

/* ---------- Painel de passos ---------- */
.panel { min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ctl {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 16px 0 12px; border-radius: 999px;
  font: 600 14px var(--font); cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.ctl .ms { font-size: 20px; }
.ctl.primary { background: var(--cta); color: var(--cta-ink); border-color: transparent; }
.ctl:focus-visible, .step-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.counter { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.step-btn {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 14px; align-items: start;
  padding: 12px 14px; border-radius: 16px; border: 1px solid transparent;
  background: transparent; color: var(--ink); font: inherit;
  transition: background .25s ease, border-color .25s ease;
}
.step-btn:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
.num {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--line); color: var(--muted); background: var(--surface); transition: all .25s ease;
}
.step-title { font-weight: 700; font-size: 16px; padding-top: 4px; display: block; }
.step-more { grid-column: 2; display: none; margin-top: 4px; }
.step-more .desc { display: block; margin: 0; color: var(--muted); font-size: 14.5px; max-width: 52ch; }
.tip {
  display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; padding: 10px 12px;
  border-radius: 12px; background: var(--accent-soft); color: var(--ink); font-size: 13.5px;
}
.tip .ms { font-size: 18px; color: var(--accent); margin-top: 1px; }
.step.done .num { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.step.active .step-btn { background: var(--surface); border-color: var(--line); box-shadow: 0 10px 24px -16px rgba(14,37,48,.35); }
.step.active .num { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.step.active .step-more { display: block; }

/* ---------- Depois da animação ---------- */
.after { margin-top: 48px; display: flex; flex-direction: column; gap: 10px; }
.after-card {
  padding: 20px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 24px;
}
.after-card > div { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.after-card h2 { margin: 0; font-size: 18px; }
.after-card p { margin: 0; color: var(--muted); max-width: 62ch; }
.note { margin: 6px 0 0; color: var(--muted); font-size: 13.5px; }
/* Download do vídeo: discreto, para quem quiser guardar ou repassar. */
.dl { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 13px; }
.dl .ms { font-size: 17px; }

/* ---------- Quadro de gravação (#gif): só o celular e a legenda, sempre escuro ---------- */
.gif-head, .gif-cap { display: none; }
html.gif, html.gif body { background: #0E2530; }
html.gif body { padding: 0; }
html.gif .wrap { padding: 0; margin: 0; max-width: none; width: 400px; }
html.gif .intro, html.gif .panel, html.gif .after, html.gif .site-header, html.gif .site-footer { display: none; }
html.gif .stage { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 22px 0 24px; }
html.gif .phone { background: #050F14; box-shadow: 0 0 0 1px #2A4955, 0 24px 48px -16px rgba(0,0,0,.55); }
html.gif .gif-head { display: flex; align-items: center; gap: 10px; color: #FFFFFF; font-weight: 800; font-size: 19px; letter-spacing: -0.01em; }
html.gif .gif-head img { width: 30px; height: 30px; border-radius: 8px; display: block; }
html.gif .gif-cap { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 352px; }
.gif-step { display: flex; align-items: center; gap: 12px; min-height: 36px; }
.gif-num {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
  background: #C6F23D; color: #0A1A22; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
}
.gif-title { color: #FFFFFF; font-weight: 700; font-size: 19px; }
.gif-dots { display: flex; gap: 2px; }
/* Cada tracinho é um botão (pula para o passo); a área de toque é maior que a barra. */
.gif-dots button { appearance: none; border: 0; background: none; padding: 10px 2px; cursor: pointer; border-radius: 6px; }
.gif-dots button::before { content: ''; display: block; width: 24px; height: 4px; border-radius: 2px; background: #2A4955; transition: background .3s ease; }
.gif-dots button.on::before { background: #C6F23D; }
.gif-dots button:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; }
.cap-desc { display: none; }

/* ---------- Celular: igual ao vídeo, legenda do passo embaixo da animação ---------- */
@media (max-width: 760px) {
  html:not(.gif) .gif-cap { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; max-width: 480px; }
  html:not(.gif) .gif-title { color: var(--ink); text-align: left; }
  html:not(.gif) .gif-dots button::before { background: var(--line); }
  html:not(.gif) .gif-dots button.on::before { background: var(--accent); }
  html:not(.gif) .cap-desc { display: block; margin: 0; min-height: 4.6em; max-width: 46ch; text-align: center; color: var(--muted); font-size: 14.5px; }
  html:not(.gif) .steps, html:not(.gif) .counter { display: none; }
  html:not(.gif) .stage { gap: 20px; }
  html:not(.gif) .controls { justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .layer, .tap, .toast { transition-duration: .01s !important; }
  .caret, .spin { animation: none; }
}
