/* AGENT_TARGET: moonbeam-mirror-styles — standalone mirror-order gameplay */

.moonbeam-modal {
  position: fixed;
  inset: 0;
  z-index: 10166;
  display: grid;
  place-items: center;
  padding: 16px;
}

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

.moonbeam-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(42, 34, 67, 0.66);
  backdrop-filter: blur(4px);
}

.moonbeam-shell {
  position: relative;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: auto auto minmax(0, auto) auto auto auto;
  gap: 10px;
  width: min(1120px, calc(100vw - 24px));
  max-height: min(92vh, 900px);
  overflow: auto;
  padding: 14px;
  border: 3px solid #d7a436;
  border-radius: 12px;
  background: #fffdf7;
  color: #2e2c50;
  box-shadow: 0 24px 70px rgba(42, 34, 67, 0.36);
}

.moonbeam-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  min-width: 44px;
  min-height: 44px;
  border: 2px solid rgba(46, 44, 80, 0.16);
  border-radius: 8px;
  background: #fff;
  color: #6b2c59;
  font: 900 24px/1 Arial, sans-serif;
  cursor: pointer;
}

.moonbeam-heading {
  width: min(720px, calc(100% - 56px));
  padding: 2px 4px 0;
}

.moonbeam-heading span,
.moonbeam-card small {
  display: block;
  color: #6b2c59;
  font:
    900 12px/1.2 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.moonbeam-heading h2 {
  margin: 3px 0;
  color: #2e2c50;
  font:
    900 25px/1.08 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
  letter-spacing: 0;
}

.moonbeam-heading p,
.moonbeam-card span,
.moonbeam-proof span,
.moonbeam-finale span,
.moonbeam-clue span,
.moonbeam-nudge {
  margin: 0;
  color: #62606f;
  font: 800 13px/1.34 "Trebuchet MS", Arial, sans-serif;
}

.moonbeam-clue {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 2px solid rgba(107, 44, 89, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff8ea, #f1f8ff);
}

.moonbeam-clue strong {
  color: #6b2c59;
  font:
    900 16px/1.1 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
}

.moonbeam-clue span {
  grid-column: 1;
}

.moonbeam-path-tokens {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.moonbeam-path-tokens span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(46, 44, 80, 0.14);
  border-radius: 999px;
  background: #fff;
  color: #6d6980;
  font:
    900 13px/1 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
}

.moonbeam-path-tokens span.current {
  border-color: #d7a436;
  background: #fff1ad;
  color: #6b2c59;
}

.moonbeam-path-tokens span.done,
.moonbeam-path-tokens.complete span {
  border-color: #baf4d2;
  background: #e7ffe9;
  color: #23633a;
}

.moonbeam-stage {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  max-height: min(52dvh, 520px);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #2e2c50;
  box-shadow: 0 14px 34px rgba(42, 34, 67, 0.24);
}

.moonbeam-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

.moonbeam-panel-target {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: clamp(42px, 6.5vw, 72px);
  height: clamp(42px, 6.5vw, 72px);
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 255, 255, 0.84);
  border-radius: 999px;
  background: rgba(255, 253, 247, 0.78);
  color: #2e2c50;
  font:
    900 20px/1 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
  box-shadow: 0 10px 22px rgba(42, 34, 67, 0.25);
  cursor: pointer;
}

.moonbeam-panel-target span {
  display: block;
  line-height: 1;
}

.moonbeam-panel-target small {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: #2e2c50;
  color: #fff;
  font:
    900 10px/1 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
}

.moonbeam-panel-target.current {
  border-color: #ffdf8d;
  background: #fff1ad;
  box-shadow:
    0 0 0 5px rgba(255, 255, 255, 0.55),
    0 12px 24px rgba(42, 34, 67, 0.24);
}

.moonbeam-panel-target.chosen {
  border-color: #baf4d2;
  background: #e7ffe9;
  color: #23633a;
}

.moonbeam-panel-target:disabled {
  opacity: 0.58;
  cursor: default;
}

.moonbeam-panel-target.chosen:disabled {
  opacity: 1;
}

.moonbeam-nudge {
  min-height: 22px;
  padding: 0 4px;
  color: #23633a;
  font-weight: 900;
}

.moonbeam-tray {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.moonbeam-card,
.moonbeam-proof {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 2px solid rgba(46, 44, 80, 0.14);
  border-radius: 8px;
  background: #fff;
}

.moonbeam-card.current,
.moonbeam-proof.current {
  border-color: #d7a436;
  background: #fff8ea;
}

.moonbeam-card.chosen,
.moonbeam-proof.chosen {
  background: #edf9f4;
}

.moonbeam-card strong,
.moonbeam-proof strong {
  color: #2e2c50;
  font:
    900 14px/1.12 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
}

.moonbeam-proof {
  min-height: 72px;
  text-align: left;
  cursor: pointer;
}

.moonbeam-proof:disabled {
  opacity: 0.62;
  cursor: default;
}

.moonbeam-finale {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 14px;
  align-items: center;
  padding: 12px;
  border: 2px solid rgba(46, 44, 80, 0.13);
  border-radius: 8px;
  background: #fff8ea;
}

.moonbeam-finale strong {
  color: #6b2c59;
  font:
    900 18px/1.1 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
}

.moonbeam-finale button {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-width: 128px;
  min-height: 46px;
  border: 2px solid rgba(46, 44, 80, 0.16);
  border-radius: 8px;
  background: #fff;
  color: #2e2c50;
  font:
    900 12px/1.1 "Arial Rounded MT Bold",
    "Trebuchet MS",
    Arial,
    sans-serif;
  cursor: pointer;
}

.moonbeam-close:focus-visible,
.moonbeam-panel-target:focus-visible,
.moonbeam-proof:focus-visible,
.moonbeam-finale button:focus-visible {
  outline: 3px solid rgba(107, 44, 89, 0.72);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .moonbeam-modal {
    align-items: start;
    padding: 8px;
  }
  .moonbeam-shell {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 10px;
    border-radius: 10px;
  }
  .moonbeam-heading {
    width: calc(100% - 56px);
  }
  .moonbeam-heading h2 {
    font-size: 21px;
  }
  .moonbeam-panel-target {
    width: 48px;
    height: 48px;
    border-width: 2px;
    font-size: 16px;
  }
  .moonbeam-panel-target small {
    min-width: 18px;
    height: 18px;
    font-size: 9px;
  }
  .moonbeam-clue {
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 8px 9px;
  }
  .moonbeam-path-tokens {
    grid-column: 1;
    grid-row: auto;
    justify-content: flex-start;
  }
  .moonbeam-path-tokens span {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }
  .moonbeam-tray,
  .moonbeam-finale {
    grid-template-columns: 1fr;
  }
  .moonbeam-finale button {
    grid-row: auto;
    grid-column: auto;
    width: 100%;
  }
}
