html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#45382e}*{box-sizing:border-box}#activity-root{height:100%;width:100%}
.memory-workspace{height:100%;width:100%;min-width:0;min-height:0;display:grid;grid-template-columns:25% minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);gap:12px;padding:10px 20px;color:#174a7e;font-family:Fredoka,sans-serif;position:relative}
.memory-luvi{grid-row:1/-1;position:relative;min-height:0;pointer-events:none}.memory-actor{position:absolute;bottom:-5%;left:50%;transform:translateX(-50%);width:clamp(300px,38vw,520px);height:clamp(300px,38vw,520px);max-width:none!important;max-height:none!important;object-fit:contain;filter:none!important;pointer-events:none}
.memory-instruction{grid-column:2;align-self:center;justify-self:center;text-align:center;margin:0;padding:7px 16px;background:#fff8e6;border-radius:12px;font-size:clamp(19px,2.3vw,28px);line-height:1.12;text-wrap:balance;max-width:700px}
.memory-cards{grid-column:2;grid-row:2;align-self:center;justify-self:center;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:clamp(8px,1.3vw,17px);width:min(100%,680px);height:100%;max-height:490px;min-height:0;align-content:center}
.memory-cards[data-count="4"]{grid-template-columns:repeat(2,minmax(0,1fr));width:min(100%,430px);max-height:430px}.memory-cards[data-count="8"]{max-height:360px}
.memory-card{border:0;padding:0;position:relative;display:block;min-width:44px;min-height:44px;width:100%;aspect-ratio:1;max-height:100%;background:transparent;border-radius:14px;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent;outline-offset:2px}
.memory-card img{width:100%;height:100%;object-fit:contain;display:block;pointer-events:none;user-select:none;max-height:none!important;filter:none!important}.memory-card:focus-visible{outline:4px solid #174a7e}.memory-card.is-selected{outline:4px solid #174a7e}.memory-card.is-matched{cursor:default}.memory-card.is-matched img{opacity:1}.memory-card.is-matched:after{content:'';position:absolute;right:5%;bottom:5%;width:24%;height:24%;background:url('../shared-shell/assets/images/button-check-normal.webp') center/contain no-repeat;pointer-events:none}
.memory-hand{position:absolute;width:68px;height:86px;object-fit:contain;z-index:8;pointer-events:none;transition:left 500ms ease,top 500ms ease}.memory-hand[hidden]{display:none}
@media(max-width:700px) and (orientation:portrait){.memory-workspace{grid-template-columns:90px minmax(0,1fr);grid-template-rows:100px minmax(0,1fr);gap:4px;padding:0 5px 5px}.memory-luvi{grid-row:1;grid-column:1}.memory-actor{width:178px;height:178px;bottom:-20px}.memory-instruction{grid-row:1;grid-column:2;font-size:19px;padding:8px 10px}.memory-cards{grid-column:1/-1;grid-row:2;gap:7px;width:100%;max-width:430px;height:auto;max-height:none;grid-template-columns:repeat(3,minmax(0,1fr))}.memory-cards[data-count="4"]{width:min(100%,290px);max-height:none}.memory-cards[data-count="8"]{grid-template-columns:repeat(4,minmax(0,1fr));max-height:none}.memory-hand{width:54px;height:68px}}
@media(orientation:landscape) and (max-height:600px){.memory-workspace{grid-template-columns:24% minmax(0,1fr);grid-template-rows:32px minmax(0,1fr);padding:0 12px 3px;gap:4px 12px}.memory-actor{width:280px;height:280px;bottom:-24px}.memory-instruction{font-size:17px;padding:4px 12px}.memory-cards{grid-template-columns:repeat(6,minmax(0,1fr));width:min(100%,610px);height:auto;gap:7px;max-height:none}.memory-cards[data-count="4"]{grid-template-columns:repeat(4,minmax(0,1fr));width:min(100%,420px);max-height:none}.memory-cards[data-count="8"]{grid-template-columns:repeat(4,minmax(0,1fr));width:min(100%,390px);max-height:none}.memory-hand{width:49px;height:62px}}
@media(prefers-reduced-motion:reduce){.memory-hand{transition:none}}

.wm-play .wm-scene-image { filter: saturate(.75) brightness(.95); }

.memory-card:is(.is-selected,.is-matched)::before {
  content: "";
  position: absolute;
  inset: 0 13.25%;
  border: 2px solid #be8a62;
  border-radius: clamp(5px, 1vw, 13px);
  background: #fff3de;
  box-shadow: 0 3px 6px #5b302140;
}

.memory-card:is(.is-selected,.is-matched) img {
  position: absolute;
  inset: 10% 19%;
  width: 62%;
  height: 80%;
  max-width: none;
}

.memory-card.is-selected { outline: none; }
.memory-card.is-selected::before { border-color: #85354d; box-shadow: 0 0 0 2px #85354d; }
.memory-card:focus-visible { outline: 3px solid #174a7e; }
.memory-card.is-matched::after { right: 12%; bottom: 3%; width: 21%; height: 21%; }

@media (max-width: 700px) and (orientation: portrait) {
  .memory-workspace {
    --guide-height: clamp(100px, 31vw, 150px);
    grid-template-columns: calc(var(--guide-height) * .77) minmax(0,1fr);
    grid-template-rows: var(--guide-height) minmax(0,1fr);
  }
  .memory-actor {
    top: 50%;
    bottom: auto;
    width: calc(var(--guide-height) * 1.36);
    height: calc(var(--guide-height) * 1.36);
    transform: translate(-50%,-58%);
  }
  .memory-actor[src$="character-luvi.webp"] {
    width: var(--guide-height);
    height: var(--guide-height);
    transform: translate(-50%,-50%);
  }
}

@media (max-width: 700px) and (orientation: portrait) and (min-height: 700px) {
  .wm-shell-illustrated-board.wm-shell-actions-outside .wm-play-grid {
    container-type: size;
    grid-template-rows: auto auto minmax(0,1fr);
  }
  .wm-shell-illustrated-board.wm-shell-actions-outside .wm-board-frame {
    height: min(calc(100cqh - 76px), 652px);
  }
  .wm-shell-illustrated-board.wm-shell-actions-outside .wm-board-frame:has(.memory-cards[data-count="4"]) {
    height: min(calc(100cqh - 76px), calc(153px + 65vw));
  }
  .wm-shell-illustrated-board.wm-shell-actions-outside .wm-board-frame:has(.memory-cards[data-count="8"]) {
    height: min(calc(100cqh - 76px), calc(145px + 55vw));
  }
}

.memory-cards[data-count="6"] { grid-template-columns: repeat(3,minmax(0,1fr)); }
.memory-cards[data-count="10"] { grid-template-columns: repeat(5,minmax(0,1fr)); }
@media (max-width: 700px) and (orientation: portrait) and (min-height: 700px) {
  .wm-shell-illustrated-board.wm-shell-actions-outside .wm-board-frame:has(.memory-cards[data-count="6"], .memory-cards[data-count="10"]) {
    height: min(calc(100cqh - 76px), calc(145px + 55vw));
  }
}
