/* SELVO 1.14.0: controls that react to the finger (feel.js, haptics.js). Loaded last.
   Held controls grow and lift like iOS 26's tab bar lens, with a soft spring (a few % past, then settled). Scale uses
   the separate `scale` property, never `transform`, because the indicators are positioned by an inline transform.
   Pressing a card or a button still only dims it: nothing bounces on a plain tap. */
:root { --m-spring: cubic-bezier(.3, 1.25, .5, 1); }
@supports (transition-timing-function: linear(0, 1)) {
  :root { --m-spring: linear(0, .22 5%, .56 11%, .84 18%, 1.005 26%, 1.045 33%, 1.03 42%, 1.006 54%, .998 68%, 1); }
}
@media (prefers-reduced-motion: reduce) { :root { --m-spring: var(--m-ease); } }

/* 1.14.0 (Max: "not everything has to animate in"): no staggered entrances on tabs, screens or sheets */
.enter, .lg-up { animation: none !important; }

/* 1.14.1: the tab bar lives in tabbar.css / tabbar.js now */
.seg:not(.tabbar) > .ind {
  transition: transform var(--m-glide) var(--m-ease), width var(--m-glide) var(--m-ease), height var(--m-glide) var(--m-ease),
    background-color var(--m-fade) var(--m-ease), opacity var(--m-fade), scale .46s var(--m-spring), box-shadow .3s var(--m-ease);
}
/* segmented controls: the thumb swells a little and lifts */
.seg:not(.tabbar) > button { transition: color var(--m-fade) var(--m-ease), scale .4s var(--m-spring); }

/* ---------------------------------------------------------------- sliders: the thumb grows into a lens while dragged */
.ios-sl .sl-thumb { transition: scale .42s var(--m-spring), box-shadow .3s var(--m-ease); }
.ios-sl.held .sl-thumb, .ios-sl.drag .sl-thumb { scale: 1.32; box-shadow: var(--thumb-sh), 0 6px 16px rgba(0, 0, 0, .22); }
.ios-sl .sl-track { transition: scale .42s var(--m-spring); }
.ios-sl.held .sl-track, .ios-sl.drag .sl-track { scale: 1 1.6; }

/* ---------------------------------------------------------------- switches: the knob stretches while held, like iOS */
.tg::after, .tog::after { transition: transform var(--m-toggle) var(--m-ease), width .34s var(--m-spring); }
.tg.held::after, .tog.held::after { width: 33px; }
.tg.held:checked::after { transform: translate3d(14px, 0, 0); }
.tg.held.tg-drag::after, .tog.held.tg-drag::after { transform: translate3d(min(var(--tgx, 0px), 14px), 0, 0); transition: width .34s var(--m-spring); }

/* ---------------------------------------------------------------- slide to confirm: tearing open a letter
   Behind the thumb the paper splits along a perforation: a slit with torn, zigzag edges opens wider the further
   you drag, with a soft shadow under the lifted edge. Ahead of the thumb the perforation waits as a dotted line.
   At the end it tears fully open; let go early and it springs shut. */
.lg-slide { --slit: var(--lg-thumb); }
.lg-slide.held .lg-thumb, .lg-slide.drag .lg-thumb { scale: 1.1; }
.lg-thumb { transition: transform var(--m-snap) var(--m-spring), scale .4s var(--m-spring), background-color var(--m-done) var(--m-ease), color var(--m-done) var(--m-ease); }
.lg-tear { position: absolute; z-index: 2; inset: 0; pointer-events: none; filter: drop-shadow(0 1px 1.2px rgba(0, 0, 0, .35)); }
.lg-slit {
  position: absolute; left: 0; top: 50%;
  width: calc(var(--x) + 30px); height: calc(5px + var(--p) * 30px); transform: translate3d(0, -50%, 0);
  background: linear-gradient(to bottom, rgba(0, 0, 0, .3), rgba(0, 0, 0, .06) 4px, transparent 40%, transparent 75%, rgba(0, 0, 0, .12)), var(--slit);
  opacity: min(1, calc(var(--p) * 6));
  --zz: 9px 4px;
  -webkit-mask: linear-gradient(#000 0 0) center / 100% calc(100% - 7.6px) no-repeat,
    conic-gradient(from -45deg at 50% 100%, #0000, #000 1deg 89deg, #0000 90deg) top / var(--zz) repeat-x,
    conic-gradient(from 135deg at 50% 0, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--zz) repeat-x;
  mask: linear-gradient(#000 0 0) center / 100% calc(100% - 7.6px) no-repeat,
    conic-gradient(from -45deg at 50% 100%, #0000, #000 1deg 89deg, #0000 90deg) top / var(--zz) repeat-x,
    conic-gradient(from 135deg at 50% 0, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--zz) repeat-x;
  transition: width var(--m-snap) var(--m-spring), height var(--m-snap) var(--m-spring), opacity var(--m-snap) var(--m-ease);
}
.lg-perf {
  position: absolute; z-index: 0; top: 50%; height: 2px; margin-top: -1px; left: calc(var(--x) + 54px); right: 20px; pointer-events: none;
  background: radial-gradient(circle, var(--faint) 0 .9px, transparent 1.2px) 0 50% / 7px 2px repeat-x;
  opacity: calc(.55 - var(--p) * .3);
  transition: left var(--m-snap) var(--m-spring), opacity var(--m-snap) var(--m-ease);
}
.lg-slide.drag .lg-slit, .lg-slide.drag .lg-perf { transition: none; }
.lg-slide.drag .lg-thumb { transition: scale .4s var(--m-spring); } /* 1:1 with the finger, only the grow springs */
.lg-slide.done .lg-slit { width: 100%; height: calc(100% - 10px); opacity: 1; transition: width var(--m-done) var(--m-spring), height var(--m-done) var(--m-spring); }
.lg-slide.done .lg-perf { opacity: 0; }
.lg-slide .lg-sl, .lg-slide .lg-chev { z-index: 1; }
.lg-slide .lg-thumb { z-index: 3; }

/* ---------------------------------------------------------------- swipe back: the screen carries a soft edge shadow */
.screen.swiping { box-shadow: -10px 0 28px rgba(0, 0, 0, .18); }
.sheet-wrap .scrim { opacity: calc(1 - var(--pull, 0) * .8); }

/* ---------------------------------------------------------------- pull to refresh: the chainring */
#ptr {
  position: fixed; z-index: 4; left: 50%; top: calc(var(--st) + 6px); width: 34px; height: 34px; margin-left: -17px;
  color: var(--fg); pointer-events: none; opacity: 0;
  transform: translate3d(0, calc(var(--pull, 0) * 22px - 14px), 0) scale(calc(.6 + min(var(--pull, 0), 1) * .4));
  transition: opacity .2s var(--m-ease), transform .32s var(--m-ease);
}
body.stacked #ptr { display: none; }
#ptr.show { opacity: calc(.25 + min(var(--pull, 0), 1) * .75); transition: opacity .12s; }
#ptr svg { display: block; width: 100%; height: 100%; }
#ptr .ptr-r { transform-origin: 20px 20px; transform: rotate(calc(var(--pull, 0) * 300deg)); }
#ptr.armed { opacity: 1; }
#ptr.armed svg { animation: ptrClick .3s var(--m-spring); }
@keyframes ptrClick { 40% { scale: 1.14; } }
#ptr.spin { opacity: 1; --pull: 1; }
#ptr.spin .ptr-r { animation: ptrSpin .7s cubic-bezier(.45, 0, .2, 1); }
@keyframes ptrSpin { from { transform: rotate(300deg); } to { transform: rotate(660deg); } }

/* ---------------------------------------------------------------- checking off: a strike, a little dust */
.just .txt b { position: relative; width: fit-content; max-width: 100%; }
.just .txt b::after {
  content: ''; position: absolute; left: 0; right: 0; top: 54%; height: 1.6px; border-radius: 1px; background: currentColor;
  transform-origin: 0 50%; animation: strike .95s var(--m-ease) forwards;
}
@keyframes strike { 0% { transform: scaleX(0); opacity: 1; } 42% { transform: scaleX(1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0; } }
.just .box { animation: boxIn .5s var(--m-spring); }
@keyframes boxIn { 30% { scale: .86; } }
#dust { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#dust i { position: absolute; border-radius: 50%; background: var(--acc); will-change: transform, opacity; }

/* ---------------------------------------------------------------- long press: the row presses in while it charges */
.rm-row, [data-a="fx-open"] { transition: scale .5s var(--m-ease), opacity .22s; }
.charging { scale: .965; transition: scale .41s cubic-bezier(.4, 0, .6, 1) !important; }

/* ---------------------------------------------------------------- the record button clips in like a pedal */
[data-a="rec-start"] .i { transition: rotate .42s var(--m-spring); }
[data-a="rec-start"].clipping .i { rotate: -28deg; transition-duration: .18s; }

@media (prefers-reduced-motion: reduce) {
  .ios-sl.held .sl-track, .ios-sl.drag .sl-track { scale: none; }
  .just .txt b::after, .just .box, #ptr.armed svg, #ptr.spin .ptr-r { animation: none; }
}
