/* Painted wells keep their hue distinct beneath the glass and toy silhouettes. */
.arcade-tile[data-type]::before {
  background: linear-gradient(145deg,
    color-mix(in srgb, var(--toy-color) 46%, #fffaff),
    color-mix(in srgb, var(--toy-color) 88%, #fffaff) 58%,
    var(--toy-color));
}

/* Animate the artwork inside the button so the swipe and tap area stays put. */
.arcade-board[aria-busy=false] .arcade-pieces {overflow: visible}
.arcade-board .arcade-tile {overflow: visible}
.arcade-board .tile-toy {
  transform-origin: center 70%;
  transition: transform 180ms cubic-bezier(.22,1,.36,1);
}
.arcade-tile:is(.type-pony,.type-unicorn) {--toy-pose: translateY(-8%) rotate(-11deg) scale(1.14)}
.arcade-tile.type-doll {--toy-pose: translateY(-5%) rotate(7deg) scale(1.12)}
.arcade-tile.type-bear {--toy-pose: translateY(-3%) rotate(-6deg) scale(1.14,1.08)}
.arcade-tile.type-bow {--toy-pose: translateY(-9%) rotate(-7deg) scale(1.16)}
.arcade-tile.type-ball {--toy-pose: translate(-4%,-7%) rotate(-23deg) scale(1.14)}
.arcade-tile.type-bunny {--toy-pose: translateY(-10%) rotate(3deg) scale(1.08,1.16)}
.arcade-tile:is(.type-crown,.type-cupcake) {--toy-pose: translateY(-7%) rotate(9deg) scale(1.13)}
.arcade-tile.type-icecream {--toy-pose: translateY(-7%) rotate(-9deg) scale(1.11,1.15)}
.arcade-tile.power-joker {--toy-pose: translate(4%,-6%) rotate(-3deg) scale(1.13)}
.arcade-board .tile-shine {
  overflow: hidden;
  z-index: 0;
}
.arcade-board .tile-shine::after {
  content: '';
  position: absolute;
  inset: -25% auto -25% -42%;
  width: 24%;
  background: linear-gradient(90deg, transparent, #fff7e3c9 50%, transparent);
  transform: translateX(0) skewX(-22deg);
  opacity: 0;
}
.arcade-board .arcade-tile:hover {filter: none}
.arcade-board .arcade-tile:focus-visible {outline-color: transparent}
.arcade-board .arcade-tile:is(.selected,.hinted,:focus-visible)::after {
  content: '';
  position: absolute;
  inset: 2%;
  border: 2px solid #fff3ad;
  border-radius: 20%;
  box-shadow: 0 0 8px #ffe18e, inset 0 0 7px #fff5aa;
  z-index: 1;
  pointer-events: none;
}
.arcade-board .arcade-tile:focus-visible::after {
  border-color: #fff;
  box-shadow: 0 0 0 2px #592251, inset 0 0 0 1px #592251;
}
@media (forced-colors: active) {
  .arcade-board .arcade-tile:focus-visible {outline-color: CanvasText}
}
@media (hover: hover) and (pointer: fine) {
  .arcade-board[aria-busy=false] .arcade-tile:hover {
    z-index: 5;
  }
  .arcade-board[aria-busy=false] .arcade-tile:hover .tile-toy {
    transform: var(--toy-pose, translateY(-6%) scale(1.13));
    transition-timing-function: cubic-bezier(.18,.9,.34,1);
  }
  .arcade-board[aria-busy=false] .arcade-tile:hover .tile-shine {
    box-shadow: inset 0 0 0 1px #fff4f9, inset 0 -3px 0 #fb88bdbf, 0 2px 10px #ed6daa70;
  }
  .arcade-board[aria-busy=false] .arcade-tile:hover .tile-shine::after {
    animation: arcade-tile-glint 380ms cubic-bezier(.22,1,.36,1) both;
  }
}
.arcade-board[aria-busy=false] .arcade-tile:active .tile-toy {
  transform: translateY(3%) scale(.89);
  transition-duration: 75ms;
}
.arcade-board[aria-busy=false] .arcade-tile:active .tile-shine {
  box-shadow: inset 0 0 0 2px #fff1b7, inset 0 -3px 0 #f3a86f;
}
.arcade-board .arcade-tile.hinted {animation: none}
.arcade-board[aria-busy=false] .arcade-tile.hinted:not(:hover,:active) .tile-toy {
  animation: arcade-toy-peek 500ms cubic-bezier(.2,.75,.3,1) calc(var(--col) * 28ms) both;
}
.arcade-board[aria-busy=false] .hinted ~ .hinted ~ .hinted ~ .hinted .tile-toy {
  animation: none;
}
@keyframes arcade-toy-peek {
  0%, 100% {transform: none}
  26% {transform: translateY(2%) scale(1.04,.95)}
  63% {transform: var(--toy-pose, translateY(-6%) scale(1.13))}
}
@keyframes arcade-tile-glint {
  0% {transform: translateX(0) skewX(-22deg); opacity: 0}
  22% {opacity: .92}
  100% {transform: translateX(650%) skewX(-22deg); opacity: 0}
}
.tile-landing {
  position: absolute;
  inset: auto 18% 10%;
  height: 6%;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, #fff7cb 35% 65%, transparent);
  box-shadow: 0 0 8px var(--toy-color);
  pointer-events: none;
  z-index: 1;
  opacity: 0;
}

/* The glass dims once per match, leaving the actual removed pieces above it. */
.match-focus {
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:#27123191;
  opacity:0;
  pointer-events:none;
  z-index:4;
}
.arcade-board .arcade-tile.match-lit {z-index:8}
.arcade-board .arcade-tile.match-lit::before {
  border-color:#fff0b3;
  background:linear-gradient(145deg,#fffbe7,color-mix(in srgb,var(--toy-color) 70%,#fff2ba) 63%,var(--toy-color));
  box-shadow:0 0 0 2px #fff1ad,0 0 15px var(--toy-color),inset 0 2px 4px #fff;
}
.arcade-board .arcade-tile.match-lit[data-match-tier="5"]::before {
  border-color:#d9fff4;
  box-shadow:0 0 0 2px #b4fbea,0 0 13px #7df4deb0,inset 0 2px 4px #fff;
}
.arcade-board .arcade-tile.match-lit:is([data-match-tier="7"],[data-match-tier="8"])::before {
  box-shadow:0 0 0 2px #fff4b9,0 0 10px #ffabec,0 0 17px var(--toy-color),inset 0 2px 4px #fff;
}
.arcade-caption[data-tone=power] {
  top:var(--power-caption-y,19%);
  width:max-content;
  max-width:90%;
  padding:8px 16px;
  border:2px solid #fff0a8;
  border-radius:14px;
  background:linear-gradient(155deg,#fff5ce,#ffca84 66%,#fa9fc1);
  box-shadow:0 3px 0 #9e5171,0 0 22px #ffe48e8c,inset 0 0 0 1px #b66d73;
  color:#582346;
  font:700 clamp(16px,4.6vw,27px)/1 Fredoka,var(--font);
  text-shadow:0 1px #fff1d5;
  -webkit-text-stroke:0;
}

.match-effects {
  position:absolute;
  inset:0;
  z-index:11;
  border-radius:inherit;
  overflow:hidden;
  pointer-events:none;
}
.match-ring {
  position: absolute;
  width: calc(95% / var(--size));
  aspect-ratio: 1;
  border: 2px solid #fff6cf;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--match-color);
  opacity: 0;
  pointer-events: none;
  z-index: 11;
}
.match-ring[data-tier="2"] {border-width:1px;box-shadow:0 0 0 1px var(--match-color)}
.match-ring[data-tier="3"] {box-shadow:0 0 0 2px var(--match-color),0 0 8px #ffce90c0}
.match-ring[data-tier="3"]::before {
  content:'';
  position:absolute;
  inset:29%;
  background:linear-gradient(145deg,#fffdf0,#ffd487 72%);
  clip-path:polygon(50% 0,58% 42%,100% 50%,58% 58%,50% 100%,42% 58%,0 50%,42% 42%);
  transform:rotate(-16deg);
}
.match-ring[data-tier="4"] {
  border-color:#fff1d7;
  box-shadow:0 0 0 2px var(--match-color),0 0 0 5px #ff9adc,0 0 13px #ffabd5, inset 0 0 8px #ffeba1;
}
.match-ring[data-tier="5"] {
  border-color:#e4fff4;
  border-radius:29%;
  box-shadow:0 0 0 2px var(--match-color),0 0 0 4px #a8fdec,0 0 13px #9ffde8b0,inset 0 0 9px #f5ffc4;
}
.match-ring[data-tier="6"] {
  border-color:#fffae1;
  box-shadow:0 0 0 2px #ffd984,0 0 0 5px var(--match-color),0 0 17px #ffabdc, inset 0 0 10px #fff6b3;
}
.match-ring[data-tier="7"] {
  border-color:#fff9de;
  box-shadow:0 0 0 2px #ffcf78,0 0 0 4px var(--match-color),0 0 12px #abf9ffc0,inset 0 0 10px #ffdf98;
}
.match-ring[data-tier="8"] {
  border-color:#fffbed;
  box-shadow:0 0 0 2px #ffc5ed,0 0 0 5px #ffce75,0 0 13px var(--match-color),inset 0 0 11px #fff2bd;
}
.match-sunburst {
  position:absolute;
  z-index:12;
  width:calc(175% / var(--size));
  aspect-ratio:1;
  background:linear-gradient(146deg,#ffedac 20%,#fff9df 47%,#ffd988 54%,var(--match-color) 71%,#ff9fde);
  clip-path:polygon(50% 0%,58% 35%,85% 15%,65% 42%,100% 50%,65% 58%,85% 85%,58% 65%,50% 100%,42% 65%,15% 85%,35% 58%,0% 50%,35% 42%,15% 15%,42% 35%);
  opacity:0;
  pointer-events:none;
}
.match-sunburst[data-tier="5"] {
  width:calc(126% / var(--size));
  background:linear-gradient(132deg,#fff3b7 12%,#fbfff0 43%,#9cffe7 63%,#9ecee9 93%);
  clip-path:polygon(50% 0,60% 38%,100% 50%,60% 62%,50% 100%,40% 62%,0 50%,40% 38%);
}
.match-sunburst:is([data-tier="7"],[data-tier="8"]) {
  width:calc(185% / var(--size));
  background:linear-gradient(146deg,#ff9ad6 13%,#ffdc8a 37%,#fffcee 48%,#9bf9ec 70%,var(--match-color) 91%);
}
.match-sunburst[data-tier="8"] {
  width:calc(208% / var(--size));
  background:linear-gradient(141deg,#d18bff 10%,#ff9cdb 30%,#fff9cc 46%,#ffc76c 56%,#a1fdf0 76%,var(--match-color) 93%);
}
.match-sunburst[data-satellite="true"] {width:calc(93% / var(--size))}
.reduce-motion .match-effects,.arcade-board[data-reduced=true] .match-effects {display:none}
@media (prefers-reduced-motion:reduce) {.match-effects {display:none}}
.match-ring::after {
  content: '';
  position: absolute;
  inset: 7%;
  border: 1px solid #fff8dfb8;
  border-radius: inherit;
}
.family-cameo {
  position: absolute;
  z-index: 19;
  top: 50%;
  left: 50%;
  width: min(72%, 220px);
  margin: 0;
  padding: 4px;
  border: 2px solid #ffe6a5;
  border-radius: 16px;
  background: #821b4d;
  box-shadow: 0 9px 22px #310b27a8, inset 0 0 0 1px #ff9ac5;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%,-50%);
}
.family-cameo img {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: contain;
  border-radius: 10px;
}
.family-cameo figcaption {
  padding: 5px 2px 3px;
  color: #fff0c9;
  font: 600 clamp(12px, 2.5vw, 17px)/1.05 Fredoka, var(--font);
  text-align: center;
}

/* Violet enamel and a soft intermittent rim mark the one real joker. */
.arcade-tile.power-joker::before {
  background: linear-gradient(145deg,#ffebfa 5%,#d99ee5 48%,#a260bf 100%) !important;
  border-color: #ffdf9d;
  box-shadow: 0 0 0 1px #ac5bac,0 0 9px #ffb5e98a,inset 0 0 0 2px #fbe0f0,inset 0 2px 3px #fff !important;
}
.arcade-tile.power-joker::after {
  content: '';
  position: absolute;
  z-index: 0;
  inset: 4%;
  border-radius: 19%;
  box-shadow: 0 0 5px #fff1b5,0 0 13px #f996ed,inset 0 0 9px #ffdaf8;
  opacity: .2;
  pointer-events: none;
  animation: amor-hero-twinkle 3.4s cubic-bezier(.22,.61,.36,1) infinite;
}
.arcade-tile.power-joker .power-sprite {
  padding: 0;
  filter: drop-shadow(0 2px 2px #66376188) drop-shadow(0 0 3px #fff0b2a8);
}
.arcade-tile.power-joker .power-mark {
  display: flex;
  width: 24%;
  right: 3%;
  bottom: 1%;
}
@keyframes amor-hero-twinkle {
  0%, 44%, 100% { opacity: .2; }
  18% { opacity: .82; }
  29% { opacity: .53; }
}
.reduce-motion .arcade-tile.power-joker::after,
.arcade-board[data-reduced=true] .arcade-tile.power-joker::after { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .arcade-tile.power-joker::after { animation: none; }
}
.arcade-tile.joker-mimicking::before {
  background: radial-gradient(ellipse at 35% 24%, #fffdf0,
    color-mix(in srgb, var(--joker-color) 65%, #fff0bd)) !important;
}
.joker-imitation {
  position: absolute;
  inset: 5%;
  display: block;
  pointer-events: none;
  z-index: 5;
  opacity: 0;
  filter: drop-shadow(0 0 4px #fff3bd);
}
.joker-imitation .toy-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0;
}
.arcade-tile.joker-target::before {
  border-color: #fff7cd;
  box-shadow: 0 0 8px color-mix(in srgb, var(--joker-color) 65%, #ffdc80),
    inset 0 0 6px #fff2b78c !important;
}

/* Short neighbouring segments, rather than the rainbow's board-wide spokes. */
.joker-path {
  position: absolute;
  height: clamp(3px, .6vw, 5px);
  margin-top: -2px;
  border-radius: 999px;
  transform-origin: left center;
  background: linear-gradient(90deg, #fff8cc, #ffe9a2 35%, var(--joker-color) 100%);
  box-shadow: 0 0 7px #ffd978a3;
  z-index: 10;
  pointer-events: none;
}
.power-ring.joker {
  width: calc(145% / var(--size));
  border-width: 3px;
  border-color: #fff0b0;
  box-shadow: 0 0 12px #ffdc88a6, inset 0 0 8px #ffe6a35c;
}
.power-ring.created {
  width: calc(145% / var(--size));
  border-width: 3px;
  border-color: #fff2bc;
}
.combo-charging::after {
  background: radial-gradient(ellipse at center, #5b205033, #25144779);
}
.blanket-fold {
  position: absolute;
  width: calc(78% / var(--size));
  height: calc(60% / var(--size));
  pointer-events: none;
  z-index: 12;
  transform-origin: 95% 90%;
}
.blanket-flap {
  position: absolute;
  inset: 0;
  border: 2px dashed #fff4db;
  border-radius: 18% 12% 28% 10%;
  background: repeating-linear-gradient(0deg,#f6b8b9 0 3px,#f1a9b5 3px 5px);
  box-shadow: 1px 3px 5px #643b6952, inset 0 0 0 3px #f7cebe;
}
.blanket-thread {
  position: absolute;
  width: 35%;
  height: 5px;
  border-top: 2px solid #fff1cf;
  border-radius: 50%;
  left: -10%;
  bottom: 10%;
  transform: rotate(-28deg);
}
.blanket-thread.second { left: 5%; bottom: -2%; transform: rotate(-8deg); }

.arcade-board[data-reduced=true] .arcade-tile {
  transition: none;
}
.arcade-board[data-reduced=true] .joker-path,
.arcade-board[data-reduced=true] .blanket-fold {
  display: none;
}
.reduce-motion .arcade-board .tile-toy,
.arcade-board[data-reduced=true] .tile-toy {
  transition: none;
  animation: none !important;
}
.reduce-motion .arcade-board .arcade-tile:is(:hover,:active) .tile-toy,
.arcade-board[data-reduced=true] .arcade-tile:is(:hover,:active) .tile-toy {
  transform: none;
}
.reduce-motion .arcade-board .arcade-tile:hover .tile-shine::after,
.arcade-board[data-reduced=true] .arcade-tile:hover .tile-shine::after,
.reduce-motion .match-ring,
.reduce-motion .family-cameo {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .arcade-board .arcade-tile,
  .arcade-board .tile-toy {transition: none;animation: none !important}
  .arcade-board[aria-busy=false] .arcade-tile:is(:hover,:active) .tile-toy {transform: none}
  .arcade-board .tile-shine::after,
  .joker-path, .blanket-fold, .match-ring, .family-cameo {display: none}
}
.arcade-tile.power-superspecial::before {
  background:linear-gradient(145deg,#6ccfc7,#7760ae 57%,#513573)!important;
  border-color:#fff2ab;
  box-shadow:0 0 0 1px #e4a4d0,0 0 12px #ffc6e1a0,inset 0 0 9px #c8e9ed!important;
}
.arcade-tile.power-superspecial .power-sprite {padding:0}
