body[data-theme='slime'] {
  --slime-ink: #472568;
  --slime-violet: #694099;
  background: radial-gradient(ellipse at 50% 14%, #f3d4ff 0%, #dfb6fa 42%, #b88de6 100%);
  background-attachment: fixed;
}

[data-theme='slime'] .game-shell { width: min(100%, 1200px); }
[data-theme='slime'] .game-title { color: #fff4aa; }
[data-theme='slime'] .game-instruction {
  margin: 13px auto 11px;
  min-width: min(100%, 320px);
  padding: 6px 22px;
  border: 3px solid #543079;
  border-radius: 21px;
  background: linear-gradient(#9f70d5, #7543ae);
  color: white;
  text-shadow: 0 2px #4e226d;
  box-shadow: inset 0 2px 0 #ddadf9, 0 4px 0 #704195;
}
[data-theme='slime'] .game-status {
  min-height: 0;
  margin: 11px auto 0;
  padding: 4px 12px;
  border: 0;
  background: none;
  color: var(--slime-ink);
  font-size: 1rem;
}
.slime-symbols { position: absolute; pointer-events: none; }
.slime-steps {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: clamp(7px, 1.2vw, 15px);
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}
.slime-steps li {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border: 2px solid #b28bcf;
  border-radius: 14px;
  background: #f5e6ff;
  color: var(--slime-ink);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
}
.slime-steps svg { width: 23px; height: 23px; color: #a1e8ff; }
.slime-steps [aria-current='step'] {
  border-color: #66418e;
  background: #fff1a2;
  box-shadow: inset 0 2px 0 #fff8dc, 0 3px 0 #a075b5;
}
.slime-steps .slime-step-done { background: #dcfae8; }

.slime-bench {
  display: grid;
  grid-template-columns: clamp(98px, 13vw, 154px) minmax(0, 1fr) clamp(98px, 13vw, 154px);
  align-items: center;
  justify-items: center;
  gap: clamp(9px, 1.6vw, 18px);
  padding: clamp(9px, 1.9vw, 21px);
  border: 3px solid #60398b;
  border-radius: 32px;
  background:
    radial-gradient(ellipse 54% 25% at 50% 37%, #f7b8f5, transparent),
    linear-gradient(180deg, transparent 67%, #aa91ea 67%),
    linear-gradient(110deg, #8c72e4, #aa86eb 51%, #8265d7);
  box-shadow: inset 0 3px 0 #d7bcff, 0 7px 0 #8559af, 0 14px 26px #5c358a32;
  isolation: isolate;
}
.slime-stage {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  aspect-ratio: 720 / 420;
  user-select: none;
}
.slime-art { display: block; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.slime-bench[data-step='1'] {
  grid-template-columns: minmax(0, 720px) clamp(159px, 23vw, 252px);
  justify-content: center;
}
.slime-bench[data-step='1'] .slime-stage { grid-column: 1; }
.slime-bench:is([data-step='2'], [data-step='3']) { grid-template-columns: minmax(0, 740px); justify-content: center; }
.slime-bench:is([data-step='2'], [data-step='3']) .slime-stage { grid-column: 1; }

.slime-bin {
  position: relative;
  display: grid;
  grid-row: 1;
  gap: 7px;
  width: 100%;
  padding: clamp(6px, .9vw, 11px);
  border: 3px solid #653b87;
  border-radius: 21px;
  background: linear-gradient(#efd2ff, #c79ce9);
  box-shadow: inset 0 2px 0 #fff3ff, 0 5px 0 #7851a0;
}
.slime-bin:has(.slime-dragging) { z-index: 4; }
.slime-bin-first { grid-column: 1; }
.slime-bin-second { grid-column: 3; }
.slime-bin-decor { grid-column: 2; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.slime-tool {
  --toy: #ffdba9;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0;
  min-width: 48px;
  padding: 3px 2px 2px;
  border: 2px solid #9662bd;
  border-radius: 14px;
  background: linear-gradient(#fff8ff, #eddaff);
  box-shadow: inset 0 2px 0 #fff, 0 3px 0 #af84c6;
  font-weight: 800;
  font-size: clamp(.88rem, 1.5vw, 1.135rem);
  line-height: 1.12;
  touch-action: none;
  user-select: none;
}
.slime-tool svg { flex: none; width: clamp(34px, 5vw, 63px); height: clamp(34px, 5vw, 63px); color: var(--toy); }
.slime-tool svg, .slime-tool span { pointer-events: none; }
.slime-tool[aria-pressed='true'] {
  border-color: #653b87;
  background: linear-gradient(#fff4be, #ffdc87);
  box-shadow: inset 0 2px 0 #fff, 0 3px 0 #9b61b3;
}
.slime-tool:not(.slime-dragging):active { transform: scale(.96); }
.slime-dragging { cursor: grabbing; }

.slime-bowl, .slime-final { transition: opacity .24s ease; }
.slime-final { opacity: 0; }
[data-step='3'] .slime-bowl { opacity: 0; }
[data-step='3'] .slime-final { opacity: 1; }
.slime-pool { opacity: var(--slime-fill, 0); }
.slime-liquid {
  transform-origin: 360px 221px;
  transform: translateY(calc((1 - var(--slime-fill, 0)) * 34px)) scaleY(calc(.2 + var(--slime-fill, 0) * .8));
}
[data-base='empty'] .slime-pool { opacity: 0; }
[data-base='clear'] .slime-liquid { opacity: .54; }
[data-base='bright'] .slime-liquid { filter: saturate(1.28); }
.slime-base-glitter { opacity: 0; }
[data-base='bright'] .slime-base-glitter { opacity: .85; }
.slime-swirl { opacity: 0; stroke-dasharray: 107 13; }
[data-step='2'] .slime-swirl { opacity: var(--swirl-strength, .8); }
.slime-veins { opacity: var(--vein-strength, 0); stroke-dasharray: 170 14; }
.slime-pour { opacity: 0; transition: opacity .15s ease-out; }
.slime-pour-bottle { color: var(--pour-color); }
.slime-pouring .slime-pour { opacity: 1; }

.slime-spatula { opacity: 0; }
[data-step='2'] .slime-spatula { opacity: 1; }
.slime-guide {
  position: absolute;
  z-index: 3;
  top: 56%;
  left: 66%;
  width: clamp(31px, 5.2vw, 69px);
  transform: rotate(-25deg);
  animation: slime-point 1.25s 4 ease-in-out;
  pointer-events: none;
  filter: drop-shadow(0 4px 1px #59408066);
}
.slime-guide svg { width: 100%; display: block; }
[data-step='0'] .slime-guide { top: 6%; left: 5%; transform: rotate(-49deg); }
[data-step='1'] .slime-guide { top: 49%; left: 66%; }
[data-step='3'] .slime-guide { top: 56%; left: 25%; }
.slime-gesture {
  position: absolute;
  top: 35%;
  left: 23%;
  width: 54%;
  height: 35%;
  padding: 0;
  border: 0;
  border-radius: 43%;
  background: none;
  touch-action: none;
  cursor: grab;
}
[data-step='3'] .slime-gesture { top: 32%; left: 13%; width: 74%; height: 55%; }
[data-step='0'] .slime-gesture:not([aria-disabled='true']), [data-step='1'] .slime-gesture:not([aria-disabled='true']) { cursor: crosshair; }
body[data-theme='slime'] button.slime-gesture:active { transform: none; cursor: grabbing; }
.slime-bubble {
  position: absolute;
  z-index: 2;
  width: clamp(48px, 6.4vw, 66px);
  height: clamp(48px, 6.4vw, 66px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
}
body[data-theme='slime'] .slime-bubble:active { transform: translate(-50%, -50%) scale(.90); }
/* A bubble moving under the second finger must not interrupt a pinch. */
.slime-handling .slime-bubble { pointer-events: none; }
.slime-bubble::before {
  position: absolute;
  content: '';
  inset: 12%;
  border: 1px solid #e6fcff;
  border-radius: inherit;
  background:
    radial-gradient(circle at 29% 23%, #fff 3%, #ffffff26 22%, transparent 45%),
    radial-gradient(ellipse at 77% 78%, #ffc5e7ba, #b4e7ff32 60%, #ffbdedbb);
  box-shadow: inset 0 0 4px #effcff, 0 2px 5px #644ec267;
  pointer-events: none;
  scale: var(--bubble-growth, 0);
}
.slime-keys { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.slime-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 13px;
  margin: 13px auto 0;
}
.slime-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 15px;
  border: 3px solid #633b88;
  border-radius: 25px;
  background: linear-gradient(#ffe8f8, #f6adf1);
  box-shadow: inset 0 2px 0 #fff6fb, 0 4px 0 #9c66b2;
  font-size: clamp(1rem, 2.3vw, 1.24rem);
  font-weight: 800;
}
.slime-actions .slime-back { padding-inline: 9px; font-size: 1.5rem; }
.slime-actions .slime-next {
  border-color: #4c6b29;
  background: linear-gradient(#e2ff9c, #82d550);
  box-shadow: inset 0 2px 0 #f6ffcd, 0 4px 0 #608145;
  color: #264618;
}
.slime-actions .slime-next:disabled { color: #3e5b30; box-shadow: none; }
.slime-actions svg { width: 30px; height: 30px; }
.slime-progress { width: clamp(75px, 17vw, 161px); height: 21px; accent-color: #7442a5; }

@keyframes slime-point {
  0%, 100% { translate: 0 0; }
  55% { translate: -7px 7px; }
}

@media (min-width: 900px) and (max-height: 830px) {
  [data-theme='slime'] .game-shell { width: min(100%, 1050px); }
  [data-theme='slime'] .game-title { font-size: clamp(2.4rem, 5vw, 3.65rem); }
  .slime-bench:is([data-step='2'], [data-step='3']) { grid-template-columns: minmax(0, 650px); }
}

@media (max-width: 670px) {
  .slime-bench, .slime-bench[data-step='1'] {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 8px;
    border-radius: 23px;
    background:
      radial-gradient(ellipse 83% 34% at 50% 23%, #edb8f4, transparent),
      linear-gradient(180deg, #9075df 0%, #a38bea 60%, #b9a1ed 60%);
  }
  .slime-stage { grid-column: 1; }
  .slime-bin { grid-column: 1; grid-row: auto; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .slime-bin-decor { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .slime-bin { padding: 5px; gap: 5px; border-radius: 15px; }
  .slime-tool { border-radius: 9px; }
  [data-step='0'] .slime-guide { top: auto; bottom: -3%; left: 17%; transform: rotate(164deg); }
  [data-step='1'] .slime-guide { left: 66%; top: 46%; }
  .slime-actions { gap: 7px; }
  .slime-actions button { padding-inline: 8px; }
}

@media (max-width: 390px) {
  .slime-steps { gap: 5px; }
  .slime-steps li { padding-inline: 5px; font-size: .83rem; }
  .slime-steps svg { width: 19px; height: 19px; }
  .slime-bin-decor { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 350px) {
  .slime-steps li { gap: 1px; padding-inline: 3px; }
  .slime-steps svg { width: 15px; height: 16px; }
  .slime-tool { font-size: .78rem; }
}

[data-theme='slime'][data-reduced-motion='true'] .slime-guide { animation: none; }
[data-theme='slime'][data-reduced-motion='true'] :is(.slime-bowl, .slime-final) { transition: none; }

.slime-material, .slime-foreground { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.slime-material { touch-action: none; }
.slime-bench:not([data-step='3']) #slime-final-additions { display: none; }
