.singles-trigger {
  position: fixed; right: max(10px, env(safe-area-inset-right)); bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 65; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; padding: 0; background: transparent;
  color: #111; font: 300 25px/1 var(--font); cursor: pointer;
}
.singles-trigger__label {
  position: absolute; right: 48px; white-space: nowrap; opacity: 0;
  font: 700 10px/1 var(--font); letter-spacing: .06em; text-transform: uppercase;
  transition: opacity 180ms ease; pointer-events: none;
}
.singles-trigger:hover .singles-trigger__label,
.singles-trigger:focus-visible .singles-trigger__label { opacity: 1; }
.singles-open .singles-trigger__label { display: none; }
.singles-open, .singles-open #slides { overflow: hidden !important; }
body.singles-open { cursor: auto !important; }
.singles-open #cursorLabel { opacity: 0 !important; }
.singles-open .navbar { visibility: hidden; }
.singles-layer {
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; box-sizing: border-box;
  --singles-sheet-bg: rgba(255,255,255,.90);
  --singles-viewer-bg: #fff;
  opacity: 0;
  --singles-layer-duration: 1100ms;
  background: var(--singles-sheet-bg); color: #111; font-family: var(--font);
}
/* Separate settings on one surface: no stacked white veils. */
.singles-layer[data-mode="viewer"] { background: var(--singles-viewer-bg); }
.singles-layer::backdrop { background: transparent; }
.singles-layer[open] { opacity: 1; animation: singles-rise var(--singles-layer-duration) cubic-bezier(.22,.61,.36,1) backwards; }
.singles-layer[open][data-closing] { animation: singles-fall var(--singles-layer-duration) cubic-bezier(.64,0,.78,.39) both; }
@keyframes singles-fall {
  from { opacity: 1; clip-path: inset(0); }
  to { opacity: 0; clip-path: inset(100% 0 0 0); }
}
@keyframes singles-rise {
  from { opacity: 0; clip-path: inset(100% 0 0 0); }
  to { opacity: 1; clip-path: inset(0); }
}
.singles-layer__cell img, .singles-layer__image { opacity: 0; }
.singles-layer img.singles-image-ready { opacity: 1; animation: singles-image-in var(--singles-image-duration, 420ms) ease-out both; }
.singles-layer__image[data-from-sheet="true"] { --singles-image-duration: 1000ms; }
@keyframes singles-image-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .singles-layer[open][data-closing], .singles-layer[open], .singles-layer img.singles-image-ready { animation: none; }
}
.singles-layer__header {
  position: absolute; top: max(22px, env(safe-area-inset-top)); left: 24px; right: 24px;
  display: flex; justify-content: space-between; gap: 24px; align-items: baseline;
  font-size: 11px; letter-spacing: .04em;
}
.singles-layer__header h2 { margin: 0; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.singles-layer__count { white-space: nowrap; }
.singles-layer__sheet {
  position: absolute; inset: 90px 0 70px; overflow: auto; overscroll-behavior: contain;
  padding: 16px clamp(24px, 6vw, 100px); display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 40px 32px; align-content: safe end;
}
.singles-layer__cell { border: 0; padding: 0; background: none; cursor: pointer; min-width: 0; color: inherit; }
.singles-layer__cell img { display: block; width: 100%; height: 180px; object-fit: contain; font: 12px var(--font); }
.singles-layer__viewer { position: absolute; inset: 78px 20px 70px; display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; align-items: center; gap: 12px; }
.singles-layer__image { cursor: pointer; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.singles-layer__prev, .singles-layer__next { border: 0; background: none; color: #111; width: 44px; height: 44px; font: 24px var(--font); cursor: pointer; }
.singles-layer__error { position: absolute; bottom: 0; left: 20%; right: 20%; text-align: center; font-size: 12px; }
.singles-layer__prev:focus-visible, .singles-layer__next:focus-visible { outline: 1px solid #777; outline-offset: 5px; }
.singles-layer__cell:focus, .singles-trigger:focus { outline: none; }
.singles-trigger[hidden], .singles-layer [hidden] { display: none !important; }
@media (max-width: 600px) {
  .singles-layer__sheet { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 24px 18px; }
  .singles-layer__cell img { height: 140px; }
  .singles-layer__viewer { inset-inline: 6px; gap: 0; }
}

.desktop-autoplay-control {
  position: fixed; right: calc(max(10px, env(safe-area-inset-right)) + 44px);
  bottom: max(8px, env(safe-area-inset-bottom)); z-index: 65;
  width: 32px; height: 44px; display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; background: transparent; color: #111; cursor: pointer;
}
.desktop-autoplay-control svg { width: 20px; height: 20px; }
.desktop-autoplay-control:focus { outline: none; }
.desktop-autoplay-control:focus-visible { outline: 1px dotted currentColor; outline-offset: -6px; }
.desktop-autoplay-control[hidden], .singles-open .desktop-autoplay-control { display: none; }
.singles-trigger__label { right: 80px; }
@media (pointer: coarse) and (hover: none) {
  .desktop-autoplay-control { display: none; }
  .singles-trigger__label { right: 48px; }
}
