/* Calm mode, premium pass (calm-premium.js) */
/* the moon rises into place when calm turns on */
.calm-fab.cp-rise{animation:cp-rise 1.4s cubic-bezier(.25,1.2,.4,1) both!important}
@keyframes cp-rise{0%{opacity:0;translate:0 90px;scale:.5;rotate:-30deg}60%{opacity:1}100%{opacity:1;translate:0 0;scale:1;rotate:0deg}}
.calm-fab .cp-count{position:absolute;right:-6px;top:-6px;min-width:26px;height:20px;padding:0 5px;border-radius:999px;background:#ffe7a8;color:#3a2c66;font:900 11px/20px Grandstander,ui-rounded,sans-serif;text-align:center;box-shadow:0 2px 0 #c8a24e}

/* the fan opens on a gentle arc, each button floating up in turn */
html body .calm-dock{overflow:visible!important}
html body .calm-dock.open button{animation:cp-float .45s cubic-bezier(.3,1.6,.5,1) both;animation-delay:calc(var(--i,0)*70ms)}
html body .calm-dock button{position:relative}
html body .calm-dock button:nth-of-type(2),html body .calm-dock button:nth-of-type(3){translate:0 -12px}
@keyframes cp-float{0%{opacity:0;scale:.4;translate:0 30px}100%{opacity:1}}
html body .calm-dock .cp-path{position:absolute;left:12%;right:12%;top:30%;height:26px;border-top:2px dashed #ffe7a866;border-radius:50% 50% 0 0;pointer-events:none}
html body .calm-dock .cp-peek{position:absolute;left:-26px;bottom:-8px;width:52px;height:52px;object-fit:contain;pointer-events:none;filter:drop-shadow(0 3px 4px #0006);animation:cp-peek 4s ease-in-out infinite;transform-origin:50% 100%}
@keyframes cp-peek{0%,100%{rotate:-6deg}50%{rotate:4deg;translate:2px -2px}}
/* bedtime path: step numbers, the next step glows, done steps get a check */
html body .calm-dock .cp-step{position:absolute;left:8px;top:4px;width:18px;height:18px;border-radius:50%;background:#ffffff26;color:#ffeec4;font:900 11px/18px Grandstander,ui-rounded,sans-serif;font-style:normal;text-align:center}
html body .calm-dock .cp-next img{filter:drop-shadow(0 0 12px #ffe08a) drop-shadow(0 0 4px #fff3c4)!important}
html body .calm-dock .cp-next .cp-step{background:#ffe7a8;color:#3a2c66}
html body .calm-dock .cp-done .cp-step{background:#75d5bd;color:#0000;font-size:0}
html body .calm-dock .cp-done .cp-step::after{content:'✓';color:#fff;font-size:12px;font-weight:900;line-height:18px}
html body .calm-dock .cp-done img{opacity:.75}

/* Sweet dreams sticker */
.cp-sweet{position:fixed;inset:0;z-index:300;display:grid;place-items:center;background:#120c2acc;opacity:0;transition:opacity .4s}
.cp-sweet.in{opacity:1}
.cp-card{position:relative;width:min(320px,82vw);padding:22px 18px 18px;border-radius:32px;background:radial-gradient(circle at 50% 30%,#3f3380,#1d1636);border:4px solid #ffe7a8;box-shadow:0 0 40px 8px #ffd96a55;display:flex;flex-direction:column;align-items:center;gap:10px;transform:scale(.7);transition:transform .5s cubic-bezier(.3,1.6,.5,1)}
.cp-sweet.in .cp-card{transform:none}
.cp-sticker{width:70%;aspect-ratio:1;object-fit:contain;filter:drop-shadow(0 6px 10px #0008);animation:cp-sticker 3s ease-in-out infinite}
@keyframes cp-sticker{50%{rotate:4deg;scale:1.04}}
.cp-nights{color:#ffe08a;font-size:22px;letter-spacing:3px;text-shadow:0 0 10px #ffd96a}
.cp-ok{width:58px;height:58px;border-radius:50%;border:4px solid #fff;background:#75d5bd;color:#fff;font-size:28px;font-weight:900;box-shadow:0 5px 0 #3aab9e;cursor:pointer}
.cp-stars{position:absolute;inset:0;pointer-events:none;overflow:hidden;border-radius:28px}
.cp-stars i{position:absolute;width:4px;height:4px;border-radius:50%;background:#fff;opacity:.2;animation:cp-tw 2.4s ease-in-out infinite}
.cp-stars i:nth-child(n){left:calc(7% * var(--n,1))}
.cp-stars i:nth-child(1){left:8%;top:12%}.cp-stars i:nth-child(2){left:22%;top:30%;animation-delay:-.4s}.cp-stars i:nth-child(3){left:80%;top:10%;animation-delay:-.9s}.cp-stars i:nth-child(4){left:90%;top:40%;animation-delay:-1.3s}.cp-stars i:nth-child(5){left:12%;top:70%;animation-delay:-1.7s}.cp-stars i:nth-child(6){left:70%;top:80%;animation-delay:-.2s}.cp-stars i:nth-child(7){left:50%;top:6%;animation-delay:-1.1s}.cp-stars i:nth-child(8){left:36%;top:88%;animation-delay:-2s}.cp-stars i:nth-child(9){left:60%;top:22%;animation-delay:-.7s}.cp-stars i:nth-child(10){left:5%;top:45%;animation-delay:-1.5s}.cp-stars i:nth-child(11){left:94%;top:70%;animation-delay:-.3s}.cp-stars i:nth-child(12){left:28%;top:55%;animation-delay:-1.9s}.cp-stars i:nth-child(13){left:84%;top:58%;animation-delay:-.6s}.cp-stars i:nth-child(14){left:44%;top:40%;animation-delay:-2.2s}
@keyframes cp-tw{50%{opacity:1;scale:1.6}}

/* the town winds down */
.sq-dock .sq-tile.cp-yawn{animation:cp-yawn 1.6s ease-in-out}
@keyframes cp-yawn{0%,100%{scale:1 1;rotate:0deg}30%{scale:1.04 .9;rotate:-3deg}55%{scale:.97 1.08;rotate:2deg}}
/* Trade friends wear nightcaps */
html body.calm-mode .friend-closeup,html body.calm-mode .club-friend-face{position:relative}
html body.calm-mode .friend-closeup::before,html body.calm-mode .club-friend-face::before{content:'';position:absolute;left:50%;top:-14%;width:46%;aspect-ratio:1;translate:-40% 0;rotate:14deg;background:url('./assets/room-night/nightcap.webp') center/contain no-repeat;z-index:3;pointer-events:none;filter:drop-shadow(0 2px 2px #0004)}
/* Play: the calm games wear a little moon */
html body.calm-mode .gm-tile:is([data-gm=rain],[data-gm=bubble],[data-gm=stack],[data-gm=popup]){position:relative}
html body.calm-mode .gm-tile:is([data-gm=rain],[data-gm=bubble],[data-gm=stack],[data-gm=popup])::after{content:'';position:absolute;right:6%;top:6%;width:26%;aspect-ratio:1;background:url('./assets/icons3d/moon.webp') center/contain no-repeat;filter:drop-shadow(0 0 6px #ffe08a);z-index:4;pointer-events:none;animation:cp-tw 3s ease-in-out infinite}
@media(prefers-reduced-motion:reduce){.calm-fab.cp-rise,.calm-dock.open button,.cp-peek,.cp-sticker,.cp-stars i,.sq-tile.cp-yawn{animation:none!important}}

/* the fan now hangs from the top bar, so its arc dips down instead of up */
html body.calm-mode .calm-dock button:nth-of-type(2),html body.calm-mode .calm-dock button:nth-of-type(4){translate:0 6px}
html body.calm-mode .calm-dock button:nth-of-type(3){translate:0 10px}
html body.calm-mode .calm-dock .cp-path{top:auto;bottom:22%;border-top:0;border-bottom:2px dashed #ffe7a866;border-radius:0 0 50% 50%}
html body .calm-moon .cp-count{position:absolute;right:-6px;top:-6px;min-width:26px;height:20px;padding:0 5px;border-radius:999px;background:#ffe7a8;color:#3a2c66;font:900 11px/20px Grandstander,ui-rounded,sans-serif;text-align:center;box-shadow:0 2px 0 #c8a24e;z-index:2}
html body .calm-moon{position:relative}
html body.calm-mode .calm-dock .cp-peek{left:10px;bottom:-30px;width:40px;height:40px}
