/* Motion for Studio and Quest (motion.js has the JavaScript side). Classic gets none of it: every rule here starts with
   :root:not([data-style="classic"]) or a class only the new styles use. Colours are the style's variables, like app.css. */

/* Settings → Appearance → Animations: Calm = what the computer's "reduce motion" asks for, everywhere. The chart pop-ups
   still fade out by themselves (they are removed when their animation ends). */
:root[data-motion="calm"] *, :root[data-motion="calm"] *::before, :root[data-motion="calm"] *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
:root[data-motion="calm"] .fx-in, :root[data-motion="calm"] .fx-in.fx-res { animation: fx-fade 2.4s linear forwards !important; }

/* ---- sliding pills: the highlight glides from the old choice to the new one ---- */
.pill-host { isolation: isolate; }
.pill-rel { position: relative; }
.pill-ghost { position: absolute; z-index: -1; pointer-events: none; box-sizing: border-box; will-change: transform, width; }
.pill-to { background-color: transparent !important; background-image: none !important; box-shadow: none !important; color: var(--muted) !important; }

/* ---- a soft light under the mouse on cards ---- */
:root:not([data-style="classic"]) :is(.s-card, .q-card, .tk-card, .an-card) { position: relative; }
:root:not([data-style="classic"]) :is(.s-card, .q-card, .tk-card, .an-card)::after,
:root:not([data-style="classic"]) :is(.s-hero, .bl-cont)::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .4s ease;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 9%, transparent), transparent 62%); }
:root:not([data-style="classic"]) :is(.s-card, .q-card, .tk-card, .an-card):hover::after,
:root:not([data-style="classic"]) :is(.s-hero, .bl-cont):hover::before { opacity: 1; }
:root:not([data-style="classic"]) .tk-card::after { background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 6%, transparent), transparent 60%); }

/* ---- Studio: buttons give a little when pressed (Quest's press in with their lip already) ---- */
:root:is([data-style="studio"], [data-style="nebula"], [data-style="clarity"], [data-style="dojo"]) :is(.btn, .pill-btn, .ctl, .ab-tab, .stab, .tab, .tf, .spd, .mk-btn, .look-card, .accent-dot, .segs > button, .tk-size-pick, .size-picks button) {
  transition: transform .14s cubic-bezier(.3, 1.4, .5, 1), background-color .18s, color .18s, border-color .18s, box-shadow .2s; }
:root:is([data-style="studio"], [data-style="nebula"], [data-style="clarity"], [data-style="dojo"]) :is(.btn, .pill-btn, .ctl, .ab-tab, .stab, .tab, .tf, .spd, .mk-btn, .look-card, .accent-dot, .segs > button, .size-picks button):active:not(:disabled) { transform: scale(.96); }
:root:is([data-style="studio"], [data-style="nebula"], [data-style="clarity"], [data-style="dojo"]) .big-play:active:not(:disabled) { transform: scale(.93); }

/* ---- numbers that count to a new value glow once ---- */
.roll-up { animation: roll-up 1.1s ease-out; }
.roll-down { animation: roll-down 1.1s ease-out; }
@keyframes roll-up { 0%, 30% { color: var(--green); text-shadow: 0 0 14px color-mix(in srgb, var(--green) 55%, transparent); } }
@keyframes roll-down { 0%, 30% { color: var(--red); text-shadow: 0 0 14px color-mix(in srgb, var(--red) 55%, transparent); } }
.mchip b, .chips b { font-variant-numeric: tabular-nums; }

/* ---- sparks (burst in motion.js) ---- */
.fx-burst { position: fixed; z-index: 3000; width: 0; height: 0; pointer-events: none; }
.fx-burst i { position: absolute; left: 0; top: 0; display: block; }

/* Settings → Appearance → Feel */
.feel-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.feel-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.feel-seg { flex-shrink: 0; }

/* ================= the replay screen ================= */
/* play ⇄ pause: the triangle's two halves slide into the two bars */
.pm svg { display: block; overflow: visible; }
.pm path { fill: currentColor; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; transition: d .26s cubic-bezier(.4, 0, .2, 1); }
.big-play.on .pm .pm-a { d: path("M6.8 5 L10.6 5 L10.6 19 L6.8 19 Z"); }
.big-play.on .pm .pm-b { d: path("M13.4 5 L17.2 5 L17.2 19 L13.4 19 Z"); }
.big-play .pm { transition: margin .26s; }
/* while it plays, a slow breathing ring (Studio) / a glow (Quest) */
.transport.studio .ctl.big-play.on { animation: play-breathe 2.4s ease-in-out infinite; }
@keyframes play-breathe {
  0%, 100% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 16%, transparent), 0 8px 24px color-mix(in srgb, var(--accent) 26%, transparent); }
  50% { box-shadow: 0 0 0 11px color-mix(in srgb, var(--accent) 7%, transparent), 0 8px 30px color-mix(in srgb, var(--accent) 36%, transparent); } }
.q-transport .ctl.big-play.on { animation: q-play 2.4s ease-in-out infinite; }
@keyframes q-play { 50% { box-shadow: 0 3px 0 var(--accent-lip), 0 0 22px color-mix(in srgb, var(--accent) 55%, transparent); } }

/* the day line: the fill glides, a session dot pings as the replay passes it, and says which session opened */
.ws.styled .dl-fill { transition: width .22s ease-out; }
.ws.styled .dl-thumb { transition: left .22s ease-out; }
.dl-sess.past { box-shadow: 0 0 0 2px var(--dl-ring, var(--panel)), 0 0 8px currentColor; }
.dl-sess.asia { color: var(--sess-asia); } .dl-sess.london { color: var(--sess-london); } .dl-sess.ny { color: var(--sess-ny); }
.dl-sess.ping::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid currentColor; animation: sess-ping 1.1s ease-out 2; }
@keyframes sess-ping { from { transform: scale(1); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }
.dl-callout { position: absolute; bottom: 16px; transform: translateX(-50%); z-index: 3; white-space: nowrap; pointer-events: none;
  padding: 3px 10px; border-radius: 999px; background: var(--panel2); border: 1px solid currentColor; font: 600 12px var(--font-body);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--bg) 60%, transparent); animation: callout 2.6s cubic-bezier(.2, .8, .2, 1) forwards; }
.dl-callout.asia { color: var(--sess-asia); } .dl-callout.london { color: var(--sess-london); } .dl-callout.ny { color: var(--sess-ny); }
@keyframes callout { 0% { opacity: 0; transform: translate(-50%, 8px) scale(.8); } 10% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  16% { transform: translate(-50%, 0) scale(1); } 82% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -6px); } }
/* Quest (no day line): the same news as a banner at the top of the chart */
.sess-banner { position: absolute; top: 12px; left: 50%; z-index: 6; display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px 0 10px;
  border-radius: 12px; background: var(--panel); border: 2px solid currentColor; font: 700 13px var(--font-body); pointer-events: none;
  box-shadow: 0 4px 0 var(--lipc); animation: banner 2.6s cubic-bezier(.2, .8, .2, 1) forwards; }
.sess-banner i { width: 10px; height: 10px; border-radius: 50%; background: currentColor; box-shadow: 0 0 10px currentColor; }
.sess-banner small { font: 500 11px var(--font-mono); color: var(--muted); }
.sess-banner.asia { color: var(--sess-asia); } .sess-banner.london { color: var(--sess-london); } .sess-banner.ny { color: var(--sess-ny); }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -14px); } 10% { opacity: 1; transform: translate(-50%, 2px); } 16% { transform: translate(-50%, 0); }
  82% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -8px); } }

/* an order filled: rings spread from the fill price */
.fx-ripple { width: 0; height: 0; transform: none; }
.fx-ripple i, .fx-ripple b { position: absolute; left: 0; top: 0; border-radius: 50%; transform: translate(-50%, -50%); }
.fx-ripple i { width: 12px; height: 12px; border: 2px solid var(--up-text); animation: ripple 1.2s cubic-bezier(.2, .7, .3, 1) forwards; }
.fx-ripple i + i { animation-delay: .18s; opacity: 0; }
.fx-ripple b { width: 8px; height: 8px; background: var(--up-text); animation: ripple-dot 1.3s ease-out forwards; }
.fx-ripple.sell i { border-color: var(--down-text); } .fx-ripple.sell b { background: var(--down-text); }
@keyframes ripple { 0% { width: 8px; height: 8px; opacity: 1; } 100% { width: 64px; height: 64px; opacity: 0; } }
@keyframes ripple-dot { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 1; } 30% { transform: translate(-50%, -50%) scale(1.3); } 100% { transform: translate(-50%, -50%) scale(1); opacity: 0; } }

/* Place: a light passes over it once when the last rule is ticked */
.ws.styled .place { position: relative; overflow: hidden; }
.ws.styled .place.warm::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, var(--text-hi) 45%, transparent) 50%, transparent 70%);
  transform: translateX(-110%); animation: sheen .85s .12s cubic-bezier(.3, .6, .3, 1) forwards; }
@keyframes sheen { to { transform: translateX(110%); } }
/* the rules card glows once when every rule is ticked (with its Place footer: the footer's ::before, looks.css) */
.tk-plan:has(.rules-check.just-done), .tk-plan:has(.rules-check.just-done) + .tk-foot::before, .rules-check.styled.just-done:not(.tk-plan *) { animation: plan-glow 1s ease-out; }
@keyframes plan-glow { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 14px color-mix(in srgb, var(--accent) 0%, transparent); } }
.rules-check.styled.just-done .rules-bar span.on { animation: bar-flash .6s ease-out; animation-delay: calc(var(--k, 0) * 40ms); }
@keyframes bar-flash { 40% { background: var(--accent-hi); transform: scaleY(1.6); } }
.rules-check.styled .rules-count { transition: color .25s; }
/* a confluence chip gives a tiny pop when it turns on (its own, never the plan glow) */
:root:not([data-style="classic"]) .conf-check.styled .conf-chip.on .conf-mark { animation: conf-pop .3s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes conf-pop { 0% { transform: scale(.4); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .conf-check.styled .conf-chip.on .conf-mark { animation: none; } }

/* Trades today: the count ticks up; the table rows come in one after the other when it opens */
.ts-num { display: inline-block; }
.ts-num.bump { animation: num-bump .5s cubic-bezier(.2, 1.6, .4, 1); }
.ts-seal.bump { animation: seal-stamp .35s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes num-bump { 0% { transform: translateY(70%); opacity: 0; } 60% { transform: translateY(-12%); opacity: 1; } 100% { transform: none; } }
.ws.styled .bottom.opening .trades tbody tr { animation: row-in .35s cubic-bezier(.2, .8, .2, 1) both; }
.ws.styled .bottom.opening .trades tbody tr:nth-child(2) { animation-delay: 40ms; } .ws.styled .bottom.opening .trades tbody tr:nth-child(3) { animation-delay: 80ms; }
.ws.styled .bottom.opening .trades tbody tr:nth-child(4) { animation-delay: 120ms; } .ws.styled .bottom.opening .trades tbody tr:nth-child(5) { animation-delay: 160ms; }
.ws.styled .bottom.opening .trades tbody tr:nth-child(n+6) { animation-delay: 200ms; }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } }
.ts-toggle svg { transition: transform .25s; }

/* Quest: the XP a trade earned floats up under the level crest, and the crest gives a little hop */
.xp-float { position: fixed; z-index: 3000; transform: translateX(-50%); pointer-events: none; padding: 2px 9px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font: 800 12px var(--font-display); box-shadow: 0 3px 0 var(--accent-lip);
  animation: xp-float 1.6s cubic-bezier(.2, .8, .2, 1) forwards; }
@keyframes xp-float { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.08); }
  25% { transform: translate(-50%, 0) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -18px); } }
.wt-crest.bump svg { animation: crest-hop .6s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes crest-hop { 0% { transform: scale(1); } 35% { transform: scale(1.18) rotate(-6deg); } 100% { transform: none; } }

/* ================= Home ================= */
/* the practice calendar fills in as a wave, oldest week first; today's square keeps a soft pulse */
:root:not([data-style="classic"]) .hm-grid .hm-c { animation: hm-in .45s cubic-bezier(.2, 1.3, .4, 1) both; animation-delay: calc(var(--d, 0) * 16ms + 120ms); }
@keyframes hm-in { from { transform: scale(.2); opacity: 0; } }
:root:not([data-style="classic"]) .hm-grid .hm-c.today { animation: hm-in .45s cubic-bezier(.2, 1.3, .4, 1) both, hm-today 2.6s ease-in-out 1.2s infinite; animation-delay: calc(var(--d, 0) * 16ms + 120ms), 1.4s; }
@keyframes hm-today { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); } }
/* the rank rings light up from the middle out */
.rk-rings circle.on { animation: ring-on .5s ease-out both; animation-delay: calc(var(--k, 0) * 90ms + 250ms); }
@keyframes ring-on { from { stroke: var(--seg-off); } 60% { stroke: var(--accent-hi); } }
/* the small chart of where you stopped draws itself left to right, and "now" blinks softly */
.mini-chart svg { animation: mc-draw 1.1s cubic-bezier(.3, .7, .2, 1) both; }
@keyframes mc-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.mini-chart line.cur { animation: cur-blink 1.6s ease-in-out 1.1s infinite; }
@keyframes cur-blink { 50% { opacity: .35; } }
/* backtest rows lean in a little under the mouse */
:root:not([data-style="classic"]) .bl-row { transition: background-color .15s, transform .2s cubic-bezier(.2, .8, .2, 1); }
:root:not([data-style="classic"]) .bl-row:hover { transform: translateX(3px); }
:root:not([data-style="classic"]) .bl-rows .bl-row { animation: row-in .4s cubic-bezier(.2, .8, .2, 1) both; }
.bl-rows .bl-row:nth-child(2) { animation-delay: 50ms; } .bl-rows .bl-row:nth-child(3) { animation-delay: 100ms; }
.bl-rows .bl-row:nth-child(4) { animation-delay: 150ms; } .bl-rows .bl-row:nth-child(n+5) { animation-delay: 200ms; }
/* Quest's quest rows: a finished quest's hex stamps in */
.qq-row.done .hex-tile { animation: seal-stamp .4s cubic-bezier(.2, 1.6, .4, 1) .3s both; }

/* ---- a new level (Quest) / practice rank (Studio): the celebration (progressMoment in stylehome.js) ---- */
.cu-wrap { position: fixed; inset: 0; z-index: 2500; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(6px); animation: cu-fade .3s ease-out both; }
.cu-wrap.out { animation: cu-fade .22s ease-in reverse both; }
@keyframes cu-fade { from { opacity: 0; } }
.cu-card { position: relative; width: min(420px, 100%); padding: 36px 32px 28px; text-align: center; overflow: hidden; isolation: isolate;
  background: var(--panel); border: 1px solid var(--line2); border-radius: 28px; box-shadow: 0 30px 80px color-mix(in srgb, var(--bg) 80%, transparent);
  animation: cu-pop .55s cubic-bezier(.2, 1.35, .4, 1) both; }
.cu-wrap.quest .cu-card { border-radius: 22px; border: 2px solid var(--line2); box-shadow: 0 6px 0 var(--lipc), 0 30px 80px color-mix(in srgb, var(--bg) 80%, transparent); }
@keyframes cu-pop { from { opacity: 0; transform: scale(.82) translateY(14px); } }
.cu-rays { position: absolute; left: 50%; top: 104px; width: 520px; height: 520px; margin: -260px 0 0 -260px; z-index: -1; pointer-events: none; opacity: .55;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--accent) 22%, transparent) 0deg 9deg, transparent 9deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 0 18%, transparent 62%); mask: radial-gradient(circle, #000 0 18%, transparent 62%);
  animation: cu-spin 18s linear infinite, cu-fade .8s ease-out both; }
@keyframes cu-spin { to { transform: rotate(360deg); } }
.cu-emblem { display: flex; justify-content: center; margin-bottom: 14px; filter: drop-shadow(0 10px 24px color-mix(in srgb, var(--accent) 45%, transparent));
  animation: cu-drop .7s cubic-bezier(.2, 1.5, .4, 1) .12s both; }
@keyframes cu-drop { from { opacity: 0; transform: translateY(-26px) scale(.5) rotate(-14deg); } }
.cu-kicker { font: 700 12px var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); animation: row-in .4s ease-out .35s both; }
.cu-title { font: 800 34px/1.1 var(--font-display); letter-spacing: -.01em; margin: 6px 0 10px; animation: row-in .4s ease-out .42s both; }
.cu-roll { display: inline-grid; vertical-align: bottom; overflow: hidden; height: 1.1em; }
.cu-roll > span { grid-area: 1 / 1; }
.cu-old { animation: cu-out .45s cubic-bezier(.5, 0, .5, 1) .75s both; }
.cu-new { color: var(--accent-text); animation: cu-in .5s cubic-bezier(.2, 1.4, .4, 1) .82s both; }
@keyframes cu-out { to { transform: translateY(-110%); opacity: 0; } }
@keyframes cu-in { from { transform: translateY(110%); opacity: 0; } }
.cu-sub { margin: 0 auto 22px; max-width: 320px; color: var(--muted); font-size: 14px; line-height: 1.5; animation: row-in .4s ease-out .5s both; }
.cu-actions { display: flex; justify-content: center; gap: 10px; animation: row-in .4s ease-out .58s both; }
.cu-actions .btn { min-width: 110px; }
.xp-rail20:not(.intro) .mtr i.on { animation: none; }

/* ---- corner messages: they spring in, and a thin line shows how long they stay ---- */
:root:not([data-style="classic"]) .toast { position: relative; overflow: hidden; border-radius: 14px; animation: toast-in .42s cubic-bezier(.2, 1.3, .4, 1) both; }
:root[data-style="quest"] .toast { border-radius: 12px; border-width: 2px; box-shadow: 0 4px 0 var(--lipc), 0 10px 30px color-mix(in srgb, var(--bg) 60%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateX(28px) scale(.96); } }
:root:not([data-style="classic"]) .toast[style*="--ms"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; transform-origin: left;
  background: color-mix(in srgb, var(--accent) 60%, transparent); animation: toast-time var(--ms) linear forwards; }
:root:not([data-style="classic"]) .toast.success[style*="--ms"]::after { background: color-mix(in srgb, var(--green) 60%, transparent); }
:root:not([data-style="classic"]) .toast.error[style*="--ms"]::after { background: color-mix(in srgb, var(--red) 60%, transparent); }
@keyframes toast-time { from { transform: scaleX(1); } to { transform: scaleX(0); } }
:root:not([data-style="classic"]) .toast.out { animation: toast-out .28s ease-in forwards; }
@keyframes toast-out { to { opacity: 0; transform: translateX(28px) scale(.96); } }
.feel-seg { padding: 3px; border-radius: 999px; background: var(--sunken); gap: 2px; }
.feel-seg button { min-width: 64px; height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 600 13px var(--font-body); cursor: pointer; }
.feel-seg button:hover:not(.on) { color: var(--text); }
.feel-seg button.on { background: var(--accent); color: var(--accent-ink); }
:root[data-style="quest"] .feel-seg, :root[data-style="quest"] .feel-seg button { border-radius: 10px; }
:root[data-style="classic"] .feel-seg, :root[data-style="classic"] .feel-seg button { border-radius: var(--radius-btn); }
/* the streak grew since the last visit: the flame flares up and the number rolls from the old count to the new one */
.s-flame.ignite, .qh-flame.ignite { display: inline-flex; transform-origin: 50% 90%; animation: ignite 1.1s cubic-bezier(.2, 1.3, .4, 1) .25s both; }
@keyframes ignite { 0% { transform: scale(.55) translateY(12%); filter: brightness(.7); }
  45% { transform: scale(1.28); filter: brightness(1.45) drop-shadow(0 0 18px color-mix(in srgb, var(--flame) 80%, transparent)); } 100% { transform: none; filter: none; } }
.sk-roll { display: inline-grid; overflow: hidden; vertical-align: bottom; }
.sk-roll > span { grid-area: 1 / 1; }
.sk-old { animation: cu-out .4s cubic-bezier(.5, 0, .5, 1) .45s both; }
.sk-new { animation: cu-in .5s cubic-bezier(.2, 1.4, .4, 1) .52s both; }
/* the "Loading candles from Replaybook…" note (api.js) and a chart's "couldn't load" message: they fade in and the dot breathes, in the styled looks only (never Classic, Calm or reduced motion) */
:root:not([data-style="classic"]):not([data-motion="calm"]) .load-note { animation: load-in .25s ease-out both; }
:root:not([data-style="classic"]):not([data-motion="calm"]) .load-dot { animation: load-pulse 1.1s ease-in-out infinite; }
:root:not([data-style="classic"]):not([data-motion="calm"]) .chart-err { animation: load-in .25s ease-out both; }
@keyframes load-in { from { opacity: 0; } }
@keyframes load-pulse { 50% { transform: scale(.55); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .load-note, .load-dot, .chart-err { animation: none !important; } }
:root:not([data-style="classic"]):not([data-motion="calm"]) .chart.loading::after { background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 40% 100%; background-repeat: no-repeat; animation: load-slide 1.1s ease-in-out infinite; }
@keyframes load-slide { from { background-position: -50% 0; } to { background-position: 150% 0; } }
@media (prefers-reduced-motion: reduce) { .chart.loading::after { animation: none !important; } }

/* ================= from page to page (main.js → motion.js swapPage) ================= */
/* The next page is swapped in at once; in the styled looks with a short cross-fade (View Transitions) while the top bar
   stays where it is: Home's bar, the backtest's and Charts' share one name, so it changes in place (unless it was scrolled
   out of sight: data-vt-top="off", then it fades with the page). <html data-vt> is set
   while one runs: 'page' or 'tab' (Replay / Journal / Analytics inside a backtest: a little quicker, nothing named).
   Never in Classic, Calm or "reduce motion" (swapPage doesn't start one there; the guards below are a second line). */
:root[data-vt="page"]:not([data-vt-top="off"]) :is(.appbar:not(.quest), .appbar-wrap.quest, .wt-top, .ws.lc.styled .lc-top) { view-transition-name: rb-top; }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="calm"]):not([data-style="classic"])::view-transition-group(*),
  :root:not([data-motion="calm"]):not([data-style="classic"])::view-transition-old(*),
  :root:not([data-motion="calm"]):not([data-style="classic"])::view-transition-new(*) { animation-duration: 180ms; animation-timing-function: ease; }
  :root[data-vt="tab"]:not([data-motion="calm"]):not([data-style="classic"])::view-transition-old(root),
  :root[data-vt="tab"]:not([data-motion="calm"]):not([data-style="classic"])::view-transition-new(root) { animation-duration: 150ms; }
  :root:not([data-motion="calm"]):not([data-style="classic"])::view-transition-group(rb-top) { z-index: 1; }
  /* a top bar only on one side (the welcome page has none): it settles in */
  :root:not([data-motion="calm"]):not([data-style="classic"])::view-transition-new(rb-top):only-child { animation: rb-top-in 180ms cubic-bezier(.2, .8, .2, 1) both; }
  :root:not([data-motion="calm"]):not([data-style="classic"])::view-transition-old(rb-top):only-child { animation: rb-top-out 160ms ease-in both; }
}
@keyframes rb-top-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes rb-top-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }
:root:is([data-motion="calm"], [data-style="classic"])::view-transition-group(*),
:root:is([data-motion="calm"], [data-style="classic"])::view-transition-old(*),
:root:is([data-motion="calm"], [data-style="classic"])::view-transition-new(*) { animation: none !important; }

/* Cards that rise in, calendars that fill, small charts that draw themselves: only on the first page a window shows.
   A page swapped in later (.page.swapped, main.js) or a Journal / Analytics opened from the tabs (.ws-alt.swapped)
   appears whole, with the cross-fade, instead of moving again after it. */
.swapped :is(.home.styled > .home-body, .ws.styled, .s-main > *, .s-list, .q-home > .q-card, .mtr i.on, .rk-bar span, .q-bar span,
  .sand-bar span, .ms-bar span, .day-ring .arc.on, .hm-grid .hm-c:not(.today), .rk-rings circle.on, .mini-chart svg, .bl-rows .bl-row,
  .qq-row.done .hex-tile, .cl-home > *, .cl-cards > .cl-card, .cl-two > .cl-card, .cl-day, .cl-wd.done .cl-wd-dot, .sk-s .sk-dot,
  .sk-s .sk-glow, .sk-ln, .s-hero, .s-row > *, .s-recap, .dj-cards > .dj-card, .dj-row2 > .dj-card, .enso.draw svg, .brush-bar .bb-on,
  .cal-seal.sealed) { animation: none !important; }
.swapped .dj-book .practice-book svg { animation: none !important; -webkit-mask: none !important; mask: none !important; }
/* Analytics' charts draw themselves only on a first page; swapped in they show whole (their end state, as with reduce motion) */
.swapped :is(.an-eq .line, .an-eq .area, .an-day rect) { animation: none !important; stroke-dashoffset: 0; opacity: 1; }
:root:not([data-style="classic"]) .swapped .hm-grid .hm-c.today { animation: hm-today 2.6s ease-in-out 1.4s infinite; }
