.sakura-board {
  --board-dark: #372c4b;
  --board-light: #493653;
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 11px;
  background: var(--board-dark);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.sb-grid {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(var(--sb-cols,7), minmax(0, 1fr));
  grid-template-rows: repeat(var(--sb-rows,7), minmax(0, 1fr));
}
.sb-cell {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  appearance: none;
  border: 0;
  border-radius: 0;
  background: var(--board-dark);
  box-shadow: none;
  cursor: pointer;
  touch-action: none;
  outline: none;
}
.sb-cell.sb-pale { background: var(--board-light); }
.sb-cell.sb-void { visibility:hidden; pointer-events:none }
.sakura-board { background:repeating-linear-gradient(135deg,#251b31 0 3px,#281e35 3px 6px); }
.sakura-board .sb-cell:active { translate: 0 0; }
.sb-cell .sb-charm { -webkit-touch-callout: none; }
.sb-held { will-change: translate; }
.sb-obstacle { display: none; pointer-events: none; position: absolute; }
.sb-cell[data-obstacle="seal"] { box-shadow: inset 0 0 0 2px #e3bd84a6, inset 0 0 12px 2px #e9b16d58; }
.sb-cell[data-obstacle="seal"] .sb-obstacle {
  display: block;
  width: 36%; height: 44%; bottom: 0; right: 0; z-index: 2;
  background: url("assets/seal.svg") center / contain no-repeat;
  filter: drop-shadow(0 1px 1px #2b173e8c);
}
.sb-cell[data-obstacle="crate"] .sb-charm { visibility: hidden; }
.sb-cell[data-obstacle="crate"] .sb-obstacle {
  display: block; inset: 0; z-index: 2;
  background: url("assets/crate.svg") center / 96% 96% no-repeat;
  filter: drop-shadow(0 2px 2px #2213287a);
}
.sb-cell[data-obstacle="crate"][data-hp="1"] .sb-obstacle::after {
  content: ""; position: absolute; inset: 8% 13% 15% 52%; background: #653c39;
  clip-path: polygon(42% 0,61% 0,33% 30%,53% 34%,22% 61%,43% 66%,5% 100%,19% 70%,0 65%,27% 39%,8% 35%);
}
.sb-obstacle-chip {
  width: 13%; height: 13%; translate: -50% -50%; position: absolute;
  border: 2px dashed #f7cc88; border-radius: 14%; animation: sb-obstacle-chip .34s ease-out both;
}
@keyframes sb-obstacle-chip { from {scale: .7; opacity: .85} to {scale: 1.35; opacity: 0} }
.sb-cell::before {
  content: "";
  position: absolute;
  inset: 3%;
  border-radius: 15%;
  pointer-events: none;
}
.sb-cell:focus-visible { z-index: 4; }
.sb-cell:focus-visible::before { outline: 2px solid #ffefaf; outline-offset: -2px; }
.sb-charm {
  display: block;
  height: 90%;
  width: 90%;
  max-width: none;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  z-index: 1;
  filter: drop-shadow(0 2px 1px #170b2455);
}
@media (hover: hover) {
  .sakura-board:not([aria-busy="true"]) .sb-cell:hover::before {
    background: #f6d5ff13;
    box-shadow: inset 0 0 0 1px #fff0ff38;
  }
  .sakura-board[data-armed]:not([data-armed=""]) .sb-cell:hover::before {
    background: #f4b7ff25;
    box-shadow: inset 0 0 0 2px #ffe4a8;
  }
}
.sb-cell.sb-selected::before {
  background: #ffbde52c;
  box-shadow: inset 0 0 0 2.5px #ffe2a1, inset 0 0 12px #ffa64f66, 0 0 6px #f4acea66;
}
.sb-selected .sb-charm { scale: 1.065; }
.sb-cell.sb-hinted::before {
  border: 2px solid #ffda76;
  background: #ffde7b15;
  animation: sb-hint 1s ease-in-out infinite alternate;
}
.sb-hinted .sb-charm { animation: sb-wiggle 850ms ease-in-out infinite; }
.sb-clearing .sb-charm { animation: sb-pop 145ms ease-in forwards; }
.sb-cell[data-special]:not([data-special=""]) .sb-charm {
  filter: drop-shadow(0 0 3px #ffeeb76b) drop-shadow(0 2px 1px #1e0f34);
}
.sb-cell[data-special="row"] .sb-charm { transform: rotate(57deg); }
.sb-cell[data-special="column"] .sb-charm { transform: rotate(-33deg); }
.sb-cell[data-special="row"]::after,
.sb-cell[data-special="column"]::after {
  content: "";
  position: absolute;
  width: 84%;
  height: 8%;
  border-block: 1px solid #ffe2a6;
  background: #ffcd7580;
  border-radius: 50%;
  opacity: .75;
}
.sb-cell[data-special="column"]::after { transform: rotate(90deg); }
.sb-effects {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.sb-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.sb-banner {
  position: absolute;
  z-index: 3;
  top: 43%;
  left: 50%;
  width: max-content;
  max-width: 97%;
  transform: translate(-50%, -50%) rotate(-5deg);
  color: #fff5ca;
  font-family: inherit;
  font-size: clamp(1.35rem, 3.5vw, 2.7rem);
  font-weight: 1000;
  font-style: italic;
  line-height: 1;
  letter-spacing: -.045em;
  text-align: center;
  paint-order: stroke fill;
  -webkit-text-stroke: .14em #622345;
  text-shadow: 0 .1em 0 #bd5281, 0 .16em 0 #401c3c, 0 .26em .3em #2c142c99;
  animation: sb-banner-pop 950ms ease-out both;
}
.sb-banner.sb-chain { color: #ffe17c; -webkit-text-stroke-color: #592b6e; }
.sb-points {
  position: absolute;
  z-index: 4;
  translate: -50% -50%;
  color: #fff8dc;
  font-family: inherit;
  font-weight: 1000;
  font-size: clamp(1.1rem, 1.95vw, 1.65rem);
  font-style: italic;
  line-height: 1;
  letter-spacing: -.045em;
  paint-order: stroke fill;
  -webkit-text-stroke: .16em #582443;
  text-shadow: 0 .13em 0 #a94469, 0 .2em .18em #220b30;
  animation: sb-points-rise 780ms ease-out both;
}
.sb-mote {
  position: absolute;
  z-index: 2;
  width: 2.35%;
  aspect-ratio: 1;
  translate: -50% -50%;
  animation: sb-mote-flight 810ms cubic-bezier(.13,.6,.27,1) both;
}
.sb-mote::before, .sb-mote::after { content: ""; position: absolute; }
.sb-mote::before {
  inset: 0;
  z-index: 1;
  animation: sb-tumble 780ms ease-out both;
}
.sb-mote::after {
  top: 44%;
  right: 48%;
  width: 205%;
  height: 13%;
  border-radius: 50%;
  background: linear-gradient(to right, transparent, var(--mote-color));
  transform-origin: right;
  transform: rotate(var(--heading));
}
.sb-mote-petal::before {
  background: linear-gradient(140deg,#fff4e9 5%,#ffbad2 36%,#ec659c 78%,#b64785);
  border-radius: 52% 48% 45% 50%;
  clip-path: polygon(13% 8%,42% 0,54% 19%,65% 0,92% 10%,100% 32%,94% 58%,68% 88%,48% 100%,28% 82%,7% 55%,0 27%);
}
.sb-mote-star::before {
  background: linear-gradient(135deg,#fffbe5 15%,#ffdb63 55%,#ff9c64);
  clip-path: polygon(50% 0,61% 34%,96% 36%,69% 57%,78% 95%,49% 74%,18% 94%,28% 58%,0 34%,37% 33%);
}
.sb-mote-confetti::before {
  inset: 22% 10%;
  border-radius: 25%;
  background: linear-gradient(135deg,#fff7d7,var(--mote-color) 45%);
}
.sb-spark {
  position: absolute;
  width: 3.6%;
  aspect-ratio: 1;
  translate: -50% -50%;
  color: var(--spark-color);
  filter: drop-shadow(0 0 2px currentColor);
  animation: sb-spark-fly 480ms ease-out both;
}
.sb-spark::before, .sb-spark::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: polygon(50% 0, 59% 38%, 100% 50%, 60% 58%, 50% 100%, 40% 58%, 0 50%, 40% 39%);
  background: #fff8c7;
}
.sb-spark::after { transform: translate(90%, 82%) scale(.55); background: currentColor; }
.sb-burst { position: absolute; z-index: 2; }
.sb-burst-row, .sb-burst-column {
  background: linear-gradient(0deg, #f379b155, #ffb0ad 18%, #ffe399 39%, #fff9ca 50%, #ffca89 64%, #bba1ff 78%, #8ecbfa66);
  box-shadow: 0 0 7px #ffbfad;
  border-radius: 50%;
  animation: sb-line 460ms ease-out both;
}
.sb-burst-row { width: 100%; height: 2%; margin-top: -1%; }
.sb-burst-column { height: 100%; width: 2%; margin-left: -1%; background: linear-gradient(90deg, #f379b155, #ffb0ad 18%, #ffe399 39%, #fff9ca 50%, #ffca89 64%, #bba1ff 78%, #8ecbfa66); }
.sb-burst-row::after, .sb-burst-column::after {
  content: "";
  position: absolute;
  inset: -65% 1%;
  border-block: 1px solid #ffd89eab;
  border-radius: 50%;
}
.sb-burst-column::after { inset: 1% -65%; border: 0; border-inline: 1px solid #ffaec6bd; }
.sb-burst-bomb, .sb-burst-rainbow {
  width: 10%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 100%;
  background: radial-gradient(circle, #fffbd9 4%, #ffc47a81 40%, #ff78684d 60%, transparent 70%);
  box-shadow: inset 0 0 0 1.5px #ffde7d;
  animation: sb-ring 470ms ease-out both;
}
.sb-burst-rainbow { background: conic-gradient(#f990c477, #ffcb6e88, #83f2ae88, #86dfff77, #c98bff77, #f990c477); }
.sb-burst-bomb::before, .sb-burst-bomb::after {
  content: "";
  position: absolute;
  inset: 13%;
  border: 1px solid #ffadca;
  border-radius: 50%;
}
.sb-burst-bomb::after { inset: 29%; border-color: #ffecb5; }
.sb-combo-aura,.sb-guardian-flash { position:absolute; inset:0; pointer-events:none; z-index:0; animation:sb-festival-halo 620ms ease-out both; }
.sb-combo-2 { box-shadow:inset 0 0 25px #ef8db78c; }
.sb-combo-3 { background:radial-gradient(ellipse at 50% 100%,#fda86475,transparent 60%); box-shadow:inset 0 0 28px #ffc87783; }
.sb-combo-4 { background:repeating-conic-gradient(from 20deg at 50% 60%,#ffdb8755 0deg 2deg,transparent 3deg 27deg); box-shadow:inset 0 0 27px #ffad80a1; }
.sb-combo-5 { background:repeating-conic-gradient(from 2deg at 50% 60%,#f9c2ee70 0deg 2deg,transparent 3deg 24deg); box-shadow:inset 0 0 42px #f596d2ab; }
.sb-combo-6,.sb-call-aki { background:repeating-conic-gradient(from -8deg at 50% 55%,#ffc77463 0deg 4deg,transparent 6deg 20deg); box-shadow:inset 0 0 50px #ffcf80cc; }
.sb-call-momo { box-shadow:inset 0 0 45px #ffb0d2ce; }.sb-call-ren { box-shadow:inset 0 0 50px #ffdd78c9; }.sb-call-yuki { box-shadow:inset 0 0 50px #cdb6ffca; }.sb-call-kage { box-shadow:inset 0 0 50px #76d8f5cd; }
.sb-chain-flower,.sb-lightning { position:absolute; width:10%; height:10%; translate:-50% -50%; pointer-events:none; animation:sb-fireflower 530ms ease-out both; }
.sb-chain-flower { background:repeating-conic-gradient(#fff1af 0 4deg,transparent 5deg 28deg); border-radius:50%; mask:radial-gradient(circle,transparent 30%,#000 34%); }
.sb-lightning { background:linear-gradient(120deg,#fffbc7,#9decfc 55%,#a491ff); clip-path:polygon(60% 0,18% 60%,45% 60%,26% 100%,84% 39%,53% 39%); }
@keyframes sb-festival-halo {from{opacity:0} 22%{opacity:.85} to{opacity:0}}
@keyframes sb-fireflower {from{scale:.1;opacity:1} to{scale:2.4;opacity:0}}
@keyframes sb-points-rise {
  0% { transform: translateY(2px) scale(.72); opacity: 0; }
  16% { transform: translateY(-3px) scale(1.12); opacity: 1; }
  36% { transform: translateY(-10px) scale(1); }
  67% { opacity: 1; }
  100% { transform: translateY(-27px); opacity: 0; }
}
@keyframes sb-mote-flight {
  0% { transform: translate(0,0) scale(.32); opacity: 0; }
  12% { opacity: .95; }
  68% { opacity: .95; }
  100% { transform: translate(var(--flight-x),var(--flight-y)) scale(.6); opacity: 0; }
}
@keyframes sb-tumble { from { rotate: var(--heading); } to { rotate: calc(var(--heading) + var(--twist)); } }
@keyframes sb-spark-fly {
  0% { transform: rotate(var(--spark-angle)) translateY(6px) scale(.2); opacity: 0; }
  25% { opacity: 1; }
  60% { opacity: 1; }
  100% { transform: rotate(var(--spark-angle)) translateY(-28px) scale(1.1); opacity: 0; }
}
@keyframes sb-pop {
  0% { scale: 1; opacity: 1; }
  42% { scale: 1.17; filter: brightness(1.35); }
  100% { scale: .3; opacity: 0; }
}
@keyframes sb-banner-pop {
  0% { opacity: 0; scale: .72; }
  16% { opacity: 1; scale: 1.06; }
  29%, 70% { opacity: 1; scale: 1; }
  100% { opacity: 0; translate: 0 -12px; }
}
@keyframes sb-ring { from { scale: .4; opacity: 1; } to { scale: 5; opacity: 0; } }
@keyframes sb-line { 0% { opacity: 0; scale: .6; } 20% { opacity: 1; scale: 1; } 100% { opacity: 0; } }
@keyframes sb-hint { to { opacity: .4; box-shadow: 0 0 7px #ffcd7b; } }
@keyframes sb-wiggle { 0%, 65%, 100% { rotate: 0deg; } 20% { rotate: -5deg; } 43% { rotate: 5deg; } }
.sb-impact-seal {
  position:absolute; width:18%; aspect-ratio:1; translate:-50% -50%; border:3px double #ffde94;
  border-radius:50%; box-shadow:0 0 9px #ffb760,inset 0 0 8px #ffd8a0; animation:sb-seal-expand .51s ease-out both;
}
.sb-taiko-salvo,.sb-twin-drum {
  position:absolute; translate:-50% -50%; aspect-ratio:1; border-radius:50%; pointer-events:none;
}
.sb-taiko-salvo {
  width:16%; background:radial-gradient(circle,#fff9cb 0 7%,#ffe097 8% 19%,#ffb15563 30%,transparent 55%),
    repeating-conic-gradient(#ffc27a 0 4deg,transparent 6deg 42deg);
  animation:sb-salvo .42s var(--offset) cubic-bezier(.16,.58,.36,1) both;
}
.sb-twin-drum { border:4px double #ffc06b; box-shadow:inset 0 0 17px #f379668a,0 0 10px #ffca9080; animation:sb-salvo .64s ease-out both; }
@keyframes sb-salvo { 0% {scale:.12;opacity:0} 22% {opacity:.87} 100% {scale:1;opacity:0} }
.sb-temari-sweep, .sb-parade-trail {
  position:absolute; inset:-35%; pointer-events:none; transform:rotate(-28deg);
  background:linear-gradient(90deg,transparent 40%,#ccadff2c 47%,var(--sweep-color,#fff6ce) 50%,#ffbdcf38 52%,transparent 57%);
  animation:sb-ribbon-pass .65s cubic-bezier(.22,.63,.43,.95) both;
}
.sb-temari-sweep.sb-encore { animation-direction:reverse; }
.sb-temari-strand {
  position:absolute; width:66%; height:2px; transform-origin:left; rotate:var(--heading);
  background:linear-gradient(90deg,transparent,var(--thread) 36%,#fff9dd 55%,transparent);
  box-shadow:0 2px 3px var(--thread); animation:sb-strand .62s ease-out both;
}
.sb-parade-trail { inset:0; background:linear-gradient(113deg,transparent 39%,#fff0 44%,var(--parade-ink) 50%,transparent 55%); opacity:.5; }
.sb-hanabi-crown {
  position:absolute; width:18%; aspect-ratio:1; translate:-50% -50%; border-radius:50%;
  background:repeating-conic-gradient(from 8deg,#ffdc80 0 3deg,transparent 4deg 23deg);
  mask-image:radial-gradient(circle, transparent 38%,#000 40% 61%,transparent 67%);
  animation:sb-crown .62s var(--offset) cubic-bezier(.21,.64,.38,1) both;
}
@keyframes sb-seal-expand { 0% {scale:.36;opacity:0} 20% {opacity:.95} 100% {scale:2.25;opacity:0} }
@keyframes sb-ribbon-pass { from {translate:-70% 24%;opacity:0} 23%,64% {opacity:.52} to {translate:70% -24%;opacity:0} }
@keyframes sb-strand { 0% {scale:.06 1;opacity:0} 23% {opacity:.9} 75% {scale:1.25 1} 100% {scale:1.32 .5;opacity:0} }
@keyframes sb-crown { from {scale:.1;opacity:0} 28% {opacity:.9} to {scale:1.9;opacity:0} }
.sb-gift-bag { flex:1 0 100%; text-align:center; color:#fff4da; }
.sb-gift-bag[hidden], .sb-gift-bag [hidden] { display:none; }
.sb-gift-bag>strong { display:block; margin:3px 0; text-shadow:0 1px 3px #3d153e; font-size:13px; }
.sb-bag-choices { display:flex; flex-wrap:wrap; justify-content:center; gap:4px; }
.sb-bag-choices button {
  position:relative; display:grid; place-items:center; width:43px; height:43px; padding:2px;
  border-radius:13px; border:1.5px solid #e7b780; background:linear-gradient(#673661,#361d45);
  box-shadow:inset 0 0 0 2px #9a65817d,0 2px 1px #2e1833; cursor:pointer;
}
.sb-bag-choices button[aria-pressed=true] { border-color:#fff2ad;box-shadow:0 0 7px 2px #ffcd86; }
.sb-bag-choices button:disabled { opacity:.68; }
.sb-bag-choices img { width:86%;height:86%;object-fit:contain; }
.sb-bag-choices [data-gift=column] img { rotate:90deg; }
.sb-bag-choices b { position:absolute;right:-1px;bottom:-1px;min-width:14px;padding:1px 3px;border-radius:8px;background:#fff1ce;color:#502e51;font-size:10px; }
.sb-gift-bag small { display:block; margin-top:3px; font-size:11px; }
.sakura-board[data-armed^="gift-"] .sb-cell[data-special=""][data-obstacle=""]::before { box-shadow:inset 0 0 0 1px #ffdfac86; }
@media(max-width:700px) {
  .sb-gift-bag>strong { font-size:10px; margin:0 0 2px; }
  .sb-bag-choices button { width:34px; height:34px; border-radius:10px; }
}
.sakura-board[data-motion="reduced"] *, .sakura-board[data-motion="reduced"] *::before { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .sakura-board *, .sakura-board *::before { animation: none !important; }
}

.sb-bag-choices button[data-placed=true]{border-color:#86b8aa;background:#3a504d}.sb-bag-choices button[data-placed=true]::after{content:"✓";position:absolute;top:-3px;left:-3px;width:15px;height:15px;border-radius:50%;background:#244f43;color:#ddffe3;border:1px solid #a6d3a4;font:900 11px/14px system-ui;text-align:center}.sb-bag-choices button[data-stock="0"][data-placed=false]{filter:saturate(.18);opacity:.45}

/* An unstacked cell leaves the one real, already-decoded charm free to travel
   over neighbouring cell backgrounds. Never lift an opaque cell with its art. */
.sakura-board .sb-cell,
.sakura-board .sb-cell:hover,
.sakura-board .sb-cell:active,
.sakura-board .sb-cell:focus-visible {
  translate: none; transform: none; filter: none; isolation: auto;
  z-index: auto; overflow: visible; -webkit-user-drag: none;
}
.sakura-board .sb-cell .sb-held { pointer-events: none; }
.sakura-board .sb-cell[data-special="row"]::after,
.sakura-board .sb-cell[data-special="column"]::after { display: none; }
.sakura-board {
  --board-dark: #433453;
  --board-light: #544264;
  background: radial-gradient(ellipse at 48% 42%,#1714288c,#161322ce);
}
.sakura-board .sb-cell:not(.sb-void) { border-radius: 9%; box-shadow: inset 0 0 0 1px #eed5fb1c; }
.sakura-board .sb-cell[data-obstacle="seal"] { box-shadow: inset 0 0 0 2px #e3bd84b9,inset 0 0 10px #f5bb7440; }
