/* M04.2 SAFETY BASELINE: Only a background switch added to the confirmed M03 card.
   No changes to card geometry, transforms, material layers, or shadow rendering. */
.app[data-backdrop="light"] {
  background: radial-gradient(ellipse 77% 60% at 50% 47%, #f0ede8 0%, #dedbd5 52%, #c7c3bc 100%);
}
.app[data-backdrop="light"]::before {
  background:linear-gradient(180deg, rgba(255,255,255,.20), transparent 28%, transparent 77%, rgba(94,90,84,.07));
}
.app[data-backdrop="light"] .header {color:#252527}
.app[data-backdrop="light"] .header .count {color:#55534e}
.app[data-backdrop="light"] .hand-mark span {background:#77736f;box-shadow:0 2px 7px #0004}
.backdrop-toggle {
  position:absolute;z-index:90;right:12px;top:calc(8px + env(safe-area-inset-top,0px));
  height:36px;min-width:78px;padding:0 10px;display:flex;align-items:center;justify-content:center;gap:6px;
  border-radius:999px;background:#2a2b2b;color:#ebeae5;border:1px solid #ffffff28;
  box-shadow:0 2px 5px #0004;font-size:10px;font-weight:800;letter-spacing:.45px;
  touch-action:manipulation;
}
.backdrop-toggle svg {width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.app[data-backdrop="light"] .backdrop-toggle {background:#faf8f3;color:#28292b;border-color:#0003}
/* M05.3: one-tap artwork zoom mode cycle. Always available in hand/player/tray. */
.artzoom-toggle {right:104px;min-width:80px;white-space:nowrap;}
.artzoom-toggle .zoom-symbol {font-size:15px;font-weight:700;line-height:1;}
@media (max-width:360px){.artzoom-toggle{right:100px;min-width:74px;padding:0 7px;font-size:9px}}
.app[data-mode="hand"] .header .count {margin-right:85px}
/* Optional diagnostic mode. Not active in normal M04.2. */
html[data-render="light"] .song.material-card .mat-lacquer,
html[data-render="light"] .song.material-card .mat-paper {display:none!important}
html[data-render="light"] .song[data-finish="silver-title"] .toptext::after,
html[data-render="light"] .song[data-finish="silver-border"]::after {display:none!important}
html[data-render="light"] .info-panel {backdrop-filter:none!important;-webkit-backdrop-filter:none!important}
html[data-render="light"] .song.material-card {will-change:auto}


/* M05.1: compositor-first transitions, with M05 available via ?motion=original.
   The static material rendering and artwork/focal logic are not changed. */
html:not([data-motion="original"]) .song {
  /* Card dimensions are constant in both states; animating them serves no purpose. */
  transition:transform .57s cubic-bezier(.22,.85,.15,1), opacity .29s ease, visibility 0s;
  will-change:auto;
}
html:not([data-motion="original"]) .app[data-mode="hand"] .song:not(.offhand),
html:not([data-motion="original"]) .app[data-mode="player"] .song.current,
html:not([data-motion="original"]) .app[data-mode="tray"] .song:not(.tray-hidden) {
  will-change:transform,opacity;
}
/* Do not keep nine invisible, transformed, textured full-card surfaces in the render tree. */
html:not([data-motion="original"]) .app[data-mode="hand"] .song.offhand {
  visibility:hidden;
}
html:not([data-motion="original"]) .app[data-mode="player"] .song:not(.current),
html:not([data-motion="original"]) .app[data-mode="tray"] .song.tray-hidden {
  visibility:hidden;
  transition:transform .57s cubic-bezier(.22,.85,.15,1),opacity .29s ease,visibility 0s linear .32s;
}
/* Collapse header/footer geometry in one step, not over ~0.56s. This preserves
   the original player/tray dimensions while removing per-frame flex re-layout. */
html:not([data-motion="original"]) .header,
html:not([data-motion="original"]) .bottom {
  transition:opacity .20s ease;
}
/* max-height is a layout animation. Switch it once, then softly fade the controls. */
html:not([data-motion="original"]) .transport {
  max-height:0;
  opacity:0;
  transition:opacity .16s ease;
}
html:not([data-motion="original"]) .app[data-mode="player"] .current .transport,
html:not([data-motion="original"]) .app[data-mode="tray"] .current .transport {
  max-height:145px;
  opacity:1;
  transition:opacity .22s ease .17s;
}
/* The cards' information panels are already 78% opaque and artwork-colored.
   Drop costly live backdrop blurring, leaving all other materials untouched. */
html:not([data-motion="original"]) .info-panel {
  -webkit-backdrop-filter:none;
  backdrop-filter:none;
}
@media (prefers-reduced-motion:reduce) {
  html:not([data-motion="original"]) .song,
  html:not([data-motion="original"]) .transport {transition-duration:.01ms!important;transition-delay:0s!important}
}


/* M05.2: animate only the artwork inside each physical card. No animation of
   borders, metadata, texture or the existing M05.1 card transitions. */
.song.art-ready .art {
  --art-feature-scale: 1.055;
  transform:scale(1);
  transform-origin:var(--art-pivot-x,50%) var(--art-pivot-y,50%);
  transition:opacity .18s ease,transform .68s cubic-bezier(.22,.7,.2,1);
}
/* Default: the compact card reveals a little less zoom; selecting it moves in. */
html[data-art-zoom="in"] .app[data-mode="player"] .song.current.art-ready .art,
html[data-art-zoom="in"] .app[data-mode="tray"] .song.current.art-ready .art {
  transform:scale(var(--art-feature-scale));
}
/* Alternative: start a little closer, reveal more of the artwork when selected.
   Do not animate hidden cards or cause background image layers to be promoted. */
html[data-art-zoom="out"] .app[data-mode="hand"] .song:not(.offhand).art-ready .art,
html[data-art-zoom="out"] .app[data-mode="tray"] .song:not(.current):not(.tray-hidden).art-ready .art {
  transform:scale(var(--art-feature-scale));
}
html[data-art-zoom="off"] .song.art-ready .art {
  transform:none;
  transition:opacity .18s ease;
}
@media (prefers-reduced-motion:reduce) {
  .song.art-ready .art {transition-duration:.01ms!important;transition-delay:0s!important}
}
