/* ============ Themes ============ */
body {
  --bg: #f7efe3; --bg2: #efe1cb; --panel: #fffaf2; --ink: #3b2a1a; --accent: #e07a2f;
  --light: #f0d9b5; --dark: #b58863; --frame: #6b4423;
  --sel: rgba(255, 221, 0, .55); --last: rgba(155, 199, 0, .45);
  --wfill: #ffffff; --wstroke: #3b2a1a; --bfill: #2b2b2b; --bstroke: #f5f5f5;
  --font-piece: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", "Apple Symbols", serif;
}
body.theme-ocean {
  --bg: #e3f4fb; --bg2: #c9e8f5; --panel: #f6fcff; --ink: #0d3b52; --accent: #0a8fc4;
  --light: #d6eef8; --dark: #4f9fc7; --frame: #0d5c80; --wfill: #fff; --wstroke: #0d3b52;
  --bfill: #0a2a3d; --bstroke: #d6eef8; --last: rgba(255, 200, 80, .5);
}
body.theme-candy {
  --bg: #fff0f7; --bg2: #ffd9ec; --panel: #fffafd; --ink: #6a1b4d; --accent: #ff4fa0;
  --light: #fff3fa; --dark: #ff9ccf; --frame: #c2187a; --wfill: #fff; --wstroke: #c2187a;
  --bfill: #7b2fbe; --bstroke: #fff; --last: rgba(120, 220, 200, .55); --sel: rgba(255, 240, 120, .7);
}
body.theme-space {
  --bg: #12112b; --bg2: #1d1b45; --panel: #23214f; --ink: #ecebff; --accent: #8c7dff;
  --light: #6f68c9; --dark: #2f2a78; --frame: #0b0a1f; --wfill: #fff7c2; --wstroke: #2a2560;
  --bfill: #ff6b9b; --bstroke: #2a0a1a; --last: rgba(0, 255, 200, .35); --sel: rgba(255, 255, 255, .35);
}
body.theme-zoo {
  --bg: #fff8d6; --bg2: #ffe98a; --panel: #fffdf0; --ink: #3d4a14; --accent: #ff8a00;
  --light: #c5e86c; --dark: #8cc152; --frame: #8b5a2b; --last: rgba(255, 140, 0, .45); --sel: rgba(255, 255, 255, .55);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Comic Sans MS", "Chalkboard SE", "Comic Neue", "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(circle at 20% 10%, var(--bg2), var(--bg) 60%);
  color: var(--ink);
  transition: background .4s, color .4s;
  overflow-x: hidden;
}
body.theme-space {
  background:
    radial-gradient(2px 2px at 10% 20%, #fff, transparent), radial-gradient(1px 1px at 30% 70%, #fff, transparent),
    radial-gradient(2px 2px at 80% 30%, #fff, transparent), radial-gradient(1px 1px at 60% 90%, #fff, transparent),
    radial-gradient(1px 1px at 90% 60%, #fff, transparent), radial-gradient(circle at 50% 0%, #2d2a6e, #12112b 70%);
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ============ Lobby ============ */
.screen { min-height: 100vh; }
#lobby { display: grid; place-items: center; padding: 20px; }
.lobby-card {
  background: var(--panel); border-radius: 28px; padding: 28px 32px; width: min(520px, 100%);
  box-shadow: 0 12px 0 var(--bg2), 0 20px 40px rgba(0,0,0,.15); text-align: center;
}
.lobby-card h1 { margin: 0 0 4px; font-size: 2.4rem; color: var(--accent); }
.tagline { margin: 0 0 18px; }
.field { display: block; text-align: left; margin: 14px 0; }
.field > span { display: block; font-weight: bold; margin-bottom: 6px; font-size: 1.1rem; }
.field small { font-weight: normal; opacity: .7; }
.field input {
  width: 100%; font: inherit; font-size: 1.3rem; padding: 10px 14px; border-radius: 14px;
  border: 3px solid var(--bg2); background: #fff; color: #222; outline: none;
}
.field input:focus { border-color: var(--accent); }
.avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.avatar-picker button {
  font-size: 2rem; width: 56px; height: 56px; border-radius: 16px; border: 3px solid transparent;
  background: var(--bg2); transition: transform .15s;
}
.avatar-picker button:hover { transform: scale(1.1) rotate(-6deg); }
.avatar-picker button.picked { border-color: var(--accent); background: #fff; transform: scale(1.12); }
.big-btn {
  font-size: 1.4rem; padding: 12px 28px; border-radius: 18px; border: none; color: #fff; background: var(--accent);
  box-shadow: 0 6px 0 rgba(0,0,0,.25); margin-top: 8px; transition: transform .1s, box-shadow .1s;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.big-btn.secondary { background: #9e9e9e; }
.error { color: #d32f2f; font-weight: bold; min-height: 1.2em; }

/* ============ Game layout ============ */
#game { display: grid; grid-template-columns: auto 360px; gap: 20px; padding: 16px; justify-content: center; align-items: start; }
@media (max-width: 1000px) { #game { grid-template-columns: 1fr; justify-items: center; } .side { width: min(560px, 100%); } }

.board-area { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.status {
  font-size: 1.5rem; font-weight: bold; background: var(--panel); padding: 10px 22px; border-radius: 18px;
  box-shadow: 0 4px 0 var(--bg2); text-align: center; min-width: 60%;
}
.status.check { background: #ffdddd; color: #b00020; animation: shake .5s; }
.status.win { background: #fff3b0; color: #7a5a00; }
.offer-bar {
  display: flex; gap: 10px; align-items: center; background: #fff3b0; color: #5a4300; padding: 8px 16px;
  border-radius: 14px; font-size: 1.15rem; font-weight: bold;
}
.offer-bar button { font: inherit; font-size: 1rem; border: none; border-radius: 10px; padding: 6px 14px; color: #fff; background: #43a047; }
.offer-bar button.no { background: #e53935; }

/* ============ Board ============ */
.board-wrap { position: relative; }
.board {
  --size: min(80vh, calc(100vw - 420px), 720px);
  width: var(--size); height: var(--size); display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr);
  border: 10px solid var(--frame); border-radius: 12px; overflow: hidden; touch-action: none; user-select: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
@media (max-width: 1000px) { .board { --size: min(94vw, 70vh); } }
.sq { position: relative; display: grid; place-items: center; }
.sq.light { background: var(--light); }
.sq.dark { background: var(--dark); }
.sq.last::before, .sq.sel::before { content: ""; position: absolute; inset: 0; }
.sq.last::before { background: var(--last); }
.sq.sel::before { background: var(--sel); }
.sq .coord { position: absolute; font-size: calc(var(--size) / 55); font-weight: bold; opacity: .65; pointer-events: none; font-family: system-ui, sans-serif; }
.sq .coord.file { right: 4%; bottom: 2%; }
.sq .coord.rank { left: 4%; top: 2%; }
.sq.light .coord { color: var(--dark); }
.sq.dark .coord { color: var(--light); }
.sq .hint {
  position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(0,0,0,.22); pointer-events: none; z-index: 2;
  animation: pop .2s;
}
.sq .hint.capture { width: 88%; height: 88%; background: transparent; border: calc(var(--size) / 110) solid rgba(220, 0, 0, .45); }
.sq.danger .piece { animation: danger 1s infinite; }
.board .sq.check-sq { background: radial-gradient(circle, #ff3b3b 0%, #ff7b7b 40%, transparent 75%), var(--light); }

.piece {
  position: relative; z-index: 3; width: 88%; height: 88%; line-height: 1; cursor: grab;
  display: grid; place-items: center; transition: transform .12s;
}
.piece svg { width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 1.5px rgba(0,0,0,.4)); }
.piece svg * { stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.piece.w svg { fill: var(--wfill); stroke: var(--wstroke); }
.piece.b svg { fill: var(--bfill); stroke: var(--bstroke); }
.piece.w svg .d, .piece.w svg .e { stroke: var(--wstroke); fill: var(--wstroke); }
.piece.b svg .d, .piece.b svg .e { stroke: var(--bstroke); fill: var(--bstroke); }
.piece.mine:hover { transform: scale(1.1); }
.piece.dragging { opacity: .25; }
.ghost { position: fixed; pointer-events: none; z-index: 1000; transform: translate(-50%, -50%) scale(1.2); }

/* --- Silly Zoo pieces: emoji animals in team bubbles --- */
body.theme-zoo .sq.light { background: linear-gradient(135deg, #d4f07e, var(--light)); }
body.theme-zoo .sq.dark { background: linear-gradient(135deg, #9bd060, var(--dark)); }
body.theme-zoo .piece {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: calc(var(--size) / 14);
  width: 84%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%;
  -webkit-text-stroke: 0; text-shadow: none; animation: wobble 2.4s ease-in-out infinite;
  animation-delay: var(--wd, 0s);
}
body.theme-zoo .piece.w { background: radial-gradient(circle at 35% 30%, #fffde8, #ffd54f); border: 4px solid #f9a825; box-shadow: 0 4px 0 #c17900; }
body.theme-zoo .piece.b { background: radial-gradient(circle at 35% 30%, #e6d4ff, #9c6ade); border: 4px solid #6a3fb5; box-shadow: 0 4px 0 #43237a; }
body.theme-zoo .piece { height: auto; }
body.theme-zoo .sq.danger .piece { animation: danger 1s infinite, wobble 2.4s infinite; }
body.theme-zoo .piece.landed { animation: squash .45s; }

.funny-text {
  position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%) scale(0); pointer-events: none; z-index: 50;
  font-size: calc(min(80vh, 720px) / 8); font-weight: 900; color: #ff3d00; -webkit-text-stroke: 3px #fff;
  text-shadow: 0 6px 0 rgba(0,0,0,.2); white-space: nowrap;
}
.funny-text.show { animation: funny 1.2s ease-out; }
.flyaway { position: fixed; z-index: 900; pointer-events: none; animation: flyaway 1s ease-in forwards; }

.board-tools { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.theme-picker { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.theme-picker button {
  border: 3px solid transparent; border-radius: 14px; padding: 6px 12px; font-size: 1rem; background: var(--panel); color: var(--ink);
  box-shadow: 0 3px 0 var(--bg2); display: flex; align-items: center; gap: 6px;
}
.theme-picker button .sw { width: 22px; height: 22px; border-radius: 6px; display: inline-block; }
.theme-picker button.on { border-color: var(--accent); transform: translateY(-2px); }

/* ============ Side panel ============ */
.side { display: flex; flex-direction: column; gap: 12px; }
.player-card { background: var(--panel); border-radius: 20px; padding: 10px; box-shadow: 0 4px 0 var(--bg2); }
.video-box { position: relative; aspect-ratio: 16 / 11; background: #222; border-radius: 14px; overflow: hidden; }
.video-box.small { aspect-ratio: 16 / 8; }
.video-box video { width: 100%; height: 100%; object-fit: cover; display: block; }
#localVideo { transform: scaleX(-1); }
.video-placeholder {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: #fff;
  background: linear-gradient(135deg, #5c6bc0, #ab47bc);
}
.ph-avatar { font-size: 4rem; animation: bob 2s ease-in-out infinite; }
.video-box.small .ph-avatar { font-size: 2.5rem; }
.ph-text { font-size: 1rem; opacity: .9; }
.player-line { display: flex; align-items: center; gap: 8px; padding: 8px 4px 0; font-size: 1.15rem; flex-wrap: wrap; }
.pname { font-weight: bold; }
.pcolor { font-size: .9rem; opacity: .8; }
.caught { margin-left: auto; display: flex; flex-wrap: wrap; max-width: 60%; justify-content: flex-end; }
.caught .piece { width: 20px; height: 20px; margin-left: -4px; cursor: default; animation: none !important; }
body.theme-zoo .caught .piece { font-size: 12px; width: 22px; height: 22px; border-width: 2px; box-shadow: none; margin-left: -2px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: #bbb; }
.dot.on { background: #43a047; box-shadow: 0 0 6px #43a047; }
.player-card.turn { outline: 4px solid var(--accent); animation: glow 1.5s infinite; }

.emoji-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.float-emoji { position: absolute; bottom: 0; font-size: 3rem; animation: floatUp 2.2s ease-out forwards; }

.scoreboard { background: var(--panel); border-radius: 20px; padding: 10px 14px; box-shadow: 0 4px 0 var(--bg2); text-align: center; }
.score-title { font-weight: bold; font-size: 1.1rem; }
.score-row { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 1.2rem; }
.score-num { font-size: 2.4rem; font-weight: 900; color: var(--accent); min-width: 1.2em; }
.score-num.bump { animation: bump .6s; }
.score-draws { font-size: .95rem; opacity: .8; }
.recent { text-align: left; font-size: .9rem; margin-top: 6px; }
.recent summary { cursor: pointer; opacity: .8; }
.recent ol { padding-left: 20px; margin: 6px 0; }

.emoji-bar { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.emoji-bar button { font-size: 1.4rem; border: none; background: var(--panel); border-radius: 12px; width: 36px; height: 40px; padding: 0; box-shadow: 0 3px 0 var(--bg2); transition: transform .1s; }
.emoji-bar button:hover { transform: scale(1.15) rotate(8deg); }
.emoji-bar button:active { transform: scale(.9); }

.controls { display: flex; gap: 5px; flex-wrap: wrap; justify-content: center; }
.ctl { font-size: 1.3rem; width: 45px; height: 45px; border-radius: 16px; border: none; background: var(--panel); box-shadow: 0 4px 0 var(--bg2); }
.ctl.wide { width: auto; padding: 0 16px; font-size: 1.2rem; background: #43a047; color: #fff; animation: glow 1.5s infinite; }
.ctl.off { background: #ffcdd2; position: relative; }
.ctl.off::after { content: ""; position: absolute; left: 12%; right: 12%; top: 50%; height: 4px; background: #d32f2f; transform: rotate(-35deg); border-radius: 2px; }
.ctl.active { background: #c8e6c9; }
.ctl:disabled { opacity: .35; cursor: default; }
.small-links { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.link-btn { border: none; background: transparent; color: var(--ink); opacity: .75; font-size: .95rem; text-decoration: underline; }

/* ============ Modals / toast / confetti ============ */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 2000; }
.modal-card { background: var(--panel); color: var(--ink); padding: 24px 30px; border-radius: 24px; text-align: center; animation: pop .25s; }
.modal-buttons { display: flex; gap: 14px; justify-content: center; }
.promo-choices { display: flex; gap: 12px; justify-content: center; }
.promo-choices button { width: 90px; height: 100px; border-radius: 18px; border: 3px solid var(--bg2); background: #fff; display: grid; place-items: center; font-size: .9rem; color: #333; }
.promo-choices button .piece { width: 60px; height: 60px; cursor: pointer; }
body.theme-zoo .promo-choices button .piece { font-size: 2rem; height: 60px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(calc(100% + 40px)); background: #333; color: #fff;
  padding: 12px 22px; border-radius: 16px; font-size: 1.1rem; transition: transform .3s; z-index: 3000; max-width: 90vw; text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 2500; width: 100vw; height: 100vh; }

/* ============ Animations ============ */
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
@keyframes danger { 0%, 100% { filter: drop-shadow(0 0 0 red); } 50% { filter: drop-shadow(0 0 8px red) drop-shadow(0 0 4px red); } }
@keyframes wobble { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) translateY(-3%); } }
@keyframes squash { 0% { transform: scale(1.4, .6); } 40% { transform: scale(.8, 1.3); } 70% { transform: scale(1.1, .9); } 100% { transform: scale(1); } }
@keyframes funny { 0% { transform: translate(-50%, -50%) scale(0) rotate(-20deg); opacity: 1; } 30% { transform: translate(-50%, -50%) scale(1.2) rotate(8deg); } 70% { transform: translate(-50%, -50%) scale(1) rotate(-4deg); opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1); opacity: 0; } }
@keyframes flyaway { to { transform: translate(var(--fx), -120vh) rotate(1080deg) scale(.4); opacity: 0; } }
@keyframes floatUp { 0% { transform: translateY(0) scale(.5); opacity: 0; } 15% { opacity: 1; transform: translateY(-20%) scale(1.2); } 100% { transform: translateY(-400%) scale(1); opacity: 0; } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 rgba(0,0,0,0); } 50% { box-shadow: 0 0 18px var(--accent); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.8) rotate(-10deg); } 100% { transform: scale(1); } }

/* ============ 3D Castle theme: tilted board, standing pieces ============ */
body.theme-3d {
  --bg: #e9dcc6; --bg2: #d8c3a0; --panel: #fffaf0; --ink: #3a2412; --accent: #b5651d;
  --light: #f3e3c3; --dark: #8b4a2b; --frame: #5a2e14; --wfill: #fffdf5; --wstroke: #6b4a2a;
  --bfill: #2a1d14; --bstroke: #e8c66a; --last: rgba(255, 200, 60, .5);
}
body.theme-3d .board-wrap { perspective: 1200px; perspective-origin: 50% 0%; }
body.theme-3d .board {
  --size: min(66vh, calc(100vw - 500px), 600px); transform: rotateX(30deg); transform-origin: 50% 100%; transform-style: preserve-3d; overflow: visible; margin: 0 0 22px;
  box-shadow: 0 16px 0 #3d1d0b, 0 40px 50px rgba(0,0,0,.45);
}
body.theme-3d .sq { transform-style: preserve-3d; }
body.theme-3d .sq.light { background: linear-gradient(135deg, #fff4dc, var(--light)); }
body.theme-3d .sq.dark { background: linear-gradient(135deg, #a35d39, var(--dark)); }
body.theme-3d .piece { transform: rotateX(-30deg) scale(1.15); transform-origin: 50% 88%; }
body.theme-3d .piece.mine:hover { transform: rotateX(-30deg) scale(1.28); }
body.theme-3d .piece svg { filter: drop-shadow(2px 4px 2px rgba(0,0,0,.45)); }
body.theme-3d .sq:has(.piece)::after {
  content: ""; position: absolute; left: 22%; right: 22%; bottom: 10%; height: 18%; border-radius: 50%;
  background: radial-gradient(rgba(0,0,0,.45), transparent 70%); pointer-events: none;
}
body.theme-3d .caught .piece, body.theme-3d .promo-choices .piece { transform: none; }
body .piece.ghost { transform: translate(-50%, -50%) scale(1.2) !important; }

/* ============ Wizard School theme: night castle, house colours, levitating pieces ============ */
body.theme-wizard {
  --bg: #120c24; --bg2: #2a1b4a; --panel: #fbf3dc; --ink: #3a1d10; --accent: #b8860b;
  --light: #f1e2b8; --dark: #7a1f2b; --frame: #3b2414; --last: rgba(255, 215, 64, .5); --sel: rgba(255, 255, 210, .6);
  font-family: "Georgia", "Palatino Linotype", "Book Antiqua", serif;
  background:
    radial-gradient(2px 2px at 8% 15%, #fff8, transparent), radial-gradient(1.5px 1.5px at 25% 60%, #fff8, transparent),
    radial-gradient(2px 2px at 75% 25%, #fff8, transparent), radial-gradient(1.5px 1.5px at 55% 85%, #fff8, transparent),
    radial-gradient(1.5px 1.5px at 92% 70%, #fff8, transparent), radial-gradient(2px 2px at 40% 10%, #fff8, transparent),
    radial-gradient(circle at 50% -10%, #3d2a73, #120c24 70%);
  background-attachment: fixed;
}
/* floating candles */
body.theme-wizard::before, body.theme-wizard::after {
  content: "🕯️    🕯️        🕯️      🕯️          🕯️     🕯️"; position: fixed; left: 0; right: 0; top: 6px; white-space: pre;
  text-align: center; font-size: 26px; opacity: .55; pointer-events: none; z-index: 0; animation: candles 5s ease-in-out infinite;
  text-shadow: 0 -6px 14px #ffcc66;
}
body.theme-wizard::after { content: "    🕯️        🕯️     🕯️          🕯️       🕯️   "; top: 46px; font-size: 20px; opacity: .4; animation-delay: -2.5s; }
body.theme-wizard .screen { position: relative; z-index: 1; }
body.theme-wizard .lobby-card { border: 3px solid #c9a227; box-shadow: 0 0 0 6px #3b2414, 0 20px 50px rgba(0,0,0,.6); }
body.theme-wizard .lobby-card h1 { color: #7a1f2b; text-shadow: 0 2px 0 #e8c66a; }
body.theme-wizard .big-btn { background: linear-gradient(#a32638, #7a1f2b); border: 2px solid #e8c66a; }
body.theme-wizard .status { border: 2px solid #c9a227; box-shadow: 0 4px 0 #3b2414; }
body.theme-wizard .player-card, body.theme-wizard .scoreboard { border: 2px solid #c9a227; box-shadow: 0 4px 0 #3b2414; }
body.theme-wizard .link-btn { color: #f1e2b8; }
body.theme-wizard .theme-picker button { box-shadow: 0 3px 0 #3b2414; }
body.theme-wizard .board {
  border: 12px solid var(--frame); outline: 3px solid #c9a227; outline-offset: -6px;
  box-shadow: 0 0 40px rgba(201, 162, 39, .35), 0 14px 40px rgba(0,0,0,.6);
}
body.theme-wizard .sq.light { background: radial-gradient(circle at 30% 30%, #fff5d6, var(--light)); }
body.theme-wizard .sq.dark { background: radial-gradient(circle at 30% 30%, #9c2b3a, var(--dark)); }
body.theme-wizard .video-placeholder { background: linear-gradient(135deg, #3d2a73, #7a1f2b); }
body.theme-wizard .toast { background: #2a1b4a; border: 2px solid #c9a227; }
body.theme-wizard .funny-text { color: #ffd54f; -webkit-text-stroke: 3px #4a148c; font-size: calc(min(80vh, 720px) / 12); text-shadow: 0 0 24px #fff59d; }

/* emoji pieces in house bubbles: Lions (scarlet & gold) vs Serpents (green & silver) */
body.theme-wizard .piece {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; font-size: calc(var(--size) / 15);
  width: 84%; height: auto; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%;
  animation: hover 3s ease-in-out infinite; animation-delay: var(--wd, 0s);
}
body.theme-wizard .piece.w { background: radial-gradient(circle at 35% 30%, #ffe082, #c62828 75%); border: 4px solid #ffc107; box-shadow: 0 6px 6px rgba(0,0,0,.35), 0 0 10px rgba(255, 193, 7, .5); }
body.theme-wizard .piece.b { background: radial-gradient(circle at 35% 30%, #e0e0e0, #1b5e20 75%); border: 4px solid #cfd8dc; box-shadow: 0 6px 6px rgba(0,0,0,.35), 0 0 10px rgba(207, 216, 220, .5); }
body.theme-wizard .sq.danger .piece { animation: danger 1s infinite, hover 3s infinite; }
body.theme-wizard .caught .piece { font-size: 12px; width: 22px; height: 22px; border-width: 2px; box-shadow: none; margin-left: -2px; }
body.theme-wizard .promo-choices button .piece { font-size: 2rem; height: 60px; }
.sparkle { position: absolute; z-index: 4; font-size: calc(var(--size) / 12); pointer-events: none; animation: sparkle .9s ease-out forwards; }

@keyframes hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5%); } }
@keyframes candles { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@keyframes sparkle { 0% { transform: scale(.2) rotate(0); opacity: 1; } 100% { transform: scale(1.8) rotate(90deg); opacity: 0; } }
@keyframes levitate { 0% { transform: translateY(0) rotate(0); } 30% { transform: translateY(-40px) rotate(-15deg); } 100% { transform: translateY(-110vh) rotate(25deg) scale(.5); opacity: 0; } }
