  :root {
    --bottom: rgb(168 162 164);
    --ink: #3a2a2a;
    /* set from JS */
    --stage-l: 0px;
    --stage-t: 0px;
    --stage-w: 56.25vh;
    --stage-h: 100vh;
    --x: 50vw;
    --u: 1px; /* 1 video pixel in css px */
  }
  * { box-sizing: border-box; margin: 0; }
  html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }
  body {
    /* the plate's own top/bottom rows, for when the screen is taller than the video (phones) */
    background:
      linear-gradient(to right, rgb(212 203 196), rgb(234 225 216), rgb(245 239 234)) top / 100% 50% no-repeat,
      linear-gradient(to right, rgb(157 152 154), rgb(161 155 157), rgb(166 161 162)) bottom / 100% 50% no-repeat;
    background-color: var(--bottom);
    font-family: YEKANBakh, system-ui, sans-serif;
    color: var(--ink);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: grab;
  }
  body.dragging { cursor: grabbing; }

  /* everything lives inside one clipped box the size of the screen, so nothing
     (the slightly-wider-than-phone plate, the laser glow at the edges) can
     widen the page and knock it off-centre on mobile browsers */
  .scene {
    position: fixed; inset: 0;
    overflow: hidden;
    contain: strict;
  }
  .scene > * { position: absolute; }

  /* background band: the video's own edge colors stretched across the screen */
  .band, .band::after {
    inset-inline: 0;
    top: var(--stage-t); height: var(--stage-h);
    background: url(../assets/bg-l.png) 0 0 / 100% 100% no-repeat;
  }
  .band { mask-image: linear-gradient(transparent, #000 5%, #000 95%, transparent); }
  /* right-hand profile cross-fades in behind the stage, so there's no seam */
  .band::after {
    content: ""; position: absolute;
    top: 0; height: 100%;
    background-image: url(../assets/bg-r.png);
    mask-image: linear-gradient(to right, transparent 40%, #000 60%);
  }
  /* the plate is darker on the left and lit from the right; keep that slope
     going past its edges so the sides don't read as flat panels */
  .shade { top: 0; bottom: 0; pointer-events: none; }
  .shade.l {
    left: 0; width: max(0px, calc(var(--stage-l) + var(--stage-w) * .04));
    background: linear-gradient(to left, transparent, rgb(70 50 45 / .16));
  }
  .shade.r {
    right: 0; width: max(0px, calc(100% - var(--stage-l) - var(--stage-w) * .96));
    background: linear-gradient(to right, transparent, rgb(255 255 255 / .22));
  }

  .stage {
    left: var(--stage-l); top: var(--stage-t);
    width: var(--stage-w); height: var(--stage-h);
    /* edge fade: tight beside the text, wide everywhere else */
    mask: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFoAAACgCAYAAACMoXt9AAADkUlEQVR42u3by08TURjG4ZnptA2XSqOoIMTbSlfu/f9XLly7IMREQkAuBdqinV7G74P36Elj0mlpWf3e5A1hGDbPnHwzlDNpWZaJpWbNozZ0LLOmCakSh5xYx9bCOoo6zgXpXzetLeuW9Yl1Q+AZhpUyEXDfemO9tnatPf9ZgK4L+rl1R32qY0BXh3bUS+uJ6qt8YB3+D/qN9Z31lbWtEUJmx0fGlfXY2tT3t1rdaa6TYui31g/W99ZtjRUyOz6LzzV2S42NC9kmYUVnWrl+JdaE/kQrGujq0IXs1mT594GC+ftIARpooAnQQAMNAdBAE6CBBpoADTQBGmigCdBAE6CBBtrj/wkP28LqUdkOVj3plF0u0zSG9oPryf32gm21lbB5Zp7UZBb82jLNA7SLN3TSM+sLfW1iN3eaU4Yt2aYBuqkr8FJtMTYWHh+tyLEt2zvoTEvcl/uerkYds4VTl+GeTN02C9C+VXff+lpXhDwsLVnuy/YOOpe8b2rcZWQsbYTsJtFG0UwzxLfqfkzuN+eR5WRNpm7bDPP5k5Y5WW72Zbvu0L67/3PC9txVJJftTljRW5isLFthRZNH/KyDAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaarAR6YP0NxcritgOHPrV+sU4wWXomsj116K71q8DJcnMq224YHYfWb9YCm6WlkOlhGB0j60/rga5AidGDU8ryQLajTHPk2vpDvcXpwbmNPN12EqD7kj+ynlvHWC2csQyPZNqPof0RpGM9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aaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaaAA00ARpooAnQQBOggQaarAR6YP0NxcritgOHPrV+sU4wWXomsj116K71q8DJcnMq224YHYfWb9YCm6WlkOlhGB0j60/rga5AidGDU8ryQLajTHPk2vpDvcXpwbmNPN12EqD7kj+ynlvHWC2csQyPZNqPof0RpGM9UXt4LZxe5NiR7SSLBrc/fVzoKlxyY1z4BngpwwuZFuEPFh/cQ82Vjpb9uU7i2Xq+Z+Zu5NeRqduWWXSXHOpR75c6AHpu6Gm/YXiK47OOR/ysgwANNAEaaKAJ0EAToIEGmgANNAEaaKAJ0EAToIEGmgANNAEaaKAJ0EAToIEGmgANNKmcPLnf+u+vBfhrW+HVAH+z6Mba0DlkdkYy6yX/Xq0Yy7YMiEOdcGb9bk31S21rDcNKcdQr67EMz2Q6jFd0DF3T1fBXuDYZL5UzkaG//nYyBV1OQ/tKLnRlNjQ6gK4O7XZ9TYPrGDoty7u3s2pa3aENHcuET2YnvtcVmtmh4z+9TtelqQYmogAAAABJRU5ErkJggg==") 0 0 / 100% 100% no-repeat;
    opacity: 0;
    transition: opacity .9s ease;
  }
  .ready .stage { opacity: 1; }
  .stage img {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
  }
  .stage .lego { clip-path: inset(0 50% 0 0); will-change: clip-path; }

  /* subtle grain on top so the two plates and the band read as one surface */
  .grain {
    inset: 0; pointer-events: none;
    opacity: .07; mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  }

  #fx { inset: 0; width: 100%; height: 100%; pointer-events: none; }

  /* ---------- the laser ---------- */
  .laser {
    top: var(--stage-t); height: var(--stage-h);
    left: 0; width: 0;
    translate: var(--x) 0;
    pointer-events: none;
    will-change: translate;
    outline: none;
  }
  .laser > * { position: absolute; left: 0; translate: -50% 0; }

  .haze {
    top: 0; height: 100%;
    width: calc(var(--u) * 110);
    background: linear-gradient(to right,
      rgb(255 40 40 / 0), rgb(255 40 40 / .16) 38%, rgb(255 70 70 / .34) 50%,
      rgb(255 40 40 / .16) 62%, rgb(255 40 40 / 0));
    mask-image: linear-gradient(to bottom, transparent 4%, #000 24%, #000 70%, transparent 82%);
    transform-origin: 50% 50%;
    transform: scaleY(var(--power, 0));
  }
  .core {
    top: 0; height: 100%;
    width: max(2px, calc(var(--u) * 3));
    background: linear-gradient(to bottom,
      transparent 5%, rgb(255 190 190 / .7) 14%, #fff 32%, #fff 72%, rgb(255 170 170 / .8) 78%, transparent 81%);
    filter: drop-shadow(0 0 calc(var(--u) * 3) rgb(255 40 40))
            drop-shadow(0 0 calc(var(--u) * 10) rgb(255 30 30 / .8));
    transform-origin: 50% 50%;
    transform: scaleY(var(--power, 0));
    border-radius: 2px;
  }
  .flare {
    top: 76%;
    width: calc(var(--u) * 300);
    height: calc(var(--u) * 70);
    translate: -50% -50%;
    background: radial-gradient(closest-side, rgb(255 90 90 / .55), rgb(255 40 40 / .18) 55%, transparent);
    opacity: var(--power, 0);
  }

  /* the grab handle */
  .handle {
    top: 88%;
    translate: -50% -50%;
    width: clamp(44px, calc(var(--u) * 64), 64px);
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid; place-items: center;
    background: rgb(255 255 255 / .55);
    backdrop-filter: blur(8px) saturate(1.3);
    -webkit-backdrop-filter: blur(8px) saturate(1.3);
    border: 2px solid rgb(255 255 255 / .9);
    box-shadow: 0 0 0 1px rgb(255 40 40 / .35), 0 6px 22px rgb(120 20 20 / .25), 0 0 26px rgb(255 40 40 / .35);
    opacity: var(--power, 0);
    transition: scale .25s cubic-bezier(.3,1.6,.5,1);
  }
  .laser:focus-visible .handle { box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgb(220 20 20); }
  .handle svg { width: 58%; height: 58%; }
  .dragging .handle { scale: 1.12; }
  .handle::before, .handle::after {
    content: ""; position: absolute; inset: -2px; border-radius: 50%;
    border: 2px solid rgb(255 60 60 / .6);
    animation: ping 2.4s cubic-bezier(.2,.6,.3,1) infinite;
  }
  .handle::after { animation-delay: 1.2s; }
  .touched .handle::before, .touched .handle::after { animation: none; opacity: 0; }
  @keyframes ping { from { scale: 1; opacity: .8; } to { scale: 2.1; opacity: 0; } }

  .hint {
    top: 88%;
    translate: -50% calc(-50% + clamp(44px, calc(var(--u) * 64), 64px));
    white-space: nowrap;
    font-size: clamp(13px, calc(var(--u) * 20), 17px);
    font-weight: 700;
    color: rgb(60 30 30 / .7);
    opacity: calc(var(--power, 0) * var(--hint, 1));
    transition: opacity .6s;
  }
  .touched .hint { --hint: 0; }

  /* ---------- countdown: "۷ روز دیگه…" — days only, dots loop forever ---------- */
  .count {
    top: max(18px, env(safe-area-inset-top));
    left: 50%; translate: -50% 0;
    font-size: clamp(17px, 2.4vh, 24px);
    font-weight: 700;
    color: rgb(40 25 25 / .42);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0; transition: opacity 1.4s 1.4s;
  }
  .ready .count { opacity: 1; }
  .count .dots { display: inline-block; width: 1.1em; text-align: start; }
  .count .dots i {
    font-style: normal;
    opacity: 0;
    animation: dot 1.8s infinite;
  }
  .count .dots i:nth-child(2) { animation-delay: .3s; }
  .count .dots i:nth-child(3) { animation-delay: .6s; }
  @keyframes dot { 0%, 12% { opacity: 0; } 25%, 70% { opacity: 1; } 85%, 100% { opacity: 0; } }
  .count.done { color: rgb(215 25 25 / .75); }
  @keyframes pulse { 50% { opacity: .45; } }

  /* ---------- sound toggle ---------- */
  .sound {
    top: max(12px, env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border: 0; border-radius: 50%;
    background: rgb(255 255 255 / .35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: rgb(40 25 25 / .55);
    cursor: pointer;
    opacity: 0; transition: opacity 1.2s 1.6s, background .2s;
  }
  .ready .sound { opacity: 1; }
  .sound:hover { background: rgb(255 255 255 / .6); }
  .sound:focus-visible { outline: 2px solid rgb(220 20 20); outline-offset: 2px; }
  .sound svg { width: 20px; height: 20px; }
  .sound .off { display: none; }
  .muted .sound .on { display: none; }
  .muted .sound .off { display: block; }

  .mark {
    inset-inline: 0; bottom: max(14px, env(safe-area-inset-bottom));
    text-align: center; pointer-events: none;
    font-size: 13px; font-weight: 900;
    color: rgb(40 25 25 / .38);
    opacity: 0; transition: opacity 1.2s 1.2s;
  }
  .ready .mark { opacity: 1; }

  @media (prefers-reduced-motion: reduce) {
    .handle::before, .handle::after { animation: none; opacity: 0; }
    .count .dots i { animation: none; opacity: 1; }
  }