/* The room: dark plum wallpaper, a wooden floor and ceiling in real perspective, string lights. */
.rm-wall { background-color: #2c1e3c; background-size: 96px 96px; overflow: hidden; position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.rm-wall-lo { overflow: hidden; }
.rm-wall i { position: absolute; left: 0; right: 0; display: block; }
.rm-crown { top: 0; height: 26px; background: linear-gradient(#150c1e, #3a2a4c 60%, #22162e); }
.rm-rail { top: 636px; height: 14px; background: linear-gradient(#4f3a63, #2a1c38); }
.rm-wains {
  top: 650px; bottom: 30px;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 22px, rgba(255, 255, 255, .05) 22px 24px, rgba(0, 0, 0, 0) 24px 146px, rgba(0, 0, 0, .25) 146px 150px),
    linear-gradient(#35233f, #2a1b33);
}
.rm-skirt { bottom: 0; height: 30px; background: linear-gradient(#4a3358 0 3px, #24162c 3px); }

/* floor, ceiling and rug planes: CSS perspective matched to BD.world (D = 1000, horizon at 50%) */
.rm-3d { perspective: 1000px; perspective-origin: 50% 50%; overflow: hidden; }
.rm-plane {
  position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform;
  background-repeat: repeat; backface-visibility: visible;
}
.rm-floor { background-color: #3a2431; background-size: 240px 400px; }
.rm-ceil { background-color: #1c1228; background-size: 240px 400px; }
.rm-rug {
  border-radius: 50%;
  background:
    radial-gradient(closest-side, #7a3b5e 0 30%, #9c4a6b 30% 33%, #6a3355 33% 62%, #c58ae0 62% 64%, #5a2c4a 64% 90%, #ee8aa4 90% 93%, #4a2440 93% 99%, rgba(0, 0, 0, 0) 100%);
}

/* the room lights: a warm wash that comes up with --light.
   --light is registered as non-inherited, so the camera changing it on #world every frame of a fade
   restyles only the elements that ask for it (inherit), not every node in the room. */
@property --light { syntax: "<number>"; inherits: false; initial-value: 0; }
.rm-wash {
  --light: inherit;
  background: linear-gradient(rgba(255, 214, 170, .11), rgba(255, 196, 160, .16) 55%, rgba(255, 180, 140, .12));
  opacity: var(--light, 0);
}

.rm-prop svg { display: block; overflow: visible; }
.rm-string svg, .ext-string svg { position: absolute; left: 0; top: 0; display: block; overflow: visible; }
.rm-prop.flip svg { transform: scaleX(-1); }

/* string lights: dim until they switch on, then a quick cascade and a slow breathing glow */
/* (the bulbs fade up as one element: a per-bulb animation would re-lay-out the whole string's SVG) */
.rm-string .bulbs, .ext-string .bulbs { opacity: .34; }
.rm-string .halos, .ext-string .halos { opacity: 0; }
.rm-string.on .bulbs, .ext-string.on .bulbs { opacity: 1; animation: rmBulbsOn .7s ease-out backwards; }
@keyframes rmBulbsOn { 0% { opacity: .34; } 40% { opacity: 1; } 55% { opacity: .7; } 100% { opacity: 1; } }
.rm-string.on .halos, .ext-string.on .halos { opacity: .85; animation: rmFadeIn 1.2s ease-out backwards; }
@keyframes rmBulbOn { 0% { opacity: .32; transform: scale(1); } 45% { opacity: 1; transform: scale(1.35); } 100% { opacity: 1; transform: scale(1); } }
@keyframes rmFadeIn { from { opacity: 0; } }
@keyframes rmBreath { from { opacity: 1; } to { opacity: .55; } }
@keyframes rmTw { from { opacity: 1; } to { opacity: .6; } }

/* drifting specks (BD.room.specks): each group of dots drifts as one element */
.rm-specks .sp { position: absolute; background-size: 100% 100%; background-repeat: no-repeat; opacity: 0; }
.rm-specks .sp0 { animation: rmSp0 7s ease-in-out infinite alternate; }
.rm-specks .sp1 { animation: rmSp1 9s ease-in-out -3s infinite alternate; }
.rm-specks .sp2 { animation: rmSp2 8s ease-in-out -5s infinite alternate; }
.rm-specks .sp3 { animation: rmSp1 11s ease-in-out -7s infinite alternate-reverse; }
@keyframes rmSp0 { 0% { transform: translate(0, 0); opacity: .15; } 50% { opacity: 1; } 100% { transform: translate(26px, -34px); opacity: .3; } }
@keyframes rmSp1 { 0% { transform: translate(0, 0); opacity: .9; } 45% { opacity: .2; } 100% { transform: translate(-30px, -22px); opacity: .85; } }
@keyframes rmSp2 { 0% { transform: translate(0, 0); opacity: .3; } 60% { opacity: 1; } 100% { transform: translate(14px, 30px); opacity: .2; } }
.rm-specks.rise .sp0 { animation-name: rmRise; animation-duration: 12s; animation-direction: normal; }
.rm-specks.rise .sp1 { animation-name: rmRise; animation-duration: 15s; animation-direction: normal; }
.rm-specks.rise .sp2 { animation-name: rmRise; animation-duration: 18s; animation-direction: normal; }
@keyframes rmRise { 0% { transform: translate(0, 40px); opacity: 0; } 25% { opacity: .9; } 75% { opacity: .7; } 100% { transform: translate(24px, -110px); opacity: 0; } }

/* off-screen layers of the door, room and cake stop animating until they come back into view */
.w-layer.rm-off, .w-layer.rm-off * { animation-play-state: paused !important; }

/* a trotting cat (BD.room.catWalkSVG) */
.cat-walk .cw-la, .cat-walk .cw-lb, .cat-walk .cw-tail, .cat-walk .cw-bob { transform-box: fill-box; }
.cat-walk .cw-la, .cat-walk .cw-lb { transform-origin: 50% 0; animation: cwLeg .34s ease-in-out infinite alternate; }
.cat-walk .cw-lb { animation-delay: -.34s; }
.cat-walk .cw-bob { animation: cwBob .17s ease-in-out infinite alternate; }
.cat-walk .cw-tail { transform-origin: 100% 0; animation: cwTail .68s ease-in-out infinite alternate; }
@keyframes cwLeg { from { transform: rotate(-30deg); } to { transform: rotate(30deg); } }
@keyframes cwBob { from { transform: translateY(0); } to { transform: translateY(-2.2px); } }
@keyframes cwTail { from { transform: rotate(-8deg); } to { transform: rotate(10deg); } }
.cat-walk.still .cw-la, .cat-walk.still .cw-lb, .cat-walk.still .cw-bob { animation: none; }
