/* ===== Estudiapp · capa de movimiento =====
   Todo lo animado vive aquí y en motion.js. Se desactiva con
   prefers-reduced-motion o con Ajustes › Animaciones (html[data-motion=off]). */

@property --a1 { syntax: "<color>"; inherits: true; initial-value: #3b82f6; }
@property --a2 { syntax: "<color>"; inherits: true; initial-value: #8b5cf6; }

@media (prefers-reduced-motion: no-preference) {
:root:not([data-motion=off]) {

  /* ---- aurora: cambia de color con suavidad y sigue al ratón ---- */
  /* el fondo se desplaza hasta 18 px con el ratón: lo hacemos 60 px más grande por cada lado para que nunca asome el borde */
  .aurora { inset: -60px; }
  .aurora { transition: --a1 1.4s ease, --a2 1.4s ease, transform 1.2s cubic-bezier(.2,.8,.2,1); }
  .aurora i { will-change: transform; }

  /* ---- entrada de páginas y bloques ---- */
  .mo-in { animation: moIn .6s cubic-bezier(.16,1,.3,1) both; animation-delay: var(--d, 0ms); }
  .mo-wait { opacity: 0; transform: translateY(26px); }
  .mo-slide { animation: moSlide .5s cubic-bezier(.16,1,.3,1) both; }
  .mo-flip { animation: moFlip .55s cubic-bezier(.2,.9,.25,1.05) both; }
  .mo-pop { animation: moPop .45s cubic-bezier(.2,1.5,.4,1) both; animation-delay: var(--d, 0ms); }

  /* ---- tarjetas vivas: foco de luz bajo el cursor + inclinación ---- */
  .glass.card, .opt, .inset {
    background-image: radial-gradient(520px circle at var(--mx, -999px) var(--my, -999px),
      color-mix(in srgb, var(--c, #ffffff) 13%, transparent), transparent 42%);
  }
  .subj { transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .3s; will-change: transform; }
  .subj:hover { box-shadow: var(--shadow), 0 18px 50px color-mix(in srgb, var(--c) 28%, transparent), inset 0 1px 0 var(--hi); }
  .subj::before { transition: transform .6s cubic-bezier(.2,.8,.2,1), opacity .4s; }
  .subj:hover::before { transform: scale(1.35) translate(-14px, 10px); opacity: .5; }
  .subj:hover .ring svg { animation: moSpinOnce .9s cubic-bezier(.2,.8,.2,1); }
  .inset { transition: transform .2s cubic-bezier(.2,.8,.2,1), background-color .2s; }
  a.inset:hover, .spread.inset:hover { transform: translateX(4px); }
  .ach { transition: transform .25s cubic-bezier(.2,.8,.2,1); }
  .ach:hover { transform: translateY(-3px) scale(1.015); }
  .ach.got .ic { animation: moGlow 3.2s ease-in-out infinite; }

  /* ---- navegación: indicador que se desliza ---- */
  .nav, .tabs { position: relative; }
  .mo-ind { position: absolute; z-index: 0; pointer-events: none; border-radius: 12px; background: var(--glass-3);
    box-shadow: inset 0 1px 0 var(--hi), 0 2px 10px rgba(0,0,0,.1);
    transition: transform .45s cubic-bezier(.3,1.25,.4,1), width .45s cubic-bezier(.3,1.25,.4,1), height .45s cubic-bezier(.3,1.25,.4,1); }
  .has-ind > a, .has-ind > button, .has-ind > .lab { position: relative; z-index: 1; }
  .has-ind > a.on, .has-ind > button.on { background: transparent !important; box-shadow: none !important; }
  .nav a { transition: background .2s, transform .25s cubic-bezier(.2,.8,.2,1); }
  .nav a:hover { transform: translateX(4px); }
  .nav a svg { transition: transform .3s cubic-bezier(.2,1.5,.4,1); }
  .nav a:hover svg, .nav a.on svg { transform: scale(1.12) rotate(-6deg); }
  .nav .dot { transition: transform .3s cubic-bezier(.2,1.5,.4,1), box-shadow .3s; }
  .nav a:hover .dot, .nav a.on .dot { transform: scale(1.35); box-shadow: 0 0 12px currentColor; }
  .tabs button { transition: color .25s; }
  .mobilebar a { transition: background .2s, color .2s, transform .2s; }
  .mobilebar a.on svg { animation: moPop .45s cubic-bezier(.2,1.5,.4,1); }

  /* ---- botones con más respuesta ---- */
  .btn { transition: transform .18s cubic-bezier(.2,1.5,.4,1), background .2s, box-shadow .25s, filter .2s; }
  .btn:hover:not(:disabled) { transform: translateY(-1px); }
  .btn:active:not(:disabled) { transform: scale(.95); transition-duration: .06s; }
  .btn.pri:hover:not(:disabled) { box-shadow: 0 10px 28px color-mix(in srgb, var(--blue) 50%, transparent); filter: brightness(1.08); }
  .btn.gold:hover:not(:disabled) { box-shadow: 0 10px 28px rgba(255,159,10,.5); }
  .btn svg { transition: transform .25s cubic-bezier(.2,1.5,.4,1); }
  .btn:hover svg { transform: translateX(3px); }
  .btn.pri, .btn.gold, .btn.claude { position: relative; overflow: hidden; }
  .btn.pri::after, .btn.gold::after, .btn.claude::after { content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.35) 50%, transparent 65%); transform: translateX(-120%); }
  .btn.pri:hover::after, .btn.gold:hover::after, .btn.claude:hover::after { transform: translateX(120%); transition: transform .7s ease; }
  .chip { transition: transform .2s cubic-bezier(.2,1.5,.4,1), background .2s; }
  button.chip:hover { transform: translateY(-1px); background: var(--glass-3); }
  .opt { transition: background .15s, transform .2s cubic-bezier(.2,1.5,.4,1), border-color .2s, box-shadow .2s; }
  .opt:hover:not(:disabled) { transform: translateX(5px); box-shadow: 0 6px 20px rgba(0,0,0,.12); }
  .opt:hover:not(:disabled) .l { background: color-mix(in srgb, var(--c, var(--blue)) 40%, transparent); }
  .opt .l { transition: background .2s, transform .25s cubic-bezier(.2,1.5,.4,1); }

  /* ---- feedback del test ---- */
  .opt.right { animation: moRight .6s cubic-bezier(.2,1.4,.4,1); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 22%, transparent), 0 10px 30px color-mix(in srgb, var(--green) 25%, transparent); }
  .opt.right .l { animation: moPop .5s cubic-bezier(.2,1.6,.4,1); }
  .opt.wrong { animation: moShake .5s cubic-bezier(.36,.07,.19,.97); }
  .opt:disabled:not(.right):not(.wrong) { opacity: .55; transition: opacity .3s; }
  .exp { animation: moIn .45s cubic-bezier(.16,1,.3,1) both; animation-delay: .12s; }
  .combo { display: inline-block; animation: moCombo .6s cubic-bezier(.2,1.6,.4,1); text-shadow: 0 0 14px rgba(255,159,10,.55); }
  .progressdots i { transition: background .3s, transform .3s; }
  .progressdots i.cur { animation: moBeat 1.4s ease-in-out infinite; }
  .progressdots i.ok, .progressdots i.ko { animation: moPop .4s cubic-bezier(.2,1.6,.4,1) both; }

  /* ---- flashcards en 3D ---- */
  .flash { transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s; transform-style: preserve-3d; }
  .flash:not(:has(.back)):hover { transform: translateY(-3px) rotateX(4deg); box-shadow: var(--shadow), 0 24px 60px rgba(0,0,0,.18); }
  .flash .back { animation: moIn .5s cubic-bezier(.16,1,.3,1) both; animation-delay: .18s; }

  /* ---- barra superior: XP con brillo, insignia que late, racha que arde ---- */
  .bar i { position: relative; overflow: hidden; }
  .bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent); transform: translateX(-100%); animation: moShimmer 2.8s ease-in-out infinite; }
  .lvl .badge { animation: moBadge 4s ease-in-out infinite; }
  .lvl .badge.mo-bump { animation: moBump .6s cubic-bezier(.2,1.6,.4,1); }
  .chip.fire svg { transform-origin: 50% 90%; animation: moFlicker 1.8s ease-in-out infinite; }
  .chip.mo-bump { animation: moBump .6s cubic-bezier(.2,1.6,.4,1); }
  .xpfloat { animation: moXP 1.1s cubic-bezier(.2,.8,.2,1) forwards !important; }

  /* ---- barras y gráficos ---- */
  .mbar i { transition: width 1s cubic-bezier(.2,.8,.2,1); }
  .vbars i { transition: height .9s cubic-bezier(.2,.8,.2,1); transform-origin: bottom; }
  .vbars div:hover i { filter: brightness(1.2); transform: scaleX(1.15); }
  .heat i { transition: transform .2s cubic-bezier(.2,1.5,.4,1); }
  .heat i:hover { transform: scale(1.45); position: relative; z-index: 2; box-shadow: 0 0 0 2px var(--bg); }
  .heat.mo-heat i { animation: moPop .4s cubic-bezier(.2,1.5,.4,1) both; animation-delay: calc(var(--i, 0) * 4ms); }

  /* ---- desplegables ---- */
  details[open] > :not(summary) { animation: moIn .4s cubic-bezier(.16,1,.3,1) both; }
  details.box summary .ring { transition: transform .3s cubic-bezier(.2,1.5,.4,1); }
  details.box:hover summary .ring { transform: scale(1.08) rotate(-8deg); }

  /* ---- avisos, modales y carga ---- */
  .toast.mo-out { animation: moOut .35s cubic-bezier(.4,0,1,1) forwards; }
  .modal { animation: moFade .3s ease both; }
  .modal > .glass { animation: moModal .6s cubic-bezier(.2,1.4,.4,1) both; }
  .modal .badge { animation: moBadgeIn 1s cubic-bezier(.2,1.6,.4,1) both .15s; }
  .loading .logo { animation: moSpin 2.4s linear infinite; }
  .focuspop { animation: moDrop .35s cubic-bezier(.2,1.3,.4,1) both; transform-origin: top right; }


  /* ---- más reactividad ---- */
  .top { transition: padding .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s, background .3s; }
  .top.mo-scrolled { padding-top: 8px; padding-bottom: 8px; box-shadow: var(--shadow), 0 12px 40px rgba(0,0,0,.22), inset 0 1px 0 var(--hi); }
  .top.mo-scrolled .lvl .badge { width: 40px; height: 40px; font-size: 16px; }
  .lvl .badge { transition: width .3s, height .3s, font-size .3s, transform .3s cubic-bezier(.2,1.5,.4,1); }
  .lvl:hover .badge { transform: rotate(-8deg) scale(1.08); }
  a.glass.card:active, button.glass.card:active { transform: scale(.98); transition-duration: .08s; }
  button.glass.card { transition: transform .2s cubic-bezier(.2,1.5,.4,1), box-shadow .25s; }
  button.glass.card:hover { transform: translateY(-3px); box-shadow: var(--shadow), 0 16px 40px rgba(0,0,0,.18), inset 0 1px 0 var(--hi); }
  .kpi { transition: transform .25s cubic-bezier(.2,1.5,.4,1); }
  .kpi:hover { transform: translateY(-2px); }
  .kpi:hover b { color: var(--c, var(--ink)); }
  .pill { transition: transform .2s cubic-bezier(.2,1.5,.4,1), background .2s; }
  .pill:hover { transform: scale(1.06); }
  .pill.ok { animation: moPop .4s cubic-bezier(.2,1.6,.4,1) both; }
  .nav .pct { transition: transform .3s cubic-bezier(.2,1.5,.4,1); }
  .nav a:hover .pct { transform: scale(1.12); }
  .empty h2 { animation: moFloat 4s ease-in-out infinite; }
  .btn.mo-mag:active:not(:disabled) { transform: scale(.95) !important; }
  .btn.mo-mag { transition: transform .25s cubic-bezier(.2,.8,.2,1), background .2s, box-shadow .25s, filter .2s; }
  .toast { position: relative; overflow: hidden; }
  .toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: linear-gradient(90deg, var(--gold1), var(--gold2)); transform-origin: left; animation: moLife var(--life, 2.6s) linear forwards; opacity: .8; }
  .statuslab { transition: letter-spacing .3s; }
  .subj:hover .statuslab { letter-spacing: .02em; }
  .mbar i { position: relative; overflow: hidden; }
  .mbar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent); transform: translateX(-100%); animation: moShimmer 3.6s ease-in-out infinite; animation-delay: 1.2s; }
  .heat i[data-l="4"] { animation: moGlowG 3s ease-in-out infinite; }
  summary { transition: color .2s; }
  details:not(.box) > summary:hover { color: var(--ink); }
  table.t tbody tr { transition: background .15s; }
  table.t tbody tr:hover { background: var(--glass-2); }

  /* ---- clic: onda en el punto donde pulsas ---- */
  .mo-ripple { position: fixed; z-index: 95; pointer-events: none; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
    border: 2px solid var(--rc, var(--blue)); animation: moRipple .55s cubic-bezier(.2,.8,.2,1) forwards; }
  .mo-spark { position: fixed; z-index: 96; pointer-events: none; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
    background: var(--sc); animation: moSpark .8s cubic-bezier(.2,.8,.2,1) forwards; }
  .mo-flashbg { position: fixed; inset: 0; z-index: 94; pointer-events: none; animation: moFlashBg .7s ease-out forwards; }
}
}

@keyframes moIn { from { opacity: 0; transform: translateY(22px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes moSlide { from { opacity: 0; transform: translateX(46px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes moFlip { 0% { transform: perspective(1200px) rotateY(-90deg); opacity: .4; } 60% { transform: perspective(1200px) rotateY(8deg); opacity: 1; } 100% { transform: perspective(1200px) rotateY(0); } }
@keyframes moPop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes moRight { 0% { transform: scale(1); } 35% { transform: scale(1.035); } 100% { transform: scale(1); } }
@keyframes moShake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@keyframes moCombo { 0% { transform: scale(.5) rotate(-12deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes moBeat { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }
@keyframes moShimmer { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
@keyframes moBadge { 0%, 100% { box-shadow: 0 6px 18px rgba(255,159,10,.35), inset 0 1px 0 rgba(255,255,255,.6); } 50% { box-shadow: 0 6px 30px rgba(255,159,10,.65), inset 0 1px 0 rgba(255,255,255,.6); } }
@keyframes moBump { 0% { transform: scale(1); } 40% { transform: scale(1.22) rotate(-4deg); } 100% { transform: scale(1); } }
@keyframes moFlicker { 0%, 100% { transform: scale(1) rotate(0); } 25% { transform: scale(1.08, .94) rotate(-3deg); } 50% { transform: scale(.96, 1.08) rotate(2deg); } 75% { transform: scale(1.05, .97) rotate(-1deg); } }
@keyframes moXP { 0% { transform: translateY(0) scale(.6); opacity: 0; } 20% { transform: translateY(-14px) scale(1.25); opacity: 1; } 100% { transform: translateY(-80px) scale(1); opacity: 0; } }
@keyframes moGlow { 0%, 100% { box-shadow: 0 6px 16px rgba(255,159,10,.3); } 50% { box-shadow: 0 6px 26px rgba(255,159,10,.6); } }
@keyframes moSpinOnce { from { transform: rotate(-90deg); } to { transform: rotate(270deg); } }
@keyframes moOut { to { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes moFade { from { opacity: 0; } }
@keyframes moModal { from { opacity: 0; transform: scale(.7) translateY(30px); } }
@keyframes moBadgeIn { 0% { transform: scale(0) rotate(-180deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes moSpin { to { transform: rotate(360deg); } }
@keyframes moDrop { from { opacity: 0; transform: scale(.85) translateY(-8px); } }
@keyframes moRipple { to { transform: scale(5); opacity: 0; } }
@keyframes moSpark { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
@keyframes moFlashBg { from { opacity: .45; } to { opacity: 0; } }
@keyframes moFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes moLife { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes moGlowG { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 50% { box-shadow: 0 0 10px color-mix(in srgb, var(--green) 60%, transparent); } }
