/* 0.80: the shared motion system. Only movement lives here: no colour, size or layout of its own.
   Every duration and curve is one of these dials, and motion.js reads the same ones. */
:root{--m-fast:120ms;--m-med:220ms;--m-slow:320ms;--m-seat:560ms;--m-exit:120ms;--m-rise:18px;--m-slide:34px;--m-tilt:-3deg;--m-pop:.965;--m-gap:30ms;--m-seat-gap:45ms;--m-ease:cubic-bezier(.2,.85,.25,1);--m-bounce:cubic-bezier(.25,1.2,.4,1);--m-slice:560ms;--m-wave:460ms}

/* Dialogs: close() stays instant for focus and clicks, so a closing dialog only fades and takes no clicks. */
dialog{opacity:0;translate:0 var(--m-rise);scale:var(--m-pop);transition:opacity var(--m-exit) ease-in,translate var(--m-exit) ease-in,scale var(--m-exit) ease-in,transform var(--m-exit) ease-in,overlay var(--m-exit) allow-discrete,display var(--m-exit) allow-discrete}
dialog:not([open]){pointer-events:none}
dialog[open]{opacity:1;translate:none;scale:none;transition-duration:var(--m-slow);transition-timing-function:var(--m-bounce)}
dialog::backdrop{opacity:0;transition:opacity var(--m-exit) linear,overlay var(--m-exit) allow-discrete,display var(--m-exit) allow-discrete}
dialog[open]::backdrop{opacity:1;transition-duration:var(--m-med)}
@starting-style{dialog[open]{opacity:0;translate:0 calc(var(--m-rise)*1.4);scale:var(--m-pop)}dialog[open]:not(#answer-window,#online-dialog){transform:skewX(var(--m-tilt))}dialog[open]::backdrop{opacity:0}}
/* The full-screen room and the deal window give way straight to the board: nothing fades over it. */
#online-dialog{scale:none}
:is(#online-dialog,#round-dialog):not([open]),:is(#online-dialog,#round-dialog):not([open])::backdrop{transition:none}

/* Popovers: the toast, Your card peek, trait report and revealed notes. */
:is(#toast,#peek-popover,.trait-report,.ch-notes-menu){opacity:0;translate:0 -8px;transition:opacity var(--m-exit) ease-in,translate var(--m-exit) ease-in,overlay var(--m-exit) allow-discrete,display var(--m-exit) allow-discrete}
:is(#toast,#peek-popover,.trait-report,.ch-notes-menu):not(:popover-open){pointer-events:none}
:is(#toast,#peek-popover,.trait-report,.ch-notes-menu):popover-open{opacity:1;translate:none;transition-duration:var(--m-med);transition-timing-function:var(--m-bounce)}
@starting-style{:is(#toast,#peek-popover,.trait-report,.ch-notes-menu):popover-open{opacity:0;translate:0 calc(var(--m-rise)*-.6)}}

/* The app's own menus fade away; motion.js unfurls them on the way in. */
:is(.board-menu-panel,.board-filter,.home-pool-strip){transition:opacity var(--m-exit) ease-in,display var(--m-exit) allow-discrete}
:is(.board-menu-panel,.board-filter,.home-pool-strip)[hidden]{opacity:0;pointer-events:none}

/* Tabs and segments change colour smoothly. */
:is(.nav,.seg button,.rail-tabs button,.panel-tabs button,.settings-nav button,.browse-tabs button){transition:color var(--m-med),background-color var(--m-med),border-color var(--m-med),box-shadow var(--m-med),transform var(--m-fast) var(--m-bounce),filter var(--m-fast)}
/* While the sliding marker is in flight the real one waits, and a moving plate rides above its neighbours. */
.m-landing{border-bottom-color:transparent!important;box-shadow:none!important}
.m-lift{z-index:1}
.m-fly{position:fixed;z-index:60;pointer-events:none;margin:0}

/* Buttons press in; on a mouse they also lift. Nothing that positions itself with transform is touched. */
.cta:active:not(:disabled,#answer-pill){transform:translate(3px,3px) scale(.98)}
.cta:not(#answer-pill){transition:transform var(--m-fast) var(--m-bounce),filter var(--m-fast)}
:is(.ghost,.quiet):not(:disabled){transition:transform var(--m-fast) var(--m-bounce),border-color var(--m-fast),color var(--m-fast),background-color var(--m-fast),filter var(--m-fast)}
:is(.ghost,.quiet):active:not(:disabled){transform:translateY(1px) scale(.97)}
:is(.choice-tile,.variant-tile,.home-card .cta):active:not(:disabled){scale:.985}
:is(.choice-tile,.variant-tile){transition:border-color var(--m-med),box-shadow var(--m-med),scale var(--m-fast) var(--m-bounce),translate var(--m-fast) var(--m-bounce)}
.close{transition:transform var(--m-med) var(--m-bounce),background-color var(--m-fast),filter var(--m-fast)}
.history-item{transition:translate var(--m-fast) var(--m-ease),border-color var(--m-fast)}
@media(hover:hover){
 .ghost:hover:not(:disabled){transform:translateY(-2px)}
 :is(.choice-tile,.variant-tile):hover:not(:disabled){translate:0 -2px}
 .close:hover{transform:rotate(90deg)}
 .history-item:hover{translate:4px 0}
}

/* Table view and the Stream window. */
.tv-box{transition:border-top-color var(--m-med)}
.tv-bar i{transition:width var(--m-slow) var(--m-ease)}
.tv-tag{animation:m-pop-in var(--m-med) var(--m-bounce)}
.tv-moving{position:relative;z-index:3;box-shadow:0 18px 40px rgba(0,0,0,.45)}
/* In Table view a player changing seats passes underneath your board and the panel, never over them. */
body.in-round.table-view #round-workspace>:is(#library-section,.notes){z-index:4}
body.in-round.table-view #round-workspace{overflow:clip}
.tv-shade{animation:m-fade var(--m-med) linear}
.tv-card{animation:m-pop-in var(--m-slow) var(--m-bounce)}
@keyframes m-fade{from{opacity:0}}
@keyframes m-pop-in{from{opacity:0;scale:var(--m-pop)}}

/* 0.90 Living board (board-motion.js). Every part waits for the tile's own delay (--dl) looking untouched.
   The slice: a blade crosses the tile corner to corner, the halves part along the cut and close greyed, the cross lands. */
.m-half{position:absolute;inset:0;overflow:hidden;opacity:0;pointer-events:none;background:var(--panel)}
.m-half .avatar{position:absolute;inset:0;font-size:56px}
.tile-wrap.m-slice{overflow:clip}
.tile-wrap.m-slice>.character{animation:m-cut-a var(--m-slice) var(--m-ease) var(--dl,0ms) both}
.tile-wrap.m-slice>.m-half{animation:m-cut-b var(--m-slice) var(--m-ease) var(--dl,0ms) both}
.tile-wrap.m-slice :is(.card-top,.copy,.star){visibility:visible;animation:m-copy-out var(--m-slice) linear var(--dl,0ms) both}
.tile-wrap.m-slice .out-mark{animation:m-x-in var(--m-slice) var(--m-bounce) var(--dl,0ms) both}
.tile-wrap.m-slice::after{content:"";position:absolute;left:50%;top:50%;z-index:4;width:172%;height:2px;background:#fff;box-shadow:0 0 6px 1px #ff7a85,0 0 14px 2px rgba(255,122,133,.6);pointer-events:none;animation:m-blade var(--m-slice) ease-out var(--dl,0ms) both}
.tile-wrap.m-slice.auto::after{box-shadow:0 0 6px 1px var(--muted),0 0 14px 2px rgba(143,149,173,.5)}
@keyframes m-cut-a{0%,18%{clip-path:none;translate:0 0;rotate:0deg;filter:none}19%{clip-path:polygon(0 0,100% 0,100% 100%)}30%{filter:none}42%{translate:5px -5px;rotate:1.5deg}62%{filter:grayscale(1) brightness(.42)}78%,99%{clip-path:polygon(0 0,100% 0,100% 100%);translate:0 0;rotate:0deg;filter:grayscale(1) brightness(.42)}100%{clip-path:none;filter:grayscale(1) brightness(.42)}}
@keyframes m-cut-b{0%,18%{opacity:0;translate:0 0;rotate:0deg;filter:none}19%{opacity:1;clip-path:polygon(0 0,0 100%,100% 100%)}30%{filter:none}42%{translate:-5px 5px;rotate:-1.5deg}62%{filter:grayscale(1) brightness(.42)}78%,99%{opacity:1;clip-path:polygon(0 0,0 100%,100% 100%);translate:0 0;rotate:0deg;filter:grayscale(1) brightness(.42)}100%{opacity:0}}
@keyframes m-copy-out{0%,4%{opacity:1}18%,100%{opacity:0}}
@keyframes m-x-in{0%,52%{opacity:0;scale:.3}76%{opacity:1;scale:1.18}100%{opacity:1;scale:1}}
@keyframes m-blade{0%{opacity:1;transform:translate(-50%,-50%) rotate(53.13deg) scaleX(0);transform-origin:0 50%}22%{opacity:1;transform:translate(-50%,-50%) rotate(53.13deg) scaleX(1)}40%,100%{opacity:0;transform:translate(-50%,-50%) rotate(53.13deg) scaleX(1)}}
/* The ripple: the characters still standing lift for a moment as it passes them. */
.tile-wrap.m-wave{outline:3px solid transparent;outline-offset:-3px;animation:m-wave var(--m-wave) var(--m-ease) var(--dl,0ms) both}
@keyframes m-wave{0%{translate:0 0;outline-color:transparent}38%{translate:0 -6px;outline-color:var(--lime)}100%{translate:0 0;outline-color:transparent}}
/* Hide crossed out: a cut tile stays until it has folded away, then the rest glide into its place. */
.cards.show-left .tile-wrap.out.m-keep{display:block}
.tile-wrap.m-fold{transform-origin:50% 100%;animation:m-fold var(--m-slow) cubic-bezier(.5,0,.75,0) var(--dl,0ms) both}
.tile-wrap.m-unfold{transform-origin:50% 100%;animation:m-fold var(--m-slow) var(--m-bounce) var(--dl,0ms) reverse both}
@keyframes m-fold{to{transform:perspective(420px) rotateX(84deg) scale(.86);opacity:0}}

/* 0.94 Close-call moments: the board darkens on each heartbeat, the tiles left lift one after another (--cl),
   thump again on the later beats, and the label lands over the board. */
.cc-scrim{animation:cc-beat var(--cc-gap,1000ms) linear var(--cc-beats,1) both}
@keyframes cc-beat{0%{opacity:0}12%{opacity:.5}100%{opacity:0}}
.cards.cc-moment .tile-wrap:not(.out) .character{animation:cc-lift .62s var(--m-bounce) var(--cl,0ms) both}
@keyframes cc-lift{0%{translate:0 0}55%{translate:0 -14px;scale:1.04}100%{translate:0 -5px;scale:1}}
.cards.cc-moment.cc-thump .tile-wrap:not(.out) .character{animation:cc-thump .26s ease-out both}
@keyframes cc-thump{0%{translate:0 -5px;scale:1}35%{translate:0 -5px;scale:1.035}100%{translate:0 -5px;scale:1}}
.cc-label:not(.cc-still){animation:cc-land 1.6s var(--m-ease) both}
@keyframes cc-land{0%{opacity:0;scale:1.6}14%{opacity:1;scale:1}78%{opacity:1;scale:1}100%{opacity:0;scale:.96}}

/* 0.95 Card reveal theatre: the card in the spotlight rises, then settles a little higher than the rest. */
.rt-lit .rt-face{animation:rt-rise .5s var(--m-bounce) both}
@keyframes rt-rise{0%{translate:0 0}60%{translate:0 -12px}100%{translate:0 -6px}}
.rt-wait .rt-back{animation:rt-wait 1.2s ease-in-out infinite}
@keyframes rt-wait{50%{box-shadow:inset 0 0 0 2px var(--purple)}}

/* 0.96 Dex 2.0 after a win: the portrait's rarity frame closes in, New in your Dex rises, its bar fills,
   then each milestone stamps down. Only played once per save (.go); redraws show it still. */
.dex-frame.go{animation:dex-frame .7s .15s var(--m-ease) both}
@keyframes dex-frame{0%{outline-color:transparent;outline-offset:16px}100%{outline-offset:3px}}
.dex-news-slot.go .dex-news{animation:dex-rise .4s .8s var(--m-ease) both}
@keyframes dex-rise{0%{opacity:0;translate:0 10px}100%{opacity:1;translate:none}}
.dex-news-slot.go .dex-mbar>i{transition:width .9s 1.2s var(--m-ease)}
.dex-news-slot.go .dex-stamp{animation:dex-stamp .35s 2.1s var(--m-bounce) both}
.dex-news-slot.go .dex-stamp+.dex-stamp{animation-delay:2.45s}.dex-news-slot.go .dex-stamp+.dex-stamp+.dex-stamp{animation-delay:2.8s}.dex-news-slot.go .dex-stamp+.dex-stamp+.dex-stamp+.dex-stamp{animation-delay:3.15s}
@keyframes dex-stamp{0%{opacity:0;scale:1.6;rotate:-6deg}100%{opacity:1;scale:1;rotate:0deg}}

/* Motion = Off and Windows' reduced motion stop everything, including what themes.css's rule cannot reach. */
html[data-motion="off"] ::backdrop{transition:none!important;animation:none!important}
@media(prefers-reduced-motion:reduce){*,*:before,*:after,::backdrop{animation:none!important;transition:none!important}}
