/* FOURMI THINK — SuccessOverlay cinematográfico (componente compartilhado).
   Ativado só quando o diálogo recebe .is-cinematic (nesta fase: perfil Professor).
   Camadas separadas: tela real desfocada (::backdrop) → véu verde profundo → bokeh/brilhos → medalhão dourado
   → formiga oficial (assets/brand-symbol-320.*) → check verde → textos → card de detalhes → botões reais. */
.success-overlay:not(.is-cinematic) :is(.so-stage,.so-rays,.so-x){display:none}
.success-overlay:not(.is-cinematic) .so-coin{display:none}
.success-overlay:not(.is-cinematic) .so-medal{display:contents}
.success-overlay .so-details[hidden]{display:none}

.success-overlay.is-cinematic{position:fixed;inset:0;width:100%;max-width:100%;height:100%;max-height:100%;margin:0;padding:0;border:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;color:#fff;
  background:
    radial-gradient(70% 42% at 50% 26%,rgba(212,168,83,.20),rgba(212,168,83,0) 70%),
    radial-gradient(120% 60% at 50% 110%,rgba(1,20,15,.75),rgba(1,20,15,0) 70%),
    linear-gradient(180deg,rgba(4,46,35,.80) 0%,rgba(3,36,29,.86) 45%,rgba(2,24,19,.93) 100%)}
.success-overlay.is-cinematic::backdrop{background:rgba(2,26,20,.30);-webkit-backdrop-filter:blur(16px) saturate(1.1);backdrop-filter:blur(16px) saturate(1.1)}
.success-overlay.is-cinematic[open]{display:block}
.success-overlay.is-cinematic .so-stage{position:fixed;inset:0;overflow:hidden;pointer-events:none}
.so-bokeh{position:absolute;border-radius:50%;filter:blur(18px);opacity:.55}
.so-bokeh.b1{width:160px;height:160px;left:-40px;top:18%;background:rgba(212,168,83,.22)}
.so-bokeh.b2{width:120px;height:120px;right:-30px;top:8%;background:rgba(64,140,110,.30)}
.so-bokeh.b3{width:190px;height:190px;right:-70px;top:52%;background:rgba(212,150,90,.16)}
.so-bokeh.b4{width:110px;height:110px;left:10%;bottom:6%;background:rgba(212,168,83,.14)}
.so-bokeh.b5{width:90px;height:90px;left:58%;top:4%;background:rgba(255,224,150,.12)}
.so-spark{position:absolute;width:6px;height:16px;border-radius:2px;background:linear-gradient(180deg,#f6dc93,#c8952f);opacity:.85;box-shadow:0 0 8px rgba(246,220,147,.45)}
.so-spark.s1{left:calc(50% - 128px);top:calc(env(safe-area-inset-top,0px) + 84px);transform:rotate(-32deg)}
.so-spark.s2{left:calc(50% + 104px);top:calc(env(safe-area-inset-top,0px) + 70px);transform:rotate(38deg)}
.so-spark.s3{left:calc(50% - 150px);top:calc(env(safe-area-inset-top,0px) + 190px);transform:rotate(48deg);height:12px}
.so-spark.s4{left:calc(50% + 140px);top:calc(env(safe-area-inset-top,0px) + 178px);transform:rotate(-40deg);height:12px}
.so-spark.s5{left:calc(50% - 40px);top:calc(env(safe-area-inset-top,0px) + 40px);transform:rotate(24deg);width:4px;height:10px}
.so-spark.s6{left:calc(50% + 70px);top:calc(env(safe-area-inset-top,0px) + 262px);width:5px;height:5px;border-radius:50%}
.success-overlay.is-cinematic .so-x{position:fixed;z-index:2;top:calc(14px + env(safe-area-inset-top,0px));right:calc(14px + env(safe-area-inset-right,0px));display:grid;place-items:center;width:46px;height:46px;padding:0;border:1px solid rgba(255,255,255,.14);border-radius:50%;background:rgba(255,255,255,.08);color:#fff;cursor:pointer;-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}
.success-overlay.is-cinematic .so-x svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round}
.success-overlay.is-cinematic .so-content{position:relative;z-index:1;box-sizing:border-box;display:grid;justify-items:center;gap:0;width:min(100%,440px);min-height:100%;margin:0 auto;padding:calc(64px + env(safe-area-inset-top,0px)) calc(22px + env(safe-area-inset-right,0px)) calc(26px + env(safe-area-inset-bottom,0px)) calc(22px + env(safe-area-inset-left,0px));align-content:center;text-align:center;animation:none}

/* Medalhão dourado + formiga oficial + check verde */
.success-overlay.is-cinematic .so-medal{--medal:clamp(132px,40vw,176px);position:relative;display:grid;place-items:center;width:var(--medal);height:var(--medal);margin:0 0 22px}
.success-overlay.is-cinematic .so-rays{position:absolute;inset:-46%;border-radius:50%;background:radial-gradient(circle,rgba(255,214,120,.45) 0%,rgba(212,168,83,.18) 34%,rgba(212,168,83,0) 66%);pointer-events:none}
.success-overlay.is-cinematic .so-coin{position:relative;display:grid;place-items:center;width:100%;height:100%;border-radius:50%;
  background:radial-gradient(circle at 34% 26%,#fff3c4 0%,#f1d184 22%,#dcae55 52%,#b8852b 82%,#94661a 100%);
  box-shadow:inset 0 0 0 5px rgba(255,236,180,.55),inset 0 0 0 8px rgba(150,104,24,.55),inset 0 10px 24px rgba(255,255,255,.25),inset 0 -12px 26px rgba(120,80,10,.35),0 0 0 2px rgba(255,220,140,.35),0 18px 44px rgba(0,0,0,.45),0 0 60px rgba(212,168,83,.35)}
.success-overlay.is-cinematic .so-coin picture{display:contents}
.success-overlay.is-cinematic .so-ant{display:block;width:70%;height:auto;margin-top:-4%;filter:drop-shadow(0 3px 4px rgba(90,60,6,.35))}
.success-overlay.is-cinematic .so-check{position:absolute;right:-2%;bottom:2%;display:grid;place-items:center;width:34%;height:34%;margin:0;border:3px solid rgba(3,36,29,.85);border-radius:50%;background:radial-gradient(circle at 35% 30%,#2fcf8b,#0d9b63 60%,#08754a);box-shadow:0 8px 20px rgba(0,0,0,.35)}
.success-overlay.is-cinematic .so-check svg{width:58%;height:58%;fill:none;stroke:#fff;stroke-width:3.2;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:30;stroke-dashoffset:0}

/* Textos dinâmicos */
.success-overlay.is-cinematic .so-content h2{margin:0;color:#fff;font-family:var(--tp-serif,"Literata",Georgia,serif);font-size:clamp(2rem,9.6vw,2.7rem);font-weight:700;line-height:1.08;letter-spacing:-.02em;text-shadow:0 2px 18px rgba(0,0,0,.35);text-wrap:balance;overflow-wrap:anywhere}
.success-overlay.is-cinematic .so-accent{background:linear-gradient(180deg,#f8dc8e 10%,#d9a94c 90%);-webkit-background-clip:text;background-clip:text;color:transparent}
.success-overlay.is-cinematic .so-content p{max-width:30ch;margin:12px 0 0;color:rgba(255,255,255,.84);font-size:1.04rem;line-height:1.45;white-space:pre-line;text-shadow:none;text-wrap:pretty}
.success-overlay.is-cinematic .so-content p:empty{display:none}

/* Card translúcido de detalhes */
.success-overlay.is-cinematic .so-details{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:16px;width:100%;box-sizing:border-box;margin:22px 0 0;padding:18px;border:1px solid rgba(255,255,255,.13);border-radius:22px;background:linear-gradient(180deg,rgba(255,255,255,.075),rgba(255,255,255,.035));box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 16px 36px rgba(0,0,0,.22);text-align:left;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px)}
.success-overlay.is-cinematic .so-details:not(:has(.so-avatar)){grid-template-columns:minmax(0,1fr)}
.so-avatar{display:grid;place-items:center;width:62px;height:62px;border-radius:50%;background:#eef2ea;color:var(--tp-green,#053d2e);font-size:1.45rem;font-weight:800;overflow:hidden;box-shadow:0 0 0 3px rgba(255,255,255,.12)}
.so-avatar img{width:100%;height:100%;object-fit:cover}
.so-details-text{display:grid;gap:3px;min-width:0}
.so-details-text strong{color:#fff;font-size:1.12rem;font-weight:750;line-height:1.25;overflow-wrap:anywhere}
.so-details-text small{color:rgba(255,255,255,.72);font-size:.92rem}
.so-details-text ul{display:grid;gap:6px;margin:6px 0 0;padding:0;list-style:none}
.so-details-text li{display:flex;align-items:center;gap:9px;color:rgba(255,255,255,.86);font-size:.92rem;font-variant-numeric:tabular-nums;min-width:0}
.so-details-text li span{min-width:0;overflow-wrap:anywhere}
.so-details-text li svg{flex:none;width:18px;height:18px;fill:none;stroke:#e1b75e;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}

/* Botões reais */
.success-overlay.is-cinematic .so-actions{display:grid;gap:12px;width:100%;margin-top:24px}
.success-overlay.is-cinematic .so-actions button{display:flex;align-items:center;justify-content:center;gap:10px;min-height:56px;padding:0 20px;border-radius:18px;font:inherit;font-size:1.04rem;font-weight:750;cursor:pointer;transition:transform .12s,filter .18s}
.success-overlay.is-cinematic .so-actions button:active{transform:scale(.98)}
.success-overlay.is-cinematic .so-primary{position:relative;border:0;background:linear-gradient(90deg,#f2cd78,#dcaa4f);color:#10261e;box-shadow:0 14px 30px -12px rgba(212,168,83,.7),inset 0 1px 0 rgba(255,255,255,.4)}
.success-overlay.is-cinematic .so-primary span{flex:1;text-align:center;padding-left:24px}
.success-overlay.is-cinematic .so-primary svg{flex:none;width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.success-overlay.is-cinematic :is(.so-ghost,.so-secondary){border:1.5px solid rgba(226,186,104,.85);background:rgba(255,255,255,.03);color:#fff}
.success-overlay.is-cinematic .so-link{min-height:44px!important;border:0;background:transparent;color:rgba(255,255,255,.9);text-decoration:underline;text-underline-offset:4px;font-weight:700!important}
.success-overlay.is-cinematic :is(.so-actions button,.so-x):focus-visible{outline:3px solid #f2cd78;outline-offset:3px}

/* Sequência (Motion System): tela desfoca → véu verde → medalhão → formiga → check → título → informações → botões (~520 ms) */
@keyframes so-cine-fade{from{opacity:0}to{opacity:1}}
@keyframes so-cine-rays{from{opacity:0;transform:scale(.55)}to{opacity:1;transform:none}}
@keyframes so-cine-coin{from{opacity:0;transform:scale(.82)}to{opacity:1;transform:none}}
@keyframes so-cine-ant{from{opacity:0;transform:translate3d(0,6px,0)}to{opacity:1;transform:none}}
@keyframes so-cine-check{0%{opacity:0;transform:scale(.4)}70%{opacity:1;transform:scale(1.06)}100%{opacity:1;transform:none}}
@keyframes so-cine-draw{from{stroke-dashoffset:30}to{stroke-dashoffset:0}}
@keyframes so-cine-rise{from{opacity:0;transform:translate3d(0,10px,0)}to{opacity:1;transform:none}}
@keyframes so-cine-spark{0%{opacity:0;translate:0 8px}40%{opacity:.9}100%{opacity:.7;translate:0 0}}
body .success-overlay.is-cinematic[open]{animation:so-cine-fade 220ms cubic-bezier(.2,.8,.2,1) both}
body .success-overlay.is-cinematic[open]::backdrop{animation:so-cine-fade 200ms ease-out both}
body .success-overlay.is-cinematic[open] .so-content,body[data-profession] .success-overlay.is-cinematic[open] .so-content{animation:none}
body[data-profession] .success-overlay.is-cinematic[open] .so-rays{animation:so-cine-rays 460ms cubic-bezier(.2,.8,.2,1) 30ms both}
body[data-profession] .success-overlay.is-cinematic[open] .so-coin{animation:so-cine-coin 340ms cubic-bezier(.2,.9,.2,1) 30ms both}
body[data-profession] .success-overlay.is-cinematic[open] .so-ant{animation:so-cine-ant 240ms cubic-bezier(.2,.8,.2,1) 110ms both}
body[data-profession] .success-overlay.is-cinematic[open] .so-check{animation:so-cine-check 280ms cubic-bezier(.2,.9,.2,1) 170ms both}
body[data-profession] .success-overlay.is-cinematic[open] .so-check svg{animation:so-cine-draw 220ms cubic-bezier(.2,.8,.2,1) 250ms both}
body[data-profession] .success-overlay.is-cinematic[open] .so-content h2{animation:so-cine-rise 240ms cubic-bezier(.2,.8,.2,1) 200ms both}
body[data-profession] .success-overlay.is-cinematic[open] .so-content p{animation:so-cine-rise 240ms cubic-bezier(.2,.8,.2,1) 235ms both}
body[data-profession] .success-overlay.is-cinematic[open] .so-details{animation:so-cine-rise 260ms cubic-bezier(.2,.8,.2,1) 265ms both}
body[data-profession] .success-overlay.is-cinematic[open] .so-actions{animation:so-cine-rise 260ms cubic-bezier(.2,.8,.2,1) 295ms both}
body[data-profession] .success-overlay.is-cinematic[open] .so-spark{animation:so-cine-spark 700ms cubic-bezier(.2,.8,.2,1) 160ms both}
body .success-overlay.is-cinematic.is-closing{animation:so-cine-fade 170ms cubic-bezier(.4,0,1,1) reverse forwards}
body .success-overlay.is-cinematic.is-closing::backdrop{animation:so-cine-fade 170ms cubic-bezier(.4,0,1,1) reverse forwards}
.success-overlay.is-cinematic.is-closing{pointer-events:none}

@media(max-height:640px){
  .success-overlay.is-cinematic .so-medal{--medal:118px;margin-bottom:14px}
  .success-overlay.is-cinematic .so-content{padding-top:calc(54px + env(safe-area-inset-top,0px))}
  .success-overlay.is-cinematic .so-content h2{font-size:1.9rem}
  .success-overlay.is-cinematic .so-details{margin-top:14px;padding:14px}
  .success-overlay.is-cinematic .so-actions{margin-top:16px}
}
@media(max-width:359px){
  .so-avatar{width:50px;height:50px;font-size:1.15rem}
  .success-overlay.is-cinematic .so-details{gap:12px;padding:14px}
  .so-spark.s3,.so-spark.s4{display:none}
}
@media(prefers-reduced-motion:reduce){
  body .success-overlay.is-cinematic[open],body .success-overlay.is-cinematic[open]::backdrop,
  body[data-profession] .success-overlay.is-cinematic[open] :is(.so-rays,.so-coin,.so-ant,.so-check,.so-check svg,h2,p,.so-details,.so-actions,.so-spark),
  body .success-overlay.is-cinematic.is-closing,body .success-overlay.is-cinematic.is-closing::backdrop{animation:none!important}
}
