body.mm-modal-open {
  overflow: hidden;
}

.mm-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba( 0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease-out;
  backdrop-filter: blur(10px);
}

.mm-modal--visible {
  opacity: 1;
  pointer-events: auto;
}

.mm-modal[hidden] {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .mm-modal {
    transition: none;
  }
}

.mm-modal__header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1002;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  padding: 20px 60px 34px;
  background: linear-gradient( to bottom, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.6) 80%, rgba(0, 0, 0, 0) 100% );
  pointer-events: none;
}

.mm-modal__title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mm-font-family, "Hiragino Sans", "Yu Gothic", sans-serif);
}

.mm-modal__title-name {
  font-weight: 900;
  font-size: 48px;
  line-height: 1.2;
  color: #ffffff;
  text-shadow: 0 2px 6px #000000;
}

.mm-modal__close {
  position: absolute;
  top: 0;
  right: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: #fff;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 150ms ease;
}

.mm-modal__close:hover {
  background: var(--mm-land-hover, #e8bd63);
}

.mm-modal__close-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.mm-modal__nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1001;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  cursor: pointer;
  border: none;
  box-shadow: var(--mm-panel-shadow, 0 8px 24px rgba(42, 33, 23, 0.18));
  transition: background-color 150ms ease;
}

.mm-modal__nav:hover {
  background: var(--mm-land-hover, #e8bd63);
}

.mm-modal__nav-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.mm-modal__nav--prev {
  left: 16px;
}

.mm-modal__nav--next {
  right: 16px;
}

.mm-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 104px 0 40px;
  transition: transform 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
    opacity 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (prefers-reduced-motion: reduce) {
  .mm-modal__body {
    transition: none;
  }
}

.mm-modal__grid {
  display: grid;
  grid-template-columns: repeat(2, 420px);
  column-gap: 20px;
  row-gap: 40px;
  justify-content: center;
  max-width: 860px;
  margin: 0 auto;
}

.mm-modal__empty {
  text-align: center;
  font-size: 16px;
  color: #ffffff;
  padding: 80px 16px;
}

.mm-modal__card {
  position: relative;
  width: 420px;
  /* The speech-bubble tail (::after below) is absolutely positioned and
     pokes out past this box's own bottom edge into the .mm-modal__grid
     gap, the same way the old bubble.svg's tail lived in the bottom 20px
     of its 160px-tall artwork - so the box itself only needs to be as
     tall as the bordered body (140px), not 160px. */
  min-height: 150px;
  background: #ffffff;
  padding: 15px;
  box-sizing: border-box;
  font-family: var(--mm-font-family, "Hiragino Sans", "Yu Gothic", sans-serif);
  /* Custom properties are set per-card in JS (see CARD_JITTER_* in
     mm.modal.js) - default to 0 so jitter is a no-op when disabled. */
  transform: rotate(var(--mm-card-jitter-rotate, 0deg)) translate(var(--mm-card-jitter-tx, 0px), var(--mm-card-jitter-ty, 0px));
  filter: drop-shadow( 5px 5px 0px rgba(0,0,0,1));
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mm-modal__card::after {
  /* The tail: a square rotated 45deg, with a border only on the two edges
     that end up facing down-right - those trace the visible "V" of the
     tail, while the rest of the square hides behind the card's own
     matching background. */
  content: '';
  position: absolute;
  left: calc(66% - 10px);
bottom: -20px;
  width: 40px;
  height: 20px;
  background: #ffffff;
  box-sizing: border-box;
  clip-path: polygon(100% 0%, 40% 0%, 0% 100%);
}

.mm-modal__card-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--mm-panel-ink, #2a2117);
  line-height: 1.4;
  font-feature-settings: "palt";
}

.mm-modal__card-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-direction: row-reverse;
  margin-bottom: 3px;
}

.mm-modal__card-img {
  flex: none;
  width: auto;
  height: auto;
  max-width: 100px;
  max-height: 100px;
  /* contain, not cover - the image is shown in full at its own aspect
     ratio (letterboxed within the box via the background below) instead
     of being cropped to fill the square. */
  object-fit: contain;
}

.mm-modal__card-msg {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--mm-panel-ink, #2a2117);
  font-feature-settings: "palt";
}

@media (max-width: 768px) {
  .mm-modal__header {
    padding: 10px 0 30px;
  }

  .mm-modal__title-name {
  font-size: 32px;
}

  .mm-modal__body {
    padding: 76px 16px 32px;
  }

  .mm-modal__grid {
    grid-template-columns: 1fr;
    max-width: 370px;
    row-gap: 30px;
  }

  .mm-modal__card {
    width: 100%;
    max-width: 370px;
    height: auto;
    min-height: 100px;
  }

  .mm-modal__nav {
    width: 40px;
    height: 40px;
  }

  .mm-modal__nav-icon {
    width: 20px;
    height: 20px;
  }

  .mm-modal__nav--prev {
    left: 6px;
  }

  .mm-modal__nav--next {
    right: 6px;
  }
}
