/* Action reels: .rv- video, .rs- slideshow, .rp- puzzle, .rc- catch.
   Each reel fills its stage (.g-stage). --g-safe-top / --g-safe-bottom come from gram.css. */

/* ================= video ================= */
.rv { background: #000; }
.rv-video {
  position: absolute; inset: 0; width: 100%; height: 100%; max-width: none;
  object-fit: cover; background: #000;
  opacity: 0; transition: opacity 400ms;
}
.rv.is-ready .rv-video { opacity: 1; }
.rv-spinner { position: absolute; left: 50%; top: 50%; margin: -18px 0 0 -18px; border-color: rgba(255, 255, 255, 0.2); border-top-color: #fff; }
.rv-surface {
  position: absolute; inset: 0; z-index: 1;
  border: 0; padding: 0; background: transparent; cursor: pointer;
}
.rv-surface:focus-visible { outline-offset: -6px; }
.rv-ico { width: 100%; height: 100%; display: block; }
.rv-hint {
  position: absolute; z-index: 2; left: 50%; top: var(--g-safe-top, 64px);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 8px; border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.5); color: #fff; font-size: 13px; font-weight: 600;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  pointer-events: none; white-space: nowrap;
  transition: opacity 400ms, transform 400ms var(--ease-out);
}
.rv-hint .rv-ico { width: 18px; height: 18px; }
.rv-hint.is-gone { opacity: 0; transform: translate(-50%, -8px); }
.rv-flash {
  position: absolute; z-index: 2; left: 50%; top: 50%;
  width: 84px; height: 84px; margin: -42px 0 0 -42px; padding: 20px;
  border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff;
  opacity: 0; pointer-events: none;
}
.rv-flash.is-on { animation: rv-flash 800ms var(--ease-out) forwards; }
@keyframes rv-flash {
  0% { opacity: 0; transform: scale(0.6); }
  18% { opacity: 1; transform: scale(1.05); }
  30% { transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.1); }
}
.rv-play {
  position: absolute; z-index: 3; left: 50%; top: 50%;
  width: 84px; height: 84px; margin: -42px 0 0 -42px; padding: 22px 20px 22px 26px;
  border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  animation: rv-pulse 1.6s ease-in-out infinite;
}
@keyframes rv-pulse { 50% { transform: scale(1.08); } }
.rv-progress {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: 0;
  height: 3px; background: rgba(255, 255, 255, 0.22); pointer-events: none;
}
.rv-fill { height: 100%; background: #fff; transform-origin: 0 50%; transform: scaleX(0); }
.rv-error { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--g-muted); }

/* ================= slideshow ================= */
.rs { background: #000; }
.rs-track { position: absolute; inset: 0; }
.rs-slide {
  position: absolute; inset: 0; overflow: hidden;
  opacity: 0; transition: opacity 700ms ease;
}
.rs-slide.is-active.is-loaded { opacity: 1; }
.rs-img {
  width: 100%; height: 100%; max-width: none; object-fit: cover;
  transform-origin: 50% 50%; will-change: transform;
  user-select: none; -webkit-user-drag: none;
}
.rs-shade {
  position: absolute; left: 0; right: 0; top: 0; height: 140px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
}
.rs-bars {
  position: absolute; z-index: 2; left: 10px; right: 10px;
  top: calc(var(--g-safe-top, 64px) - 4px);
  display: flex; gap: 4px; pointer-events: none;
}
.rs-bar { flex: 1; height: 3px; border-radius: 2px; overflow: hidden; background: rgba(255, 255, 255, 0.35); }
.rs-fill { height: 100%; background: #fff; transform-origin: 0 50%; transform: scaleX(0); }
.rs-surface {
  position: absolute; inset: 0; z-index: 1; cursor: pointer;
  -webkit-touch-callout: none; user-select: none;
}
.rs-surface:focus-visible { outline-offset: -6px; }
.rs-hint {
  position: absolute; z-index: 2; left: 50%; top: calc(var(--g-safe-top, 64px) + 14px);
  transform: translateX(-50%);
  display: flex; gap: 14px; align-items: center;
  padding: 6px 14px; border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.45); color: #fff; font-size: 12px; font-weight: 600;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  white-space: nowrap; pointer-events: none;
  transition: opacity 500ms, transform 500ms var(--ease-out);
}
.rs-hint-l, .rs-hint-r { opacity: 0.75; }
.rs-hint.is-gone { opacity: 0; transform: translate(-50%, -8px); }
.rs.is-held .rs-bars, .rs.is-held .rs-hint { opacity: 0.4; }
.rs-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--g-muted); }

/* ================= puzzle ================= */
.rp {
  --rp-size: min(calc(100% - 32px), calc(100dvh - var(--g-safe-top, 64px) - var(--g-safe-bottom, 92px) - 170px), 440px);
  background:
    radial-gradient(90% 60% at 50% 35%, rgba(98, 40, 215, 0.35), transparent 70%),
    radial-gradient(70% 40% at 50% 100%, rgba(238, 42, 123, 0.25), transparent 70%),
    #0b0b0f;
}
.rp-col {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  padding: var(--g-safe-top, 64px) 16px var(--g-safe-bottom, 92px);
}
.rp-head { width: var(--rp-size); min-width: 260px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.rp-hint {
  margin: 0; font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, 0.85);
  padding: 6px 12px; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.1);
}
.rp-moves { margin: 0; font-size: 13px; color: var(--g-muted); letter-spacing: 0.04em; text-transform: uppercase; }
.rp-moves b { display: inline-block; color: #fff; font-size: 16px; margin-left: 4px; min-width: 1.2em; }
.rp-moves b.is-bump { animation: rp-bump 320ms var(--ease-spring); }
@keyframes rp-bump { 40% { transform: scale(1.45); color: #f9ce34; } }
.rp-wrap {
  position: relative; width: var(--rp-size); aspect-ratio: 1;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
  opacity: 0; transform: scale(0.96);
  transition: opacity 400ms, transform 500ms var(--ease-spring);
}
.rp.is-ready .rp-wrap { opacity: 1; transform: none; }
.rp-board {
  position: absolute; inset: 0;
  border-radius: 16px; overflow: visible;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  background: rgba(255, 255, 255, 0.04);
}
.rp-tile {
  position: absolute; left: 0; top: 0;
  width: calc(100% / var(--n)); height: calc(100% / var(--n));
  padding: 2px; cursor: grab;
  transition: transform 260ms var(--ease-out);
  will-change: transform;
}
.rp-face {
  width: 100%; height: 100%; border-radius: 8px;
  background-color: #222; background-repeat: no-repeat;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  transition: transform 300ms var(--ease-spring), box-shadow 200ms, border-radius 400ms, filter 200ms;
}
.rp-tile.is-selected { z-index: 2; }
.rp-tile.is-selected .rp-face {
  transform: scale(0.9);
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(238, 42, 123, 0.9), 0 10px 24px rgba(0, 0, 0, 0.5);
  animation: rp-wiggle 900ms ease-in-out infinite;
}
@keyframes rp-wiggle { 25% { transform: scale(0.9) rotate(-2deg); } 75% { transform: scale(0.9) rotate(2deg); } }
.rp-tile.is-target .rp-face { box-shadow: 0 0 0 3px #f9ce34; filter: brightness(1.15); }
.rp-tile.is-dragging { z-index: 5; transition: none; cursor: grabbing; }
.rp-tile.is-dragging .rp-face { box-shadow: 0 16px 34px rgba(0, 0, 0, 0.6), 0 0 0 2px #fff; }
.rp-board.is-solved .rp-tile { padding: 0; cursor: default; transition: transform 260ms var(--ease-out), padding 450ms var(--ease-out); }
.rp-board.is-solved .rp-face { border-radius: 0; box-shadow: none; }
.rp-board.is-solved { overflow: hidden; animation: rp-solved 700ms var(--ease-spring); }
@keyframes rp-solved { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }
.rp.is-solved .rp-wrap { box-shadow: 0 20px 60px rgba(238, 42, 123, 0.45), 0 0 0 2px rgba(255, 255, 255, 0.6); }
.rp-peek {
  position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 16px; object-fit: cover;
  opacity: 0; pointer-events: none; transition: opacity 180ms; z-index: 6;
}
.rp-wrap.is-peeking .rp-peek { opacity: 1; }
.rp-foot { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; }
.rp-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 18px;
  border: 0; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 700; font-size: 14px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  transition: transform 160ms var(--ease-out), background 160ms;
}
.rp-btn:active { transform: scale(0.95); background: rgba(255, 255, 255, 0.24); }
.rp-done { display: flex; flex-direction: column; align-items: center; text-align: center; animation: fade-up 480ms var(--ease-out) both; }
.rp-done-msg { margin: 0; font-size: 19px; font-weight: 800; }
.rp-done-sub { margin: 2px 0 10px; font-size: 13px; color: var(--g-muted); }
.rp-again { background: var(--g-gradient); }
.rp-spinner { position: absolute; left: 50%; top: 50%; margin: -18px 0 0 -18px; border-color: rgba(255, 255, 255, 0.2); border-top-color: #fff; }
.rp-error { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--g-muted); }

/* ================= catch ================= */
.rc {
  --rc-w: min(64%, 280px, calc((100dvh - 300px) * 0.75));
  background: radial-gradient(70% 50% at 50% 48%, #2a1640 0%, #120a1e 55%, #050308 100%);
  -webkit-user-select: none; user-select: none;
}
.rc-speed {
  /* speed lines that spin while a photo is in flight */
  position: absolute; left: 50%; top: 48%; width: 200vmax; height: 200vmax;
  margin: -100vmax 0 0 -100vmax; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.07) 0deg 1.5deg, transparent 1.5deg 9deg);
  -webkit-mask-image: radial-gradient(circle, transparent 0 8%, #000 30%);
  mask-image: radial-gradient(circle, transparent 0 8%, #000 30%);
  opacity: 0.25; transition: opacity 300ms;
}
.rc.is-flying .rc-speed { opacity: 1; animation: rc-spin 900ms linear infinite; }
@keyframes rc-spin { to { transform: rotate(9deg); } }
.rc-arena {
  position: absolute; inset: 0; display: grid; place-items: center;
  padding-top: 0; pointer-events: none;
}
.rc-frame, .rc-photo { grid-area: 1 / 1; width: var(--rc-w); aspect-ratio: 3 / 4; }
.rc-frame {
  position: relative;
  border: 2px dashed rgba(255, 255, 255, 0.45); border-radius: 14px;
  transition: border-color 200ms, transform 300ms var(--ease-spring);
}
.rc.is-armed .rc-frame { animation: rc-ready 900ms ease-in-out infinite; }
@keyframes rc-ready { 50% { border-color: rgba(249, 206, 52, 0.85); } }
.rc-c { position: absolute; width: 22px; height: 22px; border: 0 solid #fff; }
.rc-tl { left: -8px; top: -8px; border-left-width: 4px; border-top-width: 4px; border-top-left-radius: 10px; }
.rc-tr { right: -8px; top: -8px; border-right-width: 4px; border-top-width: 4px; border-top-right-radius: 10px; }
.rc-bl { left: -8px; bottom: -8px; border-left-width: 4px; border-bottom-width: 4px; border-bottom-left-radius: 10px; }
.rc-br { right: -8px; bottom: -8px; border-right-width: 4px; border-bottom-width: 4px; border-bottom-right-radius: 10px; }
.rc.is-miss .rc-frame { border-color: #ff3b5c; }
.rc.is-miss .rc-c { border-color: #ff3b5c; }
.rc-photo {
  position: relative; z-index: 1;
  border-radius: 10px; overflow: hidden; background: #222;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  opacity: 0; transform: scale(0.05);
  will-change: transform, opacity;
}
.rc-img { width: 100%; height: 100%; max-width: none; object-fit: cover; -webkit-user-drag: none; }
.rc-photo.is-caught {
  transition: transform 340ms var(--ease-spring), border-width 200ms;
  border: 6px solid #fff; border-bottom-width: 22px; border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.rc-shutter {
  position: absolute; z-index: 3; left: 0; right: 0; height: 50%;
  background: #000; pointer-events: none; transform: translateY(-101%);
}
.rc-shutter-t { top: 0; }
.rc-shutter-b { bottom: 0; transform: translateY(101%); }
.rc-flash { position: absolute; inset: 0; z-index: 3; background: #fff; opacity: 0; pointer-events: none; }
.rc-surface { position: absolute; inset: 0; z-index: 2; cursor: crosshair; -webkit-touch-callout: none; }
.rc-surface:focus-visible { outline-offset: -6px; }
.rc-head {
  position: absolute; z-index: 4; left: 0; right: 0; top: var(--g-safe-top, 64px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.rc-hint {
  margin: 0; padding: 6px 12px; border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.12); font-size: 13px; font-weight: 600;
}
.rc-score {
  font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 10px; border-radius: var(--radius-pill); background: var(--g-gradient);
}
.rc-count {
  position: absolute; z-index: 4; left: 50%; top: 48%;
  width: 160px; height: 160px; margin: -80px 0 0 -80px;
  display: grid; place-items: center; pointer-events: none;
  font-size: 110px; font-weight: 900; line-height: 1; color: #fff;
  text-shadow: 0 6px 30px rgba(238, 42, 123, 0.8);
  opacity: 0;
}
.rc-count.is-on { opacity: 1; }
.rc-bottom {
  position: absolute; z-index: 4; left: 16px; right: 16px; bottom: calc(var(--g-safe-bottom, 92px) + 6px);
  display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none;
  min-height: 60px; justify-content: flex-end;
}
.rc-msg { min-height: 1em; margin: 0; text-align: center; font-size: 20px; font-weight: 800; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }
.rc-msg small { display: block; font-size: 13px; font-weight: 600; color: var(--g-muted); }
.rc-msg.is-hit { color: #fff; }
.rc-msg.is-miss { color: #ff7b93; }
.rc-btn {
  pointer-events: auto;
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 24px;
  border: 0; border-radius: var(--radius-pill);
  background: var(--g-gradient); color: #fff; font-weight: 800; font-size: 16px;
  box-shadow: 0 10px 28px rgba(238, 42, 123, 0.45);
  transition: transform 160ms var(--ease-out);
}
.rc-btn:active { transform: scale(0.95); }
.rc-next:not([hidden]) { animation: fade-up 360ms var(--ease-out) both; }
.rc-final {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: var(--g-safe-top, 64px) 16px var(--g-safe-bottom, 92px);
  background: radial-gradient(80% 60% at 50% 45%, rgba(238, 42, 123, 0.35), rgba(5, 3, 8, 0.92) 75%);
  text-align: center;
}
.rc-final-title { margin: 0; font-size: 28px; font-weight: 900; animation: fade-up 480ms var(--ease-out) both; }
.rc-final-sub { margin: 0; font-size: 14px; color: var(--g-muted); animation: fade-up 480ms 100ms var(--ease-out) both; }
.rc-pile {
  position: relative; width: min(100%, 320px); height: min(46dvh, 340px); margin: 14px 0 18px;
}
.rc-polaroid {
  position: absolute; left: 50%; top: 50%;
  width: 46%; aspect-ratio: 3 / 4;
  background: #fff; padding: 6px 6px 20px; border-radius: 3px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
  animation: rc-drop 600ms var(--ease-spring) both;
  animation-delay: calc(var(--i) * 140ms);
}
.rc-polaroid:nth-child(4n+1) { --x: -34%; --y: -14%; }
.rc-polaroid:nth-child(4n+2) { --x: 30%; --y: -8%; }
.rc-polaroid:nth-child(4n+3) { --x: -6%; --y: 12%; }
.rc-polaroid:nth-child(4n+4) { --x: 36%; --y: 18%; }
.rc-polaroid { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y, 0%))) rotate(var(--r)); }
.rc-polaroid img { width: 100%; height: 100%; max-width: none; object-fit: cover; }
@keyframes rc-drop {
  from { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y, 0%) - 40px)) rotate(calc(var(--r) * 3)) scale(1.4); }
}
.rc.is-done .rc-head, .rc.is-done .rc-bottom { visibility: hidden; }
.rc-empty { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--g-muted); }

@media (prefers-reduced-motion: reduce) {
  .rc.is-flying .rc-speed, .rp-tile.is-selected .rp-face, .rv-play { animation: none; }
}
