/* Shared Rules overlay; independent of the game's board. */
.game-rules-overlay[hidden] { display: none; }
.game-rules-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(15, 23, 42, .83); padding: 0;
  display: flex; align-items: stretch; justify-content: center;
}
.game-rules-dialog {
  box-sizing: border-box; width: min(100%, 850px); height: 100%;
  background: #fff; color: #26364d; padding: clamp(16px, 4vw, 32px);
  overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 18px;
}
.game-rules-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.game-rules-heading h2 { margin: 0; }
.game-rules-heading button { width: auto; flex-shrink: 0; }
.game-rules-content { flex: 1; line-height: 1.55; }
.game-rules-content h3 { margin: 22px 0 8px; }
.game-rules-content p { margin: 7px 0 12px; }
.game-rules-content ul { padding-left: 22px; }
.game-rules-content li { margin: 6px 0; }
.game-rules-content .rules-settings { padding: 14px 18px; border-radius: 10px; background: #edf2f7; }
.game-rules-dialog > button:last-child { align-self: stretch; }
#roomGameRulesButton { width: auto; margin: 12px 0 4px; }
@media (min-width: 850px) { .game-rules-overlay { padding: 18px; } .game-rules-dialog { border-radius: 14px; height: 100%; max-height: calc(100vh - 36px); } }
