/* Spell Caster: twilight meadow, Alanna the wizard on the left, creatures drifting in from the right.
   Creature containers are positioned by inline transforms, so effects animate .sp-body inside them. */
.game.spells { background: #2a1f5c; }
.spells .sp-scene { flex: 1; position: relative; min-height: 0; overflow: hidden; background: linear-gradient(#2a1f5c, #6b4bd8 55%, #ff9ccf 84%); }
.spells .sp-sky { position: absolute; inset: 0; pointer-events: none; }
.spells .sp-moon { position: absolute; top: 6%; right: 8%; font-size: 64px; filter: drop-shadow(0 0 18px #fff6a8); }
.spells .sp-castle { position: absolute; bottom: 15%; right: 18%; font-size: 120px; opacity: .45; filter: saturate(.5) brightness(.8); }
.spells .sp-stars { position: absolute; inset: 0 0 40% 0; background-image: radial-gradient(2px 2px at 12% 20%, #fff, transparent), radial-gradient(2px 2px at 30% 8%, #fff, transparent),
  radial-gradient(2px 2px at 48% 26%, #fff, transparent), radial-gradient(3px 3px at 64% 12%, #fff6a8, transparent), radial-gradient(2px 2px at 78% 30%, #fff, transparent),
  radial-gradient(2px 2px at 90% 18%, #fff, transparent), radial-gradient(2px 2px at 22% 40%, #fff, transparent); animation: sp-twinkle 3s ease-in-out infinite; }
.spells .sp-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 16%; background: linear-gradient(#7ac943, #4f9a2c); border-top: 4px solid var(--ink); display: flex; justify-content: space-around; align-items: flex-start; font-size: 34px; }
.spells .sp-ground span { margin-top: -26px; }

.spells .sp-wizard { position: absolute; left: 2%; bottom: 10%; width: 180px; z-index: 3; transform-origin: bottom left; }
.spells .sp-wizard-svg { width: 180px; height: 252px; display: block; }
.spells .sp-wizard.casting .sp-wizard-svg { animation: sp-cast .35s ease-out; }
.spells .wand-star { animation: sp-wand 1.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.spells .sp-slime { position: absolute; inset: 20% 10% 30% 10%; pointer-events: none; opacity: 0; }
.spells .sp-slime::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 40% 40%, #b6f36a, #5cc93b 60%, transparent 62%); filter: drop-shadow(0 2px 0 #3a7a1f); }
.spells .sp-slime i { position: absolute; top: 60%; width: 12px; height: 34px; border-radius: 0 0 8px 8px; background: #6fd34a; }
.spells .sp-slime i:nth-child(1) { left: 30%; } .spells .sp-slime i:nth-child(2) { left: 50%; height: 48px; } .spells .sp-slime i:nth-child(3) { left: 66%; }
.spells .sp-slime.on { animation: sp-goo 1.8s ease-out forwards; }

.spells .sp-creatures, .spells .sp-fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.spells .sp-fx { z-index: 5; }
.spells .sp-creature { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; will-change: transform; }
.spells .sp-scroll { background: #fff4d6; color: var(--ink); border: 3px solid var(--ink); border-radius: 10px; padding: 0 12px; font-size: calc(32px * var(--sp-s, 1)); font-weight: 800; letter-spacing: 2px; margin-bottom: 4px; box-shadow: 0 3px 0 rgba(0, 0, 0, .3); white-space: nowrap; }
.spells .sp-scroll span.done { color: #7a3ea8; }
.spells .sp-scroll span.now { color: var(--coral-dark); text-decoration: underline 4px var(--coral); text-underline-offset: 5px; }
.spells .sp-creature.targeted { z-index: 1; }
.spells .sp-creature.targeted .sp-scroll { background: #fff8b0; box-shadow: 0 0 0 4px var(--sun), 0 0 20px 4px rgba(255, 210, 63, .7); }
.spells .sp-creature.casted .sp-scroll { opacity: 0; transition: opacity .15s; }
.spells .sp-body { animation: sp-wobble 1.2s ease-in-out infinite; transform-origin: bottom center; }
.spells .sp-emoji { font-size: calc(76px * var(--sp-s, 1)); line-height: 1; display: block; }
.spells .c-bat .sp-body { animation: sp-flap .35s ease-in-out infinite; }
.spells .c-ghost .sp-emoji { opacity: .9; }

.spells .slime-blob { zoom: var(--sp-s, 1); position: relative; width: 84px; height: 66px; border-radius: 50% 50% 38% 38% / 70% 70% 30% 30%; background: radial-gradient(circle at 35% 30%, #d8ff9e, #7ad94a 55%, #4fae2c); border: 3px solid var(--ink); }
.spells .slime-blob .eye { position: absolute; top: 22px; width: 12px; height: 16px; border-radius: 50%; background: var(--ink); }
.spells .slime-blob .eye:nth-child(1) { left: 22px; } .spells .slime-blob .eye:nth-child(2) { right: 22px; }
.spells .slime-blob .mouth { position: absolute; left: 34px; top: 42px; width: 16px; height: 8px; border-bottom: 3px solid var(--ink); border-radius: 0 0 10px 10px; }

/* spell effects on the creature */
.spells .fx-fire .sp-body { animation: sp-burn .3s ease-in-out infinite; filter: sepia(1) saturate(5) hue-rotate(-20deg); }
.spells .fx-ice .sp-body { filter: hue-rotate(160deg) brightness(1.4) drop-shadow(0 0 10px #bdf0ff); animation: none; }
.spells .fx-zap .sp-body { animation: shake .2s 2; filter: brightness(1.8) drop-shadow(0 0 12px #ffd23f); }
.spells .fx-spin .sp-body { animation: sp-spin .3s linear infinite; }
.spells .fx-poof .sp-body { animation: sp-squish .26s ease-in-out; filter: hue-rotate(260deg); }
.spells .fx-sparkle .sp-body { filter: brightness(1.6) drop-shadow(0 0 14px #fff8b0); }
.spells .charmed .sp-body { animation: sp-charmed 1.3s ease-out forwards; }
.spells .splat-out .sp-body { animation: sp-splat .5s ease-in forwards; }
.spells .splat-out .sp-scroll { opacity: 0; }

.spells .sp-proj { position: absolute; left: 0; top: 0; font-size: 46px; filter: drop-shadow(0 0 10px #fff); }
.spells .sp-particle { position: absolute; font-size: 30px; transform: translate(-50%, -50%); animation: sp-burst .85s ease-out forwards; }
.spells .sp-bolt { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 10px #ffd23f); }
.spells .sp-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 6; }
.spells .sp-flash.on { animation: sp-flash .3s ease-out; }
.spells .sp-book { position: absolute; right: 12px; bottom: 12px; z-index: 3; background: rgba(255, 244, 214, .92); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 2px 14px; font-weight: 800; font-size: max(14px, calc(18px * var(--sp-s, 1))); max-width: 60%;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.spells .sp-scene.short .sp-book { -webkit-line-clamp: 1; line-clamp: 1; }
.spells .sp-banner { position: absolute; inset: 0; display: grid; place-items: center; font-size: 64px; font-weight: 800; color: #fff6a8; text-shadow: 0 5px 0 #7a3ea8, 0 9px 0 var(--ink); z-index: 7; pointer-events: none; animation: comicIn .6s cubic-bezier(.2, 1.6, .4, 1); }

@keyframes sp-twinkle { 0%, 100% { opacity: .6; } 50% { opacity: 1; } }
@keyframes sp-cast { 0% { transform: rotate(0); } 40% { transform: rotate(-6deg) translateX(-6px); } 100% { transform: rotate(0); } }
@keyframes sp-wand { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.2) rotate(20deg); } }
@keyframes sp-goo { 0% { opacity: 0; transform: scale(.3); } 15% { opacity: 1; transform: scale(1.1); } 70% { opacity: 1; transform: scale(1) translateY(10px); } 100% { opacity: 0; transform: translateY(40px); } }
@keyframes sp-wobble { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.06, .94); } }
@keyframes sp-flap { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.8) translateY(4px); } }
@keyframes sp-burn { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px) scale(1.05); } }
@keyframes sp-spin { to { transform: rotate(360deg); } }
@keyframes sp-squish { 50% { transform: scale(1.3, .6); } }
@keyframes sp-charmed { 0% { transform: scale(.3); } 30% { transform: scale(1.3); } 60% { transform: scale(1) translateY(-20px); opacity: 1; } 100% { transform: translateY(-110px); opacity: 0; } }
@keyframes sp-splat { 0% { transform: translateX(0); } 50% { transform: translateX(-30px) scale(1.2, .8); } 100% { transform: translateX(-40px) scale(1.6, .2); opacity: 0; } }
@keyframes sp-burst { from { transform: translate(-50%, -50%) scale(.4); opacity: 1; } to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.2); opacity: 0; } }
@keyframes sp-flash { 0% { opacity: .7; } 100% { opacity: 0; } }

@media (max-width: 640px) {
  .spells .sp-wizard { width: 120px; }
  .spells .sp-wizard-svg { width: 120px; height: 168px; }
  .spells .sp-emoji { font-size: 54px; }
  .spells .sp-scroll { font-size: 24px; }
  .spells .sp-book { display: none; }
}
