.alchemy-card {
  border-color: #bdddd5;
  background: linear-gradient(145deg, #fff, #effbf7);
}
.alchemy-card .activity-icon {
  background: linear-gradient(145deg, #28a88f, #3d5fc7);
  box-shadow-color: #237d75;
  font-size: 38px;
}
.alchemy-card .activity-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: inherit;
}
.alchemy-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 2px solid #75d5c2;
  border-radius: 999px;
  background: #e9fbf6;
  color: #176e60;
  font-size: 20px;
  font-weight: 1000;
}
.playground:has(.alchemy-game) {
  display: block;
  min-height: 650px;
  padding: 14px;
  overflow: visible;
  background:
    radial-gradient(circle at 52% 28%, rgba(117, 213, 194, .28), transparent 28%),
    linear-gradient(180deg, #f4f8ff, #edf8f3);
}
.alchemy-game {
  display: grid;
  grid-template-columns: minmax(250px, .9fr) minmax(280px, 1fr) minmax(250px, .9fr);
  gap: 14px;
  text-align: left;
}
.element-inventory,
.crucible-panel,
.comment-book {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(39, 50, 72, .11);
  border-radius: 12px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 10px 24px rgba(39, 50, 72, .08);
}
.alchemy-step {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: #4f6470;
  font-size: 13px;
  font-weight: 1000;
}
.alchemy-step b {
  width: 26px;
  height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: #218b79;
}
.alchemy-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.alchemy-tabs button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #cbd9d8;
  border-radius: 8px;
  color: #536078;
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}
.alchemy-tabs button.active {
  color: white;
  border-color: #218b79;
  background: linear-gradient(135deg, #218b79, #3d5fc7);
}
.element-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.element-chip {
  min-height: 82px;
  padding: 7px 4px 6px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
  border: 1px solid #d7e4e1;
  border-radius: 10px;
  color: #273248;
  background: #fffefa;
  box-shadow: 0 4px 0 rgba(33, 139, 121, .12);
  user-select: none;
}
.element-chip:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(33, 139, 121, .12);
}
.element-art {
  width: 56px;
  height: 56px;
  display: block;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, .5);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.72);
}
.element-chip small {
  color: #687086;
  font-size: 10px;
  font-weight: 900;
}
.crucible-panel {
  text-align: center;
}
.crucible-drop {
  position: relative;
  min-height: 310px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px dashed rgba(33, 139, 121, .36);
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 45%, rgba(255,255,255,.9), transparent 18%),
    radial-gradient(circle at 22% 20%, rgba(167, 229, 255, .74), transparent 24%),
    radial-gradient(circle at 78% 18%, rgba(196, 246, 255, .68), transparent 22%),
    linear-gradient(180deg, #eafaff, #bdefff 55%, #8cd7ef);
}
.crucible-drop.ready {
  border-color: #75d5c2;
  box-shadow: 0 0 0 8px rgba(117, 213, 194, .18);
}
.crucible-drop.has-result {
  border-style: solid;
  background:
    radial-gradient(circle at 50% 48%, rgba(255,255,255,.92), transparent 26%),
    linear-gradient(180deg, #dff7ff, #89d7f1 58%, #5bb8dd);
}
.crucible-drop.has-match-pair {
  background:
    radial-gradient(circle at 50% 48%, rgba(255,255,255,.94), transparent 26%),
    radial-gradient(circle at 24% 50%, rgba(255,255,255,.54), transparent 20%),
    radial-gradient(circle at 76% 50%, rgba(255,255,255,.54), transparent 20%),
    linear-gradient(180deg, #dff7ff, #89d7f1 58%, #5bb8dd);
}
.crucible-drop.is-revealing {
  border-style: solid;
  border-color: rgba(117, 213, 194, .82);
  box-shadow: 0 0 0 8px rgba(117, 213, 194, .15), inset 0 0 36px rgba(255, 255, 255, .72);
}
.crucible-drop .crucible-pot {
  display: none;
}
.crucible-drop.has-result .crucible-pot,
.crucible-drop.has-result .crucible-bubbles,
.crucible-drop.has-result:not(.has-match-pair) .crucible-slots,
.crucible-drop.is-revealing .crucible-bubbles {
  display: none;
}
.crucible-bubbles {
  position: absolute;
  inset: 25px 30% auto;
  height: 110px;
}
.crucible-bubbles i {
  position: absolute;
  bottom: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .78);
  animation: alchemyBubble 2.2s infinite ease-in;
}
.crucible-bubbles i:nth-child(2) {
  left: 42%;
  width: 15px;
  height: 15px;
  animation-delay: -.7s;
}
.crucible-bubbles i:nth-child(3) {
  right: 3%;
  width: 28px;
  height: 28px;
  animation-delay: -1.4s;
}
.crucible-pot {
  position: absolute;
  left: 50%;
  bottom: 42px;
  width: 230px;
  height: 132px;
  transform: translateX(-50%);
  border-radius: 45% 45% 28px 28px;
  background: linear-gradient(145deg, #161d2b, #35425c 60%, #121722);
  box-shadow: inset 0 -16px rgba(0,0,0,.32), 0 18px 30px rgba(0,0,0,.24);
}
.crucible-pot::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  top: 18px;
  height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle, #95ffe9, #39c7b1 52%, #177e76);
  box-shadow: 0 0 28px rgba(117, 213, 194, .82);
}
.crucible-pot::after {
  content: "";
  position: absolute;
  left: -18px;
  right: -18px;
  top: 35px;
  height: 20px;
  border-radius: 50px;
  background: #101621;
}
.crucible-slots {
  position: relative;
  z-index: 2;
  display: flex;
  align-self: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 0;
}
.alchemy-slot {
  width: 76px;
  height: 76px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255,255,255,.7);
  border-radius: 14px;
  color: #dffef8;
  background: rgba(11, 34, 50, .56);
  backdrop-filter: blur(3px);
}
.alchemy-slot.active {
  cursor: pointer;
}
.alchemy-slot.active:active {
  transform: translateY(2px);
}
.alchemy-slot b {
  color: #fff;
  font-size: 38px;
  text-shadow: 0 0 14px #75d5c2;
}
.alchemy-slot .element-art {
  width: 62px;
  height: 62px;
  border-radius: 15px;
}
.alchemy-slot.reveal-slot {
  pointer-events: none;
  animation-duration: .78s;
  animation-timing-function: cubic-bezier(.18, .82, .22, 1);
  animation-fill-mode: both;
}
.alchemy-slot.reveal-left {
  animation-name: revealLeft;
}
.alchemy-slot.reveal-right {
  animation-name: revealRight;
}
.crucible-drop.has-match-pair .crucible-slots {
  gap: 118px;
  z-index: 3;
}
.alchemy-slot.matched-slot {
  pointer-events: none;
  opacity: .86;
  animation: matchedHold .58s ease-out both;
}
.alchemy-slot.matched-left {
  transform: translateX(-18px) rotate(-4deg);
}
.alchemy-slot.matched-right {
  transform: translateX(18px) rotate(4deg);
}
.alchemy-slot span {
  font-size: 12px;
  font-weight: 900;
  opacity: .72;
}
.crucible-result {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  transform: translate(-50%, -50%);
  color: #213143;
  font-size: 118px;
  line-height: 1;
  font-weight: 1000;
  text-shadow: 0 0 22px rgba(255,255,255,.95), 0 5px 18px rgba(36, 92, 123, .32);
  pointer-events: none;
}
.crucible-result.success-pop {
  animation: alchemyPop .8s cubic-bezier(.2, 1.5, .4, 1);
}
.comment-book {
  display: grid;
  align-content: start;
  gap: 12px;
}
#alchemyComment {
  min-height: 160px;
  margin: 0;
  padding: 14px;
  border-radius: 12px;
  color: #334156;
  background: #fff9e8;
  font-size: 17px;
  line-height: 1.45;
  font-weight: 850;
}
#alchemyComment small {
  display: block;
  margin-top: 10px;
  color: #687086;
  font-size: 14px;
}
.crucible-drop.success {
  animation: crucibleSuccess .78s ease-in-out;
}
.crucible-drop.fizzle {
  animation: crucibleFizzle .56s ease-in-out;
}
@keyframes alchemyBubble {
  from { opacity: 0; transform: translateY(40px) scale(.5); }
  25% { opacity: 1; }
  to { opacity: 0; transform: translateY(-82px) scale(1.3); }
}
@keyframes alchemyPop {
  0% { opacity: .2; transform: scale(.4) rotate(-8deg); }
  58% { opacity: 1; transform: scale(1.18) rotate(3deg); text-shadow: 0 0 24px #75d5c2; }
  100% { transform: scale(1) rotate(0); }
}
@keyframes revealLeft {
  0% { opacity: 1; transform: translateX(0) scale(1); }
  56% { opacity: 1; transform: translateX(-34px) scale(1.08) rotate(-4deg); }
  100% { opacity: .82; transform: translateX(-62px) scale(.92) rotate(-8deg); }
}
@keyframes revealRight {
  0% { opacity: 1; transform: translateX(0) scale(1); }
  56% { opacity: 1; transform: translateX(34px) scale(1.08) rotate(4deg); }
  100% { opacity: .82; transform: translateX(62px) scale(.92) rotate(8deg); }
}
@keyframes matchedHold {
  from { opacity: .28; filter: blur(2px); }
  to { opacity: .86; filter: blur(0); }
}
@keyframes crucibleSuccess {
  40% { box-shadow: 0 0 0 12px rgba(117,213,194,.28), 0 0 40px rgba(117,213,194,.52); filter: saturate(1.35); }
}
@keyframes crucibleFizzle {
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}
@media (max-width: 820px) {
  .playground:has(.alchemy-game) {
    padding: 8px;
  }
  .alchemy-game {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .crucible-panel {
    position: sticky;
    top: 6px;
    z-index: 12;
    order: 1;
    padding: 10px;
    box-shadow: 0 12px 28px rgba(39, 50, 72, .16);
  }
  .element-inventory {
    order: 2;
    padding: 10px;
  }
  .comment-book {
    order: 3;
    padding: 10px;
  }
  .alchemy-tabs {
    margin-right: -10px;
    padding-right: 12px;
    scrollbar-width: none;
  }
  .alchemy-tabs::-webkit-scrollbar {
    display: none;
  }
  .element-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }
  .element-chip {
    min-height: 60px;
    padding: 4px 2px;
  }
  .element-art {
    width: 40px;
    height: 40px;
  }
  .element-chip small {
    font-size: 10px;
  }
  .crucible-drop {
    min-height: 230px;
  }
  .crucible-pot {
    width: 205px;
    height: 112px;
    bottom: 32px;
  }
  .crucible-slots {
    margin-bottom: 0;
  }
  .alchemy-slot {
    width: 66px;
    height: 66px;
  }
  .alchemy-slot .element-art {
    width: 54px;
    height: 54px;
    border-radius: 13px;
  }
  .crucible-drop.has-match-pair .crucible-slots {
    gap: 86px;
  }
  .crucible-result {
    font-size: 88px;
  }
  @keyframes revealLeft {
    0% { opacity: 1; transform: translateX(0) scale(1); }
    56% { opacity: 1; transform: translateX(-24px) scale(1.07) rotate(-4deg); }
    100% { opacity: .82; transform: translateX(-42px) scale(.92) rotate(-8deg); }
  }
  @keyframes revealRight {
    0% { opacity: 1; transform: translateX(0) scale(1); }
    56% { opacity: 1; transform: translateX(24px) scale(1.07) rotate(4deg); }
    100% { opacity: .82; transform: translateX(42px) scale(.92) rotate(8deg); }
  }
  #alchemyComment {
    min-height: 92px;
    font-size: 15px;
  }
}
@media (max-width: 520px) {
  .element-chip {
    flex-basis: 78px;
    min-height: 72px;
  }
  .crucible-result {
    font-size: 80px;
  }
}
@media (min-width: 821px) and (max-width: 1100px) {
  .alchemy-game {
    grid-template-columns: minmax(270px, .9fr) minmax(340px, 1.1fr);
  }
  .crucible-panel {
    order: 1;
    grid-column: 1 / -1;
  }
  .crucible-drop {
    min-height: 260px;
  }
  .element-inventory {
    order: 2;
  }
  .comment-book {
    order: 3;
  }
  .element-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
  .element-chip {
    min-height: 58px;
    padding: 4px 3px;
  }
  .element-art {
    width: 40px;
    height: 40px;
  }
}
@media (orientation: landscape) and (max-height: 820px) and (max-width: 1200px) {
  main {
    padding-top: 8px;
  }
  .play-card:has(.alchemy-game) {
    padding: 10px;
  }
  .play-card:has(.alchemy-game) .top-copy {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 14px;
    text-align: left;
  }
  .play-card:has(.alchemy-game) .cheer {
    font-size: 15px;
  }
  .play-card:has(.alchemy-game) .equation {
    margin: 0;
    font-size: 18px;
    text-align: right;
  }
  .play-card:has(.alchemy-game) .instruction {
    grid-column: 1 / -1;
    min-height: 0;
    margin: 0 0 6px;
    font-size: 14px;
  }
  .playground:has(.alchemy-game) {
    min-height: 0;
    padding: 8px;
  }
  .alchemy-game {
    grid-template-columns: minmax(330px, .9fr) minmax(260px, .7fr);
    grid-template-areas:
      "pot comment"
      "items comment";
    gap: 8px;
  }
  .crucible-panel {
    position: static;
    grid-area: pot;
    padding: 8px;
  }
  .crucible-panel .alchemy-step {
    margin-bottom: 0;
  }
  .crucible-drop {
    min-height: 170px;
    border-radius: 14px;
  }
  .crucible-pot {
    width: 162px;
    height: 86px;
    bottom: 22px;
  }
  .crucible-pot::before {
    left: 16px;
    right: 16px;
    top: 12px;
    height: 28px;
  }
  .crucible-pot::after {
    top: 26px;
  }
  .crucible-slots {
    gap: 6px;
    margin-bottom: 0;
  }
  .alchemy-slot {
    width: 54px;
    height: 54px;
  }
  .alchemy-slot .element-art {
    width: 44px;
    height: 44px;
    border-radius: 11px;
  }
  .crucible-drop.has-match-pair .crucible-slots {
    gap: 72px;
  }
  .alchemy-slot b {
    font-size: 28px;
  }
  .crucible-result {
    font-size: 90px;
  }
  .element-inventory {
    grid-area: items;
    padding: 8px;
  }
  .element-inventory .alchemy-step,
  .comment-book .alchemy-step {
    margin-bottom: 6px;
    font-size: 11px;
  }
  .alchemy-step b {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
  .alchemy-tabs {
    padding-bottom: 5px;
  }
  .alchemy-tabs button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 11px;
  }
  .element-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 5px;
  }
  .element-chip {
    min-height: 52px;
    padding: 4px 2px;
    border-radius: 8px;
  }
  .element-art {
    width: 36px;
    height: 36px;
    border-radius: 9px;
  }
  .element-chip small {
    font-size: 9px;
  }
  .comment-book {
    grid-area: comment;
    padding: 8px;
  }
  #alchemyComment {
    min-height: 110px;
    padding: 10px;
    font-size: 13px;
    line-height: 1.35;
  }
  #alchemyComment small {
    margin-top: 6px;
    font-size: 11px;
  }
  .parent-note:has(+ *) {
    display: none;
  }
}
@media (orientation: landscape) and (max-height: 520px) {
  .alchemy-game {
    grid-template-columns: minmax(300px, 1fr) minmax(220px, .65fr);
  }
  .crucible-drop {
    min-height: 142px;
  }
  .crucible-result {
    font-size: 78px;
  }
  .element-chip {
    min-height: 48px;
  }
  .alchemy-slot .element-art {
    width: 40px;
    height: 40px;
  }
}
.element-grid.is-empty {
  display: block;
}
.element-empty {
  margin: 0;
  padding: 18px 10px;
  color: #687086;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}
