/* Animationen in der App (gleiche Datei bei ClipCards und Stundo).
   .m-cc = ClipCards, .m-st = Stundo (Klasse am <html>). Bei „Bewegung reduzieren“ bleibt alles ruhig. */
:root { --m-ease: cubic-bezier(.16, 1, .3, 1); --m-spring: cubic-bezier(.34, 1.56, .64, 1); }

/* Tabs unten: Markierung gleitet zum aktiven Tab */
.m-tabind { position: absolute; top: -1px; left: 0; width: var(--tw, 25%); height: 3px; display: flex; justify-content: center; pointer-events: none;
  transform: translateX(var(--tx, 0)); opacity: 0; transition: transform .5s var(--m-spring), opacity .3s; }
.m-tabind.on { opacity: 1; }
.m-tabind::before { content: ""; width: 30px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); box-shadow: 0 2px 10px var(--accent); }
.m-st nav.tabs .inner { position: relative; }

/* Klick-Welle */
m-rip { display: block; position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
m-rip m-dot { display: block; position: absolute; border-radius: 50%; background: currentColor; opacity: .2; translate: -50% -50%; scale: 0; animation: m-ripple .65s var(--m-ease) forwards; }

/* Häkchen: kleiner Funkenregen */
.m-spark { position: fixed; z-index: 60; width: 7px; height: 7px; border-radius: 50%; pointer-events: none; background: var(--c);
  translate: -50% -50%; animation: m-spark .7s var(--m-ease) forwards; }

@media (prefers-reduced-motion: no-preference) {
  /* ---------- Start der App ---------- */
  .m-boot header { animation: m-down .7s var(--m-ease) both; }
  .m-boot.m-cc .library { animation: m-left .8s var(--m-ease) .1s both; }
  .m-boot .tabbar, .m-boot nav.tabs { animation: m-up .7s var(--m-ease) .15s both; }

  /* ---------- Neuer Inhalt: gestaffelt herein ---------- */
  .m-st-in { animation: m-in .6s var(--m-ease) both; animation-delay: var(--mi, 0ms); }
  .m-grow { transform-origin: 0 50%; animation: m-grow 1.1s var(--m-ease) both; animation-delay: var(--mi, 0ms); }
  .m-popin { animation: m-popin .5s var(--m-spring) both; animation-delay: var(--mi, 0ms); }

  /* ---------- Dialoge: weich auf und zu ---------- */
  dialog { transition: opacity .25s ease, translate .4s var(--m-ease), scale .4s var(--m-ease), display .4s allow-discrete, overlay .4s allow-discrete; }
  dialog:not([open]) { opacity: 0; translate: 0 14px; scale: .96; }
  @starting-style { dialog[open] { opacity: 0; translate: 0 14px; scale: .96; } }
  dialog::backdrop { transition: opacity .35s ease, display .35s allow-discrete, overlay .35s allow-discrete; }
  dialog:not([open])::backdrop { opacity: 0; }
  @starting-style { dialog[open]::backdrop { opacity: 0; } }
  .m-cc dialog[open] > *, .m-st dialog[open] .dlg > * { animation: m-in .5s var(--m-ease) both; }
  .m-cc dialog[open] > :nth-child(2), .m-st dialog[open] .dlg > :nth-child(2) { animation-delay: 40ms; }
  .m-cc dialog[open] > :nth-child(3), .m-st dialog[open] .dlg > :nth-child(3) { animation-delay: 80ms; }
  .m-cc dialog[open] > :nth-child(4), .m-st dialog[open] .dlg > :nth-child(4) { animation-delay: 120ms; }
  .m-cc dialog[open] > :nth-child(5), .m-st dialog[open] .dlg > :nth-child(5) { animation-delay: 160ms; }
  .m-cc dialog[open] > :nth-child(n+6), .m-st dialog[open] .dlg > :nth-child(n+6) { animation-delay: 200ms; }
  /* Am Handy als Blatt von unten */
  @media (max-width: 880px) {
    .m-cc dialog[open] { animation: none; }
    .m-cc dialog:not([open]) { translate: 0 100%; scale: 1; opacity: 1; }
    @starting-style { .m-cc dialog[open] { translate: 0 100%; scale: 1; opacity: 1; } }
  }
  @media (max-width: 600px) {
    .m-st dialog:not([open]) { translate: 0 100%; scale: 1; opacity: 1; }
    @starting-style { .m-st dialog[open] { translate: 0 100%; scale: 1; opacity: 1; } }
  }

  /* ---------- Meldungen springen herein ---------- */
  .m-cc .toast { transition: opacity .3s, transform .55s var(--m-spring); }
  .m-st #toast { transition: opacity .3s, transform .55s var(--m-spring); }

  /* ---------- Antippen: kurz eindrücken ---------- */
  .m-cc :is(.go, .chip, .tab, .mode, .fold, .navhome, .grade button, .seg button, .tabbar button, .crumb, .demo-btn, .exam-set, .hard-link) { transition: scale .18s var(--m-ease); }
  .m-cc .item { transition: transform .15s, border-color .15s, scale .18s var(--m-ease); }
  .m-cc .act { transition: transform .2s, scale .18s var(--m-ease); }
  .m-cc .tile, .m-cc .exam-banner { transition: transform .15s, scale .18s var(--m-ease); }
  .m-cc .opt { transition: border-color .15s, transform .15s, background-color .25s, scale .18s var(--m-ease); }
  .m-cc :is(.go, .chip, .tab, .mode, .fold, .navhome, .grade button, .seg button, .tabbar button, .item, .act, .tile, .exam-banner, .opt, .crumb, .demo-btn, .exam-set, .hard-link):active:not(:disabled) { scale: .965; }
  .m-st :is(.btn, .chip, .iconbtn, .daypick button, nav.tabs button) { transition: scale .18s var(--m-ease), background-color .25s, border-color .25s, color .25s; }
  .m-st :is(.btn, .chip, .iconbtn, .daypick button, nav.tabs button):active:not(:disabled) { scale: .95; }
  .m-st .tick { transition: scale .18s var(--m-ease), background-color .25s, border-color .25s; }
  .m-st .tick:active { scale: .85; }
  .m-st .item { transition: transform .2s ease, border-color .25s, box-shadow .25s; }
  @media (hover: hover) {
    .m-st .item:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); box-shadow: var(--shadow); }
    .m-st .btn:hover:not(:disabled), .m-st .iconbtn:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
    .m-st .iconbtn svg { transition: transform .6s var(--m-ease); }
    .m-st #btn-settings:hover svg, .m-cc #settingsBtn:hover svg { transform: rotate(60deg); }
    .m-cc #settingsBtn svg { transition: transform .6s var(--m-ease); }
    .m-cc .act:hover .em { animation: m-wiggle .6s var(--m-ease); }
    .m-cc .stat { transition: transform .3s var(--m-ease), box-shadow .3s; }
    .m-cc .stat:hover { transform: translateY(-3px); }
  }

  /* Aktiver Tab: Symbol hüpft */
  .m-hop svg { animation: m-hop .5s var(--m-spring); }

  /* Häkchen setzen */
  .m-ticked .tick { animation: m-tick .5s var(--m-spring); }
  .m-ticked .tick svg { animation: m-check .45s var(--m-ease) .05s both; }
  .m-ticked .title { transition: color .4s; }

  /* ClipCards: Quiz, Laden, Eingabe */
  .m-cc .opt.right { animation: m-correct .6s var(--m-ease); }
  .m-cc .explain { animation: m-in .45s var(--m-ease) both; }
  .m-cc .go:disabled { background-image: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%); background-size: 250% 100%; animation: m-shim 1.3s linear infinite; }
  .m-cc .add input, .m-cc .search, .m-cc dialog input, .m-cc .field textarea { transition: border-color .2s, box-shadow .25s; }
  .m-cc .add input:focus, .m-cc .search:focus, .m-cc dialog input:focus, .m-cc .field textarea:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
  .m-cc .done .score { animation: m-popin .7s var(--m-spring) .15s both; }
  .m-cc .grade .yes { transition: filter .15s, scale .18s var(--m-ease), box-shadow .3s; }
  .m-cc .grade .yes:hover { box-shadow: 0 8px 20px -10px var(--ok); }

  /* Stundo: Eingabefelder, Update-Hinweis */
  .m-st .inp { transition: border-color .2s, box-shadow .25s, outline-color .2s; }
  .m-st .inp:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
  .m-st .update:not([hidden]) { animation: m-in .6s var(--m-ease) both; }
}

@keyframes m-in { from { opacity: 0; translate: 0 16px; scale: .98; } }
@keyframes m-down { from { opacity: 0; translate: 0 -16px; } }
@keyframes m-up { from { translate: 0 100%; } }
@keyframes m-left { from { opacity: 0; translate: -22px 0; } }
@keyframes m-grow { from { scale: 0 1; } }
@keyframes m-popin { 0% { opacity: 0; scale: .6; } 100% { opacity: 1; scale: 1; } }
@keyframes m-ripple { to { scale: 1; opacity: 0; } }
@keyframes m-hop { 0% { translate: 0 0; } 40% { translate: 0 -5px; scale: 1.12; } 100% { translate: 0 0; scale: 1; } }
@keyframes m-tick { 0% { scale: .7; } 55% { scale: 1.2; } 100% { scale: 1; } }
@keyframes m-check { from { opacity: 0; scale: .3; rotate: -25deg; } }
@keyframes m-spark { to { translate: calc(-50% + var(--bx)) calc(-50% + var(--by)); scale: .2; opacity: 0; } }
@keyframes m-correct { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@keyframes m-shim { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@keyframes m-wiggle { 0%, 100% { rotate: 0deg; } 30% { rotate: -12deg; scale: 1.12; } 60% { rotate: 8deg; } }
