@font-face {
  font-family: "Fredoka";
  src: url("assets/fonts/fredoka-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Fredoka";
  src: url("assets/fonts/fredoka-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  --wm-cream-1: #fff8e6;
  --wm-cream-2: #f6e7c8;
  --wm-wood-1: #c98f5a;
  --wm-wood-2: #8a552c;
  --wm-gold: #f2c141;
  --wm-sage: #879a63;
  --wm-plum: #8d6197;
  --wm-coral: #e98978;
  --wm-ink: #3d3226;
  --wm-font-family: "Fredoka", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wm-touch-min: 48px;
  --wm-control-size: clamp(56px, 6.6vmin, 64px);
  --wm-gap-1: 8px;
  --wm-gap-2: 16px;
  --wm-gap-3: 24px;
  --wm-pad-left: max(12px, env(safe-area-inset-left));
  --wm-pad-right: max(12px, env(safe-area-inset-right));
  --wm-pad-top: max(10px, env(safe-area-inset-top));
  --wm-pad-bottom: max(10px, env(safe-area-inset-bottom));
  --wm-rune-clearance: clamp(58px, 7vmin, 76px);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.wm-shell-root {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  background: var(--wm-cream-2);
  color: var(--wm-text-color, var(--wm-ink));
  font-family: var(--wm-font-family);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.wm-shell-root button {
  font: inherit;
  color: inherit;
}

.wm-opening,
.wm-play,
.wm-overlay,
.wm-error {
  position: absolute;
  inset: 0;
}

.wm-opening {
  overflow: hidden;
  background: #c7dfe8;
}

.wm-intro-picture,
.wm-intro-image,
.wm-scene-picture,
.wm-scene-image {
  display: block;
  width: 100%;
  height: 100%;
}

.wm-intro-image,
.wm-scene-image {
  object-fit: cover;
}

.wm-scene-picture {
  position: absolute;
  inset: 0;
}

.wm-intro-image {
  object-position: 50% 43%;
}

.wm-opening-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(47, 32, 22, 0.38), transparent 25%),
    linear-gradient(0deg, rgba(47, 32, 22, 0.54), transparent 38%);
}

.wm-opening-copy {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding:
    calc(var(--wm-pad-top) + 10px)
    var(--wm-pad-right)
    calc(var(--wm-pad-bottom) + 14px)
    var(--wm-pad-left);
}

.wm-opening-title {
  width: fit-content;
  max-width: min(88%, 760px);
  margin: 0;
  padding: clamp(9px, 1.5vmin, 16px) clamp(20px, 3.5vmin, 38px);
  border: 4px solid var(--wm-wood-2);
  border-radius: 30px 24px 32px 22px;
  background: var(--wm-cream-1);
  box-shadow:
    inset 0 0 0 3px var(--wm-gold),
    0 10px 22px rgba(42, 27, 17, 0.28);
  color: var(--wm-text-color, var(--wm-wood-2));
  font-size: clamp(28px, 5.1vmin, 58px);
  font-weight: 600;
  line-height: 1.08;
  text-align: center;
  text-wrap: balance;
  animation: wm-title-arrive 480ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.wm-opening-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.wm-opening-caption {
  max-width: min(90vw, 620px);
  margin: 0;
  padding: 8px 16px;
  border: 2px solid rgba(255, 248, 230, 0.82);
  border-radius: 18px 22px 18px 24px;
  background: rgba(61, 50, 38, 0.72);
  color: #fffdf7;
  font-size: clamp(15px, 1.9vmin, 21px);
  line-height: 1.25;
  text-align: center;
  text-shadow: 0 1px 2px rgba(20, 14, 10, 0.55);
}

.wm-play-button {
  width: clamp(104px, 17vmin, 164px);
  height: clamp(104px, 17vmin, 164px);
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 10px 14px rgba(35, 22, 14, 0.42));
  transition: transform 120ms ease-out, filter 120ms ease-out;
}

.wm-play-button img,
.wm-icon-button img,
.wm-check-button img,
.wm-icon-action img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wm-play-button:active {
  transform: translateY(3px) scale(0.97);
}

.wm-play {
  overflow: hidden;
  background: #c7dfe8;
}

.wm-scene-image {
  object-position: 50% 52%;
}

.wm-scene-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 248, 230, 0.28), rgba(255, 248, 230, 0.12));
}

.wm-play-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.wm-hud {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: var(--wm-gap-2);
  padding: var(--wm-pad-top) var(--wm-pad-right) 4px var(--wm-pad-left);
}

.wm-controls {
  display: flex;
  flex: 0 0 auto;
  flex-flow: row nowrap;
  gap: var(--wm-gap-1);
}

.wm-icon-button,
.wm-check-button {
  width: var(--wm-control-size);
  height: var(--wm-control-size);
  min-width: 56px;
  min-height: 56px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 4px 5px rgba(61, 38, 18, 0.28));
  transition: transform 120ms ease-out, filter 120ms ease-out;
}

.wm-icon-button:active,
.wm-check-button:active:not(:disabled),
.wm-icon-action:active {
  transform: translateY(2px) scale(0.96);
}

.wm-icon-button:disabled,
.wm-check-button:disabled {
  cursor: default;
  opacity: 0.5;
  filter: grayscale(0.25) drop-shadow(0 3px 4px rgba(61, 38, 18, 0.18));
}

.wm-progress {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.wm-levels,
.wm-stars {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  margin: 0;
  padding: 4px 7px;
  border: 2px solid rgba(138, 85, 44, 0.48);
  border-radius: 22px;
  background: rgba(255, 248, 230, 0.9);
  box-shadow: 0 4px 10px rgba(61, 38, 18, 0.13);
  list-style: none;
}

.wm-level-token,
.wm-star-token {
  width: clamp(29px, 3.9vmin, 43px);
  height: clamp(30px, 4.1vmin, 45px);
}

.wm-level-token img,
.wm-star-token img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wm-level-token {
  opacity: 0.36;
  filter: grayscale(0.72);
  transition: opacity 180ms ease, filter 180ms ease, transform 180ms ease;
}

.wm-level-token.is-current {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(242, 193, 65, 0.68));
  transform: translateY(-1px) scale(1.08);
}

.wm-star-token {
  width: clamp(27px, 3.4vmin, 36px);
  height: clamp(27px, 3.4vmin, 36px);
}

.wm-play-grid {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(110px, 18vw) minmax(0, 1fr) minmax(110px, 18vw);
  align-items: center;
  gap: clamp(8px, 2vmin, 24px);
  min-height: 0;
  padding:
    4px
    var(--wm-pad-right)
    calc(var(--wm-pad-bottom) + 6px)
    var(--wm-pad-left);
}

/* Gameplay characters are decoration; adapter controls beneath them stay tappable. */
.wm-play-grid > .wm-guide-wrap,
.wm-play-grid > .wm-hero-image {
  pointer-events: none;
}

.wm-guide-wrap {
  position: relative;
  display: flex;
  align-self: end;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  padding-bottom: 4px;
}

.wm-guide-image {
  display: block;
  width: min(100%, clamp(94px, 18vmin, 190px));
  height: auto;
  filter: drop-shadow(0 7px 8px rgba(42, 27, 17, 0.24));
}

.wm-speech {
  position: relative;
  z-index: 1;
  align-self: center;
  width: min(100%, 230px);
  margin: 0 0 8px;
  padding: 10px 13px;
  border: 1px solid rgba(138, 85, 44, 0.38);
  border-radius: 999px;
  background: linear-gradient(180deg, #fffaf0, var(--wm-cream-1));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 4px 10px rgba(61, 38, 18, 0.12);
  color: var(--wm-text-color, var(--wm-ink));
  font-size: clamp(13px, 1.8vmin, 18px);
  font-weight: 600;
  line-height: 1.22;
  text-align: center;
}

.wm-guide-wrap {
  flex-direction: column;
}

.wm-board-frame {
  --wm-board-edge: clamp(42px, 5vmin, 50px);

  display: flex;
  flex-direction: column;
  align-self: stretch;
  justify-self: center;
  width: min(100%, 760px);
  min-height: 0;
  margin: clamp(8px, 2vmin, 24px) 0;
  padding: clamp(4px, 1.1vmin, 10px);
  border: var(--wm-board-edge) solid transparent;
  border-image-source: url("assets/images/board-tray.webp");
  border-image-slice: 17% fill;
  border-image-width: var(--wm-board-edge);
  border-image-repeat: round;
  border-radius: 0;
  background: transparent;
  box-shadow: 0 10px 20px rgba(46, 31, 19, 0.17);
}

.wm-board-eyebrow {
  flex: 0 0 auto;
  align-self: flex-end;
  margin: 0 4px 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(61, 50, 38, 0.08);
  color: #665545;
  font-size: clamp(10px, 1.35vmin, 13px);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.wm-board-slot {
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  outline: none;
}

.wm-board-slot img {
  display: block;
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(61, 38, 18, 0.22));
}

.wm-check-wrap {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  min-height: 64px;
  padding-top: 5px;
}

.wm-check-button {
  width: clamp(58px, 8vmin, 74px);
  height: clamp(58px, 8vmin, 74px);
}

.wm-outside-actions {
  display: none;
}

.wm-shell-actions-outside .wm-play-grid {
  grid-template-rows: minmax(0, 1fr) auto;
  row-gap: clamp(4px, 1vmin, 10px);
}

.wm-shell-actions-outside .wm-guide-wrap,
.wm-shell-actions-outside .wm-board-frame,
.wm-shell-actions-outside .wm-hero-image {
  grid-row: 1;
}

.wm-shell-actions-outside .wm-board-frame {
  margin-bottom: 0;
}

.wm-shell-actions-outside .wm-outside-actions:not([hidden]) {
  grid-row: 2;
  grid-column: 2;
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
  min-height: 56px;
}

.wm-outside-actions .wm-check-wrap {
  min-height: 0;
  padding: 0;
}

.wm-secondary-action {
  min-height: 44px;
  white-space: nowrap;
}

.wm-secondary-action:disabled {
  cursor: default;
  opacity: 0.5;
}

.wm-hero-image {
  display: block;
  align-self: end;
  justify-self: center;
  width: min(100%, clamp(100px, 20vmin, 220px));
  height: auto;
  padding-bottom: 4px;
  filter: drop-shadow(0 7px 9px rgba(42, 27, 17, 0.25));
}

.wm-overlay {
  z-index: 40;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding:
    calc(var(--wm-pad-top) + 8px)
    var(--wm-pad-right)
    calc(var(--wm-pad-bottom) + var(--wm-rune-clearance))
    var(--wm-pad-left);
  background: rgba(47, 32, 22, 0.66);
}

.wm-panel {
  position: relative;
  display: grid;
  width: min(94vw, 760px);
  max-height: 100%;
  overflow: hidden;
  border: 4px solid var(--wm-wood-2);
  border-radius: 36px 30px 38px 32px;
  background: var(--wm-cream-1);
  box-shadow:
    inset 0 0 0 3px var(--wm-gold),
    0 24px 48px rgba(30, 19, 12, 0.42);
  color: var(--wm-text-color, var(--wm-ink));
}

.wm-panel-content {
  min-width: 0;
  min-height: 0;
  padding: clamp(18px, 3.2vmin, 32px);
  overflow: auto;
  overscroll-behavior: contain;
  text-align: center;
}

.wm-panel h2 {
  margin: 0 0 8px;
  color: var(--wm-text-color, var(--wm-wood-2));
  font-size: clamp(24px, 3.8vmin, 38px);
  font-weight: 600;
  line-height: 1.1;
}

.wm-panel p {
  max-width: 56ch;
  margin: 0 auto 12px;
  font-size: clamp(14px, 1.9vmin, 18px);
  line-height: 1.42;
}

.wm-pause-panel,
.wm-help-panel {
  grid-template-columns: minmax(150px, 0.72fr) minmax(0, 1.45fr);
}

.wm-panel-art,
.wm-help-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  overflow: hidden;
  border-right: 3px solid rgba(138, 85, 44, 0.28);
  background: #e8d4ae;
}

.wm-panel-character,
.wm-help-character {
  position: relative;
  z-index: 2;
  display: block;
  width: min(86%, 220px);
  height: auto;
  filter: drop-shadow(0 8px 11px rgba(61, 38, 18, 0.24));
}

.wm-panel-feather {
  position: absolute;
  width: 82px;
  height: auto;
  opacity: 0.56;
}

.wm-panel-feather-a {
  top: 9%;
  left: -17px;
  transform: rotate(-26deg);
}

.wm-panel-feather-b {
  right: -17px;
  bottom: 8%;
  transform: rotate(23deg);
}

.wm-level-picker {
  display: grid;
  grid-template-columns: repeat(5, minmax(48px, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.wm-level-choice {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 58px;
  padding: 3px;
  border: 3px solid var(--wm-wood-2);
  border-radius: 18px;
  background: var(--wm-cream-2);
  color: var(--wm-text-color, var(--wm-wood-2));
  cursor: pointer;
  font-size: clamp(16px, 2.2vmin, 21px);
  font-weight: 600;
}

.wm-level-choice img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  opacity: 0.46;
}

.wm-level-choice span {
  position: absolute;
  right: 5px;
  bottom: 2px;
  min-width: 20px;
  padding: 1px 4px;
  border-radius: 999px;
  background: var(--wm-cream-1);
}

.wm-level-choice:active,
.wm-text-button:active,
.wm-icon-action:active {
  transform: translateY(2px) scale(0.98);
}

.wm-action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.wm-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 10px 20px;
  border: 3px solid var(--wm-wood-2);
  border-radius: 18px 22px 18px 22px;
  background: var(--wm-cream-2);
  box-shadow: 0 4px 0 var(--wm-wood-2), 0 7px 12px rgba(61, 38, 18, 0.18);
  color: var(--wm-text-color, var(--wm-wood-2));
  cursor: pointer;
  font-size: clamp(15px, 1.8vmin, 18px);
  font-weight: 600;
}

.wm-text-button.wm-primary {
  background: var(--wm-sage);
  color: #fffdf7;
}

.wm-icon-label img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

/* Optional place-value pause palette. Requires the root opt-in class, so every
   default game and the help/reward/HUD surfaces keep their established styles. */
.wm-shell-pause-place-value [data-overlay="paused"] .wm-pause-panel {
  grid-template-columns: minmax(190px, 0.78fr) minmax(0, 1.35fr);
  border: 2px solid #b9cde9;
  border-radius: 28px;
  background: #fffdf8;
  box-shadow: 0 18px 46px rgba(23, 43, 77, 0.28);
  color: #172b4d;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-panel-art {
  border-right: 2px solid #d5e3f5;
  background: #edf4ff;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-panel-character {
  width: min(92%, 260px);
  max-height: 330px;
  object-fit: contain;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-panel-feather {
  display: none;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-panel-content {
  padding: clamp(18px, 3vmin, 30px);
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-pause-panel h2,
.wm-shell-pause-place-value [data-overlay="paused"] .wm-pause-panel p {
  color: #172b4d;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-level-picker {
  grid-template-columns: repeat(5, minmax(44px, 1fr));
  gap: 8px;
  margin: 16px 0 18px;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-level-choice {
  grid-template-columns: 1fr;
  min-width: 44px;
  min-height: 56px;
  padding: 2px;
  border: 2px solid #c5d8f2;
  border-radius: 14px;
  background: #f4f8ff;
  box-shadow: none;
  color: #172b4d;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-level-choice img {
  grid-area: 1 / 1;
  align-self: start;
  justify-self: start;
  width: 30px;
  height: 30px;
  margin: 2px;
  opacity: 0.2;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-level-choice span {
  position: static;
  grid-area: 1 / 1;
  align-self: center;
  justify-self: center;
  min-width: 0;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-level-choice:hover:not(.is-current) {
  border-color: #a9c5e8;
  background: #edf3ff;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-level-choice.is-current {
  border-color: #1e46b3;
  background: #2855d9;
  color: #fff;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-level-choice.is-current img {
  opacity: 0.42;
  filter: brightness(0) invert(1);
}

.wm-shell-pause-place-value [data-overlay="paused"] :is(
  .wm-level-choice,
  .wm-text-button
):focus-visible {
  outline: 4px solid #172b4d;
  outline-offset: 3px;
  box-shadow: 0 0 0 7px #fffdf8;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-action-row {
  margin-top: 4px;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-text-button {
  min-height: 52px;
  border: 2px solid #cbd3dd;
  border-radius: 14px;
  background: #f4f6f8;
  box-shadow: none;
  color: #172b4d;
  font-size: 17px;
  font-weight: 800;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-text-button.wm-primary {
  min-width: 140px;
  border-color: #1e46b3;
  background: #2855d9;
  color: #fff;
}

.wm-shell-pause-place-value [data-overlay="paused"] .wm-text-button.wm-primary:hover {
  background: #1f49c2;
}

@media (orientation: portrait) {
  .wm-shell-pause-place-value [data-overlay="paused"] .wm-pause-panel {
    grid-template-columns: 1fr;
  }

  .wm-shell-pause-place-value [data-overlay="paused"] .wm-panel-art {
    height: clamp(120px, 18vh, 150px);
    min-height: 120px;
    max-height: 150px;
    border-right: 0;
    border-bottom: 2px solid #d5e3f5;
  }

  .wm-shell-pause-place-value [data-overlay="paused"] .wm-panel-character {
    width: auto;
    height: min(96%, 150px);
    max-width: 92%;
    max-height: 150px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .wm-shell-pause-place-value [data-overlay="paused"] .wm-panel-content {
    padding: 10px 14px;
  }

  .wm-shell-pause-place-value [data-overlay="paused"] .wm-pause-panel h2 {
    font-size: 24px;
  }

  .wm-shell-pause-place-value [data-overlay="paused"] .wm-level-picker {
    margin: 6px 0 8px;
  }
}

.wm-help-panel {
  width: min(94vw, 720px);
  grid-template-rows: minmax(0, 1fr);
}

.wm-help-art {
  min-height: 330px;
}

.wm-help-panel .wm-panel-content {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto auto;
  align-items: stretch;
  justify-content: flex-start;
  overflow: hidden;
}

.wm-help-panel .wm-panel-content > * {
  min-height: 0;
}

.wm-help-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  min-height: 0;
  margin: 0 0 12px;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.wm-help-step {
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 2px solid rgba(138, 85, 44, 0.28);
  border-radius: 16px;
  background: var(--wm-cream-2);
}

.wm-help-step img {
  display: block;
  width: 100%;
  height: 72px;
  margin-bottom: 5px;
  object-fit: contain;
}

.wm-help-step figcaption {
  font-size: clamp(12px, 1.55vmin, 15px);
  font-weight: 600;
  line-height: 1.25;
}

.wm-help-audio {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 12px;
}

.wm-help-panel .wm-panel-content > .wm-help-close {
  align-self: center;
  min-height: 48px;
  min-width: 138px;
  margin-top: 12px;
  background: var(--wm-sage);
}

.wm-reward-panel,
.wm-final-panel {
  width: min(92vw, 670px);
  padding: clamp(18px, 3vmin, 30px);
  text-align: center;
}

.wm-reward-image,
.wm-final-image {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: min(28vh, 220px);
  margin: 4px auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 8px 12px rgba(61, 38, 18, 0.2));
}

.wm-final-panel {
  background: #f8e7b8;
}

.wm-final-image {
  max-height: min(34vh, 270px);
  border-radius: 24px 18px 26px 20px;
}

.wm-icon-action {
  display: inline-grid;
  grid-template-columns: 48px auto;
  align-items: center;
  gap: 8px;
  min-width: 112px;
  min-height: 58px;
  padding: 4px 14px 4px 6px;
  border: 3px solid var(--wm-wood-2);
  border-radius: 999px;
  background: var(--wm-cream-2);
  box-shadow: 0 4px 0 var(--wm-wood-2);
  color: var(--wm-text-color, var(--wm-wood-2));
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
}

.wm-icon-action img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.wm-rune {
  position: fixed;
  z-index: 200;
  left: var(--wm-pad-left);
  bottom: var(--wm-pad-bottom);
  width: clamp(29px, 4.2vmin, 48px);
  height: auto;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 3px 5px rgba(30, 19, 12, 0.38));
}

.wm-shell-root:is([data-state="paused"], [data-state="help"], [data-state="reward"], [data-state="final"]) :is(.wm-hud, .wm-check-wrap, .wm-outside-actions) {
  visibility: hidden;
  pointer-events: none;
}

.wm-error {
  z-index: 120;
  display: grid;
  place-items: center;
  padding: var(--wm-pad-top) var(--wm-pad-right) var(--wm-rune-clearance) var(--wm-pad-left);
  background: #ead9b7;
}

.wm-error-panel {
  width: min(92vw, 620px);
  padding: 28px;
  border: 4px solid #8a552c;
  border-radius: 28px;
  background: #fff8e6;
  box-shadow: 0 14px 30px rgba(61, 38, 18, 0.25);
  text-align: center;
}

.wm-error-panel h2 {
  margin: 0 0 12px;
  color: #713b24;
  font-size: clamp(24px, 4vmin, 38px);
}

.wm-error-panel p {
  margin: 8px 0;
  font-size: 17px;
  line-height: 1.45;
}

.wm-error-detail {
  overflow-wrap: anywhere;
  color: #5d3928;
  font-weight: 600;
}

.wm-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.wm-shell-root :is(button, [tabindex]):focus-visible {
  outline: 3px solid #fffdf7;
  outline-offset: 3px;
  box-shadow:
    0 0 0 6px var(--wm-wood-2),
    0 8px 16px rgba(30, 19, 12, 0.28);
}

.wm-shell-root .wm-board-slot:focus-visible {
  outline: none;
  box-shadow: none;
}

.wm-shell-root .wm-board-frame:has(.wm-board-slot:focus-visible) {
  outline: none;
  filter:
    drop-shadow(0 0 1px rgba(46, 31, 19, 0.95))
    drop-shadow(0 0 3px rgba(255, 253, 247, 0.95));
}

.wm-shell-root ::selection {
  background: var(--wm-gold);
  color: var(--wm-ink);
}

@keyframes wm-title-arrive {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (orientation: portrait) {
  .wm-board-frame {
    --wm-board-edge: clamp(28px, 4.8vmin, 34px);
  }

  .wm-opening-copy {
    padding-top: calc(var(--wm-pad-top) + 18px);
  }

  .wm-opening-title {
    max-width: 94%;
    font-size: clamp(27px, 8.4vmin, 52px);
  }

  .wm-opening-action {
    width: 100%;
  }

  .wm-opening-caption {
    max-width: min(84vw, 520px);
  }

  .wm-hud {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
    padding-top: calc(var(--wm-pad-top) + 2px);
  }

  .wm-controls {
    justify-content: center;
  }

  .wm-progress {
    justify-content: center;
    gap: 8px;
  }

  .wm-levels,
  .wm-stars {
    padding: 3px 5px;
  }

  .wm-level-token {
    width: clamp(27px, 7.1vmin, 40px);
    height: clamp(28px, 7.3vmin, 42px);
  }

  .wm-star-token {
    width: clamp(25px, 6.3vmin, 35px);
    height: clamp(25px, 6.3vmin, 35px);
  }

  .wm-play-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    padding-top: 2px;
    padding-bottom: calc(var(--wm-pad-bottom) + 76px);
  }

  .wm-guide-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    align-self: auto;
    justify-self: center;
    width: min(100%, 520px);
    padding: 0;
  }

  .wm-speech {
    align-self: center;
    width: auto;
    max-width: none;
    margin: 0 4px 0 0;
    font-size: clamp(12px, 3.1vmin, 17px);
  }

  .wm-guide-image {
    width: clamp(72px, 17vmin, 130px);
  }

  .wm-board-frame {
    align-self: stretch;
    width: min(100%, 610px);
    height: 100%;
    max-height: 58vh;
    margin: 0 auto;
  }

  .wm-hero-image {
    position: absolute;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(3px, env(safe-area-inset-bottom));
    width: clamp(70px, 18vmin, 140px);
    max-height: 19vh;
    object-fit: contain;
    object-position: bottom;
  }

  .wm-pause-panel {
    grid-template-columns: 1fr;
  }

  .wm-help-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    height: 100%;
  }

  .wm-panel-art,
  .wm-help-art {
    min-height: 0;
    height: clamp(104px, 18vh, 176px);
    border-right: 0;
    border-bottom: 3px solid rgba(138, 85, 44, 0.28);
  }

  .wm-panel-character,
  .wm-help-character {
    width: auto;
    height: min(98%, 170px);
  }

  .wm-panel-feather {
    width: 60px;
  }

  .wm-panel-content {
    padding: 16px;
  }

  .wm-panel h2 {
    margin-bottom: 5px;
  }

  .wm-panel p {
    margin-bottom: 8px;
  }

  .wm-level-picker {
    gap: 6px;
    margin: 10px 0;
  }

  .wm-level-choice {
    min-height: 54px;
  }

  .wm-level-choice img {
    width: 38px;
    height: 38px;
  }

  .wm-reward-panel,
  .wm-final-panel {
    padding: 16px;
  }
}

@media (min-width: 700px) and (orientation: landscape) {
  :root {
    --wm-control-size: clamp(58px, 6.1vmin, 66px);
  }

  .wm-icon-button {
    width: var(--wm-control-size);
    height: var(--wm-control-size);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  :root {
    --wm-control-size: 56px;
    --wm-rune-clearance: 54px;
  }

  .wm-hud {
    gap: 10px;
    padding-top: max(6px, env(safe-area-inset-top));
  }

  .wm-progress {
    gap: 6px;
  }

  .wm-levels,
  .wm-stars {
    padding: 2px 4px;
  }

  .wm-level-token {
    width: 26px;
    height: 28px;
  }

  .wm-star-token {
    width: 24px;
    height: 24px;
  }

  .wm-play-grid {
    grid-template-columns: minmax(76px, 12vw) minmax(0, 1fr) minmax(76px, 12vw);
    gap: 6px;
    padding-top: 0;
    padding-bottom: calc(var(--wm-pad-bottom) + 2px);
  }

  .wm-speech {
    margin: 0;
    padding: 6px 8px;
    font-size: 11px;
  }

  .wm-guide-image,
  .wm-hero-image {
    width: min(100%, 104px);
  }

  .wm-board-frame {
    --wm-board-edge: clamp(20px, 6vmin, 26px);
    margin: 2px 0;
    padding: 6px;
  }

  .wm-board-eyebrow {
    margin-bottom: 2px;
    font-size: 9px;
  }

  .wm-check-wrap {
    min-height: 56px;
    padding-top: 0;
  }

  .wm-check-button {
    width: 56px;
    height: 56px;
  }

  .wm-overlay {
    padding-top: 6px;
    padding-bottom: calc(var(--wm-pad-bottom) + var(--wm-rune-clearance));
  }

  .wm-panel {
    width: min(96vw, 820px);
  }

  .wm-panel-art,
  .wm-help-art {
    min-height: 0;
  }

  .wm-panel-content {
    padding: 12px 16px;
  }

  .wm-panel h2 {
    margin-bottom: 3px;
    font-size: clamp(20px, 4vmin, 30px);
  }

  .wm-panel p {
    margin-bottom: 5px;
    font-size: 13px;
    line-height: 1.28;
  }

  .wm-level-picker {
    margin: 7px 0;
  }

  .wm-level-choice {
    min-height: 50px;
  }

  .wm-reward-image {
    max-height: 104px;
    margin-bottom: 6px;
  }

  .wm-final-image {
    max-height: 122px;
    margin-bottom: 6px;
  }

  .wm-icon-action {
    min-height: 52px;
  }
}

@media (max-width: 430px) and (orientation: portrait) {
  .wm-opening-title {
    font-size: clamp(27px, 8.9vmin, 38px);
  }

  .wm-controls {
    gap: 8px;
  }

  .wm-levels,
  .wm-stars {
    gap: 1px;
  }

  .wm-progress {
    gap: 5px;
  }

  .wm-play-grid {
    padding-bottom: calc(var(--wm-pad-bottom) + 66px);
  }

  .wm-board-frame {
    max-height: 55vh;
  }

  .wm-hero-image {
    width: 66px;
    max-height: 16vh;
  }

  .wm-panel {
    border-radius: 28px 24px 30px 25px;
  }
}

/* Opt-in scene presentation: the adventure art is the stage and the shared
   board slot, controls, guide, hero, and OK retain their existing behavior. */
.wm-shell-scene {
  background: #0b3546;
}

.wm-shell-scene .wm-play {
  background: #9bdcef;
}

.wm-shell-scene .wm-scene-shade {
  background:
    linear-gradient(180deg, rgba(9, 53, 70, 0.18), transparent 22%),
    linear-gradient(0deg, rgba(9, 53, 70, 0.16), transparent 28%);
}

.wm-shell-scene .wm-play-grid {
  position: relative;
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

.wm-shell-scene .wm-board-frame {
  position: absolute;
  inset: 0;
  display: flex;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  min-height: 0;
  margin: 0 auto;
  padding: 0;
  border: 0;
  border-image: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.wm-shell-scene .wm-board-eyebrow {
  display: none;
}

.wm-shell-scene .wm-board-slot {
  position: absolute;
  inset: 0;
  display: block;
  overflow: visible;
}

.wm-shell-scene .wm-check-wrap {
  position: absolute;
  z-index: 12;
  bottom: clamp(8px, 2.6vh, 22px);
  left: 50%;
  min-height: 0;
  padding: 0;
  transform: translateX(-50%);
}

.wm-shell-scene .wm-guide-wrap {
  position: absolute;
  z-index: 8;
  top: clamp(8px, 2vh, 20px);
  left: max(var(--wm-pad-left), 3%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  align-self: auto;
  justify-self: auto;
  gap: 8px;
  width: min(72%, 680px);
  padding: 0;
}

.wm-shell-scene .wm-speech {
  align-self: center;
  width: auto;
  max-width: none;
  min-height: 64px;
  margin: 0;
  padding: 12px 16px;
  border-color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 248, 230, 0.94);
  box-shadow: 0 5px 13px rgba(9, 53, 70, 0.2);
  font-size: clamp(22px, 2.6vmin, 26px);
  line-height: 1.24;
}

.wm-shell-scene .wm-guide-image {
  width: clamp(180px, 22vmin, 220px);
  filter:
    brightness(1.035)
    drop-shadow(0 0 3px rgba(255, 244, 200, 0.75))
    drop-shadow(0 0 12px rgba(255, 205, 115, 0.35))
    drop-shadow(0 7px 8px rgba(9, 53, 70, 0.3));
}

.wm-shell-scene.wm-shell-guide-top-right .wm-guide-wrap {
  top: clamp(8px, 2vh, 20px);
  right: max(6px, 3%, env(safe-area-inset-right));
  left: auto;
  width: min(62%, 560px);
}

.wm-shell-scene.wm-shell-guide-top-right .wm-guide-image {
  width: clamp(72px, 12vmin, 110px);
}

.wm-shell-scene .wm-hero-image {
  position: absolute;
  z-index: 6;
  right: max(8px, env(safe-area-inset-right));
  bottom: max(4px, env(safe-area-inset-bottom));
  width: clamp(200px, 22vw, 260px);
  max-height: min(40vh, 280px);
  padding: 0;
  object-fit: contain;
  object-position: bottom right;
  filter:
    brightness(1.035)
    drop-shadow(0 0 3px rgba(255, 244, 200, 0.75))
    drop-shadow(0 0 12px rgba(255, 205, 115, 0.35))
    drop-shadow(0 10px 10px rgba(9, 53, 70, 0.3));
}

.wm-shell-hero-adapter .wm-play-grid > .wm-hero-image {
  display: none;
}

.wm-shell-scene .wm-board-frame:has(.wm-board-slot:focus-visible) {
  filter: none;
}

@media (orientation: portrait) {
  .wm-shell-scene .wm-guide-image {
    width: clamp(170px, 24vw, 200px);
  }
}

@media (max-width: 430px) and (orientation: portrait) {
  .wm-shell-scene .wm-guide-wrap {
    top: 6px;
    left: max(6px, env(safe-area-inset-left));
    width: calc(100% - 12px);
    gap: 6px;
  }

  .wm-shell-scene .wm-speech {
    min-height: 56px;
    padding: 10px 12px;
    font-size: 18px;
    line-height: 1.24;
  }

  .wm-shell-scene .wm-guide-image {
    width: clamp(130px, 36vw, 145px);
  }

  .wm-shell-scene .wm-hero-image {
    right: max(2px, env(safe-area-inset-right));
    bottom: max(2px, env(safe-area-inset-bottom));
    width: clamp(140px, 40vw, 170px);
    max-height: min(25vh, 170px);
  }

  .wm-shell-scene .wm-check-wrap {
    bottom: max(10px, env(safe-area-inset-bottom));
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .wm-shell-scene .wm-guide-wrap {
    top: 4px;
    left: max(6px, env(safe-area-inset-left));
    width: min(64%, 560px);
  }

  .wm-shell-scene .wm-speech {
    min-height: 56px;
    padding: 9px 12px;
    font-size: 18px;
    line-height: 1.2;
  }

  .wm-shell-scene .wm-guide-image {
    width: clamp(96px, 13vmin, 110px);
  }

  .wm-shell-scene .wm-hero-image {
    right: max(6px, env(safe-area-inset-right));
    bottom: max(2px, env(safe-area-inset-bottom));
    width: 100px;
    max-height: 112px;
  }

  .wm-shell-scene .wm-check-wrap {
    bottom: max(4px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 430px) and (orientation: portrait) {
  .wm-shell-actions-outside .wm-play-grid {
    row-gap: 4px;
  }

  .wm-shell-actions-outside .wm-outside-actions:not([hidden]) {
    gap: 8px;
  }

  .wm-shell-actions-outside .wm-secondary-action {
    min-height: 44px;
    padding: 8px 12px;
    font-size: 14px;
  }
}

@media (max-height: 640px) and (orientation: landscape) {
  .wm-shell-actions-outside .wm-play-grid {
    row-gap: 4px;
    padding-bottom: 2px;
  }

  .wm-shell-actions-outside .wm-board-frame {
    margin-top: 2px;
  }

  .wm-shell-actions-outside .wm-outside-actions:not([hidden]) {
    min-height: 50px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .wm-shell-actions-outside .wm-board-frame {
    --wm-board-edge: clamp(22px, 4vmin, 32px);
    max-height: none;
    margin: 2px 0 0;
  }
}

@media (orientation: portrait) {
  .wm-shell-actions-outside .wm-play-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 4px;
    padding-bottom: max(2px, env(safe-area-inset-bottom));
  }

  .wm-shell-actions-outside .wm-guide-wrap {
    grid-row: 1;
    grid-column: 1;
    justify-self: center;
    align-self: auto;
  }

  .wm-shell-actions-outside .wm-board-frame {
    grid-row: 2;
    grid-column: 1;
    align-self: stretch;
    justify-self: center;
    height: 100%;
    max-height: none;
    margin: 0 auto;
  }

  .wm-shell-actions-outside .wm-outside-actions:not([hidden]) {
    grid-row: 3;
    grid-column: 1;
    min-height: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wm-opening-title {
    animation: none;
  }

  .wm-level-token,
  .wm-icon-button,
  .wm-check-button,
  .wm-play-button,
  .wm-text-button,
  .wm-level-choice,
  .wm-icon-action {
    transition: none;
  }
}

@media (forced-colors: active) {
  .wm-shell-root :is(button, [tabindex]):focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }

  .wm-shell-root .wm-board-slot:focus-visible {
    outline: none;
    box-shadow: none;
  }

  .wm-shell-root .wm-board-frame:has(.wm-board-slot:focus-visible) {
    outline: 3px solid Highlight;
    outline-offset: 3px;
    box-shadow: none;
    filter: none;
  }

  .wm-board-frame,
  .wm-panel,
  .wm-levels,
  .wm-stars {
    border-color: CanvasText;
  }
}

/* Readability for the small secondary guide is opt-in and scoped to the
   top-right scene placement; framed and left-guide defaults stay untouched. */
.wm-shell-scene.wm-shell-guide-top-right .wm-guide-wrap {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: min(72%, 560px);
}

.wm-shell-scene.wm-shell-guide-top-right .wm-speech {
  width: auto;
  max-width: none;
  min-width: min(100%, 220px);
  min-height: 60px;
  padding: 12px 16px;
  font-size: clamp(22px, 2.6vmin, 26px);
  line-height: 1.24;
}

.wm-shell-scene.wm-shell-guide-top-right .wm-guide-image {
  width: clamp(72px, 12vmin, 110px);
}

@media (max-width: 430px) and (orientation: portrait) {
  .wm-shell-scene.wm-shell-guide-top-right .wm-guide-wrap {
    top: 0;
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 8px;
    width: calc(100% - 12px);
  }

  .wm-shell-scene.wm-shell-guide-top-right .wm-speech {
    min-width: 0;
    min-height: 56px;
    padding: 10px 12px;
    font-size: 18px;
    line-height: 1.2;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .wm-shell-scene.wm-shell-guide-top-right .wm-guide-wrap {
    grid-template-columns: minmax(0, 1fr) 72px;
    gap: 8px;
    width: min(58%, 380px);
  }

  .wm-shell-scene.wm-shell-guide-top-right .wm-speech {
    min-width: 0;
    min-height: 56px;
    padding: 9px 12px;
    font-size: 18px;
    line-height: 1.2;
  }

  .wm-shell-scene.wm-shell-guide-top-right .wm-guide-image {
    width: 72px;
  }
}

/* Opt-in emphasis keeps the seal and its instruction readable together. */
.wm-shell-scene.wm-shell-guide-top-right.wm-shell-character-prominent .wm-guide-wrap {
  align-items: start;
  gap: 10px;
  width: min(78%, 680px);
}

.wm-shell-scene.wm-shell-guide-top-right.wm-shell-character-prominent .wm-speech {
  align-self: start;
}

.wm-shell-scene.wm-shell-guide-top-right.wm-shell-character-prominent .wm-guide-image {
  width: 140px;
  filter:
    brightness(1.04)
    drop-shadow(0 0 2px rgba(255, 249, 228, 0.95))
    drop-shadow(0 0 8px rgba(211, 240, 248, 0.58))
    drop-shadow(0 7px 8px rgba(9, 53, 70, 0.3));
}

@media (max-width: 430px) and (orientation: portrait) {
  .wm-shell-scene.wm-shell-guide-top-right.wm-shell-character-prominent .wm-guide-wrap {
    top: 0;
    right: 6px;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
    width: calc(100% - 12px);
  }

  .wm-shell-scene.wm-shell-guide-top-right.wm-shell-character-prominent .wm-guide-image {
    width: 96px;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .wm-shell-scene.wm-shell-guide-top-right.wm-shell-character-prominent .wm-guide-wrap {
    right: 3%;
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 8px;
    width: min(58%, 380px);
  }

  .wm-shell-scene.wm-shell-guide-top-right.wm-shell-character-prominent .wm-guide-image {
    width: 96px;
  }
}

/* Opt-in character sizing uses the existing art and layout slots. */
.wm-shell-character-large .wm-guide-image {
  width: clamp(128px, 25vmin, 240px);
}

.wm-shell-character-large .wm-hero-image {
  width: clamp(136px, 27vmin, 240px);
}

@media (orientation: portrait) {
  .wm-shell-character-large .wm-guide-wrap {
    grid-template-columns: minmax(0, 1fr);
    min-height: calc(clamp(150px, 22vw, 190px) * 0.94);
    padding-right: 190px;
  }

  .wm-shell-character-large .wm-guide-image {
    position: absolute;
    right: 0;
    bottom: 0;
    width: clamp(150px, 22vw, 190px);
  }

  .wm-shell-character-large .wm-hero-image {
    width: clamp(150px, 23vw, 190px);
    max-height: min(24vh, 190px);
  }
}

@media (max-width: 430px) and (orientation: portrait) {
  .wm-shell-character-large .wm-guide-wrap {
    min-height: 94px;
    padding-right: 112px;
  }

  .wm-shell-character-large .wm-guide-image {
    width: clamp(104px, 27vw, 112px);
  }

  .wm-shell-character-large .wm-hero-image {
    right: max(2px, env(safe-area-inset-right));
    width: clamp(96px, 27vw, 108px);
    max-height: min(20vh, 120px);
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .wm-shell-character-large .wm-guide-image,
  .wm-shell-character-large .wm-hero-image {
    width: min(100%, 104px);
  }

  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-guide-wrap {
    grid-template-columns: minmax(0, 1fr) 104px;
  }
}

/* Scene artwork and outside actions need explicit normal-flow rows so the
   guide reserves space and the existing OK control cannot cover the task. */
.wm-shell-scene.wm-shell-actions-outside .wm-play-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: clamp(4px, 1vmin, 10px);
  min-height: 0;
  padding:
    0
    var(--wm-pad-right)
    max(2px, var(--wm-pad-bottom))
    var(--wm-pad-left);
}

.wm-shell-scene.wm-shell-actions-outside .wm-guide-wrap {
  position: relative;
  inset: auto;
  grid-row: 1;
  grid-column: 1;
  align-self: start;
  justify-self: end;
}

.wm-shell-scene.wm-shell-actions-outside .wm-board-frame {
  position: relative;
  inset: auto;
  display: flex;
  grid-row: 2;
  grid-column: 1;
  align-self: stretch;
  justify-self: stretch;
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-image: none;
  background: transparent;
  box-shadow: none;
}

.wm-shell-scene.wm-shell-actions-outside .wm-board-slot {
  position: relative;
  inset: auto;
  display: grid;
  flex: 1 1 auto;
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.wm-shell-scene.wm-shell-actions-outside .wm-outside-actions:not([hidden]) {
  position: static;
  grid-row: 3;
  grid-column: 1;
  align-self: stretch;
  min-height: 56px;
}

.wm-shell-scene.wm-shell-actions-outside
  .wm-outside-actions
  > .wm-check-wrap {
  position: static;
  inset: auto;
  min-height: 56px;
  padding: 0;
  transform: none;
}

/* 1.3.6 keeps opted-in large characters genuinely readable on portrait
   phones while their normal-flow row protects the HUD and speech. */
@media (max-width: 600px) and (orientation: portrait) {
  .wm-shell-actions-outside.wm-shell-character-large .wm-guide-wrap {
    min-height: 142px;
    padding-right: 150px;
  }

  .wm-shell-actions-outside.wm-shell-character-large .wm-guide-image {
    width: clamp(140px, 36.7vw, 143px);
  }

  .wm-shell-actions-outside.wm-shell-character-large .wm-hero-image {
    width: clamp(140px, 36.7vw, 143px);
    max-height: 143px;
  }

  .wm-shell-actions-outside.wm-shell-character-large
    .wm-outside-actions:not([hidden]) {
    padding-right: 8px;
  }
}

@media (max-width: 340px) and (orientation: portrait) {
  .wm-shell-actions-outside.wm-shell-character-large
    .wm-outside-actions:not([hidden]) {
    padding-right: 72px;
  }
}

/* Opt-in paired header: the existing guide and hero share one row while the
   existing speech moves beneath them. Other shell consumers stay unchanged. */
@media (orientation: portrait) {
  .wm-shell-character-paired .wm-play-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    column-gap: 8px;
    row-gap: 4px;
    padding-bottom: max(2px, env(safe-area-inset-bottom));
  }

  .wm-shell-character-paired .wm-guide-wrap {
    display: contents;
  }

  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-guide-image,
  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-hero-image {
    position: relative;
    inset: auto;
    grid-row: 1;
    align-self: end;
    transform: translateY(6px);
    z-index: 2;
    width: clamp(128px, 25vmin, 190px);
    max-width: 46vw;
    max-height: none;
    padding: 0;
    object-fit: contain;
  }

  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-guide-image {
    grid-column: 1;
    justify-self: end;
  }

  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-hero-image {
    grid-column: 2;
    justify-self: start;
  }

  .wm-shell-character-paired .wm-speech {
    grid-row: 2;
    grid-column: 1 / -1;
    align-self: stretch;
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 8px 12px;
    font-size: 18px;
    line-height: 1.2;
  }

  .wm-shell-character-paired .wm-board-frame {
    grid-row: 3;
    grid-column: 1 / -1;
  }

  .wm-shell-character-paired .wm-outside-actions:not([hidden]) {
    grid-row: 4;
    grid-column: 1 / -1;
  }

  .wm-shell-scene.wm-shell-actions-outside.wm-shell-character-paired
    .wm-play-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    column-gap: 8px;
    row-gap: 4px;
  }

  .wm-shell-scene.wm-shell-actions-outside.wm-shell-character-paired
    .wm-guide-wrap {
    display: contents;
  }

  .wm-shell-scene.wm-shell-actions-outside.wm-shell-character-paired
    .wm-speech {
    grid-row: 2;
    grid-column: 1 / -1;
    align-self: stretch;
    width: 100%;
    min-height: 52px;
    margin: 0;
    padding: 8px 12px;
    font-size: 18px;
    line-height: 1.2;
  }

  .wm-shell-scene.wm-shell-actions-outside.wm-shell-character-paired
    .wm-board-frame {
    grid-row: 3;
    grid-column: 1 / -1;
  }

  .wm-shell-scene.wm-shell-actions-outside.wm-shell-character-paired
    .wm-outside-actions:not([hidden]) {
    grid-row: 4;
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) and (orientation: portrait) {
  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-guide-image,
  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-hero-image {
    width: clamp(145px, 31vw, 160px);
  }
}

@media (max-width: 430px) and (orientation: portrait) {
  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-guide-image,
  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-hero-image {
    width: clamp(145px, 37vw, 151px);
    max-width: 46vw;
    max-height: 143px;
  }
}

/* Short portrait keeps the paired header clear of the approved tray. */
@media (max-width: 600px) and (max-height: 700px) and (orientation: portrait) {
  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-guide-image,
  .wm-shell-actions-outside.wm-shell-character-large.wm-shell-character-paired
    .wm-hero-image {
    width: 90px;
    max-height: 90px;
    transform: none;
  }

  .wm-shell-character-paired .wm-speech,
  .wm-shell-scene.wm-shell-actions-outside.wm-shell-character-paired
    .wm-speech {
    min-height: 44px;
    padding: 3px 10px;
    font-size: 16px;
    line-height: 1.15;
  }
}

/* Opt-in illustrated gameplay: the adapter supplies both characters inside
   the existing board slot, while the shell keeps its assets for every overlay. */
.wm-shell-illustrated-board .wm-play-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  min-height: 0;
  padding:
    4px
    var(--wm-pad-right)
    max(2px, env(safe-area-inset-bottom))
    var(--wm-pad-left);
}

.wm-shell-illustrated-board .wm-play-grid > .wm-guide-wrap,
.wm-shell-illustrated-board .wm-play-grid > .wm-guide-wrap > .wm-speech,
.wm-shell-illustrated-board .wm-play-grid > .wm-hero-image {
  display: none;
}

.wm-shell-illustrated-board .wm-board-frame {
  grid-column: 1;
  grid-row: 1;
  align-self: stretch;
  justify-self: center;
  width: min(100%, 1400px);
  max-width: 1400px;
  height: auto;
  max-height: none;
  min-height: 0;
  margin: 0 auto;
}

.wm-shell-illustrated-board.wm-shell-actions-outside .wm-play-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  row-gap: 4px;
}

.wm-shell-illustrated-board.wm-shell-actions-outside .wm-board-frame {
  grid-row: 1;
  grid-column: 1;
}

.wm-shell-illustrated-board.wm-shell-actions-outside
  .wm-outside-actions:not([hidden]) {
  grid-row: 2;
  grid-column: 1;
  align-self: stretch;
  min-height: 56px;
}
