html:has(.game-overlay[open]) { overflow: hidden; }

dialog.game-overlay {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: fit-content;
  max-width: min(28rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  margin: auto;
  padding: .4rem;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #f8f1df;
  text-align: start;
}

.game-overlay[open] {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  column-gap: .72rem;
  align-items: start;
}

/* Keep the masonry or foliage visible through the message, even on a bright scene. */
dialog.game-overlay::backdrop {
  background: radial-gradient(ellipse min(32rem, 98vw) 12rem at center, #101917d9, #101917aa 38%, #10191740 72%, transparent);
  backdrop-filter: blur(3px);
  mask-image: radial-gradient(ellipse min(34rem, 105vw) 14rem at center, black 28%, transparent);
}

.game-overlay-mark {
  width: 1.2rem;
  height: 1.2rem;
  margin-top: .45rem;
  color: #dfc38e;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-overlay .message-orbit { transform-origin: 12px 12px; animation: message-turn 2.4s linear infinite; }
.game-overlay .message-seal, .game-overlay[data-game-overlay="error"] .message-orbit { display: none; }
.game-overlay[data-game-overlay="error"] .message-seal { display: inline; }

.game-overlay h2 {
  margin: 0;
  outline: none;
  color: inherit;
  font: 550 clamp(1.65rem, 4.8vw, 2rem)/1.12 Cormorant, Georgia, serif;
  text-wrap: balance;
}
.game-overlay p, .game-overlay-actions { grid-column: 2; }
.game-overlay p {
  margin: .3rem 0 0;
  color: #eee4ce;
  font: 500 .875rem/1.5 Manrope, 'Segoe UI', sans-serif;
  overflow-wrap: anywhere;
}
.game-overlay [hidden] { display: none; }
.game-overlay-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.35rem;
  margin-top: .35rem;
}
.game-overlay-actions button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: #e2d9c5;
  font: 600 1.13rem/1.2 Cormorant, Georgia, serif;
  text-decoration: none;
  cursor: pointer;
}
.game-overlay-actions [data-primary] { --mark-size: 5px; color: #f6dfb6; }
.game-overlay-actions button:hover { color: #fff3d9; }
.game-overlay-actions button:focus-visible {
  outline: none;
  color: #fff3d9;
  text-decoration: underline;
  text-underline-offset: .28em;
}

@keyframes message-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .game-overlay .message-orbit { animation: none; } }
@media (forced-colors: active) {
  dialog.game-overlay { background: Canvas; color: CanvasText; border: 1px solid CanvasText; }
  .game-overlay-actions button:focus-visible { outline: 1px solid Highlight; outline-offset: 1px; }
}
