/* ---------------- achicar lo que flota y la barra de arriba (web/mini.js) ---------------- */
/* botón para achicar: una flechita en la punta opuesta al agarre (en la leyenda a la derecha, en la barra de dibujo abajo) */
.pm-x { z-index: 2; padding: 0; border: 0; display: grid; place-items: center; pointer-events: auto; cursor: pointer;
  color: var(--muted); background: rgba(var(--hi-rgb), .045); opacity: .7;
  transition: opacity .2s, scale .4s cubic-bezier(.34, 1.9, .5, 1), background .15s, color .15s, box-shadow .2s; }
#legend .pm-x { position: absolute; right: 4px; top: 6px; bottom: 6px; width: 16px; border-radius: 5px; }   /* tan alta como el agarre */
#legend:not(.mini) { padding-right: 26px; }
#drawbar .pm-x { width: 28px; height: 20px; margin: 3px 0 0; border-radius: 7px; }
.pm-x:hover { opacity: 1; color: var(--hi); background: rgba(var(--acc-rgb), .3) !important; box-shadow: 0 0 10px rgba(var(--acc-rgb), .35); scale: 1.15; }
.pm-x:active { scale: .85; transition-duration: .06s; }
#legend .pm-x svg { transition: translate .35s cubic-bezier(.34, 1.9, .5, 1); }
#legend .pm-x:hover svg { translate: -1.5px 0; }
#drawbar .pm-x:hover svg { translate: 0 -1.5px; }
#drawbar .pm-x svg { transition: translate .35s cubic-bezier(.34, 1.9, .5, 1); }
/* el ícono de la pastilla: sólo se ve achicado */
.pm-ic { display: none; }
.mini .pm-ic { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 8px; pointer-events: auto; cursor: pointer;
  color: var(--on-acc); background: linear-gradient(135deg, var(--acc), var(--acc2)); box-shadow: 0 0 12px rgba(var(--acc-rgb), .5);
  animation: pmIn .55s cubic-bezier(.34, 1.56, .64, 1) both .12s; transition: scale .35s cubic-bezier(.34, 1.9, .5, 1); }
.mini .pm-ic:hover { scale: 1.12; }
.mini .pm-ic:active { scale: .85; }
@keyframes pmIn { 0% { opacity: 0; scale: .3; rotate: -30deg; } 100% { opacity: 1; scale: 1; rotate: 0deg; } }
/* achicado: queda el agarre (para moverla) y el ícono */
#legend.mini, #drawbar.mini, #legend.pm-anim, #drawbar.pm-anim { overflow: hidden; }
#legend.mini > *:not(.grip):not(.pm-ic), #drawbar.mini > *:not(.grip):not(.pm-ic) { opacity: 0; pointer-events: none; }
#legend > *, #drawbar > * { transition: opacity .25s; }
#legend.mini { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 15px !important; max-width: none; border-radius: 15px; }
#legend.mini #legendBody, #legend.mini .pm-x, #drawbar.mini .pm-x { display: none; }
#legend.mini .grip { top: 7px; bottom: 7px; }
#legend.mini .pm-ic { margin-left: auto; }
#drawbar.mini { align-items: center; padding: 4px; border-radius: 17px; }
#drawbar.mini > *:not(.grip):not(.pm-ic) { display: none; }
.fx-on .mini .pm-ic svg { animation: pmBoing 3.4s cubic-bezier(.34, 1.56, .64, 1) infinite; }
@keyframes pmBoing { 0%, 70%, 100% { scale: 1; } 76% { scale: 1.25; } 82% { scale: .9; } 88% { scale: 1.05; } }

/* barra de arriba: se encoge hacia el centro (toma un poquito de impulso) y vuelve creciendo con rebote; el gráfico toma todo el alto */
#top { transform-origin: center top;
  transition: height .5s cubic-bezier(.34, 1.3, .64, 1), padding .4s, transform .7s cubic-bezier(.34, 1.56, .64, 1) .1s, opacity .25s .1s, border-color .3s; }
body.top-mini #top, body.zen #top { height: 0; padding-top: 0; padding-bottom: 0; border-bottom-color: transparent; transform: scale(.35); opacity: 0; pointer-events: none; overflow: hidden;
  transition: transform .4s cubic-bezier(.6, -0.6, .7, 1), opacity .25s .15s, height .45s cubic-bezier(.5, 0, .3, 1) .25s, padding .45s .25s, border-color .3s; }
#body { transition: height .5s cubic-bezier(.34, 1.3, .64, 1); }
body.top-mini #body, body.zen #body { height: 100%; transition: height .45s cubic-bezier(.5, 0, .3, 1) .25s; }
.tb-min svg { transition: translate .4s cubic-bezier(.34, 1.9, .5, 1); }
.tb-min:hover svg { translate: -3px 0; }
#topBack { position: fixed; top: 6px; left: 50%; translate: -50% 0; z-index: 60; display: none; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 8px;
  border-radius: 999px; border: 1px solid rgba(var(--acc-rgb), .45); background: rgba(var(--float-rgb), .92); color: var(--text); font: 600 11px var(--sans); cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 6px 20px rgba(var(--shadow-rgb), .45), 0 0 16px rgba(var(--acc-rgb), .25);
  transition: scale .45s cubic-bezier(.34, 1.9, .5, 1), box-shadow .2s; }
body.top-mini #topBack { display: flex; animation: tbIn .7s cubic-bezier(.34, 1.56, .64, 1) both .2s; }
@keyframes tbIn { 0% { opacity: 0; scale: .3; translate: -50% -20px; } 100% { opacity: 1; scale: 1; translate: -50% 0; } }
#topBack:hover { scale: 1.12; box-shadow: 0 8px 26px rgba(var(--shadow-rgb), .5), 0 0 24px rgba(var(--acc-rgb), .45); }
#topBack:active { scale: .9; }
.fx-on #topBack > svg:first-child { animation: pmBoing 3s cubic-bezier(.34, 1.56, .64, 1) infinite; }

@media (prefers-reduced-motion: reduce) { #top, #body, #topBack, .mini .pm-ic, .pm-x { animation: none !important; transition: none !important; } }
#drawbar:not(.mini) .pm-ic, #legend:not(.mini) .pm-ic { display: none !important; }   /* «#drawbar button» le gana a .pm-ic */
#drawbar.mini .pm-x { display: none; }

/* ---------------- sólo el gráfico (botón ⛶ o F): todo lo que flota explota y se desvanece ---------------- */
.zen-out { animation: zenOut .5s cubic-bezier(.5, 0, .75, 0) both; animation-delay: var(--zd, 0s); pointer-events: none !important; }
@keyframes zenOut { 0% { scale: 1; opacity: 1; filter: none; } 30% { scale: 1.07; opacity: 1; filter: brightness(1.7) blur(0); } 100% { scale: .25; opacity: 0; filter: brightness(2.2) blur(10px); } }
.zen-in { animation: zenIn .75s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: var(--zd, 0s); }
@keyframes zenIn { 0% { scale: .3; opacity: 0; filter: blur(8px); } 60% { opacity: 1; filter: blur(0); } 100% { scale: 1; opacity: 1; filter: none; } }
body.zen :is(#legend, #drawbar, #taLeg, #htBar, #htSet, #topBack, #toasts) { visibility: hidden !important; }
body.zen #topBack { display: none !important; }
#zenBack, #zenLupa { position: fixed; z-index: 70; display: none; place-items: center; padding: 0; cursor: pointer; color: var(--text);
  border: 1px solid rgba(var(--acc-rgb), .45); background: rgba(var(--float-rgb), .88); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(var(--shadow-rgb), .45), 0 0 16px rgba(var(--acc-rgb), .22); transition: scale .45s cubic-bezier(.34, 1.9, .5, 1), box-shadow .2s, background .2s, color .2s; }
/* volver: redondo como la lupa, arriba y en la misma columna */
#zenBack { top: 18px; right: 84px; width: 46px; height: 46px; border-radius: 50%; }
#zenBack span { display: none; }
#zenBack svg { transition: scale .45s cubic-bezier(.34, 1.9, .5, 1); }
#zenBack:hover svg { scale: 1.2; }
#zenLupa { right: 84px; bottom: 40px; width: 46px; height: 46px; border-radius: 50%; }
body.zen #zenBack, body.zen #zenLupa { display: grid; animation: zenBtn .8s cubic-bezier(.34, 1.56, .64, 1) both .45s; }
body.zen #zenLupa { animation-delay: .55s; }
@keyframes zenBtn { 0% { opacity: 0; scale: .2; rotate: -40deg; } 100% { opacity: 1; scale: 1; rotate: 0deg; } }
#zenBack:hover, #zenLupa:hover { scale: 1.12; box-shadow: 0 10px 28px rgba(var(--shadow-rgb), .5), 0 0 26px rgba(var(--acc-rgb), .45); }
#zenBack:active, #zenLupa:active { scale: .88; transition-duration: .06s; }
#zenLupa.on { color: var(--on-acc); border-color: transparent; background: linear-gradient(135deg, var(--acc), var(--acc2)); box-shadow: 0 0 0 4px rgba(var(--acc-rgb), .18), 0 0 26px rgba(var(--acc-rgb), .6); }
.fx-on #zenLupa .lp-rt { transform-origin: 8.5px 8.5px; animation: zenRt 6s linear infinite; }
@keyframes zenRt { to { rotate: 360deg; } }
body.fx-on.zen #zenBack { animation: zenBtn .8s cubic-bezier(.34, 1.56, .64, 1) both .45s, zenBreath 3.2s ease-in-out infinite 1.3s; }
.fx-on #zenLupa:not(.on) { animation: zenBtn .8s cubic-bezier(.34, 1.56, .64, 1) both .55s, zenBreath 3.2s ease-in-out infinite 1.4s; }
@keyframes zenBreath { 0%, 100% { box-shadow: 0 8px 24px rgba(var(--shadow-rgb), .45), 0 0 12px rgba(var(--acc-rgb), .2); } 50% { box-shadow: 0 8px 24px rgba(var(--shadow-rgb), .45), 0 0 26px rgba(var(--acc-rgb), .5); } }
#zenFx { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .zen-out, .zen-in, #zenBack, #zenLupa { animation: none !important; } }
