/* Fun mode (Settings → Appearance, html[data-fun]): everything the official look keeps quiet comes back (the reaper race,
   confetti, stamps, glows; their rules live in app.css), plus a rubber duck for a cursor, buttons that wobble, and on the
   beta the songs: the page bobs on every other beat and lyrics appear in the side margins; with "Claude's Plan" a tiny
   terminal types the coding jokes, with "Pirate Token" its coin spins, circles and rains. With reduced motion the duck and the lyrics stay, the moving parts don't */

/* the rubber duck (rubber-duck debugging); over anything clickable it quacks */
:root[data-duck],:root[data-duck] body{cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cellipse cx='18' cy='21.5' rx='12' ry='7.5' fill='%23ffd23f' stroke='%231d140c' stroke-width='1.5'/%3E%3Ccircle cx='11.5' cy='9' r='6' fill='%23ffd23f' stroke='%231d140c' stroke-width='1.5'/%3E%3Cpath d='M15 20q5 5 10-1' fill='none' stroke='%231d140c' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='7.8' r='1.4' fill='%231d140c'/%3E%3Cpath d='M7 6.6 1.5 8.4 7 10.4Z' fill='%23f08a1c' stroke='%231d140c' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 2 8,auto}
:root[data-duck] :is(a,button,summary,label,select,[role="slider"],[role="switch"],.upitem,.winbar){cursor:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cellipse cx='18' cy='21.5' rx='12' ry='7.5' fill='%23ffd23f' stroke='%231d140c' stroke-width='1.5'/%3E%3Ccircle cx='11.5' cy='9' r='6' fill='%23ffd23f' stroke='%231d140c' stroke-width='1.5'/%3E%3Cpath d='M15 20q5 5 10-1' fill='none' stroke='%231d140c' stroke-width='1.3' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='7.8' r='1.4' fill='%231d140c'/%3E%3Cpath d='M7 6.4 1.5 5.6 7 8.6Z M7 9 1.8 11.6 7 11.2Z' fill='%23f08a1c' stroke='%231d140c' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 2 8,pointer}
:root[data-duck] :is(input[type="text"],textarea,input:not([type])){cursor:text}

/* while the song plays its part, the page leaves room in the margins for the lyrics */
@media (min-width:1240px){:root[data-song] .wrap{max-width:min(1180px,calc(100vw - 440px))}}

@media (prefers-reduced-motion:no-preference){
  :root[data-fun]:not([data-perf="low"]) :is(.btn,.gear,.seg button,.addbtn):active{animation:fwob .35s ease}
  /* the beat: the plane and the course cells nod, the progress bar flexes */
  :root[data-fun].bt:not([data-perf="low"]) .summary{animation:fnod .26s cubic-bezier(.3,.7,.3,1)}
  :root[data-fun].bt:not([data-perf="low"]) details.course:not([open]){animation:fnod .26s cubic-bezier(.3,.7,.3,1)}
  :root[data-fun].bt:not([data-perf="low"]) .summary .bar{animation:fflex .26s ease-out}
  :root[data-fun].bt:not([data-perf="low"]) .wm .n{animation:fhop .26s ease-out}
  .lyr p span{display:inline-block;animation:fword .38s cubic-bezier(.2,1.6,.4,1) both}
  .lyr p.out{animation:fout .45s ease-in forwards}
}
@keyframes fwob{25%{transform:rotate(-4deg) scale(.96)}55%{transform:rotate(3deg) scale(1.03)}80%{transform:rotate(-1deg)}}
@keyframes fnod{40%{transform:translateY(-3px) rotate(-.25deg)}}
@keyframes fflex{40%{transform:scaleY(1.6)}}
@keyframes fhop{40%{transform:translateY(-14px)}}
@keyframes fword{from{opacity:0;transform:translateY(.5em) scale(.4) rotate(-8deg)}}
@keyframes fout{to{opacity:0;transform:translateY(-.6em);filter:blur(3px)}}

/* the player: a chip in the bottom-left corner, play / pause and how far the song is */
.funplay{position:fixed;left:max(16px,env(safe-area-inset-left,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:55;display:flex;align-items:center;gap:10px;
  padding:6px 14px 6px 6px;border-radius:999px;background:var(--ink);color:var(--paper);box-shadow:0 8px 24px rgba(20,12,6,.3);font-size:12.5px}
.funpp{width:30px;height:30px;border-radius:50%;border:0;background:var(--wmark);display:grid;place-items:center;padding:0}
.funpp::before{content:"";width:0;height:0;margin-left:3px;border-style:solid;border-width:6px 0 6px 10px;border-color:transparent transparent transparent #1d140c}
.funpp.on::before{width:10px;height:12px;margin:0;border:0;border-left:3px solid #1d140c;border-right:3px solid #1d140c}
.funt{display:grid;gap:4px;min-width:0}
.funt b{font-weight:700;white-space:nowrap}
.funt i{display:block;height:3px;width:120px;background:color-mix(in srgb,var(--paper) 25%,transparent)}
.funt u{display:block;height:100%;width:0;background:var(--wmark)}
.funplay:has(.funnx){padding-right:6px}
.funnx{width:30px;height:30px;border-radius:50%;border:0;background:transparent;color:inherit;display:grid;place-items:center;padding:0;opacity:.75;transition:opacity .15s,background-color .15s}
.funnx:hover{opacity:1;background:color-mix(in srgb,var(--paper) 14%,transparent)}
.funpp:focus-visible,.funnx:focus-visible{outline:2px solid var(--wmark);outline-offset:2px}
@media (max-width:640px){.funplay{bottom:calc(84px + env(safe-area-inset-bottom,0px))}}
/* the "new version" band (app.css) sits over the chip, not under it, while the player is shown */
:root[data-song] .updband{bottom:calc(68px + env(safe-area-inset-bottom,0px))}
@media (max-width:640px){:root[data-song] .updband{bottom:calc(136px + env(safe-area-inset-bottom,0px))}}

/* lyrics: on wide screens one line at a time in a side margin (left, right, left …), on narrow ones a band at the bottom */
.lyr{position:fixed;z-index:4;pointer-events:none;font:800 clamp(18px,1.6vw,26px)/1.15 var(--f-display);letter-spacing:-.02em;color:var(--ink);text-wrap:balance}
.lyr p{margin:0;position:absolute;inset:auto 0 0}
.lyr p span:nth-child(3n+2){color:var(--wmark)}
.lyr.l,.lyr.r{top:30vh;width:180px;height:40vh}
.lyr.l{left:24px;text-align:left}
.lyr.r{right:24px;text-align:right}
.lyr.l p,.lyr.r p{inset:0 0 auto}
.lyr.b{left:16px;right:16px;bottom:calc(64px + env(safe-area-inset-bottom,0px));height:3.6em;text-align:center;font-size:18px}
@media (min-width:1240px){.lyr.b{display:none}}
@media (max-width:1239px){.lyr.l,.lyr.r{display:none}}
@media (max-width:640px){.lyr.b{bottom:calc(132px + env(safe-area-inset-bottom,0px))}}
.lyr.b p{padding:6px 10px;border-radius:6px;background:color-mix(in srgb,var(--paper) 88%,transparent)}
/* a line with word times (Pirate Token): the word being sung is gold and a touch bigger; "Pirate token" is shouted */
.lyr p.w span{color:inherit;transition:color .12s,transform .15s ease-out}
.lyr p.w span.on{color:var(--wmark);transform:scale(1.08)}
.lyr p.big{font-size:1.3em;text-transform:uppercase;letter-spacing:-.01em}

/* Pirate Token's coin: the player chip's twin in the bottom-right corner. It sways, pulses and rings on the beat and turns on
   every "Pirate token" (fun.js); six small coins circle it, and more rain down through the choruses (html[data-rain]) */
.funtok{--s:112px;position:fixed;right:max(40px,env(safe-area-inset-right,0px));bottom:calc(16px + env(safe-area-inset-bottom,0px));z-index:54;width:var(--s);height:var(--s);pointer-events:none}
.funtok .main{position:absolute;inset:0;z-index:1;width:100%;height:100%;filter:drop-shadow(0 6px 12px rgba(110,64,0,.35))}
.funtok .orbs{position:absolute;left:50%;top:50%;display:none}
.funtok .orbs img{position:absolute;left:0;top:0;width:calc(var(--s)*.24);offset-path:path("M -64 0 A 64 18 0 1 0 64 0 A 64 18 0 1 0 -64 0");offset-rotate:0deg}
.funtok .ring{position:absolute;inset:6%;border-radius:50%;border:3px solid #ffd27a;pointer-events:none}
.funrain{position:fixed;inset:0;z-index:53;pointer-events:none;overflow:hidden;opacity:0;visibility:hidden;transition:opacity .6s,visibility 0s .6s}
.funrain img{position:absolute;top:-60px;height:auto;filter:drop-shadow(0 3px 5px rgba(110,64,0,.3))}
:root[data-rain] .funrain{opacity:1;visibility:visible;transition:opacity .4s}
/* below 1240px the lyrics are a band at the bottom: the coin shrinks to the player chip's height, in its row */
@media (max-width:1239px){
  .funtok{--s:46px;right:max(16px,env(safe-area-inset-right,0px));bottom:calc(14px + env(safe-area-inset-bottom,0px))}
  .funtok .orbs img{offset-path:path("M -30 0 A 30 8 0 1 0 30 0 A 30 8 0 1 0 -30 0")}
}
@media (max-width:640px){.funtok{bottom:calc(82px + env(safe-area-inset-bottom,0px))}}
@media (prefers-reduced-motion:no-preference){
  :root:not([data-perf="low"]) .funtok .main{animation:ftsway 3.7s ease-in-out infinite}
  :root:not([data-perf="low"]) .funtok .orbs{display:block}
  :root:not([data-perf="low"]) .funtok .orbs img{animation:ftorb 6s linear infinite}
  :root:not([data-perf="low"]) .funrain img{animation:ftrain linear infinite}
  :root:not([data-rain]) .funrain img{animation-play-state:paused}
  .lyr p.w span.k0{animation-name:ffly}
  .lyr p.w span.k1{animation-name:fslam;animation-timing-function:cubic-bezier(.3,1.3,.5,1)}
  .lyr p.w span.k2{animation:fdrop .5s linear both}
  .lyr p.w span.k3{animation-name:fspin;animation-timing-function:cubic-bezier(.2,.9,.3,1.2)}
}
@media (prefers-reduced-motion:reduce){.funrain{display:none}}
@keyframes ftsway{0%,100%{transform:rotate(-8deg)}50%{transform:rotate(8deg) translateY(-4%)}}
/* around the ellipse: in front of the coin and bigger along the bottom, behind it and smaller along the top */
@keyframes ftorb{0%{offset-distance:0%;z-index:2;transform:scale(1)}25%{transform:scale(1.35)}50%{offset-distance:50%;z-index:2;transform:scale(1)}
  50.01%{z-index:0}75%{transform:scale(.7)}100%{offset-distance:100%;z-index:0;transform:scale(1)}}
@keyframes ftrain{to{transform:translateY(calc(100vh + 120px)) rotate(540deg)}}
@keyframes ffly{from{opacity:0;transform:translate(-1.4em,.4em) rotate(-14deg) scale(1.8)}}
@keyframes fslam{from{opacity:0;transform:scale(3.2)}}
@keyframes fdrop{0%{opacity:0;transform:translateY(-2.2em)}30%{opacity:1;transform:translateY(0)}48%{transform:translateY(-.5em)}64%{transform:translateY(0)}78%{transform:translateY(-.15em)}}
@keyframes fspin{from{opacity:0;transform:rotate(-360deg) scale(.1)}}

/* the terminal: types the command, then answers */
.funsh{position:fixed;right:max(16px,env(safe-area-inset-right,0px));top:calc(16px + env(safe-area-inset-top,0px));z-index:56;width:min(340px,calc(100vw - 32px));pointer-events:none;
  padding:10px 14px;border-radius:6px;background:#120d09;color:#e9dfcf;font:500 12.5px/1.5 var(--f-mono);box-shadow:0 12px 30px rgba(0,0,0,.35);
  opacity:0;transform:translateY(-8px);transition:opacity .25s,transform .25s}
.funsh.in{opacity:1;transform:none}
.funsh p{margin:0;white-space:pre-wrap;word-break:break-word}
.funsh b{color:#e0a94f}
.funsh .cur{display:inline-block;width:7px;height:1.1em;vertical-align:-.2em;background:#e9dfcf;margin-left:2px}
.funsh .ans.yes{color:#7fc495}.funsh .ans.no{color:#ef7f72}
@media (prefers-reduced-motion:no-preference){.funsh .cur{animation:fblink 1s steps(1) infinite}}
@keyframes fblink{50%{opacity:0}}
