/* PUL motion: native CSS cursor (no follower element), plus quiet interactions. */
:root {
  --pul-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='32' viewBox='0 0 28 32'%3E%3Cpath d='M3.1 2.2 23.9 17l-9.1 2.2-4.9 8.5z' fill='none' stroke='%238ba4ff' stroke-width='5' stroke-linejoin='round' opacity='.75'/%3E%3Cpath d='M3.1 2.2 23.9 17l-9.1 2.2-4.9 8.5z' fill='%230b0d12' stroke='%23fff' stroke-width='2.2' stroke-linejoin='round'/%3E%3C/svg%3E") 3 2, auto;
}
.pul-pointer-halo {
  display: none !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 0;
  height: 0;
  pointer-events: none;
  user-select: none;
  z-index: 10000;
  opacity: 0;
  transition: opacity 90ms ease;
}

/* A CSS cursor stays single and instant across Windows/macOS and when leaving
   the Mini App.  No JavaScript follower means no lag or duplicate arrows. */
@media (hover: hover) and (pointer: fine) {
  html,body,button,a[href],summary,[role="button"],select,label{cursor:var(--pul-arrow)}
}
input,textarea,[contenteditable]{cursor:text}
.pul-pointer-halo.is-visible { opacity: 1; }
.pul-pointer-halo > span {
  display: block;
  width: 18px;
  height: 22px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 24'%3E%3Cpath d='M10 1.5 17.6 18l-5.9-2.7L10 22.5l-1.7-7.2L2.4 18z' fill='%23fff' stroke='%234263ff' stroke-width='1.6' stroke-linejoin='round'/%3E%3C/svg%3E");
  filter: drop-shadow(0 2px 4px #1f3db955);
  transform: translate(-9px,-1px);
  transform-origin: 9px 2px;
  transition: transform 130ms cubic-bezier(.2,.75,.3,1), filter 130ms ease;
}
.pul-pointer-halo.is-interactive > span {
  transform: translate(-9px,-1px) scale(1.07);
  filter: drop-shadow(0 3px 6px #294bda77);
}
.pul-pointer-halo.is-pressed > span {
  transform: translate(-9px,-1px) scale(.91);
  filter: drop-shadow(0 1px 3px #294bda55);
}

@media (prefers-reduced-motion: no-preference) {
  #content > * {
    animation: pul-page-enter 260ms cubic-bezier(.2,.72,.25,1) backwards;
  }
  #content > :nth-child(2) { animation-delay: 35ms; }
  #content > :nth-child(3) { animation-delay: 65ms; }
  #content > :nth-child(4) { animation-delay: 90ms; }
  :is(.home-grid,.account-grid,.debt-grid,.goal-grid,.planning-grid,.diary-grid) > * {
    animation: pul-card-enter 300ms cubic-bezier(.18,.75,.25,1) backwards;
  }
  :is(.home-grid,.account-grid,.debt-grid,.goal-grid,.planning-grid,.diary-grid) > :nth-child(2) { animation-delay: 45ms; }
  :is(.home-grid,.account-grid,.debt-grid,.goal-grid,.planning-grid,.diary-grid) > :nth-child(3) { animation-delay: 80ms; }
  :is(.home-grid,.account-grid,.debt-grid,.goal-grid,.planning-grid,.diary-grid) > :nth-child(4) { animation-delay: 110ms; }
  .track > span { transform-origin:left center; animation:pul-track-grow 520ms cubic-bezier(.2,.75,.25,1) both; }
  .line-chart polyline { stroke-dasharray:1200; stroke-dashoffset:1200; animation:pul-line-draw 720ms ease-out 90ms both; }
  .line-chart path[fill] { animation:pul-chart-fill 520ms ease-out 250ms both; }
  .donut { animation:pul-donut-enter 420ms cubic-bezier(.2,.72,.25,1) both; }
  .year-ledger-row { animation:pul-row-enter 220ms ease-out backwards; }
  .year-ledger-row:nth-child(3n+2) { animation-delay:25ms; }
  .year-ledger-row:nth-child(3n) { animation-delay:50ms; }
  button:not(:disabled),a[href] { transition:transform 120ms ease,filter 120ms ease,border-color 150ms ease,background-color 150ms ease,color 150ms ease; }
  button:not(:disabled):active,a[href]:active { filter:brightness(.96); transform:scale(.985); }
  body.pul-motion-ready dialog[open] {
    animation: pul-dialog-enter 170ms cubic-bezier(.2, .7, .3, 1) both;
  }
  body.pul-motion-ready dialog[open]::backdrop { animation: pul-backdrop-enter 130ms ease both; }
  body.pul-motion-ready .line-chart svg {
    animation: pul-chart-enter 180ms ease-out both;
  }
  @keyframes pul-chart-enter {
    from { opacity: .55; }
    to { opacity: 1; }
  }
  @keyframes pul-page-enter {
    from { opacity:0; transform:translateY(7px); }
    to { opacity:1; transform:translateY(0); }
  }
  @keyframes pul-card-enter {
    from { opacity:0; transform:translateY(10px) scale(.995); }
    to { opacity:1; transform:translateY(0) scale(1); }
  }
  @keyframes pul-track-grow {
    from { transform:scaleX(0); }
    to { transform:scaleX(1); }
  }
  @keyframes pul-line-draw { to { stroke-dashoffset:0; } }
  @keyframes pul-chart-fill {
    from { opacity:0; }
    to { opacity:1; }
  }
  @keyframes pul-donut-enter {
    from { opacity:.2; transform:scale(.92) rotate(-7deg); }
    to { opacity:1; transform:scale(1) rotate(0); }
  }
  @keyframes pul-row-enter {
    from { opacity:0; transform:translateX(-5px); }
    to { opacity:1; transform:translateX(0); }
  }
  @keyframes pul-dialog-enter {
    from { opacity: 0; transform: translateY(7px) scale(.99); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  @keyframes pul-backdrop-enter {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body.pul-motion-ready :is(.row, .year-ledger-row, .category-row, .settings-routes button) {
    transition: transform 150ms ease, border-color 150ms ease, color 150ms ease,
                box-shadow 150ms ease, background-color 150ms ease;
  }
  body.pul-motion-ready :is(.row, .year-ledger-row, .category-row, .settings-routes button):hover {
    background: transparent;
    border-color: #6985ff70;
    box-shadow: none;
    transform: translateY(-1px);
  }
  body.pul-motion-ready .row { position:relative; overflow:visible; }
  body.pul-motion-ready .row::before {
    content:"";
    position:absolute;
    left:-8px;
    top:12px;
    bottom:12px;
    width:2px;
    border-radius:2px;
    background:var(--blue-light);
    opacity:0;
    transform:scaleY(.55);
    transition:opacity 130ms ease,transform 150ms ease;
  }
  body.pul-motion-ready .row:hover::before,
  body.pul-motion-ready .row:focus-visible::before {
    opacity:.75;
    transform:scaleY(1);
  }
  body.pul-motion-ready :is(.account-card, .diary-card, .goal-card, .debt-card) {
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  }
  body.pul-motion-ready :is(.account-card, .diary-card, .goal-card, .debt-card):hover {
    transform: translateY(-2px);
    border-color: #7389ff80;
    box-shadow: 0 9px 28px #08103322;
  }
  body.pul-motion-ready :is(.account-card, .diary-card):active { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce), (hover: none), (pointer: coarse) {
  .pul-pointer-halo { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  body.pul-motion-ready dialog[open], body.pul-motion-ready dialog[open]::backdrop { animation: none !important; }
  body.pul-motion-ready :is(.account-card, .diary-card, .goal-card, .debt-card) {
    transition: none !important;
    transform: none !important;
  }
  body.pul-custom-pointer, body.pul-custom-pointer * { cursor: auto !important; }
}
