/* JiCHO cassette player and now-playing badge (public/cassette.js). Original artwork drawn in CSS
   after the owner's references: an illustrated retro cassette, a turquoise/coral cassette, a clear
   reel cassette (construction and motion) and a disco record (the small badge). */
.jcas-wrap{--jcas-w:min(84vw,340px);display:grid;justify-items:center;gap:12px;width:100%;color:#1d1530}
.jcas-stage{position:relative;width:100%;display:grid;place-items:center;padding:14px 0 6px;border-radius:20px;overflow:hidden;background:radial-gradient(120% 90% at 50% 10%,#3a1e6e 0%,#170c33 60%,#0b0620 100%)}
.jcas-clip{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:.55;filter:saturate(1.2)}
.jcas-wrap.has-clip .jcas-stage::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,#0b062055,#0b0620aa);pointer-events:none}

/* the shell */
.jcas{position:relative;z-index:1;width:var(--jcas-w);aspect-ratio:1.6/1;border-radius:16px;box-shadow:0 18px 40px #0008,inset 0 2px 0 #ffffff55,inset 0 -3px 0 #0003;
  --body:linear-gradient(160deg,#2ad1c9,#16a7a8);--band:linear-gradient(90deg,#ff6f61 0 33%,#ffc857 33% 66%,#ff8a3d 66%);--label:#fff6e3;--ink:#2b1d0e;--window:#1b2430;--screw:#0e5c5c;background:var(--body)}
.jcas-retro{--body:linear-gradient(160deg,#ff8a3d,#d9481e 70%,#9c2c12);--band:linear-gradient(90deg,#2b1d0e 0 30%,#ffc857 30% 60%,#fff3d6 60%);--label:#fff3d6;--ink:#3a1606;--window:#1c1410;--screw:#5a1d08}
.jcas-clear{--body:linear-gradient(160deg,#e9eef3cc,#b9c4cecc 60%,#8b98a5cc);--band:linear-gradient(90deg,#c8a64b,#f3dc8b,#c8a64b);--label:#f8f2df;--ink:#2d2a20;--window:#202a33;--screw:#3e4b57;backdrop-filter:blur(2px)}
.jcas-screw{position:absolute;width:9px;height:9px;border-radius:50%;background:radial-gradient(circle at 35% 35%,#fff9,transparent 45%),var(--screw);box-shadow:inset 0 0 0 1px #0004}
.jcas-screw::after{content:"";position:absolute;left:1px;right:1px;top:4px;height:1px;background:#0006;transform:rotate(35deg)}
.jcas-screw.s1{left:4%;top:6%}.jcas-screw.s2{right:4%;top:6%}.jcas-screw.s3{left:4%;bottom:7%}.jcas-screw.s4{right:4%;bottom:7%}

/* the label: the song's artwork blended into it */
.jcas-label{position:absolute;left:9%;right:9%;top:7%;height:40%;display:flex;gap:8px;align-items:center;padding:6px 8px 9px;border-radius:9px;background:var(--label);box-shadow:inset 0 0 0 1px #0001;overflow:hidden}
.jcas-label::after{content:"";position:absolute;left:0;right:0;bottom:0;height:7px;background:var(--band)}
.jcas-art{position:relative;flex:0 0 auto;height:100%;aspect-ratio:1;border-radius:7px;overflow:hidden;background:linear-gradient(135deg,#7b2ff7,#f107a3);box-shadow:0 2px 6px #0003}
.jcas-art img{width:100%;height:100%;object-fit:cover;object-position:center;display:block}
.jcas-art::after{content:"";position:absolute;inset:0;background:linear-gradient(160deg,#ffffff22,transparent 40%,#00000018);pointer-events:none}
.jcas-art-none{display:grid;place-items:center;width:100%;height:100%;color:#fff;font-size:26px;font-weight:900}
.jcas-text{min-width:0;display:grid;gap:1px;color:var(--ink)}
.jcas-title{font:900 clamp(12px,3.6vw,15px)/1.15 Inter,system-ui,sans-serif;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.jcas-artist{font:700 clamp(10.5px,3vw,12.5px)/1.2 Inter,system-ui,sans-serif;opacity:.8;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.jcas-text i{font:800 9px/1 Inter,system-ui,sans-serif;letter-spacing:.14em;opacity:.55;font-style:normal;margin-top:2px}

/* the window with the two reels and the tape between them */
.jcas-window{position:absolute;left:17%;right:17%;top:51%;height:27%;display:flex;align-items:center;justify-content:space-between;padding:0 3%;border-radius:999px;background:var(--window);box-shadow:inset 0 3px 8px #000a,0 0 0 3px #ffffff30}
.jcas-reel{position:relative;z-index:1;height:118%;aspect-ratio:1;--pack:.8}
.jcas-pack{fill:#3a2414;transform:scale(var(--pack));transform-box:fill-box;transform-origin:center;transition:transform .4s linear}
.jcas-pack-shine{fill:none;stroke:#ffffff24;stroke-width:3;transform:scale(var(--pack));transform-box:fill-box;transform-origin:center}
.jcas-flange{fill:#f4efe6;stroke:#0002}
.jcas-tooth{fill:var(--window)}
.jcas-spoke{fill:#cdbfa9}
.jcas-hub{fill:var(--window);stroke:#fff6;stroke-width:1.5}
.jcas-tape{position:absolute;left:12%;right:12%;bottom:10%;height:22%;overflow:visible}
.jcas-tape-run{stroke:#5a3a22;stroke-width:3.5;fill:none;stroke-dasharray:6 4}
.jcas-foot{position:absolute;left:24%;right:24%;bottom:0;height:16%;border-radius:10px 10px 0 0;background:#0000002a;clip-path:polygon(8% 0,92% 0,100% 100%,0 100%);display:flex;justify-content:space-around;align-items:center}
.jcas-foot span{width:9px;height:9px;border-radius:50%;background:#0005;box-shadow:inset 0 1px 2px #0008}

/* pop forward, then settle */
.jcas-wrap.pop .jcas{animation:jcasPop .42s cubic-bezier(.2,1.4,.4,1) both}
@keyframes jcasPop{0%{transform:translateY(24px) scale(.62) rotate(-4deg);opacity:0}60%{transform:translateY(-4px) scale(1.05) rotate(1deg);opacity:1}100%{transform:none}}
.jcas-wrap.is-playing .jcas{box-shadow:0 18px 44px #0009,0 0 0 2px #ffd65a66,inset 0 2px 0 #ffffff55}

/* controls */
.jcas-ctrl{display:flex;align-items:center;gap:10px;width:100%;max-width:420px;padding:0 4px}
.jcas-play{flex:0 0 52px;width:52px;height:52px;border:0;border-radius:50%;display:grid;place-items:center;background:linear-gradient(180deg,#ffd65a,#f3a61b);color:#2a0f5c;box-shadow:0 6px 16px #f3a61b55;cursor:pointer}
.jcas-play svg{width:26px;height:26px}
.jcas-meta{flex:1;min-width:0;display:grid;gap:5px}
.jcas-who{display:grid;text-align:left;border:0;background:none;padding:0;color:inherit;font:inherit;cursor:pointer;min-width:0}
.jcas-who:disabled{cursor:default}
.jcas-who b{font-size:15px;font-weight:900;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.jcas-who small{font-size:12.5px;font-weight:700;color:#6b5f86;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.jcas-who:not(:disabled) small{text-decoration:underline;text-underline-offset:2px}
.jcas-bar{height:6px;border-radius:3px;background:#e9e1f6;overflow:hidden}
.jcas-bar i{display:block;height:100%;width:0;background:linear-gradient(90deg,#f107a3,#ff9a3c);border-radius:3px}
.jcas-time{display:flex;justify-content:space-between;align-items:center;font:700 11.5px/1 Inter,system-ui,sans-serif;color:#6b5f86}
.jcas-x{flex:0 0 40px;width:40px;height:40px;border:0;border-radius:50%;background:#f1ecf8;color:#2a0f5c;font-size:24px;line-height:1;cursor:pointer}
.jcas-play:focus-visible,.jcas-x:focus-visible,.jcas-who:focus-visible{outline:3px solid #1d4ed8;outline-offset:2px}
.jcas-extra{width:100%;max-width:420px}

/* the sheet (Music page) */
dialog.jcas-sheet{border:0;padding:0;margin:auto auto 0;width:min(100%,460px);max-width:100vw;max-height:calc(100dvh - 12px);background:transparent;overflow:visible}
dialog.jcas-sheet::backdrop{background:#0b0620b3}
.jcas-sheet-box{position:relative;background:#fff;border-radius:24px 24px 0 0;padding:12px 12px calc(16px + env(safe-area-inset-bottom,0px));box-shadow:0 -12px 40px #0006;animation:jcasUp .26s ease both;max-height:calc(100dvh - 12px);overflow:auto}
.jcas-min{position:absolute;z-index:3;top:20px;left:20px;width:36px;height:36px;border:0;border-radius:50%;background:#ffffff26;color:#fff;font-size:20px;line-height:1;cursor:pointer}
dialog.jcas-sheet.out .jcas-sheet-box{animation:jcasDown .18s ease both}
@keyframes jcasUp{from{transform:translateY(40px);opacity:.4}to{transform:none;opacity:1}}
@keyframes jcasDown{to{transform:translateY(60px);opacity:0}}
@media(min-width:700px){dialog.jcas-sheet{margin:auto}.jcas-sheet-box{border-radius:24px}}

/* the small now-playing badge (spins only while its song plays) */
.jc-np{display:inline-flex;align-items:flex-end;gap:1.5px;height:18px;vertical-align:middle;margin-left:6px}
.jc-np svg{width:18px;height:18px}
.jc-np-disc{fill:#151018}.jc-np-groove{fill:none;stroke:#ffffff2e;stroke-width:1}.jc-np-lbl{fill:#f107a3}
.jc-np-shine{fill:none;stroke:#ffd65a;stroke-width:1.6;stroke-linecap:round}
.jc-np i{display:block;width:2.5px;height:6px;border-radius:1px;background:linear-gradient(#ffd65a,#f107a3);margin-left:1px}
.playing .jc-np svg,.is-playing .jc-np svg{animation:jcNpSpin 1.6s linear infinite}
.playing .jc-np i,.is-playing .jc-np i{animation:jcNpBeat .9s ease-in-out infinite}
.playing .jc-np i:nth-of-type(2),.is-playing .jc-np i:nth-of-type(2){animation-delay:.2s}
.playing .jc-np i:nth-of-type(3),.is-playing .jc-np i:nth-of-type(3){animation-delay:.42s}
@keyframes jcNpSpin{to{transform:rotate(360deg)}}
@keyframes jcNpBeat{0%,100%{height:5px}50%{height:15px}}

@media (prefers-reduced-motion:reduce){
  .jcas-wrap.pop .jcas,.jcas-sheet-box,dialog.jcas-sheet.out .jcas-sheet-box{animation:none}
  .jcas-pack,.jcas-pack-shine{transition:none}
  .playing .jc-np svg,.is-playing .jc-np svg,.playing .jc-np i,.is-playing .jc-np i{animation:none}
  .jcas-clip{display:none}
}
